diff --git a/.cursor/rules/studio-ui.mdc b/.cursor/rules/studio-ui.mdc index 67db62a0ba1..c6f48881525 100644 --- a/.cursor/rules/studio-ui.mdc +++ b/.cursor/rules/studio-ui.mdc @@ -128,6 +128,7 @@ export const MyPageComponent = () => ( - Use our `_Shadcn_` form primitives from `ui` and prefer `FormItemLayout` with layout="flex-row-reverse" for most controls (see `apps/studio/components/interfaces/Settings/Integrations/GithubIntegration/GitHubIntegrationConnectionForm.tsx`). - Keep imports from `ui` with `_Shadcn_` suffixes. - Forms should generally be wrapped in a Card unless specified +- If the submit button is outside the form, add a new variable named formId outside the component, and set it as property id on the form element and formId on the button. ### Example (single field) @@ -143,6 +144,8 @@ const profileSchema = z.object({ username: z.string().min(2, 'Username must be at least 2 characters'), }) +const formId = `profile-form` + export function ProfileForm() { const form = useForm>({ resolver: zodResolver(profileSchema), @@ -200,6 +203,11 @@ export function ProfileForm() { - Use a sheet when needing to reveal more complicated forms or information relating to an object and context switching away to a new page would be disruptive e.g. we list auth providers, clicking an auth provider opens a sheet with information about that provider and a form to enable, user can close sheet to go back to providers list +## React Query + +- When doing a mutation, always use the mutate function. Always use onSuccess and onError with a toast.success and toast.error. +- Use mutateAsync only if the mutation is part of multiple async actions. Wrap the mutateAsync call with try/catch block and add toast.success and toast.error. + ## Tables - Use the generic ui table components for most tables diff --git a/apps/design-system/README.md b/apps/design-system/README.md index 12706027761..959e3631802 100644 --- a/apps/design-system/README.md +++ b/apps/design-system/README.md @@ -58,13 +58,13 @@ The design system _references_ components rather than housing them. That’s an With that out of the way, there are several parts of this design system that need to be manually updated after components have been added or removed (from documentation). These include: - `config/docs.ts`: list of components in the sidebar -- `content/docs`: where the actual component documentation `.mdx` file lives +- `content/docs`: the actual component documentation - `registry/examples.ts`: list of example components -- `registry/default/example`: where the actual example component(s) live -- `registry/charts.ts`: Chart components -- `registry/fragments.ts`: Fragment components +- `registry/default/example`: the actual example components +- `registry/charts.ts`: chart components +- `registry/fragments.ts`: fragment components -You will need to rebuild the design system’s registry each time a new example component is added. In other words: whenever a new file enters `registry`, it needs to be rebuilt. You can do that via: +You may need to rebuild the design system’s registry. You can do that via: ```bash cd apps/design-system diff --git a/apps/design-system/__registry__/index.tsx b/apps/design-system/__registry__/index.tsx index 005d8278801..cead6b766f8 100644 --- a/apps/design-system/__registry__/index.tsx +++ b/apps/design-system/__registry__/index.tsx @@ -2293,6 +2293,39 @@ export const Index: Record = { subcategory: "undefined", chunks: [] }, + "empty-state-missing-route": { + name: "empty-state-missing-route", + type: "components:example", + registryDependencies: undefined, + component: React.lazy(() => import("@/registry/default/example/empty-state-missing-route")), + source: "", + files: ["registry/default/example/empty-state-missing-route.tsx"], + category: "undefined", + subcategory: "undefined", + chunks: [] + }, + "empty-state-zero-items-table": { + name: "empty-state-zero-items-table", + type: "components:example", + registryDependencies: undefined, + component: React.lazy(() => import("@/registry/default/example/empty-state-zero-items-table")), + source: "", + files: ["registry/default/example/empty-state-zero-items-table.tsx"], + category: "undefined", + subcategory: "undefined", + chunks: [] + }, + "empty-state-initial-state": { + name: "empty-state-initial-state", + type: "components:example", + registryDependencies: undefined, + component: React.lazy(() => import("@/registry/default/example/empty-state-initial-state")), + source: "", + files: ["registry/default/example/empty-state-initial-state.tsx"], + category: "undefined", + subcategory: "undefined", + chunks: [] + }, "chart-area-axes": { name: "chart-area-axes", type: "components:block", diff --git a/apps/design-system/config/docs.ts b/apps/design-system/config/docs.ts index 35407e0b433..ec78bcd99ca 100644 --- a/apps/design-system/config/docs.ts +++ b/apps/design-system/config/docs.ts @@ -6,28 +6,6 @@ interface DocsConfig { } export const docsConfig: DocsConfig = { - // mainNav: [ - // { - // title: 'Documentation', - // href: '/docs', - // }, - // { - // title: 'Components', - // href: '/docs/components/accordion', - // }, - // { - // title: 'Themes', - // href: '/themes', - // }, - // { - // title: 'Examples', - // href: '/examples', - // }, - // { - // title: 'Blocks', - // href: '/blocks', - // }, - // ], sidebarNav: [ { title: 'Getting Started', @@ -77,6 +55,11 @@ export const docsConfig: DocsConfig = { href: '/docs/ui-patterns/navigation', items: [], }, + { + title: 'Empty States', + href: '/docs/ui-patterns/empty-states', + items: [], + }, ], }, { diff --git a/apps/design-system/content/docs/ui-patterns/empty-states.mdx b/apps/design-system/content/docs/ui-patterns/empty-states.mdx new file mode 100644 index 00000000000..876f5020a0e --- /dev/null +++ b/apps/design-system/content/docs/ui-patterns/empty-states.mdx @@ -0,0 +1,38 @@ +--- +title: Empty states +description: Convey the absence of data and provide clear instruction for what to do about it. +--- + +At a minimum, empty states convey the fact that there is nothing to list, perform, or display on the current page. They should also provide a clear call to action for the user to take. + +## Missing route + +Users may accidentally navigate to a non-existent dynamic route, such as a non-existent bucket in [Storage](https://supabase.com/dashboard/project/_/storage) or a non-existent table in the [Table Editor](https://supabase.com/dashboard/project/_/editor). In these cases, follow the pattern of a centered [Admonition](../fragments/admonition) as shown below.. + + + +## Zero results + +Tabular information without results—or perhaps no data to begin with—should have an empty state that matches the larger presentation. + +For instance, a [Table](../components/table) may just display a single row just like it would if it had data. Dulling the TableHead text color and removing the TableCell hover state can further reinforce the lack of usable data. + + + +The treatment for other layouts, such as the list of users in [Authentication](https://supabase.com/dashboard/project/_/auth/users), should match their own general styling. + +## Initial state + +Perhaps the user has not yet created any data yet. They might be a feature for the first time. In these cases, the empty state should provide the briefest information about the lack of data, putting more focus on the value proposition and primary action. + + + +Keep in mind that this empty state will likely appear after a visual loading state. Consider layout shift and button placement during and after the transition. + +## Components + +There is not yet a shared empty state UI component. The context and needs for each placement differ enough to warrant custom components for each placement. That said, we should aim to make these as consistent as possible over time. See the below examples that might share common logic in a future centralized component. + +## External references + +- [_Empty States_ on GitHub Primer](https://primer.style/product/ui-patterns/empty-states/) diff --git a/apps/design-system/next.config.mjs b/apps/design-system/next.config.mjs index 2280b564d29..2c3beb53dca 100644 --- a/apps/design-system/next.config.mjs +++ b/apps/design-system/next.config.mjs @@ -26,16 +26,27 @@ const nextConfig = { return [ ...(BASE_PATH.length ? [ - { - source: '/', - destination: BASE_PATH, - basePath: false, - permanent: false, - }, - ] + { + source: '/', + destination: BASE_PATH, + basePath: false, + permanent: false, + }, + ] : []), ] }, + // Turbopack configuration to handle .md files with raw-loader + // This mirrors the webpack configuration added by withContentlayer + // and ensures both bundlers can process content files properly + turbopack: { + rules: { + '*.md': { + loaders: ['raw-loader'], + as: '*.js', + }, + }, + }, } export default withContentlayer(nextConfig) diff --git a/apps/design-system/package.json b/apps/design-system/package.json index c6fc32cdbdd..928d7cc74dc 100644 --- a/apps/design-system/package.json +++ b/apps/design-system/package.json @@ -29,6 +29,7 @@ "next-contentlayer2": "0.4.6", "next-themes": "^0.3.0", "react": "catalog:", + "react-day-picker": "^9.11.1", "react-docgen": "^7.0.3", "react-dom": "catalog:", "react-hook-form": "^7.45.0", @@ -53,8 +54,8 @@ "@types/lodash.template": "4.5.0", "@types/react": "catalog:", "@types/react-dom": "catalog:", - "config": "workspace:^", "concurrently": "^8.2.2", + "config": "workspace:^", "mdast-util-toc": "^6.1.1", "postcss": "^8.5.3", "rimraf": "^4.1.3", diff --git a/apps/design-system/registry/default/example/date-picker-demo.tsx b/apps/design-system/registry/default/example/date-picker-demo.tsx index c4424bc6aba..ebe91815100 100644 --- a/apps/design-system/registry/default/example/date-picker-demo.tsx +++ b/apps/design-system/registry/default/example/date-picker-demo.tsx @@ -1,13 +1,17 @@ 'use client' -import * as React from 'react' import { format } from 'date-fns' import { Calendar as CalendarIcon } from 'lucide-react' +import * as React from 'react' import { cn } from '@/lib/utils' -import { Button } from 'ui' -import { Calendar } from 'ui' -import { Popover_Shadcn_, PopoverContent_Shadcn_, PopoverTrigger_Shadcn_ } from 'ui' +import { + Button, + Calendar, + Popover_Shadcn_, + PopoverContent_Shadcn_, + PopoverTrigger_Shadcn_, +} from 'ui' export default function DatePickerDemo() { const [date, setDate] = React.useState() @@ -21,8 +25,8 @@ export default function DatePickerDemo() { 'w-[280px] justify-start text-left font-normal', !date && 'text-muted-foreground' )} + icon={} > - {date ? format(date, 'PPP') : Pick a date} diff --git a/apps/design-system/registry/default/example/date-picker-form.tsx b/apps/design-system/registry/default/example/date-picker-form.tsx index dc3270acb69..53e7ebc1293 100644 --- a/apps/design-system/registry/default/example/date-picker-form.tsx +++ b/apps/design-system/registry/default/example/date-picker-form.tsx @@ -62,9 +62,9 @@ export default function DatePickerForm() { 'w-[240px] pl-3 text-left font-normal', !field.value && 'text-muted-foreground' )} + icon={} > {field.value ? format(field.value, 'PPP') : Pick a date} - diff --git a/apps/design-system/registry/default/example/date-picker-with-presets.tsx b/apps/design-system/registry/default/example/date-picker-with-presets.tsx index 41dec91c019..d9ff1090e26 100644 --- a/apps/design-system/registry/default/example/date-picker-with-presets.tsx +++ b/apps/design-system/registry/default/example/date-picker-with-presets.tsx @@ -1,14 +1,16 @@ 'use client' -import * as React from 'react' import { addDays, format } from 'date-fns' import { Calendar as CalendarIcon } from 'lucide-react' +import * as React from 'react' import { cn } from '@/lib/utils' -import { Button } from 'ui' -import { Calendar } from 'ui' -import { Popover_Shadcn_, PopoverContent_Shadcn_, PopoverTrigger_Shadcn_ } from 'ui' import { + Button, + Calendar, + Popover_Shadcn_, + PopoverContent_Shadcn_, + PopoverTrigger_Shadcn_, Select_Shadcn_, SelectContent_Shadcn_, SelectItem_Shadcn_, @@ -28,8 +30,8 @@ export default function DatePickerWithPresets() { 'w-[280px] justify-start text-left font-normal', !date && 'text-muted-foreground' )} + icon={} > - {date ? format(date, 'PPP') : Pick a date} diff --git a/apps/design-system/registry/default/example/date-picker-with-range.tsx b/apps/design-system/registry/default/example/date-picker-with-range.tsx index 15bf3c13d09..9cbde727e3c 100644 --- a/apps/design-system/registry/default/example/date-picker-with-range.tsx +++ b/apps/design-system/registry/default/example/date-picker-with-range.tsx @@ -1,14 +1,18 @@ 'use client' -import * as React from 'react' import { addDays, format } from 'date-fns' import { Calendar as CalendarIcon } from 'lucide-react' -// @ts-expect-error +import * as React from 'react' import { DateRange } from 'react-day-picker' + import { cn } from '@/lib/utils' -import { Button } from 'ui' -import { Calendar } from 'ui' -import { Popover_Shadcn_, PopoverContent_Shadcn_, PopoverTrigger_Shadcn_ } from 'ui' +import { + Button, + Calendar, + Popover_Shadcn_, + PopoverContent_Shadcn_, + PopoverTrigger_Shadcn_, +} from 'ui' export default function DatePickerWithRange({ className }: React.HTMLAttributes) { const [date, setDate] = React.useState({ @@ -27,8 +31,8 @@ export default function DatePickerWithRange({ className }: React.HTMLAttributes< 'w-[300px] justify-start text-left font-normal', !date && 'text-muted-foreground' )} + icon={} > - {date?.from ? ( date.to ? ( <> diff --git a/apps/design-system/registry/default/example/empty-state-initial-state.tsx b/apps/design-system/registry/default/example/empty-state-initial-state.tsx new file mode 100644 index 00000000000..0c0db657166 --- /dev/null +++ b/apps/design-system/registry/default/example/empty-state-initial-state.tsx @@ -0,0 +1,22 @@ +import { Button } from 'ui' +import { Plus } from 'lucide-react' +import { BucketAdd } from 'icons' + +export default function EmptyStateInitialState() { + return ( + + ) +} diff --git a/apps/design-system/registry/default/example/empty-state-missing-route.tsx b/apps/design-system/registry/default/example/empty-state-missing-route.tsx new file mode 100644 index 00000000000..fca36ca0fd0 --- /dev/null +++ b/apps/design-system/registry/default/example/empty-state-missing-route.tsx @@ -0,0 +1,22 @@ +import { Admonition } from 'ui-patterns/admonition' +import Link from 'next/link' +import { Button } from 'ui' + +const bucketId = 'user_avatars' + +export default function EmptyStateMissingRoute() { + return ( +
+ + + +
+ ) +} diff --git a/apps/design-system/registry/default/example/empty-state-zero-items-table.tsx b/apps/design-system/registry/default/example/empty-state-zero-items-table.tsx new file mode 100644 index 00000000000..67949539b13 --- /dev/null +++ b/apps/design-system/registry/default/example/empty-state-zero-items-table.tsx @@ -0,0 +1,25 @@ +import { Card, Table, TableBody, TableHead, TableHeader, TableRow, TableCell } from 'ui' + +export default function EmptyStateZeroItemsTable() { + return ( + + + + + Table name + Date created + + + + + + +

No tables yet

+

Connect a table from your database

+
+
+
+
+
+ ) +} diff --git a/apps/design-system/registry/examples.ts b/apps/design-system/registry/examples.ts index b47de24fed5..622605d6896 100644 --- a/apps/design-system/registry/examples.ts +++ b/apps/design-system/registry/examples.ts @@ -1263,4 +1263,19 @@ export const examples: Registry = [ type: 'components:example', files: ['example/logs-bar-chart.tsx'], }, + { + name: 'empty-state-missing-route', + type: 'components:example', + files: ['example/empty-state-missing-route.tsx'], + }, + { + name: 'empty-state-zero-items-table', + type: 'components:example', + files: ['example/empty-state-zero-items-table.tsx'], + }, + { + name: 'empty-state-initial-state', + type: 'components:example', + files: ['example/empty-state-initial-state.tsx'], + }, ] diff --git a/apps/docs/content/_partials/postgres_installation.mdx b/apps/docs/content/_partials/postgres_installation.mdx index 82e62070161..a116934ecdd 100644 --- a/apps/docs/content/_partials/postgres_installation.mdx +++ b/apps/docs/content/_partials/postgres_installation.mdx @@ -25,7 +25,7 @@ Add the Postgres binary to your system PATH. - In Control Panel, under the Advanced tab of System Properties, click Environment Variables. Edit the Path variable by adding the path the SQL binary you just installed. + In Control Panel, under the Advanced tab of System Properties, click Environment Variables. Edit the Path variable by adding the path to the SQL binary you just installed. The path will look something like this, though it may differ slightly depending on your installed version: diff --git a/apps/docs/content/guides/auth/auth-email-templates.mdx b/apps/docs/content/guides/auth/auth-email-templates.mdx index 8f23b52a284..7731d4f990a 100644 --- a/apps/docs/content/guides/auth/auth-email-templates.mdx +++ b/apps/docs/content/guides/auth/auth-email-templates.mdx @@ -71,20 +71,34 @@ For mobile applications, you might need to link or redirect to a specific page w Certain email providers may have spam detection or other security features that prefetch URL links from incoming emails (e.g. [Safe Links in Microsoft Defender for Office 365](https://learn.microsoft.com/en-us/microsoft-365/security/office-365-security/safe-links-about?view=o365-worldwide)). In this scenario, the `{{ .ConfirmationURL }}` sent will be consumed instantly which leads to a "Token has expired or is invalid" error. -To guard against this: +To guard against this there are the options below: -- Use an email OTP instead by including `{{ .Token }}` in the email template. -- Create your own custom email link to redirect the user to a page where they can click on a button to confirm the action. - For example, you can include the following in your email template: +**Option 1** - ```html - Confirm your signup - - ``` +- Use an email OTP instead by including `{{ .Token }}` in the email template +- Create your own custom email link to redirect the user to a page where they can enter with their email and token to login - The user should be brought to a page on your site where they can confirm the action by clicking a button. - The button should contain the actual confirmation link which can be obtained from parsing the `confirmation_url={{ .ConfirmationURL }}` query parameter in the URL. +```html +Confirm your signup +``` + +- Log them in by verifying the OTP token value with their email e.g. with [`supabase.auth.verifyOtp`](/docs/reference/javascript/auth-verifyotp) show below + +```ts +const { data, error } = await supabase.auth.verifyOtp({ email, token, type: 'email' }) +``` + +**Option 2** + +- Create your own custom email link to redirect the user to a page where they can click on a button to confirm the action + +```html +Confirm your signup +``` + +- The button should contain the actual confirmation link which can be obtained from parsing the `confirmation_url={{ .ConfirmationURL }}` query parameter in the URL. ### Email tracking diff --git a/apps/docs/content/guides/auth/auth-identity-linking.mdx b/apps/docs/content/guides/auth/auth-identity-linking.mdx index fe950304c1d..774e84a11b0 100644 --- a/apps/docs/content/guides/auth/auth-identity-linking.mdx +++ b/apps/docs/content/guides/auth/auth-identity-linking.mdx @@ -108,7 +108,7 @@ For native mobile applications, you can link an identity using an ID token obtai const idToken = 'ID_TOKEN_FROM_GOOGLE' const accessToken = 'ACCESS_TOKEN_FROM_GOOGLE' -const { data, error } = await supabase.auth.linkIdentityWithIdToken({ +const { data, error } = await supabase.auth.linkIdentity({ provider: 'google', token: idToken, access_token: accessToken, diff --git a/apps/docs/content/guides/auth/enterprise-sso/auth-sso-saml.mdx b/apps/docs/content/guides/auth/enterprise-sso/auth-sso-saml.mdx index f6ed8713600..44392bc35cc 100644 --- a/apps/docs/content/guides/auth/enterprise-sso/auth-sso-saml.mdx +++ b/apps/docs/content/guides/auth/enterprise-sso/auth-sso-saml.mdx @@ -481,3 +481,13 @@ export const GET: RequestHandler = async ({ url, locals }) => { + +### Why doesn't IdP-initiated SAML flow work with PKCE, and what's the alternative? + +Traditional IdP-initiated SAML flows aren't compatible with PKCE (Proof Key for Code Exchange) because PKCE requires a `code_challenge` and `code_verifier` that are generated when your application initiates the authentication flow. In IdP-initiated flows, Supabase receives an unsolicited response without this information, causing the code exchange step to fail. + +To achieve the same user experience while maintaining PKCE security, you can implement a "bookmark app" approach: + +Create an endpoint in your application (for example, `https://your-app.com/auth/saml-init`) that initiates the SAML flow using `signInWithSSO`. Then create a bookmark or linked application in your IdP that points to this endpoint. When users access the bookmark app, it triggers a secure SP-initiated flow. + +This approach supports custom SAML assertions and lets you embed the link anywhere in your application. diff --git a/apps/docs/content/guides/auth/server-side/advanced-guide.mdx b/apps/docs/content/guides/auth/server-side/advanced-guide.mdx index 536b92ddd08..58a6626e036 100644 --- a/apps/docs/content/guides/auth/server-side/advanced-guide.mdx +++ b/apps/docs/content/guides/auth/server-side/advanced-guide.mdx @@ -50,7 +50,7 @@ When you receive this error on the server-side, try to defer rendering to the br The `Max-Age` or `Expires` cookie parameters only control whether the browser sends the value to the server. Since a refresh token represents the long-lived authentication session of the user on that browser, setting a short `Max-Age` or `Expires` parameter on the cookies only results in a degraded user experience. -The only way to ensure that a user has logged out or their session has ended is to get the user's details with `getUser()`. +The only way to ensure that a user has logged out or their session has ended is to get the user's details with `getUser()`. The `getClaims()` method only checks local JWT validation (signature and expiration), but it doesn't verify with the auth server whether the session is still valid or if the user has logged out server-side. ### What should I use for the `SameSite` property? diff --git a/apps/docs/content/guides/auth/social-login/auth-google.mdx b/apps/docs/content/guides/auth/social-login/auth-google.mdx index 023aa782b00..fea520c5c2d 100644 --- a/apps/docs/content/guides/auth/social-login/auth-google.mdx +++ b/apps/docs/content/guides/auth/social-login/auth-google.mdx @@ -443,13 +443,13 @@ export default OneTapComponent -Unlike the OAuth flow which requires the use of a web browser, the native Sign in with Google flow on Android uses the [operating system's built-in functionalities](https://developers.google.com/android/reference/com/google/android/gms/auth/api/identity/package-summary) to prompt the user for consent. Note that native sign-in has been rebranded as _One Tap sign-in on Android_ by Google, which you should not confuse with _One Tap sign in for web_, as mentioned below. +Unlike the OAuth flow which requires the use of a web browser, the native Sign in with Google flow on Android uses the [Credential Manager library](https://developer.android.com/identity/sign-in/credential-manager-siwg) to prompt the user for consent. -When the user provides consent, Google issues an identity token (commonly abbreviated as ID token) that is then sent to your project's Supabase Auth server. When valid, a new user session is started by issuing an access and refresh token from Supabase Auth. +When the user provides consent, Google issues an identity token (commonly abbreviated as ID token) that you then send to your project's Supabase Auth server. When valid, a new user session is started by issuing an access and refresh token from Supabase Auth. By default, Supabase Auth implements nonce validation during the authentication flow. This can be disabled in production under `Authentication > Providers > Google > Skip Nonce Check` in the Dashboard, or when developing locally by setting `auth.external..skip_nonce_check`. Only disable this if your client libraries cannot properly handle nonce verification. -When working with Expo, you can use the [`react-native-google-signin/google-signin` library](https://github.com/react-native-google-signin/google-signin#expo-installation) library to obtain an ID token that you can pass to supabase-js [`signInWithIdToken` method](/docs/reference/javascript/auth-signinwithidtoken). +When working with Expo, you can use the [`@react-native-google-signin/google-signin` library](https://github.com/react-native-google-signin/google-signin#expo-installation) to obtain an ID token that you can pass to supabase-js [`signInWithIdToken` method](/docs/reference/javascript/auth-signinwithidtoken). Follow the [Expo installation docs](https://react-native-google-signin.github.io/docs/setting-up/expo) for installation and configuration instructions. See the [supabase-js reference](/docs/reference/javascript/initializing?example=react-native-options-async-storage) for instructions on initializing the supabase-js client in React Native. @@ -463,7 +463,6 @@ import { supabase } from '../utils/supabase' export default function () { GoogleSignin.configure({ - scopes: ['https://www.googleapis.com/auth/drive.readonly'], webClientId: 'YOUR CLIENT ID FROM GOOGLE CONSOLE', }) @@ -474,20 +473,16 @@ export default function () { onPress={async () => { try { await GoogleSignin.hasPlayServices() - const userInfo = await GoogleSignin.signIn() - if (userInfo.data.idToken) { + const response = await GoogleSignin.signIn() + if (isSuccessResponse(response)) { const { data, error } = await supabase.auth.signInWithIdToken({ provider: 'google', - token: userInfo.data.idToken, + token: response.data.idToken, }) console.log(error, data) - } else { - throw new Error('no ID token present!') } } catch (error: any) { - if (error.code === statusCodes.SIGN_IN_CANCELLED) { - // user cancelled the login flow - } else if (error.code === statusCodes.IN_PROGRESS) { + if (error.code === statusCodes.IN_PROGRESS) { // operation (e.g. sign in) is in progress already } else if (error.code === statusCodes.PLAY_SERVICES_NOT_AVAILABLE) { // play services not available or outdated diff --git a/apps/docs/content/guides/database/connecting-to-postgres.mdx b/apps/docs/content/guides/database/connecting-to-postgres.mdx index 45cd80cc50a..81dd4e67cca 100644 --- a/apps/docs/content/guides/database/connecting-to-postgres.mdx +++ b/apps/docs/content/guides/database/connecting-to-postgres.mdx @@ -11,8 +11,8 @@ How you connect to your database depends on where you're connecting from: - For frontend applications, use the [Data API](#data-apis-and-client-libraries) - For Postgres clients, use a connection string - For single sessions (for example, database GUIs) or Postgres native commands (for example, using client applications like [pg_dump](https://www.postgresql.org/docs/current/app-pgdump.html) or specifying connections for [replication](/docs/guides/database/postgres/setup-replication-external)) use the [direct connection string](#direct-connection) if your environment supports IPv6 - - For persistent clients, and support for both IPv4 and IPv6, use [Supavisor session mode](#supavisor-session-mode) - - For temporary clients (for example, serverless or edge functions) use [Supavisor transaction mode](#supavisor-transaction-mode) + - For persistent clients, and support for both IPv4 and IPv6, use [pooler session mode](#pooler-session-mode) + - For temporary clients (for example, serverless or edge functions) use [pooler transaction mode](#pooler-transaction-mode) ## Quickstarts @@ -74,18 +74,18 @@ Direct connections use IPv6 by default. If your environment doesn't support IPv6 The connection string looks like this: ``` -postgresql://postgres:[YOUR-PASSWORD]@db.apbkobhfnmcqqzqeeqss.supabase.co:5432/postgres +postgresql://postgres:[YOUR-PASSWORD]@db.abcdefghijklmnopqrst.supabase.co:5432/postgres ``` Get your project's direct connection string from your project dashboard by clicking [Connect](/dashboard/project/_?showConnect=true). -## Shared pooler +## Poolers -Every Supabase project includes a free, shared connection pooler. This is ideal for persistent servers when IPv6 is not supported. +Every Supabase project includes a connection pooler. This is ideal for persistent servers when IPv6 is not supported. -### Supavisor session mode +### Pooler session mode -The session mode connection string connects to your Postgres instance via a proxy. +The session mode connection string connects to your Postgres instance via a proxy. This is only recommended as an alternative to a Direct Connection, when connecting via an IPv4 network. The connection string looks like this: @@ -95,7 +95,7 @@ postgres://postgres.apbkobhfnmcqqzqeeqss:[YOUR-PASSWORD]@aws-0-[REGION].pooler.s Get your project's Session pooler connection string from your project dashboard by clicking [Connect](/dashboard/project/_?showConnect=true&method=session). -### Supavisor transaction mode +### Pooler transaction mode The transaction mode connection string connects to your Postgres instance via a proxy which serves as a connection pooler. This is ideal for serverless or edge functions, which require many transient connections. @@ -108,7 +108,7 @@ Transaction mode does not support [prepared statements](https://postgresql.org/d The connection string looks like this: ``` -postgres://postgres.apbkobhfnmcqqzqeeqss:[YOUR-PASSWORD]@aws-0-[REGION].pooler.supabase.com:6543/postgres +postgres://postgres:[YOUR-PASSWORD]@db.abcdefghijklmnopqrst.supabase.co:6543/postgres ``` Get your project's Transaction pooler connection string from your project dashboard by clicking [Connect](/dashboard/project/_?showConnect=true&method=transaction). diff --git a/apps/docs/content/guides/deployment/shared-responsibility-model.mdx b/apps/docs/content/guides/deployment/shared-responsibility-model.mdx index 02280bab1d1..cdd5be9300b 100644 --- a/apps/docs/content/guides/deployment/shared-responsibility-model.mdx +++ b/apps/docs/content/guides/deployment/shared-responsibility-model.mdx @@ -97,7 +97,6 @@ You can use Supabase to store and process Protected Health Information (PHI). Yo - Turning on [SSL Enforcement](/docs/guides/platform/ssl-enforcement). - Enabling [Network Restrictions](/docs/guides/platform/network-restrictions). - Complying with encryption requirements in the HIPAA Security Rule. Data is encrypted at rest and in transit by Supabase. You can consider encrypting the data at your application layer. -- Not using [Edge functions](/docs/guides/functions) to process PHI. - Not storing PHI in [public Storage buckets](/docs/guides/storage/buckets/fundamentals#public-buckets). - Not [transferring projects](/docs/guides/platform/project-transfer) to a non-HIPAA organization. diff --git a/apps/docs/content/guides/functions/websockets.mdx b/apps/docs/content/guides/functions/websockets.mdx index e4d15d7ae9d..d9ae931bc8a 100644 --- a/apps/docs/content/guides/functions/websockets.mdx +++ b/apps/docs/content/guides/functions/websockets.mdx @@ -155,7 +155,7 @@ Deno.serve((req) => { return new Response('Auth token not provided', { status: 403 }) } - const { error, data } = await supabase.auth.getUser(jwt) + const { error, data } = await supabase.auth.getClaims() if (error) { console.error(error) @@ -210,8 +210,7 @@ Deno.serve((req) => { return new Response('Auth token not provided', { status: 403 }) } - const { error, data } = await supabase.auth.getUser(jwt) - + const { error, data } = await supabase.auth.getClaims() if (error) { console.error(error) return new Response('Invalid token provided', { status: 403 }) diff --git a/apps/docs/content/guides/local-development/cli/testing-and-linting.mdx b/apps/docs/content/guides/local-development/cli/testing-and-linting.mdx index 0d0abc5f641..5246f956484 100644 --- a/apps/docs/content/guides/local-development/cli/testing-and-linting.mdx +++ b/apps/docs/content/guides/local-development/cli/testing-and-linting.mdx @@ -28,7 +28,7 @@ Our friends at [Basejump](https://usebasejump.com/) have created a useful set of ### Running database tests in CI -Use our GitHub Action to [automate your database tests](/docs/guides/cli/github-action/testing#testing-your-database). +Use our GitHub Action to [automate your database tests](/docs/guides/deployment/ci/testing). ## Testing your Edge Functions diff --git a/apps/docs/content/guides/platform/regions.mdx b/apps/docs/content/guides/platform/regions.mdx index 594e3f80cbf..fc46be89e6b 100644 --- a/apps/docs/content/guides/platform/regions.mdx +++ b/apps/docs/content/guides/platform/regions.mdx @@ -1,18 +1,19 @@ --- title: Available regions -subtitle: Spin up Supabase projects in our global regions --- -The following regions are available for your Supabase projects. +Each Supabase project is deployed to one primary region. Choose the location closest to your users for the best performance. -## Smart region selection +## General regions -Smart Region Selection is a feature that allows you to select from a list of broader regions. Optimizations are made to ensure that the selected region has compute capacity availability. +For most projects, we recommend choosing a general region. Supabase will deploy your project to an available AWS region within that area based on current infrastructure capacity. -Currently, smart region selection is not available for read replicas and project-related operations via the management API. +Note: General regions aren’t yet supported for read replicas or management via the API. -## AWS +## Specific regions + +If you prefer, you can choose an exact AWS region for your project. diff --git a/apps/docs/content/guides/realtime/broadcast.mdx b/apps/docs/content/guides/realtime/broadcast.mdx index 7e3c667c7f7..1623beb441b 100644 --- a/apps/docs/content/guides/realtime/broadcast.mdx +++ b/apps/docs/content/guides/realtime/broadcast.mdx @@ -6,6 +6,27 @@ description: 'Send low-latency messages using the client libs, REST, or your Dat You can use Realtime Broadcast to send low-latency messages between users. Messages can be sent using the client libraries, REST APIs, or directly from your database. +## How Broadcast works + +The way Broadcast works changes based on the channel you are using: + +- From REST API will receive an HTTP request which then will be sent via WebSocket to connected clients +- From Client libraries we have an established WebSocket connection and we use that to send a message to the server which then will be sent via WebSocket to connected clients +- From Database we add a new entry to `realtime.messages` where we have logical replication set to listen for changes which then will be sent via WebSocket to connected clients + + + +The public flag (the last argument in `realtime.send(payload, event, topic, is_private))` only affects who can subscribe to the topic not who can read messages from the database. + +- Public (false) → Anyone can subscribe to that topic without authentication +- Private (true) → Only authenticated clients can subscribe to that topic + +However, regardless of whether it's public or private, the Realtime service connects to your database as the authenticated Supabase Admin role. + + + +For Authorization we do insert a message and try to read it and then we it back as way to verify that the RLS policies set by the user are being respected by the user joining the channel but this messages won't be sent to the user. You can read more about it in the [Authorization](/docs/guides/realtime/authorization) docs + ## Subscribe to messages You can use the Supabase client libraries to receive Broadcast messages. @@ -384,6 +405,7 @@ You can use the Supabase client libraries to send Broadcast messages. {/* supa-mdx-lint-disable-next-line Rule001HeadingCase */} + ### Broadcast from the Database @@ -411,6 +433,14 @@ select ); ``` + + +The realtime.send function in the database includes a flag that determines whether the broadcast is private or public, and client channels also have the same configuration. For broadcasts to work correctly, these settings must match a public broadcast will only reach public channels, and a private broadcast will only reach private ones. + +By default, all database broadcasts are private, meaning clients must authenticate to receive them. If the database sends a public message but the client subscribes to a private channel, the message won't be delivered since private channels only accept signed, authenticated messages. + + + It's a common use case to broadcast messages when a record is created, updated, or deleted. We provide a helper function specific to this use case, `realtime.broadcast_changes()`. For more details, check out the [Subscribing to Database Changes](/docs/guides/realtime/subscribing-to-database-changes) guide. ### Broadcast using the REST API diff --git a/apps/docs/content/troubleshooting/converted-github-account-to-organisation---lost-supabase-account-access-5wsE_1.mdx b/apps/docs/content/troubleshooting/converted-github-account-to-organisation---lost-supabase-account-access-5wsE_1.mdx index 6a2fbd47015..ed8ae7d401d 100644 --- a/apps/docs/content/troubleshooting/converted-github-account-to-organisation---lost-supabase-account-access-5wsE_1.mdx +++ b/apps/docs/content/troubleshooting/converted-github-account-to-organisation---lost-supabase-account-access-5wsE_1.mdx @@ -1,5 +1,5 @@ --- -title = "Converted GitHub account to organization - Lost Supabase account access" +title = "Converted GitHub account to organization / GitHub Account was deleted - Lost Supabase account access" github_url = "https://github.com/orgs/supabase/discussions/21101" date_created = "2024-02-08T01:39:25+00:00" topics = [ "auth" ] @@ -9,4 +9,6 @@ database_id = "94c6e33b-cc05-49b3-b010-7480f8dde843" [Converting](https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-your-personal-account/converting-a-user-into-an-organization) your GitHub account to a [GitHub organization](https://docs.github.com/en/get-started/learning-about-github/types-of-github-accounts#organization-accounts) will cause you to lose access to all other accounts using GitHub sign-ins. -However, Supabase can help you transfer ownership of an existing organization on your account by inviting a new owner to your organization. This new user will need to have a different email from the previous one, and you will need to email support@supabase.com with that new email as well to confirm that you own the email address. +If possible, create a new GitHub account using the **same email** as the previous GitHub account that was turned into a Organization or that was deleted. Once you sign in with that newly created account, you should have access to the old account. You can then invite any new account to have access to the Organization and Projects as needed. + +If that is not possible, Supabase can help you transfer ownership of an existing organization on your account by inviting a new owner to your organization. This new user will need to have a different email from the previous one, and you will need to email support@supabase.com with that new email as well to confirm that you own the email address. diff --git a/apps/docs/content/troubleshooting/dashboard-errors-when-managing-users-N1ls4A.mdx b/apps/docs/content/troubleshooting/dashboard-errors-when-managing-users-N1ls4A.mdx index 174f021b7e1..12bd167584f 100644 --- a/apps/docs/content/troubleshooting/dashboard-errors-when-managing-users-N1ls4A.mdx +++ b/apps/docs/content/troubleshooting/dashboard-errors-when-managing-users-N1ls4A.mdx @@ -1,8 +1,8 @@ --- -title = "Dashboard errors when managing users" +title = "Errors when creating / updating / deleting users" github_url = "https://github.com/orgs/supabase/discussions/21247" date_created = "2024-02-14T04:26:37+00:00" -topics = [ "auth", "studio" ] +topics = [ "auth", "database", "studio" ] keywords = [ "users" ] database_id = "c5d8260b-c17a-4f6c-ab20-801f953f6c94" @@ -13,49 +13,108 @@ sdk = [ "auth-signup" ] message = "Failed to send magic link: failed to make magiclink request: Error sending magic link" [[errors]] -message = "Failed to delete user: Database error deleting user" - -[[errors]] -message = "Failed to create user: Database error creating new user" +http_status_code = 500 +code = "unexpected_failure" +message = "Database error saving new user" [[errors]] http_status_code = 500 -message = "Database error saving new user" +code = "unexpected_failure" +message = "Failed to create user" + +[[errors]] +http_status_code = 500 +code = "unexpected_failure" +message = "Database error creating new user" + +[[errors]] +http_status_code = 500 +code = "unexpected_failure" +message = "Failed to delete user" + +[[errors]] +http_status_code = 500 +code = "unexpected_failure" +message = "Database error deleting user" + +[[errors]] +http_status_code = 500 +code = "unexpected_failure" +message = "Error updating user" + +[[errors]] +http_status_code = 500 +code = "unexpected_failure" +message = "Database error updating user" + --- -## PROBLEM +These error are normal a side effect of issues in your custom user management logic. This can cause errors that return HTTP `500` status codes with a of code `unexpected_failure` and one of the following error messages -### Receiving the following or _similar_ error messages in the Dashboard when managing users. +- Failed to create user: Database error creating new user +- Failed to update user: Error updating user +- Failed to delete user: Database error deleting user +- Database error updating user +- Database error saving new user -> ... Database error -> ... Error sending +## Debugging this error - - - +- [Auth logs](/dashboard/project/_/logs/auth-logs): as the error relates to [Auth](/docs/guides/auth) users +- [Postgres logs](/dashboard/project/_/logs/postgres-logs): for raw error logs related to database -### Or, receiving a comparable 500 error from the Auth REST API: +## Common causes of this error: -> Database error ... +- Trigger/trigger function setup on the `auth.users` table +- A constraint on the `auth.users` table which isn't being met +- You are using Prisma and it has broken all the permissions on the `auth.users` table -Screenshot 2024-02-13 at 10 59 17 PM +## Example error messages -## SOLUTION 1 (trigger related) +Use the hints provided in the error message to fix issues in your custom user management logic. -Check if the auth schema contains any triggers in the [Dashboard's trigger section](/dashboard/project/_/database/triggers). Remove all triggers by dropping their functions with a CASCADE modifier: +**Trigger/trigger function related error messages** - [Solution for trigger related issues](#solution-trigger) + +``` +"error":"error update user`s last_sign_in field: ERROR: permission denied for table profiles (SQLSTATE 42501)" +``` + +**Constraint related error message** - [Solution for constraint related issues](#solution-constraint) + +``` +ERROR: 23503: update or delete on table "users" violates foreign key constraint "profiles_id_fkey" on table "profiles" +DETAIL: Key (id)=(7428a53c-75b7-4531-9ae9-1567d9c4ac0a) is still referenced from table "profiles". +``` + +**Missing column** + +``` +ERROR: column \"updated_at\" of relation \"profiles\" does not exist (SQLSTATE 42703) +``` + +**Broken search path / incorrect name** - [42P01 related solution](docs/guides/troubleshooting/resolving-42p01-relation-does-not-exist-error-W4_9-V) + +``` +failed to close prepared statement: ERROR: current transaction is aborted, commands ignored until end of transaction block (SQLSTATE 25P02): ERROR: relation \"public.profiles\" does not exist (SQLSTATE 42P01) +``` + +--- + +## Solution for constraint related issues [#solution-constraint] + +- Check for foreign/primary key relationship between the `auth.users` table and another table +- Then ALTER the [behavior](https://stackoverflow.com/questions/5383612/setting-up-table-relations-what-do-cascade-set-null-and-restrict-do) of the relationship and recreate it with a less [restrictive constraint](https://stackoverflow.com/questions/3359329/how-to-change-the-foreign-key-referential-action-behavior). +- If this is related to deleting records, review the [Cascade Deletes doc](/docs/guides/database/postgres/cascade-deletes) for possible approaches (e.g. using `CASCADE` / `SET NULL`) + +--- + +## Solution for trigger related issues [#solution-trigger] + +Supabase Auth uses your project's database to store user data. It relies on the `auth` schema, and Supabase restricts access to the `auth` schema to prevent unintended custom changes that could break the functionality of the Auth service. + +Check if the `auth` schema contains any triggers in the [Dashboard's trigger section](/dashboard/project/_/database/triggers?schema=auth). + +1. Identify related functions using `security invoker` from the [Dashboard's function section](/dashboard/project/_/database/functions) +2. Remove all triggers by dropping their functions with a CASCADE modifier shown below (This command still works because the `postgres` role has the ownership of the function, and the `CASCADE` clause will drop the trigger indirectly.) ```sql DROP FUNCTION () CASCADE; @@ -64,8 +123,10 @@ DROP FUNCTION () CASCADE; -- DROP TRIGGER on auth.; ``` -Then recreate the functions with a [security definer](/docs/guides/database/functions#security-definer-vs-invoker) modifier before recreating the triggers. +3. Recreate the functions with a [security definer](/docs/guides/database/functions#security-definer-vs-invoker) modifier +4. Recreate the triggers +**Example function and trigger using security definer** The [SQL Editor](/dashboard/project/_/sql/) contains a template for [User Management](/dashboard/project/_/sql/quickstarts). Within it, there is a working example of how to setup triggers with security definer that may be worth referencing: ```sql @@ -81,7 +142,9 @@ create table profiles ( ); create function public.handle_new_user() -returns trigger as $$ +returns trigger +set search_path = '' +as $$ begin insert into public.profiles (id, full_name, avatar_url) values (new.id, new.raw_user_meta_data->>'full_name', new.raw_user_meta_data->>'avatar_url'); @@ -94,12 +157,8 @@ create trigger on_auth_user_created for each row execute procedure public.handle_new_user(); ``` -### EXPLANATION +### Explanation -One of the most common design patterns in Supabase is to add a trigger to the `auth.users` table. The database role managing authentication (supabase_auth_admin) only has the necessary permissions it needs to perform its duties. So, when a trigger operated by the supabase_auth_admin interacts outside the auth schema, it causes a permission error. +One of the most common design patterns in Supabase is to add a trigger to the `auth.users` table. The database role managing authentication (`supabase_auth_admin`) only has the necessary permissions it needs to perform its duties. So, when a trigger operated by the `supabase_auth_admin` interacts outside the auth schema, it causes a permission error. A security definer function retains the privileges of the database user that created it. As long as it is the `postgres` role, your auth triggers should be able to engage with outside tables. - -## SOLUTION 2 (constraint related) - -If you did not create a trigger, check if you created a foreign/primary key relationship between the auth.users table and another table. If you did, then ALTER the [behavior](https://stackoverflow.com/questions/5383612/setting-up-table-relations-what-do-cascade-set-null-and-restrict-do) of the relationship and recreate it with a less [restrictive constraint](https://stackoverflow.com/questions/3359329/how-to-change-the-foreign-key-referential-action-behavior). diff --git a/apps/docs/content/troubleshooting/edge-function-fails-deploy.mdx b/apps/docs/content/troubleshooting/edge-function-fails-deploy.mdx new file mode 100644 index 00000000000..0575a4bc016 --- /dev/null +++ b/apps/docs/content/troubleshooting/edge-function-fails-deploy.mdx @@ -0,0 +1,42 @@ +--- +title = "Edge Function deploy failed due to an internal error" +topics = [ "functions" ] +keywords = [ "fail", "deploy" ] + +[[errors]] +http_status_code = 500 +message="Function deploy failed due to an internal error" + +[[errors]] +http_status_code = 500 +message="unexpected deploy status 500" +--- + +When encountering the `Function deploy failed due to an internal error`, try deploy the function via the [Supabase CLI](/docs/guides/local-development) with the `--debug` flag to gather extra information to identify the possible cause. + +You can also try [alternative bundle methods](/docs/reference/cli/supabase-functions-deploy): + +- `--use-api`: Use Management API to bundle functions. +- `--use-docker`: Use Docker to bundle functions. + +If you're not able to run the CLI or cannot identify the cause, [open a support ticket](/dashboard/support/new). + +**Example error** + +``` +$ supabase functions deploy FUNCTION_NAME --project-ref $PROJECT_ID +... +unexpected deploy status 500: {"message":"Function deploy failed due to an internal error"} +``` + +**Example output with `--debug`** + +- From the details we can see it is exceeding the 20MB [Edge Function size limit](/docs/guides/functions/limits) + +``` +$ supabase functions deploy FUNCTION_NAME --project-ref $PROJECT_ID --debug +... +Deploying Function: FUNCTION_NAME (script size: 62.61MB) +... +unexpected update function status 413: {"message":"request entity too large"} +``` diff --git a/apps/docs/content/troubleshooting/edge-function-shutdown-reasons-explained.mdx b/apps/docs/content/troubleshooting/edge-function-shutdown-reasons-explained.mdx index 67816d99b72..9b7a4a16cf6 100644 --- a/apps/docs/content/troubleshooting/edge-function-shutdown-reasons-explained.mdx +++ b/apps/docs/content/troubleshooting/edge-function-shutdown-reasons-explained.mdx @@ -2,7 +2,6 @@ title = "Edge Function shutdown reasons explained" topics = [ "functions" ] keywords = [ "shutdown", "termination", "event loop", "wall clock", "cpu time", "memory", "early drop" ] -database_id = "" [[errors]] http_status_code = 546 diff --git a/apps/docs/content/troubleshooting/email-template-not-updating.mdx b/apps/docs/content/troubleshooting/email-template-not-updating.mdx new file mode 100644 index 00000000000..c0929a289d4 --- /dev/null +++ b/apps/docs/content/troubleshooting/email-template-not-updating.mdx @@ -0,0 +1,31 @@ +--- +title = "Email template not updating" +topics = [ "auth", "studio" ] +keywords = [ "email", "template" ] + +[[errors]] +code = "templatemailer_template_body_parse_error" +--- + +If your email templates are not updated, check [Auth Logs](/dashboard/project/_/logs/auth-logs) for any errors when the email is sent. When there are errors, we will use a fallback template with valid syntax so it will not show any of your customizations. + +Typical errors relate to invalid syntax involving variables. Refer to [the Email Templates docs](/docs/guides/auth/auth-email-templates#terminology) for the supported variables and syntax. + +**Example error message** + +``` +"event": "templatemailer_template_body_parse_error", +"msg": "templatemailer: template type \"recovery\": template: https://api.supabase.com/platform/auth/PROJECT_ID/templates/recovery:2: function \"default\" not defined", +``` + +The error shows an issue with `default` which is used in the invalid syntax below. + +``` +{{ .Data.display_name | default: "test" }} +``` + +The final correct syntax after removing invalid syntax. + +``` +{{ .Data.display_name }} +``` diff --git a/apps/docs/content/troubleshooting/should-i-set-a-shorter-max-age-parameter-on-the-cookies-8sbF4V.mdx b/apps/docs/content/troubleshooting/should-i-set-a-shorter-max-age-parameter-on-the-cookies-8sbF4V.mdx index 02fcc78cc8b..0450149f2b8 100644 --- a/apps/docs/content/troubleshooting/should-i-set-a-shorter-max-age-parameter-on-the-cookies-8sbF4V.mdx +++ b/apps/docs/content/troubleshooting/should-i-set-a-shorter-max-age-parameter-on-the-cookies-8sbF4V.mdx @@ -9,4 +9,4 @@ database_id = "e51bedf0-cdc4-4880-865b-e39c06dfe497" The `Max-Age` or `Expires` cookie parameters only control whether the browser sends the value to the server. Since a refresh token represents the long-lived authentication session of the user on that browser, setting a short `Max-Age` or `Expires` parameter on the cookies only results in a degraded user experience. -The only way to ensure that a user has logged out or their session has ended is to get the user's details with `getUser()`. +The only way to ensure that a user has logged out or their session has ended is to get the user's details with `getUser()`. The `getClaims()` method only checks local JWT validation (signature and expiration), but it doesn't verify with the auth server whether the session is still valid or if the user has logged out server-side. diff --git a/apps/docs/docs/ref/api/api.mdx b/apps/docs/docs/ref/api/api.mdx index 74db1446683..c1764683dd3 100644 --- a/apps/docs/docs/ref/api/api.mdx +++ b/apps/docs/docs/ref/api/api.mdx @@ -23,7 +23,7 @@ All API requests must be authenticated and made over HTTPS. ## Rate limits -The rate limit for Management API is 60 requests per one minute per user, and applies cumulatively across all requests made with your personal access tokens. +The rate limit for Management API is 120 requests per one minute per user, and applies cumulatively across all requests made with your personal access tokens. If you exceed this limit, all Management API calls for the next minute will be blocked, resulting in a HTTP 429 response. diff --git a/apps/docs/docs/ref/api/introduction.mdx b/apps/docs/docs/ref/api/introduction.mdx index a5cd9b0057e..638f39b6d53 100644 --- a/apps/docs/docs/ref/api/introduction.mdx +++ b/apps/docs/docs/ref/api/introduction.mdx @@ -40,7 +40,7 @@ hideTitle: true ## Rate limits - The rate limit for Management API is 60 requests per one minute per user, and applies cumulatively across all requests made with your personal access tokens. + The rate limit for Management API is 120 requests per one minute per user, and applies cumulatively across all requests made with your personal access tokens. If you exceed this limit, all Management API calls for the next minute will be blocked, resulting in a HTTP 429 response. diff --git a/apps/docs/docs/ref/self-hosting-analytics/introduction.mdx b/apps/docs/docs/ref/self-hosting-analytics/introduction.mdx index 45db31b53e0..cbe7d39d8d8 100644 --- a/apps/docs/docs/ref/self-hosting-analytics/introduction.mdx +++ b/apps/docs/docs/ref/self-hosting-analytics/introduction.mdx @@ -173,6 +173,14 @@ The current Postgres Ingestion backend isn't optimized for production usage. We **We recommend using the BigQuery backend for production environments as it offers better scaling and querying/debugging experiences.** +### Rotate Encryption Keys Regularly + +The Logflare server uses the a Base64 encryption key set on the `LOGFLARE_DB_ENCRYPTION_KEY` environment variable to perform encryption at rest for sensitive database columns. + +To perform encryption key rotation, move the retired key to the `LOGFLARE_DB_ENCRYPTION_KEY_RETIRED` environment variable, and replace the `LOGFLARE_DB_ENCRYPTION_KEY` environement variable with the new key. Perform a server restart and check `info` logs for the migration to be detected and performed. + +Once migration is complete, you can safely remove the retired key. + diff --git a/apps/docs/features/docs/Troubleshooting.script.mjs b/apps/docs/features/docs/Troubleshooting.script.mjs index e3cd431c508..ff6e9eda6c7 100644 --- a/apps/docs/features/docs/Troubleshooting.script.mjs +++ b/apps/docs/features/docs/Troubleshooting.script.mjs @@ -258,37 +258,37 @@ async function updateChecksumIfNeeded(entry) { /** * Converts relative links to absolute URLs for GitHub discussions using MDAST - * @param {string} content - The markdown content to process + * @param {string} content - The markdown content to process (already stripped of JSX) */ function rewriteRelativeLinks(content) { const baseUrl = 'https://supabase.com' - + // Parse the markdown to AST const mdast = fromMarkdown(content, { - extensions: [gfm(), mdxjs()], - mdastExtensions: [gfmFromMarkdown(), mdxFromMarkdown()], + extensions: [gfm()], + mdastExtensions: [gfmFromMarkdown()], }) - + // Walk the tree and modify link nodes - /** - * @param {import('mdast').Root|import('mdast').Content} node - */ + /** + * @param {import('mdast').Root|import('mdast').Content} node + */ function visitNode(node) { if (node.type === 'link' && node.url && node.url.startsWith('/')) { // Convert relative URL to absolute node.url = `${baseUrl}${node.url}` } - + // Recursively visit children if ('children' in node) { node.children.forEach(visitNode) } } - + visitNode(mdast) - + // Convert back to markdown - return toMarkdown(mdast, { extensions: [gfmToMarkdown(), mdxToMarkdown()] }) + return toMarkdown(mdast, { extensions: [gfmToMarkdown()] }) } /** diff --git a/apps/docs/features/docs/__snapshots__/Reference.typeSpec.test.ts.snap b/apps/docs/features/docs/__snapshots__/Reference.typeSpec.test.ts.snap index 00fecd84440..3ef80a4ab51 100644 --- a/apps/docs/features/docs/__snapshots__/Reference.typeSpec.test.ts.snap +++ b/apps/docs/features/docs/__snapshots__/Reference.typeSpec.test.ts.snap @@ -42109,7 +42109,7 @@ exports[`TS type spec parsing > matches snapshot 1`] = ` } }, "comment": { - "shortText": "Generates email links and OTPs to be sent via a custom email provider." + "shortText": "Generates email links and OTPs. This will not send links or OTPs to the end user. This function is for custom admin functionality." } }, "@supabase/auth-js.GoTrueAdminApi.getUserById": { diff --git a/apps/docs/features/ui/McpConfigPanel.tsx b/apps/docs/features/ui/McpConfigPanel.tsx index 87ccd8c1d1a..629a15537b0 100644 --- a/apps/docs/features/ui/McpConfigPanel.tsx +++ b/apps/docs/features/ui/McpConfigPanel.tsx @@ -294,7 +294,7 @@ export function McpConfigPanel() {

{ - "Your MCP client will automatically prompt you to login to Supabase during setup. This will open a browser window where you can login to your Supabase account and grant access to the MCP client. Be sure to choose the organization that contains the project you wish to work with. In the future, we'll offer more fine grain control over these permissions." + "Some MCP clients will automatically prompt you to login during setup, while others may require manual authentication steps. Either authentication method will open a browser window where you can login to your Supabase account and grant organization access to the MCP client. In the future, we'll offer more fine grain control over these permissions." }

diff --git a/apps/docs/public/humans.txt b/apps/docs/public/humans.txt index e24faa90c46..2159ce76d00 100644 --- a/apps/docs/public/humans.txt +++ b/apps/docs/public/humans.txt @@ -74,6 +74,7 @@ Ignacio Dobronich Illia Basalaiev Inian P Ivan Vasilov +Jason Farber Jean-Paul Argudo Jeff Smick Jenny Kibiri @@ -135,6 +136,7 @@ Sam Meech-Ward Sam Rome Sam Rose Sean Oliver +Sean Thompson Sergio Cioban Filho Sreyas Udayavarman Stanislav M diff --git a/apps/docs/spec/cli_v1_commands.yaml b/apps/docs/spec/cli_v1_commands.yaml index 05f92d1eccf..214fb7b6cd0 100644 --- a/apps/docs/spec/cli_v1_commands.yaml +++ b/apps/docs/spec/cli_v1_commands.yaml @@ -1,7 +1,7 @@ clispec: '001' info: id: cli - version: 2.54.10 + version: 2.54.11 title: Supabase CLI language: sh source: https://github.com/supabase/cli diff --git a/apps/docs/spec/enrichments/tsdoc_v2/combined.json b/apps/docs/spec/enrichments/tsdoc_v2/combined.json index 7c2277b16e8..0961a32b0a7 100644 --- a/apps/docs/spec/enrichments/tsdoc_v2/combined.json +++ b/apps/docs/spec/enrichments/tsdoc_v2/combined.json @@ -65068,7 +65068,7 @@ "summary": [ { "kind": "text", - "text": "Generates email links and OTPs to be sent via a custom email provider." + "text": "Generates email links and OTPs. This will not send links or OTPs to the end user. This function is for custom admin functionality." } ] }, diff --git a/apps/docs/spec/enrichments/tsdoc_v2/combined_raw.json b/apps/docs/spec/enrichments/tsdoc_v2/combined_raw.json index a8e0cbb5a2d..9e2f73cc033 100644 --- a/apps/docs/spec/enrichments/tsdoc_v2/combined_raw.json +++ b/apps/docs/spec/enrichments/tsdoc_v2/combined_raw.json @@ -6309,7 +6309,7 @@ "kindString": "Call signature", "flags": {}, "comment": { - "shortText": "Generates email links and OTPs to be sent via a custom email provider." + "shortText": "Generates email links and OTPs. This will not send links or OTPs to the end user. This function is for custom admin functionality." }, "parameters": [ { diff --git a/apps/docs/spec/enrichments/tsdoc_v2/gotrue.json b/apps/docs/spec/enrichments/tsdoc_v2/gotrue.json index bcc6eca3d27..98811c5a188 100644 --- a/apps/docs/spec/enrichments/tsdoc_v2/gotrue.json +++ b/apps/docs/spec/enrichments/tsdoc_v2/gotrue.json @@ -4413,7 +4413,7 @@ "summary": [ { "kind": "text", - "text": "Generates email links and OTPs to be sent via a custom email provider." + "text": "Generates email links and OTPs. This will not send links or OTPs to the end user. This function is for custom admin functionality." } ] }, diff --git a/apps/docs/spec/enrichments/tsdoc_v2/gotrue_dereferenced.json b/apps/docs/spec/enrichments/tsdoc_v2/gotrue_dereferenced.json index bcc6eca3d27..98811c5a188 100644 --- a/apps/docs/spec/enrichments/tsdoc_v2/gotrue_dereferenced.json +++ b/apps/docs/spec/enrichments/tsdoc_v2/gotrue_dereferenced.json @@ -4413,7 +4413,7 @@ "summary": [ { "kind": "text", - "text": "Generates email links and OTPs to be sent via a custom email provider." + "text": "Generates email links and OTPs. This will not send links or OTPs to the end user. This function is for custom admin functionality." } ] }, diff --git a/apps/docs/spec/supabase_dart_v1.yml b/apps/docs/spec/supabase_dart_v1.yml index a7d3326c000..a13ba8b73da 100644 --- a/apps/docs/spec/supabase_dart_v1.yml +++ b/apps/docs/spec/supabase_dart_v1.yml @@ -685,7 +685,7 @@ functions: - id: generate-link title: 'generateLink()' notes: | - Generates email links and OTPs to be sent via a custom email provider. + Generates email links and OTPs. This will not send links or OTPs to the end user. This function is for custom admin functionality. - The following types can be passed into `generateLink()`: `signup`, `magiclink`, `invite`, `recovery`, `emailChangeCurrent`, `emailChangeNew`, `phoneChange`. - `generateLink()` only generates the email link for `email_change_email` if the "Secure email change" setting is enabled under the "Email" provider in your Supabase project. - `generateLink()` handles the creation of the user for `signup`, `invite` and `magiclink`. diff --git a/apps/docs/spec/supabase_dart_v2.yml b/apps/docs/spec/supabase_dart_v2.yml index 82de09cd49e..581856679b6 100644 --- a/apps/docs/spec/supabase_dart_v2.yml +++ b/apps/docs/spec/supabase_dart_v2.yml @@ -2428,7 +2428,7 @@ functions: - id: generate-link title: 'generateLink()' notes: | - Generates email links and OTPs to be sent via a custom email provider. + Generates email links and OTPs. This will not send links or OTPs to the end user. This function is for custom admin functionality. - The following types can be passed into `generateLink()`: `signup`, `magiclink`, `invite`, `recovery`, `emailChangeCurrent`, `emailChangeNew`, `phoneChange`. - `generateLink()` only generates the email link for `email_change_email` if the "Secure email change" setting is enabled under the "Email" provider in your Supabase project. - `generateLink()` handles the creation of the user for `signup`, `invite` and `magiclink`. diff --git a/apps/docs/spec/supabase_kt_v1.yml b/apps/docs/spec/supabase_kt_v1.yml index a1f80811d36..02e8f5d02ec 100644 --- a/apps/docs/spec/supabase_kt_v1.yml +++ b/apps/docs/spec/supabase_kt_v1.yml @@ -2904,7 +2904,7 @@ functions: title: 'generateLink()' $ref: '@supabase/gotrue-js.GoTrueAdminApi.generateLink' notes: | - Generates email links and OTPs to be sent via a custom email provider. + Generates email links and OTPs. This will not send links or OTPs to the end user. This function is for custom admin functionality. examples: - id: generate-a-signup-link name: Generate a signup link diff --git a/apps/docs/spec/supabase_kt_v2.yml b/apps/docs/spec/supabase_kt_v2.yml index 3285997fb15..cc66c3da5e4 100644 --- a/apps/docs/spec/supabase_kt_v2.yml +++ b/apps/docs/spec/supabase_kt_v2.yml @@ -4186,7 +4186,7 @@ functions: title: 'generateLink()' $ref: '@supabase/gotrue-js.GoTrueAdminApi.generateLink' notes: | - Generates email links and OTPs to be sent via a custom email provider. + Generates email links and OTPs. This will not send links or OTPs to the end user. This function is for custom admin functionality. params: - name: type isOptional: false diff --git a/apps/docs/spec/supabase_kt_v3.yml b/apps/docs/spec/supabase_kt_v3.yml index 3cb465d3947..047700eea79 100644 --- a/apps/docs/spec/supabase_kt_v3.yml +++ b/apps/docs/spec/supabase_kt_v3.yml @@ -4271,7 +4271,7 @@ functions: title: 'generateLink()' $ref: '@supabase/gotrue-js.GoTrueAdminApi.generateLink' notes: | - Generates email links and OTPs to be sent via a custom email provider. + Generates email links and OTPs. This will not send links or OTPs to the end user. This function is for custom admin functionality. params: - name: type isOptional: false diff --git a/apps/studio/components/interfaces/Account/AccessTokens/NewAccessTokenDialog.tsx b/apps/studio/components/interfaces/Account/AccessTokens/NewAccessTokenDialog.tsx index 7d6a15f57d6..afd1d8b7cf1 100644 --- a/apps/studio/components/interfaces/Account/AccessTokens/NewAccessTokenDialog.tsx +++ b/apps/studio/components/interfaces/Account/AccessTokens/NewAccessTokenDialog.tsx @@ -2,7 +2,7 @@ import { zodResolver } from '@hookform/resolvers/zod' import dayjs from 'dayjs' import { ExternalLink } from 'lucide-react' import { useState } from 'react' -import { type SubmitHandler, useForm } from 'react-hook-form' +import { useForm, type SubmitHandler } from 'react-hook-form' import { toast } from 'sonner' import { z } from 'zod' @@ -214,16 +214,13 @@ export const NewAccessTokenDialog = ({ selectsRange={false} triggerButtonSize="small" contentSide="top" + to={customExpiryDate?.date} minDate={new Date()} maxDate={dayjs().add(1, 'year').toDate()} onChange={(date) => { if (date.to) handleCustomDateChange({ date: date.to }) }} - > - {customExpiryDate - ? `${dayjs(customExpiryDate.date).format('DD MMM, HH:mm')}` - : 'Select date'} - + /> )} {field.value === NON_EXPIRING_TOKEN_VALUE && ( diff --git a/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreview.constants.tsx b/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreview.constants.tsx index 03d791ca891..ce8d859e785 100644 --- a/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreview.constants.tsx +++ b/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreview.constants.tsx @@ -8,13 +8,6 @@ export const FEATURE_PREVIEWS = [ isNew: true, isPlatformOnly: true, }, - { - key: LOCAL_STORAGE_KEYS.UI_PREVIEW_NEW_STORAGE_UI, - name: 'New Storage interface', - discussionsUrl: undefined, - isNew: true, - isPlatformOnly: false, - }, { key: LOCAL_STORAGE_KEYS.UI_PREVIEW_UNIFIED_LOGS, name: 'New Logs interface', diff --git a/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewContext.tsx b/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewContext.tsx index bb2b449c4d5..248d731e5a7 100644 --- a/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewContext.tsx +++ b/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewContext.tsx @@ -110,11 +110,6 @@ export const useIsAdvisorRulesEnabled = () => { return flags[LOCAL_STORAGE_KEYS.UI_PREVIEW_ADVISOR_RULES] } -export const useIsNewStorageUIEnabled = () => { - const { flags } = useFeaturePreviewContext() - return flags[LOCAL_STORAGE_KEYS.UI_PREVIEW_NEW_STORAGE_UI] -} - export const useIsSecurityNotificationsEnabled = () => { const { flags } = useFeaturePreviewContext() return flags[LOCAL_STORAGE_KEYS.UI_PREVIEW_SECURITY_NOTIFICATIONS] @@ -126,7 +121,6 @@ export const useFeaturePreviewModal = () => { const gitlessBranchingEnabled = useFlag('gitlessBranching') const advisorRulesEnabled = useFlag('advisorRules') const isUnifiedLogsPreviewAvailable = useFlag('unifiedLogs') - const isNewStorageUIAvailable = useFlag('storageAnalyticsVector') const isSecurityNotificationsAvailable = useFlag('securityNotifications') const selectedFeatureKeyFromQuery = featurePreviewModal?.trim() ?? null @@ -142,8 +136,6 @@ export const useFeaturePreviewModal = () => { return advisorRulesEnabled case 'supabase-ui-preview-unified-logs': return isUnifiedLogsPreviewAvailable - case 'new-storage-ui': - return isNewStorageUIAvailable case 'security-notifications': return isSecurityNotificationsAvailable default: @@ -154,7 +146,6 @@ export const useFeaturePreviewModal = () => { gitlessBranchingEnabled, advisorRulesEnabled, isUnifiedLogsPreviewAvailable, - isNewStorageUIAvailable, isSecurityNotificationsAvailable, ] ) diff --git a/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewModal.tsx b/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewModal.tsx index 3fa262e4b12..524e7cd28e5 100644 --- a/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewModal.tsx +++ b/apps/studio/components/interfaces/App/FeaturePreview/FeaturePreviewModal.tsx @@ -14,9 +14,8 @@ import { CLSPreview } from './CLSPreview' import { FEATURE_PREVIEWS } from './FeaturePreview.constants' import { useFeaturePreviewContext, useFeaturePreviewModal } from './FeaturePreviewContext' import { InlineEditorPreview } from './InlineEditorPreview' -import { NewStorageUIPreview } from './NewStorageUIPreview' -import { UnifiedLogsPreview } from './UnifiedLogsPreview' import { SecurityNotificationsPreview } from './SecurityNotificationsPreview' +import { UnifiedLogsPreview } from './UnifiedLogsPreview' const FEATURE_PREVIEW_KEY_TO_CONTENT: { [key: string]: ReactNode @@ -27,7 +26,6 @@ const FEATURE_PREVIEW_KEY_TO_CONTENT: { [LOCAL_STORAGE_KEYS.UI_PREVIEW_API_SIDE_PANEL]: , [LOCAL_STORAGE_KEYS.UI_PREVIEW_CLS]: , [LOCAL_STORAGE_KEYS.UI_PREVIEW_UNIFIED_LOGS]: , - [LOCAL_STORAGE_KEYS.UI_PREVIEW_NEW_STORAGE_UI]: , [LOCAL_STORAGE_KEYS.UI_PREVIEW_SECURITY_NOTIFICATIONS]: , } diff --git a/apps/studio/components/interfaces/App/FeaturePreview/NewStorageUIPreview.tsx b/apps/studio/components/interfaces/App/FeaturePreview/NewStorageUIPreview.tsx deleted file mode 100644 index 6225b04d523..00000000000 --- a/apps/studio/components/interfaces/App/FeaturePreview/NewStorageUIPreview.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import Image from 'next/image' - -import { useParams } from 'common' -import { InlineLink } from 'components/ui/InlineLink' -import { BASE_PATH } from 'lib/constants' -import { useIsNewStorageUIEnabled } from './FeaturePreviewContext' - -export const NewStorageUIPreview = () => { - const { ref } = useParams() - const isStorageV2 = useIsNewStorageUIEnabled() - - return ( -

-

- Experience our enhanced{' '} - - Storage interface - {' '} - with support for analytics and vector bucket types. -

- new-storage-preview -
-

Enabling this preview will:

-
    -
  • Move Storage buckets from the sidebar into the main content area
  • -
  • Change the role of the sidebar to a bucket type selector
  • -
  • Nest settings and policies under their respective bucket types
  • -
-

- These changes are necessary to support incoming analytics and vector bucket types. File - storage will remain the default, and be shown by default when entering Storage. -

-
-
- ) -} diff --git a/apps/studio/components/interfaces/BranchManagement/BranchPanels.tsx b/apps/studio/components/interfaces/BranchManagement/BranchPanels.tsx index 6b8c96bee7d..55285d3368d 100644 --- a/apps/studio/components/interfaces/BranchManagement/BranchPanels.tsx +++ b/apps/studio/components/interfaces/BranchManagement/BranchPanels.tsx @@ -6,7 +6,7 @@ import { PropsWithChildren, ReactNode } from 'react' import { ButtonTooltip } from 'components/ui/ButtonTooltip' import ShimmeringLoader from 'components/ui/ShimmeringLoader' import type { Branch } from 'data/branches/branches-query' -import { BASE_PATH } from 'lib/constants' +import Link from 'next/link' import { Tooltip, TooltipContent, TooltipTrigger } from 'ui' import { WorkflowLogs } from './WorkflowLogs' @@ -25,9 +25,7 @@ export const BranchManagementSection = ({
{typeof header === 'string' ? {header} : header}
-
- {children} -
+
{children}
{footer !== undefined &&
{footer}
} ) @@ -86,14 +84,6 @@ export const BranchRow = ({ const navigateUrl = rowLink ?? `/project/${branch.project_ref}` - const handleRowClick = () => { - if (external) { - window.open(`${BASE_PATH}/${navigateUrl}`, '_blank', 'noopener noreferrer') - } else { - router.push(navigateUrl) - } - } - return (
@@ -114,10 +104,15 @@ export const BranchRow = ({ )} - -
+ + {label || branch.name} -
+
{((page === 'branches' && !branch.is_default) || page === 'merge-requests') && ( diff --git a/apps/studio/components/interfaces/Database/Backups/PITR/PITRForm.tsx b/apps/studio/components/interfaces/Database/Backups/PITR/PITRForm.tsx index a476baeed7a..4168c4c80a4 100644 --- a/apps/studio/components/interfaces/Database/Backups/PITR/PITRForm.tsx +++ b/apps/studio/components/interfaces/Database/Backups/PITR/PITRForm.tsx @@ -1,12 +1,11 @@ -import { format } from 'date-fns' import dayjs from 'dayjs' -import { ChevronLeft, ChevronRight, HelpCircle } from 'lucide-react' +import { HelpCircle } from 'lucide-react' import { useMemo, useState } from 'react' -import DatePicker from 'react-datepicker' import { ButtonTooltip } from 'components/ui/ButtonTooltip' import { FormPanel } from 'components/ui/Forms/FormPanel' import InformationBox from 'components/ui/InformationBox' +import { Calendar, cn } from 'ui' import { Timezone } from './PITR.types' import { constrainDateToRange, @@ -41,6 +40,8 @@ export function PITRForm({ const latestAvailableBackup = dayjs .unix(latestAvailableBackupUnix ?? 0) .tz(selectedTimezone.utc[0]) + const earliestAvailableBackupAsDate = earliestAvailableBackup.toDate() + const latestAvailableBackupAsDate = latestAvailableBackup.toDate() const [selectedDateRaw, setSelectedDateRaw] = useState(latestAvailableBackup.toDate()) @@ -125,51 +126,25 @@ export function PITRForm({ >
- 'cursor-pointer'} - minDate={earliestAvailableBackup.toDate()} - maxDate={latestAvailableBackup.toDate()} - highlightDates={availableDates.map((date) => date.toDate())} - renderCustomHeader={({ - date, - decreaseMonth, - increaseMonth, - prevMonthButtonDisabled, - nextMonthButtonDisabled, - }) => ( -
-
- - - {format(date, 'MMMM yyyy')} - - -
-
- )} + onSelect={onUpdateDate} + defaultMonth={latestAvailableBackupAsDate} + startMonth={earliestAvailableBackupAsDate} + endMonth={latestAvailableBackupAsDate} + disabled={[ + { before: earliestAvailableBackupAsDate }, + { after: latestAvailableBackupAsDate }, + ]} + classNames={{ + day: cn( + '[&:not(:has(:disabled))]:border [&:not(:has(:disabled))]:border-stronger [&:not(:last-child)]:border-r-0 [&:not(:has(:disabled))]:bg-overlay-hover', + 'rounded-none' + ), + selected: '!bg-brand-500', + }} /> {availableDates.length > 1 && (
diff --git a/apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanelFields.tsx b/apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanelFields.tsx index 283c180190b..54f871f94b2 100644 --- a/apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanelFields.tsx +++ b/apps/studio/components/interfaces/Database/Replication/DestinationPanel/DestinationPanelFields.tsx @@ -3,7 +3,6 @@ import { useMemo, useState } from 'react' import type { UseFormReturn } from 'react-hook-form' import { useParams } from 'common' -import { useIsNewStorageUIEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext' import { getCatalogURI } from 'components/interfaces/Storage/StorageSettings/StorageSettings.utils' import { InlineLink } from 'components/ui/InlineLink' import { getKeys, useAPIKeysQuery } from 'data/api-keys/api-keys-query' @@ -124,7 +123,6 @@ export const AnalyticsBucketFields = ({ const [showSecretAccessKey, setShowSecretAccessKey] = useState(false) const { ref: projectRef } = useParams() - const isStorageV2 = useIsNewStorageUIEnabled() const { data: project } = useSelectedProjectQuery() const { data: apiKeys } = useAPIKeysQuery({ projectRef, reveal: true }) @@ -447,13 +445,7 @@ export const AnalyticsBucketFields = ({

Please select another key or create a new set, as this destination will not work otherwise. S3 access keys can be managed in your{' '} - + storage settings

@@ -466,13 +458,7 @@ export const AnalyticsBucketFields = ({

S3 access keys can be managed in your{' '} - + storage settings . diff --git a/apps/studio/components/interfaces/Database/Triggers/TriggerSheet.tsx b/apps/studio/components/interfaces/Database/Triggers/TriggerSheet.tsx index 6cc885670ae..384391b597d 100644 --- a/apps/studio/components/interfaces/Database/Triggers/TriggerSheet.tsx +++ b/apps/studio/components/interfaces/Database/Triggers/TriggerSheet.tsx @@ -412,7 +412,7 @@ export const TriggerSheet = ({

-

Function to trigger

+

Function to trigger

{function_name.length === 0 ? (
) } - -export default TriggersList diff --git a/apps/studio/components/interfaces/Integrations/Landing/IntegrationCard.tsx b/apps/studio/components/interfaces/Integrations/Landing/IntegrationCard.tsx index 00d770d3c72..c7192597c45 100644 --- a/apps/studio/components/interfaces/Integrations/Landing/IntegrationCard.tsx +++ b/apps/studio/components/interfaces/Integrations/Landing/IntegrationCard.tsx @@ -26,9 +26,9 @@ export const IntegrationLoadingCard = () => {
-
- - +
+ +
diff --git a/apps/studio/components/interfaces/LogDrains/LogDrainDestinationSheetForm.tsx b/apps/studio/components/interfaces/LogDrains/LogDrainDestinationSheetForm.tsx index 77fa65d0b88..e66de06524d 100644 --- a/apps/studio/components/interfaces/LogDrains/LogDrainDestinationSheetForm.tsx +++ b/apps/studio/components/interfaces/LogDrains/LogDrainDestinationSheetForm.tsx @@ -6,7 +6,7 @@ import { toast } from 'sonner' import { z } from 'zod' import { IS_PLATFORM, useFlag, useParams } from 'common' -import { DocsButton } from 'components/ui/DocsButton' +import Link from 'next/link' import { LogDrainData, useLogDrainsQuery } from 'data/log-drains/log-drains-query' import { DOCS_URL } from 'lib/constants' import { @@ -34,6 +34,7 @@ import { SheetSection, SheetTitle, Switch, + cn, } from 'ui' import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout' import { InfoTooltip } from 'ui-patterns/info-tooltip' @@ -571,33 +572,36 @@ export function LogDrainDestinationSheetForm({
- - Additional drain cost - -
- } - > -
    -
  • - $60 per drain per month -
  • -
  • + $0.20 per million events
  • -
  • + $0.09 per GB egress
  • -
- +
    +
  • + Additional drain cost + $60 per month +
  • +
  • + Per million events + +$0.20 +
  • +
  • + Per GB egress + +$0.09 +
  • +
- + + + See full pricing breakdown{' '} + + here + + diff --git a/apps/studio/components/interfaces/LogDrains/LogDrains.constants.tsx b/apps/studio/components/interfaces/LogDrains/LogDrains.constants.tsx index 02530e37222..ea38250a168 100644 --- a/apps/studio/components/interfaces/LogDrains/LogDrains.constants.tsx +++ b/apps/studio/components/interfaces/LogDrains/LogDrains.constants.tsx @@ -13,7 +13,7 @@ export type LogDrainType = components['schemas']['CreateBackendParamsOpenapi'][' export const LOG_DRAIN_TYPES = [ { value: 'webhook', - name: 'HTTP Endpoint', + name: 'Custom Endpoint', description: 'Forward logs as a POST request to a custom HTTP endpoint', icon: , }, diff --git a/apps/studio/components/interfaces/LogDrains/LogDrains.tsx b/apps/studio/components/interfaces/LogDrains/LogDrains.tsx index 01ef4efc2bc..9fe41b4df53 100644 --- a/apps/studio/components/interfaces/LogDrains/LogDrains.tsx +++ b/apps/studio/components/interfaces/LogDrains/LogDrains.tsx @@ -1,11 +1,8 @@ import { MoreHorizontal, Pencil, TrashIcon } from 'lucide-react' -import { useState } from 'react' +import React, { useState } from 'react' import { toast } from 'sonner' - import { useFlag, useParams } from 'common' import AlertError from 'components/ui/AlertError' -import CardButton from 'components/ui/CardButton' -import Panel from 'components/ui/Panel' import { useDeleteLogDrainMutation } from 'data/log-drains/delete-log-drain-mutation' import { LogDrainData, useLogDrainsQuery } from 'data/log-drains/log-drains-query' import { useCurrentOrgPlan } from 'hooks/misc/useCurrentOrgPlan' @@ -21,11 +18,15 @@ import { TableHead, TableHeader, TableRow, + Card, + cn, } from 'ui' import ConfirmationModal from 'ui-patterns/Dialogs/ConfirmationModal' import { GenericSkeletonLoader } from 'ui-patterns/ShimmeringLoader' import { LOG_DRAIN_TYPES, LogDrainType } from './LogDrains.constants' import { LogDrainsEmpty } from './LogDrainsEmpty' +import { LogDrainsCard } from './LogDrainsCard' +import { VoteLink } from './VoteLink' export function LogDrains({ onNewDrainClick, @@ -81,19 +82,23 @@ export function LogDrains({ if (!isLoading && !hasLogDrains) { return ( -
- {LOG_DRAIN_TYPES.filter((t) => t.value !== 'sentry' || sentryEnabled).map((src) => ( - { - onNewDrainClick(src.value) - }} - /> - ))} -
+ <> +
+ {LOG_DRAIN_TYPES.filter((t) => t.value !== 'sentry' || sentryEnabled).map((src) => ( + { + onNewDrainClick(src.value) + }} + /> + ))} +
+ + ) } @@ -103,63 +108,80 @@ export function LogDrains({ return ( <> - + Name - Description - Destination + Description + Destination
Actions
- {logDrains?.map((drain) => ( - - - {drain.name} - - - {drain.description} - - {drain.type} - - - -
-
+ ) } diff --git a/apps/studio/components/interfaces/LogDrains/LogDrainsCard.tsx b/apps/studio/components/interfaces/LogDrains/LogDrainsCard.tsx new file mode 100644 index 00000000000..b3a5c6b5e9f --- /dev/null +++ b/apps/studio/components/interfaces/LogDrains/LogDrainsCard.tsx @@ -0,0 +1,34 @@ +import { Card } from 'ui' + +interface LogDrainsCardProps { + title: string + description: string + rightLabel?: string + icon: React.ReactNode + onClick: () => void +} + +export const LogDrainsCard = ({ + title, + description, + rightLabel, + icon, + onClick, +}: LogDrainsCardProps) => { + return ( + + ) +} diff --git a/apps/studio/components/interfaces/LogDrains/LogDrainsEmpty.tsx b/apps/studio/components/interfaces/LogDrains/LogDrainsEmpty.tsx index 9beca599536..eae55878541 100644 --- a/apps/studio/components/interfaces/LogDrains/LogDrainsEmpty.tsx +++ b/apps/studio/components/interfaces/LogDrains/LogDrainsEmpty.tsx @@ -1,15 +1,14 @@ import { Button, Card, cn } from 'ui' import Link from 'next/link' import { AnimatedLogos } from './AnimatedLogos' -import Image from 'next/image' -import { BASE_PATH } from 'lib/constants' import { UpgradePlanButton } from 'components/ui/UpgradePlanButton' +import { VoteLink } from './VoteLink' export const LogDrainsEmpty = () => { const items = [ { step: 1, - title: 'Log drain pricing', + title: 'Pricing', description: 'Log Drains are available as a project Add-On for all Team and Enterprise users. Each Log Drain costs $60 per month.', label: 'See our pricing', @@ -19,14 +18,14 @@ export const LogDrainsEmpty = () => { step: 2, title: 'Connect to your drain', description: - 'We offer support for multiple destinations including HTTPS, Datadog, Loki and Sentry.', + 'We offer support for multiple destinations including Datadog, Loki, Sentry or a custom endpoint.', label: 'Read our documentation', link: 'https://supabase.com/docs/guides/telemetry/log-drains', }, ] return ( -
+
@@ -61,25 +60,7 @@ export const LogDrainsEmpty = () => {
))} -
- GitHub icon -

- Don't see your preferred drain?{' '} - - Vote here - -

-
+
diff --git a/apps/studio/components/interfaces/LogDrains/VoteLink.tsx b/apps/studio/components/interfaces/LogDrains/VoteLink.tsx new file mode 100644 index 00000000000..0d92b0c83d0 --- /dev/null +++ b/apps/studio/components/interfaces/LogDrains/VoteLink.tsx @@ -0,0 +1,18 @@ +import Link from 'next/link' + +export const VoteLink = () => { + return ( +
+

+ Don't see your preferred drain?{' '} + + Vote here + +

+
+ ) +} diff --git a/apps/studio/components/interfaces/Organization/CloudMarketplace/cloud-marketplace-query.ts b/apps/studio/components/interfaces/Organization/CloudMarketplace/cloud-marketplace-query.ts index 359ee20aea5..4f8ad4601a0 100644 --- a/apps/studio/components/interfaces/Organization/CloudMarketplace/cloud-marketplace-query.ts +++ b/apps/studio/components/interfaces/Organization/CloudMarketplace/cloud-marketplace-query.ts @@ -1,6 +1,6 @@ +import { useQuery } from '@tanstack/react-query' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { get, handleError } from '../../../../data/fetchers' -import type { ResponseError } from '../../../../types' -import { useQuery, UseQueryOptions } from '@tanstack/react-query' import { useProfile } from '../../../../lib/profile' import { cloudMarketplaceKeys } from './keys' @@ -35,7 +35,7 @@ export const useCloudMarketplaceOnboardingInfoQuery = { + if (name === 'APAC') { + return 'Asia-Pacific' + } + return name +} + export const RegionSelector = ({ form, instanceSize, @@ -149,7 +157,9 @@ export const RegionSelector = ({ /> )} - {selectedRegion?.name ?? field.value} + {selectedRegion?.name + ? getDisplayNameForSmartRegion(selectedRegion.name) + : field.value}
)} @@ -159,7 +169,7 @@ export const RegionSelector = ({ {smartRegionEnabled && ( <> - Smart Region Selection + General regions {smartRegions.map((value) => { return ( - {value.name} + + {getDisplayNameForSmartRegion(value.name)} +
@@ -194,7 +206,7 @@ export const RegionSelector = ({ )} - All Regions + Specific regions {regionOptions.map((value) => { return ( = 0 + ? String(minCalls) + : '' + ) const debouncedInputValue = useDebounce(inputValue, 500) + const debouncedMinCalls = useDebounce(minCallsInput, 300) const searchValue = inputValue.length === 0 ? inputValue : debouncedInputValue const onSearchQueryChange = (value: string) => { - setSearchParams({ search: value || '' }) + const sanitizedMinCalls = + typeof minCalls === 'number' && Number.isFinite(minCalls) && minCalls >= 0 + ? Math.floor(minCalls) + : undefined + setSearchParams({ search: value || '', minCalls: sanitizedMinCalls }) } const onFilterRolesChange = (roles: string[]) => { setFilters({ ...filters, roles }) - setSearchParams({ roles }) + const sanitizedMinCalls = + typeof minCalls === 'number' && Number.isFinite(minCalls) && minCalls >= 0 + ? Math.floor(minCalls) + : undefined + setSearchParams({ roles, minCalls: sanitizedMinCalls }) } useEffect(() => { @@ -51,6 +67,21 @@ export const QueryPerformanceFilterBar = ({ // eslint-disable-next-line react-hooks/exhaustive-deps }, [searchValue]) + useEffect(() => { + const value = debouncedMinCalls.trim() + if (value === '') { + setSearchParams({ minCalls: undefined }) + return + } + const parsed = Number(value) + if (Number.isFinite(parsed) && parsed >= 0) { + setSearchParams({ minCalls: Math.floor(parsed) }) + } else { + setSearchParams({ minCalls: undefined }) + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [debouncedMinCalls]) + return (
@@ -78,6 +109,30 @@ export const QueryPerformanceFilterBar = ({ ]} /> + ) => setMinCallsInput(e.target.value)} + name="minCalls" + id="minCalls" + min={0} + placeholder="Min. calls (e.g. 100)" + className="w-32" + actions={[ + minCallsInput && ( +
- - -
- } - onChange={(dates) => { - handleDatePickerChange(dates) + setCurrentMonth(new Date(month))} + selected={{ from: startDate ?? undefined, to: endDate ?? undefined }} + onSelect={(range) => { + handleDatePickerChange([range?.from ?? null, range?.to ?? null]) }} - dateFormat="MMMM d, yyyy h:mm aa" - dayClassName={() => 'cursor-pointer'} - startDate={startDate} - endDate={endDate} - renderCustomHeader={({ - date, - decreaseMonth, - increaseMonth, - prevMonthButtonDisabled, - nextMonthButtonDisabled, - }) => ( -
-
- - - {dayjs(date).format('MMMM YYYY')} - - -
-
- )} />
{isLargeRange && !hideWarnings && ( @@ -412,12 +376,10 @@ export const LogsDatePicker = ({
@@ -344,12 +265,13 @@ export const AnalyticBucketDetails = ({ bucket }: { bucket: AnalyticsBucket }) = - + )} - setModal(null)} + onSuccess={() => router.push(`/project/${projectRef}/storage/analytics`)} /> ) @@ -361,7 +283,7 @@ const ExtensionNotInstalled = ({ wrapperMeta, wrappersExtension, }: { - bucketName: string + bucketName?: string projectRef: string wrapperMeta: WrapperMeta wrappersExtension: DatabaseExtension @@ -410,7 +332,7 @@ const ExtensionNeedsUpgrade = ({ wrapperMeta, wrappersExtension, }: { - bucketName: string + bucketName?: string projectRef: string wrapperMeta: WrapperMeta wrappersExtension: DatabaseExtension @@ -453,11 +375,12 @@ const ExtensionNeedsUpgrade = ({ ) } -const WrapperMissing = ({ bucketName }: { bucketName: string }) => { +const WrapperMissing = ({ bucketName }: { bucketName?: string }) => { const { mutateAsync: createIcebergWrapper, isLoading: isCreatingIcebergWrapper } = useIcebergWrapperCreateMutation() const onSetupWrapper = async () => { + if (!bucketName) return console.error('Bucket name is required') await createIcebergWrapper({ bucketName }) } diff --git a/apps/studio/components/interfaces/Storage/AnalyticsBucketDetails/useAnalyticsBucketAssociatedEntities.tsx b/apps/studio/components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/useAnalyticsBucketAssociatedEntities.tsx similarity index 90% rename from apps/studio/components/interfaces/Storage/AnalyticsBucketDetails/useAnalyticsBucketAssociatedEntities.tsx rename to apps/studio/components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/useAnalyticsBucketAssociatedEntities.tsx index e75b00d6117..539aa0a836f 100644 --- a/apps/studio/components/interfaces/Storage/AnalyticsBucketDetails/useAnalyticsBucketAssociatedEntities.tsx +++ b/apps/studio/components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/useAnalyticsBucketAssociatedEntities.tsx @@ -1,6 +1,5 @@ import { PermissionAction } from '@supabase/shared-types/out/constants' -import { useIsNewStorageUIEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext' import { WrapperMeta } from 'components/interfaces/Integrations/Wrappers/Wrappers.types' import { useFDWDeleteMutation } from 'data/fdw/fdw-delete-mutation' import { FDW } from 'data/fdw/fdws-query' @@ -23,13 +22,9 @@ import { useAnalyticsBucketWrapperInstance } from './useAnalyticsBucketWrapperIn * Used for cleaning up analytics bucket after deletion */ export const useAnalyticsBucketAssociatedEntities = ( - { projectRef, bucketId }: { projectRef?: string; bucketId: string }, + { projectRef, bucketId }: { projectRef?: string; bucketId?: string }, options: { enabled: boolean } = { enabled: true } ) => { - // [Joshen] Opting to skip cleaning up ETL related entities within old UI - // Also to prevent an unnecessary call to /sources for existing UI - const isStorageV2 = useIsNewStorageUIEnabled() - const { can: canReadS3Credentials } = useAsyncCheckPermissions( PermissionAction.STORAGE_ADMIN_READ, '*' @@ -45,12 +40,12 @@ export const useAnalyticsBucketAssociatedEntities = ( { enabled: canReadS3Credentials && options.enabled } ) const s3AccessKey = (s3AccessKeys?.data ?? []).find( - (x) => x.description === getAnalyticsBucketS3KeyName(bucketId) + (x) => x.description === getAnalyticsBucketS3KeyName(bucketId ?? '') ) const { data: sourcesData } = useReplicationSourcesQuery( { projectRef }, - { enabled: isStorageV2 && options.enabled } + { enabled: options.enabled } ) const sourceId = sourcesData?.sources.find((s) => s.name === projectRef)?.id @@ -59,7 +54,7 @@ export const useAnalyticsBucketAssociatedEntities = ( { enabled: options.enabled } ) const publication = publications.find( - (p) => p.name === getAnalyticsBucketPublicationName(bucketId) + (p) => p.name === getAnalyticsBucketPublicationName(bucketId ?? '') ) return { icebergWrapper, icebergWrapperMeta, s3AccessKey, publication } diff --git a/apps/studio/components/interfaces/Storage/AnalyticsBucketDetails/useAnalyticsBucketWrapperInstance.tsx b/apps/studio/components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/useAnalyticsBucketWrapperInstance.tsx similarity index 90% rename from apps/studio/components/interfaces/Storage/AnalyticsBucketDetails/useAnalyticsBucketWrapperInstance.tsx rename to apps/studio/components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/useAnalyticsBucketWrapperInstance.tsx index 409b4b8a85d..b685e212e87 100644 --- a/apps/studio/components/interfaces/Storage/AnalyticsBucketDetails/useAnalyticsBucketWrapperInstance.tsx +++ b/apps/studio/components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/useAnalyticsBucketWrapperInstance.tsx @@ -10,17 +10,18 @@ import { useFDWsQuery } from 'data/fdw/fdws-query' import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject' export const useAnalyticsBucketWrapperInstance = ( - { bucketId }: { bucketId: string }, + { bucketId }: { bucketId?: string }, options?: { enabled?: boolean } ) => { const { data: project, isLoading: isLoadingProject } = useSelectedProjectQuery() + const defaultEnabled = options?.enabled ?? true const { data, isLoading: isLoadingFDWs } = useFDWsQuery( { projectRef: project?.ref, connectionString: project?.connectionString, }, - options + { enabled: defaultEnabled && !!bucketId } ) const icebergWrapper = useMemo(() => { diff --git a/apps/studio/components/interfaces/Storage/AnalyticsBucketDetails/useIcebergWrapper.tsx b/apps/studio/components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/useIcebergWrapper.tsx similarity index 100% rename from apps/studio/components/interfaces/Storage/AnalyticsBucketDetails/useIcebergWrapper.tsx rename to apps/studio/components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/useIcebergWrapper.tsx diff --git a/apps/studio/components/interfaces/Storage/CreateSpecializedBucketModal.tsx b/apps/studio/components/interfaces/Storage/AnalyticsBuckets/CreateAnalyticsBucketModal.tsx similarity index 72% rename from apps/studio/components/interfaces/Storage/CreateSpecializedBucketModal.tsx rename to apps/studio/components/interfaces/Storage/AnalyticsBuckets/CreateAnalyticsBucketModal.tsx index 3208dfedd62..2e2afe50d13 100644 --- a/apps/studio/components/interfaces/Storage/CreateSpecializedBucketModal.tsx +++ b/apps/studio/components/interfaces/Storage/AnalyticsBuckets/CreateAnalyticsBucketModal.tsx @@ -10,15 +10,16 @@ import z from 'zod' import { useParams } from 'common' import { ButtonTooltip } from 'components/ui/ButtonTooltip' import { InlineLink } from 'components/ui/InlineLink' -import { useProjectStorageConfigQuery } from 'data/config/project-storage-config-query' +import { useIsAnalyticsBucketsEnabled } from 'data/config/project-storage-config-query' import { useDatabaseExtensionEnableMutation } from 'data/database-extensions/database-extension-enable-mutation' import { useAnalyticsBucketCreateMutation } from 'data/storage/analytics-bucket-create-mutation' +import { useAnalyticsBucketsQuery } from 'data/storage/analytics-buckets-query' import { useIcebergWrapperCreateMutation } from 'data/storage/iceberg-wrapper-create-mutation' import { useSendEventMutation } from 'data/telemetry/send-event-mutation' import { useAsyncCheckPermissions } from 'hooks/misc/useCheckPermissions' import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization' import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject' -import { DOCS_URL, IS_PLATFORM } from 'lib/constants' +import { DOCS_URL } from 'lib/constants' import { Button, cn, @@ -37,9 +38,9 @@ import { } from 'ui' import { Admonition } from 'ui-patterns' import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout' +import { inverseValidBucketNameRegex, validBucketNameRegex } from '../CreateBucketModal.utils' +import { BUCKET_TYPES } from '../Storage.constants' import { useIcebergWrapperExtension } from './AnalyticsBucketDetails/useIcebergWrapper' -import { inverseValidBucketNameRegex, validBucketNameRegex } from './CreateBucketModal.utils' -import { BUCKET_TYPES } from './Storage.constants' const FormSchema = z .object({ @@ -70,12 +71,11 @@ const FormSchema = z } }) -const formId = 'create-specialized-storage-bucket-form' +const formId = 'create-analytics-storage-bucket-form' -export type CreateSpecializedBucketForm = z.infer +export type CreateAnalyticsBucketForm = z.infer -interface CreateSpecializedBucketModalProps { - bucketType: 'analytics' | 'vectors' +interface CreateAnalyticsBucketModalProps { buttonSize?: 'tiny' | 'small' buttonType?: 'default' | 'primary' buttonClassName?: string @@ -88,14 +88,13 @@ interface CreateSpecializedBucketModalProps { } } -export const CreateSpecializedBucketModal = ({ - bucketType, +export const CreateAnalyticsBucketModal = ({ buttonSize = 'tiny', buttonType = 'default', buttonClassName, disabled = false, tooltip, -}: CreateSpecializedBucketModalProps) => { +}: CreateAnalyticsBucketModalProps) => { const router = useRouter() const { ref } = useParams() const { data: org } = useSelectedOrganizationQuery() @@ -106,8 +105,9 @@ export const CreateSpecializedBucketModal = ({ const [visible, setVisible] = useState(false) - const { data } = useProjectStorageConfigQuery({ projectRef: ref }, { enabled: IS_PLATFORM }) - const icebergCatalogEnabled = data?.features?.icebergCatalog?.enabled + const { data: buckets = [] } = useAnalyticsBucketsQuery({ projectRef: ref }) + const icebergCatalogEnabled = useIsAnalyticsBucketsEnabled({ projectRef: ref }) + const wrappersExtenstionNeedsUpgrading = wrappersExtensionState === 'needs-upgrade' const { mutate: sendEvent } = useSendEventMutation() @@ -126,64 +126,48 @@ export const CreateSpecializedBucketModal = ({ const config = BUCKET_TYPES['analytics'] const isCreating = isEnablingExtension || isCreatingIcebergWrapper || isCreatingAnalyticsBucket - const form = useForm({ + const form = useForm({ resolver: zodResolver(FormSchema), defaultValues: { name: '' }, }) - const onSubmit: SubmitHandler = async (values) => { + const onSubmit: SubmitHandler = async (values) => { if (!ref) return console.error('Project ref is required') if (!project) return console.error('Project details is required') if (!wrappersExtension) return console.error('Unable to find wrappers extension') - if (wrappersExtensionState === 'needs-upgrade') { - // [Joshen] Double check if this is the right CTA - return toast.error( -

- Wrappers extensions needs to be updated to create an Iceberg Wrapper. Update the extension - by disabling and enabling the wrappers extension first in - the{' '} - - database extensions page - {' '} - before creating an Analytics bucket. -

- ) - } + const hasExistingBucket = buckets.some((x) => x.id === values.name) + if (hasExistingBucket) return toast.error('Bucket name already exists') try { - if (bucketType === 'analytics') { - await createAnalyticsBucket({ - projectRef: ref, - bucketName: values.name, - }) + await createAnalyticsBucket({ + projectRef: ref, + bucketName: values.name, + }) - if (wrappersExtensionState === 'not-installed') { - await enableExtension({ - projectRef: project?.ref, - connectionString: project?.connectionString, - name: wrappersExtension.name, - schema: wrappersExtension.schema ?? 'extensions', - version: wrappersExtension.default_version, - }) - await createIcebergWrapper({ bucketName: values.name }) - } else if (wrappersExtensionState === 'installed') { - await createIcebergWrapper({ bucketName: values.name }) - } - } else { - // TODO for vectors bucket + if (wrappersExtensionState === 'not-installed') { + await enableExtension({ + projectRef: project?.ref, + connectionString: project?.connectionString, + name: wrappersExtension.name, + schema: wrappersExtension.schema ?? 'extensions', + version: wrappersExtension.default_version, + }) + await createIcebergWrapper({ bucketName: values.name }) + } else if (wrappersExtensionState === 'installed') { + await createIcebergWrapper({ bucketName: values.name }) } sendEvent({ action: 'storage_bucket_created', - properties: { bucketType }, + properties: { bucketType: 'analytics' }, groups: { project: ref ?? 'Unknown', organization: org?.slug ?? 'Unknown' }, }) toast.success(`Created bucket “${values.name}”`) form.reset() setVisible(false) - router.push(`/project/${ref}/storage/${bucketType}/buckets/${values.name}`) + router.push(`/project/${ref}/storage/analytics/buckets/${values.name}`) } catch (error: any) { toast.error(`Failed to create bucket: ${error.message}`) } @@ -227,7 +211,7 @@ export const CreateSpecializedBucketModal = ({ - + Create {config.singularName} bucket @@ -263,9 +247,27 @@ export const CreateSpecializedBucketModal = ({ )} /> - {bucketType === 'analytics' && ( + {wrappersExtenstionNeedsUpgrading ? ( + +

+ Update the wrappers extension by disabling and + enabling it in{' '} + + database extensions + {' '} + before creating an Analytics bucket.{' '} + + Learn more + + . +

+
+ ) : ( -

+

Supabase will install the{' '} {wrappersExtensionState !== 'installed' ? 'Wrappers extension and ' : ''} Iceberg Wrapper integration on your behalf.{' '} @@ -284,8 +286,13 @@ export const CreateSpecializedBucketModal = ({ - diff --git a/apps/studio/components/interfaces/Storage/AnalyticsBuckets/DeleteAnalyticsBucketModal.tsx b/apps/studio/components/interfaces/Storage/AnalyticsBuckets/DeleteAnalyticsBucketModal.tsx new file mode 100644 index 00000000000..0568c24ceb0 --- /dev/null +++ b/apps/studio/components/interfaces/Storage/AnalyticsBuckets/DeleteAnalyticsBucketModal.tsx @@ -0,0 +1,164 @@ +import { zodResolver } from '@hookform/resolvers/zod' +import { SubmitHandler, useForm } from 'react-hook-form' +import { toast } from 'sonner' +import z from 'zod' + +import { useParams } from 'common' +import { useAnalyticsBucketDeleteMutation } from 'data/storage/analytics-bucket-delete-mutation' +import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject' +import { + Button, + Dialog, + DialogContent, + DialogFooter, + DialogHeader, + DialogSection, + DialogSectionSeparator, + DialogTitle, + Form_Shadcn_, + FormControl_Shadcn_, + FormField_Shadcn_, + Input_Shadcn_, +} from 'ui' +import { Admonition } from 'ui-patterns' +import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout' +import { + useAnalyticsBucketAssociatedEntities, + useAnalyticsBucketDeleteCleanUp, +} from './AnalyticsBucketDetails/useAnalyticsBucketAssociatedEntities' + +export interface DeleteAnalyticsBucketModalProps { + visible: boolean + bucketId?: string + onClose: () => void + onSuccess?: () => void +} + +const formId = `delete-analytics-bucket-form` + +// [Joshen] Can refactor to use TextConfirmModal + +export const DeleteAnalyticsBucketModal = ({ + visible, + bucketId, + onClose, + onSuccess, +}: DeleteAnalyticsBucketModalProps) => { + const { ref: projectRef } = useParams() + const { data: project } = useSelectedProjectQuery() + + const schema = z.object({ + confirm: z.literal(bucketId, { + errorMap: () => ({ message: `Please enter "${bucketId}" to confirm` }), + }), + }) + + const form = useForm>({ + resolver: zodResolver(schema), + }) + + const { icebergWrapper, icebergWrapperMeta, s3AccessKey, publication } = + useAnalyticsBucketAssociatedEntities({ projectRef, bucketId: bucketId }) + + const { mutateAsync: deleteAnalyticsBucketCleanUp, isLoading: isCleaningUpAnalyticsBucket } = + useAnalyticsBucketDeleteCleanUp() + + const { mutate: deleteAnalyticsBucket, isLoading: isDeletingAnalyticsBucket } = + useAnalyticsBucketDeleteMutation({ + onSuccess: async () => { + if (project?.connectionString) { + await deleteAnalyticsBucketCleanUp({ + projectRef, + connectionString: project.connectionString, + bucketId: bucketId, + icebergWrapper, + icebergWrapperMeta, + s3AccessKey, + publication, + }) + } + toast.success(`Successfully deleted analytics bucket ${bucketId}`) + onClose() + onSuccess?.() + }, + }) + + const onSubmit: SubmitHandler> = async () => { + if (!projectRef) return console.error('Project ref is required') + if (!bucketId) return console.error('No bucket is selected') + deleteAnalyticsBucket({ projectRef, id: bucketId }) + } + + const isDeleting = isDeletingAnalyticsBucket || isCleaningUpAnalyticsBucket + + return ( +

{ + if (!open) onClose() + }} + > + + + Confirm deletion of {bucketId} + + + + + + + +

+ Your bucket {bucketId} and all its + contents will be permanently deleted. +

+
+ + + +
+ ( + + Type {bucketId} to + confirm. + + } + > + + + + + )} + /> + +
+
+ + + + +
+
+ ) +} diff --git a/apps/studio/components/interfaces/Storage/AnalyticsBuckets.tsx b/apps/studio/components/interfaces/Storage/AnalyticsBuckets/index.tsx similarity index 75% rename from apps/studio/components/interfaces/Storage/AnalyticsBuckets.tsx rename to apps/studio/components/interfaces/Storage/AnalyticsBuckets/index.tsx index bd797d70cd7..f02ae2c05e4 100644 --- a/apps/studio/components/interfaces/Storage/AnalyticsBuckets.tsx +++ b/apps/studio/components/interfaces/Storage/AnalyticsBuckets/index.tsx @@ -1,6 +1,5 @@ -import { MoreVertical, Search, Trash2 } from 'lucide-react' +import { ExternalLink, MoreVertical, Search, Trash2 } from 'lucide-react' import Link from 'next/link' -import { useRouter } from 'next/router' import { useState } from 'react' import { useParams } from 'common' @@ -21,16 +20,13 @@ import { TableHeader, TableRow, } from 'ui' -import { TimestampInfo } from 'ui-patterns' +import { Admonition, TimestampInfo } from 'ui-patterns' import { Input } from 'ui-patterns/DataInputs/Input' -import { CreateSpecializedBucketModal } from './CreateSpecializedBucketModal' -import { DeleteBucketModal } from './DeleteBucketModal' -import { EmptyBucketState } from './EmptyBucketState' - -// [Joshen] Remove typecasts bucket: any once infra changes for analytics bucket is in +import { EmptyBucketState } from '../EmptyBucketState' +import { CreateAnalyticsBucketModal } from './CreateAnalyticsBucketModal' +import { DeleteAnalyticsBucketModal } from './DeleteAnalyticsBucketModal' export const AnalyticsBuckets = () => { - const router = useRouter() const { ref } = useParams() const [filterString, setFilterString] = useState('') @@ -41,19 +37,41 @@ export const AnalyticsBuckets = () => { projectRef: ref, }) - const analyticsBuckets = buckets.filter((bucket: any) => + const analyticsBuckets = buckets.filter((bucket) => filterString.length === 0 ? true : bucket.id.toLowerCase().includes(filterString.toLowerCase()) ) return ( - <> + + }> + + Leave feedback + + + } + > +

+ Expect rapid changes, limited features, and possible breaking updates as we expand access. +

+

Please share feedback as we refine the experience!

+
+ {!isLoadingBuckets && - buckets.filter((bucket: any) => !('type' in bucket) || bucket.type === 'ANALYTICS').length === + buckets.filter((bucket) => !('type' in bucket) || bucket.type === 'ANALYTICS').length === 0 ? ( ) : ( - // Override the default first:pt-12 to match other storage types - +
Buckets @@ -66,11 +84,7 @@ export const AnalyticsBuckets = () => { onChange={(e) => setFilterString(e.target.value)} icon={} /> - +
{isLoadingBuckets ? ( @@ -96,7 +110,7 @@ export const AnalyticsBuckets = () => { )} - {analyticsBuckets.map((bucket: any) => ( + {analyticsBuckets.map((bucket) => (

{bucket.id}

@@ -145,16 +159,16 @@ export const AnalyticsBuckets = () => { )} -
+
)} {selectedBucket && ( - setModal(null)} /> )} - + ) } diff --git a/apps/studio/components/interfaces/Storage/BucketsComingSoon.tsx b/apps/studio/components/interfaces/Storage/BucketsComingSoon.tsx new file mode 100644 index 00000000000..30416d60e81 --- /dev/null +++ b/apps/studio/components/interfaces/Storage/BucketsComingSoon.tsx @@ -0,0 +1,36 @@ +import { ScaffoldSection } from 'components/layouts/Scaffold' +import { Bucket } from 'icons' +import { ExternalLink } from 'lucide-react' +import Link from 'next/link' +import { Button } from 'ui' + +export const BucketsComingSoon = ({ type }: { type: 'analytics' | 'vector' }) => { + return ( + + + + ) +} diff --git a/apps/studio/components/interfaces/Storage/CreateBucketModal.tsx b/apps/studio/components/interfaces/Storage/CreateBucketModal.tsx index 8db8ca83806..f816ff02392 100644 --- a/apps/studio/components/interfaces/Storage/CreateBucketModal.tsx +++ b/apps/studio/components/interfaces/Storage/CreateBucketModal.tsx @@ -1,29 +1,22 @@ import { zodResolver } from '@hookform/resolvers/zod' import { PermissionAction } from '@supabase/shared-types/out/constants' -import { snakeCase } from 'lodash' import { Plus } from 'lucide-react' -import { useRouter } from 'next/router' import { useState } from 'react' import { SubmitHandler, useForm } from 'react-hook-form' import { toast } from 'sonner' import z from 'zod' import { useParams } from 'common' -import { useIcebergWrapperExtension } from 'components/interfaces/Storage/AnalyticsBucketDetails/useIcebergWrapper' import { StorageSizeUnits } from 'components/interfaces/Storage/StorageSettings/StorageSettings.constants' import { ButtonTooltip } from 'components/ui/ButtonTooltip' import { InlineLink } from 'components/ui/InlineLink' import { useProjectStorageConfigQuery } from 'data/config/project-storage-config-query' import { useBucketCreateMutation } from 'data/storage/bucket-create-mutation' -import { useIcebergWrapperCreateMutation } from 'data/storage/iceberg-wrapper-create-mutation' import { useSendEventMutation } from 'data/telemetry/send-event-mutation' import { useAsyncCheckPermissions } from 'hooks/misc/useCheckPermissions' import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization' -import { BASE_PATH, IS_PLATFORM } from 'lib/constants' +import { IS_PLATFORM } from 'lib/constants' import { - Alert_Shadcn_, - AlertDescription_Shadcn_, - AlertTitle_Shadcn_, Button, Dialog, DialogContent, @@ -38,22 +31,16 @@ import { FormField_Shadcn_, FormMessage_Shadcn_, Input_Shadcn_, - Label_Shadcn_, - RadioGroupStacked, - RadioGroupStackedItem, Select_Shadcn_, SelectContent_Shadcn_, SelectItem_Shadcn_, SelectTrigger_Shadcn_, SelectValue_Shadcn_, Switch, - WarningIcon, } from 'ui' import { Admonition } from 'ui-patterns/admonition' import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout' -import { useIsNewStorageUIEnabled } from '../App/FeaturePreview/FeaturePreviewContext' import { inverseValidBucketNameRegex, validBucketNameRegex } from './CreateBucketModal.utils' -import { BUCKET_TYPES } from './Storage.constants' import { convertFromBytes, convertToBytes } from './StorageSettings/StorageSettings.utils' const FormSchema = z @@ -71,7 +58,6 @@ const FormSchema = z (value) => value !== 'public', '"public" is a reserved name. Please choose another name' ), - type: z.enum(['STANDARD', 'ANALYTICS']).default('STANDARD'), public: z.boolean().default(false), has_file_size_limit: z.boolean().default(false), formatted_size_limit: z.coerce @@ -110,60 +96,42 @@ export const CreateBucketModal = ({ buttonClassName, label = 'New bucket', }: CreateBucketModalProps) => { - const router = useRouter() const { ref } = useParams() const { data: org } = useSelectedOrganizationQuery() - const isStorageV2 = useIsNewStorageUIEnabled() const [visible, setVisible] = useState(false) const [selectedUnit, setSelectedUnit] = useState(StorageSizeUnits.MB) + const [hasAllowedMimeTypes, setHasAllowedMimeTypes] = useState(false) const { can: canCreateBuckets } = useAsyncCheckPermissions(PermissionAction.STORAGE_WRITE, '*') - const { mutate: sendEvent } = useSendEventMutation() - const { mutateAsync: createBucket, isLoading: isCreating } = useBucketCreateMutation({ - // [Joshen] Silencing the error here as it's being handled in onSubmit - onError: () => {}, - }) - const { mutateAsync: createIcebergWrapper, isLoading: isCreatingIcebergWrapper } = - useIcebergWrapperCreateMutation() - const { data } = useProjectStorageConfigQuery({ projectRef: ref }, { enabled: IS_PLATFORM }) const { value, unit } = convertFromBytes(data?.fileSizeLimit ?? 0) const formattedGlobalUploadLimit = `${value} ${unit}` - const config = BUCKET_TYPES['files'] + const { mutate: sendEvent } = useSendEventMutation() + const { mutateAsync: createBucket, isLoading: isCreatingBucket } = useBucketCreateMutation({ + // [Joshen] Silencing the error here as it's being handled in onSubmit + onError: () => {}, + }) const form = useForm({ resolver: zodResolver(FormSchema), defaultValues: { name: '', public: false, - type: 'STANDARD', has_file_size_limit: false, formatted_size_limit: undefined, allowed_mime_types: '', }, }) const { formatted_size_limit: formattedSizeLimitError } = form.formState.errors - - const bucketName = snakeCase(form.watch('name')) const isPublicBucket = form.watch('public') - const isStandardBucket = form.watch('type') === 'STANDARD' const hasFileSizeLimit = form.watch('has_file_size_limit') - const [hasAllowedMimeTypes, setHasAllowedMimeTypes] = useState(false) - const { state: icebergWrapperExtensionState } = useIcebergWrapperExtension() - const icebergCatalogEnabled = data?.features?.icebergCatalog?.enabled const onSubmit: SubmitHandler = async (values) => { if (!ref) return console.error('Project ref is required') - if (values.type === 'ANALYTICS' && !icebergCatalogEnabled) { - return toast.error( - 'The Analytics catalog feature is not enabled for your project. Please contact support to enable it.' - ) - } - // [Joshen] Should shift this into superRefine in the form schema try { const fileSizeLimit = @@ -186,27 +154,21 @@ export const CreateBucketModal = ({ await createBucket({ projectRef: ref, id: values.name, - type: values.type, + type: 'STANDARD', isPublic: values.public, file_size_limit: fileSizeLimit, allowed_mime_types: allowedMimeTypes, }) sendEvent({ action: 'storage_bucket_created', - properties: { bucketType: values.type }, + properties: { bucketType: 'STANDARD' }, groups: { project: ref ?? 'Unknown', organization: org?.slug ?? 'Unknown' }, }) - if (values.type === 'ANALYTICS' && icebergWrapperExtensionState === 'installed') { - await createIcebergWrapper({ bucketName: values.name }) - } - toast.success(`Successfully created bucket ${values.name}`) form.reset() - setSelectedUnit(StorageSizeUnits.MB) setVisible(false) - if (!isStorageV2) router.push(`/project/${ref}/storage/buckets/${values.name}`) } catch (error: any) { // Handle specific error cases for inline display const errorMessage = error.message?.toLowerCase() || '' @@ -267,7 +229,7 @@ export const CreateBucketModal = ({ - Create a {isStorageV2 ? config.singularName : 'storage'} bucket + Create a storage bucket @@ -299,344 +261,197 @@ export const CreateBucketModal = ({ )} /> + - {!isStorageV2 && ( - ( - - - field.onChange(v)} - > - - {IS_PLATFORM && ( - - <> -

- Stores Iceberg files and is optimized for analytical workloads. -

+ - {icebergCatalogEnabled ? null : ( -
- - - This feature is currently in alpha and not yet enabled for - your project. Sign up{' '} - - here - - . - -
- )} - -
- )} -
-
-
- )} + + ( + + + + + + )} + /> + {isPublicBucket && ( + )} - {isStandardBucket ? ( - <> - - ( - - - - - - )} - /> - {isPublicBucket && ( - - )} - - - - - - ( - - - - - - )} - /> - - {hasFileSizeLimit && ( -
- ( - -
-
- - - -
-
- - - {selectedUnit} - - - {Object.values(StorageSizeUnits).map((unit: string) => ( - - {unit} - - ))} - - -
-
-
- )} - /> - {formattedSizeLimitError?.message === 'exceed_global_limit' && ( - - Exceeds global limit of {formattedGlobalUploadLimit}. Increase limit in{' '} - setVisible(false)} - > - Storage Settings - {' '} - first. - - )} - - {IS_PLATFORM && ( -

- This project has a{' '} - setVisible(false)} - > - global file size limit - {' '} - of {formattedGlobalUploadLimit}. -

- )} -
- )} -
- - - - + + ( - {hasAllowedMimeTypes && ( - ( - - - - - - )} - /> - )} - - - ) : ( - <> - {icebergWrapperExtensionState === 'installed' ? ( - - -

- Supabase will setup a - - foreign data wrapper - {bucketName && {`${bucketName}_fdw`}} - - - {' '} - for easier access to the data. This action will also create{' '} - - S3 Access Keys - {bucketName && ( - <> - {' '} - named {`${bucketName}_keys`} - - )} - - and - - four Vault Secrets - {bucketName && ( - <> - {' '} - prefixed with{' '} - {`${bucketName}_vault_`} - - )} - - . - -

-

- As a final step, you'll need to create an{' '} - Iceberg namespace before you - connect the Iceberg data to your database. -

-
-
- ) : ( - - - - You need to install the Iceberg wrapper extension to connect your Analytic - bucket to your database. - - -

- You need to install the wrappers{' '} - extension (with the minimum version of 0.5.3) if you want to - connect your Analytics bucket to your database. -

-
-
)} - - )} + /> + + {hasFileSizeLimit && ( +
+ ( + +
+
+ + + +
+
+ + + {selectedUnit} + + + {Object.values(StorageSizeUnits).map((unit: string) => ( + + {unit} + + ))} + + +
+
+
+ )} + /> + {formattedSizeLimitError?.message === 'exceed_global_limit' && ( + + Exceeds global limit of {formattedGlobalUploadLimit}. Increase limit in{' '} + setVisible(false)} + > + Storage Settings + {' '} + first. + + )} + + {IS_PLATFORM && ( +

+ This project has a{' '} + setVisible(false)} + > + global file size limit + {' '} + of {formattedGlobalUploadLimit}. +

+ )} +
+ )} +
+ + + + + + + + + + {hasAllowedMimeTypes && ( + ( + + + + + + )} + /> + )} + - diff --git a/apps/studio/components/interfaces/Storage/DeleteBucketModal.tsx b/apps/studio/components/interfaces/Storage/DeleteBucketModal.tsx index 40e67daa13b..c75c54bc234 100644 --- a/apps/studio/components/interfaces/Storage/DeleteBucketModal.tsx +++ b/apps/studio/components/interfaces/Storage/DeleteBucketModal.tsx @@ -8,7 +8,6 @@ import z from 'zod' import { useParams } from 'common' import { useDatabasePoliciesQuery } from 'data/database-policies/database-policies-query' import { useDatabasePolicyDeleteMutation } from 'data/database-policies/database-policy-delete-mutation' -import { useAnalyticsBucketDeleteMutation } from 'data/storage/analytics-bucket-delete-mutation' import { AnalyticsBucket } from 'data/storage/analytics-buckets-query' import { useBucketDeleteMutation } from 'data/storage/bucket-delete-mutation' import { Bucket, useBucketsQuery } from 'data/storage/buckets-query' @@ -29,11 +28,6 @@ import { } from 'ui' import { Admonition } from 'ui-patterns' import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout' -import { useIsNewStorageUIEnabled } from '../App/FeaturePreview/FeaturePreviewContext' -import { - useAnalyticsBucketAssociatedEntities, - useAnalyticsBucketDeleteCleanUp, -} from './AnalyticsBucketDetails/useAnalyticsBucketAssociatedEntities' import { formatPoliciesForStorage } from './Storage.utils' export interface DeleteBucketModalProps { @@ -46,11 +40,8 @@ const formId = `delete-storage-bucket-form` export const DeleteBucketModal = ({ visible, bucket, onClose }: DeleteBucketModalProps) => { const router = useRouter() - const { ref: projectRef } = useParams() + const { ref: projectRef, bucketId } = useParams() const { data: project } = useSelectedProjectQuery() - const isStorageV2 = useIsNewStorageUIEnabled() - - const isStandardBucketSelected = 'type' in bucket && bucket.type === 'STANDARD' const schema = z.object({ confirm: z.literal(bucket.id, { @@ -71,12 +62,6 @@ export const DeleteBucketModal = ({ visible, bucket, onClose }: DeleteBucketModa schema: 'storage', }) - const { icebergWrapper, icebergWrapperMeta, s3AccessKey, publication } = - useAnalyticsBucketAssociatedEntities( - { projectRef, bucketId: bucket.id }, - { enabled: !isStandardBucketSelected } - ) - const { mutateAsync: deletePolicy } = useDatabasePolicyDeleteMutation() const { mutate: deleteBucket, isLoading: isDeletingBucket } = useBucketDeleteMutation({ @@ -107,11 +92,7 @@ export const DeleteBucketModal = ({ visible, bucket, onClose }: DeleteBucketModa ) toast.success(`Successfully deleted bucket ${bucket.id}`) - if (isStorageV2) { - router.push(`/project/${projectRef}/storage/files`) - } else { - router.push(`/project/${projectRef}/storage/buckets`) - } + if (!!bucketId) router.push(`/project/${projectRef}/storage/files`) onClose() } catch (error) { toast.success( @@ -121,51 +102,12 @@ export const DeleteBucketModal = ({ visible, bucket, onClose }: DeleteBucketModa }, }) - const { mutateAsync: deleteAnalyticsBucketCleanUp, isLoading: isCleaningUpAnalyticsBucket } = - useAnalyticsBucketDeleteCleanUp() - - const { mutate: deleteAnalyticsBucket, isLoading: isDeletingAnalyticsBucket } = - useAnalyticsBucketDeleteMutation({ - onSuccess: async () => { - if (project?.connectionString) { - await deleteAnalyticsBucketCleanUp({ - projectRef, - connectionString: project.connectionString, - bucketId: bucket.id, - icebergWrapper, - icebergWrapperMeta, - s3AccessKey, - publication, - }) - } - toast.success(`Successfully deleted analytics bucket ${bucket.id}`) - if (isStorageV2) { - router.push(`/project/${projectRef}/storage/analytics`) - } else { - router.push(`/project/${projectRef}/storage/buckets`) - } - onClose() - }, - }) - const onSubmit: SubmitHandler> = async () => { if (!projectRef) return console.error('Project ref is required') if (!bucket) return console.error('No bucket is selected') - - // [Joshen] We'll need a third case to figure out for vector buckets - if (isStandardBucketSelected) { - deleteBucket({ projectRef, id: bucket.id }) - } else { - if (isStorageV2) { - deleteAnalyticsBucket({ projectRef, id: bucket.id }) - } else { - deleteBucket({ projectRef, id: bucket.id }) - } - } + deleteBucket({ projectRef, id: bucket.id }) } - const isDeleting = isDeletingBucket || isDeletingAnalyticsBucket || isCleaningUpAnalyticsBucket - return ( - - diff --git a/apps/studio/components/interfaces/Storage/EmptyBucketState.tsx b/apps/studio/components/interfaces/Storage/EmptyBucketState.tsx index dde4c6e3166..8a917dae18e 100644 --- a/apps/studio/components/interfaces/Storage/EmptyBucketState.tsx +++ b/apps/studio/components/interfaces/Storage/EmptyBucketState.tsx @@ -1,18 +1,27 @@ import { BucketAdd } from 'icons' +import { cn } from 'ui' +import { CreateAnalyticsBucketModal } from './AnalyticsBuckets/CreateAnalyticsBucketModal' import { CreateBucketModal } from './CreateBucketModal' -import { CreateSpecializedBucketModal } from './CreateSpecializedBucketModal' import { BUCKET_TYPES } from './Storage.constants' +import { CreateVectorBucketDialog } from './VectorBuckets/CreateVectorBucketDialog' interface EmptyBucketStateProps { bucketType: keyof typeof BUCKET_TYPES + className?: string } -export const EmptyBucketState = ({ bucketType }: EmptyBucketStateProps) => { +export const EmptyBucketState = ({ bucketType, className }: EmptyBucketStateProps) => { const config = BUCKET_TYPES[bucketType] return ( -
+ + + + {isLoading ? ( + + ) : ( + + + + )} + + )} + + {selectedBucket && ( + <> + setModal(null)} + /> + setModal(null)} + /> + setModal(null)} + /> + + )} + + ) +} diff --git a/apps/studio/components/interfaces/Storage/StorageExplorer/FileExplorerHeader.tsx b/apps/studio/components/interfaces/Storage/StorageExplorer/FileExplorerHeader.tsx index c42bde0e89c..abfc34bbbf4 100644 --- a/apps/studio/components/interfaces/Storage/StorageExplorer/FileExplorerHeader.tsx +++ b/apps/studio/components/interfaces/Storage/StorageExplorer/FileExplorerHeader.tsx @@ -16,16 +16,14 @@ import { } from 'lucide-react' import { useCallback, useEffect, useRef, useState } from 'react' -import { - useIsAPIDocsSidePanelEnabled, - useIsNewStorageUIEnabled, -} from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext' +import { useIsAPIDocsSidePanelEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext' import { APIDocsButton } from 'components/ui/APIDocsButton' import { ButtonTooltip } from 'components/ui/ButtonTooltip' import { useAsyncCheckPermissions } from 'hooks/misc/useCheckPermissions' import { useStorageExplorerStateSnapshot } from 'state/storage-explorer' import { Button, + cn, DropdownMenu, DropdownMenuContent, DropdownMenuItem, @@ -58,23 +56,23 @@ const SORT_ORDER_OPTIONS = [ const HeaderPathEdit = ({ loading, isSearching, breadcrumbs, togglePathEdit }: any) => { return (
(!loading.isLoading ? togglePathEdit() : {})} > {loading.isLoading ? ( -
- -

{loading.message}

+
+ +

{loading.message}

) : ( -
-

{breadcrumbs[breadcrumbs.length - 1] || ''}

+
+ {breadcrumbs.length > 1 && ( +

{breadcrumbs[breadcrumbs.length - 1] || ''}

+ )} {!isSearching && ( -
- -
+ )}
)} @@ -151,7 +149,6 @@ export const FileExplorerHeader = ({ const debounceDuration = 300 const snap = useStorageExplorerStateSnapshot() const isNewAPIDocsEnabled = useIsAPIDocsSidePanelEnabled() - const isNewStorageUIEnabled = useIsNewStorageUIEnabled() const [pathString, setPathString] = useState('') const [searchString, setSearchString] = useState('') @@ -283,10 +280,11 @@ export const FileExplorerHeader = ({ return (
{/* Navigation */}
@@ -334,29 +332,12 @@ export const FileExplorerHeader = ({ /> ) : snap.view === STORAGE_VIEWS.COLUMNS ? ( - breadcrumbs.length > 1 ? ( - - ) : isNewStorageUIEnabled ? ( -
-
- -
-
- ) : ( - - ) + ) : breadcrumbs.length > 1 ? ( = {} + { ...options }: UseCustomQueryOptions = {} ) => { const { getPathAlongOpenedFolders } = useStorageExplorerStateSnapshot() const pathToFile = getPathAlongOpenedFolders(false) diff --git a/apps/studio/components/interfaces/Storage/StorageExplorer/useSelectedBucket.ts b/apps/studio/components/interfaces/Storage/StorageExplorer/useSelectedBucket.ts index 72149e736f4..b44317600dd 100644 --- a/apps/studio/components/interfaces/Storage/StorageExplorer/useSelectedBucket.ts +++ b/apps/studio/components/interfaces/Storage/StorageExplorer/useSelectedBucket.ts @@ -1,22 +1,20 @@ import { useParams } from 'common' -import { useIsNewStorageUIEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext' +import { useIsAnalyticsBucketsEnabled } from 'data/config/project-storage-config-query' import { useAnalyticsBucketsQuery } from 'data/storage/analytics-buckets-query' import { useBucketsQuery } from 'data/storage/buckets-query' import { useStorageV2Page } from '../Storage.utils' -// [Joshen] Adding isStorageV2 checks here to support the existing UI while API changes are not on prod just yet - export const useSelectedBucket = () => { const { ref, bucketId } = useParams() - const isStorageV2 = useIsNewStorageUIEnabled() const page = useStorageV2Page() + const hasIcebergEnabled = useIsAnalyticsBucketsEnabled({ projectRef: ref }) const { data: analyticsBuckets = [], isSuccess: isSuccessAnalyticsBuckets, isError: isErrorAnalyticsBuckets, error: errorAnalyticsBuckets, - } = useAnalyticsBucketsQuery({ projectRef: ref }, { enabled: isStorageV2 }) + } = useAnalyticsBucketsQuery({ projectRef: ref }) const { data: buckets = [], @@ -25,18 +23,18 @@ export const useSelectedBucket = () => { error: errorBuckets, } = useBucketsQuery({ projectRef: ref }) - const isSuccess = isStorageV2 ? isSuccessBuckets && isSuccessAnalyticsBuckets : isSuccessBuckets - const isError = isStorageV2 ? isErrorBuckets || isErrorAnalyticsBuckets : isErrorBuckets - const error = isStorageV2 ? errorBuckets || errorAnalyticsBuckets : errorBuckets + const isSuccess = hasIcebergEnabled + ? isSuccessBuckets && isSuccessAnalyticsBuckets + : isSuccessBuckets + const isError = hasIcebergEnabled ? isErrorBuckets || isErrorAnalyticsBuckets : isErrorBuckets + const error = hasIcebergEnabled ? errorBuckets || errorAnalyticsBuckets : errorBuckets const bucket = page === 'files' ? buckets.find((b) => b.id === bucketId) : page === 'analytics' ? analyticsBuckets.find((b: any) => b.id === bucketId) - : // [Joshen] Remove typecasts bucket: any once infra changes for analytics bucket is in - // [Joshen] Temp fallback to buckets for backwards compatibility old UI - buckets.find((b) => b.id === bucketId) + : buckets.find((b) => b.id === bucketId) return { bucket, isSuccess, isError, error } } diff --git a/apps/studio/components/interfaces/Storage/StorageMenu.BucketList.tsx b/apps/studio/components/interfaces/Storage/StorageMenu.BucketList.tsx deleted file mode 100644 index ee564a893d1..00000000000 --- a/apps/studio/components/interfaces/Storage/StorageMenu.BucketList.tsx +++ /dev/null @@ -1,94 +0,0 @@ -import type { CSSProperties } from 'react' -import { memo, useCallback, useMemo } from 'react' - -import { InfiniteListDefault } from 'components/ui/InfiniteList' -import type { Bucket } from 'data/storage/buckets-query' -import { cn } from 'ui' -import { BucketRow } from './BucketRow' - -type VirtualizedBucketRowProps = { - item: Bucket - projectRef?: string - selectedBucketId?: string - style?: CSSProperties -} - -const BUCKET_ROW_HEIGHT = 'h-7' - -const VirtualizedBucketRow = memo( - ({ item, projectRef, selectedBucketId, style }: VirtualizedBucketRowProps) => { - const isSelected = selectedBucketId === item.id - - return ( - - ) - } -) -VirtualizedBucketRow.displayName = 'VirtualizedBucketRow' - -const BucketListVirtualized = ({ buckets, selectedBucketId, projectRef = '' }: BucketListProps) => { - const itemData = useMemo( - () => ({ - projectRef, - selectedBucketId, - }), - [projectRef, selectedBucketId] - ) - - const getItemKey = useCallback( - (index: number) => { - const item = buckets[index] - return item?.id || `bucket-${index}` - }, - [buckets] - ) - - return ( - 28} - ItemComponent={VirtualizedBucketRow} - // There is no loader because all buckets load from backend at once - LoaderComponent={() => null} - /> - ) -} - -type BucketListProps = { - buckets: Bucket[] - selectedBucketId?: string - projectRef?: string -} - -export const BucketList = ({ buckets, selectedBucketId, projectRef = '' }: BucketListProps) => { - const numBuckets = buckets.length - - if (numBuckets <= 50) { - return buckets.map((bucket) => ( - - )) - } - - return ( - - ) -} diff --git a/apps/studio/components/interfaces/Storage/StorageMenu.tsx b/apps/studio/components/interfaces/Storage/StorageMenu.tsx deleted file mode 100644 index 7b0c795f94d..00000000000 --- a/apps/studio/components/interfaces/Storage/StorageMenu.tsx +++ /dev/null @@ -1,203 +0,0 @@ -import Link from 'next/link' -import { useRouter } from 'next/router' -import { useMemo, useState } from 'react' - -import { useFlag, useParams } from 'common' -import { CreateBucketModal } from 'components/interfaces/Storage/CreateBucketModal' -import ShimmeringLoader from 'components/ui/ShimmeringLoader' -import { useProjectStorageConfigQuery } from 'data/config/project-storage-config-query' -import { useBucketsQuery } from 'data/storage/buckets-query' -import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject' -import { IS_PLATFORM } from 'lib/constants' -import { useStorageExplorerStateSnapshot } from 'state/storage-explorer' -import { Alert_Shadcn_, AlertDescription_Shadcn_, AlertTitle_Shadcn_, cn, Menu } from 'ui' -import { InfoTooltip } from 'ui-patterns/info-tooltip' -import { - InnerSideBarEmptyPanel, - InnerSideBarFilters, - InnerSideBarFilterSearchInput, - InnerSideBarFilterSortDropdown, - InnerSideBarFilterSortDropdownItem, -} from 'ui-patterns/InnerSideMenu' -import { BucketList } from './StorageMenu.BucketList' - -export const StorageMenu = () => { - const router = useRouter() - const { ref, bucketId } = useParams() - const { data: projectDetails } = useSelectedProjectQuery() - const snap = useStorageExplorerStateSnapshot() - - const showMigrationCallout = useFlag('storageMigrationCallout') - const { data: config } = useProjectStorageConfigQuery( - { projectRef: ref }, - { enabled: showMigrationCallout } - ) - const isListV2UpgradeAvailable = - !!config && !config.capabilities.list_v2 && config.external.upstreamTarget === 'main' - - const isBranch = projectDetails?.parent_project_ref !== undefined - - const [searchText, setSearchText] = useState('') - - const page = router.pathname.split('/')[4] as - | undefined - | 'policies' - | 'settings' - | 'usage' - | 'logs' - - const { - data: buckets = [], - error, - isLoading, - isError, - isSuccess, - } = useBucketsQuery({ projectRef: ref }) - const sortedBuckets = useMemo( - () => - snap.sortBucket === 'alphabetical' - ? buckets.sort((a, b) => - a.name.toLowerCase().trim().localeCompare(b.name.toLowerCase().trim()) - ) - : buckets.sort((a, b) => (new Date(b.created_at) > new Date(a.created_at) ? -1 : 1)), - [buckets, snap.sortBucket] - ) - const filteredBuckets = useMemo( - () => - searchText.length > 1 - ? sortedBuckets.filter((bucket) => bucket.name.includes(searchText.trim())) - : sortedBuckets, - [sortedBuckets, searchText] - ) - const tempNotSupported = error?.message.includes('Tenant config') && isBranch - const isVirtualized = buckets.length > 50 - - return ( - <> - -
- - - - { - setSearchText(e.target.value) - }} - > - snap.setSortBucket(value)} - > - - Alphabetical - - - Created at - - - - -
- -
-
0 - ? 'mb-3' - : 'mb-5' - )} - > - All buckets} /> - - {isLoading && ( -
- - - -
- )} - - {isError && ( -
- - - {tempNotSupported - ? 'Storage is not available on preview branches for now' - : 'Failed to fetch buckets'} - - - {tempNotSupported - ? "We're actively looking into making this available on preview branches" - : 'Please refresh to try again'} - - -
- )} - - {isSuccess && ( - <> - {buckets.length === 0 && ( - - )} - {searchText.length > 0 && filteredBuckets.length === 0 && ( - - )} - {filteredBuckets.length > 0 && ( - - )} - - )} -
-
- -
- Configuration} /> - - -

Policies

-
- - {IS_PLATFORM && ( - - -
-

Settings

- {isListV2UpgradeAvailable && ( - Upgrade available - )} -
-
- - )} -
-
- - ) -} diff --git a/apps/studio/components/interfaces/Storage/StorageMenuV2.tsx b/apps/studio/components/interfaces/Storage/StorageMenuV2.tsx index b3ef2cc665a..3bd7d775962 100644 --- a/apps/studio/components/interfaces/Storage/StorageMenuV2.tsx +++ b/apps/studio/components/interfaces/Storage/StorageMenuV2.tsx @@ -1,7 +1,11 @@ import Link from 'next/link' import { IS_PLATFORM, useParams } from 'common' -import { Menu } from 'ui' +import { + useIsAnalyticsBucketsEnabled, + useIsVectorBucketsEnabled, +} from 'data/config/project-storage-config-query' +import { Badge, Menu } from 'ui' import { BUCKET_TYPES, BUCKET_TYPE_KEYS } from './Storage.constants' import { useStorageV2Page } from './Storage.utils' @@ -9,6 +13,9 @@ export const StorageMenuV2 = () => { const { ref } = useParams() const page = useStorageV2Page() + const isAnalyticsBucketsEnabled = useIsAnalyticsBucketsEnabled({ projectRef: ref }) + const isVectorBucketsEnabled = useIsVectorBucketsEnabled({ projectRef: ref }) + return (
@@ -18,11 +25,17 @@ export const StorageMenuV2 = () => { {BUCKET_TYPE_KEYS.map((bucketTypeKey) => { const isSelected = page === bucketTypeKey const config = BUCKET_TYPES[bucketTypeKey] + const isAlphaEnabled = + (bucketTypeKey === 'analytics' && isAnalyticsBucketsEnabled) || + (bucketTypeKey === 'vectors' && isVectorBucketsEnabled) return ( -

{config.displayName}

+
+

{config.displayName}

+ {isAlphaEnabled && ALPHA} +
) diff --git a/apps/studio/components/interfaces/Storage/VectorBuckets/CreateVectorBucketDialog.tsx b/apps/studio/components/interfaces/Storage/VectorBuckets/CreateVectorBucketDialog.tsx new file mode 100644 index 00000000000..354ae2596f3 --- /dev/null +++ b/apps/studio/components/interfaces/Storage/VectorBuckets/CreateVectorBucketDialog.tsx @@ -0,0 +1,178 @@ +import { zodResolver } from '@hookform/resolvers/zod' +import { PermissionAction } from '@supabase/shared-types/out/constants' +import { Plus } from 'lucide-react' +import { useEffect, useState } from 'react' +import { SubmitHandler, useForm } from 'react-hook-form' +import { toast } from 'sonner' +import z from 'zod' + +import { useParams } from 'common' +import { ButtonTooltip } from 'components/ui/ButtonTooltip' +import { useVectorBucketCreateMutation } from 'data/storage/vector-bucket-create-mutation' +import { useVectorBucketsQuery } from 'data/storage/vector-buckets-query' +import { useSendEventMutation } from 'data/telemetry/send-event-mutation' +import { useAsyncCheckPermissions } from 'hooks/misc/useCheckPermissions' +import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization' +import { + Button, + Dialog, + DialogContent, + DialogFooter, + DialogHeader, + DialogSection, + DialogSectionSeparator, + DialogTitle, + DialogTrigger, + Form_Shadcn_, + FormControl_Shadcn_, + FormField_Shadcn_, + Input_Shadcn_, +} from 'ui' +import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout' +import { inverseValidBucketNameRegex, validBucketNameRegex } from '../CreateBucketModal.utils' + +const FormSchema = z.object({ + name: z + .string() + .trim() + .min(1, 'Please provide a name for your bucket') + .max(100, 'Bucket name should be below 100 characters') + .superRefine((name, ctx) => { + if (!validBucketNameRegex.test(name)) { + const [match] = name.match(inverseValidBucketNameRegex) ?? [] + ctx.addIssue({ + path: [], + code: z.ZodIssueCode.custom, + message: !!match + ? `Bucket name cannot contain the "${match}" character` + : 'Bucket name contains an invalid special character', + }) + } + }), +}) + +const formId = 'create-storage-bucket-form' + +export type CreateBucketForm = z.infer + +export const CreateVectorBucketDialog = () => { + const { ref } = useParams() + const { data: org } = useSelectedOrganizationQuery() + + const [visible, setVisible] = useState(false) + const { can: canCreateBuckets } = useAsyncCheckPermissions(PermissionAction.STORAGE_WRITE, '*') + + const { data } = useVectorBucketsQuery({ projectRef: ref }) + + const form = useForm({ + resolver: zodResolver(FormSchema), + defaultValues: { name: '' }, + }) + + const { mutate: sendEvent } = useSendEventMutation() + const { mutate: createVectorBucket, isLoading: isCreating } = useVectorBucketCreateMutation({ + onSuccess: (values) => { + sendEvent({ + action: 'storage_bucket_created', + properties: { bucketType: 'vector' }, + groups: { project: ref ?? 'Unknown', organization: org?.slug ?? 'Unknown' }, + }) + toast.success(`Successfully created vector bucket ${values.name}`) + form.reset() + setVisible(false) + }, + onError: (error) => { + toast.error(`Failed to create vector bucket: ${error.message}`) + }, + }) + + const onSubmit: SubmitHandler = async (values) => { + if (!ref) return console.error('Project ref is required') + + const hasExistingBucket = (data?.vectorBuckets ?? []).some( + (x) => x.vectorBucketName === values.name + ) + if (hasExistingBucket) return toast.error('Bucket name already exists') + + createVectorBucket({ projectRef: ref, bucketName: values.name }) + } + + useEffect(() => { + if (!visible) form.reset() + }, [visible]) + + return ( + + + } + disabled={!canCreateBuckets} + onClick={() => setVisible(true)} + tooltip={{ + content: { + side: 'bottom', + text: !canCreateBuckets + ? 'You need additional permissions to create buckets' + : undefined, + }, + }} + > + New bucket + + + + + + Create vector bucket + + + + + +
+ + ( + + + + + + )} + /> + +
+
+ + + + + +
+
+ ) +} diff --git a/apps/studio/components/interfaces/Storage/VectorBuckets/CreateVectorTableSheet.tsx b/apps/studio/components/interfaces/Storage/VectorBuckets/CreateVectorTableSheet.tsx new file mode 100644 index 00000000000..6b512720d42 --- /dev/null +++ b/apps/studio/components/interfaces/Storage/VectorBuckets/CreateVectorTableSheet.tsx @@ -0,0 +1,399 @@ +import { zodResolver } from '@hookform/resolvers/zod' +import { PermissionAction } from '@supabase/shared-types/out/constants' +import { Lock, Plus, Trash2 } from 'lucide-react' +import { useEffect, useState } from 'react' +import { SubmitHandler, useFieldArray, useForm } from 'react-hook-form' +import { toast } from 'sonner' +import z from 'zod' + +import { useParams } from 'common' +import { ButtonTooltip } from 'components/ui/ButtonTooltip' +import { DocsButton } from 'components/ui/DocsButton' +import { useVectorBucketIndexCreateMutation } from 'data/storage/vector-bucket-index-create-mutation' +import { useAsyncCheckPermissions } from 'hooks/misc/useCheckPermissions' +import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject' +import { + Button, + Form_Shadcn_, + FormControl_Shadcn_, + FormField_Shadcn_, + FormItem_Shadcn_, + FormMessage_Shadcn_, + Input_Shadcn_, + RadioGroupStacked, + RadioGroupStackedItem, + Separator, + Sheet, + SheetContent, + SheetFooter, + SheetHeader, + SheetSection, + SheetTitle, + SheetTrigger, +} from 'ui' +import { Admonition } from 'ui-patterns' +import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout' +import { inverseValidBucketNameRegex } from '../CreateBucketModal.utils' + +const isStagingLocal = process.env.NEXT_PUBLIC_ENVIRONMENT !== 'prod' + +const BUCKET_INDEX_NAME_REGEX = /^[a-z0-9](?:[a-z0-9.-]{1,61})?[a-z0-9]$/ + +const DISTANCE_METRICS = [ + { + value: 'cosine', + label: 'Cosine', + description: 'Measures similarity between two vectors, based on directions, not magnitude.', + }, + { + value: 'euclidean', + label: 'Euclidean', + description: + 'Measures straight-line distance between two vectors, using both directions and magnitudes.', + }, +] as const + +const FormSchema = z.object({ + name: z + .string() + .trim() + .min(3, 'Name must be at least 3 characters') + .max(63, 'Name must be below 63 characters') + .refine( + (value) => value !== 'public', + '"public" is a reserved name. Please choose another name' + ) + .superRefine((name, ctx) => { + if (!BUCKET_INDEX_NAME_REGEX.test(name)) { + const [match] = name.match(inverseValidBucketNameRegex) ?? [] + ctx.addIssue({ + path: [], + code: z.ZodIssueCode.custom, + message: !!match + ? `Bucket name cannot contain the "${match}" character` + : 'Bucket name contains an invalid special character', + }) + } + }), + targetSchema: z.string().default(''), + dimension: z + .number() + .int('Dimension must be an integer') + .min(1, 'Dimension must be at least 1') + .max(4096, 'Dimension must be at most 4096'), + distanceMetric: z.enum(['cosine', 'euclidean'], { + required_error: 'Please select a distance metric', + }), + metadataKeys: z + .array( + z.object({ + value: z.string().min(1, 'The metadata key needs to be at least 1 character long'), + }) + ) + .default([]), +}) + +const formId = 'create-vector-table-form' + +export type CreateVectorTableForm = z.infer + +interface CreateVectorTableSheetProps { + bucketName?: string +} + +export const CreateVectorTableSheet = ({ bucketName }: CreateVectorTableSheetProps) => { + const { ref } = useParams() + const { data: project } = useSelectedProjectQuery() + + const [visible, setVisible] = useState(false) + const { can: canCreateBuckets } = useAsyncCheckPermissions(PermissionAction.STORAGE_WRITE, '*') + + // [Joshen] Can remove this once this restriction is removed + const showIndexCreationNotice = isStagingLocal && !!project && project?.region !== 'us-east-1' + + const defaultValues = { + name: '', + targetSchema: bucketName, + dimension: undefined, + distanceMetric: 'cosine' as 'cosine' | 'euclidean', + metadataKeys: [], + } + const form = useForm({ + resolver: zodResolver(FormSchema), + defaultValues, + values: defaultValues as any, + }) + + const { fields, append, remove } = useFieldArray({ + control: form.control, + name: 'metadataKeys', + }) + + const { mutate: createVectorBucketTable, isLoading: isCreating } = + useVectorBucketIndexCreateMutation({ + onSuccess: (values) => { + toast.success(`Successfully created vector table ${values.name}`) + form.reset() + + setVisible(false) + }, + onError: (error) => { + // For other errors, show a toast as fallback + toast.error(`Failed to create vector table: ${error.message}`) + }, + }) + + const onSubmit: SubmitHandler = async (values) => { + if (!ref) return console.error('Project ref is required') + + createVectorBucketTable({ + projectRef: ref, + bucketName: values.targetSchema, + indexName: values.name, + dataType: 'float32', + dimension: values.dimension!, + distanceMetric: values.distanceMetric, + metadataKeys: values.metadataKeys.map((key) => key.value), + }) + } + + useEffect(() => { + if (!visible) { + form.reset() + } + }, [visible]) + + return ( + + + } + disabled={!canCreateBuckets} + onClick={() => setVisible(true)} + tooltip={{ + content: { + side: 'bottom', + text: !canCreateBuckets + ? 'You need additional permissions to create buckets' + : undefined, + }, + }} + > + Create table + + + + + + Create vector table + + + {showIndexCreationNotice && ( + + )} + + +
+ + ( + + + + + + )} + /> + + ( + + +
+ +
+ +
+
+
+
+ )} + /> +
+ + + ( + + + { + const value = e.target.value + field.onChange(value === '' ? undefined : Number(value)) + }} + value={field.value ?? ''} + /> + + + )} + /> + + ( + + + + {DISTANCE_METRICS.map((metric) => ( + +
+

{metric.label}

+

+ {metric.description} +

+
+
+ ))} +
+
+
+ )} + /> +
+ + +
+ + +
+ +
+ {fields.map((field, index) => ( +
+ ( + + + + + + + )} + /> +
+ ))} +
+
+ +
+
+ +
+ + + + + +
+
+ ) +} diff --git a/apps/studio/components/interfaces/Storage/VectorBuckets/DeleteVectorBucketModal.tsx b/apps/studio/components/interfaces/Storage/VectorBuckets/DeleteVectorBucketModal.tsx new file mode 100644 index 00000000000..9d66974412c --- /dev/null +++ b/apps/studio/components/interfaces/Storage/VectorBuckets/DeleteVectorBucketModal.tsx @@ -0,0 +1,161 @@ +import { zodResolver } from '@hookform/resolvers/zod' +import { SubmitHandler, useForm } from 'react-hook-form' +import { toast } from 'sonner' +import z from 'zod' + +import { useParams } from 'common' +import { useVectorBucketDeleteMutation } from 'data/storage/vector-bucket-delete-mutation' +import { deleteVectorBucketIndex } from 'data/storage/vector-bucket-index-delete-mutation' +import { useVectorBucketsIndexesQuery } from 'data/storage/vector-buckets-indexes-query' +import { + Button, + Dialog, + DialogContent, + DialogFooter, + DialogHeader, + DialogSection, + DialogSectionSeparator, + DialogTitle, + Form_Shadcn_, + FormControl_Shadcn_, + FormField_Shadcn_, + Input_Shadcn_, +} from 'ui' +import { Admonition } from 'ui-patterns/admonition' +import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout' + +export interface DeleteVectorBucketModalProps { + visible: boolean + bucketName?: string + onCancel: () => void + onSuccess: () => void +} + +const formId = `delete-storage-vector-bucket-form` + +// [Joshen] Can refactor to use TextConfirmModal + +export const DeleteVectorBucketModal = ({ + visible, + bucketName, + onCancel, + onSuccess, +}: DeleteVectorBucketModalProps) => { + const { ref: projectRef } = useParams() + + const schema = z.object({ + confirm: z.literal(bucketName, { + errorMap: () => ({ message: `Please enter "${bucketName}" to confirm` }), + }), + }) + + const form = useForm>({ + resolver: zodResolver(schema), + }) + + const { mutate: deleteBucket, isLoading } = useVectorBucketDeleteMutation({ + onSuccess: async () => { + toast.success(`Bucket "${bucketName}" deleted successfully`) + onSuccess() + }, + }) + + const { data: { indexes = [] } = {} } = useVectorBucketsIndexesQuery({ + projectRef, + vectorBucketName: bucketName, + }) + + const onSubmit: SubmitHandler> = async () => { + if (!projectRef) return console.error('Project ref is required') + if (!bucketName) return console.error('No bucket is selected') + + try { + // delete all indexes from the bucket first + const promises = indexes.map((index) => + deleteVectorBucketIndex({ + projectRef, + bucketName: bucketName, + indexName: index.indexName, + }) + ) + await Promise.all(promises) + + deleteBucket({ projectRef, bucketName }) + } catch (error) { + toast.error( + `Failed to delete bucket: ${error instanceof Error ? error.message : 'Unknown error'}` + ) + } + } + + return ( + { + if (!open) onCancel() + }} + > + + + Confirm deletion of {bucketName} + + + + + + + +

+ Your bucket {bucketName} and all its + contents will be permanently deleted. +

+
+ + + +
+ ( + + Type {bucketName} to + confirm. + + } + > + + + + + )} + /> + +
+
+ + + + +
+
+ ) +} diff --git a/apps/studio/components/interfaces/Storage/VectorBuckets/DeleteVectorTableModal.tsx b/apps/studio/components/interfaces/Storage/VectorBuckets/DeleteVectorTableModal.tsx new file mode 100644 index 00000000000..f9251980718 --- /dev/null +++ b/apps/studio/components/interfaces/Storage/VectorBuckets/DeleteVectorTableModal.tsx @@ -0,0 +1,52 @@ +import { toast } from 'sonner' + +import { useParams } from 'common' +import { useVectorBucketIndexDeleteMutation } from 'data/storage/vector-bucket-index-delete-mutation' +import { VectorBucketIndex } from 'data/storage/vector-buckets-indexes-query' +import ConfirmationModal from 'ui-patterns/Dialogs/ConfirmationModal' + +interface DeleteVectorTableModalProps { + visible: boolean + table?: VectorBucketIndex + onClose: () => void +} + +export const DeleteVectorTableModal = ({ + visible, + table, + onClose, +}: DeleteVectorTableModalProps) => { + const { ref: projectRef } = useParams() + + const { mutate: deleteIndex, isLoading: isDeleting } = useVectorBucketIndexDeleteMutation({ + onSuccess: (_, vars) => { + toast.success(`Table "${vars.indexName}" deleted successfully`) + onClose() + }, + }) + + const onConfirmDelete = () => { + if (!projectRef) return console.error('Project ref is required') + if (!table) return console.error('Vector table is required') + + deleteIndex({ + projectRef, + bucketName: table.vectorBucketName, + indexName: table.indexName, + }) + } + + return ( + + {/* [Joshen] Can probably beef up more details here - what are potential side effects of deleting a table */} +

This action cannot be undone.

+
+ ) +} diff --git a/apps/studio/components/interfaces/Storage/VectorBuckets/VectorBucketDetails.tsx b/apps/studio/components/interfaces/Storage/VectorBuckets/VectorBucketDetails.tsx new file mode 100644 index 00000000000..527819a055c --- /dev/null +++ b/apps/studio/components/interfaces/Storage/VectorBuckets/VectorBucketDetails.tsx @@ -0,0 +1,249 @@ +import { Eye, MoreVertical, Search, Trash2 } from 'lucide-react' +import Link from 'next/link' +import { useRouter } from 'next/router' +import { useState } from 'react' + +import { useParams } from 'common' +import { + ScaffoldContainer, + ScaffoldHeader, + ScaffoldSection, + ScaffoldSectionDescription, + ScaffoldSectionTitle, +} from 'components/layouts/Scaffold' +import AlertError from 'components/ui/AlertError' +import { useVectorBucketQuery } from 'data/storage/vector-bucket-query' +import { + useVectorBucketsIndexesQuery, + VectorBucketIndex, +} from 'data/storage/vector-buckets-indexes-query' +import { + Button, + Card, + CardContent, + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from 'ui' +import { Input } from 'ui-patterns/DataInputs/Input' +import { GenericSkeletonLoader } from 'ui-patterns/ShimmeringLoader' +import { CreateVectorTableSheet } from './CreateVectorTableSheet' +import { DeleteVectorBucketModal } from './DeleteVectorBucketModal' +import { DeleteVectorTableModal } from './DeleteVectorTableModal' + +export const VectorBucketDetails = () => { + const router = useRouter() + const { ref: projectRef, bucketId } = useParams() + + const [filterString, setFilterString] = useState('') + const [showDeleteModal, setShowDeleteModal] = useState(false) + const [selectedTableToDelete, setSelectedTableToDelete] = useState() + + const { + data: bucket, + error: bucketError, + isSuccess: isSuccessBucket, + isError: isErrorBucket, + } = useVectorBucketQuery({ projectRef, vectorBucketName: bucketId }) + + const { data, isLoading: isLoadingIndexes } = useVectorBucketsIndexesQuery({ + projectRef, + vectorBucketName: bucket?.vectorBucketName, + }) + const allIndexes = data?.indexes ?? [] + + const filteredList = + filterString.length === 0 + ? allIndexes + : allIndexes.filter((index) => + index.indexName.toLowerCase().includes(filterString.toLowerCase()) + ) + + return ( + <> + {isErrorBucket ? ( + + + + + + ) : ( + + + + Tables + + Vector tables stored in this bucket. + + +
+ setFilterString(e.target.value)} + icon={} + className="w-48" + /> + +
+ + {isLoadingIndexes ? ( + + ) : ( + + + + + + Name + + + Dimension + + + Distance metric + + + + + + {filteredList.length === 0 ? ( + + + {filterString.length > 0 ? ( + <> +

No results found

+

+ Your search for "{filterString}" did not return any results +

+ + ) : ( + <> +

No tables yet

+

+ Create your first table to get started +

+ + )} +
+
+ ) : ( + filteredList.map((index, idx: number) => { + const id = `index-${idx}` + const name = index.indexName + + return ( + + {name} + +

{index.dimension}

+
+ +

{index.distanceMetric}

+
+ +
+ + + +
+
+
+ ) + }) + )} +
+
+
+ )} +
+ + +
+ Manage +
+ + +
+

Delete bucket

+

+ This will also delete any data in your bucket. Make sure you have a backup if + you want to keep your data. +

+
+ +
+
+
+
+ )} + + setSelectedTableToDelete(undefined)} + /> + + setShowDeleteModal(false)} + onSuccess={() => { + setShowDeleteModal(false) + router.push(`/project/${projectRef}/storage/vectors`) + }} + /> + + ) +} diff --git a/apps/studio/components/interfaces/Storage/VectorBuckets/index.tsx b/apps/studio/components/interfaces/Storage/VectorBuckets/index.tsx new file mode 100644 index 00000000000..16cc1e006a2 --- /dev/null +++ b/apps/studio/components/interfaces/Storage/VectorBuckets/index.tsx @@ -0,0 +1,184 @@ +import { ExternalLink, MoreVertical, Search, Trash2 } from 'lucide-react' +import Link from 'next/link' +import { useState } from 'react' + +import { useParams } from 'common' +import { ScaffoldHeader, ScaffoldSection, ScaffoldSectionTitle } from 'components/layouts/Scaffold' +import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader' +import { useVectorBucketsQuery } from 'data/storage/vector-buckets-query' +import { + Button, + Card, + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from 'ui' +import { Admonition } from 'ui-patterns' +import { Input } from 'ui-patterns/DataInputs/Input' +import { TimestampInfo } from 'ui-patterns/TimestampInfo' +import { EmptyBucketState } from '../EmptyBucketState' +import { CreateVectorBucketDialog } from './CreateVectorBucketDialog' +import { DeleteVectorBucketModal } from './DeleteVectorBucketModal' + +/** + * [Joshen] Low-priority refactor: We should use a virtualized table here as per how we do it + * for the files buckets for consistency. Not pressing, just an optimization area. + */ + +export const VectorsBuckets = () => { + const { ref: projectRef } = useParams() + + const [filterString, setFilterString] = useState('') + const [bucketForDeletion, setBucketForDeletion] = useState<{ + vectorBucketName: string + creationTime: string + } | null>(null) + + const { data, isLoading: isLoadingBuckets } = useVectorBucketsQuery({ projectRef }) + const bucketsList = data?.vectorBuckets ?? [] + + const filteredBuckets = + filterString.length === 0 + ? bucketsList + : bucketsList.filter((bucket) => + bucket.vectorBucketName.toLowerCase().includes(filterString.toLowerCase()) + ) + + return ( + + }> + + Leave feedback + + + } + > +

+ Expect rapid changes, limited features, and possible breaking updates as we expand access. +

+

Please share feedback as we refine the experience!

+
+ + {!isLoadingBuckets && bucketsList.length === 0 ? ( + + ) : ( +
+ + Buckets + +
+ setFilterString(e.target.value)} + icon={} + /> + +
+ + {isLoadingBuckets ? ( + + ) : ( + + + + + Name + Created at + + + + + {filteredBuckets.length === 0 && filterString.length > 0 && ( + + +

No results found

+

+ Your search for "{filterString}" did not return any results +

+
+
+ )} + {filteredBuckets.map((bucket, idx: number) => { + const id = `bucket-${idx}` + const name = bucket.vectorBucketName + // the creation time is in seconds, convert it to milliseconds + const created = +bucket.creationTime * 1000 + + return ( + + {name} + +

+ +

+
+ +
+ + + +
+
+
+ ) + })} +
+
+
+ )} +
+ )} + + setBucketForDeletion(null)} + onSuccess={() => setBucketForDeletion(null)} + /> +
+ ) +} diff --git a/apps/studio/components/interfaces/Storage/VectorsBuckets.tsx b/apps/studio/components/interfaces/Storage/VectorsBuckets.tsx deleted file mode 100644 index 87e2dbbab12..00000000000 --- a/apps/studio/components/interfaces/Storage/VectorsBuckets.tsx +++ /dev/null @@ -1,6 +0,0 @@ -import { EmptyBucketState } from './EmptyBucketState' - -export const VectorsBuckets = () => { - // Placeholder component - will be implemented in a later PR - return -} diff --git a/apps/studio/components/interfaces/Storage/__tests__/CreateBucketModal.test.tsx b/apps/studio/components/interfaces/Storage/__tests__/CreateBucketModal.test.tsx index 5479ff4c010..02705cc6306 100644 --- a/apps/studio/components/interfaces/Storage/__tests__/CreateBucketModal.test.tsx +++ b/apps/studio/components/interfaces/Storage/__tests__/CreateBucketModal.test.tsx @@ -57,9 +57,6 @@ describe(`CreateBucketModal`, () => { const nameInput = screen.getByLabelText(`Bucket name`) await userEvent.type(nameInput, `test`) - const standardOption = screen.getByLabelText(`Standard bucket`) - await userEvent.click(standardOption) - const publicToggle = screen.getByLabelText(`Public bucket`) expect(publicToggle).not.toBeChecked() await userEvent.click(publicToggle) @@ -93,9 +90,5 @@ describe(`CreateBucketModal`, () => { const submitButton = screen.getByRole(`button`, { name: `Create` }) fireEvent.click(submitButton) - - await waitFor(() => - expect(routerMock.asPath).toStrictEqual(`/project/default/storage/buckets/test`) - ) }) }) diff --git a/apps/studio/components/interfaces/Storage/__tests__/DeleteBucketModal.test.tsx b/apps/studio/components/interfaces/Storage/__tests__/DeleteBucketModal.test.tsx index ed7f36359b3..a119c6a7558 100644 --- a/apps/studio/components/interfaces/Storage/__tests__/DeleteBucketModal.test.tsx +++ b/apps/studio/components/interfaces/Storage/__tests__/DeleteBucketModal.test.tsx @@ -20,7 +20,7 @@ const bucket: Bucket = { count: { min: 1, max: 5 }, }), file_size_limit: faker.number.int({ min: 0, max: 25165824 }), - type: faker.helpers.arrayElement(['STANDARD', 'ANALYTICS', undefined]), + type: 'STANDARD', created_at: faker.date.recent().toISOString(), updated_at: faker.date.recent().toISOString(), } @@ -46,7 +46,7 @@ const Page = ({ onClose }: { onClose: () => void }) => { describe(`DeleteBucketModal`, () => { beforeEach(() => { // useParams - routerMock.setCurrentUrl(`/project/default/storage/buckets/test`) + routerMock.setCurrentUrl(`/project/default/storage/files`) // useProjectContext addAPIMock({ method: `get`, @@ -117,7 +117,7 @@ describe(`DeleteBucketModal`, () => { fireEvent.click(confirmButton) await waitFor(() => expect(onClose).toHaveBeenCalledOnce()) - expect(routerMock.asPath).toStrictEqual(`/project/default/storage/buckets`) + expect(routerMock.asPath).toStrictEqual(`/project/default/storage/files`) }) it(`prevents submission when the input doesn't match the bucket name`, async () => { diff --git a/apps/studio/components/layouts/ProjectLayout/LayoutHeader/HelpPopover.tsx b/apps/studio/components/layouts/ProjectLayout/LayoutHeader/HelpPopover.tsx index 3b8c00a1687..a2565cdd617 100644 --- a/apps/studio/components/layouts/ProjectLayout/LayoutHeader/HelpPopover.tsx +++ b/apps/studio/components/layouts/ProjectLayout/LayoutHeader/HelpPopover.tsx @@ -5,7 +5,9 @@ import { useState } from 'react' import SVG from 'react-inlinesvg' import { IS_PLATFORM } from 'common' +import type { SupportFormUrlKeys } from 'components/interfaces/Support/SupportForm.utils' import { SupportLink } from 'components/interfaces/Support/SupportLink' +import { SIDEBAR_KEYS } from 'components/layouts/ProjectLayout/LayoutSidebar/LayoutSidebarProvider' import { ButtonTooltip } from 'components/ui/ButtonTooltip' import { useSendEventMutation } from 'data/telemetry/send-event-mutation' import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization' @@ -20,11 +22,10 @@ import { ButtonGroupItem, cn, Popover, + Popover_Shadcn_, PopoverContent_Shadcn_, PopoverTrigger_Shadcn_, - Popover_Shadcn_, } from 'ui' -import { SIDEBAR_KEYS } from 'components/layouts/ProjectLayout/LayoutSidebar/LayoutSidebarProvider' export const HelpPopover = () => { const router = useRouter() @@ -36,6 +37,12 @@ export const HelpPopover = () => { const [isOpen, setIsOpen] = useState(false) const projectRef = project?.parent_project_ref ?? (router.query.ref as string | undefined) + let supportLinkQueryParams: Partial | undefined = undefined + if (projectRef) { + supportLinkQueryParams = { projectRef } + } else if (org?.slug) { + supportLinkQueryParams = { orgSlug: org.slug } + } return ( @@ -137,7 +144,7 @@ export const HelpPopover = () => { }> - Contact support + Contact support )} diff --git a/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx b/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx index e5059034da2..406279a34e2 100644 --- a/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx +++ b/apps/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx @@ -51,7 +51,6 @@ export const generateProductRoutes = ( storage?: boolean realtime?: boolean authOverviewPage?: boolean - isStorageV2?: boolean } ): Route[] => { const isProjectActive = project?.status === PROJECT_STATUS.ACTIVE_HEALTHY @@ -63,7 +62,6 @@ export const generateProductRoutes = ( const storageEnabled = features?.storage ?? true const realtimeEnabled = features?.realtime ?? true const authOverviewPageEnabled = features?.authOverviewPage ?? false - const isStorageV2 = features?.isStorageV2 ?? false const databaseMenu = generateDatabaseMenu(project) const authMenu = generateAuthMenu(ref as string) @@ -105,11 +103,7 @@ export const generateProductRoutes = ( key: 'storage', label: 'Storage', icon: , - link: - ref && - (isProjectBuilding - ? buildingUrl - : `/project/${ref}/storage/${isStorageV2 ? 'files' : 'buckets'}`), + link: ref && (isProjectBuilding ? buildingUrl : `/project/${ref}/storage/files`), }, ] : []), diff --git a/apps/studio/components/layouts/ProjectSettingsLayout/SettingsLayout.tsx b/apps/studio/components/layouts/ProjectSettingsLayout/SettingsLayout.tsx index d9595685b15..9b22d850b45 100644 --- a/apps/studio/components/layouts/ProjectSettingsLayout/SettingsLayout.tsx +++ b/apps/studio/components/layouts/ProjectSettingsLayout/SettingsLayout.tsx @@ -1,5 +1,5 @@ import { useRouter } from 'next/router' -import { PropsWithChildren, useEffect } from 'react' +import { PropsWithChildren } from 'react' import { useParams } from 'common' import { ProductMenu } from 'components/ui/ProductMenu' @@ -7,7 +7,6 @@ import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled' import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization' import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject' import { withAuth } from 'hooks/misc/withAuth' -import { IS_PLATFORM } from 'lib/constants' import { ProjectLayout } from '../ProjectLayout' import { generateSettingsMenu } from './SettingsMenu.utils' diff --git a/apps/studio/components/layouts/StorageLayout/StorageBucketsLayout.tsx b/apps/studio/components/layouts/StorageLayout/StorageBucketsLayout.tsx index cedfc5f43dc..3398ffa7e50 100644 --- a/apps/studio/components/layouts/StorageLayout/StorageBucketsLayout.tsx +++ b/apps/studio/components/layouts/StorageLayout/StorageBucketsLayout.tsx @@ -43,7 +43,7 @@ export const StorageBucketsLayout = ({ navigationItems={navigationItems} secondaryActions={config?.docsUrl ? [] : []} > - {children} + {children} ) } diff --git a/apps/studio/components/layouts/StorageLayout/StorageLayout.tsx b/apps/studio/components/layouts/StorageLayout/StorageLayout.tsx index a74e4fef03c..3cc9602bed7 100644 --- a/apps/studio/components/layouts/StorageLayout/StorageLayout.tsx +++ b/apps/studio/components/layouts/StorageLayout/StorageLayout.tsx @@ -1,10 +1,5 @@ -import { useRouter } from 'next/router' -import { ReactNode, useEffect } from 'react' +import { ReactNode } from 'react' -import { useParams } from 'common' -import { useIsNewStorageUIEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext' -import { useSelectedBucket } from 'components/interfaces/Storage/StorageExplorer/useSelectedBucket' -import { StorageMenu } from 'components/interfaces/Storage/StorageMenu' import { StorageMenuV2 } from 'components/interfaces/Storage/StorageMenuV2' import { withAuth } from 'hooks/misc/withAuth' import { ProjectLayout } from '../ProjectLayout' @@ -15,60 +10,8 @@ export interface StorageLayoutProps { } const StorageLayout = ({ title, children }: StorageLayoutProps) => { - const router = useRouter() - const isStorageV2 = useIsNewStorageUIEnabled() - const { ref, featurePreviewModal, bucketId } = useParams() - const { bucket } = useSelectedBucket() - - // [Joshen] Handle redirects between existing UI and feature preview - useEffect(() => { - const { pathname } = router - const suffix = !!featurePreviewModal ? `?featurePreviewModal=${featurePreviewModal}` : '' - - if (!ref) return - - if (isStorageV2) { - // From old UI to new UI - if (pathname.endsWith('/storage/settings')) { - router.push(`/project/${ref}/storage/files/settings${suffix}`) - } else if (pathname.endsWith('/storage/policies')) { - router.push(`/project/${ref}/storage/files/policies${suffix}`) - } else if (pathname.endsWith('/storage/buckets/[bucketId]')) { - if (!!bucket && bucket.type === 'STANDARD') { - router.push(`/project/${ref}/storage/files/buckets/${bucketId}${suffix}`) - } else if (!!bucket && bucket.type === 'ANALYTICS') { - router.push(`/project/${ref}/storage/analytics/buckets/${bucketId}${suffix}`) - } - } - } else { - // From new UI to old UI - if (pathname.endsWith('/files/settings')) { - router.push(`/project/${ref}/storage/settings${suffix}`) - } else if (pathname.endsWith('/files/policies')) { - router.push(`/project/${ref}/storage/policies${suffix}`) - } else if ( - pathname.endsWith('/files/buckets/[bucketId]') || - pathname.endsWith('/analytics/buckets/[bucketId]') - ) { - router.push(`/project/${ref}/storage/buckets/${bucketId}${suffix}`) - } else if ( - pathname.endsWith('/storage/files') || - pathname.endsWith('/storage/analytics') || - pathname.endsWith('/storage/vectors') - ) { - router.push(`/project/${ref}/storage/buckets`) - } - } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [ref, isStorageV2]) - return ( - : } - > + }> {children} ) diff --git a/apps/studio/components/ui/AIAssistantPanel/ModelSelector.tsx b/apps/studio/components/ui/AIAssistantPanel/ModelSelector.tsx index 1a2a73a3608..aa050cb9c96 100644 --- a/apps/studio/components/ui/AIAssistantPanel/ModelSelector.tsx +++ b/apps/studio/components/ui/AIAssistantPanel/ModelSelector.tsx @@ -50,7 +50,7 @@ export const ModelSelector = ({ selectedModel, onSelectModel }: ModelSelectorPro - - -
-
- -
-
- -
- - -
- - -
- -
- ) -} - -function DatePresets({ - selected, - onSelect, - presets, -}: { - selected: DateRange | undefined - onSelect: (date: DateRange | undefined) => void - presets: DatePreset[] -}) { - return ( -
-

Date Range

-
- {presets.map(({ label, shortcut, from, to }) => { - const isActive = selected?.from === from && selected?.to === to - return ( - - ) - })} -
-
- ) -} - -function DatePresetsSelect({ - selected, - onSelect, - presets, -}: { - selected: DateRange | undefined - onSelect: (date: DateRange | undefined) => void - presets: DatePreset[] -}) { - function findPreset(from?: Date, to?: Date) { - return presets.find((p) => p.from === from && p.to === to)?.shortcut - } - const [value, setValue] = useState(findPreset(selected?.from, selected?.to)) - - useEffect(() => { - const preset = findPreset(selected?.from, selected?.to) - if (preset === value) return - setValue(preset) - }, [selected, presets]) - - return ( - - ) -} - -// REMINDER: We can add min max date range validation https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local#setting_maximum_and_minimum_dates_and_times -function CustomDateRange({ - selected, - onSelect, -}: { - selected: DateRange | undefined - onSelect: (date: DateRange | undefined) => void -}) { - const [dateFrom, setDateFrom] = useState(selected?.from) - const [dateTo, setDateTo] = useState(selected?.to) - const debounceDateFrom = useDebounce(dateFrom, 1000) - const debounceDateTo = useDebounce(dateTo, 1000) - - const formatDateForInput = (date: Date | undefined): string => { - if (!date) return '' - const utcDate = new Date(date.getTime() - date.getTimezoneOffset() * 60000) - return utcDate.toISOString().slice(0, 16) - } - - useEffect(() => { - onSelect({ from: debounceDateFrom, to: debounceDateTo }) - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [debounceDateFrom, debounceDateTo]) - - return ( -
-

Custom Range

-
-
- - { - const newDate = new Date(e.target.value) - if (!Number.isNaN(newDate.getTime())) { - setDateFrom(newDate) - } - }} - disabled={!selected?.from} - /> -
-
- - { - const newDate = new Date(e.target.value) - if (!Number.isNaN(newDate.getTime())) { - setDateTo(newDate) - } - }} - disabled={!selected?.to} - /> -
-
-
- ) -} diff --git a/apps/studio/components/ui/DatePicker/index.tsx b/apps/studio/components/ui/DatePicker/index.tsx index 4302eaac9da..93a5f7db24f 100644 --- a/apps/studio/components/ui/DatePicker/index.tsx +++ b/apps/studio/components/ui/DatePicker/index.tsx @@ -1,12 +1,12 @@ import { format } from 'date-fns' import dayjs from 'dayjs' -import { ArrowRight, Calendar, ChevronLeft, ChevronRight } from 'lucide-react' -import { ReactNode, useEffect, useState } from 'react' -import ReactDatePicker from 'react-datepicker' +import { ArrowRight, Calendar } from 'lucide-react' +import { ReactNode, useCallback, useEffect, useMemo, useState } from 'react' import type { DatePickerToFrom } from 'components/interfaces/Settings/Logs/Logs.types' import { Button, + Calendar as CalendarPicker, Popover, PopoverContent_Shadcn_, PopoverTrigger_Shadcn_, @@ -39,6 +39,22 @@ const END_DATE_DEFAULT = new Date() const START_TIME_DEFAULT = { HH: '00', mm: '00', ss: '00' } const END_TIME_DEFAULT = { HH: '23', mm: '59', ss: '59' } +const calculateDisabledDays = (minDate?: Date, maxDate?: Date) => { + const rules: Array<{ before: Date } | { after: Date }> = [] + + if (minDate) { + rules.push({ before: dayjs(minDate).startOf('day').toDate() }) + } + + if (maxDate) { + rules.push({ after: dayjs(maxDate).endOf('day').toDate() }) + } + + if (rules.length === 0) return undefined + if (rules.length === 1) return rules[0] + return rules +} + export function DatePicker({ to, from, @@ -64,6 +80,55 @@ export function DatePicker({ const [startTime, setStartTime] = useState(START_TIME_DEFAULT) const [endTime, setEndTime] = useState(END_TIME_DEFAULT) + const disabledDays = useMemo(() => calculateDisabledDays(minDate, maxDate), [minDate, maxDate]) + + const clampDateToRange = useCallback( + (date: Date | null) => { + if (!date) return date + + let nextDate = date + + if (minDate && dayjs(nextDate).isBefore(minDate, 'day')) { + nextDate = dayjs(minDate).toDate() + } + + if (maxDate && dayjs(nextDate).isAfter(maxDate, 'day')) { + nextDate = dayjs(maxDate).toDate() + } + + return nextDate + }, + [minDate, maxDate] + ) + + useEffect(() => { + if (!minDate && !maxDate) return + + setStartDate((prev) => { + if (!prev) return prev + const clamped = clampDateToRange(prev) + return dayjs(clamped).isSame(prev) ? prev : clamped + }) + + setEndDate((prev) => { + if (!prev) return prev + const clamped = clampDateToRange(prev) + return dayjs(clamped).isSame(prev) ? prev : clamped + }) + + setAppliedStartDate((prev) => { + if (!prev) return prev + const clamped = clampDateToRange(prev) + return dayjs(clamped).isSame(prev) ? prev : clamped + }) + + setAppliedEndDate((prev) => { + if (!prev) return prev + const clamped = clampDateToRange(prev) + return dayjs(clamped).isSame(prev) ? prev : clamped + }) + }, [minDate, maxDate, clampDateToRange]) + useEffect(() => { if (!from) { setAppliedStartDate(null) @@ -145,7 +210,7 @@ export function DatePicker({ } return ( - + - - {format(date, 'MMMM yyyy')} - - -
-
- )} - /> + {selectsRange ? ( + { + handleDatePickerChange([range?.from ?? null, range?.to ?? null]) + }} + /> + ) : ( + { + handleDatePickerChange(date ?? null) + }} + /> + )}
{renderFooter({ from: startDate?.toISOString() || null, diff --git a/apps/studio/components/ui/EditorPanel/EditorPanel.tsx b/apps/studio/components/ui/EditorPanel/EditorPanel.tsx index ea19b47c2da..912a4906af5 100644 --- a/apps/studio/components/ui/EditorPanel/EditorPanel.tsx +++ b/apps/studio/components/ui/EditorPanel/EditorPanel.tsx @@ -67,6 +67,10 @@ export const EditorPanel = () => { LOCAL_STORAGE_KEYS.HOTKEY_SIDEBAR(SIDEBAR_KEYS.EDITOR_PANEL), true ) + const [isAIAssistantHotkeyEnabled] = useLocalStorageQuery( + LOCAL_STORAGE_KEYS.HOTKEY_SIDEBAR(SIDEBAR_KEYS.AI_ASSISTANT), + true + ) const currentValue = value || '' @@ -294,6 +298,7 @@ export const EditorPanel = () => { executeQuery={onExecuteSql} onClose={handleClosePanel} closeShortcutEnabled={isInlineEditorHotkeyEnabled} + openAIAssistantShortcutEnabled={isAIAssistantHotkeyEnabled} />
diff --git a/apps/studio/components/ui/FileExplorerAndEditor/index.tsx b/apps/studio/components/ui/FileExplorerAndEditor/index.tsx index f1988cff2aa..7a1d3e62d66 100644 --- a/apps/studio/components/ui/FileExplorerAndEditor/index.tsx +++ b/apps/studio/components/ui/FileExplorerAndEditor/index.tsx @@ -344,6 +344,7 @@ export const FileExplorerAndEditor = ({ folding: false, padding: { top: 20, bottom: 20 }, lineNumbersMinChars: 3, + fixedOverflowWidgets: true, }} /> )} diff --git a/apps/studio/components/ui/InlineLink.tsx b/apps/studio/components/ui/InlineLink.tsx index d82ba4eefa0..78c8eece16a 100644 --- a/apps/studio/components/ui/InlineLink.tsx +++ b/apps/studio/components/ui/InlineLink.tsx @@ -7,6 +7,7 @@ interface InlineLinkProps { className?: string target?: string rel?: string + title?: string onClick?: () => void } @@ -17,18 +18,26 @@ export const InlineLink = ({ href, className: _className, children, + title, ...props }: PropsWithChildren) => { const className = cn(InlineLinkClassName, _className) if (href.startsWith('http')) { return ( - + {children} ) } return ( - + {children} ) diff --git a/apps/studio/components/ui/QueryBlock/ParametersPopover.tsx b/apps/studio/components/ui/QueryBlock/ParametersPopover.tsx deleted file mode 100644 index a314fead4e1..00000000000 --- a/apps/studio/components/ui/QueryBlock/ParametersPopover.tsx +++ /dev/null @@ -1,164 +0,0 @@ -import { format } from 'date-fns' -import { ArrowUpDown } from 'lucide-react' -import { useEffect, useState } from 'react' - -import { DatePicker } from 'components/ui/DatePicker' -import { Parameter } from 'lib/sql-parameters' -import { - Button, - Input_Shadcn_, - Label_Shadcn_, - Popover_Shadcn_, - PopoverContent_Shadcn_, - PopoverTrigger_Shadcn_, - Select_Shadcn_, - SelectContent_Shadcn_, - SelectItem_Shadcn_, - SelectTrigger_Shadcn_, - SelectValue_Shadcn_, -} from 'ui' - -interface ParametersPopoverProps { - parameters: Parameter[] - parameterValues?: Record - onSubmit?: (parameters: Record) => void - onChange?: (parameters: Record) => void -} - -export const ParametersPopover = ({ - parameters, - parameterValues = {}, - onSubmit, - onChange, -}: ParametersPopoverProps) => { - const [tempParameters, setTempParameters] = useState>( - parameters.reduce( - (acc, param) => ({ - ...acc, - [param.name]: parameterValues[param.name] ?? param.defaultValue ?? '', - }), - {} - ) - ) - - // Update temp parameters when external parameters or values change - useEffect(() => { - setTempParameters( - parameters.reduce( - (acc, param) => ({ - ...acc, - [param.name]: parameterValues[param.name] ?? param.defaultValue ?? '', - }), - {} - ) - ) - }, [parameters, parameterValues]) - - const handleParameterChange = (name: string, value: string) => { - const newParameters = { - ...tempParameters, - [name]: value, - } - setTempParameters(newParameters) - onChange?.(newParameters) - } - - const renderInput = (param: Parameter) => { - const currentValue = tempParameters[param.name] ?? parameterValues[param.name] ?? '' - - if (param.type === 'date') { - // Check if the current value is a valid date - const isValidDate = currentValue && !isNaN(new Date(currentValue).getTime()) - - if (isValidDate) { - return ( - { - if (date && date.to) { - handleParameterChange(param.name, date.to) - } else { - handleParameterChange(param.name, '') - } - }} - > - {currentValue ? format(new Date(currentValue), 'dd MMM') : 'Pick a date'} - - ) - } - - // Fallback to regular input if date is invalid - return ( - handleParameterChange(param.name, e.target.value)} - /> - ) - } - - if (param.type === 'enum' && param.possibleValues) { - return ( - handleParameterChange(param.name, value)} - > - - - - - {param.possibleValues.map((value) => ( - - {value} - - ))} - - - ) - } - - return ( - handleParameterChange(param.name, e.target.value)} - /> - ) - } - - return ( - - - -
- )} - - - - ) -} diff --git a/apps/studio/components/ui/VirtualizedTable.tsx b/apps/studio/components/ui/VirtualizedTable.tsx new file mode 100644 index 00000000000..966c4faf124 --- /dev/null +++ b/apps/studio/components/ui/VirtualizedTable.tsx @@ -0,0 +1,238 @@ +import type { VirtualItem, Virtualizer } from '@tanstack/react-virtual' +import { useVirtualizer } from '@tanstack/react-virtual' +import type { HTMLAttributes, ReactElement, ReactNode, Ref } from 'react' +import { + cloneElement, + createContext, + forwardRef, + isValidElement, + useCallback, + useContext, + useMemo, + useRef, +} from 'react' + +import { mergeRefs } from 'common' +import { + cn, + Table, + TableBody, + TableCaption, + TableCell, + TableFooter, + TableHead, + TableHeader, + TableRow, +} from 'ui' + +type TableComponentProps = React.ComponentProps + +interface VirtualizedTableProps extends TableComponentProps { + scrollContainerProps?: HTMLAttributes + data: TItem[] + children: ReactNode + overscan?: number + estimateSize: (index: number) => number + getItemKey?: (item: TItem, index: number) => string +} + +type VirtualizedTableContextValue = { + virtualizer: Virtualizer + virtualItems: VirtualItem[] + data: TItem[] + paddingTop: number + paddingBottom: number + getRowKey: (item: TItem, index: number) => string | number +} + +const VirtualizedTableContext = createContext | null>(null) + +const useVirtualizedTableContext = () => { + const context = useContext(VirtualizedTableContext) + if (!context) { + throw new Error('VirtualizedTable components must be used within a VirtualizedTable') + } + return context as VirtualizedTableContextValue +} + +export const VirtualizedTable = ({ + scrollContainerProps, + containerProps, + data, + children, + overscan = 5, + estimateSize, + getItemKey, + ...tableProps +}: VirtualizedTableProps) => { + const scrollContainerRef = useRef(null) + + const rowKeyGetter = useCallback( + (item: TItem, index: number) => { + return getItemKey ? getItemKey(item, index) : index + }, + [getItemKey] + ) + + const getItemKeyFromIndex = useCallback( + (index: number) => { + const item = data[index] + return item ? rowKeyGetter(item, index) : index + }, + [data, rowKeyGetter] + ) + + const virtualizer = useVirtualizer({ + count: data.length, + getScrollElement: () => scrollContainerRef.current, + overscan, + estimateSize, + getItemKey: getItemKeyFromIndex, + }) + + const virtualItems = virtualizer.getVirtualItems() + const totalSize = virtualizer.getTotalSize() + + const paddingTop = virtualItems.length > 0 ? virtualItems[0].start : 0 + const paddingBottom = + virtualItems.length > 0 ? totalSize - virtualItems[virtualItems.length - 1].end : 0 + + const contextValue = useMemo>( + () => ({ + virtualizer, + virtualItems, + data, + paddingTop, + paddingBottom, + getRowKey: rowKeyGetter, + }), + [virtualizer, virtualItems, data, paddingTop, paddingBottom, rowKeyGetter] + ) + + const mergedContainerProps = useMemo( + () => ({ + ...containerProps, + className: cn('overflow-visible', containerProps?.className), + }), + [containerProps] + ) + + const { className: scrollClassName, ...restScrollContainerProps } = scrollContainerProps ?? {} + + return ( +
+ } + > + + {children} +
+
+
+ ) +} + +interface VirtualizedTableBodyProps + extends Omit, 'children'> { + emptyContent?: ReactNode + leadingContent?: ReactNode + trailingContent?: ReactNode + children: (item: TItem, index: number) => ReactElement + paddingColSpan?: number + paddingCellClassName?: string +} + +export const VirtualizedTableBody = ({ + emptyContent, + leadingContent, + trailingContent, + children, + paddingColSpan = 1, + paddingCellClassName, + ...props +}: VirtualizedTableBodyProps) => { + const { virtualizer, virtualItems, data, paddingTop, paddingBottom, getRowKey } = + useVirtualizedTableContext() + + const measurementRef = virtualizer.measureElement as unknown as Ref + + return ( + + {leadingContent} + {data.length === 0 ? ( + emptyContent ?? null + ) : ( + <> + {paddingTop > 0 && ( + + )} + {virtualItems.map((virtualItem) => { + const item = data[virtualItem.index] + if (item === undefined) return null + + const renderedRow = children(item, virtualItem.index) + if ( + !isValidElement< + Record & { + ref?: Ref | null + ['data-index']?: number + } + >(renderedRow) + ) { + return renderedRow + } + + const key = renderedRow.key ?? getRowKey(item, virtualItem.index) + + const existingRef = ( + renderedRow as unknown as { ref?: Ref | null } + ).ref + const combinedRef = + existingRef != null + ? mergeRefs(measurementRef, existingRef) + : measurementRef + + return cloneElement(renderedRow, { + key, + ref: combinedRef, + 'data-index': virtualItem.index, + }) + })} + {paddingBottom > 0 && ( + + )} + + )} + {trailingContent} + + ) +} + +export const VirtualizedTableHeader = TableHeader + +export const VirtualizedTableHead = forwardRef< + HTMLTableCellElement, + React.ComponentProps +>(({ className, ...props }, ref) => { + return +}) +VirtualizedTableHead.displayName = 'VirtualizedTableHead' + +export const VirtualizedTableRow = TableRow +export const VirtualizedTableCell = TableCell +export const VirtualizedTableFooter = TableFooter +export const VirtualizedTableCaption = TableCaption diff --git a/apps/studio/data/__templates/resource-query.ts b/apps/studio/data/__templates/resource-query.ts index b79eec258df..7bb872e996b 100644 --- a/apps/studio/data/__templates/resource-query.ts +++ b/apps/studio/data/__templates/resource-query.ts @@ -1,8 +1,8 @@ -import { useQuery, useQueryClient, UseQueryOptions } from '@tanstack/react-query' +import { useQuery, useQueryClient } from '@tanstack/react-query' import { useCallback } from 'react' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { resourceKeys } from './keys' export type ResourceVariables = { @@ -31,7 +31,7 @@ export type ResourceError = ResponseError export const useResourceQuery = ( { projectRef, id }: ResourceVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: resourceKeys.resource(projectRef, id), diff --git a/apps/studio/data/__templates/resource-update-mutation.ts b/apps/studio/data/__templates/resource-update-mutation.ts index e17c5abb1c0..478d6785ae7 100644 --- a/apps/studio/data/__templates/resource-update-mutation.ts +++ b/apps/studio/data/__templates/resource-update-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, patch } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { resourceKeys } from './keys' export type ResourceUpdateVariables = { @@ -29,7 +29,7 @@ export const useResourceUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/__templates/resources-query.ts b/apps/studio/data/__templates/resources-query.ts index d15450497a3..095d920f7d4 100644 --- a/apps/studio/data/__templates/resources-query.ts +++ b/apps/studio/data/__templates/resources-query.ts @@ -1,8 +1,8 @@ -import { useQuery, useQueryClient, UseQueryOptions } from '@tanstack/react-query' +import { useQuery, useQueryClient } from '@tanstack/react-query' import { useCallback } from 'react' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { resourceKeys } from './keys' export type ResourcesVariables = { @@ -26,7 +26,7 @@ export type ResourcesError = ResponseError export const useResourcesQuery = ( { projectRef }: ResourcesVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: resourceKeys.list(projectRef), diff --git a/apps/studio/data/access-tokens/access-tokens-create-mutation.ts b/apps/studio/data/access-tokens/access-tokens-create-mutation.ts index 928cc983f59..e932b878778 100644 --- a/apps/studio/data/access-tokens/access-tokens-create-mutation.ts +++ b/apps/studio/data/access-tokens/access-tokens-create-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { components } from 'api-types' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { accessTokenKeys } from './keys' export type AccessTokenCreateVariables = components['schemas']['CreateAccessTokenBody'] @@ -27,7 +27,7 @@ export const useAccessTokenCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/access-tokens/access-tokens-delete-mutation.ts b/apps/studio/data/access-tokens/access-tokens-delete-mutation.ts index dcf677b9cf2..2b5dd614d48 100644 --- a/apps/studio/data/access-tokens/access-tokens-delete-mutation.ts +++ b/apps/studio/data/access-tokens/access-tokens-delete-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { del, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { accessTokenKeys } from './keys' export type AccessTokenDeleteVariables = { @@ -25,7 +25,7 @@ export const useAccessTokenDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/access-tokens/access-tokens-query.ts b/apps/studio/data/access-tokens/access-tokens-query.ts index 53d5f97c3b6..7713cc6ee70 100644 --- a/apps/studio/data/access-tokens/access-tokens-query.ts +++ b/apps/studio/data/access-tokens/access-tokens-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { accessTokenKeys } from './keys' export async function getAccessTokens(signal?: AbortSignal) { @@ -20,7 +20,7 @@ export type AccessToken = AccessTokensData[number] export const useAccessTokensQuery = ({ enabled = true, ...options -}: UseQueryOptions = {}) => +}: UseCustomQueryOptions = {}) => useQuery({ queryKey: accessTokenKeys.list(), queryFn: ({ signal }) => getAccessTokens(signal), diff --git a/apps/studio/data/actions/action-detail-query.ts b/apps/studio/data/actions/action-detail-query.ts index b2957ef8e5f..1b09c0c40dd 100644 --- a/apps/studio/data/actions/action-detail-query.ts +++ b/apps/studio/data/actions/action-detail-query.ts @@ -1,8 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import type { operations } from 'data/api' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { actionKeys } from './keys' export type ActionRunVariables = operations['v1-get-action-run']['parameters']['path'] @@ -21,7 +21,7 @@ export type ActionRunError = ResponseError export const useActionRunQuery = ( { ref, run_id }: ActionRunVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: actionKeys.detail(ref, run_id), diff --git a/apps/studio/data/actions/action-logs-query.ts b/apps/studio/data/actions/action-logs-query.ts index 27270834def..20aaecadfa4 100644 --- a/apps/studio/data/actions/action-logs-query.ts +++ b/apps/studio/data/actions/action-logs-query.ts @@ -1,8 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { operations } from 'data/api' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { actionKeys } from './keys' export type ActionLogsVariables = operations['v1-get-action-run-logs']['parameters']['path'] @@ -27,7 +27,10 @@ export type WorkflowRunLogsError = ResponseError export const useActionRunLogsQuery = ( { ref, run_id }: ActionLogsVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: actionKeys.detail(ref, run_id), diff --git a/apps/studio/data/actions/action-runs-query.ts b/apps/studio/data/actions/action-runs-query.ts index 64bf56e2a2e..616b1c1cd3f 100644 --- a/apps/studio/data/actions/action-runs-query.ts +++ b/apps/studio/data/actions/action-runs-query.ts @@ -1,8 +1,8 @@ -import { useQuery, type UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import type { operations } from 'data/api' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { actionKeys } from './keys' export type ActionsVariables = operations['v1-list-action-runs']['parameters']['path'] @@ -25,7 +25,7 @@ export type ActionStatus = ActionRunStep['status'] export const useActionsQuery = ( { ref }: ActionsVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: actionKeys.list(ref), diff --git a/apps/studio/data/ai/check-api-key-query.ts b/apps/studio/data/ai/check-api-key-query.ts index f0c9c61b58d..53a8816961a 100644 --- a/apps/studio/data/ai/check-api-key-query.ts +++ b/apps/studio/data/ai/check-api-key-query.ts @@ -1,8 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { constructHeaders, fetchHandler } from 'data/fetchers' import { BASE_PATH, IS_PLATFORM } from 'lib/constants' -import { ResponseError } from 'types' +import { ResponseError, UseCustomQueryOptions } from 'types' import { aiKeys } from './keys' // check to see if the OPENAI_API_KEY env var is set in self-hosted @@ -33,7 +33,7 @@ export type ResourceError = { errorEventId: string; message: string } export const useCheckOpenAIKeyQuery = ({ enabled = true, ...options -}: UseQueryOptions = {}) => +}: UseCustomQueryOptions = {}) => useQuery({ queryKey: aiKeys.apiKey(), queryFn: ({ signal }) => checkOpenAIKey(signal), diff --git a/apps/studio/data/ai/rate-message-mutation.ts b/apps/studio/data/ai/rate-message-mutation.ts index e0b0abbf174..5f8b080e46b 100644 --- a/apps/studio/data/ai/rate-message-mutation.ts +++ b/apps/studio/data/ai/rate-message-mutation.ts @@ -1,10 +1,10 @@ import { UIMessage } from '@ai-sdk/react' -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import type { RateMessageResponse } from 'components/ui/AIAssistantPanel/Message.utils' import { constructHeaders, fetchHandler } from 'data/fetchers' import { BASE_PATH } from 'lib/constants' -import { ResponseError } from 'types' +import { ResponseError, UseCustomMutationOptions } from 'types' export type RateMessageVariables = { rating: 'positive' | 'negative' @@ -52,7 +52,7 @@ export const useRateMessageMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/ai/sql-cron-mutation.ts b/apps/studio/data/ai/sql-cron-mutation.ts index c9c636b0568..ffa453f3d7d 100644 --- a/apps/studio/data/ai/sql-cron-mutation.ts +++ b/apps/studio/data/ai/sql-cron-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { constructHeaders, fetchHandler } from 'data/fetchers' import { BASE_PATH } from 'lib/constants' -import { ResponseError } from 'types' +import { ResponseError, UseCustomMutationOptions } from 'types' export type SqlCronGenerateResponse = string @@ -41,7 +41,7 @@ export const useSqlCronGenerateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/ai/sql-title-mutation.ts b/apps/studio/data/ai/sql-title-mutation.ts index a5bf4c95044..e810d914851 100644 --- a/apps/studio/data/ai/sql-title-mutation.ts +++ b/apps/studio/data/ai/sql-title-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { constructHeaders, fetchHandler } from 'data/fetchers' import { BASE_PATH } from 'lib/constants' -import { ResponseError } from 'types' +import { ResponseError, UseCustomMutationOptions } from 'types' export type SqlTitleGenerateResponse = { title: string @@ -45,7 +45,7 @@ export const useSqlTitleGenerateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/analytics/functions-combined-stats-query.ts b/apps/studio/data/analytics/functions-combined-stats-query.ts index c9fa6f38103..d22181c45a2 100644 --- a/apps/studio/data/analytics/functions-combined-stats-query.ts +++ b/apps/studio/data/analytics/functions-combined-stats-query.ts @@ -1,7 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { operations } from 'api-types' import { get, handleError } from 'data/fetchers' import { analyticsKeys } from './keys' +import { UseCustomQueryOptions } from 'types' export type FunctionsCombinedStatsVariables = { projectRef?: string @@ -54,7 +55,7 @@ export const useFunctionsCombinedStatsQuery = = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: analyticsKeys.functionsCombinedStats(projectRef, { functionId, interval }), diff --git a/apps/studio/data/analytics/functions-req-stats-query.ts b/apps/studio/data/analytics/functions-req-stats-query.ts index 0b974c4b12d..90ec7709313 100644 --- a/apps/studio/data/analytics/functions-req-stats-query.ts +++ b/apps/studio/data/analytics/functions-req-stats-query.ts @@ -1,7 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { operations } from 'api-types' import { get, handleError } from 'data/fetchers' import { analyticsKeys } from './keys' +import { UseCustomQueryOptions } from 'types' export type FunctionsReqStatsVariables = { projectRef?: string @@ -54,7 +55,7 @@ export const useFunctionsReqStatsQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: analyticsKeys.functionsReqStats(projectRef, { functionId, interval }), diff --git a/apps/studio/data/analytics/functions-resource-usage-query.ts b/apps/studio/data/analytics/functions-resource-usage-query.ts index 45d8d1a4f81..dd49f11567b 100644 --- a/apps/studio/data/analytics/functions-resource-usage-query.ts +++ b/apps/studio/data/analytics/functions-resource-usage-query.ts @@ -1,7 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { operations } from 'api-types' import { get, handleError } from 'data/fetchers' import { analyticsKeys } from './keys' +import { UseCustomQueryOptions } from 'types' export type FunctionsResourceUsageVariables = { projectRef?: string @@ -54,7 +55,7 @@ export const useFunctionsResourceUsageQuery = = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: analyticsKeys.functionsResourceUsage(projectRef, { functionId, interval }), diff --git a/apps/studio/data/analytics/infra-monitoring-query.ts b/apps/studio/data/analytics/infra-monitoring-query.ts index e57ecc3a507..57acc306bb8 100644 --- a/apps/studio/data/analytics/infra-monitoring-query.ts +++ b/apps/studio/data/analytics/infra-monitoring-query.ts @@ -1,9 +1,10 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import dayjs from 'dayjs' import { get, handleError } from 'data/fetchers' import type { AnalyticsData, AnalyticsInterval } from './constants' import { analyticsKeys } from './keys' +import { UseCustomQueryOptions } from 'types' export type InfraMonitoringAttribute = | 'max_cpu_usage' @@ -76,7 +77,7 @@ export const useInfraMonitoringQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: analyticsKeys.infraMonitoring(projectRef, { diff --git a/apps/studio/data/analytics/org-daily-stats-query.ts b/apps/studio/data/analytics/org-daily-stats-query.ts index c6d0e247b77..fae49b3b4d1 100644 --- a/apps/studio/data/analytics/org-daily-stats-query.ts +++ b/apps/studio/data/analytics/org-daily-stats-query.ts @@ -1,8 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import type { components } from 'api-types' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { analyticsKeys } from './keys' export enum EgressType { @@ -149,7 +149,10 @@ export type OrgDailyStatsError = ResponseError export const useOrgDailyStatsQuery = ( { orgSlug, startDate, endDate, projectRef }: OrgDailyStatsVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: analyticsKeys.orgDailyStats(orgSlug, { startDate, endDate, projectRef }), diff --git a/apps/studio/data/analytics/project-daily-stats-query.ts b/apps/studio/data/analytics/project-daily-stats-query.ts index 610a87397ca..03308280cd1 100644 --- a/apps/studio/data/analytics/project-daily-stats-query.ts +++ b/apps/studio/data/analytics/project-daily-stats-query.ts @@ -1,9 +1,10 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { operations } from 'api-types' import { get, handleError } from 'data/fetchers' import type { AnalyticsData } from './constants' import { analyticsKeys } from './keys' +import { UseCustomQueryOptions } from 'types' export type ProjectDailyStatsAttribute = operations['DailyStatsController_getDailyStats']['parameters']['query']['attribute'] @@ -48,7 +49,7 @@ export const useProjectDailyStatsQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: analyticsKeys.infraMonitoring(projectRef, { diff --git a/apps/studio/data/analytics/project-log-requests-count-query.ts b/apps/studio/data/analytics/project-log-requests-count-query.ts index bc1064a01d1..e8ef75ffb50 100644 --- a/apps/studio/data/analytics/project-log-requests-count-query.ts +++ b/apps/studio/data/analytics/project-log-requests-count-query.ts @@ -1,7 +1,7 @@ -import { QueryClient, useQuery, UseQueryOptions } from '@tanstack/react-query' +import { QueryClient, useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { analyticsKeys } from './keys' export type ProjectLogRequestsCountVariables = { @@ -38,7 +38,7 @@ export const useProjectLogRequestsCountQuery = = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: analyticsKeys.usageApiRequestsCount(projectRef), diff --git a/apps/studio/data/analytics/project-log-stats-query.ts b/apps/studio/data/analytics/project-log-stats-query.ts index e9668785123..d50cb53fdf0 100644 --- a/apps/studio/data/analytics/project-log-stats-query.ts +++ b/apps/studio/data/analytics/project-log-stats-query.ts @@ -1,7 +1,8 @@ -import { QueryClient, useQuery, UseQueryOptions } from '@tanstack/react-query' +import { QueryClient, useQuery } from '@tanstack/react-query' import { operations } from 'api-types' import { get, handleError } from 'data/fetchers' import { analyticsKeys } from './keys' +import { UseCustomQueryOptions } from 'types' export type ProjectLogStatsVariables = { projectRef?: string @@ -58,7 +59,7 @@ export const useProjectLogStatsQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: analyticsKeys.usageApiCounts(projectRef, interval), diff --git a/apps/studio/data/api-authorization/api-authorization-approve-mutation.ts b/apps/studio/data/api-authorization/api-authorization-approve-mutation.ts index 832c71149b5..6d548342fe8 100644 --- a/apps/studio/data/api-authorization/api-authorization-approve-mutation.ts +++ b/apps/studio/data/api-authorization/api-authorization-approve-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type ApiAuthorizationApproveVariables = { id: string @@ -33,7 +33,11 @@ export const useApiAuthorizationApproveMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + ApiAuthorizationApproveData, + ResponseError, + ApiAuthorizationApproveVariables + >, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/api-authorization/api-authorization-decline-mutation.ts b/apps/studio/data/api-authorization/api-authorization-decline-mutation.ts index bf1eec660ec..9f47d22cdeb 100644 --- a/apps/studio/data/api-authorization/api-authorization-decline-mutation.ts +++ b/apps/studio/data/api-authorization/api-authorization-decline-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { del, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type ApiAuthorizationDeclineVariables = { id: string @@ -32,7 +32,11 @@ export const useApiAuthorizationDeclineMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + ApiAuthorizationDeclineData, + ResponseError, + ApiAuthorizationDeclineVariables + >, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/api-authorization/api-authorization-query.ts b/apps/studio/data/api-authorization/api-authorization-query.ts index bfe1f9a7cc6..92f8672caa4 100644 --- a/apps/studio/data/api-authorization/api-authorization-query.ts +++ b/apps/studio/data/api-authorization/api-authorization-query.ts @@ -1,8 +1,9 @@ import type { OAuthScope } from '@supabase/shared-types/out/constants' -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' import { resourceKeys } from './keys' +import { UseCustomQueryOptions } from 'types' export type ApiAuthorizationVariables = { id?: string @@ -40,7 +41,7 @@ export type ResourceError = { errorEventId: string; message: string } export const useApiAuthorizationQuery = ( { id }: ApiAuthorizationVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: resourceKeys.resource(id), diff --git a/apps/studio/data/api-keys/[id]/api-key-id-query.ts b/apps/studio/data/api-keys/[id]/api-key-id-query.ts index b143f24e40e..1de58426adc 100644 --- a/apps/studio/data/api-keys/[id]/api-key-id-query.ts +++ b/apps/studio/data/api-keys/[id]/api-key-id-query.ts @@ -1,6 +1,6 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { apiKeysKeys } from './../keys' export interface APIKeyVariables { @@ -35,7 +35,7 @@ export type APIKeyIdData = Awaited> export const useAPIKeyIdQuery = ( { projectRef, id, reveal }: APIKeyVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: apiKeysKeys.single(projectRef, id), diff --git a/apps/studio/data/api-keys/[id]/api-key-id-update-mutation.ts b/apps/studio/data/api-keys/[id]/api-key-id-update-mutation.ts index 2af09655ba0..4fbbcb20648 100644 --- a/apps/studio/data/api-keys/[id]/api-key-id-update-mutation.ts +++ b/apps/studio/data/api-keys/[id]/api-key-id-update-mutation.ts @@ -1,8 +1,8 @@ import { toast } from 'sonner' -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { handleError, patch } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { apiKeysKeys } from '../keys' export interface UpdateAPIKeybyIdVariables { @@ -43,7 +43,7 @@ export const useResourceUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/api-keys/api-key-create-mutation.ts b/apps/studio/data/api-keys/api-key-create-mutation.ts index 65d50087034..9c5562e2bf9 100644 --- a/apps/studio/data/api-keys/api-key-create-mutation.ts +++ b/apps/studio/data/api-keys/api-key-create-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { apiKeysKeys } from './keys' export type APIKeyCreateVariables = { @@ -58,7 +58,7 @@ export const useAPIKeyCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/api-keys/api-key-delete-mutation.ts b/apps/studio/data/api-keys/api-key-delete-mutation.ts index 7ad3e9b1b75..fd290dbda95 100644 --- a/apps/studio/data/api-keys/api-key-delete-mutation.ts +++ b/apps/studio/data/api-keys/api-key-delete-mutation.ts @@ -1,7 +1,7 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { del, handleError } from 'data/fetchers' import { toast } from 'sonner' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { apiKeysKeys } from './keys' export type APIKeyDeleteVariables = { @@ -30,7 +30,7 @@ export const useAPIKeyDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/api-keys/api-keys-query.ts b/apps/studio/data/api-keys/api-keys-query.ts index 36a93b83f53..4f94bd35599 100644 --- a/apps/studio/data/api-keys/api-keys-query.ts +++ b/apps/studio/data/api-keys/api-keys-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { apiKeysKeys } from './keys' type LegacyKeys = { @@ -68,7 +68,7 @@ export type APIKeysData = Awaited> export const useAPIKeysQuery = ( { projectRef, reveal = false }: APIKeysVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => { return useQuery({ queryKey: apiKeysKeys.list(projectRef, reveal), diff --git a/apps/studio/data/api-keys/legacy-api-key-toggle-mutation.ts b/apps/studio/data/api-keys/legacy-api-key-toggle-mutation.ts index 23c25d44bbc..5fbb64148f5 100644 --- a/apps/studio/data/api-keys/legacy-api-key-toggle-mutation.ts +++ b/apps/studio/data/api-keys/legacy-api-key-toggle-mutation.ts @@ -1,7 +1,7 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { handleError, put } from 'data/fetchers' import { toast } from 'sonner' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { apiKeysKeys } from './keys' export type ToggleLegacyAPIKeysVariables = { @@ -30,7 +30,7 @@ export const useToggleLegacyAPIKeysMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/api-keys/legacy-api-keys-status-query.ts b/apps/studio/data/api-keys/legacy-api-keys-status-query.ts index 33c812b72eb..a513906d3b9 100644 --- a/apps/studio/data/api-keys/legacy-api-keys-status-query.ts +++ b/apps/studio/data/api-keys/legacy-api-keys-status-query.ts @@ -1,8 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' import { IS_PLATFORM } from 'lib/constants' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { apiKeysKeys } from './keys' interface LegacyAPIKeysStatusVariables { @@ -31,7 +31,7 @@ export const useLegacyAPIKeysStatusQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: apiKeysKeys.status(projectRef), diff --git a/apps/studio/data/api-keys/temp-api-keys-query.ts b/apps/studio/data/api-keys/temp-api-keys-query.ts index 5d27625ef3a..eed65a90814 100644 --- a/apps/studio/data/api-keys/temp-api-keys-query.ts +++ b/apps/studio/data/api-keys/temp-api-keys-query.ts @@ -1,7 +1,7 @@ -import { type UseQueryOptions, useQuery } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { apiKeysKeys } from './keys' interface getTemporaryAPIKeyVariables { @@ -36,7 +36,10 @@ export type TemporaryAPIKeyData = Awaited> export const useTemporaryAPIKeyQuery = ( { projectRef, expiry = 300 }: getTemporaryAPIKeyVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => { return useQuery({ queryKey: apiKeysKeys.temporary(projectRef), diff --git a/apps/studio/data/api-settings/create-and-expose-api-schema-mutation.ts b/apps/studio/data/api-settings/create-and-expose-api-schema-mutation.ts index c331557c1f5..6eca1b957a5 100644 --- a/apps/studio/data/api-settings/create-and-expose-api-schema-mutation.ts +++ b/apps/studio/data/api-settings/create-and-expose-api-schema-mutation.ts @@ -1,11 +1,11 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { configKeys } from 'data/config/keys' import { databaseKeys } from 'data/database/keys' import { handleError, patch } from 'data/fetchers' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type CreateAndExposeAPISchemaVariables = { projectRef: string @@ -52,7 +52,7 @@ export const useCreateAndExposeAPISchemaMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< CreateAndExposeAPISchemaData, ResponseError, CreateAndExposeAPISchemaVariables diff --git a/apps/studio/data/auth/auth-config-query.ts b/apps/studio/data/auth/auth-config-query.ts index 466c28339a9..514157b29d1 100644 --- a/apps/studio/data/auth/auth-config-query.ts +++ b/apps/studio/data/auth/auth-config-query.ts @@ -1,9 +1,9 @@ -import { useQuery, useQueryClient, UseQueryOptions } from '@tanstack/react-query' +import { useQuery, useQueryClient } from '@tanstack/react-query' import type { components } from 'data/api' import { get, handleError } from 'data/fetchers' import { IS_PLATFORM } from 'lib/constants' import { useCallback } from 'react' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { authKeys } from './keys' export type AuthConfigVariables = { @@ -35,7 +35,7 @@ export const useAuthConfigQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: authKeys.authConfig(projectRef), diff --git a/apps/studio/data/auth/auth-config-update-mutation.ts b/apps/studio/data/auth/auth-config-update-mutation.ts index 322165a466e..75f88d4d5e6 100644 --- a/apps/studio/data/auth/auth-config-update-mutation.ts +++ b/apps/studio/data/auth/auth-config-update-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import type { components } from 'data/api' import { handleError, patch } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { authKeys } from './keys' export type AuthConfigUpdateVariables = { @@ -32,7 +32,7 @@ export const useAuthConfigUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/auth/auth-hooks-update-mutation.ts b/apps/studio/data/auth/auth-hooks-update-mutation.ts index 10b00616cf8..7da20512265 100644 --- a/apps/studio/data/auth/auth-hooks-update-mutation.ts +++ b/apps/studio/data/auth/auth-hooks-update-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import type { components } from 'data/api' import { handleError, patch } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { authKeys } from './keys' export type AuthHooksUpdateVariables = { @@ -28,7 +28,7 @@ export const useAuthHooksUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/auth/session-access-token-query.ts b/apps/studio/data/auth/session-access-token-query.ts index d335e3ed6a6..b72fb1820e6 100644 --- a/apps/studio/data/auth/session-access-token-query.ts +++ b/apps/studio/data/auth/session-access-token-query.ts @@ -1,7 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { getAccessToken } from 'common' import { authKeys } from './keys' +import { UseCustomQueryOptions } from 'types' export async function getSessionAccessToken() { // ignore if server-side @@ -21,7 +22,7 @@ export type SessionAccessTokenError = unknown export const useSessionAccessTokenQuery = ({ enabled = true, ...options -}: UseQueryOptions = {}) => +}: UseCustomQueryOptions = {}) => useQuery({ queryKey: authKeys.accessToken(), queryFn: () => getSessionAccessToken(), diff --git a/apps/studio/data/auth/user-create-mutation.ts b/apps/studio/data/auth/user-create-mutation.ts index f199977e79a..c6a56e15ba9 100644 --- a/apps/studio/data/auth/user-create-mutation.ts +++ b/apps/studio/data/auth/user-create-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { authKeys } from './keys' export type UserCreateVariables = { @@ -34,7 +34,7 @@ export const useUserCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/auth/user-delete-mfa-factors-mutation.ts b/apps/studio/data/auth/user-delete-mfa-factors-mutation.ts index 7ae5937528b..d27a9526d5c 100644 --- a/apps/studio/data/auth/user-delete-mfa-factors-mutation.ts +++ b/apps/studio/data/auth/user-delete-mfa-factors-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { del, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type UserDeleteMFAFactorsVariables = { projectRef: string @@ -26,7 +26,7 @@ export const useUserDeleteMFAFactorsMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/auth/user-delete-mutation.ts b/apps/studio/data/auth/user-delete-mutation.ts index ffa29246567..17e0d9bd482 100644 --- a/apps/studio/data/auth/user-delete-mutation.ts +++ b/apps/studio/data/auth/user-delete-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { del, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { authKeys } from './keys' export type UserDeleteVariables = { @@ -26,7 +26,7 @@ export const useUserDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/auth/user-invite-mutation.ts b/apps/studio/data/auth/user-invite-mutation.ts index e493f0a892b..15e149e72ee 100644 --- a/apps/studio/data/auth/user-invite-mutation.ts +++ b/apps/studio/data/auth/user-invite-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { authKeys } from './keys' export type UserInviteVariables = { @@ -26,7 +26,7 @@ export const useUserInviteMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/auth/user-reset-password-mutation.ts b/apps/studio/data/auth/user-reset-password-mutation.ts index d39a5a9a692..fa1f5b22d4d 100644 --- a/apps/studio/data/auth/user-reset-password-mutation.ts +++ b/apps/studio/data/auth/user-reset-password-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import type { User } from './users-infinite-query' export type UserResetPasswordVariables = { @@ -28,7 +28,7 @@ export const useUserResetPasswordMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/auth/user-send-magic-link-mutation.ts b/apps/studio/data/auth/user-send-magic-link-mutation.ts index 127fb33a313..cf3eca6b50a 100644 --- a/apps/studio/data/auth/user-send-magic-link-mutation.ts +++ b/apps/studio/data/auth/user-send-magic-link-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import type { User } from './users-infinite-query' export type UserSendMagicLinkVariables = { @@ -28,7 +28,7 @@ export const useUserSendMagicLinkMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/auth/user-send-otp-mutation.ts b/apps/studio/data/auth/user-send-otp-mutation.ts index 6072fcb969c..ab780629642 100644 --- a/apps/studio/data/auth/user-send-otp-mutation.ts +++ b/apps/studio/data/auth/user-send-otp-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import type { User } from './users-infinite-query' export type UserSendOTPVariables = { @@ -28,7 +28,7 @@ export const useUserSendOTPMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/auth/user-update-mutation.ts b/apps/studio/data/auth/user-update-mutation.ts index d65b40604a8..986a2416a1e 100644 --- a/apps/studio/data/auth/user-update-mutation.ts +++ b/apps/studio/data/auth/user-update-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, patch } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { authKeys } from './keys' export type UserUpdateVariables = { @@ -29,7 +29,7 @@ export const useUserUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/auth/users-count-query.ts b/apps/studio/data/auth/users-count-query.ts index 67052362022..434d45a13a0 100644 --- a/apps/studio/data/auth/users-count-query.ts +++ b/apps/studio/data/auth/users-count-query.ts @@ -1,7 +1,8 @@ import { getUsersCountSQL } from '@supabase/pg-meta/src/sql/studio/get-users-count' -import { useQuery, type UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { executeSql, type ExecuteSqlError } from 'data/sql/execute-sql-query' +import { UseCustomQueryOptions } from 'types' import { authKeys } from './keys' import { type Filter } from './users-infinite-query' @@ -63,7 +64,7 @@ export const useUsersCountQuery = ( providers, forceExactCount, }: UsersCountVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: authKeys.usersCount(projectRef, { diff --git a/apps/studio/data/auth/users-infinite-query.ts b/apps/studio/data/auth/users-infinite-query.ts index 2447d5656b6..0d360f0d9e7 100644 --- a/apps/studio/data/auth/users-infinite-query.ts +++ b/apps/studio/data/auth/users-infinite-query.ts @@ -1,10 +1,11 @@ import { getPaginatedUsersSQL } from '@supabase/pg-meta/src/sql/studio/get-users-paginated' -import { useInfiniteQuery, UseInfiniteQueryOptions } from '@tanstack/react-query' +import { useInfiniteQuery } from '@tanstack/react-query' import type { components } from 'data/api' import { executeSql, ExecuteSqlError } from 'data/sql/execute-sql-query' import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject' import { PROJECT_STATUS } from 'lib/constants' +import { UseCustomInfiniteQueryOptions } from 'types' import { authKeys } from './keys' const USERS_PAGE_LIMIT = 50 @@ -38,7 +39,7 @@ export const useUsersInfiniteQuery = ( order, column, }: UsersVariables, - { enabled = true, ...options }: UseInfiniteQueryOptions = {} + { enabled = true, ...options }: UseCustomInfiniteQueryOptions = {} ) => { const { data: project } = useSelectedProjectQuery() const isActive = project?.status === PROJECT_STATUS.ACTIVE_HEALTHY diff --git a/apps/studio/data/auth/validate-spam-mutation.ts b/apps/studio/data/auth/validate-spam-mutation.ts index 920a025f7d7..067b8945f07 100644 --- a/apps/studio/data/auth/validate-spam-mutation.ts +++ b/apps/studio/data/auth/validate-spam-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import type { components } from 'data/api' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type ValidateSpamVariables = { projectRef: string @@ -29,7 +29,7 @@ export const useValidateSpamMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/banned-ips/banned-ips-delete-mutations.ts b/apps/studio/data/banned-ips/banned-ips-delete-mutations.ts index 8cbda71f254..1d592df0764 100644 --- a/apps/studio/data/banned-ips/banned-ips-delete-mutations.ts +++ b/apps/studio/data/banned-ips/banned-ips-delete-mutations.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { del, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { BannedIPKeys } from './keys' export type IPDeleteVariables = { @@ -29,7 +29,10 @@ export const useBannedIPsDeleteMutation = ({ onSuccess, onError, ...options -}: Omit, 'mutationFn'> = {}) => { +}: Omit< + UseCustomMutationOptions, + 'mutationFn' +> = {}) => { const queryClient = useQueryClient() return useMutation({ mutationFn: (vars) => deleteBannedIPs(vars), diff --git a/apps/studio/data/banned-ips/banned-ips-query.ts b/apps/studio/data/banned-ips/banned-ips-query.ts index 710b68c3fb0..e79a52f9913 100644 --- a/apps/studio/data/banned-ips/banned-ips-query.ts +++ b/apps/studio/data/banned-ips/banned-ips-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { BannedIPKeys } from './keys' export type BannedIPVariables = { @@ -28,7 +28,7 @@ export type IPError = ResponseError export const useBannedIPsQuery = ( { projectRef }: BannedIPVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: BannedIPKeys.list(projectRef), diff --git a/apps/studio/data/branches/branch-create-mutation.ts b/apps/studio/data/branches/branch-create-mutation.ts index fb3ffaa181e..b03bcf95a05 100644 --- a/apps/studio/data/branches/branch-create-mutation.ts +++ b/apps/studio/data/branches/branch-create-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import type { components } from 'api-types' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { branchKeys } from './keys' export type BranchCreateVariables = { @@ -48,7 +48,7 @@ export const useBranchCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/branches/branch-delete-mutation.ts b/apps/studio/data/branches/branch-delete-mutation.ts index ef7381eca44..55d52338ded 100644 --- a/apps/studio/data/branches/branch-delete-mutation.ts +++ b/apps/studio/data/branches/branch-delete-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { del, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { BranchesData } from './branches-query' import { branchKeys } from './keys' @@ -27,7 +27,7 @@ export const useBranchDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/branches/branch-diff-query.ts b/apps/studio/data/branches/branch-diff-query.ts index a3976d63a65..bec96019640 100644 --- a/apps/studio/data/branches/branch-diff-query.ts +++ b/apps/studio/data/branches/branch-diff-query.ts @@ -1,8 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' import { IS_PLATFORM } from 'lib/constants' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { branchKeys } from './keys' export type BranchDiffVariables = { @@ -45,7 +45,7 @@ export const useBranchDiffQuery = ( { enabled = true, ...options - }: Omit, 'queryKey' | 'queryFn'> = {} + }: Omit, 'queryKey' | 'queryFn'> = {} ) => useQuery({ queryKey: branchKeys.diff(projectRef, branchRef), diff --git a/apps/studio/data/branches/branch-merge-mutation.ts b/apps/studio/data/branches/branch-merge-mutation.ts index 5da2ecdf746..9155bf41464 100644 --- a/apps/studio/data/branches/branch-merge-mutation.ts +++ b/apps/studio/data/branches/branch-merge-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { upsertMigration } from '../database/migration-upsert-mutation' import { getBranchDiff } from './branch-diff-query' import { branchKeys } from './keys' @@ -59,7 +59,7 @@ export const useBranchMergeMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/branches/branch-push-mutation.ts b/apps/studio/data/branches/branch-push-mutation.ts index d90c72ce0aa..499b091ccb5 100644 --- a/apps/studio/data/branches/branch-push-mutation.ts +++ b/apps/studio/data/branches/branch-push-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { branchKeys } from './keys' export type BranchPushVariables = { @@ -27,7 +27,7 @@ export const useBranchPushMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/branches/branch-query.ts b/apps/studio/data/branches/branch-query.ts index 03c83a3e88f..c22d6fd3cf5 100644 --- a/apps/studio/data/branches/branch-query.ts +++ b/apps/studio/data/branches/branch-query.ts @@ -1,8 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' import { IS_PLATFORM } from 'lib/constants' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { branchKeys } from './keys' export type BranchVariables = { @@ -27,7 +27,7 @@ export type BranchError = ResponseError export const useBranchQuery = ( { projectRef, branchRef }: BranchVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: branchKeys.detail(projectRef, branchRef), diff --git a/apps/studio/data/branches/branch-reset-mutation.ts b/apps/studio/data/branches/branch-reset-mutation.ts index 6be95f3c0da..7654bc90801 100644 --- a/apps/studio/data/branches/branch-reset-mutation.ts +++ b/apps/studio/data/branches/branch-reset-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { branchKeys } from './keys' export type BranchResetVariables = { @@ -27,7 +27,7 @@ export const useBranchResetMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/branches/branch-update-mutation.ts b/apps/studio/data/branches/branch-update-mutation.ts index 0dc4cd28f73..90674f6ced8 100644 --- a/apps/studio/data/branches/branch-update-mutation.ts +++ b/apps/studio/data/branches/branch-update-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, patch } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { branchKeys } from './keys' export type BranchUpdateVariables = { @@ -44,7 +44,7 @@ export const useBranchUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/branches/branches-query.ts b/apps/studio/data/branches/branches-query.ts index cf4f95f4b17..e4191a80cc2 100644 --- a/apps/studio/data/branches/branches-query.ts +++ b/apps/studio/data/branches/branches-query.ts @@ -1,9 +1,9 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import type { components } from 'data/api' import { get, handleError } from 'data/fetchers' import { IS_PLATFORM } from 'lib/constants' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { branchKeys } from './keys' export type BranchesVariables = { @@ -36,7 +36,7 @@ export type BranchesError = ResponseError export const useBranchesQuery = ( { projectRef }: BranchesVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: branchKeys.list(projectRef), diff --git a/apps/studio/data/config/disk-attributes-query.ts b/apps/studio/data/config/disk-attributes-query.ts index eb5f49cb59e..07c1b9ced35 100644 --- a/apps/studio/data/config/disk-attributes-query.ts +++ b/apps/studio/data/config/disk-attributes-query.ts @@ -1,10 +1,10 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import dayjs from 'dayjs' import { useMemo } from 'react' import type { components } from 'data/api' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { COOLDOWN_DURATION } from './disk-attributes-update-mutation' import { configKeys } from './keys' @@ -37,7 +37,7 @@ export const useDiskAttributesQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: configKeys.diskAttributes(projectRef), diff --git a/apps/studio/data/config/disk-attributes-update-mutation.ts b/apps/studio/data/config/disk-attributes-update-mutation.ts index ddbfead579b..9a090d9e2a2 100644 --- a/apps/studio/data/config/disk-attributes-update-mutation.ts +++ b/apps/studio/data/config/disk-attributes-update-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { configKeys } from './keys' export const COOLDOWN_DURATION = 60 * 60 * 6 @@ -50,7 +50,7 @@ export const useUpdateDiskAttributesMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/config/disk-autoscale-config-query.ts b/apps/studio/data/config/disk-autoscale-config-query.ts index 6d44f7f8b0b..146d911d70c 100644 --- a/apps/studio/data/config/disk-autoscale-config-query.ts +++ b/apps/studio/data/config/disk-autoscale-config-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { configKeys } from './keys' export type DiskAutoscaleCustomConfigVariables = { @@ -33,7 +33,11 @@ export const useDiskAutoscaleCustomConfigQuery = = {} + }: UseCustomQueryOptions< + DiskAutoscaleCustomConfigData, + DiskAutoscaleCustomConfigError, + TData + > = {} ) => useQuery({ queryKey: configKeys.diskAutoscaleConfig(projectRef), diff --git a/apps/studio/data/config/disk-autoscale-config-update-mutation.ts b/apps/studio/data/config/disk-autoscale-config-update-mutation.ts index 13a30ad319c..d1788cc5e77 100644 --- a/apps/studio/data/config/disk-autoscale-config-update-mutation.ts +++ b/apps/studio/data/config/disk-autoscale-config-update-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { configKeys } from './keys' export type UpdateDiskAutoscaleConfigVariables = { @@ -41,7 +41,7 @@ export const useUpdateDiskAutoscaleConfigMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< UpdateDiskAutoscaleConfigData, ResponseError, UpdateDiskAutoscaleConfigVariables diff --git a/apps/studio/data/config/disk-breakdown-query.ts b/apps/studio/data/config/disk-breakdown-query.ts index 757a289735c..2e2c9b7e0f2 100644 --- a/apps/studio/data/config/disk-breakdown-query.ts +++ b/apps/studio/data/config/disk-breakdown-query.ts @@ -1,8 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' -import type { ResponseError } from 'types' -import { configKeys } from './keys' import { executeSql } from 'data/sql/execute-sql-query' +import type { ResponseError, UseCustomQueryOptions } from 'types' +import { configKeys } from './keys' export type DiskBreakdownVariables = { projectRef?: string @@ -50,7 +50,10 @@ export type DiskBreakdownError = ResponseError export const useDiskBreakdownQuery = ( { projectRef, connectionString }: DiskBreakdownVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: configKeys.diskBreakdown(projectRef), diff --git a/apps/studio/data/config/disk-utilization-query.ts b/apps/studio/data/config/disk-utilization-query.ts index 3e7a5f394f0..0f7c8903c8b 100644 --- a/apps/studio/data/config/disk-utilization-query.ts +++ b/apps/studio/data/config/disk-utilization-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { configKeys } from './keys' export type DiskUtilizationVariables = { @@ -31,7 +31,7 @@ export const useDiskUtilizationQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: configKeys.diskUtilization(projectRef), diff --git a/apps/studio/data/config/jwt-secret-update-mutation.ts b/apps/studio/data/config/jwt-secret-update-mutation.ts index c2ead8572cd..d03d7dff928 100644 --- a/apps/studio/data/config/jwt-secret-update-mutation.ts +++ b/apps/studio/data/config/jwt-secret-update-mutation.ts @@ -1,7 +1,7 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { handleError, patch } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { configKeys } from './keys' export type JwtSecretUpdateVariables = { @@ -37,7 +37,7 @@ export const useJwtSecretUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/config/jwt-secret-updating-status-query.ts b/apps/studio/data/config/jwt-secret-updating-status-query.ts index 3f0a7167c87..2aa7cbe86be 100644 --- a/apps/studio/data/config/jwt-secret-updating-status-query.ts +++ b/apps/studio/data/config/jwt-secret-updating-status-query.ts @@ -1,6 +1,7 @@ import { JwtSecretUpdateStatus } from '@supabase/shared-types/out/events' -import { useQuery, useQueryClient, UseQueryOptions } from '@tanstack/react-query' +import { useQuery, useQueryClient } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' +import { UseCustomQueryOptions } from 'types' import { configKeys } from './keys' export type JwtSecretUpdatingStatusVariables = { @@ -49,7 +50,7 @@ export const useJwtSecretUpdatingStatusQuery = = {} + }: UseCustomQueryOptions = {} ) => { const client = useQueryClient() diff --git a/apps/studio/data/config/project-compliance-config-mutation.ts b/apps/studio/data/config/project-compliance-config-mutation.ts index 8218f85b8ff..dd6a11f4190 100644 --- a/apps/studio/data/config/project-compliance-config-mutation.ts +++ b/apps/studio/data/config/project-compliance-config-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, patch } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { configKeys } from './keys' export type ComplianceConfigUpdateVariables = { @@ -32,7 +32,11 @@ export const useComplianceConfigUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + ComplianceConfigUpdateData, + ResponseError, + ComplianceConfigUpdateVariables + >, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/config/project-creation-postgres-versions-query.ts b/apps/studio/data/config/project-creation-postgres-versions-query.ts index 1f3ecfdf9cc..7ffc09281a3 100644 --- a/apps/studio/data/config/project-creation-postgres-versions-query.ts +++ b/apps/studio/data/config/project-creation-postgres-versions-query.ts @@ -1,8 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { handleError, post } from 'data/fetchers' import { CloudProvider } from 'shared-data' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { configKeys } from './keys' export type ProjectCreationPostgresVersionsVariables = { @@ -37,7 +37,7 @@ export const useProjectCreationPostgresVersionsQuery = , + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/config/project-postgrest-config-query.ts b/apps/studio/data/config/project-postgrest-config-query.ts index 5ecea8a8bb7..178defcfb8c 100644 --- a/apps/studio/data/config/project-postgrest-config-query.ts +++ b/apps/studio/data/config/project-postgrest-config-query.ts @@ -1,8 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { components } from 'api-types' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { configKeys } from './keys' export type ProjectPostgrestConfigVariables = { @@ -37,7 +37,7 @@ export const useProjectPostgrestConfigQuery = = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: configKeys.postgrest(projectRef), diff --git a/apps/studio/data/config/project-postgrest-config-update-mutation.ts b/apps/studio/data/config/project-postgrest-config-update-mutation.ts index 43dcfeff8dd..238a7cc0a30 100644 --- a/apps/studio/data/config/project-postgrest-config-update-mutation.ts +++ b/apps/studio/data/config/project-postgrest-config-update-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { components } from 'api-types' import { handleError, patch } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { configKeys } from './keys' export type ProjectPostgrestConfigUpdateVariables = { @@ -46,7 +46,7 @@ export const useProjectPostgrestConfigUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< ProjectPostgrestConfigUpdateData, ResponseError, ProjectPostgrestConfigUpdateVariables diff --git a/apps/studio/data/config/project-settings-v2-query.ts b/apps/studio/data/config/project-settings-v2-query.ts index 2037b326d46..f43729766e0 100644 --- a/apps/studio/data/config/project-settings-v2-query.ts +++ b/apps/studio/data/config/project-settings-v2-query.ts @@ -1,10 +1,10 @@ import { PermissionAction } from '@supabase/shared-types/out/constants' -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import type { components } from 'data/api' import { get, handleError } from 'data/fetchers' import { useAsyncCheckPermissions } from 'hooks/misc/useCheckPermissions' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { configKeys } from './keys' export type ProjectSettingsVariables = { projectRef?: string } @@ -40,7 +40,7 @@ export const useProjectSettingsV2Query = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => { // [Joshen] Sync with API perms checking here - shouldReturnApiKeys // https://github.com/supabase/infrastructure/blob/develop/api/src/routes/platform/projects/ref/settings.controller.ts#L92 diff --git a/apps/studio/data/config/project-storage-config-query.ts b/apps/studio/data/config/project-storage-config-query.ts index 82cc191b194..ab1bc6350a2 100644 --- a/apps/studio/data/config/project-storage-config-query.ts +++ b/apps/studio/data/config/project-storage-config-query.ts @@ -1,9 +1,10 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' +import { useFlag } from 'common' import { components } from 'data/api' import { get, handleError } from 'data/fetchers' import { IS_PLATFORM } from 'lib/constants' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { configKeys } from './keys' export type ProjectStorageConfigVariables = { @@ -43,7 +44,7 @@ export const useProjectStorageConfigQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: configKeys.storage(projectRef), @@ -51,3 +52,14 @@ export const useProjectStorageConfigQuery = ( enabled: enabled && IS_PLATFORM && typeof projectRef !== 'undefined', ...options, }) + +export const useIsAnalyticsBucketsEnabled = ({ projectRef }: { projectRef?: string }) => { + const { data } = useProjectStorageConfigQuery({ projectRef }) + return !!data?.features.icebergCatalog?.enabled +} + +export const useIsVectorBucketsEnabled = ({ projectRef }: { projectRef?: string }) => { + // [Joshen] Temp using feature flag - will need to shift to storage config like analytics bucket once ready + const isVectorBucketsEnabled = useFlag('storageAnalyticsVector') + return isVectorBucketsEnabled +} diff --git a/apps/studio/data/config/project-storage-config-update-mutation.ts b/apps/studio/data/config/project-storage-config-update-mutation.ts index bb525ef5eed..6f8b262df33 100644 --- a/apps/studio/data/config/project-storage-config-update-mutation.ts +++ b/apps/studio/data/config/project-storage-config-update-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { components } from 'api-types' import { handleError, patch } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { configKeys } from './keys' type StorageConfigUpdatePayload = components['schemas']['UpdateStorageConfigBody'] @@ -34,7 +34,7 @@ export const useProjectStorageConfigUpdateUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< ProjectStorageConfigUpdateUpdateData, ResponseError, ProjectStorageConfigUpdateUpdateVariables diff --git a/apps/studio/data/config/project-temp-disable-read-only-mutation.ts b/apps/studio/data/config/project-temp-disable-read-only-mutation.ts index f7995c7e1e1..eaf52adc75b 100644 --- a/apps/studio/data/config/project-temp-disable-read-only-mutation.ts +++ b/apps/studio/data/config/project-temp-disable-read-only-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' import { usageKeys } from 'data/usage/keys' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type TempDisableReadOnlyModeVariables = { projectRef: string @@ -25,7 +25,11 @@ export const useDisableReadOnlyModeMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + DisableReadOnlyModeData, + ResponseError, + TempDisableReadOnlyModeVariables + >, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/config/project-unpause-postgres-versions-query.ts b/apps/studio/data/config/project-unpause-postgres-versions-query.ts index 2b62e151fb3..9c9be3cef35 100644 --- a/apps/studio/data/config/project-unpause-postgres-versions-query.ts +++ b/apps/studio/data/config/project-unpause-postgres-versions-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { configKeys } from './keys' export type ProjectUnpausePostgresVersionsVariables = { @@ -33,7 +33,7 @@ export const useProjectUnpausePostgresVersionsQuery = = {} + }: UseCustomQueryOptions< + ProjectUpgradeEligibilityData, + ProjectUpgradeEligibilityError, + TData + > = {} ) => { const { data: project } = useProjectDetailQuery({ ref: projectRef }) return useQuery({ diff --git a/apps/studio/data/config/project-upgrade-status-query.ts b/apps/studio/data/config/project-upgrade-status-query.ts index 4489ced536f..a2eb8233f18 100644 --- a/apps/studio/data/config/project-upgrade-status-query.ts +++ b/apps/studio/data/config/project-upgrade-status-query.ts @@ -1,8 +1,9 @@ import { DatabaseUpgradeStatus } from '@supabase/shared-types/out/events' -import { useQuery, useQueryClient, UseQueryOptions } from '@tanstack/react-query' +import { useQuery, useQueryClient } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' import { PROJECT_STATUS } from 'lib/constants' import { configKeys } from './keys' +import { UseCustomQueryOptions } from 'types' export type ProjectUpgradingStatusVariables = { projectRef?: string @@ -38,7 +39,7 @@ export const useProjectUpgradingStatusQuery = = {} + }: UseCustomQueryOptions = {} ) => { const client = useQueryClient() diff --git a/apps/studio/data/content-api/docs-error-codes-query.ts b/apps/studio/data/content-api/docs-error-codes-query.ts index 58e10dc04bf..878c7beef26 100644 --- a/apps/studio/data/content-api/docs-error-codes-query.ts +++ b/apps/studio/data/content-api/docs-error-codes-query.ts @@ -1,8 +1,9 @@ -import { useQuery, type UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { executeGraphQL } from 'data/graphql/execute' import { graphql } from 'data/graphql/gql' import { Service } from 'data/graphql/graphql' import { contentApiKeys } from './keys' +import { UseCustomQueryOptions } from 'types' const ErrorCodeQuery = graphql(` query ErrorCodeQuery($code: String!, $service: Service) { @@ -33,7 +34,7 @@ export const useErrorCodesQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => { return useQuery({ queryKey: contentApiKeys.errorCodes(variables), diff --git a/apps/studio/data/content/content-count-query.ts b/apps/studio/data/content/content-count-query.ts index 8b4d6cea696..7ec39630cf9 100644 --- a/apps/studio/data/content/content-count-query.ts +++ b/apps/studio/data/content/content-count-query.ts @@ -1,8 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { operations } from 'api-types' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { contentKeys } from './keys' type GetContentCountVariables = @@ -37,7 +37,7 @@ export type ContentIdError = ResponseError export const useContentCountQuery = ( { projectRef, type, name }: GetContentCountVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: contentKeys.count(projectRef, type, { diff --git a/apps/studio/data/content/content-delete-mutation.ts b/apps/studio/data/content/content-delete-mutation.ts index c19b5ac9599..87406dddbfb 100644 --- a/apps/studio/data/content/content-delete-mutation.ts +++ b/apps/studio/data/content/content-delete-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { del, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { contentKeys } from './keys' type DeleteContentVariables = { projectRef: string; ids: string[] } @@ -31,7 +31,7 @@ export const useContentDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/content/content-id-query.ts b/apps/studio/data/content/content-id-query.ts index e9d79ec8f61..74c3c828827 100644 --- a/apps/studio/data/content/content-id-query.ts +++ b/apps/studio/data/content/content-id-query.ts @@ -1,8 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { components } from 'api-types' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import type { Content } from './content-query' import { contentKeys } from './keys' @@ -35,7 +35,7 @@ export type ContentIdError = ResponseError export const useContentIdQuery = ( { projectRef, id }: { projectRef?: string; id?: string }, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: contentKeys.resource(projectRef, id), diff --git a/apps/studio/data/content/content-infinite-query.ts b/apps/studio/data/content/content-infinite-query.ts index 169fb8a578b..87f8ff26df9 100644 --- a/apps/studio/data/content/content-infinite-query.ts +++ b/apps/studio/data/content/content-infinite-query.ts @@ -1,6 +1,7 @@ -import { useInfiniteQuery, UseInfiniteQueryOptions } from '@tanstack/react-query' +import { useInfiniteQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' +import { UseCustomInfiniteQueryOptions } from 'types' import { Content, ContentType } from './content-query' import { contentKeys } from './keys' @@ -48,7 +49,10 @@ export type ContentError = unknown export const useContentInfiniteQuery = ( { projectRef, type, name, limit, sort }: GetContentVariables, - { enabled = true, ...options }: UseInfiniteQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomInfiniteQueryOptions = {} ) => { return useInfiniteQuery({ queryKey: contentKeys.infiniteList(projectRef, { type, name, limit, sort }), diff --git a/apps/studio/data/content/content-insert-mutation.ts b/apps/studio/data/content/content-insert-mutation.ts index 31e32de6a45..fcf3c72ccac 100644 --- a/apps/studio/data/content/content-insert-mutation.ts +++ b/apps/studio/data/content/content-insert-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import type { components } from 'data/api' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import type { Content } from './content-query' import { contentKeys } from './keys' @@ -47,7 +47,7 @@ export const useContentInsertMutation = ({ onSuccess, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/content/content-query.ts b/apps/studio/data/content/content-query.ts index 5ca19b335b7..4ea548a0b60 100644 --- a/apps/studio/data/content/content-query.ts +++ b/apps/studio/data/content/content-query.ts @@ -1,8 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { components } from 'api-types' import { get, handleError } from 'data/fetchers' -import type { Dashboards, LogSqlSnippets, SqlSnippets } from 'types' +import type { Dashboards, LogSqlSnippets, SqlSnippets, UseCustomQueryOptions } from 'types' import { contentKeys } from './keys' export type ContentBase = components['schemas']['GetUserContentResponse']['data'][number] @@ -59,7 +59,7 @@ export type ContentError = unknown /** @deprecated Use useContentInfiniteQuery from content-infinite-query instead */ export const useContentQuery = ( { projectRef, type, name, limit }: GetContentVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: contentKeys.list(projectRef, { type, name, limit }), diff --git a/apps/studio/data/content/content-upsert-mutation.ts b/apps/studio/data/content/content-upsert-mutation.ts index 3676727c2dd..d57ea090dd0 100644 --- a/apps/studio/data/content/content-upsert-mutation.ts +++ b/apps/studio/data/content/content-upsert-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import type { components } from 'data/api' import { handleError, put } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import type { Content } from './content-query' import { contentKeys } from './keys' @@ -39,7 +39,7 @@ export const useContentUpsertMutation = ({ invalidateQueriesOnSuccess = true, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > & { invalidateQueriesOnSuccess?: boolean diff --git a/apps/studio/data/content/sql-folder-contents-query.ts b/apps/studio/data/content/sql-folder-contents-query.ts index 393844df459..e6eb557c539 100644 --- a/apps/studio/data/content/sql-folder-contents-query.ts +++ b/apps/studio/data/content/sql-folder-contents-query.ts @@ -1,7 +1,7 @@ -import { useInfiniteQuery, UseInfiniteQueryOptions } from '@tanstack/react-query' +import { useInfiniteQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomInfiniteQueryOptions } from 'types' import { contentKeys } from './keys' import { SNIPPET_PAGE_LIMIT } from './sql-folders-query' @@ -51,7 +51,7 @@ export const useSQLSnippetFolderContentsQuery = , + UseCustomMutationOptions< + CreateSQLSnippetFolderData, + ResponseError, + CreateSQLSnippetFolderVariables + >, 'mutationFn' > & { invalidateQueriesOnSuccess?: boolean diff --git a/apps/studio/data/content/sql-folder-update-mutation.ts b/apps/studio/data/content/sql-folder-update-mutation.ts index 4225a2ed9d2..cef8792a03c 100644 --- a/apps/studio/data/content/sql-folder-update-mutation.ts +++ b/apps/studio/data/content/sql-folder-update-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, patch } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { contentKeys } from './keys' export type UpdateSQLSnippetFolderVariables = { @@ -37,7 +37,11 @@ export const useSQLSnippetFolderCreateMutation = ({ invalidateQueriesOnSuccess = true, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + UpdateSQLSnippetFolderData, + ResponseError, + UpdateSQLSnippetFolderVariables + >, 'mutationFn' > & { invalidateQueriesOnSuccess?: boolean diff --git a/apps/studio/data/content/sql-folders-delete-mutation.ts b/apps/studio/data/content/sql-folders-delete-mutation.ts index cee6f915e0e..5b3ff5f5c73 100644 --- a/apps/studio/data/content/sql-folders-delete-mutation.ts +++ b/apps/studio/data/content/sql-folders-delete-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { del, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { contentKeys } from './keys' export type DeleteSQLSnippetFoldersVariables = { @@ -32,7 +32,11 @@ export const useSQLSnippetFoldersDeleteMutation = ({ invalidateQueriesOnSuccess = true, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + DeleteSQLSnippetFoldersData, + ResponseError, + DeleteSQLSnippetFoldersVariables + >, 'mutationFn' > & { invalidateQueriesOnSuccess?: boolean diff --git a/apps/studio/data/content/sql-folders-query.ts b/apps/studio/data/content/sql-folders-query.ts index 54749e47d87..e0abb4932c4 100644 --- a/apps/studio/data/content/sql-folders-query.ts +++ b/apps/studio/data/content/sql-folders-query.ts @@ -1,8 +1,8 @@ -import { useInfiniteQuery, UseInfiniteQueryOptions } from '@tanstack/react-query' +import { useInfiniteQuery } from '@tanstack/react-query' import { components } from 'api-types' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomInfiniteQueryOptions } from 'types' import { contentKeys } from './keys' export type SnippetFolderResponse = components['schemas']['GetUserContentFolderResponse']['data'] @@ -60,7 +60,7 @@ export const useSQLSnippetFoldersQuery = ( { enabled = true, ...options - }: UseInfiniteQueryOptions = {} + }: UseCustomInfiniteQueryOptions = {} ) => useInfiniteQuery({ queryKey: contentKeys.folders(projectRef, { name, sort }), diff --git a/apps/studio/data/content/sql-snippets-query.ts b/apps/studio/data/content/sql-snippets-query.ts index d2ea729c5e0..3c941176ac7 100644 --- a/apps/studio/data/content/sql-snippets-query.ts +++ b/apps/studio/data/content/sql-snippets-query.ts @@ -1,6 +1,7 @@ -import { useInfiniteQuery, UseInfiniteQueryOptions } from '@tanstack/react-query' +import { useInfiniteQuery } from '@tanstack/react-query' import { get } from 'data/fetchers' +import { UseCustomInfiniteQueryOptions } from 'types' import { Content } from './content-query' import { contentKeys } from './keys' import { SNIPPET_PAGE_LIMIT } from './sql-folders-query' @@ -61,7 +62,7 @@ export const useSqlSnippetsQuery = ( { enabled = true, ...options - }: UseInfiniteQueryOptions = {} + }: UseCustomInfiniteQueryOptions = {} ) => useInfiniteQuery({ queryKey: contentKeys.sqlSnippets(projectRef, { sort, name, visibility, favorite }), diff --git a/apps/studio/data/custom-domains/check-cname-mutation.ts b/apps/studio/data/custom-domains/check-cname-mutation.ts index a85afaf0659..c7bfe741ce0 100644 --- a/apps/studio/data/custom-domains/check-cname-mutation.ts +++ b/apps/studio/data/custom-domains/check-cname-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { fetchHandler, handleError } from 'data/fetchers' import { BASE_PATH } from 'lib/constants' import { toast } from 'sonner' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type CheckCNAMERecordVariables = { domain: string @@ -47,7 +47,7 @@ export const useCheckCNAMERecordMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/custom-domains/custom-domains-activate-mutation.ts b/apps/studio/data/custom-domains/custom-domains-activate-mutation.ts index e49c8845ccd..f6b49ef7fd1 100644 --- a/apps/studio/data/custom-domains/custom-domains-activate-mutation.ts +++ b/apps/studio/data/custom-domains/custom-domains-activate-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { customDomainKeys } from './keys' export type CustomDomainActivateVariables = { @@ -25,7 +25,7 @@ export const useCustomDomainActivateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/custom-domains/custom-domains-create-mutation.ts b/apps/studio/data/custom-domains/custom-domains-create-mutation.ts index 6c0f7c69632..e70d671d9ca 100644 --- a/apps/studio/data/custom-domains/custom-domains-create-mutation.ts +++ b/apps/studio/data/custom-domains/custom-domains-create-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { customDomainKeys } from './keys' export type CustomDomainCreateVariables = { @@ -30,7 +30,7 @@ export const useCustomDomainCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/custom-domains/custom-domains-delete-mutation.ts b/apps/studio/data/custom-domains/custom-domains-delete-mutation.ts index 8a28cb320a3..8ec84dd46af 100644 --- a/apps/studio/data/custom-domains/custom-domains-delete-mutation.ts +++ b/apps/studio/data/custom-domains/custom-domains-delete-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { del, handleError } from 'data/fetchers' import { subscriptionKeys } from 'data/subscriptions/keys' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { customDomainKeys } from './keys' export type CustomDomainDeleteVariables = { @@ -28,7 +28,7 @@ export const useCustomDomainDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/custom-domains/custom-domains-query.ts b/apps/studio/data/custom-domains/custom-domains-query.ts index 8f9e757c280..db502694a7a 100644 --- a/apps/studio/data/custom-domains/custom-domains-query.ts +++ b/apps/studio/data/custom-domains/custom-domains-query.ts @@ -1,9 +1,9 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' import { useProjectAddonsQuery } from 'data/subscriptions/project-addons-query' import { IS_PLATFORM } from 'lib/constants' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { customDomainKeys } from './keys' export type CustomDomainsVariables = { @@ -105,7 +105,10 @@ export type CustomDomainsError = ResponseError export const useCustomDomainsQuery = ( { projectRef }: CustomDomainsVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => { const { data } = useProjectAddonsQuery({ projectRef }) const hasCustomDomainsAddon = !!data?.selected_addons.find((x) => x.type === 'custom_domain') diff --git a/apps/studio/data/custom-domains/custom-domains-reverify-mutation.ts b/apps/studio/data/custom-domains/custom-domains-reverify-mutation.ts index 3ed924f6e15..6e0ccce0602 100644 --- a/apps/studio/data/custom-domains/custom-domains-reverify-mutation.ts +++ b/apps/studio/data/custom-domains/custom-domains-reverify-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { customDomainKeys } from './keys' export type CustomDomainReverifyVariables = { @@ -25,7 +25,7 @@ export const useCustomDomainReverifyMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/database-columns/database-column-create-mutation.ts b/apps/studio/data/database-columns/database-column-create-mutation.ts index 19ee9b2ab7d..f19f64bec26 100644 --- a/apps/studio/data/database-columns/database-column-create-mutation.ts +++ b/apps/studio/data/database-columns/database-column-create-mutation.ts @@ -1,9 +1,9 @@ import pgMeta from '@supabase/pg-meta' -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type CreateColumnBody = { schema: string @@ -65,7 +65,7 @@ export const useDatabaseColumnCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/database-columns/database-column-delete-mutation.ts b/apps/studio/data/database-columns/database-column-delete-mutation.ts index 1bae6d88ae8..d37fc390f5b 100644 --- a/apps/studio/data/database-columns/database-column-delete-mutation.ts +++ b/apps/studio/data/database-columns/database-column-delete-mutation.ts @@ -1,6 +1,6 @@ import pgMeta from '@supabase/pg-meta' import { PGColumn } from '@supabase/pg-meta/src/pg-meta-columns' -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { databaseKeys } from 'data/database/keys' @@ -9,7 +9,7 @@ import { executeSql } from 'data/sql/execute-sql-query' import { tableEditorKeys } from 'data/table-editor/keys' import { tableRowKeys } from 'data/table-rows/keys' import { viewKeys } from 'data/views/keys' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type DatabaseColumnDeleteVariables = { projectRef: string @@ -43,7 +43,7 @@ export const useDatabaseColumnDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/database-columns/database-column-update-mutation.ts b/apps/studio/data/database-columns/database-column-update-mutation.ts index 8958473ed60..58eafce8968 100644 --- a/apps/studio/data/database-columns/database-column-update-mutation.ts +++ b/apps/studio/data/database-columns/database-column-update-mutation.ts @@ -1,10 +1,10 @@ import pgMeta from '@supabase/pg-meta' import { PGColumn } from '@supabase/pg-meta/src/pg-meta-columns' -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { CreateColumnBody } from './database-column-create-mutation' export type UpdateColumnBody = Partial< @@ -67,7 +67,7 @@ export const useDatabaseColumnUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/database-cron-jobs/database-cron-job-query.ts b/apps/studio/data/database-cron-jobs/database-cron-job-query.ts index 3f35b350671..237b038e82d 100644 --- a/apps/studio/data/database-cron-jobs/database-cron-job-query.ts +++ b/apps/studio/data/database-cron-jobs/database-cron-job-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { CronJob } from './database-cron-jobs-infinite-query' import { databaseCronJobsKeys } from './keys' @@ -40,7 +40,7 @@ export const useCronJobQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: databaseCronJobsKeys.job(projectRef, id ?? name), diff --git a/apps/studio/data/database-cron-jobs/database-cron-job-run-mutation.ts b/apps/studio/data/database-cron-jobs/database-cron-job-run-mutation.ts index c4d416dde14..9f5491954b6 100644 --- a/apps/studio/data/database-cron-jobs/database-cron-job-run-mutation.ts +++ b/apps/studio/data/database-cron-jobs/database-cron-job-run-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { databaseCronJobsKeys } from './keys' export type DatabaseCronJobRunVariables = { @@ -44,7 +44,7 @@ export const useDatabaseCronJobRunCommandMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/database-cron-jobs/database-cron-jobs-count-query.ts b/apps/studio/data/database-cron-jobs/database-cron-jobs-count-query.ts index db44923c27b..86f9f4d08cb 100644 --- a/apps/studio/data/database-cron-jobs/database-cron-jobs-count-query.ts +++ b/apps/studio/data/database-cron-jobs/database-cron-jobs-count-query.ts @@ -1,6 +1,6 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { databaseCronJobsKeys } from './keys' type DatabaseCronJobsCountVariables = { @@ -33,7 +33,7 @@ export const useCronJobsCountQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: databaseCronJobsKeys.count(projectRef), diff --git a/apps/studio/data/database-cron-jobs/database-cron-jobs-create-mutation.ts b/apps/studio/data/database-cron-jobs/database-cron-jobs-create-mutation.ts index c191b486090..04d31d6a67f 100644 --- a/apps/studio/data/database-cron-jobs/database-cron-jobs-create-mutation.ts +++ b/apps/studio/data/database-cron-jobs/database-cron-jobs-create-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { databaseCronJobsKeys } from './keys' export type DatabaseCronJobCreateVariables = { @@ -35,7 +35,11 @@ export const useDatabaseCronJobCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + DatabaseCronJobCreateData, + ResponseError, + DatabaseCronJobCreateVariables + >, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/database-cron-jobs/database-cron-jobs-delete-mutation.ts b/apps/studio/data/database-cron-jobs/database-cron-jobs-delete-mutation.ts index 216984f1430..43f3e8891f3 100644 --- a/apps/studio/data/database-cron-jobs/database-cron-jobs-delete-mutation.ts +++ b/apps/studio/data/database-cron-jobs/database-cron-jobs-delete-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { databaseCronJobsKeys } from './keys' export type DatabaseCronJobDeleteVariables = { @@ -34,7 +34,11 @@ export const useDatabaseCronJobDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + DatabaseCronJobDeleteData, + ResponseError, + DatabaseCronJobDeleteVariables + >, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/database-cron-jobs/database-cron-jobs-infinite-query.ts b/apps/studio/data/database-cron-jobs/database-cron-jobs-infinite-query.ts index 81cf7242b3e..bb0e0173438 100644 --- a/apps/studio/data/database-cron-jobs/database-cron-jobs-infinite-query.ts +++ b/apps/studio/data/database-cron-jobs/database-cron-jobs-infinite-query.ts @@ -1,7 +1,7 @@ -import { UseInfiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query' +import { useInfiniteQuery } from '@tanstack/react-query' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomInfiniteQueryOptions } from 'types' import { databaseCronJobsKeys } from './keys' const CRON_JOBS_PAGE_LIMIT = 20 @@ -87,7 +87,7 @@ export const useCronJobsInfiniteQuery = ( { enabled = true, ...options - }: UseInfiniteQueryOptions< + }: UseCustomInfiniteQueryOptions< DatabaseCronJobsInfiniteData, DatabaseCronJobsInfiniteError, TData diff --git a/apps/studio/data/database-cron-jobs/database-cron-jobs-runs-infinite-query.ts b/apps/studio/data/database-cron-jobs/database-cron-jobs-runs-infinite-query.ts index 57e859e2129..cfe071f6106 100644 --- a/apps/studio/data/database-cron-jobs/database-cron-jobs-runs-infinite-query.ts +++ b/apps/studio/data/database-cron-jobs/database-cron-jobs-runs-infinite-query.ts @@ -1,8 +1,8 @@ -import { UseInfiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query' +import { useInfiniteQuery } from '@tanstack/react-query' import { last } from 'lodash' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomInfiniteQueryOptions } from 'types' import { databaseCronJobsKeys } from './keys' export type DatabaseCronJobRunsVariables = { @@ -59,7 +59,7 @@ export const useCronJobRunsInfiniteQuery = ( { enabled = true, ...options - }: UseInfiniteQueryOptions = {} + }: UseCustomInfiniteQueryOptions = {} ) => useInfiniteQuery({ queryKey: databaseCronJobsKeys.runsInfinite(projectRef, jobId, { status }), diff --git a/apps/studio/data/database-cron-jobs/database-cron-jobs-toggle-mutation.ts b/apps/studio/data/database-cron-jobs/database-cron-jobs-toggle-mutation.ts index 54eba75d8f8..b3884d9853f 100644 --- a/apps/studio/data/database-cron-jobs/database-cron-jobs-toggle-mutation.ts +++ b/apps/studio/data/database-cron-jobs/database-cron-jobs-toggle-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { databaseCronJobsKeys } from './keys' export type DatabaseCronJobToggleVariables = { @@ -36,7 +36,11 @@ export const useDatabaseCronJobToggleMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + DatabaseCronJobToggleData, + ResponseError, + DatabaseCronJobToggleVariables + >, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/database-cron-jobs/database-cron-timezone-query.ts b/apps/studio/data/database-cron-jobs/database-cron-timezone-query.ts index 1ef2e3a99e8..a2da99eacc1 100644 --- a/apps/studio/data/database-cron-jobs/database-cron-timezone-query.ts +++ b/apps/studio/data/database-cron-jobs/database-cron-timezone-query.ts @@ -1,6 +1,6 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { databaseCronJobsKeys } from './keys' export type DatabaseCronJobsVariables = { @@ -26,7 +26,7 @@ export type DatabaseCronJobError = ResponseError export const useCronTimezoneQuery = ( { projectRef, connectionString }: DatabaseCronJobsVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: databaseCronJobsKeys.timezone(projectRef), diff --git a/apps/studio/data/database-extensions/database-extension-disable-mutation.ts b/apps/studio/data/database-extensions/database-extension-disable-mutation.ts index db703e7d587..0482da165be 100644 --- a/apps/studio/data/database-extensions/database-extension-disable-mutation.ts +++ b/apps/studio/data/database-extensions/database-extension-disable-mutation.ts @@ -1,10 +1,10 @@ import pgMeta from '@supabase/pg-meta' -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { configKeys } from 'data/config/keys' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { databaseExtensionsKeys } from './keys' export type DatabaseExtensionDisableVariables = { @@ -41,7 +41,7 @@ export const useDatabaseExtensionDisableMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< DatabaseExtensionDisableData, ResponseError, DatabaseExtensionDisableVariables diff --git a/apps/studio/data/database-extensions/database-extension-enable-mutation.ts b/apps/studio/data/database-extensions/database-extension-enable-mutation.ts index fc993017bf2..256d916aaf3 100644 --- a/apps/studio/data/database-extensions/database-extension-enable-mutation.ts +++ b/apps/studio/data/database-extensions/database-extension-enable-mutation.ts @@ -1,11 +1,11 @@ import pgMeta from '@supabase/pg-meta' import { ident } from '@supabase/pg-meta/src/pg-format' -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { configKeys } from 'data/config/keys' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { databaseExtensionsKeys } from './keys' export type DatabaseExtensionEnableVariables = { @@ -48,7 +48,11 @@ export const useDatabaseExtensionEnableMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + DatabaseExtensionEnableData, + ResponseError, + DatabaseExtensionEnableVariables + >, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/database-extensions/database-extensions-query.ts b/apps/studio/data/database-extensions/database-extensions-query.ts index 0d4ee6abbd6..0c6f7388d8c 100644 --- a/apps/studio/data/database-extensions/database-extensions-query.ts +++ b/apps/studio/data/database-extensions/database-extensions-query.ts @@ -1,10 +1,10 @@ import { DEFAULT_PLATFORM_APPLICATION_NAME } from '@supabase/pg-meta/src/constants' -import { UseQueryOptions, useQuery } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { components } from 'api-types' import { get, handleError } from 'data/fetchers' import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject' import { PROJECT_STATUS } from 'lib/constants' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { databaseExtensionsKeys } from './keys' export type DatabaseExtension = components['schemas']['PostgresExtension'] @@ -50,7 +50,7 @@ export const useDatabaseExtensionsQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => { const { data: project } = useSelectedProjectQuery() const isActive = project?.status === PROJECT_STATUS.ACTIVE_HEALTHY diff --git a/apps/studio/data/database-functions/database-functions-create-mutation.ts b/apps/studio/data/database-functions/database-functions-create-mutation.ts index c399935c6ce..06fc71cda19 100644 --- a/apps/studio/data/database-functions/database-functions-create-mutation.ts +++ b/apps/studio/data/database-functions/database-functions-create-mutation.ts @@ -1,11 +1,11 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { z } from 'zod' import pgMeta from '@supabase/pg-meta' import { databaseKeys } from 'data/database/keys' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type DatabaseFunctionCreateVariables = { projectRef: string @@ -37,7 +37,11 @@ export const useDatabaseFunctionCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + DatabaseFunctionCreateData, + ResponseError, + DatabaseFunctionCreateVariables + >, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/database-functions/database-functions-delete-mutation.ts b/apps/studio/data/database-functions/database-functions-delete-mutation.ts index 2d81c973562..195a38b2a27 100644 --- a/apps/studio/data/database-functions/database-functions-delete-mutation.ts +++ b/apps/studio/data/database-functions/database-functions-delete-mutation.ts @@ -1,11 +1,11 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { z } from 'zod' import pgMeta from '@supabase/pg-meta' import { databaseKeys } from 'data/database/keys' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { DatabaseFunction } from './database-functions-query' export type DatabaseFunctionDeleteVariables = { @@ -38,7 +38,11 @@ export const useDatabaseFunctionDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + DatabaseFunctionDeleteData, + ResponseError, + DatabaseFunctionDeleteVariables + >, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/database-functions/database-functions-query.ts b/apps/studio/data/database-functions/database-functions-query.ts index 5d8cec8a448..ea68e83fe6f 100644 --- a/apps/studio/data/database-functions/database-functions-query.ts +++ b/apps/studio/data/database-functions/database-functions-query.ts @@ -1,8 +1,8 @@ import pgMeta from '@supabase/pg-meta' -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { databaseKeys } from 'data/database/keys' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { z } from 'zod' export type DatabaseFunctionsVariables = { @@ -43,7 +43,7 @@ export const useDatabaseFunctionsQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: databaseKeys.databaseFunctions(projectRef), diff --git a/apps/studio/data/database-functions/database-functions-update-mutation.ts b/apps/studio/data/database-functions/database-functions-update-mutation.ts index e8b539f1153..a81c1415a4f 100644 --- a/apps/studio/data/database-functions/database-functions-update-mutation.ts +++ b/apps/studio/data/database-functions/database-functions-update-mutation.ts @@ -1,11 +1,11 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { z } from 'zod' import pgMeta from '@supabase/pg-meta' import { databaseKeys } from 'data/database/keys' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import type { DatabaseFunction } from './database-functions-query' export type DatabaseFunctionUpdateVariables = { @@ -40,7 +40,11 @@ export const useDatabaseFunctionUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + DatabaseFunctionUpdateData, + ResponseError, + DatabaseFunctionUpdateVariables + >, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/database-indexes/index-create-mutation.ts b/apps/studio/data/database-indexes/index-create-mutation.ts index 7dc32ef126d..e9159ceaaec 100644 --- a/apps/studio/data/database-indexes/index-create-mutation.ts +++ b/apps/studio/data/database-indexes/index-create-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { databaseIndexesKeys } from './keys' export type DatabaseIndexCreateVariables = { @@ -46,7 +46,7 @@ export const useDatabaseIndexCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/database-indexes/index-delete-mutation.ts b/apps/studio/data/database-indexes/index-delete-mutation.ts index d4f5deea373..989045ffe2a 100644 --- a/apps/studio/data/database-indexes/index-delete-mutation.ts +++ b/apps/studio/data/database-indexes/index-delete-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { databaseIndexesKeys } from './keys' export type DatabaseIndexDeleteVariables = { @@ -37,7 +37,7 @@ export const useDatabaseIndexDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/database-indexes/indexes-query.ts b/apps/studio/data/database-indexes/indexes-query.ts index 63c46d52af9..924082e501c 100644 --- a/apps/studio/data/database-indexes/indexes-query.ts +++ b/apps/studio/data/database-indexes/indexes-query.ts @@ -1,6 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { executeSql, ExecuteSqlError } from '../sql/execute-sql-query' import { databaseIndexesKeys } from './keys' +import { UseCustomQueryOptions } from 'types' type GetIndexesArgs = { schema?: string @@ -55,7 +56,7 @@ export type IndexesError = ExecuteSqlError export const useIndexesQuery = ( { projectRef, connectionString, schema }: IndexesVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: databaseIndexesKeys.list(projectRef, schema), diff --git a/apps/studio/data/database-policies/database-policies-query.ts b/apps/studio/data/database-policies/database-policies-query.ts index 86112fc583d..d635f4fa131 100644 --- a/apps/studio/data/database-policies/database-policies-query.ts +++ b/apps/studio/data/database-policies/database-policies-query.ts @@ -1,10 +1,10 @@ -import { UseQueryOptions, useQuery } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { DEFAULT_PLATFORM_APPLICATION_NAME } from '@supabase/pg-meta/src/constants' import { get, handleError } from 'data/fetchers' import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject' import { PROJECT_STATUS } from 'lib/constants' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { databasePoliciesKeys } from './keys' export type DatabasePoliciesVariables = { @@ -51,7 +51,7 @@ export const useDatabasePoliciesQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => { const { data: project } = useSelectedProjectQuery() const isActive = project?.status === PROJECT_STATUS.ACTIVE_HEALTHY diff --git a/apps/studio/data/database-policies/database-policy-create-mutation.ts b/apps/studio/data/database-policies/database-policy-create-mutation.ts index 8fdc5ccb5a5..b1012f086e1 100644 --- a/apps/studio/data/database-policies/database-policy-create-mutation.ts +++ b/apps/studio/data/database-policies/database-policy-create-mutation.ts @@ -1,9 +1,9 @@ import pgMeta from '@supabase/pg-meta' -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { databasePoliciesKeys } from './keys' type CreatePolicyBody = { @@ -49,7 +49,7 @@ export const useDatabasePolicyCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/database-policies/database-policy-delete-mutation.ts b/apps/studio/data/database-policies/database-policy-delete-mutation.ts index a53ef642a4a..c91a016e836 100644 --- a/apps/studio/data/database-policies/database-policy-delete-mutation.ts +++ b/apps/studio/data/database-policies/database-policy-delete-mutation.ts @@ -1,9 +1,9 @@ import pgMeta from '@supabase/pg-meta' -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { databasePoliciesKeys } from './keys' export type DatabasePolicyDeleteVariables = { @@ -43,7 +43,7 @@ export const useDatabasePolicyDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/database-policies/database-policy-update-mutation.ts b/apps/studio/data/database-policies/database-policy-update-mutation.ts index 33c2e10ab90..790edef1843 100644 --- a/apps/studio/data/database-policies/database-policy-update-mutation.ts +++ b/apps/studio/data/database-policies/database-policy-update-mutation.ts @@ -1,9 +1,9 @@ import pgMeta from '@supabase/pg-meta' -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { databasePoliciesKeys } from './keys' export type DatabasePolicyUpdateVariables = { @@ -50,7 +50,7 @@ export const useDatabasePolicyUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/database-publications/database-publications-create-mutation.ts b/apps/studio/data/database-publications/database-publications-create-mutation.ts index e4579a3b711..9ec3b901272 100644 --- a/apps/studio/data/database-publications/database-publications-create-mutation.ts +++ b/apps/studio/data/database-publications/database-publications-create-mutation.ts @@ -1,9 +1,9 @@ import pgMeta from '@supabase/pg-meta' -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { databasePublicationsKeys } from './keys' export type DatabasePublicationCreateVariables = { @@ -53,7 +53,7 @@ export const useDatabasePublicationCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< DatabasePublicationCreateData, ResponseError, DatabasePublicationCreateVariables diff --git a/apps/studio/data/database-publications/database-publications-query.ts b/apps/studio/data/database-publications/database-publications-query.ts index 0d889ebab98..cb30108dc87 100644 --- a/apps/studio/data/database-publications/database-publications-query.ts +++ b/apps/studio/data/database-publications/database-publications-query.ts @@ -1,8 +1,8 @@ -import { UseQueryOptions, useQuery } from '@tanstack/react-query' -import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' -import { databasePublicationsKeys } from './keys' import { DEFAULT_PLATFORM_APPLICATION_NAME } from '@supabase/pg-meta/src/constants' +import { useQuery } from '@tanstack/react-query' +import { get, handleError } from 'data/fetchers' +import type { ResponseError, UseCustomQueryOptions } from 'types' +import { databasePublicationsKeys } from './keys' export type DatabasePublicationsVariables = { projectRef?: string @@ -44,7 +44,7 @@ export const useDatabasePublicationsQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: databasePublicationsKeys.list(projectRef), diff --git a/apps/studio/data/database-publications/database-publications-update-mutation.ts b/apps/studio/data/database-publications/database-publications-update-mutation.ts index f4056d465f3..86d32c2a73e 100644 --- a/apps/studio/data/database-publications/database-publications-update-mutation.ts +++ b/apps/studio/data/database-publications/database-publications-update-mutation.ts @@ -1,9 +1,9 @@ import pgMeta from '@supabase/pg-meta' -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { databasePublicationsKeys } from './keys' export type DatabasePublicationUpdateVariables = { @@ -52,7 +52,7 @@ export const useDatabasePublicationUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< DatabasePublicationUpdateData, ResponseError, DatabasePublicationUpdateVariables diff --git a/apps/studio/data/database-queues/database-queue-messages-archive-mutation.ts b/apps/studio/data/database-queues/database-queue-messages-archive-mutation.ts index ea21e8994a8..5a0ea9600d0 100644 --- a/apps/studio/data/database-queues/database-queue-messages-archive-mutation.ts +++ b/apps/studio/data/database-queues/database-queue-messages-archive-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { databaseQueuesKeys } from './keys' export type DatabaseQueueMessageArchiveVariables = { @@ -35,7 +35,7 @@ export const useDatabaseQueueMessageArchiveMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< DatabaseQueueMessageArchiveData, ResponseError, DatabaseQueueMessageArchiveVariables diff --git a/apps/studio/data/database-queues/database-queue-messages-delete-mutation.ts b/apps/studio/data/database-queues/database-queue-messages-delete-mutation.ts index 4aa186bdab8..4c84f5217c7 100644 --- a/apps/studio/data/database-queues/database-queue-messages-delete-mutation.ts +++ b/apps/studio/data/database-queues/database-queue-messages-delete-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { databaseQueuesKeys } from './keys' export type DatabaseQueueMessageDeleteVariables = { @@ -35,7 +35,7 @@ export const useDatabaseQueueMessageDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< DatabaseQueueMessageDeleteData, ResponseError, DatabaseQueueMessageDeleteVariables diff --git a/apps/studio/data/database-queues/database-queue-messages-infinite-query.ts b/apps/studio/data/database-queues/database-queue-messages-infinite-query.ts index e43456a8976..caeb64a897e 100644 --- a/apps/studio/data/database-queues/database-queue-messages-infinite-query.ts +++ b/apps/studio/data/database-queues/database-queue-messages-infinite-query.ts @@ -1,11 +1,11 @@ -import { UseInfiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query' +import { useInfiniteQuery } from '@tanstack/react-query' import dayjs from 'dayjs' import { last } from 'lodash' import { QUEUE_MESSAGE_TYPE } from 'components/interfaces/Integrations/Queues/SingleQueue/Queue.utils' import { executeSql } from 'data/sql/execute-sql-query' import { DATE_FORMAT } from 'lib/constants' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomInfiniteQueryOptions } from 'types' import { databaseQueuesKeys } from './keys' export type DatabaseQueueVariables = { @@ -80,7 +80,7 @@ export const useQueueMessagesInfiniteQuery = ( { enabled = true, ...options - }: UseInfiniteQueryOptions = {} + }: UseCustomInfiniteQueryOptions = {} ) => useInfiniteQuery({ queryKey: databaseQueuesKeys.getMessagesInfinite(projectRef, queueName, { status }), diff --git a/apps/studio/data/database-queues/database-queue-messages-read-mutation.ts b/apps/studio/data/database-queues/database-queue-messages-read-mutation.ts index b5ba4a1d504..0ee46d7e5d8 100644 --- a/apps/studio/data/database-queues/database-queue-messages-read-mutation.ts +++ b/apps/studio/data/database-queues/database-queue-messages-read-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { databaseQueuesKeys } from './keys' export type DatabaseQueueMessageReadVariables = { @@ -37,7 +37,7 @@ export const useDatabaseQueueMessageReadMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< DatabaseQueueMessageReadData, ResponseError, DatabaseQueueMessageReadVariables diff --git a/apps/studio/data/database-queues/database-queue-messages-send-mutation.ts b/apps/studio/data/database-queues/database-queue-messages-send-mutation.ts index de5553dfcd6..51ae5b62191 100644 --- a/apps/studio/data/database-queues/database-queue-messages-send-mutation.ts +++ b/apps/studio/data/database-queues/database-queue-messages-send-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { databaseQueuesKeys } from './keys' export type DatabaseQueueMessageSendVariables = { @@ -37,7 +37,7 @@ export const useDatabaseQueueMessageSendMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< DatabaseQueueMessageSendData, ResponseError, DatabaseQueueMessageSendVariables diff --git a/apps/studio/data/database-queues/database-queues-create-mutation.ts b/apps/studio/data/database-queues/database-queues-create-mutation.ts index 4ba580918c7..4a6f2adbe38 100644 --- a/apps/studio/data/database-queues/database-queues-create-mutation.ts +++ b/apps/studio/data/database-queues/database-queues-create-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { executeSql } from 'data/sql/execute-sql-query' import { tableKeys } from 'data/tables/keys' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { databaseQueuesKeys } from './keys' export type DatabaseQueueCreateVariables = { @@ -52,7 +52,7 @@ export const useDatabaseQueueCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/database-queues/database-queues-delete-mutation.ts b/apps/studio/data/database-queues/database-queues-delete-mutation.ts index 23b035aeef2..c619b5cc7ae 100644 --- a/apps/studio/data/database-queues/database-queues-delete-mutation.ts +++ b/apps/studio/data/database-queues/database-queues-delete-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { databaseQueuesKeys } from './keys' export type DatabaseQueueDeleteVariables = { @@ -33,7 +33,7 @@ export const useDatabaseQueueDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/database-queues/database-queues-expose-postgrest-status-query.ts b/apps/studio/data/database-queues/database-queues-expose-postgrest-status-query.ts index d1672bd60be..56515efef60 100644 --- a/apps/studio/data/database-queues/database-queues-expose-postgrest-status-query.ts +++ b/apps/studio/data/database-queues/database-queues-expose-postgrest-status-query.ts @@ -1,8 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import minify from 'pg-minify' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { QUEUES_SCHEMA } from './database-queues-toggle-postgrest-mutation' import { databaseQueuesKeys } from './keys' @@ -35,7 +35,10 @@ export type DatabaseQueueError = ResponseError export const useQueuesExposePostgrestStatusQuery = ( { projectRef, connectionString }: DatabaseQueuesVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: databaseQueuesKeys.exposePostgrestStatus(projectRef), diff --git a/apps/studio/data/database-queues/database-queues-metrics-query.ts b/apps/studio/data/database-queues/database-queues-metrics-query.ts index 681e86108cc..03ad301e5c5 100644 --- a/apps/studio/data/database-queues/database-queues-metrics-query.ts +++ b/apps/studio/data/database-queues/database-queues-metrics-query.ts @@ -1,6 +1,6 @@ -import { UseQueryOptions, useQuery } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { databaseQueuesKeys } from './keys' export type DatabaseQueuesMetricsVariables = { @@ -77,7 +77,7 @@ export const useQueuesMetricsQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: databaseQueuesKeys.metrics(projectRef, queueName), diff --git a/apps/studio/data/database-queues/database-queues-purge-mutation.ts b/apps/studio/data/database-queues/database-queues-purge-mutation.ts index 6e084223c25..af2a8fd1ce4 100644 --- a/apps/studio/data/database-queues/database-queues-purge-mutation.ts +++ b/apps/studio/data/database-queues/database-queues-purge-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { databaseQueuesKeys } from './keys' export type DatabaseQueuePurgeVariables = { @@ -33,7 +33,7 @@ export const useDatabaseQueuePurgeMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/database-queues/database-queues-query.ts b/apps/studio/data/database-queues/database-queues-query.ts index c86f33e5c54..80667fd5778 100644 --- a/apps/studio/data/database-queues/database-queues-query.ts +++ b/apps/studio/data/database-queues/database-queues-query.ts @@ -1,6 +1,6 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { databaseQueuesKeys } from './keys' export type DatabaseQueuesVariables = { @@ -33,7 +33,10 @@ export type DatabaseQueueError = ResponseError export const useQueuesQuery = ( { projectRef, connectionString }: DatabaseQueuesVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: databaseQueuesKeys.list(projectRef), diff --git a/apps/studio/data/database-queues/database-queues-toggle-postgrest-mutation.ts b/apps/studio/data/database-queues/database-queues-toggle-postgrest-mutation.ts index 02567e13c47..bd637945550 100644 --- a/apps/studio/data/database-queues/database-queues-toggle-postgrest-mutation.ts +++ b/apps/studio/data/database-queues/database-queues-toggle-postgrest-mutation.ts @@ -1,11 +1,11 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import minify from 'pg-minify' import { toast } from 'sonner' import { databaseKeys } from 'data/database/keys' import { executeSql } from 'data/sql/execute-sql-query' import { isGreaterThanOrEqual } from 'lib/semver' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { databaseQueuesKeys } from './keys' export type DatabaseQueueExposePostgrestVariables = { @@ -258,7 +258,7 @@ export const useDatabaseQueueToggleExposeMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< DatabaseQueueExposePostgrestData, ResponseError, DatabaseQueueExposePostgrestVariables diff --git a/apps/studio/data/database-roles/database-role-create-mutation.ts b/apps/studio/data/database-roles/database-role-create-mutation.ts index 2b45a6674ac..16dc76ccb48 100644 --- a/apps/studio/data/database-roles/database-role-create-mutation.ts +++ b/apps/studio/data/database-roles/database-role-create-mutation.ts @@ -1,9 +1,9 @@ import pgMeta from '@supabase/pg-meta' -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { invalidateRolesQuery } from './database-roles-query' type CreateRoleBody = Parameters[0] @@ -36,7 +36,7 @@ export const useDatabaseRoleCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/database-roles/database-role-delete-mutation.ts b/apps/studio/data/database-roles/database-role-delete-mutation.ts index 2dbc00f29be..7fde28eb9e2 100644 --- a/apps/studio/data/database-roles/database-role-delete-mutation.ts +++ b/apps/studio/data/database-roles/database-role-delete-mutation.ts @@ -1,9 +1,9 @@ import pgMeta from '@supabase/pg-meta' -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { invalidateRolesQuery } from './database-roles-query' type DropRoleBody = Parameters[1] @@ -38,7 +38,7 @@ export const useDatabaseRoleDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/database-roles/database-role-update-mutation.ts b/apps/studio/data/database-roles/database-role-update-mutation.ts index a3cadbd917f..75108b95433 100644 --- a/apps/studio/data/database-roles/database-role-update-mutation.ts +++ b/apps/studio/data/database-roles/database-role-update-mutation.ts @@ -1,9 +1,9 @@ import pgMeta from '@supabase/pg-meta' -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { invalidateRolesQuery } from './database-roles-query' type UpdateRoleBody = Parameters[1] @@ -38,7 +38,7 @@ export const useDatabaseRoleUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/database-roles/database-roles-query.ts b/apps/studio/data/database-roles/database-roles-query.ts index c87a7c47e54..f86ebb90fa8 100644 --- a/apps/studio/data/database-roles/database-roles-query.ts +++ b/apps/studio/data/database-roles/database-roles-query.ts @@ -1,8 +1,9 @@ import pgMeta from '@supabase/pg-meta' -import { QueryClient, useQuery, UseQueryOptions } from '@tanstack/react-query' +import { QueryClient, useQuery } from '@tanstack/react-query' import { z } from 'zod' import { executeSql, ExecuteSqlError } from 'data/sql/execute-sql-query' +import { UseCustomQueryOptions } from 'types' import { databaseRoleKeys } from './keys' export type DatabaseRolesVariables = { @@ -31,7 +32,10 @@ export type DatabaseRolesError = ExecuteSqlError export const useDatabaseRolesQuery = ( { projectRef, connectionString }: DatabaseRolesVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: databaseRoleKeys.databaseRoles(projectRef), @@ -41,5 +45,5 @@ export const useDatabaseRolesQuery = ( }) export function invalidateRolesQuery(client: QueryClient, projectRef: string | undefined) { - return client.invalidateQueries(databaseRoleKeys.databaseRoles(projectRef)) + return client.invalidateQueries({ queryKey: databaseRoleKeys.databaseRoles(projectRef) }) } diff --git a/apps/studio/data/database-triggers/database-trigger-create-mutation.ts b/apps/studio/data/database-triggers/database-trigger-create-mutation.ts index d88f44247e1..d0209380568 100644 --- a/apps/studio/data/database-triggers/database-trigger-create-mutation.ts +++ b/apps/studio/data/database-triggers/database-trigger-create-mutation.ts @@ -1,9 +1,9 @@ import pgMeta from '@supabase/pg-meta' import { PGTriggerCreate } from '@supabase/pg-meta/src/pg-meta-triggers' -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { executeSql } from 'data/sql/execute-sql-query' import { toast } from 'sonner' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { databaseTriggerKeys } from './keys' export type DatabaseTriggerCreateVariables = { @@ -36,7 +36,11 @@ export const useDatabaseTriggerCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + DatabaseTriggerCreateData, + ResponseError, + DatabaseTriggerCreateVariables + >, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/database-triggers/database-trigger-delete-mutation.ts b/apps/studio/data/database-triggers/database-trigger-delete-mutation.ts index c949802ca9c..d9ec7dd34b8 100644 --- a/apps/studio/data/database-triggers/database-trigger-delete-mutation.ts +++ b/apps/studio/data/database-triggers/database-trigger-delete-mutation.ts @@ -1,8 +1,8 @@ import pgMeta from '@supabase/pg-meta' -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { executeSql } from 'data/sql/execute-sql-query' import { toast } from 'sonner' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { databaseTriggerKeys } from './keys' export type DatabaseTriggerDeleteVariables = { @@ -40,7 +40,11 @@ export const useDatabaseTriggerDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + DatabaseTriggerDeleteData, + ResponseError, + DatabaseTriggerDeleteVariables + >, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/database-triggers/database-trigger-update-mutation.ts b/apps/studio/data/database-triggers/database-trigger-update-mutation.ts index 54340e0dd97..46beecfcf00 100644 --- a/apps/studio/data/database-triggers/database-trigger-update-mutation.ts +++ b/apps/studio/data/database-triggers/database-trigger-update-mutation.ts @@ -1,9 +1,9 @@ import pgMeta from '@supabase/pg-meta' import { PGTriggerUpdate } from '@supabase/pg-meta/src/pg-meta-triggers' -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { executeSql } from 'data/sql/execute-sql-query' import { toast } from 'sonner' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { databaseTriggerKeys } from './keys' export type DatabaseTriggerUpdateVariables = { @@ -43,7 +43,11 @@ export const useDatabaseTriggerUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + DatabaseTriggerUpdateData, + ResponseError, + DatabaseTriggerUpdateVariables + >, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/database-triggers/database-trigger-update-transaction-mutation.ts b/apps/studio/data/database-triggers/database-trigger-update-transaction-mutation.ts index e030be2e119..a71b0425932 100644 --- a/apps/studio/data/database-triggers/database-trigger-update-transaction-mutation.ts +++ b/apps/studio/data/database-triggers/database-trigger-update-transaction-mutation.ts @@ -1,11 +1,11 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { PGTrigger, PGTriggerCreate } from '@supabase/pg-meta/src/pg-meta-triggers' import { PostgresTrigger } from '@supabase/postgres-meta' import { executeSql } from 'data/sql/execute-sql-query' import { quoteLiteral } from 'lib/pg-format' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { databaseTriggerKeys } from './keys' // [Joshen] Writing this query within FE as the PATCH endpoint from pg-meta only supports updating @@ -58,7 +58,11 @@ export const useDatabaseTriggerUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + DatabaseTriggerUpdateTxnData, + ResponseError, + DatabaseTriggerUpdateVariables + >, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/database-triggers/database-triggers-query.ts b/apps/studio/data/database-triggers/database-triggers-query.ts index 4e3c9a60a38..59778901977 100644 --- a/apps/studio/data/database-triggers/database-triggers-query.ts +++ b/apps/studio/data/database-triggers/database-triggers-query.ts @@ -1,7 +1,7 @@ import { DEFAULT_PLATFORM_APPLICATION_NAME } from '@supabase/pg-meta/src/constants' -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { databaseTriggerKeys } from './keys' export type DatabaseTriggersVariables = { @@ -43,7 +43,7 @@ export const useDatabaseHooksQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: databaseTriggerKeys.list(projectRef), @@ -65,7 +65,7 @@ export const useDatabaseTriggersQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: databaseTriggerKeys.list(projectRef), diff --git a/apps/studio/data/database/backup-download-mutation.ts b/apps/studio/data/database/backup-download-mutation.ts index 3a1915bf29b..2c1371c0f4e 100644 --- a/apps/studio/data/database/backup-download-mutation.ts +++ b/apps/studio/data/database/backup-download-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' -import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' import { components } from 'api-types' +import { handleError, post } from 'data/fetchers' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type BackupDownloadVariables = { ref: string @@ -28,7 +28,7 @@ export const useBackupDownloadMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/database/backup-query.ts b/apps/studio/data/database/backup-query.ts index 4f11dbd2f52..03f2c752460 100644 --- a/apps/studio/data/database/backup-query.ts +++ b/apps/studio/data/database/backup-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { databaseKeys } from './keys' export type DownloadableBackupVariables = { @@ -31,7 +31,7 @@ export const useDownloadableBackupQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: databaseKeys.backups(projectRef), diff --git a/apps/studio/data/database/backup-restore-mutation.ts b/apps/studio/data/database/backup-restore-mutation.ts index 142cef57071..95b95c2475b 100644 --- a/apps/studio/data/database/backup-restore-mutation.ts +++ b/apps/studio/data/database/backup-restore-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import type { components } from 'data/api' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type BackupRestoreVariables = { ref: string @@ -38,7 +38,7 @@ export const useBackupRestoreMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/database/backups-query.ts b/apps/studio/data/database/backups-query.ts index 6767055fd8c..1ab9ad3d076 100644 --- a/apps/studio/data/database/backups-query.ts +++ b/apps/studio/data/database/backups-query.ts @@ -1,9 +1,9 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import type { components } from 'data/api' import { get, handleError } from 'data/fetchers' import { useIsOrioleDbInAws } from 'hooks/misc/useSelectedProject' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { databaseKeys } from './keys' export type BackupsVariables = { @@ -29,7 +29,7 @@ export type BackupsError = ResponseError export const useBackupsQuery = ( { projectRef }: BackupsVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => { // [Joshen] Check for specifically false to account for project not loaded yet const isOrioleDbInAws = useIsOrioleDbInAws() diff --git a/apps/studio/data/database/constraints-query.ts b/apps/studio/data/database/constraints-query.ts index ae38e710f17..22fc7c249ec 100644 --- a/apps/studio/data/database/constraints-query.ts +++ b/apps/studio/data/database/constraints-query.ts @@ -1,6 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { executeSql, ExecuteSqlError } from '../sql/execute-sql-query' import { databaseKeys } from './keys' +import { UseCustomQueryOptions } from 'types' type GetTableConstraintsVariables = { id?: number @@ -75,7 +76,7 @@ export const useTableConstraintsQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: databaseKeys.tableConstraints(projectRef, id), diff --git a/apps/studio/data/database/database-password-reset-mutation.ts b/apps/studio/data/database/database-password-reset-mutation.ts index 6864c7fa411..9a6238dae02 100644 --- a/apps/studio/data/database/database-password-reset-mutation.ts +++ b/apps/studio/data/database/database-password-reset-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, patch } from 'data/fetchers' import { projectKeys } from 'data/projects/keys' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type DatabasePasswordResetVariables = { ref: string @@ -29,7 +29,11 @@ export const useDatabasePasswordResetMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + DatabasePasswordResetData, + ResponseError, + DatabasePasswordResetVariables + >, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/database/database-size-query.ts b/apps/studio/data/database/database-size-query.ts index 12690c11bb4..e2ac985f56a 100644 --- a/apps/studio/data/database/database-size-query.ts +++ b/apps/studio/data/database/database-size-query.ts @@ -1,6 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { executeSql, ExecuteSqlError } from '../sql/execute-sql-query' import { databaseKeys } from './keys' +import { UseCustomQueryOptions } from 'types' export const getDatabaseSizeSql = () => { const sql = /* SQL */ ` @@ -44,7 +45,10 @@ export type DatabaseSizeError = ExecuteSqlError export const useDatabaseSizeQuery = ( { projectRef, connectionString }: DatabaseSizeVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: databaseKeys.databaseSize(projectRef), diff --git a/apps/studio/data/database/enable-physical-backups-mutation.ts b/apps/studio/data/database/enable-physical-backups-mutation.ts index 2a89ffd12f1..cb82cd9cbd4 100644 --- a/apps/studio/data/database/enable-physical-backups-mutation.ts +++ b/apps/studio/data/database/enable-physical-backups-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type EnablePhysicalBackupsVariables = { ref: string @@ -23,7 +23,7 @@ export const useEnablePhysicalBackupsMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/database/entity-definitions-query.ts b/apps/studio/data/database/entity-definitions-query.ts index 49bc48c4ba1..f32f87e3c6b 100644 --- a/apps/studio/data/database/entity-definitions-query.ts +++ b/apps/studio/data/database/entity-definitions-query.ts @@ -1,7 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { executeSql, ExecuteSqlError } from '../sql/execute-sql-query' import { CREATE_PG_GET_TABLEDEF_SQL } from './database-table-definition' import { databaseKeys } from './keys' +import { UseCustomQueryOptions } from 'types' export const getEntityDefinitionsSql = ({ schemas, @@ -109,7 +110,7 @@ export const useEntityDefinitionsQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: databaseKeys.entityDefinitions(projectRef, schemas), diff --git a/apps/studio/data/database/foreign-key-constraints-query.ts b/apps/studio/data/database/foreign-key-constraints-query.ts index c15a0e762be..8494a43e82e 100644 --- a/apps/studio/data/database/foreign-key-constraints-query.ts +++ b/apps/studio/data/database/foreign-key-constraints-query.ts @@ -1,7 +1,8 @@ -import { QueryClient, useQuery, UseQueryOptions } from '@tanstack/react-query' +import { QueryClient, useQuery } from '@tanstack/react-query' import { executeSql, ExecuteSqlError } from '../sql/execute-sql-query' import { databaseKeys } from './keys' +import { UseCustomQueryOptions } from 'types' type GetForeignKeyConstraintsVariables = { schema?: string @@ -132,7 +133,7 @@ export const useForeignKeyConstraintsQuery = { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: databaseKeys.foreignKeyConstraints(projectRef, schema), diff --git a/apps/studio/data/database/hooks-enable-mutation.ts b/apps/studio/data/database/hooks-enable-mutation.ts index 6a98f02c27e..88b88eacee5 100644 --- a/apps/studio/data/database/hooks-enable-mutation.ts +++ b/apps/studio/data/database/hooks-enable-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { invalidateSchemasQuery } from './schemas-query' export type HooksEnableVariables = { @@ -24,7 +24,7 @@ export const useHooksEnableMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/database/keywords-query.ts b/apps/studio/data/database/keywords-query.ts index 28ba8b8d1f9..b2cb3e68af6 100644 --- a/apps/studio/data/database/keywords-query.ts +++ b/apps/studio/data/database/keywords-query.ts @@ -1,6 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { executeSql, ExecuteSqlError } from '../sql/execute-sql-query' import { databaseKeys } from './keys' +import { UseCustomQueryOptions } from 'types' export const getKeywordsSql = () => { const sql = /* SQL */ ` @@ -34,7 +35,7 @@ export type KeywordsError = ExecuteSqlError export const useKeywordsQuery = ( { projectRef, connectionString }: KeywordsVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: databaseKeys.keywords(projectRef), diff --git a/apps/studio/data/database/max-connections-query.ts b/apps/studio/data/database/max-connections-query.ts index 8103c8d5565..bf3a183fce7 100644 --- a/apps/studio/data/database/max-connections-query.ts +++ b/apps/studio/data/database/max-connections-query.ts @@ -1,4 +1,5 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' +import { UseCustomQueryOptions } from 'types' import { executeSql, ExecuteSqlError } from '../sql/execute-sql-query' import { databaseKeys } from './keys' @@ -39,7 +40,7 @@ export const useMaxConnectionsQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: databaseKeys.maxConnections(projectRef), diff --git a/apps/studio/data/database/migration-upsert-mutation.ts b/apps/studio/data/database/migration-upsert-mutation.ts index c132e70f493..a31807138b2 100644 --- a/apps/studio/data/database/migration-upsert-mutation.ts +++ b/apps/studio/data/database/migration-upsert-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, put } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { databaseKeys } from './keys' export type MigrationUpsertVariables = { @@ -45,7 +45,7 @@ export const useMigrationUpsertMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/database/migrations-query.ts b/apps/studio/data/database/migrations-query.ts index ca47a1296a4..f15f44e8108 100644 --- a/apps/studio/data/database/migrations-query.ts +++ b/apps/studio/data/database/migrations-query.ts @@ -1,4 +1,5 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' +import { UseCustomQueryOptions } from 'types' import { executeSql, ExecuteSqlError } from '../sql/execute-sql-query' import { databaseKeys } from './keys' @@ -55,7 +56,7 @@ export type MigrationsError = ExecuteSqlError export const useMigrationsQuery = ( { projectRef, connectionString }: MigrationsVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: databaseKeys.migrations(projectRef), diff --git a/apps/studio/data/database/pgbouncer-config-query.ts b/apps/studio/data/database/pgbouncer-config-query.ts index 5269d82dda2..924ebd59b7c 100644 --- a/apps/studio/data/database/pgbouncer-config-query.ts +++ b/apps/studio/data/database/pgbouncer-config-query.ts @@ -1,8 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' import { IS_PLATFORM } from 'lib/constants' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { databaseKeys } from './keys' export type PgbouncerConfigVariables = { @@ -31,7 +31,7 @@ export const usePgbouncerConfigQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: databaseKeys.pgbouncerConfig(projectRef), diff --git a/apps/studio/data/database/pgbouncer-config-update-mutation.ts b/apps/studio/data/database/pgbouncer-config-update-mutation.ts index 4f9d34be8d7..1039aea7623 100644 --- a/apps/studio/data/database/pgbouncer-config-update-mutation.ts +++ b/apps/studio/data/database/pgbouncer-config-update-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import type { components } from 'data/api' import { handleError, patch } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { databaseKeys } from './keys' export type PgbouncerConfigurationUpdateVariables = { @@ -41,7 +41,7 @@ export const usePgbouncerConfigurationUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< PgbouncerConfigurationUpdateData, ResponseError, PgbouncerConfigurationUpdateVariables diff --git a/apps/studio/data/database/pgbouncer-status-query.ts b/apps/studio/data/database/pgbouncer-status-query.ts index 513ea8816ae..333af72e554 100644 --- a/apps/studio/data/database/pgbouncer-status-query.ts +++ b/apps/studio/data/database/pgbouncer-status-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { databaseKeys } from './keys' export type PgbouncerStatusVariables = { @@ -30,7 +30,7 @@ export const usePgbouncerStatusQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: databaseKeys.pgbouncerStatus(projectRef), diff --git a/apps/studio/data/database/pitr-restore-mutation.ts b/apps/studio/data/database/pitr-restore-mutation.ts index 26c102e77dc..01e152360c5 100644 --- a/apps/studio/data/database/pitr-restore-mutation.ts +++ b/apps/studio/data/database/pitr-restore-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type PitrRestoreVariables = { ref: string @@ -25,7 +25,7 @@ export const usePitrRestoreMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/database/primary-keys-exists-query.ts b/apps/studio/data/database/primary-keys-exists-query.ts index 3074b364646..fb3091d0a76 100644 --- a/apps/studio/data/database/primary-keys-exists-query.ts +++ b/apps/studio/data/database/primary-keys-exists-query.ts @@ -1,8 +1,8 @@ import { getCheckPrimaryKeysExistsSQL } from '@supabase/pg-meta/src/sql/studio/check-primary-keys-exists' -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { databaseKeys } from './keys' type CheckPrimaryKeysExistsVariables = { @@ -44,7 +44,7 @@ export const useCheckPrimaryKeysExists = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: databaseKeys.checkPrimaryKeysExists(projectRef, tables), diff --git a/apps/studio/data/database/retrieve-index-advisor-result-query.ts b/apps/studio/data/database/retrieve-index-advisor-result-query.ts index fcb97c9b032..0f6d9f0b888 100644 --- a/apps/studio/data/database/retrieve-index-advisor-result-query.ts +++ b/apps/studio/data/database/retrieve-index-advisor-result-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { databaseKeys } from './keys' export type GetIndexAdvisorResultVariables = { @@ -45,7 +45,7 @@ export const useGetIndexAdvisorResult = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: databaseKeys.indexAdvisorFromQuery(projectRef, query), diff --git a/apps/studio/data/database/retrieve-index-from-select-query.ts b/apps/studio/data/database/retrieve-index-from-select-query.ts index 493571532e8..a1002b542ae 100644 --- a/apps/studio/data/database/retrieve-index-from-select-query.ts +++ b/apps/studio/data/database/retrieve-index-from-select-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { databaseKeys } from './keys' export type GetInvolvedIndexesFromSelectQueryVariables = { @@ -132,7 +132,7 @@ export const useGetIndexesFromSelectQuery = , + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/database/schemas-query.ts b/apps/studio/data/database/schemas-query.ts index 0295f93c0e0..4ec036f2093 100644 --- a/apps/studio/data/database/schemas-query.ts +++ b/apps/studio/data/database/schemas-query.ts @@ -1,8 +1,9 @@ import pgMeta from '@supabase/pg-meta' -import { QueryClient, useQuery, UseQueryOptions } from '@tanstack/react-query' +import { QueryClient, useQuery } from '@tanstack/react-query' import { z } from 'zod' import { executeSql, ExecuteSqlError } from 'data/sql/execute-sql-query' +import { UseCustomQueryOptions } from 'types' import { databaseKeys } from './keys' export type SchemasVariables = { @@ -36,7 +37,7 @@ export async function getSchemas( export const useSchemasQuery = ( { projectRef, connectionString }: SchemasVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: databaseKeys.schemas(projectRef), @@ -46,7 +47,7 @@ export const useSchemasQuery = ( }) export function invalidateSchemasQuery(client: QueryClient, projectRef: string | undefined) { - return client.invalidateQueries(databaseKeys.schemas(projectRef)) + return client.invalidateQueries({ queryKey: databaseKeys.schemas(projectRef) }) } export function prefetchSchemas( diff --git a/apps/studio/data/database/supavisor-configuration-query.ts b/apps/studio/data/database/supavisor-configuration-query.ts index 599630d5875..1abc99260b5 100644 --- a/apps/studio/data/database/supavisor-configuration-query.ts +++ b/apps/studio/data/database/supavisor-configuration-query.ts @@ -1,8 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' import { IS_PLATFORM } from 'lib/constants' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { databaseKeys } from './keys' type SupavisorConfigurationVariables = { @@ -31,7 +31,7 @@ export const useSupavisorConfigurationQuery = = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: databaseKeys.poolingConfiguration(projectRef), diff --git a/apps/studio/data/database/supavisor-configuration-update-mutation.ts b/apps/studio/data/database/supavisor-configuration-update-mutation.ts index 54c6bc21f68..6bc4a37d921 100644 --- a/apps/studio/data/database/supavisor-configuration-update-mutation.ts +++ b/apps/studio/data/database/supavisor-configuration-update-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import type { components } from 'data/api' import { handleError, patch } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { databaseKeys } from './keys' type SupavisorConfigurationUpdateVariables = { @@ -32,7 +32,7 @@ export const useSupavisorConfigurationUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< SupavisorConfigurationUpdateData, ResponseError, SupavisorConfigurationUpdateVariables diff --git a/apps/studio/data/database/table-columns-query.ts b/apps/studio/data/database/table-columns-query.ts index 45b72804d68..fbd23edcded 100644 --- a/apps/studio/data/database/table-columns-query.ts +++ b/apps/studio/data/database/table-columns-query.ts @@ -1,4 +1,5 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' +import { UseCustomQueryOptions } from 'types' import { executeSql, ExecuteSqlError } from '../sql/execute-sql-query' import { databaseKeys } from './keys' @@ -111,7 +112,10 @@ export type TableColumnsError = ExecuteSqlError export const useTableColumnsQuery = ( { projectRef, connectionString, schema, table }: TableColumnsVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: databaseKeys.tableColumns(projectRef, schema, table), diff --git a/apps/studio/data/database/table-definition-query.ts b/apps/studio/data/database/table-definition-query.ts index b20a20f163b..4d0aaa6ab9d 100644 --- a/apps/studio/data/database/table-definition-query.ts +++ b/apps/studio/data/database/table-definition-query.ts @@ -1,4 +1,5 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' +import { UseCustomQueryOptions } from 'types' import { executeSql, ExecuteSqlError } from '../sql/execute-sql-query' import { CREATE_PG_GET_TABLEDEF_SQL } from './database-table-definition' import { databaseKeys } from './keys' @@ -68,7 +69,7 @@ export const useTableDefinitionQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: databaseKeys.tableDefinition(projectRef, id), diff --git a/apps/studio/data/database/view-definition-query.ts b/apps/studio/data/database/view-definition-query.ts index fbd2f1b3cd2..411a7204825 100644 --- a/apps/studio/data/database/view-definition-query.ts +++ b/apps/studio/data/database/view-definition-query.ts @@ -1,6 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { executeSql, ExecuteSqlError } from '../sql/execute-sql-query' import { databaseKeys } from './keys' +import { UseCustomQueryOptions } from 'types' type GetViewDefinitionArgs = { id?: number @@ -60,7 +61,7 @@ export const useViewDefinitionQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: databaseKeys.viewDefinition(projectRef, id), diff --git a/apps/studio/data/docs/project-json-schema-query.ts b/apps/studio/data/docs/project-json-schema-query.ts index cf828c88773..2ce3513a61d 100644 --- a/apps/studio/data/docs/project-json-schema-query.ts +++ b/apps/studio/data/docs/project-json-schema-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { docsKeys } from './keys' export type ProjectJsonSchemaVariables = { @@ -93,7 +93,7 @@ export const useProjectJsonSchemaQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: docsKeys.jsonSchema(projectRef), diff --git a/apps/studio/data/documents/document-query.ts b/apps/studio/data/documents/document-query.ts index c10fa93b852..1e3edd66be9 100644 --- a/apps/studio/data/documents/document-query.ts +++ b/apps/studio/data/documents/document-query.ts @@ -1,6 +1,6 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { documentKeys } from './keys' export type DocType = 'standard-security-questionnaire' | 'soc2-type-2-report' @@ -45,7 +45,7 @@ export type DocumentError = ResponseError export const useDocumentQuery = ( { orgSlug, docType }: DocumentVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: documentKeys.resource(orgSlug, docType), diff --git a/apps/studio/data/documents/dpa-request-mutation.ts b/apps/studio/data/documents/dpa-request-mutation.ts index 1137a6b6bc3..6c732f02f9c 100644 --- a/apps/studio/data/documents/dpa-request-mutation.ts +++ b/apps/studio/data/documents/dpa-request-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' -import { post, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import { handleError, post } from 'data/fetchers' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type DpaRequestVariables = { recipient_email: string @@ -25,7 +25,7 @@ export const useDpaRequestMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/edge-functions/edge-function-body-query.ts b/apps/studio/data/edge-functions/edge-function-body-query.ts index 5f7f7923a10..295366c3dad 100644 --- a/apps/studio/data/edge-functions/edge-function-body-query.ts +++ b/apps/studio/data/edge-functions/edge-function-body-query.ts @@ -1,8 +1,8 @@ import { getMultipartBoundary, parseMultipartStream } from '@mjackson/multipart-parser' -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' import { IS_PLATFORM } from 'lib/constants' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { edgeFunctionsKeys } from './keys' export type EdgeFunctionBodyVariables = { @@ -81,7 +81,7 @@ export const useEdgeFunctionBodyQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: edgeFunctionsKeys.body(projectRef, slug), diff --git a/apps/studio/data/edge-functions/edge-function-query.ts b/apps/studio/data/edge-functions/edge-function-query.ts index c0aa1ff013d..a44cb9d04e5 100644 --- a/apps/studio/data/edge-functions/edge-function-query.ts +++ b/apps/studio/data/edge-functions/edge-function-query.ts @@ -1,8 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { components } from 'api-types' import { get, handleError } from 'data/fetchers' import { IS_PLATFORM } from 'lib/constants' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { edgeFunctionsKeys } from './keys' export type EdgeFunctionVariables = { @@ -33,7 +33,10 @@ export type EdgeFunctionError = ResponseError export const useEdgeFunctionQuery = ( { projectRef, slug }: EdgeFunctionVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: edgeFunctionsKeys.detail(projectRef, slug), diff --git a/apps/studio/data/edge-functions/edge-function-test-mutation.ts b/apps/studio/data/edge-functions/edge-function-test-mutation.ts index 5c9ec39c5d8..ee80a79721a 100644 --- a/apps/studio/data/edge-functions/edge-function-test-mutation.ts +++ b/apps/studio/data/edge-functions/edge-function-test-mutation.ts @@ -1,10 +1,10 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { ResponseData } from 'components/interfaces/Functions/EdgeFunctionDetails/EdgeFunctionDetails.types' import { constructHeaders, fetchHandler } from 'data/fetchers' import { BASE_PATH } from 'lib/constants' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type EdgeFunctionTestResponse = { title: string @@ -49,7 +49,7 @@ export const useEdgeFunctionTestMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/edge-functions/edge-functions-delete-mutation.ts b/apps/studio/data/edge-functions/edge-functions-delete-mutation.ts index d001a37e31b..d446d150b97 100644 --- a/apps/studio/data/edge-functions/edge-functions-delete-mutation.ts +++ b/apps/studio/data/edge-functions/edge-functions-delete-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { del, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { edgeFunctionsKeys } from './keys' export type EdgeFunctionsDeleteVariables = { @@ -30,7 +30,7 @@ export const useEdgeFunctionDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/edge-functions/edge-functions-deploy-mutation.ts b/apps/studio/data/edge-functions/edge-functions-deploy-mutation.ts index b0cf2aae2ac..8dcff2fbc02 100644 --- a/apps/studio/data/edge-functions/edge-functions-deploy-mutation.ts +++ b/apps/studio/data/edge-functions/edge-functions-deploy-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { components } from 'api-types' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { edgeFunctionsKeys } from './keys' export type EdgeFunctionsDeployVariables = { @@ -53,7 +53,7 @@ export const useEdgeFunctionDeployMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/edge-functions/edge-functions-query.ts b/apps/studio/data/edge-functions/edge-functions-query.ts index 4b872cf0209..798f3374763 100644 --- a/apps/studio/data/edge-functions/edge-functions-query.ts +++ b/apps/studio/data/edge-functions/edge-functions-query.ts @@ -1,8 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { components } from 'api-types' import { get, handleError } from 'data/fetchers' import { IS_PLATFORM } from 'lib/constants' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { edgeFunctionsKeys } from './keys' export type EdgeFunctionsVariables = { projectRef?: string } @@ -29,7 +29,10 @@ export type EdgeFunctionsError = ResponseError export const useEdgeFunctionsQuery = ( { projectRef }: EdgeFunctionsVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: edgeFunctionsKeys.list(projectRef), diff --git a/apps/studio/data/edge-functions/edge-functions-update-mutation.ts b/apps/studio/data/edge-functions/edge-functions-update-mutation.ts index 57e76d11b43..230f0d7dd8f 100644 --- a/apps/studio/data/edge-functions/edge-functions-update-mutation.ts +++ b/apps/studio/data/edge-functions/edge-functions-update-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, patch } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { edgeFunctionsKeys } from './keys' export type EdgeFunctionsUpdateVariables = { projectRef: string @@ -39,7 +39,7 @@ export const useEdgeFunctionUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/entitlements/entitlements-query.ts b/apps/studio/data/entitlements/entitlements-query.ts index 991539c6571..40099d85bbf 100644 --- a/apps/studio/data/entitlements/entitlements-query.ts +++ b/apps/studio/data/entitlements/entitlements-query.ts @@ -1,8 +1,9 @@ -import { QueryClient, useQuery, UseQueryOptions } from '@tanstack/react-query' -import { get, handleError } from 'data/fetchers' -import { ResponseError } from 'types/base' +import { useQuery } from '@tanstack/react-query' import type { components } from 'api-types' +import { get, handleError } from 'data/fetchers' import { organizationKeys } from 'data/organizations/keys' +import { UseCustomQueryOptions } from 'types' +import { ResponseError } from 'types/base' export type EntitlementsVariables = { slug: string @@ -30,7 +31,10 @@ export type EntitlementsError = ResponseError export const useEntitlementsQuery = ( { slug }: EntitlementsVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => { return useQuery({ queryKey: [organizationKeys.entitlements(slug)], diff --git a/apps/studio/data/entity-types/entity-types-infinite-query.ts b/apps/studio/data/entity-types/entity-types-infinite-query.ts index 72fc8ac4fe0..12ec54dc866 100644 --- a/apps/studio/data/entity-types/entity-types-infinite-query.ts +++ b/apps/studio/data/entity-types/entity-types-infinite-query.ts @@ -1,6 +1,6 @@ -import { QueryClient, useInfiniteQuery, UseInfiniteQueryOptions } from '@tanstack/react-query' +import { QueryClient, useInfiniteQuery } from '@tanstack/react-query' import { executeSql, ExecuteSqlVariables } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomInfiniteQueryOptions } from 'types' import { ENTITY_TYPE } from './entity-type-constants' import { entityTypeKeys } from './keys' @@ -130,7 +130,7 @@ export const useEntityTypesQuery = ( { enabled = true, ...options - }: UseInfiniteQueryOptions = {} + }: UseCustomInfiniteQueryOptions = {} ) => { return useInfiniteQuery({ queryKey: entityTypeKeys.list(projectRef, { schemas, search, sort, limit, filterTypes }), diff --git a/apps/studio/data/enumerated-types/enumerated-type-create-mutation.ts b/apps/studio/data/enumerated-types/enumerated-type-create-mutation.ts index bd468194945..9de89157cb1 100644 --- a/apps/studio/data/enumerated-types/enumerated-type-create-mutation.ts +++ b/apps/studio/data/enumerated-types/enumerated-type-create-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { executeSql } from 'data/sql/execute-sql-query' import { wrapWithTransaction } from 'data/sql/utils/transaction' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { enumeratedTypesKeys } from './keys' export type EnumeratedTypeCreateVariables = { @@ -40,7 +40,7 @@ export const useEnumeratedTypeCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/enumerated-types/enumerated-type-delete-mutation.ts b/apps/studio/data/enumerated-types/enumerated-type-delete-mutation.ts index 12514e2391b..0a867bcec9b 100644 --- a/apps/studio/data/enumerated-types/enumerated-type-delete-mutation.ts +++ b/apps/studio/data/enumerated-types/enumerated-type-delete-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { enumeratedTypesKeys } from './keys' export type EnumeratedTypeDeleteVariables = { @@ -30,7 +30,7 @@ export const useEnumeratedTypeDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/enumerated-types/enumerated-type-update-mutation.ts b/apps/studio/data/enumerated-types/enumerated-type-update-mutation.ts index d8fb085ecaf..aa220bc5360 100644 --- a/apps/studio/data/enumerated-types/enumerated-type-update-mutation.ts +++ b/apps/studio/data/enumerated-types/enumerated-type-update-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { executeSql } from 'data/sql/execute-sql-query' import { wrapWithTransaction } from 'data/sql/utils/transaction' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { enumeratedTypesKeys } from './keys' export type EnumeratedTypeUpdateVariables = { @@ -66,7 +66,7 @@ export const useEnumeratedTypeUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/enumerated-types/enumerated-types-query.ts b/apps/studio/data/enumerated-types/enumerated-types-query.ts index 6253eef547e..f7aff0c7035 100644 --- a/apps/studio/data/enumerated-types/enumerated-types-query.ts +++ b/apps/studio/data/enumerated-types/enumerated-types-query.ts @@ -1,10 +1,10 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' +import { DEFAULT_PLATFORM_APPLICATION_NAME } from '@supabase/pg-meta/src/constants' import type { components } from 'data/api' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { enumeratedTypesKeys } from './keys' -import { DEFAULT_PLATFORM_APPLICATION_NAME } from '@supabase/pg-meta/src/constants' export type EnumeratedTypesVariables = { projectRef?: string @@ -46,7 +46,7 @@ export const useEnumeratedTypesQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: enumeratedTypesKeys.list(projectRef), diff --git a/apps/studio/data/fdw/fdw-create-mutation.ts b/apps/studio/data/fdw/fdw-create-mutation.ts index 8c366b30cb4..581983c99b0 100644 --- a/apps/studio/data/fdw/fdw-create-mutation.ts +++ b/apps/studio/data/fdw/fdw-create-mutation.ts @@ -1,4 +1,4 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { @@ -10,7 +10,7 @@ import { foreignTableKeys } from 'data/foreign-tables/keys' import { executeSql } from 'data/sql/execute-sql-query' import { wrapWithTransaction } from 'data/sql/utils/transaction' import { vaultSecretsKeys } from 'data/vault/keys' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { fdwKeys } from './keys' export type FDWCreateVariables = { @@ -242,7 +242,7 @@ export const useFDWCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/fdw/fdw-delete-mutation.ts b/apps/studio/data/fdw/fdw-delete-mutation.ts index 3f3a73fbd51..14c729fdfc8 100644 --- a/apps/studio/data/fdw/fdw-delete-mutation.ts +++ b/apps/studio/data/fdw/fdw-delete-mutation.ts @@ -1,4 +1,4 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import type { WrapperMeta } from 'components/interfaces/Integrations/Wrappers/Wrappers.types' @@ -7,7 +7,7 @@ import { foreignTableKeys } from 'data/foreign-tables/keys' import { executeSql } from 'data/sql/execute-sql-query' import { wrapWithTransaction } from 'data/sql/utils/transaction' import { vaultSecretsKeys } from 'data/vault/keys' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { FDW } from './fdws-query' import { fdwKeys } from './keys' @@ -99,7 +99,7 @@ export const useFDWDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/fdw/fdw-import-foreign-schema-mutation.ts b/apps/studio/data/fdw/fdw-import-foreign-schema-mutation.ts index 1667e2b41a0..603426a7283 100644 --- a/apps/studio/data/fdw/fdw-import-foreign-schema-mutation.ts +++ b/apps/studio/data/fdw/fdw-import-foreign-schema-mutation.ts @@ -1,4 +1,4 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { entityTypeKeys } from 'data/entity-types/keys' @@ -6,7 +6,7 @@ import { foreignTableKeys } from 'data/foreign-tables/keys' import { executeSql } from 'data/sql/execute-sql-query' import { wrapWithTransaction } from 'data/sql/utils/transaction' import { vaultSecretsKeys } from 'data/vault/keys' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { fdwKeys } from './keys' export type FDWImportForeignSchemaVariables = { @@ -45,7 +45,7 @@ export const useFDWImportForeignSchemaMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/fdw/fdw-update-mutation.ts b/apps/studio/data/fdw/fdw-update-mutation.ts index c4ac3307e2b..df84fe0ee46 100644 --- a/apps/studio/data/fdw/fdw-update-mutation.ts +++ b/apps/studio/data/fdw/fdw-update-mutation.ts @@ -1,4 +1,4 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import type { WrapperMeta } from 'components/interfaces/Integrations/Wrappers/Wrappers.types' @@ -7,7 +7,7 @@ import { foreignTableKeys } from 'data/foreign-tables/keys' import { executeSql } from 'data/sql/execute-sql-query' import { wrapWithTransaction } from 'data/sql/utils/transaction' import { vaultSecretsKeys } from 'data/vault/keys' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { getCreateFDWSql } from './fdw-create-mutation' import { getDeleteFDWSql } from './fdw-delete-mutation' import { FDW } from './fdws-query' @@ -69,7 +69,7 @@ export const useFDWUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/fdw/fdws-query.ts b/apps/studio/data/fdw/fdws-query.ts index da74ba15bec..33a8b426fe0 100644 --- a/apps/studio/data/fdw/fdws-query.ts +++ b/apps/studio/data/fdw/fdws-query.ts @@ -1,6 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { executeSql, ExecuteSqlError } from '../sql/execute-sql-query' import { fdwKeys } from './keys' +import { UseCustomQueryOptions } from 'types' export const getFDWsSql = () => { const sql = /* SQL */ ` @@ -87,7 +88,7 @@ export type FDWsError = ExecuteSqlError export const useFDWsQuery = ( { projectRef, connectionString }: FDWsVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: fdwKeys.list(projectRef), diff --git a/apps/studio/data/feedback/exit-survey-send.ts b/apps/studio/data/feedback/exit-survey-send.ts index cfc9f884b1b..7910ae26f56 100644 --- a/apps/studio/data/feedback/exit-survey-send.ts +++ b/apps/studio/data/feedback/exit-survey-send.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type SendDowngradeFeedbackVariables = { projectRef?: string @@ -38,7 +38,11 @@ export const useSendDowngradeFeedbackMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + SendDowngradeFeedbackData, + ResponseError, + SendDowngradeFeedbackVariables + >, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/feedback/feedback-category.ts b/apps/studio/data/feedback/feedback-category.ts index d683fc6eb03..f0c4c2c6e3c 100644 --- a/apps/studio/data/feedback/feedback-category.ts +++ b/apps/studio/data/feedback/feedback-category.ts @@ -1,6 +1,7 @@ -import { UseQueryOptions, useQuery } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { constructHeaders, fetchHandler, handleError } from 'data/fetchers' import { BASE_PATH } from 'lib/constants' +import { UseCustomQueryOptions } from 'types' export type FeedbackCategoryVariables = { prompt: string @@ -47,7 +48,7 @@ export const useFeedbackCategoryQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: ['feedback-category', prompt], diff --git a/apps/studio/data/feedback/feedback-send.ts b/apps/studio/data/feedback/feedback-send.ts index ede0f7c1423..68463c9da8b 100644 --- a/apps/studio/data/feedback/feedback-send.ts +++ b/apps/studio/data/feedback/feedback-send.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type SendFeedbackVariables = { message: string @@ -37,7 +37,7 @@ export const useSendFeedbackMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/feedback/support-ticket-send.ts b/apps/studio/data/feedback/support-ticket-send.ts index 24a44f7f3d1..91ce4b2f932 100644 --- a/apps/studio/data/feedback/support-ticket-send.ts +++ b/apps/studio/data/feedback/support-ticket-send.ts @@ -1,10 +1,10 @@ -import { type UseMutationOptions, useMutation } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' // End of third-party imports import type { ExtendedSupportCategories } from 'components/interfaces/Support/Support.constants' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type sendSupportTicketVariables = { subject: string @@ -77,7 +77,7 @@ export const useSendSupportTicketMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/feedback/upgrade-survey-send.ts b/apps/studio/data/feedback/upgrade-survey-send.ts index e87aff4bfc1..09e70bf4f7e 100644 --- a/apps/studio/data/feedback/upgrade-survey-send.ts +++ b/apps/studio/data/feedback/upgrade-survey-send.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type SendUpgradeFeedbackVariables = { orgSlug?: string @@ -38,7 +38,7 @@ export const useSendUpgradeFeedbackMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/foreign-tables/foreign-tables-query.ts b/apps/studio/data/foreign-tables/foreign-tables-query.ts index cb6cfd90e93..5de130a2904 100644 --- a/apps/studio/data/foreign-tables/foreign-tables-query.ts +++ b/apps/studio/data/foreign-tables/foreign-tables-query.ts @@ -1,10 +1,10 @@ -import { UseQueryOptions, useQuery } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' +import { DEFAULT_PLATFORM_APPLICATION_NAME } from '@supabase/pg-meta/src/constants' import { PostgresView } from '@supabase/postgres-meta' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { foreignTableKeys } from './keys' -import { DEFAULT_PLATFORM_APPLICATION_NAME } from '@supabase/pg-meta/src/constants' export type ForeignTablesVariables = { projectRef?: string @@ -46,7 +46,10 @@ export type ForeignTablesError = ResponseError export const useForeignTablesQuery = ( { projectRef, connectionString, schema }: ForeignTablesVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: schema diff --git a/apps/studio/data/integrations/aws-redirect-query.ts b/apps/studio/data/integrations/aws-redirect-query.ts index 36699c47bff..a70f909acd1 100644 --- a/apps/studio/data/integrations/aws-redirect-query.ts +++ b/apps/studio/data/integrations/aws-redirect-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' -import type { ResponseError } from 'types' -import { integrationKeys } from './keys' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' +import type { ResponseError, UseCustomQueryOptions } from 'types' +import { integrationKeys } from './keys' export type AwsRedirectVariables = { organizationSlug?: string @@ -26,7 +26,10 @@ export type AwsRedirectError = ResponseError export const useAwsRedirectQuery = ( { organizationSlug }: AwsRedirectVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: integrationKeys.awsRedirect(organizationSlug), diff --git a/apps/studio/data/integrations/github-authorization-create-mutation.ts b/apps/studio/data/integrations/github-authorization-create-mutation.ts index c812e16faa2..3fd22101d17 100644 --- a/apps/studio/data/integrations/github-authorization-create-mutation.ts +++ b/apps/studio/data/integrations/github-authorization-create-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' -import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' import { LOCAL_STORAGE_KEYS } from 'common' +import { handleError, post } from 'data/fetchers' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type GitHubAuthorizationCreateVariables = { code: string @@ -37,7 +37,7 @@ export const useGitHubAuthorizationCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< GitHubAuthorizationCreateData, ResponseError, GitHubAuthorizationCreateVariables diff --git a/apps/studio/data/integrations/github-authorization-query.ts b/apps/studio/data/integrations/github-authorization-query.ts index 8bde6edd0fb..78f9586efb7 100644 --- a/apps/studio/data/integrations/github-authorization-query.ts +++ b/apps/studio/data/integrations/github-authorization-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { integrationKeys } from './keys' // FIXME(kamil): Do not retry, a single check is fine. @@ -21,7 +21,7 @@ export type GitHubAuthorizationError = ResponseError export const useGitHubAuthorizationQuery = ({ enabled = true, ...options -}: UseQueryOptions = {}) => { +}: UseCustomQueryOptions = {}) => { return useQuery({ queryKey: integrationKeys.githubAuthorization(), queryFn: ({ signal }) => getGitHubAuthorization(signal), diff --git a/apps/studio/data/integrations/github-branch-check-query.ts b/apps/studio/data/integrations/github-branch-check-query.ts index dd543cf89d3..2abf3892c12 100644 --- a/apps/studio/data/integrations/github-branch-check-query.ts +++ b/apps/studio/data/integrations/github-branch-check-query.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type GithubBranchVariables = { repositoryId: number @@ -37,7 +37,7 @@ export const useCheckGithubBranchValidity = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/integrations/github-branches-query.ts b/apps/studio/data/integrations/github-branches-query.ts index d8d441b8489..6cc295f83e6 100644 --- a/apps/studio/data/integrations/github-branches-query.ts +++ b/apps/studio/data/integrations/github-branches-query.ts @@ -1,6 +1,6 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { integrationKeys } from './keys' export type GitHubBranchesVariables = { @@ -30,7 +30,7 @@ export const useGitHubBranchesQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: integrationKeys.githubBranchesList(connectionId), diff --git a/apps/studio/data/integrations/github-connection-create-mutation.ts b/apps/studio/data/integrations/github-connection-create-mutation.ts index befd6698c43..cb23822a737 100644 --- a/apps/studio/data/integrations/github-connection-create-mutation.ts +++ b/apps/studio/data/integrations/github-connection-create-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { components } from 'api-types' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { integrationKeys } from './keys' type GitHubConnectionCreateVariables = { @@ -27,7 +27,11 @@ export const useGitHubConnectionCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + GitHubConnectionCreateData, + ResponseError, + GitHubConnectionCreateVariables + >, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/integrations/github-connection-delete-mutation.ts b/apps/studio/data/integrations/github-connection-delete-mutation.ts index 4b43017a828..9907c36b1a2 100644 --- a/apps/studio/data/integrations/github-connection-delete-mutation.ts +++ b/apps/studio/data/integrations/github-connection-delete-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { del, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { integrationKeys } from './keys' type DeleteVariables = { @@ -27,7 +27,7 @@ export const useGitHubConnectionDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/integrations/github-connection-update-mutation.ts b/apps/studio/data/integrations/github-connection-update-mutation.ts index 55b1bbb81e9..cbec34ad222 100644 --- a/apps/studio/data/integrations/github-connection-update-mutation.ts +++ b/apps/studio/data/integrations/github-connection-update-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { components } from 'api-types' import { handleError, patch } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { integrationKeys } from './keys' type GitHubConnectionUpdateVariables = { @@ -33,7 +33,7 @@ export const useGitHubConnectionUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/integrations/github-connections-query.ts b/apps/studio/data/integrations/github-connections-query.ts index 6f031f1344d..16e066e9911 100644 --- a/apps/studio/data/integrations/github-connections-query.ts +++ b/apps/studio/data/integrations/github-connections-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { integrationKeys } from './keys' export type GitHubConnectionsVariables = { @@ -37,7 +37,7 @@ export const useGitHubConnectionsQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => { return useQuery({ queryKey: integrationKeys.githubConnectionsList(organizationId), diff --git a/apps/studio/data/integrations/github-repositories-query.ts b/apps/studio/data/integrations/github-repositories-query.ts index 44ff23ab018..9ac089e0a2b 100644 --- a/apps/studio/data/integrations/github-repositories-query.ts +++ b/apps/studio/data/integrations/github-repositories-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { integrationKeys } from './keys' export async function getGitHubRepositories(signal?: AbortSignal) { @@ -22,7 +22,7 @@ export type GitHubRepositoriesError = ResponseError export const useGitHubRepositoriesQuery = ({ enabled = true, ...options -}: UseQueryOptions = {}) => { +}: UseCustomQueryOptions = {}) => { return useQuery({ queryKey: integrationKeys.githubRepositoriesList(), queryFn: ({ signal }) => getGitHubRepositories(signal), diff --git a/apps/studio/data/integrations/integrations-query-org-only.ts b/apps/studio/data/integrations/integrations-query-org-only.ts index ce6fdbb6111..72afeab33a6 100644 --- a/apps/studio/data/integrations/integrations-query-org-only.ts +++ b/apps/studio/data/integrations/integrations-query-org-only.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { Integration } from './integrations.types' import { integrationKeys } from './keys' @@ -25,7 +25,10 @@ export type IntegrationsError = ResponseError export const useOrgIntegrationsQuery = ( { orgSlug }: IntegrationsVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: integrationKeys.integrationsListWithOrg(orgSlug), diff --git a/apps/studio/data/integrations/integrations-query.ts b/apps/studio/data/integrations/integrations-query.ts index efdae8e3eb2..8e18d74b8ce 100644 --- a/apps/studio/data/integrations/integrations-query.ts +++ b/apps/studio/data/integrations/integrations-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { integrationKeys } from './keys' export async function getIntegrations(signal?: AbortSignal) { @@ -20,7 +20,7 @@ export type IntegrationsError = ResponseError export const useIntegrationsQuery = ({ enabled = true, ...options -}: UseQueryOptions = {}) => +}: UseCustomQueryOptions = {}) => useQuery({ queryKey: integrationKeys.integrationsList(), queryFn: ({ signal }) => getIntegrations(signal), diff --git a/apps/studio/data/integrations/integrations-vercel-connection-sync-envs-mutation.ts b/apps/studio/data/integrations/integrations-vercel-connection-sync-envs-mutation.ts index 862350bf11b..057e3edc21a 100644 --- a/apps/studio/data/integrations/integrations-vercel-connection-sync-envs-mutation.ts +++ b/apps/studio/data/integrations/integrations-vercel-connection-sync-envs-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type IntegrationsVercelConnectionSyncEnvsVariables = { connectionId: string @@ -33,7 +33,7 @@ export const useIntegrationsVercelConnectionSyncEnvsMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< IntegrationsVercelConnectionSyncEnvsData, ResponseError, IntegrationsVercelConnectionSyncEnvsVariables diff --git a/apps/studio/data/integrations/integrations-vercel-connections-create-mutation.ts b/apps/studio/data/integrations/integrations-vercel-connections-create-mutation.ts index ff6657312a8..fdae57ee171 100644 --- a/apps/studio/data/integrations/integrations-vercel-connections-create-mutation.ts +++ b/apps/studio/data/integrations/integrations-vercel-connections-create-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' import { useIntegrationInstallationSnapshot } from 'state/integration-installation' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import type { IntegrationConnectionsCreateVariables } from './integrations.types' import { integrationKeys } from './keys' @@ -35,7 +35,7 @@ export const useIntegrationVercelConnectionsCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< IntegrationVercelConnectionsCreateData, ResponseError, IntegrationConnectionsCreateVariables diff --git a/apps/studio/data/integrations/integrations-vercel-installed-connection-delete-mutation.ts b/apps/studio/data/integrations/integrations-vercel-installed-connection-delete-mutation.ts index 30eb1edf662..41d0768f7cd 100644 --- a/apps/studio/data/integrations/integrations-vercel-installed-connection-delete-mutation.ts +++ b/apps/studio/data/integrations/integrations-vercel-installed-connection-delete-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { del, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { integrationKeys } from './keys' type DeleteVariables = { @@ -33,7 +33,7 @@ export const useIntegrationsVercelInstalledConnectionDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/integrations/integrations-vercel-projects-query.ts b/apps/studio/data/integrations/integrations-vercel-projects-query.ts index f504315d860..634ef1d9322 100644 --- a/apps/studio/data/integrations/integrations-vercel-projects-query.ts +++ b/apps/studio/data/integrations/integrations-vercel-projects-query.ts @@ -1,6 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' import { integrationKeys } from './keys' +import { UseCustomQueryOptions } from 'types' export type VercelProjectsVariables = { organization_integration_id: string | undefined @@ -42,7 +43,7 @@ export const useVercelProjectsQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: integrationKeys.vercelProjectList(organization_integration_id), diff --git a/apps/studio/data/integrations/vercel-connection-update-mutate.ts b/apps/studio/data/integrations/vercel-connection-update-mutate.ts index c4514d2f374..5c9e020cc30 100644 --- a/apps/studio/data/integrations/vercel-connection-update-mutate.ts +++ b/apps/studio/data/integrations/vercel-connection-update-mutate.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, patch } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { EnvironmentTargets } from './integrations.types' import { integrationKeys } from './keys' @@ -40,7 +40,7 @@ export const useVercelConnectionUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/integrations/vercel-integration-create-mutation.ts b/apps/studio/data/integrations/vercel-integration-create-mutation.ts index 6bc91571d61..996dd0507f6 100644 --- a/apps/studio/data/integrations/vercel-integration-create-mutation.ts +++ b/apps/studio/data/integrations/vercel-integration-create-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { integrationKeys } from './keys' export type VercelIntegrationCreateVariables = { @@ -48,7 +48,11 @@ export const useVercelIntegrationCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + VercelIntegrationCreateData, + ResponseError, + VercelIntegrationCreateVariables + >, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/integrations/vercel-redirect-query.ts b/apps/studio/data/integrations/vercel-redirect-query.ts index 08cd018a96e..bf89940f8ad 100644 --- a/apps/studio/data/integrations/vercel-redirect-query.ts +++ b/apps/studio/data/integrations/vercel-redirect-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { integrationKeys } from './keys' export type VercelRedirectVariables = { @@ -30,7 +30,7 @@ export const useVercelRedirectQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: integrationKeys.vercelRedirect(installationId), diff --git a/apps/studio/data/invoices/invoice-payment-link-mutation.ts b/apps/studio/data/invoices/invoice-payment-link-mutation.ts index 6bbd7ffcb64..5433633f444 100644 --- a/apps/studio/data/invoices/invoice-payment-link-mutation.ts +++ b/apps/studio/data/invoices/invoice-payment-link-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { invoicesKeys } from './keys' export type InvoicePaymentLinkGetVariables = { @@ -39,7 +39,11 @@ export const useInvoicePaymentLinkGetMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + InvoicePaymentLinkGetData, + ResponseError, + InvoicePaymentLinkGetVariables + >, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/invoices/invoice-query.ts b/apps/studio/data/invoices/invoice-query.ts index 638d8f90a45..c0133fdede1 100644 --- a/apps/studio/data/invoices/invoice-query.ts +++ b/apps/studio/data/invoices/invoice-query.ts @@ -1,6 +1,6 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { invoicesKeys } from './keys' export type InvoiceVariables = { @@ -29,7 +29,7 @@ export type InvoiceError = ResponseError export const useInvoiceQuery = ( { invoiceId: id }: InvoiceVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: invoicesKeys.invoice(id), diff --git a/apps/studio/data/invoices/invoices-count-query.ts b/apps/studio/data/invoices/invoices-count-query.ts index a189cc91236..985993704f5 100644 --- a/apps/studio/data/invoices/invoices-count-query.ts +++ b/apps/studio/data/invoices/invoices-count-query.ts @@ -1,6 +1,6 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { head } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { invoicesKeys } from './keys' export type InvoicesCountVariables = { @@ -25,7 +25,10 @@ export type InvoicesCountError = ResponseError export const useInvoicesCountQuery = ( { slug }: InvoicesCountVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: invoicesKeys.count(slug), diff --git a/apps/studio/data/invoices/invoices-overdue-query.ts b/apps/studio/data/invoices/invoices-overdue-query.ts index b31a76bdb26..87a6d5e27db 100644 --- a/apps/studio/data/invoices/invoices-overdue-query.ts +++ b/apps/studio/data/invoices/invoices-overdue-query.ts @@ -1,9 +1,10 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' +import { useIsLoggedIn } from 'common' import type { components } from 'data/api' import { get, handleError } from 'data/fetchers' -import { invoicesKeys } from './keys' import { IS_PLATFORM } from 'lib/constants' -import { useIsLoggedIn } from 'common' +import { invoicesKeys } from './keys' +import { UseCustomQueryOptions } from 'types' export type OverdueInvoicesResponse = components['schemas']['OverdueInvoiceCount'] @@ -22,7 +23,7 @@ export type OverdueInvoicesError = unknown export const useOverdueInvoicesQuery = ({ enabled = true, ...options -}: UseQueryOptions = {}) => { +}: UseCustomQueryOptions = {}) => { const isLoggedIn = useIsLoggedIn() return useQuery({ queryKey: invoicesKeys.overdueInvoices(), diff --git a/apps/studio/data/invoices/invoices-query.ts b/apps/studio/data/invoices/invoices-query.ts index ff3118d31e9..ba72cd2b38a 100644 --- a/apps/studio/data/invoices/invoices-query.ts +++ b/apps/studio/data/invoices/invoices-query.ts @@ -1,6 +1,6 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { invoicesKeys } from './keys' export type InvoicesVariables = { @@ -32,7 +32,7 @@ export type InvoicesError = ResponseError export const useInvoicesQuery = ( { slug, offset, limit }: InvoicesVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => // [Joshen] Switch to useInfiniteQuery useQuery({ diff --git a/apps/studio/data/invoices/org-invoice-upcoming-query.ts b/apps/studio/data/invoices/org-invoice-upcoming-query.ts index 18aeb58b936..2a187425a1a 100644 --- a/apps/studio/data/invoices/org-invoice-upcoming-query.ts +++ b/apps/studio/data/invoices/org-invoice-upcoming-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { PricingMetric } from 'data/analytics/org-daily-stats-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { invoicesKeys } from './keys' export type UpcomingInvoiceVariables = { @@ -68,7 +68,7 @@ export const useOrgUpcomingInvoiceQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: invoicesKeys.orgUpcomingPreview(orgSlug), diff --git a/apps/studio/data/jwt-signing-keys/jwt-signing-key-create-mutation.ts b/apps/studio/data/jwt-signing-keys/jwt-signing-key-create-mutation.ts index 8c662686c73..a9ad8ac9649 100644 --- a/apps/studio/data/jwt-signing-keys/jwt-signing-key-create-mutation.ts +++ b/apps/studio/data/jwt-signing-keys/jwt-signing-key-create-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { JWTAlgorithm } from './jwt-signing-keys-query' import { jwtSigningKeysKeys } from './keys' @@ -38,7 +38,7 @@ export const useJWTSigningKeyCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/jwt-signing-keys/jwt-signing-key-delete-mutation.ts b/apps/studio/data/jwt-signing-keys/jwt-signing-key-delete-mutation.ts index 4b5cc07bdde..1b5791894f3 100644 --- a/apps/studio/data/jwt-signing-keys/jwt-signing-key-delete-mutation.ts +++ b/apps/studio/data/jwt-signing-keys/jwt-signing-key-delete-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { del, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { jwtSigningKeysKeys } from './keys' interface JWTSigningKeyDeleteVariables { @@ -30,7 +30,7 @@ export const useJWTSigningKeyDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/jwt-signing-keys/jwt-signing-key-update-mutation.ts b/apps/studio/data/jwt-signing-keys/jwt-signing-key-update-mutation.ts index 83198de5b5e..67e6c950baf 100644 --- a/apps/studio/data/jwt-signing-keys/jwt-signing-key-update-mutation.ts +++ b/apps/studio/data/jwt-signing-keys/jwt-signing-key-update-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, patch } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { jwtSigningKeysKeys } from './keys' interface JWTSigningKeyUpdateVariables { @@ -34,7 +34,7 @@ export const useJWTSigningKeyUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/jwt-signing-keys/jwt-signing-keys-query.ts b/apps/studio/data/jwt-signing-keys/jwt-signing-keys-query.ts index 959dbf5abf6..b990cc694b2 100644 --- a/apps/studio/data/jwt-signing-keys/jwt-signing-keys-query.ts +++ b/apps/studio/data/jwt-signing-keys/jwt-signing-keys-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { components } from 'api-types' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { jwtSigningKeysKeys } from './keys' export type JWTSigningKey = components['schemas']['SigningKeyResponse'] @@ -31,7 +31,7 @@ export type JWTSigningKeysData = Awaited> export const useJWTSigningKeysQuery = ( { projectRef }: JWTSigningKeysVariables, - { enabled, ...options }: UseQueryOptions = {} + { enabled, ...options }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: jwtSigningKeysKeys.list(projectRef), diff --git a/apps/studio/data/jwt-signing-keys/legacy-jwt-signing-key-create-mutation.ts b/apps/studio/data/jwt-signing-keys/legacy-jwt-signing-key-create-mutation.ts index 32e40a80fde..495bee859bf 100644 --- a/apps/studio/data/jwt-signing-keys/legacy-jwt-signing-key-create-mutation.ts +++ b/apps/studio/data/jwt-signing-keys/legacy-jwt-signing-key-create-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { jwtSigningKeysKeys } from './keys' interface LegacyJWTSigningKeyCreateVariables { @@ -29,7 +29,7 @@ export const useLegacyJWTSigningKeyCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< LegacyJWTSigningKeyCreateData, ResponseError, LegacyJWTSigningKeyCreateVariables diff --git a/apps/studio/data/jwt-signing-keys/legacy-jwt-signing-key-query.ts b/apps/studio/data/jwt-signing-keys/legacy-jwt-signing-key-query.ts index 23be0df5bc5..122c6c7a645 100644 --- a/apps/studio/data/jwt-signing-keys/legacy-jwt-signing-key-query.ts +++ b/apps/studio/data/jwt-signing-keys/legacy-jwt-signing-key-query.ts @@ -1,6 +1,6 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { jwtSigningKeysKeys } from './keys' @@ -30,7 +30,7 @@ export type LegacyJWTSigningKeyData = Awaited( { projectRef }: LegacyJWTSigningKeyVariables, - { enabled, ...options }: UseQueryOptions = {} + { enabled, ...options }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: jwtSigningKeysKeys.legacy(projectRef), diff --git a/apps/studio/data/lint/create-lint-rule-mutation.ts b/apps/studio/data/lint/create-lint-rule-mutation.ts index 11f0d8a1f59..37741c58dc0 100644 --- a/apps/studio/data/lint/create-lint-rule-mutation.ts +++ b/apps/studio/data/lint/create-lint-rule-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { components } from 'api-types' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { lintKeys } from './keys' type ExceptionPayload = components['schemas']['CreateNotificationExceptionsBody']['exceptions'][0] @@ -32,7 +32,7 @@ export const useLintRuleCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/lint/delete-lint-rule-mutation.ts b/apps/studio/data/lint/delete-lint-rule-mutation.ts index 4a2a43c98f2..5c255b7cd73 100644 --- a/apps/studio/data/lint/delete-lint-rule-mutation.ts +++ b/apps/studio/data/lint/delete-lint-rule-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { del, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { lintKeys } from './keys' export type LintRuleDeleteVariables = { @@ -26,7 +26,7 @@ export const useLintRuleDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/lint/lint-query.ts b/apps/studio/data/lint/lint-query.ts index bcb7fdf5be2..f73adbcbe74 100644 --- a/apps/studio/data/lint/lint-query.ts +++ b/apps/studio/data/lint/lint-query.ts @@ -1,10 +1,10 @@ -import { UseQueryOptions, useQuery } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { components } from 'api-types' import { get, handleError } from 'data/fetchers' import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject' import { PROJECT_STATUS } from 'lib/constants' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { lintKeys } from './keys' type ProjectLintsVariables = { @@ -32,7 +32,10 @@ export type ProjectLintsError = ResponseError export const useProjectLintsQuery = ( { projectRef }: ProjectLintsVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => { const { data: project } = useSelectedProjectQuery() const isActive = project?.status === PROJECT_STATUS.ACTIVE_HEALTHY diff --git a/apps/studio/data/lint/lint-rules-query.ts b/apps/studio/data/lint/lint-rules-query.ts index 7cdd94bfed9..56dd4c0ca9c 100644 --- a/apps/studio/data/lint/lint-rules-query.ts +++ b/apps/studio/data/lint/lint-rules-query.ts @@ -1,10 +1,10 @@ -import { UseQueryOptions, useQuery } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { components } from 'api-types' import { get, handleError } from 'data/fetchers' import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject' import { PROJECT_STATUS } from 'lib/constants' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { lintKeys } from './keys' type ProjectLintRulesVariables = { @@ -37,7 +37,7 @@ export const useProjectLintRulesQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => { const { data: project } = useSelectedProjectQuery() const isActive = project?.status === PROJECT_STATUS.ACTIVE_HEALTHY diff --git a/apps/studio/data/log-drains/create-log-drain-mutation.ts b/apps/studio/data/log-drains/create-log-drain-mutation.ts index afc9467afd7..4b92b00a9e0 100644 --- a/apps/studio/data/log-drains/create-log-drain-mutation.ts +++ b/apps/studio/data/log-drains/create-log-drain-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { LogDrainType } from 'components/interfaces/LogDrains/LogDrains.constants' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { logDrainsKeys } from './keys' export type LogDrainCreateVariables = { @@ -36,7 +36,7 @@ export const useCreateLogDrainMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/log-drains/delete-log-drain-mutation.ts b/apps/studio/data/log-drains/delete-log-drain-mutation.ts index 075e11fa223..cfe481deded 100644 --- a/apps/studio/data/log-drains/delete-log-drain-mutation.ts +++ b/apps/studio/data/log-drains/delete-log-drain-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { del, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { logDrainsKeys } from './keys' export type LogDrainDeleteVariables = { @@ -27,7 +27,7 @@ export const useDeleteLogDrainMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/log-drains/log-drains-query.ts b/apps/studio/data/log-drains/log-drains-query.ts index bcc5a349e09..a5d616e5abf 100644 --- a/apps/studio/data/log-drains/log-drains-query.ts +++ b/apps/studio/data/log-drains/log-drains-query.ts @@ -1,6 +1,6 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { logDrainsKeys } from './keys' export type LogDrainsVariables = { @@ -30,7 +30,7 @@ export type LogDrainsyError = ResponseError export const useLogDrainsQuery = ( { ref }: LogDrainsVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: logDrainsKeys.list(ref), diff --git a/apps/studio/data/log-drains/update-log-drain-mutation.ts b/apps/studio/data/log-drains/update-log-drain-mutation.ts index 05f681088e9..88ae9d54c99 100644 --- a/apps/studio/data/log-drains/update-log-drain-mutation.ts +++ b/apps/studio/data/log-drains/update-log-drain-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { LogDrainType } from 'components/interfaces/LogDrains/LogDrains.constants' import { handleError, put } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { logDrainsKeys } from './keys' export type LogDrainUpdateVariables = { @@ -41,7 +41,7 @@ export const useUpdateLogDrainMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/logs/get-unified-logs.ts b/apps/studio/data/logs/get-unified-logs.ts index 66ebdfb4ee5..2151c5c11c0 100644 --- a/apps/studio/data/logs/get-unified-logs.ts +++ b/apps/studio/data/logs/get-unified-logs.ts @@ -1,10 +1,10 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { getUnifiedLogsQuery } from 'components/interfaces/UnifiedLogs/UnifiedLogs.queries' import { QuerySearchParamsType } from 'components/interfaces/UnifiedLogs/UnifiedLogs.types' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { getUnifiedLogsISOStartEnd } from './unified-logs-infinite-query' export type getUnifiedLogsVariables = { @@ -69,7 +69,7 @@ export const useGetUnifiedLogsMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/logs/unified-log-inspection-query.ts b/apps/studio/data/logs/unified-log-inspection-query.ts index a9be4009fec..b23d231c2f9 100644 --- a/apps/studio/data/logs/unified-log-inspection-query.ts +++ b/apps/studio/data/logs/unified-log-inspection-query.ts @@ -1,4 +1,4 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { getAuthServiceFlowQuery, @@ -9,7 +9,7 @@ import { } from 'components/interfaces/UnifiedLogs/Queries/ServiceFlowQueries/ServiceFlow.sql' import { QuerySearchParamsType } from 'components/interfaces/UnifiedLogs/UnifiedLogs.types' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { logsKeys } from './keys' import { getUnifiedLogsISOStartEnd, @@ -178,7 +178,7 @@ export const useUnifiedLogInspectionQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: logsKeys.serviceFlow(projectRef, search, logId), diff --git a/apps/studio/data/logs/unified-logs-chart-query.ts b/apps/studio/data/logs/unified-logs-chart-query.ts index 90039ac1484..f795c9f199f 100644 --- a/apps/studio/data/logs/unified-logs-chart-query.ts +++ b/apps/studio/data/logs/unified-logs-chart-query.ts @@ -1,10 +1,11 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { getLogsChartQuery } from 'components/interfaces/UnifiedLogs/UnifiedLogs.queries' import { handleError, post } from 'data/fetchers' import { ExecuteSqlError } from 'data/sql/execute-sql-query' import { logsKeys } from './keys' import { UNIFIED_LOGS_QUERY_OPTIONS, UnifiedLogsVariables } from './unified-logs-infinite-query' +import { UseCustomQueryOptions } from 'types' export async function getUnifiedLogsChart( { projectRef, search }: UnifiedLogsVariables, @@ -148,7 +149,7 @@ export const useUnifiedLogsChartQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: logsKeys.unifiedLogsChart(projectRef, search), diff --git a/apps/studio/data/logs/unified-logs-count-query.ts b/apps/studio/data/logs/unified-logs-count-query.ts index b6511469dc5..b0408e15499 100644 --- a/apps/studio/data/logs/unified-logs-count-query.ts +++ b/apps/studio/data/logs/unified-logs-count-query.ts @@ -1,9 +1,10 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { getLogsCountQuery } from 'components/interfaces/UnifiedLogs/UnifiedLogs.queries' import { FacetMetadataSchema } from 'components/interfaces/UnifiedLogs/UnifiedLogs.schema' import { handleError, post } from 'data/fetchers' import { ExecuteSqlError } from 'data/sql/execute-sql-query' +import { UseCustomQueryOptions } from 'types' import { logsKeys } from './keys' import { getUnifiedLogsISOStartEnd, @@ -81,7 +82,7 @@ export const useUnifiedLogsCountQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: logsKeys.unifiedLogsCount(projectRef, search), diff --git a/apps/studio/data/logs/unified-logs-facet-count-query.ts b/apps/studio/data/logs/unified-logs-facet-count-query.ts index c6241a51e12..d8767876135 100644 --- a/apps/studio/data/logs/unified-logs-facet-count-query.ts +++ b/apps/studio/data/logs/unified-logs-facet-count-query.ts @@ -1,4 +1,4 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { getFacetCountCTE, @@ -7,6 +7,7 @@ import { import { Option } from 'components/ui/DataTable/DataTable.types' import { handleError, post } from 'data/fetchers' import { ExecuteSqlError } from 'data/sql/execute-sql-query' +import { UseCustomQueryOptions } from 'types' import { logsKeys } from './keys' import { getUnifiedLogsISOStartEnd, @@ -51,7 +52,7 @@ export const useUnifiedLogsFacetCountQuery = { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: logsKeys.unifiedLogsFacetCount(projectRef, facet, facetSearch, search), diff --git a/apps/studio/data/logs/unified-logs-infinite-query.ts b/apps/studio/data/logs/unified-logs-infinite-query.ts index 3dc22ee8f62..70bb70e9322 100644 --- a/apps/studio/data/logs/unified-logs-infinite-query.ts +++ b/apps/studio/data/logs/unified-logs-infinite-query.ts @@ -1,4 +1,4 @@ -import { useInfiniteQuery, UseInfiniteQueryOptions } from '@tanstack/react-query' +import { useInfiniteQuery } from '@tanstack/react-query' import { getUnifiedLogsQuery } from 'components/interfaces/UnifiedLogs/UnifiedLogs.queries' import { @@ -6,7 +6,7 @@ import { QuerySearchParamsType, } from 'components/interfaces/UnifiedLogs/UnifiedLogs.types' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomInfiniteQueryOptions } from 'types' import { logsKeys } from './keys' const LOGS_PAGE_LIMIT = 50 @@ -159,7 +159,7 @@ export const useUnifiedLogsInfiniteQuery = ( { enabled = true, ...options - }: UseInfiniteQueryOptions = {} + }: UseCustomInfiniteQueryOptions = {} ) => { return useInfiniteQuery({ queryKey: logsKeys.unifiedLogsInfinite(projectRef, search), diff --git a/apps/studio/data/materialized-views/materialized-views-query.ts b/apps/studio/data/materialized-views/materialized-views-query.ts index 331e40543e3..353e0eba606 100644 --- a/apps/studio/data/materialized-views/materialized-views-query.ts +++ b/apps/studio/data/materialized-views/materialized-views-query.ts @@ -1,10 +1,10 @@ -import { UseQueryOptions, useQuery } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' +import { DEFAULT_PLATFORM_APPLICATION_NAME } from '@supabase/pg-meta/src/constants' import { PostgresMaterializedView } from '@supabase/postgres-meta' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { materializedViewKeys } from './keys' -import { DEFAULT_PLATFORM_APPLICATION_NAME } from '@supabase/pg-meta/src/constants' export type MaterializedViewsVariables = { projectRef?: string @@ -49,7 +49,7 @@ export const useMaterializedViewsQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: schema diff --git a/apps/studio/data/misc/audit-login-mutation.ts b/apps/studio/data/misc/audit-login-mutation.ts index 3e2cca8c7a3..780fefae075 100644 --- a/apps/studio/data/misc/audit-login-mutation.ts +++ b/apps/studio/data/misc/audit-login-mutation.ts @@ -1,9 +1,9 @@ import * as Sentry from '@sentry/nextjs' -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export async function addLoginEvent() { const { error } = await post('/platform/profile/audit-login') @@ -18,7 +18,7 @@ export const useAddLoginEvent = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/misc/cli-release-version-query.ts b/apps/studio/data/misc/cli-release-version-query.ts index 3a509167dc2..653a4f2e31d 100644 --- a/apps/studio/data/misc/cli-release-version-query.ts +++ b/apps/studio/data/misc/cli-release-version-query.ts @@ -1,8 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { fetchHandler } from 'data/fetchers' import { BASE_PATH, IS_PLATFORM } from 'lib/constants' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { miscKeys } from './keys' export async function getCLIReleaseVersion() { @@ -22,7 +22,7 @@ export type CLIReleaseVersionError = ResponseError export const useCLIReleaseVersionQuery = ({ enabled = true, ...options -}: UseQueryOptions = {}) => +}: UseCustomQueryOptions = {}) => useQuery({ queryKey: miscKeys.cliReleaseVersion(), queryFn: () => getCLIReleaseVersion(), diff --git a/apps/studio/data/misc/get-default-region-query.ts b/apps/studio/data/misc/get-default-region-query.ts index 104f88ef991..c178769745d 100644 --- a/apps/studio/data/misc/get-default-region-query.ts +++ b/apps/studio/data/misc/get-default-region-query.ts @@ -1,4 +1,4 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { useFlag } from 'common' import { COUNTRY_LAT_LON } from 'components/interfaces/ProjectCreation/ProjectCreation.constants' @@ -10,7 +10,7 @@ import { fetchHandler } from 'data/fetchers' import { getDistanceLatLonKM, tryParseJson } from 'lib/helpers' import type { CloudProvider } from 'shared-data' import { AWS_REGIONS, FLY_REGIONS } from 'shared-data' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { miscKeys } from './keys' export type DefaultRegionVariables = { @@ -70,7 +70,10 @@ export type DefaultRegionError = ResponseError export const useDefaultRegionQuery = ( { cloudProvider, useRestrictedPool }: DefaultRegionVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => { // [Joshen] Flag allows us to specify restricted regions for users based on percentage const restrictedPoolFlag = useFlag('defaultRegionRestrictedPool') diff --git a/apps/studio/data/misc/reset-password-mutation.ts b/apps/studio/data/misc/reset-password-mutation.ts index a2d92053d4c..1b302852661 100644 --- a/apps/studio/data/misc/reset-password-mutation.ts +++ b/apps/studio/data/misc/reset-password-mutation.ts @@ -1,9 +1,9 @@ import * as Sentry from '@sentry/nextjs' -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' const WHITELIST_ERRORS = ['email must be an email'] @@ -30,7 +30,7 @@ export const useResetPasswordMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/misc/signup-mutation.ts b/apps/studio/data/misc/signup-mutation.ts index c8ecc47f43e..73530e341fa 100644 --- a/apps/studio/data/misc/signup-mutation.ts +++ b/apps/studio/data/misc/signup-mutation.ts @@ -1,9 +1,9 @@ import * as Sentry from '@sentry/nextjs' -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' const WHITELIST_ERRORS = [ 'A user with this email already exists', @@ -36,7 +36,10 @@ export const useSignUpMutation = ({ onSuccess, onError, ...options -}: Omit, 'mutationFn'> = {}) => { +}: Omit< + UseCustomMutationOptions, + 'mutationFn' +> = {}) => { return useMutation({ mutationFn: (vars) => signup(vars), async onSuccess(data, variables, context) { diff --git a/apps/studio/data/misc/user-ip-address-query.ts b/apps/studio/data/misc/user-ip-address-query.ts index 205b6abf59f..20233f6f345 100644 --- a/apps/studio/data/misc/user-ip-address-query.ts +++ b/apps/studio/data/misc/user-ip-address-query.ts @@ -1,8 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { fetchHandler } from 'data/fetchers' import { BASE_PATH, IS_PLATFORM } from 'lib/constants' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { miscKeys } from './keys' export async function getUserIPAddress() { @@ -20,7 +20,7 @@ export type UserIPAddressError = ResponseError export const useUserIPAddressQuery = ({ enabled = true, ...options -}: UseQueryOptions = {}) => +}: UseCustomQueryOptions = {}) => useQuery({ queryKey: miscKeys.ipAddress(), queryFn: () => getUserIPAddress(), diff --git a/apps/studio/data/network-restrictions/network-restrictions-query.ts b/apps/studio/data/network-restrictions/network-restrictions-query.ts index 40ac1db3943..7337ef6f481 100644 --- a/apps/studio/data/network-restrictions/network-restrictions-query.ts +++ b/apps/studio/data/network-restrictions/network-restrictions-query.ts @@ -1,7 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' import { networkRestrictionKeys } from './keys' +import { UseCustomQueryOptions } from 'types' export type NetworkRestrictionsVariables = { projectRef?: string } @@ -53,7 +54,7 @@ export const useNetworkRestrictionsQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: networkRestrictionKeys.list(projectRef), diff --git a/apps/studio/data/network-restrictions/network-retrictions-apply-mutation.ts b/apps/studio/data/network-restrictions/network-retrictions-apply-mutation.ts index cceb2c51c86..48b69f79e33 100644 --- a/apps/studio/data/network-restrictions/network-retrictions-apply-mutation.ts +++ b/apps/studio/data/network-restrictions/network-retrictions-apply-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { networkRestrictionKeys } from './keys' export type NetworkRestrictionsApplyVariables = { @@ -34,7 +34,7 @@ export const useNetworkRestrictionsApplyMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< NetworkRestrictionsApplyData, ResponseError, NetworkRestrictionsApplyVariables diff --git a/apps/studio/data/notifications/notifications-v2-archive-all-mutation.ts b/apps/studio/data/notifications/notifications-v2-archive-all-mutation.ts index 83ddae2501a..781c446c681 100644 --- a/apps/studio/data/notifications/notifications-v2-archive-all-mutation.ts +++ b/apps/studio/data/notifications/notifications-v2-archive-all-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, patch } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { notificationKeys } from './keys' export async function archiveAllNotifications() { @@ -20,7 +20,10 @@ export const useNotificationsArchiveAllMutation = ({ onSuccess, onError, ...options -}: Omit, 'mutationFn'> = {}) => { +}: Omit< + UseCustomMutationOptions, + 'mutationFn' +> = {}) => { const queryClient = useQueryClient() return useMutation({ mutationFn: () => archiveAllNotifications(), diff --git a/apps/studio/data/notifications/notifications-v2-query.ts b/apps/studio/data/notifications/notifications-v2-query.ts index a98e3b2a677..ffd00de107d 100644 --- a/apps/studio/data/notifications/notifications-v2-query.ts +++ b/apps/studio/data/notifications/notifications-v2-query.ts @@ -1,8 +1,8 @@ -import { useInfiniteQuery, UseInfiniteQueryOptions } from '@tanstack/react-query' +import { useInfiniteQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' import type { components } from 'data/api' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomInfiniteQueryOptions } from 'types' import { notificationKeys } from './keys' const NOTIFICATIONS_PAGE_LIMIT = 10 @@ -66,7 +66,7 @@ export const useNotificationsV2Query = ( { enabled = true, ...options - }: UseInfiniteQueryOptions = {} + }: UseCustomInfiniteQueryOptions = {} ) => { return useInfiniteQuery({ queryKey: notificationKeys.listV2({ status, filters, limit }), diff --git a/apps/studio/data/notifications/notifications-v2-summary-query.ts b/apps/studio/data/notifications/notifications-v2-summary-query.ts index ae06cdd01ff..489e89d7641 100644 --- a/apps/studio/data/notifications/notifications-v2-summary-query.ts +++ b/apps/studio/data/notifications/notifications-v2-summary-query.ts @@ -1,8 +1,8 @@ import type { Notification } from '@supabase/shared-types/out/notifications' -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { notificationKeys } from './keys' export type NotificationsResponse = Notification[] @@ -19,7 +19,7 @@ export type NotificationsData = Awaited( - options: UseQueryOptions = {} + options: UseCustomQueryOptions = {} ) => useQuery({ queryKey: notificationKeys.summary(), diff --git a/apps/studio/data/notifications/notifications-v2-update-mutation.ts b/apps/studio/data/notifications/notifications-v2-update-mutation.ts index 3747cce4a6b..4e4586c2cfc 100644 --- a/apps/studio/data/notifications/notifications-v2-update-mutation.ts +++ b/apps/studio/data/notifications/notifications-v2-update-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, patch } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type NotificationsUpdateVariables = { ids: string[] @@ -27,7 +27,7 @@ export const useNotificationsV2UpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/oauth-secrets/client-secret-create-mutation.ts b/apps/studio/data/oauth-secrets/client-secret-create-mutation.ts index 1cce6c6fcac..8a6bede51e3 100644 --- a/apps/studio/data/oauth-secrets/client-secret-create-mutation.ts +++ b/apps/studio/data/oauth-secrets/client-secret-create-mutation.ts @@ -1,7 +1,7 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { handleError, post } from 'data/fetchers' import { toast } from 'sonner' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { clientSecretKeys } from './keys' export type ClientSecretCreateVariables = { @@ -23,7 +23,7 @@ export const useClientSecretCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/oauth-secrets/client-secret-delete-mutation.ts b/apps/studio/data/oauth-secrets/client-secret-delete-mutation.ts index 0b96c249c5d..1fb503cfb87 100644 --- a/apps/studio/data/oauth-secrets/client-secret-delete-mutation.ts +++ b/apps/studio/data/oauth-secrets/client-secret-delete-mutation.ts @@ -1,7 +1,7 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { del, handleError } from 'data/fetchers' import { toast } from 'sonner' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { clientSecretKeys } from './keys' export type ClientSecretDeleteVariables = { @@ -24,7 +24,7 @@ export const useClientSecretDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/oauth-secrets/client-secrets-query.ts b/apps/studio/data/oauth-secrets/client-secrets-query.ts index 1e29456b08e..4d509d25fa7 100644 --- a/apps/studio/data/oauth-secrets/client-secrets-query.ts +++ b/apps/studio/data/oauth-secrets/client-secrets-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { clientSecretKeys } from './keys' import { components } from 'api-types' @@ -49,7 +49,10 @@ export type ClientSecretsError = ResponseError export const useClientSecretsQuery = ( { slug, appId }: ClientSecretsVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: clientSecretKeys.list(slug, appId), diff --git a/apps/studio/data/oauth-server-apps/oauth-server-app-create-mutation.ts b/apps/studio/data/oauth-server-apps/oauth-server-app-create-mutation.ts index 019e43cb73a..231e5887748 100644 --- a/apps/studio/data/oauth-server-apps/oauth-server-app-create-mutation.ts +++ b/apps/studio/data/oauth-server-apps/oauth-server-app-create-mutation.ts @@ -1,9 +1,9 @@ import { CreateOAuthClientParams, SupabaseClient } from '@supabase/supabase-js' -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { oauthServerAppKeys } from './keys' export type OAuthServerAppCreateVariables = CreateOAuthClientParams & { @@ -32,7 +32,7 @@ export const useOAuthServerAppCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/oauth-server-apps/oauth-server-app-delete-mutation.ts b/apps/studio/data/oauth-server-apps/oauth-server-app-delete-mutation.ts index 460de8fbe6d..c76af7b7621 100644 --- a/apps/studio/data/oauth-server-apps/oauth-server-app-delete-mutation.ts +++ b/apps/studio/data/oauth-server-apps/oauth-server-app-delete-mutation.ts @@ -1,9 +1,9 @@ import { SupabaseClient } from '@supabase/supabase-js' -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { oauthServerAppKeys } from './keys' export type OAuthServerAppDeleteVariables = { @@ -34,7 +34,7 @@ export const useOAuthServerAppDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/oauth-server-apps/oauth-server-app-regenerate-secret-mutation.ts b/apps/studio/data/oauth-server-apps/oauth-server-app-regenerate-secret-mutation.ts index e9e4c2c862c..e049ee20e01 100644 --- a/apps/studio/data/oauth-server-apps/oauth-server-app-regenerate-secret-mutation.ts +++ b/apps/studio/data/oauth-server-apps/oauth-server-app-regenerate-secret-mutation.ts @@ -1,9 +1,9 @@ import { SupabaseClient } from '@supabase/supabase-js' -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { oauthServerAppKeys } from './keys' export type OAuthServerAppRegenerateSecretVariables = { @@ -34,7 +34,7 @@ export const useOAuthServerAppRegenerateSecretMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< OAuthAppRegenerateSecretData, ResponseError, OAuthServerAppRegenerateSecretVariables diff --git a/apps/studio/data/oauth-server-apps/oauth-server-apps-query.ts b/apps/studio/data/oauth-server-apps/oauth-server-apps-query.ts index 7360db608cc..6b8740f39b2 100644 --- a/apps/studio/data/oauth-server-apps/oauth-server-apps-query.ts +++ b/apps/studio/data/oauth-server-apps/oauth-server-apps-query.ts @@ -1,9 +1,9 @@ import { SupabaseClient } from '@supabase/supabase-js' -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { components } from 'api-types' import { handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { oauthServerAppKeys } from './keys' export type OAuthServerAppsVariables = { @@ -41,7 +41,7 @@ export const useOAuthServerAppsQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => { return useQuery({ queryKey: oauthServerAppKeys.list(projectRef), diff --git a/apps/studio/data/oauth/authorized-app-revoke-mutation.ts b/apps/studio/data/oauth/authorized-app-revoke-mutation.ts index 5b9a0a6f353..75f071e7850 100644 --- a/apps/studio/data/oauth/authorized-app-revoke-mutation.ts +++ b/apps/studio/data/oauth/authorized-app-revoke-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { oauthAppKeys } from './keys' export type AuthorizedAppRevokeVariables = { @@ -29,7 +29,7 @@ export const useAuthorizedAppRevokeMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/oauth/authorized-apps-query.ts b/apps/studio/data/oauth/authorized-apps-query.ts index a56657ed174..ae2e87a1f10 100644 --- a/apps/studio/data/oauth/authorized-apps-query.ts +++ b/apps/studio/data/oauth/authorized-apps-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { oauthAppKeys } from './keys' export type AuthorizedAppsVariables = { @@ -37,7 +37,7 @@ export const useAuthorizedAppsQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: oauthAppKeys.authorizedApps(slug), diff --git a/apps/studio/data/oauth/oauth-app-create-mutation.ts b/apps/studio/data/oauth/oauth-app-create-mutation.ts index 43b7d495bae..74b0e6c4cc6 100644 --- a/apps/studio/data/oauth/oauth-app-create-mutation.ts +++ b/apps/studio/data/oauth/oauth-app-create-mutation.ts @@ -1,10 +1,10 @@ import type { OAuthScope } from '@supabase/shared-types/out/constants' -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { components } from 'api-types' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { oauthAppKeys } from './keys' export type OAuthAppCreateVariables = { @@ -48,7 +48,7 @@ export const useOAuthAppCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/oauth/oauth-app-delete-mutation.ts b/apps/studio/data/oauth/oauth-app-delete-mutation.ts index 51adba7fcb6..8f0a2806c35 100644 --- a/apps/studio/data/oauth/oauth-app-delete-mutation.ts +++ b/apps/studio/data/oauth/oauth-app-delete-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { del, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { oauthAppKeys } from './keys' export type OAuthAppDeleteVariables = { @@ -29,7 +29,7 @@ export const useOAuthAppDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/oauth/oauth-app-update-mutation.ts b/apps/studio/data/oauth/oauth-app-update-mutation.ts index c533853f84a..230c1038663 100644 --- a/apps/studio/data/oauth/oauth-app-update-mutation.ts +++ b/apps/studio/data/oauth/oauth-app-update-mutation.ts @@ -1,9 +1,9 @@ import type { OAuthScope } from '@supabase/shared-types/out/constants' -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, put } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { oauthAppKeys } from './keys' export type OAuthAppUpdateVariables = { @@ -52,7 +52,7 @@ export const useOAuthAppUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/oauth/oauth-apps-query.ts b/apps/studio/data/oauth/oauth-apps-query.ts index 4a9f392b69a..fe63efbc855 100644 --- a/apps/studio/data/oauth/oauth-apps-query.ts +++ b/apps/studio/data/oauth/oauth-apps-query.ts @@ -1,8 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { components } from 'api-types' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { oauthAppKeys } from './keys' export type OAuthAppsVariables = { @@ -27,7 +27,7 @@ export type OAuthAppsError = ResponseError export const useOAuthAppsQuery = ( { slug }: OAuthAppsVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: oauthAppKeys.oauthApps(slug), diff --git a/apps/studio/data/open-api/api-spec-query.ts b/apps/studio/data/open-api/api-spec-query.ts index 1fd001a9f32..b8f2a470fdc 100644 --- a/apps/studio/data/open-api/api-spec-query.ts +++ b/apps/studio/data/open-api/api-spec-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { openApiKeys } from './keys' export type OpenAPISpecVariables = { @@ -56,7 +56,10 @@ export type OpenAPISpecError = ResponseError export const useOpenAPISpecQuery = ( { projectRef }: OpenAPISpecVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: openApiKeys.apiSpec(projectRef), diff --git a/apps/studio/data/organization-members/organization-invitation-accept-mutation.ts b/apps/studio/data/organization-members/organization-invitation-accept-mutation.ts index 824c093343a..09764fb4ed3 100644 --- a/apps/studio/data/organization-members/organization-invitation-accept-mutation.ts +++ b/apps/studio/data/organization-members/organization-invitation-accept-mutation.ts @@ -1,10 +1,10 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' import { invalidateOrganizationsQuery } from 'data/organizations/organizations-query' import { useInvalidateProjectsInfiniteQuery } from 'data/projects/org-projects-infinite-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type OrganizationAcceptInvitationVariables = { slug: string @@ -30,7 +30,7 @@ export const useOrganizationAcceptInvitationMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< OrganizationMemberUpdateData, ResponseError, OrganizationAcceptInvitationVariables diff --git a/apps/studio/data/organization-members/organization-invitation-create-mutation.ts b/apps/studio/data/organization-members/organization-invitation-create-mutation.ts index 184f3f2adba..c22c8fe8bcf 100644 --- a/apps/studio/data/organization-members/organization-invitation-create-mutation.ts +++ b/apps/studio/data/organization-members/organization-invitation-create-mutation.ts @@ -1,10 +1,10 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { components } from 'api-types' import { handleError, post } from 'data/fetchers' import { organizationKeys as organizationKeysV1 } from 'data/organizations/keys' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { organizationKeys } from './keys' export type OrganizationCreateInvitationVariables = { @@ -39,7 +39,7 @@ export const useOrganizationCreateInvitationMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< OrganizationMemberUpdateData, ResponseError, OrganizationCreateInvitationVariables diff --git a/apps/studio/data/organization-members/organization-invitation-delete-mutation.ts b/apps/studio/data/organization-members/organization-invitation-delete-mutation.ts index eef180c15b3..30382c0e918 100644 --- a/apps/studio/data/organization-members/organization-invitation-delete-mutation.ts +++ b/apps/studio/data/organization-members/organization-invitation-delete-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { del, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { organizationKeys as organizationKeysV1 } from '../organizations/keys' import { organizationKeys } from './keys' @@ -31,7 +31,7 @@ export const useOrganizationDeleteInvitationMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< OrganizationDeleteInvitationData, ResponseError, OrganizationDeleteInvitationVariables diff --git a/apps/studio/data/organization-members/organization-invitation-token-query.ts b/apps/studio/data/organization-members/organization-invitation-token-query.ts index e65cc45b73e..5d59fb11a4f 100644 --- a/apps/studio/data/organization-members/organization-invitation-token-query.ts +++ b/apps/studio/data/organization-members/organization-invitation-token-query.ts @@ -1,9 +1,9 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' -import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' -import { organizationKeys } from './keys' import { components } from 'api-types' +import { get, handleError } from 'data/fetchers' +import type { ResponseError, UseCustomQueryOptions } from 'types' +import { organizationKeys } from './keys' export type OrganizationInviteTokenVariables = { slug?: string; token?: string } @@ -33,7 +33,7 @@ export const useOrganizationInvitationTokenQuery = = {} + }: UseCustomQueryOptions = {} ) => { return useQuery({ queryKey: organizationKeys.token(slug, token), diff --git a/apps/studio/data/organization-members/organization-member-role-assign-mutation.ts b/apps/studio/data/organization-members/organization-member-role-assign-mutation.ts index 80a9ee5567e..690b962cbb4 100644 --- a/apps/studio/data/organization-members/organization-member-role-assign-mutation.ts +++ b/apps/studio/data/organization-members/organization-member-role-assign-mutation.ts @@ -1,10 +1,10 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { components } from 'api-types' import { handleError, patch } from 'data/fetchers' import { organizationKeys as organizationKeysV1 } from 'data/organizations/keys' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { organizationKeys } from './keys' export type OrganizationMemberAssignRoleVariables = { @@ -41,7 +41,7 @@ export const useOrganizationMemberAssignRoleMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< OrganizationMemberAssignData, ResponseError, OrganizationMemberAssignRoleVariables diff --git a/apps/studio/data/organization-members/organization-member-role-unassign-mutation.ts b/apps/studio/data/organization-members/organization-member-role-unassign-mutation.ts index 593013f5183..a7afc010eb3 100644 --- a/apps/studio/data/organization-members/organization-member-role-unassign-mutation.ts +++ b/apps/studio/data/organization-members/organization-member-role-unassign-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { del, handleError } from 'data/fetchers' import { organizationKeys as organizationKeysV1 } from 'data/organizations/keys' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { organizationKeys } from './keys' export type OrganizationMemberUnassignRoleVariables = { @@ -42,7 +42,7 @@ export const useOrganizationMemberUnassignRoleMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< OrganizationMemberUnassignRoleData, ResponseError, OrganizationMemberUnassignRoleVariables diff --git a/apps/studio/data/organization-members/organization-member-role-update-mutation.ts b/apps/studio/data/organization-members/organization-member-role-update-mutation.ts index 8e52a5aa9d1..a964d973783 100644 --- a/apps/studio/data/organization-members/organization-member-role-update-mutation.ts +++ b/apps/studio/data/organization-members/organization-member-role-update-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, put } from 'data/fetchers' import { organizationKeys as organizationKeysV1 } from 'data/organizations/keys' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { organizationKeys } from './keys' export type OrganizationMemberUpdateRoleVariables = { @@ -41,7 +41,7 @@ export const useOrganizationMemberUpdateRoleMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< OrganizationMemberAssignData, ResponseError, OrganizationMemberUpdateRoleVariables diff --git a/apps/studio/data/organization-members/organization-roles-query.ts b/apps/studio/data/organization-members/organization-roles-query.ts index 1085ee8b73b..e6c7ae46c22 100644 --- a/apps/studio/data/organization-members/organization-roles-query.ts +++ b/apps/studio/data/organization-members/organization-roles-query.ts @@ -1,8 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import type { components } from 'api-types' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { organizationKeys } from './keys' export const FIXED_ROLE_ORDER = ['Owner', 'Administrator', 'Developer', 'Read-only'] @@ -34,7 +34,7 @@ export const useOrganizationRolesV2Query = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: organizationKeys.rolesV2(slug), diff --git a/apps/studio/data/organizations/free-project-limit-check-query.ts b/apps/studio/data/organizations/free-project-limit-check-query.ts index 1b37ebb8833..cbe0e24118e 100644 --- a/apps/studio/data/organizations/free-project-limit-check-query.ts +++ b/apps/studio/data/organizations/free-project-limit-check-query.ts @@ -1,8 +1,9 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { components } from 'api-types' import { get, handleError } from 'data/fetchers' import { organizationKeys } from './keys' +import { UseCustomQueryOptions } from 'types' export type MemberWithFreeProjectLimit = components['schemas']['MemberWithFreeProjectLimit'] @@ -36,7 +37,7 @@ export const useFreeProjectLimitCheckQuery = { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: organizationKeys.freeProjectLimitCheck(slug), diff --git a/apps/studio/data/organizations/organization-audit-logs-query.ts b/apps/studio/data/organizations/organization-audit-logs-query.ts index 0be36991c7a..1701003f185 100644 --- a/apps/studio/data/organizations/organization-audit-logs-query.ts +++ b/apps/studio/data/organizations/organization-audit-logs-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { organizationKeys } from './keys' export type AuditLog = { @@ -64,7 +64,7 @@ export const useOrganizationAuditLogsQuery = { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => { const { slug, iso_timestamp_start, iso_timestamp_end } = vars diff --git a/apps/studio/data/organizations/organization-available-regions-query.ts b/apps/studio/data/organizations/organization-available-regions-query.ts index 7d037845ae9..594880ec61e 100644 --- a/apps/studio/data/organizations/organization-available-regions-query.ts +++ b/apps/studio/data/organizations/organization-available-regions-query.ts @@ -1,8 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import type { operations } from 'api-types' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { organizationKeys } from './keys' export type DesiredInstanceSizeForAvailableRegions = @@ -44,7 +44,7 @@ export const useOrganizationAvailableRegionsQuery = = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: organizationKeys.subscriptionPreview(organizationSlug, tier), diff --git a/apps/studio/data/organizations/organization-by-fly-organization-id-mutation.ts b/apps/studio/data/organizations/organization-by-fly-organization-id-mutation.ts index 4e015facf5e..a93098c48d7 100644 --- a/apps/studio/data/organizations/organization-by-fly-organization-id-mutation.ts +++ b/apps/studio/data/organizations/organization-by-fly-organization-id-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type OrganizationByFlyOrgIdVariables = { flyOrganizationId: string @@ -28,7 +28,11 @@ export const useOrganizationByFlyOrgIdMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + OrganizationByFlyOrgIdData, + ResponseError, + OrganizationByFlyOrgIdVariables + >, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/organizations/organization-create-mutation.ts b/apps/studio/data/organizations/organization-create-mutation.ts index cab7a6b97fb..f18a8bf2f80 100644 --- a/apps/studio/data/organizations/organization-create-mutation.ts +++ b/apps/studio/data/organizations/organization-create-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' import { permissionKeys } from 'data/permissions/keys' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { organizationKeys } from './keys' import { castOrganizationResponseToOrganization } from './organizations-query' import type { CustomerAddress, CustomerTaxId } from './types' @@ -53,7 +53,7 @@ export const useOrganizationCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() @@ -125,7 +125,7 @@ export const useAwsManagedOrganizationCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< AwsManagedOrganizationCreateData, ResponseError, AwsManagedOrganizationCreateVariables diff --git a/apps/studio/data/organizations/organization-credit-top-up-mutation.ts b/apps/studio/data/organizations/organization-credit-top-up-mutation.ts index 7e8e984b3da..b39996ab60f 100644 --- a/apps/studio/data/organizations/organization-credit-top-up-mutation.ts +++ b/apps/studio/data/organizations/organization-credit-top-up-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import type { CustomerAddress, CustomerTaxId } from './types' export type OrganizationCreditTopUpVariables = { @@ -64,7 +64,11 @@ export const useOrganizationCreditTopUpMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + OrganizationTaxIdUpdateData, + ResponseError, + OrganizationCreditTopUpVariables + >, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/organizations/organization-customer-profile-query.ts b/apps/studio/data/organizations/organization-customer-profile-query.ts index 8545bba1794..da637ca5dc7 100644 --- a/apps/studio/data/organizations/organization-customer-profile-query.ts +++ b/apps/studio/data/organizations/organization-customer-profile-query.ts @@ -1,11 +1,11 @@ import { PermissionAction } from '@supabase/shared-types/out/constants' -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' +import { IS_PLATFORM } from 'common' import { get, handleError } from 'data/fetchers' import { useAsyncCheckPermissions } from 'hooks/misc/useCheckPermissions' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { organizationKeys } from './keys' -import { IS_PLATFORM } from 'common' export type OrganizationCustomerProfileVariables = { slug?: string @@ -40,7 +40,11 @@ export const useOrganizationCustomerProfileQuery = = {} + }: UseCustomQueryOptions< + OrganizationCustomerProfileData, + OrganizationCustomerProfileError, + TData + > = {} ) => { // [Joshen] Thinking it makes sense to add this check at the RQ level - prevent // unnecessary requests, although this behaviour still needs handling on the UI diff --git a/apps/studio/data/organizations/organization-customer-profile-update-mutation.ts b/apps/studio/data/organizations/organization-customer-profile-update-mutation.ts index f396cae3352..bc7507948ca 100644 --- a/apps/studio/data/organizations/organization-customer-profile-update-mutation.ts +++ b/apps/studio/data/organizations/organization-customer-profile-update-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, put } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { organizationKeys } from './keys' import type { CustomerAddress } from './types' @@ -43,7 +43,7 @@ export const useOrganizationCustomerProfileUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< OrganizationCustomerProfileUpdateData, ResponseError, OrganizationCustomerProfileUpdateVariables diff --git a/apps/studio/data/organizations/organization-delete-mutation.ts b/apps/studio/data/organizations/organization-delete-mutation.ts index e303cbdc374..d825d20b937 100644 --- a/apps/studio/data/organizations/organization-delete-mutation.ts +++ b/apps/studio/data/organizations/organization-delete-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { del, handleError } from 'data/fetchers' import { permissionKeys } from 'data/permissions/keys' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { organizationKeys } from './keys' export type OrganizationDeleteVariables = { @@ -25,7 +25,7 @@ export const useOrganizationDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/organizations/organization-link-aws-marketplace-mutation.ts b/apps/studio/data/organizations/organization-link-aws-marketplace-mutation.ts index 829ae1c2432..79e3cbd7671 100644 --- a/apps/studio/data/organizations/organization-link-aws-marketplace-mutation.ts +++ b/apps/studio/data/organizations/organization-link-aws-marketplace-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' +import type { ResponseError, UseCustomMutationOptions } from '../../types' import { handleError, put } from '../fetchers' -import type { ResponseError } from '../../types' export type OrganizationLinkAwsMarketplaceVariables = { buyerId: string @@ -29,7 +29,11 @@ export const useOrganizationLinkAwsMarketplaceMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + LinkOrganizationData, + ResponseError, + OrganizationLinkAwsMarketplaceVariables + >, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/organizations/organization-member-delete-mutation.ts b/apps/studio/data/organizations/organization-member-delete-mutation.ts index dc4a9e0f0e5..cdff3635248 100644 --- a/apps/studio/data/organizations/organization-member-delete-mutation.ts +++ b/apps/studio/data/organizations/organization-member-delete-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { del, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { organizationKeys } from './keys' export type OrganizationMemberDeleteVariables = { @@ -28,7 +28,7 @@ export const useOrganizationMemberDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< OrganizationMemberDeleteData, ResponseError, OrganizationMemberDeleteVariables diff --git a/apps/studio/data/organizations/organization-members-query.ts b/apps/studio/data/organizations/organization-members-query.ts index 444c3580ee2..6cc5cf0edf7 100644 --- a/apps/studio/data/organizations/organization-members-query.ts +++ b/apps/studio/data/organizations/organization-members-query.ts @@ -1,8 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import type { components } from 'data/api' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { organizationKeys } from './keys' export type OrganizationMembersVariables = { @@ -58,7 +58,7 @@ export const useOrganizationMembersQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: organizationKeys.members(slug), diff --git a/apps/studio/data/organizations/organization-mfa-mutation.ts b/apps/studio/data/organizations/organization-mfa-mutation.ts index b0e964d6a7f..b07fbb5c666 100644 --- a/apps/studio/data/organizations/organization-mfa-mutation.ts +++ b/apps/studio/data/organizations/organization-mfa-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' -import { patch, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import { handleError, patch } from 'data/fetchers' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { organizationKeys } from './keys' export type OrganizationMfaToggleVariables = { @@ -29,7 +29,11 @@ export const useOrganizationMfaToggleMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + OrganizationMfaToggleData, + ResponseError, + OrganizationMfaToggleVariables + >, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/organizations/organization-mfa-query.ts b/apps/studio/data/organizations/organization-mfa-query.ts index 0105816198e..cd847011bb9 100644 --- a/apps/studio/data/organizations/organization-mfa-query.ts +++ b/apps/studio/data/organizations/organization-mfa-query.ts @@ -1,6 +1,6 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { organizationKeys } from './keys' export type OrganizationMfaVariables = { @@ -29,7 +29,7 @@ export type OrganizationMfaError = ResponseError export const useOrganizationMfaQuery = ( { slug }: OrganizationMfaVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: organizationKeys.mfa(slug), diff --git a/apps/studio/data/organizations/organization-payment-method-default-mutation.ts b/apps/studio/data/organizations/organization-payment-method-default-mutation.ts index fd0b6f1c2d7..a513308853c 100644 --- a/apps/studio/data/organizations/organization-payment-method-default-mutation.ts +++ b/apps/studio/data/organizations/organization-payment-method-default-mutation.ts @@ -1,7 +1,7 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { handleError, put } from 'data/fetchers' import { toast } from 'sonner' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { organizationKeys } from './keys' export type OrganizationPaymentMethodDefaultVariables = { @@ -34,7 +34,7 @@ export const useOrganizationPaymentMethodMarkAsDefaultMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< OrganizationPaymentMethodDefaultData, ResponseError, OrganizationPaymentMethodDefaultVariables diff --git a/apps/studio/data/organizations/organization-payment-method-delete-mutation.ts b/apps/studio/data/organizations/organization-payment-method-delete-mutation.ts index 35cc15ed959..628f0c79047 100644 --- a/apps/studio/data/organizations/organization-payment-method-delete-mutation.ts +++ b/apps/studio/data/organizations/organization-payment-method-delete-mutation.ts @@ -1,7 +1,7 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { del, handleError } from 'data/fetchers' import { toast } from 'sonner' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { organizationKeys } from './keys' export type OrganizationPaymentMethodDeleteVariables = { @@ -35,7 +35,7 @@ export const useOrganizationPaymentMethodDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< OrganizationPaymentMethodDeleteData, ResponseError, OrganizationPaymentMethodDeleteVariables diff --git a/apps/studio/data/organizations/organization-payment-method-setup-intent-mutation.ts b/apps/studio/data/organizations/organization-payment-method-setup-intent-mutation.ts index 044ef993f3c..fc1a245d289 100644 --- a/apps/studio/data/organizations/organization-payment-method-setup-intent-mutation.ts +++ b/apps/studio/data/organizations/organization-payment-method-setup-intent-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type OrganizationPaymentMethodSetupIntentVariables = { slug: string @@ -30,7 +30,7 @@ export const useOrganizationPaymentMethodSetupIntent = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< OrganizationPaymentMethodSetupIntentData, ResponseError, OrganizationPaymentMethodSetupIntentVariables diff --git a/apps/studio/data/organizations/organization-payment-methods-query.ts b/apps/studio/data/organizations/organization-payment-methods-query.ts index a2571a3ddb2..f346893e6fd 100644 --- a/apps/studio/data/organizations/organization-payment-methods-query.ts +++ b/apps/studio/data/organizations/organization-payment-methods-query.ts @@ -1,10 +1,10 @@ import { PermissionAction } from '@supabase/shared-types/out/constants' -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { components } from 'api-types' import { get, handleError } from 'data/fetchers' import { useAsyncCheckPermissions } from 'hooks/misc/useCheckPermissions' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { organizationKeys } from './keys' export type OrganizationPaymentMethodsVariables = { slug?: string } @@ -42,7 +42,11 @@ export const useOrganizationPaymentMethodsQuery = = {} + }: UseCustomQueryOptions< + OrganizationPaymentMethodsData, + OrganizationPaymentMethodsError, + TData + > = {} ) => { const { can: canReadSubscriptions } = useAsyncCheckPermissions( PermissionAction.BILLING_READ, diff --git a/apps/studio/data/organizations/organization-project-claim-mutation.ts b/apps/studio/data/organizations/organization-project-claim-mutation.ts index 9a3e7223e81..3598be82d21 100644 --- a/apps/studio/data/organizations/organization-project-claim-mutation.ts +++ b/apps/studio/data/organizations/organization-project-claim-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' type OrganizationProjectClaimVariables = { slug: string @@ -24,7 +24,7 @@ export const useOrganizationProjectClaimMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< ClaimOrganizationProjectData, ResponseError, OrganizationProjectClaimVariables diff --git a/apps/studio/data/organizations/organization-project-claim-query.ts b/apps/studio/data/organizations/organization-project-claim-query.ts index c8abadb23bd..7b86012b2a8 100644 --- a/apps/studio/data/organizations/organization-project-claim-query.ts +++ b/apps/studio/data/organizations/organization-project-claim-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' -import { organizationKeys } from './keys' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' +import { organizationKeys } from './keys' type OrganizationProjectClaimVariables = { slug: string @@ -67,7 +67,7 @@ export const useOrganizationProjectClaimQuery = = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: organizationKeys.projectClaim(slug, token), diff --git a/apps/studio/data/organizations/organization-query.ts b/apps/studio/data/organizations/organization-query.ts index fe46fab8676..f761e6b2a1e 100644 --- a/apps/studio/data/organizations/organization-query.ts +++ b/apps/studio/data/organizations/organization-query.ts @@ -1,8 +1,8 @@ -import { QueryClient, useQuery, UseQueryOptions } from '@tanstack/react-query' +import { QueryClient, useQuery } from '@tanstack/react-query' import { components } from 'api-types' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { organizationKeys } from './keys' export type OrganizationVariables = { slug?: string } @@ -35,7 +35,10 @@ export type OrganizationsError = ResponseError export const useOrganizationQuery = ( { slug }: OrganizationVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => { return useQuery({ queryKey: organizationKeys.detail(slug), @@ -47,5 +50,5 @@ export const useOrganizationQuery = ( } export function invalidateOrganizationsQuery(client: QueryClient) { - return client.invalidateQueries(organizationKeys.list()) + return client.invalidateQueries({ queryKey: organizationKeys.list() }) } diff --git a/apps/studio/data/organizations/organization-tax-id-query.ts b/apps/studio/data/organizations/organization-tax-id-query.ts index fe4ea3ab0a3..19e148b9ebc 100644 --- a/apps/studio/data/organizations/organization-tax-id-query.ts +++ b/apps/studio/data/organizations/organization-tax-id-query.ts @@ -1,10 +1,10 @@ import { PermissionAction } from '@supabase/shared-types/out/constants' -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { components } from 'api-types' import { get, handleError } from 'data/fetchers' import { useAsyncCheckPermissions } from 'hooks/misc/useCheckPermissions' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { organizationKeys } from './keys' export type OrganizationTaxIdVariables = { @@ -34,7 +34,7 @@ export const useOrganizationTaxIdQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => { const { can: canReadSubscriptions } = useAsyncCheckPermissions( PermissionAction.BILLING_READ, diff --git a/apps/studio/data/organizations/organization-tax-id-update-mutation.ts b/apps/studio/data/organizations/organization-tax-id-update-mutation.ts index 2feea64e7d4..19d1a1dc9d7 100644 --- a/apps/studio/data/organizations/organization-tax-id-update-mutation.ts +++ b/apps/studio/data/organizations/organization-tax-id-update-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { del, handleError, put } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { organizationKeys } from './keys' export type OrganizationTaxIdUpdateVariables = { @@ -54,7 +54,11 @@ export const useOrganizationTaxIdUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + OrganizationTaxIdUpdateData, + ResponseError, + OrganizationTaxIdUpdateVariables + >, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/organizations/organization-update-mutation.ts b/apps/studio/data/organizations/organization-update-mutation.ts index 81a22616fd3..272d332bd43 100644 --- a/apps/studio/data/organizations/organization-update-mutation.ts +++ b/apps/studio/data/organizations/organization-update-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import type { components } from 'data/api' import { handleError, patch } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { organizationKeys } from './keys' export type OrganizationUpdateVariables = { @@ -44,7 +44,7 @@ export const useOrganizationUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/organizations/organizations-query.ts b/apps/studio/data/organizations/organizations-query.ts index c0898ea2c3e..88c29412143 100644 --- a/apps/studio/data/organizations/organizations-query.ts +++ b/apps/studio/data/organizations/organizations-query.ts @@ -1,11 +1,11 @@ -import { QueryClient, useQuery, UseQueryOptions } from '@tanstack/react-query' +import { QueryClient, useQuery } from '@tanstack/react-query' import { components } from 'api-types' import { get, handleError } from 'data/fetchers' -import { useProfile } from 'lib/profile' -import type { Organization, ResponseError } from 'types' -import { organizationKeys } from './keys' import { MANAGED_BY, ManagedBy } from 'lib/constants/infrastructure' +import { useProfile } from 'lib/profile' +import type { Organization, ResponseError, UseCustomQueryOptions } from 'types' +import { organizationKeys } from './keys' export type OrganizationBase = components['schemas']['OrganizationResponse'] @@ -52,7 +52,7 @@ export type OrganizationsError = ResponseError export const useOrganizationsQuery = ({ enabled = true, ...options -}: UseQueryOptions = {}) => { +}: UseCustomQueryOptions = {}) => { const { profile } = useProfile() return useQuery({ queryKey: organizationKeys.list(), diff --git a/apps/studio/data/permissions/permissions-query.ts b/apps/studio/data/permissions/permissions-query.ts index 875a823ee5a..6e47549e96b 100644 --- a/apps/studio/data/permissions/permissions-query.ts +++ b/apps/studio/data/permissions/permissions-query.ts @@ -1,9 +1,9 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { useIsLoggedIn } from 'common' import { get, handleError } from 'data/fetchers' import { IS_PLATFORM } from 'lib/constants' -import type { Permission, ResponseError } from 'types' +import type { Permission, ResponseError, UseCustomQueryOptions } from 'types' import { permissionKeys } from './keys' export type PermissionsResponse = Permission[] @@ -33,7 +33,7 @@ export type PermissionsError = ResponseError export const usePermissionsQuery = ({ enabled = true, ...options -}: UseQueryOptions = {}) => { +}: UseCustomQueryOptions = {}) => { const isLoggedIn = useIsLoggedIn() return useQuery({ diff --git a/apps/studio/data/platform/platform-status-query.ts b/apps/studio/data/platform/platform-status-query.ts index fb92d2e154f..73f944673bf 100644 --- a/apps/studio/data/platform/platform-status-query.ts +++ b/apps/studio/data/platform/platform-status-query.ts @@ -1,7 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' import { platformKeys } from './keys' +import { UseCustomQueryOptions } from 'types' export type PlatformStatusResponse = { isHealthy: boolean @@ -17,7 +18,7 @@ export type PlatformStatusData = Awaited> export type PlatformStatusError = unknown export const usePlatformStatusQuery = ( - options: UseQueryOptions = {} + options: UseCustomQueryOptions = {} ) => useQuery({ queryKey: platformKeys.status(), diff --git a/apps/studio/data/privileges/column-privileges-grant-mutation.ts b/apps/studio/data/privileges/column-privileges-grant-mutation.ts index 31c485675b6..412b9950c97 100644 --- a/apps/studio/data/privileges/column-privileges-grant-mutation.ts +++ b/apps/studio/data/privileges/column-privileges-grant-mutation.ts @@ -1,8 +1,8 @@ import pgMeta from '@supabase/pg-meta' -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { executeSql } from 'data/sql/execute-sql-query' import { toast } from 'sonner' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { privilegeKeys } from './keys' export type ColumnPrivilegesGrant = { @@ -49,7 +49,11 @@ export const useColumnPrivilegesGrantMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + ColumnPrivilegesGrantData, + ResponseError, + ColumnPrivilegesGrantVariables + >, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/privileges/column-privileges-query.ts b/apps/studio/data/privileges/column-privileges-query.ts index b9d3d866778..7f9ec099832 100644 --- a/apps/studio/data/privileges/column-privileges-query.ts +++ b/apps/studio/data/privileges/column-privileges-query.ts @@ -1,10 +1,10 @@ -import { UseQueryOptions, useQuery } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' +import { DEFAULT_PLATFORM_APPLICATION_NAME } from '@supabase/pg-meta/src/constants' import type { components } from 'data/api' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { privilegeKeys } from './keys' -import { DEFAULT_PLATFORM_APPLICATION_NAME } from '@supabase/pg-meta/src/constants' export type ColumnPrivilegesVariables = { projectRef?: string @@ -47,7 +47,7 @@ export const useColumnPrivilegesQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: privilegeKeys.columnPrivilegesList(projectRef), diff --git a/apps/studio/data/privileges/column-privileges-revoke-mutation.ts b/apps/studio/data/privileges/column-privileges-revoke-mutation.ts index bffbb295427..578f5d25da6 100644 --- a/apps/studio/data/privileges/column-privileges-revoke-mutation.ts +++ b/apps/studio/data/privileges/column-privileges-revoke-mutation.ts @@ -1,8 +1,8 @@ import pgMeta from '@supabase/pg-meta' -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { executeSql } from 'data/sql/execute-sql-query' import { toast } from 'sonner' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { privilegeKeys } from './keys' export type ColumnPrivilegesRevoke = { @@ -47,7 +47,11 @@ export const useColumnPrivilegesRevokeMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + ColumnPrivilegesRevokeData, + ResponseError, + ColumnPrivilegesRevokeVariables + >, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/privileges/table-privileges-grant-mutation.ts b/apps/studio/data/privileges/table-privileges-grant-mutation.ts index 8347e44c1ea..321d97a3609 100644 --- a/apps/studio/data/privileges/table-privileges-grant-mutation.ts +++ b/apps/studio/data/privileges/table-privileges-grant-mutation.ts @@ -1,9 +1,9 @@ import pgMeta from '@supabase/pg-meta' -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { privilegeKeys } from './keys' import { invalidateTablePrivilegesQuery } from './table-privileges-query' @@ -41,7 +41,7 @@ export const useTablePrivilegesGrantMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/privileges/table-privileges-query.ts b/apps/studio/data/privileges/table-privileges-query.ts index 9d872e65436..3bbaf06676e 100644 --- a/apps/studio/data/privileges/table-privileges-query.ts +++ b/apps/studio/data/privileges/table-privileges-query.ts @@ -1,8 +1,9 @@ import pgMeta from '@supabase/pg-meta' -import { QueryClient, UseQueryOptions, useQuery } from '@tanstack/react-query' +import { QueryClient, useQuery } from '@tanstack/react-query' import { z } from 'zod' import { executeSql, ExecuteSqlError } from 'data/sql/execute-sql-query' +import { UseCustomQueryOptions } from 'types' import { privilegeKeys } from './keys' export type TablePrivilegesVariables = { @@ -39,7 +40,7 @@ export const useTablePrivilegesQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: privilegeKeys.tablePrivilegesList(projectRef), @@ -52,5 +53,5 @@ export function invalidateTablePrivilegesQuery( client: QueryClient, projectRef: string | undefined ) { - return client.invalidateQueries(privilegeKeys.tablePrivilegesList(projectRef)) + return client.invalidateQueries({ queryKey: privilegeKeys.tablePrivilegesList(projectRef) }) } diff --git a/apps/studio/data/privileges/table-privileges-revoke-mutation.ts b/apps/studio/data/privileges/table-privileges-revoke-mutation.ts index 5f0e9c4d760..bd886179f39 100644 --- a/apps/studio/data/privileges/table-privileges-revoke-mutation.ts +++ b/apps/studio/data/privileges/table-privileges-revoke-mutation.ts @@ -1,9 +1,9 @@ import pgMeta from '@supabase/pg-meta' -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { privilegeKeys } from './keys' import { invalidateTablePrivilegesQuery } from './table-privileges-query' @@ -41,7 +41,11 @@ export const useTablePrivilegesRevokeMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + TablePrivilegesRevokeData, + ResponseError, + TablePrivilegesRevokeVariables + >, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/profile/mfa-authenticator-assurance-level-query.ts b/apps/studio/data/profile/mfa-authenticator-assurance-level-query.ts index ec2f78ca863..5e7a797c36d 100644 --- a/apps/studio/data/profile/mfa-authenticator-assurance-level-query.ts +++ b/apps/studio/data/profile/mfa-authenticator-assurance-level-query.ts @@ -1,8 +1,9 @@ import type { AuthMFAGetAuthenticatorAssuranceLevelResponse } from '@supabase/supabase-js' -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { auth } from 'lib/gotrue' import { profileKeys } from './keys' import type { Profile } from './types' +import { UseCustomQueryOptions } from 'types' export type ProfileResponse = Profile @@ -25,7 +26,7 @@ export const useAuthenticatorAssuranceLevelQuery = < >({ enabled = true, ...options -}: UseQueryOptions< +}: UseCustomQueryOptions< CustomAuthMFAGetAuthenticatorAssuranceLevelData, CustomAuthMFAGetAuthenticatorAssuranceLevelError, TData diff --git a/apps/studio/data/profile/mfa-challenge-and-verify-mutation.ts b/apps/studio/data/profile/mfa-challenge-and-verify-mutation.ts index 2bac6e111e5..6cb56b6a441 100644 --- a/apps/studio/data/profile/mfa-challenge-and-verify-mutation.ts +++ b/apps/studio/data/profile/mfa-challenge-and-verify-mutation.ts @@ -1,10 +1,11 @@ import * as Sentry from '@sentry/nextjs' import type { AuthMFAVerifyResponse, MFAChallengeAndVerifyParams } from '@supabase/supabase-js' -import { UseMutationOptions, useMutation, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { auth } from 'lib/gotrue' import { profileKeys } from './keys' +import { UseCustomMutationOptions } from 'types' const WHITELIST_ERRORS = ['Invalid TOTP code entered'] @@ -26,7 +27,11 @@ export const useMfaChallengeAndVerifyMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + CustomMFAVerifyResponse, + CustomMFAVerifyError, + MFAChallengeAndVerifyVariables + >, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/profile/mfa-enroll-mutation.ts b/apps/studio/data/profile/mfa-enroll-mutation.ts index 220974b50a2..31cc58291f4 100644 --- a/apps/studio/data/profile/mfa-enroll-mutation.ts +++ b/apps/studio/data/profile/mfa-enroll-mutation.ts @@ -1,7 +1,8 @@ import type { AuthMFAEnrollResponse, MFAEnrollParams } from '@supabase/supabase-js' -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { auth } from 'lib/gotrue' import { toast } from 'sonner' +import { UseCustomMutationOptions } from 'types' const mfaEnroll = async (params: MFAEnrollParams) => { const { error, data } = await auth.mfa.enroll(params) @@ -18,7 +19,7 @@ export const useMfaEnrollMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/profile/mfa-list-factors-query.ts b/apps/studio/data/profile/mfa-list-factors-query.ts index 6e3ade9fd05..fd234db75de 100644 --- a/apps/studio/data/profile/mfa-list-factors-query.ts +++ b/apps/studio/data/profile/mfa-list-factors-query.ts @@ -1,7 +1,8 @@ import type { AuthMFAListFactorsResponse, Factor } from '@supabase/supabase-js' -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { auth } from 'lib/gotrue' import { profileKeys } from './keys' +import { UseCustomQueryOptions } from 'types' export async function getMfaListFactors() { const { error, data } = await auth.mfa.listFactors() @@ -17,7 +18,7 @@ type CustomMFAListFactorsError = NonNullable({ enabled = true, ...options -}: UseQueryOptions = {}) => { +}: UseCustomQueryOptions = {}) => { return useQuery({ queryKey: profileKeys.mfaFactors(), queryFn: () => getMfaListFactors(), diff --git a/apps/studio/data/profile/mfa-unenroll-mutation.ts b/apps/studio/data/profile/mfa-unenroll-mutation.ts index a94fe258249..fa6d206ff0b 100644 --- a/apps/studio/data/profile/mfa-unenroll-mutation.ts +++ b/apps/studio/data/profile/mfa-unenroll-mutation.ts @@ -1,8 +1,9 @@ import type { AuthMFAUnenrollResponse, MFAUnenrollParams } from '@supabase/supabase-js' -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { auth } from 'lib/gotrue' import { toast } from 'sonner' import { profileKeys } from './keys' +import { UseCustomMutationOptions } from 'types' const mfaUnenroll = async (params: MFAUnenrollParams) => { const { error, data } = await auth.mfa.unenroll(params) @@ -19,7 +20,7 @@ export const useMfaUnenrollMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/profile/profile-audit-logs-query.ts b/apps/studio/data/profile/profile-audit-logs-query.ts index 209179d2fd1..4164b00a51d 100644 --- a/apps/studio/data/profile/profile-audit-logs-query.ts +++ b/apps/studio/data/profile/profile-audit-logs-query.ts @@ -1,9 +1,9 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' import type { AuditLog } from 'data/organizations/organization-audit-logs-query' import { IS_PLATFORM } from 'lib/constants' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { profileKeys } from './keys' export type ProfileAuditLogsVariables = { @@ -37,7 +37,7 @@ export type ProfileAuditLogsData = { export const useProfileAuditLogsQuery = ( vars: ProfileAuditLogsVariables, - options: UseQueryOptions = {} + options: UseCustomQueryOptions = {} ) => { const { iso_timestamp_start, iso_timestamp_end } = vars return useQuery({ diff --git a/apps/studio/data/profile/profile-create-mutation.ts b/apps/studio/data/profile/profile-create-mutation.ts index b49484fd05e..98809a35579 100644 --- a/apps/studio/data/profile/profile-create-mutation.ts +++ b/apps/studio/data/profile/profile-create-mutation.ts @@ -1,11 +1,11 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { components } from 'api-types' import { handleError, post } from 'data/fetchers' import { organizationKeys } from 'data/organizations/keys' import { permissionKeys } from 'data/permissions/keys' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { profileKeys } from './keys' export type ProfileResponse = components['schemas']['ProfileResponse'] @@ -23,7 +23,7 @@ export const useProfileCreateMutation = ({ onSuccess, onError, ...options -}: Omit, 'mutationFn'> = {}) => { +}: Omit, 'mutationFn'> = {}) => { const queryClient = useQueryClient() return useMutation({ diff --git a/apps/studio/data/profile/profile-identities-query.ts b/apps/studio/data/profile/profile-identities-query.ts index 52cc46db893..9c70a3ac0fb 100644 --- a/apps/studio/data/profile/profile-identities-query.ts +++ b/apps/studio/data/profile/profile-identities-query.ts @@ -1,8 +1,9 @@ import type { UserIdentity } from '@supabase/supabase-js' -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { auth } from 'lib/gotrue' import { profileKeys } from './keys' +import { UseCustomQueryOptions } from 'types' export async function getProfileIdentities() { // getSession() uses a cached user object, which is almost never stale as the @@ -28,7 +29,7 @@ type ProfileIdentitiesError = any export const useProfileIdentitiesQuery = ({ enabled = true, ...options -}: UseQueryOptions = {}) => { +}: UseCustomQueryOptions = {}) => { return useQuery({ queryKey: profileKeys.identities(), queryFn: () => getProfileIdentities(), diff --git a/apps/studio/data/profile/profile-query.ts b/apps/studio/data/profile/profile-query.ts index 86b50d7ffb6..f7553f9b96b 100644 --- a/apps/studio/data/profile/profile-query.ts +++ b/apps/studio/data/profile/profile-query.ts @@ -1,8 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' import { IS_PLATFORM } from 'lib/constants' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { profileKeys } from './keys' import type { Profile } from './types' @@ -30,7 +30,7 @@ export type ProfileError = ResponseError export const useProfileQuery = ({ enabled = true, ...options -}: UseQueryOptions = {}) => { +}: UseCustomQueryOptions = {}) => { return useQuery({ queryKey: profileKeys.profile(), queryFn: ({ signal }) => getProfile(signal), diff --git a/apps/studio/data/profile/profile-unlink-identity-mutation.ts b/apps/studio/data/profile/profile-unlink-identity-mutation.ts index eb6eb658c68..4cbd42794fc 100644 --- a/apps/studio/data/profile/profile-unlink-identity-mutation.ts +++ b/apps/studio/data/profile/profile-unlink-identity-mutation.ts @@ -1,8 +1,9 @@ import type { UserIdentity } from '@supabase/supabase-js' -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { auth } from 'lib/gotrue' +import { UseCustomMutationOptions } from 'types' import { profileKeys } from './keys' const unlinkIdentity = async (identity: UserIdentity) => { @@ -20,7 +21,7 @@ export const useUnlinkIdentityMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/profile/profile-update-email-mutation.ts b/apps/studio/data/profile/profile-update-email-mutation.ts index f2e69821beb..8778d828de3 100644 --- a/apps/studio/data/profile/profile-update-email-mutation.ts +++ b/apps/studio/data/profile/profile-update-email-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, put } from 'data/fetchers' import { auth } from 'lib/gotrue' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { profileKeys } from './keys' export type EmailUpdateVariables = { @@ -27,7 +27,7 @@ export const useEmailUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/profile/profile-update-mutation.ts b/apps/studio/data/profile/profile-update-mutation.ts index 204cb201425..39fb866292f 100644 --- a/apps/studio/data/profile/profile-update-mutation.ts +++ b/apps/studio/data/profile/profile-update-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, patch } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { profileKeys } from './keys' export type ProfileUpdateVariables = { @@ -38,7 +38,7 @@ export const useProfileUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/projects/clone-mutation.ts b/apps/studio/data/projects/clone-mutation.ts index e41daff40de..b68997edb96 100644 --- a/apps/studio/data/projects/clone-mutation.ts +++ b/apps/studio/data/projects/clone-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { projectKeys } from './keys' export type ProjectCloneVariables = { @@ -42,7 +42,7 @@ export const useProjectCloneMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/projects/clone-query.ts b/apps/studio/data/projects/clone-query.ts index 7de7d173b1d..fac667aad75 100644 --- a/apps/studio/data/projects/clone-query.ts +++ b/apps/studio/data/projects/clone-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { InfraInstanceSize } from 'components/interfaces/DiskManagement/DiskManagement.types' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { projectKeys } from './keys' export async function getCloneBackups(projectRef?: string) { @@ -25,7 +25,7 @@ export const useCloneBackupsQuery = < }, >( { projectRef }: { projectRef?: string }, - options: UseQueryOptions = {} + options: UseCustomQueryOptions = {} ) => { return useQuery({ queryKey: projectKeys.listCloneBackups(projectRef), diff --git a/apps/studio/data/projects/clone-status-query.ts b/apps/studio/data/projects/clone-status-query.ts index 2ed76392964..440083da2cb 100644 --- a/apps/studio/data/projects/clone-status-query.ts +++ b/apps/studio/data/projects/clone-status-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { components } from 'api-types' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { projectKeys } from './keys' export type CloneStatus = components['schemas']['ProjectClonedStatusResponse'] @@ -22,7 +22,7 @@ export type CloneStatusError = ResponseError export const useCloneStatusQuery = ( { projectRef }: { projectRef?: string }, - options: UseQueryOptions = {} + options: UseCustomQueryOptions = {} ) => { return useQuery({ queryKey: projectKeys.listCloneStatus(projectRef), diff --git a/apps/studio/data/projects/org-projects-infinite-query.ts b/apps/studio/data/projects/org-projects-infinite-query.ts index 47524700e9c..350c67adbd6 100644 --- a/apps/studio/data/projects/org-projects-infinite-query.ts +++ b/apps/studio/data/projects/org-projects-infinite-query.ts @@ -1,9 +1,9 @@ -import { useInfiniteQuery, UseInfiniteQueryOptions, useQueryClient } from '@tanstack/react-query' +import { useInfiniteQuery, useQueryClient } from '@tanstack/react-query' import { components } from 'api-types' import { get, handleError } from 'data/fetchers' import { useProfile } from 'lib/profile' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomInfiniteQueryOptions } from 'types' import { INFINITE_PROJECTS_KEY_PREFIX, projectKeys } from './keys' // [Joshen] Try to keep this value a multiple of 6 (common denominator of 2 and 3) to fit the cards view @@ -65,7 +65,7 @@ export const useOrgProjectsInfiniteQuery = ( { enabled = true, ...options - }: UseInfiniteQueryOptions = {} + }: UseCustomInfiniteQueryOptions = {} ) => { const { profile } = useProfile() return useInfiniteQuery({ diff --git a/apps/studio/data/projects/project-by-fly-extension-id-mutation.ts b/apps/studio/data/projects/project-by-fly-extension-id-mutation.ts index b3cb3cca45e..8c29d8c8cb7 100644 --- a/apps/studio/data/projects/project-by-fly-extension-id-mutation.ts +++ b/apps/studio/data/projects/project-by-fly-extension-id-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type ProjectByFlyExtensionIdVariables = { flyExtensionId: string @@ -28,7 +28,11 @@ export const useProjectByFlyExtensionIdMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + ProjectByFlyExtensionIdData, + ResponseError, + ProjectByFlyExtensionIdVariables + >, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/projects/project-create-mutation.ts b/apps/studio/data/projects/project-create-mutation.ts index d1206196641..77fa75b68f0 100644 --- a/apps/studio/data/projects/project-create-mutation.ts +++ b/apps/studio/data/projects/project-create-mutation.ts @@ -1,11 +1,11 @@ import * as Sentry from '@sentry/nextjs' -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import type { components } from 'data/api' import { handleError, post } from 'data/fetchers' import { PROVIDERS } from 'lib/constants' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { projectKeys } from './keys' import { DesiredInstanceSize, PostgresEngine, ReleaseChannel } from './new-project.constants' @@ -90,7 +90,7 @@ export const useProjectCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/projects/project-delete-mutation.ts b/apps/studio/data/projects/project-delete-mutation.ts index 5e6bd9fba60..b3a2af446eb 100644 --- a/apps/studio/data/projects/project-delete-mutation.ts +++ b/apps/studio/data/projects/project-delete-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { del, handleError } from 'data/fetchers' import { organizationKeys } from 'data/organizations/keys' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { projectKeys } from './keys' export type ProjectDeleteVariables = { @@ -27,7 +27,7 @@ export const useProjectDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/projects/project-detail-query.ts b/apps/studio/data/projects/project-detail-query.ts index df530655ef0..7ba84d421cb 100644 --- a/apps/studio/data/projects/project-detail-query.ts +++ b/apps/studio/data/projects/project-detail-query.ts @@ -1,8 +1,8 @@ -import { QueryClient, useQuery, useQueryClient, UseQueryOptions } from '@tanstack/react-query' +import { QueryClient, useQuery, useQueryClient } from '@tanstack/react-query' import type { components } from 'data/api' import { get, handleError, isValidConnString } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { projectKeys } from './keys' import { OrgProjectsResponse } from './org-projects-infinite-query' @@ -42,7 +42,10 @@ export type ProjectDetailError = ResponseError export const useProjectDetailQuery = ( { ref }: ProjectDetailVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: projectKeys.detail(ref), diff --git a/apps/studio/data/projects/project-pause-mutation.ts b/apps/studio/data/projects/project-pause-mutation.ts index df177591361..8f17f261c00 100644 --- a/apps/studio/data/projects/project-pause-mutation.ts +++ b/apps/studio/data/projects/project-pause-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type ProjectPauseVariables = { ref: string @@ -23,7 +23,7 @@ export const useProjectPauseMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/projects/project-pause-status-query.ts b/apps/studio/data/projects/project-pause-status-query.ts index 64ed5103101..5297ffd73b1 100644 --- a/apps/studio/data/projects/project-pause-status-query.ts +++ b/apps/studio/data/projects/project-pause-status-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { projectKeys } from './keys' export type ProjectPauseStatusVariables = { ref?: string } @@ -29,7 +29,7 @@ export const useProjectPauseStatusQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: projectKeys.pauseStatus(ref), diff --git a/apps/studio/data/projects/project-restart-mutation.ts b/apps/studio/data/projects/project-restart-mutation.ts index 064d8a6b50b..029d70a7fa1 100644 --- a/apps/studio/data/projects/project-restart-mutation.ts +++ b/apps/studio/data/projects/project-restart-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import type { components } from 'api-types' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type ProjectRestartVariables = { ref: string @@ -31,7 +31,7 @@ export const useProjectRestartMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/projects/project-restart-services-mutation.ts b/apps/studio/data/projects/project-restart-services-mutation.ts index f5703f6b2d3..5fe3675a38c 100644 --- a/apps/studio/data/projects/project-restart-services-mutation.ts +++ b/apps/studio/data/projects/project-restart-services-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type ProjectRestartServicesVariables = { ref: string @@ -52,7 +52,11 @@ export const useProjectRestartServicesMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + ProjectRestartServicesData, + ResponseError, + ProjectRestartServicesVariables + >, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/projects/project-restore-mutation.ts b/apps/studio/data/projects/project-restore-mutation.ts index 7037970e2bc..01b276a5997 100644 --- a/apps/studio/data/projects/project-restore-mutation.ts +++ b/apps/studio/data/projects/project-restore-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { PostgresEngine, ReleaseChannel } from './new-project.constants' export type ProjectRestoreVariables = { @@ -34,7 +34,7 @@ export const useProjectRestoreMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/projects/project-service-versions.ts b/apps/studio/data/projects/project-service-versions.ts index dabd53811db..6411cf2f29f 100644 --- a/apps/studio/data/projects/project-service-versions.ts +++ b/apps/studio/data/projects/project-service-versions.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { projectKeys } from './keys' export type ProjectServiceVersionsVariables = { @@ -30,7 +30,7 @@ export const useProjectServiceVersionsQuery = = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: projectKeys.serviceVersions(projectRef), diff --git a/apps/studio/data/projects/project-status-query.ts b/apps/studio/data/projects/project-status-query.ts index 1503aeb5bd1..07beb16804d 100644 --- a/apps/studio/data/projects/project-status-query.ts +++ b/apps/studio/data/projects/project-status-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { projectKeys } from './keys' export type ProjectStatusVariables = { @@ -28,7 +28,10 @@ export type ProjectStatusError = ResponseError export const useProjectStatusQuery = ( { projectRef }: ProjectStatusVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: projectKeys.status(projectRef), diff --git a/apps/studio/data/projects/project-transfer-mutation.ts b/apps/studio/data/projects/project-transfer-mutation.ts index 7aee266c13c..6ad56c73fac 100644 --- a/apps/studio/data/projects/project-transfer-mutation.ts +++ b/apps/studio/data/projects/project-transfer-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { projectKeys } from './keys' export type ProjectTransferVariables = { @@ -36,7 +36,7 @@ export const useProjectTransferMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/projects/project-transfer-preview-query.ts b/apps/studio/data/projects/project-transfer-preview-query.ts index 75cc11428e7..3f7d7be8bb7 100644 --- a/apps/studio/data/projects/project-transfer-preview-query.ts +++ b/apps/studio/data/projects/project-transfer-preview-query.ts @@ -1,7 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { handleError, post } from 'data/fetchers' import { projectKeys } from './keys' +import { UseCustomQueryOptions } from 'types' export type ProjectTransferPreviewVariables = { projectRef?: string @@ -35,7 +36,7 @@ export const useProjectTransferPreviewQuery = = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: projectKeys.projectTransferPreview(projectRef, targetOrganizationSlug), diff --git a/apps/studio/data/projects/project-type-generation-query.ts b/apps/studio/data/projects/project-type-generation-query.ts index 02fe84604e6..b1a43d0063d 100644 --- a/apps/studio/data/projects/project-type-generation-query.ts +++ b/apps/studio/data/projects/project-type-generation-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { projectKeys } from './keys' export type GenerateTypesVariables = { ref?: string; included_schemas?: string } @@ -26,7 +26,10 @@ export type GenerateTypesError = ResponseError export const useGenerateTypesQuery = ( { ref, included_schemas }: GenerateTypesVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: projectKeys.types(ref), diff --git a/apps/studio/data/projects/project-update-mutation.ts b/apps/studio/data/projects/project-update-mutation.ts index 3953d5f5af8..c9fd55d25b5 100644 --- a/apps/studio/data/projects/project-update-mutation.ts +++ b/apps/studio/data/projects/project-update-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, patch } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { projectKeys } from './keys' export type ProjectUpdateVariables = { @@ -32,7 +32,7 @@ export const useProjectUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/projects/project-upgrade-mutation.ts b/apps/studio/data/projects/project-upgrade-mutation.ts index fb775e73c77..0efdafe47fb 100644 --- a/apps/studio/data/projects/project-upgrade-mutation.ts +++ b/apps/studio/data/projects/project-upgrade-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { components } from 'api-types' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type ProjectUpgradeVariables = components['schemas']['UpgradeDatabaseBody'] & { ref: string @@ -29,7 +29,7 @@ export const useProjectUpgradeMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/projects/projects-infinite-query.ts b/apps/studio/data/projects/projects-infinite-query.ts index d25dba27ce7..ed2259a8c35 100644 --- a/apps/studio/data/projects/projects-infinite-query.ts +++ b/apps/studio/data/projects/projects-infinite-query.ts @@ -1,9 +1,9 @@ -import { useInfiniteQuery, UseInfiniteQueryOptions } from '@tanstack/react-query' +import { useInfiniteQuery } from '@tanstack/react-query' import { components } from 'api-types' import { get, handleError } from 'data/fetchers' import { useProfile } from 'lib/profile' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomInfiniteQueryOptions } from 'types' import { projectKeys } from './keys' const DEFAULT_LIMIT = 100 @@ -50,7 +50,7 @@ export const useProjectsInfiniteQuery = ( { enabled = true, ...options - }: UseInfiniteQueryOptions = {} + }: UseCustomInfiniteQueryOptions = {} ) => { const { profile } = useProfile() return useInfiniteQuery({ diff --git a/apps/studio/data/projects/projects-query.ts b/apps/studio/data/projects/projects-query.ts index 458d12374b0..b478e70b3b1 100644 --- a/apps/studio/data/projects/projects-query.ts +++ b/apps/studio/data/projects/projects-query.ts @@ -1,9 +1,9 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import type { components } from 'data/api' import { get, handleError } from 'data/fetchers' import { useProfile } from 'lib/profile' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { projectKeys } from './keys' type PaginatedProjectsResponse = components['schemas']['ListProjectsPaginatedResponse'] @@ -32,7 +32,7 @@ export type ProjectsError = ResponseError export const useProjectsQuery = ({ enabled = true, ...options -}: UseQueryOptions = {}) => { +}: UseCustomQueryOptions = {}) => { const { profile } = useProfile() return useQuery({ queryKey: projectKeys.list(), diff --git a/apps/studio/data/read-replicas/load-balancers-query.ts b/apps/studio/data/read-replicas/load-balancers-query.ts index 1401742cba5..321575a8bd4 100644 --- a/apps/studio/data/read-replicas/load-balancers-query.ts +++ b/apps/studio/data/read-replicas/load-balancers-query.ts @@ -1,9 +1,9 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import type { components } from 'data/api' import { get, handleError } from 'data/fetchers' import { IS_PLATFORM } from 'lib/constants' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { replicaKeys } from './keys' export type LoadBalancersVariables = { @@ -32,7 +32,10 @@ export type LoadBalancersError = ResponseError export const useLoadBalancersQuery = ( { projectRef }: LoadBalancersVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => { return useQuery({ queryKey: replicaKeys.loadBalancers(projectRef), diff --git a/apps/studio/data/read-replicas/replica-lag-query.ts b/apps/studio/data/read-replicas/replica-lag-query.ts index 2c224f0ec87..dc026bbfb35 100644 --- a/apps/studio/data/read-replicas/replica-lag-query.ts +++ b/apps/studio/data/read-replicas/replica-lag-query.ts @@ -1,6 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { executeSql, ExecuteSqlError } from '../sql/execute-sql-query' import { replicaKeys } from './keys' +import { UseCustomQueryOptions } from 'types' export const replicationLagSql = () => { const sql = /* SQL */ ` @@ -43,7 +44,7 @@ export const useReplicationLagQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: replicaKeys.replicaLag(projectRef, id), diff --git a/apps/studio/data/read-replicas/replica-remove-mutation.ts b/apps/studio/data/read-replicas/replica-remove-mutation.ts index aa175e3cc4c..ac563da61b5 100644 --- a/apps/studio/data/read-replicas/replica-remove-mutation.ts +++ b/apps/studio/data/read-replicas/replica-remove-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { replicaKeys } from './keys' export type ReadReplicaRemoveVariables = { @@ -31,7 +31,7 @@ export const useReadReplicaRemoveMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/read-replicas/replica-setup-mutation.ts b/apps/studio/data/read-replicas/replica-setup-mutation.ts index e7d812f36f3..eac1d970fae 100644 --- a/apps/studio/data/read-replicas/replica-setup-mutation.ts +++ b/apps/studio/data/read-replicas/replica-setup-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { replicaKeys } from './keys' export type Region = @@ -47,7 +47,7 @@ export const useReadReplicaSetUpMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/read-replicas/replicas-query.ts b/apps/studio/data/read-replicas/replicas-query.ts index 80d64517f51..ea8e86b6377 100644 --- a/apps/studio/data/read-replicas/replicas-query.ts +++ b/apps/studio/data/read-replicas/replicas-query.ts @@ -1,8 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import type { components } from 'data/api' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { replicaKeys } from './keys' export const MAX_REPLICAS_BELOW_XL = 2 @@ -31,7 +31,10 @@ export type ReadReplicasError = ResponseError export const useReadReplicasQuery = ( { projectRef }: ReadReplicasVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => { return useQuery({ queryKey: replicaKeys.list(projectRef), diff --git a/apps/studio/data/read-replicas/replicas-status-query.ts b/apps/studio/data/read-replicas/replicas-status-query.ts index f601b15d0e2..796d485c240 100644 --- a/apps/studio/data/read-replicas/replicas-status-query.ts +++ b/apps/studio/data/read-replicas/replicas-status-query.ts @@ -1,8 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { components } from 'api-types' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { replicaKeys } from './keys' // [Joshen] Is it possible to import this from the code gen? @@ -46,7 +46,7 @@ export const useReadReplicasStatusesQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => { return useQuery({ queryKey: replicaKeys.statuses(projectRef), diff --git a/apps/studio/data/realtime/realtime-config-mutation.ts b/apps/studio/data/realtime/realtime-config-mutation.ts index 62e29911ee5..3aa6e0ef9e8 100644 --- a/apps/studio/data/realtime/realtime-config-mutation.ts +++ b/apps/studio/data/realtime/realtime-config-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import type { components } from 'data/api' import { handleError, patch } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { realtimeKeys } from './keys' export type RealtimeConfigurationUpdateVariables = { @@ -52,7 +52,7 @@ export const useRealtimeConfigurationUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< RealtimeConfigurationUpdateData, ResponseError, RealtimeConfigurationUpdateVariables diff --git a/apps/studio/data/realtime/realtime-config-query.ts b/apps/studio/data/realtime/realtime-config-query.ts index d5cff6a73f8..4867fadd241 100644 --- a/apps/studio/data/realtime/realtime-config-query.ts +++ b/apps/studio/data/realtime/realtime-config-query.ts @@ -1,8 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' import { IS_PLATFORM } from 'lib/constants' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { realtimeKeys } from './keys' export type RealtimeConfigurationVariables = { @@ -50,7 +50,7 @@ export const useRealtimeConfigurationQuery = { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: realtimeKeys.configuration(projectRef), diff --git a/apps/studio/data/replication/create-destination-pipeline-mutation.ts b/apps/studio/data/replication/create-destination-pipeline-mutation.ts index 92fa12e1275..a313280119d 100644 --- a/apps/studio/data/replication/create-destination-pipeline-mutation.ts +++ b/apps/studio/data/replication/create-destination-pipeline-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import type { components } from 'api-types' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { replicationKeys } from './keys' export type BigQueryDestinationConfig = { @@ -121,7 +121,11 @@ export const useCreateDestinationPipelineMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + CreateDestinationPipelineData, + ResponseError, + CreateDestinationPipelineParams + >, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/replication/create-publication-mutation.ts b/apps/studio/data/replication/create-publication-mutation.ts index 949592f796d..c8530d853f5 100644 --- a/apps/studio/data/replication/create-publication-mutation.ts +++ b/apps/studio/data/replication/create-publication-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { replicationKeys } from './keys' export type CreatePublicationParams = { @@ -40,7 +40,7 @@ export const useCreatePublicationMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/replication/create-tenant-source-mutation.ts b/apps/studio/data/replication/create-tenant-source-mutation.ts index 16251727e34..49ee0e1a209 100644 --- a/apps/studio/data/replication/create-tenant-source-mutation.ts +++ b/apps/studio/data/replication/create-tenant-source-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { replicationKeys } from './keys' export type CreateTenantSourceParams = { @@ -30,7 +30,7 @@ export const useCreateTenantSourceMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/replication/delete-destination-pipeline-mutation.ts b/apps/studio/data/replication/delete-destination-pipeline-mutation.ts index c6a6091c04b..5df1384074a 100644 --- a/apps/studio/data/replication/delete-destination-pipeline-mutation.ts +++ b/apps/studio/data/replication/delete-destination-pipeline-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { del, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { replicationKeys } from './keys' export type DeleteDestinationPipelineParams = { @@ -38,7 +38,11 @@ export const useDeleteDestinationPipelineMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + DeleteDestinationPipelineData, + ResponseError, + DeleteDestinationPipelineParams + >, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/replication/destination-by-id-query.ts b/apps/studio/data/replication/destination-by-id-query.ts index c157f0108e2..80873804aaf 100644 --- a/apps/studio/data/replication/destination-by-id-query.ts +++ b/apps/studio/data/replication/destination-by-id-query.ts @@ -1,8 +1,8 @@ -import { UseQueryOptions, useQuery } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import type { components } from 'api-types' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { replicationKeys } from './keys' type ReplicationDestinationByIdParams = { projectRef?: string; destinationId?: number } @@ -31,7 +31,7 @@ export const useReplicationDestinationByIdQuery = = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: replicationKeys.destinationById(projectRef, destinationId), diff --git a/apps/studio/data/replication/destinations-query.ts b/apps/studio/data/replication/destinations-query.ts index 63fd8098fae..9c73561f751 100644 --- a/apps/studio/data/replication/destinations-query.ts +++ b/apps/studio/data/replication/destinations-query.ts @@ -1,7 +1,7 @@ -import { UseQueryOptions, useQuery } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { replicationKeys } from './keys' type ReplicationDestinationsParams = { projectRef?: string } @@ -30,7 +30,7 @@ export const useReplicationDestinationsQuery = = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: replicationKeys.destinations(projectRef), diff --git a/apps/studio/data/replication/pipeline-by-id-query.ts b/apps/studio/data/replication/pipeline-by-id-query.ts index 65e3584b3a6..ca8c0cfcaea 100644 --- a/apps/studio/data/replication/pipeline-by-id-query.ts +++ b/apps/studio/data/replication/pipeline-by-id-query.ts @@ -1,8 +1,8 @@ -import { UseQueryOptions, useQuery } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import type { components } from 'api-types' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { replicationKeys } from './keys' type ReplicationPipelineByIdParams = { projectRef?: string; pipelineId?: number } @@ -31,7 +31,7 @@ export const useReplicationPipelineByIdQuery = = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: replicationKeys.pipelineById(projectRef, pipelineId), diff --git a/apps/studio/data/replication/pipeline-replication-status-query.ts b/apps/studio/data/replication/pipeline-replication-status-query.ts index 9289ff21ea6..f4e164fc38f 100644 --- a/apps/studio/data/replication/pipeline-replication-status-query.ts +++ b/apps/studio/data/replication/pipeline-replication-status-query.ts @@ -1,7 +1,7 @@ -import { UseQueryOptions, useQuery } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { replicationKeys } from './keys' type ReplicationPipelineReplicationStatusParams = { projectRef?: string; pipelineId?: number } @@ -38,7 +38,7 @@ export const useReplicationPipelineReplicationStatusQuery = < { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: replicationKeys.pipelinesReplicationStatus(projectRef, pipelineId), diff --git a/apps/studio/data/replication/pipeline-status-query.ts b/apps/studio/data/replication/pipeline-status-query.ts index 400884d4628..1e6b2d9787d 100644 --- a/apps/studio/data/replication/pipeline-status-query.ts +++ b/apps/studio/data/replication/pipeline-status-query.ts @@ -1,7 +1,7 @@ -import { UseQueryOptions, useQuery } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { replicationKeys } from './keys' type ReplicationPipelinesStatusParams = { projectRef?: string; pipelineId?: number } @@ -33,7 +33,7 @@ export const useReplicationPipelineStatusQuery = = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: replicationKeys.pipelinesStatus(projectRef, pipelineId), diff --git a/apps/studio/data/replication/pipeline-version-query.ts b/apps/studio/data/replication/pipeline-version-query.ts index 911ced6ff53..024e2874040 100644 --- a/apps/studio/data/replication/pipeline-version-query.ts +++ b/apps/studio/data/replication/pipeline-version-query.ts @@ -1,8 +1,8 @@ -import { UseQueryOptions, useQuery } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { components } from 'api-types' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { replicationKeys } from './keys' type ReplicationPipelineVersionParams = { projectRef?: string; pipelineId?: number } @@ -35,7 +35,7 @@ export const useReplicationPipelineVersionQuery = = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: replicationKeys.pipelinesVersion(projectRef, pipelineId), diff --git a/apps/studio/data/replication/pipelines-query.ts b/apps/studio/data/replication/pipelines-query.ts index cb00595c6f2..5e9ed35d57a 100644 --- a/apps/studio/data/replication/pipelines-query.ts +++ b/apps/studio/data/replication/pipelines-query.ts @@ -1,7 +1,7 @@ -import { UseQueryOptions, useQuery } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { replicationKeys } from './keys' type ReplicationPipelinesParams = { projectRef?: string } @@ -31,7 +31,7 @@ export const useReplicationPipelinesQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: replicationKeys.pipelines(projectRef), diff --git a/apps/studio/data/replication/publication-delete-mutation.ts b/apps/studio/data/replication/publication-delete-mutation.ts index f1fca52927a..ffae14965d0 100644 --- a/apps/studio/data/replication/publication-delete-mutation.ts +++ b/apps/studio/data/replication/publication-delete-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { del, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { replicationKeys } from './keys' export type DeletePublicationParams = { @@ -41,7 +41,7 @@ export const useDeletePublicationMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() @@ -50,7 +50,9 @@ export const useDeletePublicationMutation = ({ mutationFn: (vars) => deletePublication(vars), async onSuccess(data, variables, context) { const { projectRef, sourceId } = variables - await queryClient.invalidateQueries(replicationKeys.publications(projectRef, sourceId)) + await queryClient.invalidateQueries({ + queryKey: replicationKeys.publications(projectRef, sourceId), + }) await onSuccess?.(data, variables, context) }, async onError(data, variables, context) { diff --git a/apps/studio/data/replication/publications-query.ts b/apps/studio/data/replication/publications-query.ts index 6fb56ad7982..baa75854e4e 100644 --- a/apps/studio/data/replication/publications-query.ts +++ b/apps/studio/data/replication/publications-query.ts @@ -1,8 +1,8 @@ -import { UseQueryOptions, useQuery } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { components } from 'api-types' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { replicationKeys } from './keys' type ReplicationPublicationsParams = { projectRef?: string; sourceId?: number } @@ -39,7 +39,7 @@ export const useReplicationPublicationsQuery = = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: replicationKeys.publications(projectRef, sourceId), diff --git a/apps/studio/data/replication/rollback-table-mutation.ts b/apps/studio/data/replication/rollback-table-mutation.ts index cc4e2d1a8e9..d95b62b2e08 100644 --- a/apps/studio/data/replication/rollback-table-mutation.ts +++ b/apps/studio/data/replication/rollback-table-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { replicationKeys } from './keys' export type RollbackType = 'individual' | 'full' @@ -52,7 +52,7 @@ export const useRollbackTableMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/replication/sources-query.ts b/apps/studio/data/replication/sources-query.ts index 14201ee64ce..8561af72a1d 100644 --- a/apps/studio/data/replication/sources-query.ts +++ b/apps/studio/data/replication/sources-query.ts @@ -1,7 +1,7 @@ -import { UseQueryOptions, useQuery } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { replicationKeys } from './keys' type ReplicationSourcesParams = { projectRef?: string } @@ -27,7 +27,10 @@ export type ReplicationSourcesData = Awaited( { projectRef }: ReplicationSourcesParams, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: replicationKeys.sources(projectRef), diff --git a/apps/studio/data/replication/start-pipeline-mutation.ts b/apps/studio/data/replication/start-pipeline-mutation.ts index a5cc611f86b..f613a0c44d3 100644 --- a/apps/studio/data/replication/start-pipeline-mutation.ts +++ b/apps/studio/data/replication/start-pipeline-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { replicationKeys } from './keys' export type StartPipelineParams = { @@ -34,7 +34,7 @@ export const useStartPipelineMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/replication/stop-pipeline-mutation.ts b/apps/studio/data/replication/stop-pipeline-mutation.ts index ff59291ceca..33a9e10af0c 100644 --- a/apps/studio/data/replication/stop-pipeline-mutation.ts +++ b/apps/studio/data/replication/stop-pipeline-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { replicationKeys } from './keys' export type StopPipelineParams = { @@ -31,7 +31,7 @@ export const useStopPipelineMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/replication/tables-query.ts b/apps/studio/data/replication/tables-query.ts index a557f33d6f3..0635055aba3 100644 --- a/apps/studio/data/replication/tables-query.ts +++ b/apps/studio/data/replication/tables-query.ts @@ -1,7 +1,7 @@ -import { UseQueryOptions, useQuery } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { replicationKeys } from './keys' type ReplicationTablesParams = { projectRef?: string; sourceId?: number } @@ -28,7 +28,10 @@ export type ReplicationTablesData = Awaited( { projectRef, sourceId }: ReplicationTablesParams, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: replicationKeys.tables(projectRef, sourceId), diff --git a/apps/studio/data/replication/update-destination-pipeline-mutation.ts b/apps/studio/data/replication/update-destination-pipeline-mutation.ts index 49412f264d8..ae7def269b4 100644 --- a/apps/studio/data/replication/update-destination-pipeline-mutation.ts +++ b/apps/studio/data/replication/update-destination-pipeline-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import type { components } from 'api-types' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { replicationKeys } from './keys' export type BigQueryDestinationConfig = { @@ -125,7 +125,11 @@ export const useUpdateDestinationPipelineMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + UpdateDestinationPipelineData, + ResponseError, + UpdateDestinationPipelineParams + >, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/replication/update-pipeline-version-mutation.ts b/apps/studio/data/replication/update-pipeline-version-mutation.ts index 1014f85d6ca..ed679ddb976 100644 --- a/apps/studio/data/replication/update-pipeline-version-mutation.ts +++ b/apps/studio/data/replication/update-pipeline-version-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { replicationKeys } from './keys' type UpdatePipelineVersionParams = { @@ -39,7 +39,7 @@ export const useUpdatePipelineVersionMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/secrets/secrets-create-mutation.ts b/apps/studio/data/secrets/secrets-create-mutation.ts index 9463a8b3874..7518c2338eb 100644 --- a/apps/studio/data/secrets/secrets-create-mutation.ts +++ b/apps/studio/data/secrets/secrets-create-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { secretsKeys } from './keys' export type SecretsCreateVariables = { @@ -29,7 +29,7 @@ export const useSecretsCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/secrets/secrets-delete-mutation.ts b/apps/studio/data/secrets/secrets-delete-mutation.ts index fc0df36948b..834410e9826 100644 --- a/apps/studio/data/secrets/secrets-delete-mutation.ts +++ b/apps/studio/data/secrets/secrets-delete-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { del, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { secretsKeys } from './keys' export type SecretsDeleteVariables = { @@ -29,7 +29,7 @@ export const useSecretsDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/secrets/secrets-query.ts b/apps/studio/data/secrets/secrets-query.ts index ae41c2455b3..512aafb1fe3 100644 --- a/apps/studio/data/secrets/secrets-query.ts +++ b/apps/studio/data/secrets/secrets-query.ts @@ -1,8 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import type { components } from 'data/api' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { secretsKeys } from './keys' export type SecretsVariables = { @@ -28,7 +28,7 @@ export type SecretsError = ResponseError export const useSecretsQuery = ( { projectRef }: SecretsVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: secretsKeys.list(projectRef), diff --git a/apps/studio/data/service-status/edge-functions-status-query.ts b/apps/studio/data/service-status/edge-functions-status-query.ts index f21c992cb93..9ec5dce7ad4 100644 --- a/apps/studio/data/service-status/edge-functions-status-query.ts +++ b/apps/studio/data/service-status/edge-functions-status-query.ts @@ -1,6 +1,6 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { serviceStatusKeys } from './keys' export type EdgeFunctionServiceStatusVariables = { @@ -28,7 +28,11 @@ export const useEdgeFunctionServiceStatusQuery = = {} + }: UseCustomQueryOptions< + EdgeFunctionServiceStatusData, + EdgeFunctionServiceStatusError, + TData + > = {} ) => useQuery({ queryKey: serviceStatusKeys.edgeFunctions(projectRef), diff --git a/apps/studio/data/service-status/service-status-query.ts b/apps/studio/data/service-status/service-status-query.ts index 2ae7ea79089..38d481bbdd6 100644 --- a/apps/studio/data/service-status/service-status-query.ts +++ b/apps/studio/data/service-status/service-status-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { serviceStatusKeys } from './keys' export type ProjectServiceStatusVariables = { @@ -37,7 +37,7 @@ export const useProjectServiceStatusQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: serviceStatusKeys.serviceStatus(projectRef), diff --git a/apps/studio/data/sql/abort-query-mutation.ts b/apps/studio/data/sql/abort-query-mutation.ts index 34acbce8ccf..bbfc5b7d9e4 100644 --- a/apps/studio/data/sql/abort-query-mutation.ts +++ b/apps/studio/data/sql/abort-query-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { sqlKeys } from './keys' export type QueryAbortVariables = { @@ -24,7 +24,7 @@ export const useQueryAbortMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/sql/execute-sql-mutation.ts b/apps/studio/data/sql/execute-sql-mutation.ts index 575d3227b68..b687c71bb3f 100644 --- a/apps/studio/data/sql/execute-sql-mutation.ts +++ b/apps/studio/data/sql/execute-sql-mutation.ts @@ -1,10 +1,11 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { useSendEventMutation } from 'data/telemetry/send-event-mutation' import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization' import { sqlEventParser } from 'lib/sql-event-parser' import { executeSql, ExecuteSqlData, ExecuteSqlVariables } from './execute-sql-query' +import { UseCustomMutationOptions } from 'types' // [Joshen] Intention is that we invalidate all database related keys whenever running a mutation related query // So we attempt to ignore all the non-related query keys. We could probably look into grouping our query keys better @@ -30,7 +31,7 @@ export const useExecuteSqlMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/sql/execute-sql-query.ts b/apps/studio/data/sql/execute-sql-query.ts index 94d7dee7056..cee39cfd3a0 100644 --- a/apps/studio/data/sql/execute-sql-query.ts +++ b/apps/studio/data/sql/execute-sql-query.ts @@ -1,4 +1,4 @@ -import { QueryKey, useQuery, UseQueryOptions } from '@tanstack/react-query' +import { QueryKey, useQuery } from '@tanstack/react-query' import { DEFAULT_PLATFORM_APPLICATION_NAME } from '@supabase/pg-meta/src/constants' import { handleError as handleErrorFetchers, post } from 'data/fetchers' @@ -8,7 +8,7 @@ import { ROLE_IMPERSONATION_NO_RESULTS, ROLE_IMPERSONATION_SQL_LINE_COUNT, } from 'lib/role-impersonation' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { sqlKeys } from './keys' export type ExecuteSqlVariables = { @@ -157,7 +157,7 @@ export const useExecuteSqlQuery = ( handleError, isRoleImpersonationEnabled, }: ExecuteSqlVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => { const { data: project } = useSelectedProjectQuery() const isActive = project?.status === PROJECT_STATUS.ACTIVE_HEALTHY diff --git a/apps/studio/data/sql/ongoing-queries-query.ts b/apps/studio/data/sql/ongoing-queries-query.ts index 6d981fc27a2..9c258aba9b7 100644 --- a/apps/studio/data/sql/ongoing-queries-query.ts +++ b/apps/studio/data/sql/ongoing-queries-query.ts @@ -1,6 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { executeSql, ExecuteSqlError } from '../sql/execute-sql-query' import { sqlKeys } from './keys' +import { UseCustomQueryOptions } from 'types' type OngoingQuery = { pid: number @@ -43,7 +44,7 @@ export const useOngoingQueriesQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: sqlKeys.ongoingQueries(projectRef), diff --git a/apps/studio/data/ssl-enforcement/ssl-enforcement-query.ts b/apps/studio/data/ssl-enforcement/ssl-enforcement-query.ts index c9888ee0163..3a8b9228d86 100644 --- a/apps/studio/data/ssl-enforcement/ssl-enforcement-query.ts +++ b/apps/studio/data/ssl-enforcement/ssl-enforcement-query.ts @@ -1,6 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' import { sslEnforcementKeys } from './keys' +import { UseCustomQueryOptions } from 'types' export type SSLEnforcementVariables = { projectRef?: string } @@ -44,7 +45,7 @@ export const useSSLEnforcementQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: sslEnforcementKeys.list(projectRef), diff --git a/apps/studio/data/ssl-enforcement/ssl-enforcement-update-mutation.ts b/apps/studio/data/ssl-enforcement/ssl-enforcement-update-mutation.ts index 30149f874e0..b4398355e9e 100644 --- a/apps/studio/data/ssl-enforcement/ssl-enforcement-update-mutation.ts +++ b/apps/studio/data/ssl-enforcement/ssl-enforcement-update-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, put } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { sslEnforcementKeys } from './keys' export type SSLEnforcementUpdateVariables = { @@ -38,7 +38,7 @@ export const useSSLEnforcementUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/sso/sso-config-create-mutation.ts b/apps/studio/data/sso/sso-config-create-mutation.ts index e631057715b..241935f6dc6 100644 --- a/apps/studio/data/sso/sso-config-create-mutation.ts +++ b/apps/studio/data/sso/sso-config-create-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import type { components } from 'data/api' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { orgSSOKeys } from './keys' export type SSOConfigCreateVariables = { @@ -28,7 +28,7 @@ export const useSSOConfigCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/sso/sso-config-query.ts b/apps/studio/data/sso/sso-config-query.ts index 33a4d0ab898..e411d0b2fd4 100644 --- a/apps/studio/data/sso/sso-config-query.ts +++ b/apps/studio/data/sso/sso-config-query.ts @@ -1,9 +1,9 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization' import { IS_PLATFORM } from 'lib/constants' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { orgSSOKeys } from './keys' export type OrgSSOConfigVariables = { @@ -37,7 +37,10 @@ export type OrgSSOConfigError = ResponseError export const useOrgSSOConfigQuery = ( { orgSlug }: OrgSSOConfigVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => { const { data: organization } = useSelectedOrganizationQuery() const plan = organization?.plan.id diff --git a/apps/studio/data/sso/sso-config-update-mutation.ts b/apps/studio/data/sso/sso-config-update-mutation.ts index cf2bb27a3b2..5bd1eaf87bf 100644 --- a/apps/studio/data/sso/sso-config-update-mutation.ts +++ b/apps/studio/data/sso/sso-config-update-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import type { components } from 'data/api' import { handleError, put } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { orgSSOKeys } from './keys' export type SSOConfigUpdateVariables = { @@ -28,7 +28,7 @@ export const useSSOConfigUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/storage/analytics-bucket-create-mutation.ts b/apps/studio/data/storage/analytics-bucket-create-mutation.ts index 55d9a081ee3..97d4ddc0f31 100644 --- a/apps/studio/data/storage/analytics-bucket-create-mutation.ts +++ b/apps/studio/data/storage/analytics-bucket-create-mutation.ts @@ -1,11 +1,9 @@ -// @ts-nocheck -// [Joshen] To remove after infra changes for analytics bucket is in -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { components } from 'api-types' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { storageKeys } from './keys' type AnalyticsBucketCreateVariables = CreateAnalyticsBucketBody & { @@ -34,7 +32,11 @@ export const useAnalyticsBucketCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + AnalyticsBucketCreateData, + ResponseError, + AnalyticsBucketCreateVariables + >, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/storage/analytics-bucket-delete-mutation.ts b/apps/studio/data/storage/analytics-bucket-delete-mutation.ts index d71105d2b78..05971d4bfdf 100644 --- a/apps/studio/data/storage/analytics-bucket-delete-mutation.ts +++ b/apps/studio/data/storage/analytics-bucket-delete-mutation.ts @@ -1,11 +1,8 @@ -// @ts-nocheck -// [Joshen] To remove after infra changes for analytics bucket is in -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' -import { useIsNewStorageUIEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext' import { del, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { storageKeys } from './keys' type AnalyticsBucketDeleteVariables = { @@ -32,21 +29,20 @@ export const useAnalyticsBucketDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + AnalyticsBucketDeleteData, + ResponseError, + AnalyticsBucketDeleteVariables + >, 'mutationFn' > = {}) => { const queryClient = useQueryClient() - const isStorageV2 = useIsNewStorageUIEnabled() return useMutation({ mutationFn: (vars) => deleteAnalyticsBucket(vars), async onSuccess(data, variables, context) { const { projectRef } = variables - if (isStorageV2) { - await queryClient.invalidateQueries(storageKeys.analyticsBuckets(projectRef)) - } else { - await queryClient.invalidateQueries(storageKeys.buckets(projectRef)) - } + await queryClient.invalidateQueries(storageKeys.analyticsBuckets(projectRef)) await onSuccess?.(data, variables, context) }, async onError(data, variables, context) { diff --git a/apps/studio/data/storage/analytics-buckets-query.ts b/apps/studio/data/storage/analytics-buckets-query.ts index 03fd2c7e65b..37b60fbe406 100644 --- a/apps/studio/data/storage/analytics-buckets-query.ts +++ b/apps/studio/data/storage/analytics-buckets-query.ts @@ -1,12 +1,11 @@ -// @ts-nocheck -// [Joshen] To remove after infra changes for analytics bucket is in -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { components } from 'api-types' +import { useIsAnalyticsBucketsEnabled } from 'data/config/project-storage-config-query' import { get, handleError } from 'data/fetchers' import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject' import { PROJECT_STATUS } from 'lib/constants' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { storageKeys } from './keys' export type AnalyticsBucketsVariables = { projectRef?: string } @@ -36,31 +35,16 @@ export const useAnalyticsBucketsQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => { const { data: project } = useSelectedProjectQuery() const isActive = project?.status === PROJECT_STATUS.ACTIVE_HEALTHY + const hasIcebergEnabled = useIsAnalyticsBucketsEnabled({ projectRef: project?.ref }) return useQuery({ queryKey: storageKeys.analyticsBuckets(projectRef), queryFn: ({ signal }) => getAnalyticsBuckets({ projectRef }, signal), - enabled: enabled && typeof projectRef !== 'undefined' && isActive, + enabled: enabled && typeof projectRef !== 'undefined' && isActive && hasIcebergEnabled, ...options, - retry: (failureCount, error) => { - if ( - typeof error === 'object' && - error !== null && - error.message.startsWith('Tenant config') && - error.message.endsWith('not found') - ) { - return false - } - - if (failureCount < 3) { - return true - } - - return false - }, }) } diff --git a/apps/studio/data/storage/bucket-create-mutation.ts b/apps/studio/data/storage/bucket-create-mutation.ts index 5199c50f119..cbfbf784996 100644 --- a/apps/studio/data/storage/bucket-create-mutation.ts +++ b/apps/studio/data/storage/bucket-create-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { components } from 'api-types' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { storageKeys } from './keys' type BucketCreateVariables = Omit & { @@ -46,7 +46,7 @@ export const useBucketCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/storage/bucket-delete-mutation.ts b/apps/studio/data/storage/bucket-delete-mutation.ts index 7586d152453..3e69ef78a00 100644 --- a/apps/studio/data/storage/bucket-delete-mutation.ts +++ b/apps/studio/data/storage/bucket-delete-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { del, handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { storageKeys } from './keys' type BucketDeleteVariables = { @@ -34,7 +34,7 @@ export const useBucketDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/storage/bucket-empty-mutation.ts b/apps/studio/data/storage/bucket-empty-mutation.ts index 6598028c813..a3aaeb5926f 100644 --- a/apps/studio/data/storage/bucket-empty-mutation.ts +++ b/apps/studio/data/storage/bucket-empty-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { storageKeys } from './keys' export type BucketEmptyVariables = { @@ -29,7 +29,7 @@ export const useBucketEmptyMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/storage/bucket-object-delete-mutation.ts b/apps/studio/data/storage/bucket-object-delete-mutation.ts index 2554d7feedb..3d692fa9c5b 100644 --- a/apps/studio/data/storage/bucket-object-delete-mutation.ts +++ b/apps/studio/data/storage/bucket-object-delete-mutation.ts @@ -1,8 +1,8 @@ -import { UseMutationOptions, useMutation, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { del, handleError } from 'data/fetchers' import { toast } from 'sonner' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' type DeleteBucketObjectParams = { projectRef: string @@ -39,7 +39,7 @@ export const useBucketObjectDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/storage/bucket-object-download-mutation.ts b/apps/studio/data/storage/bucket-object-download-mutation.ts index 5fb6df6752d..7e9bcc3b4ac 100644 --- a/apps/studio/data/storage/bucket-object-download-mutation.ts +++ b/apps/studio/data/storage/bucket-object-download-mutation.ts @@ -1,10 +1,10 @@ -import { UseMutationOptions, useMutation } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { components } from 'data/api' import { fetchPost } from 'data/fetchers' import { API_URL, IS_PLATFORM } from 'lib/constants' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' type DownloadBucketObjectParams = { projectRef: string @@ -34,7 +34,7 @@ export const useBucketObjectDownloadMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/storage/bucket-object-get-public-url-mutation.ts b/apps/studio/data/storage/bucket-object-get-public-url-mutation.ts index d9b3274d83f..88718fa9926 100644 --- a/apps/studio/data/storage/bucket-object-get-public-url-mutation.ts +++ b/apps/studio/data/storage/bucket-object-get-public-url-mutation.ts @@ -1,9 +1,9 @@ -import { UseMutationOptions, useMutation } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { components } from 'data/api' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' type BucketObjectPublicUrlParams = { projectRef: string @@ -39,7 +39,7 @@ export const useGetBucketObjectPublicUrlMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/storage/bucket-object-sign-mutation.ts b/apps/studio/data/storage/bucket-object-sign-mutation.ts index 82e0435f90b..cfb00628e44 100644 --- a/apps/studio/data/storage/bucket-object-sign-mutation.ts +++ b/apps/studio/data/storage/bucket-object-sign-mutation.ts @@ -1,9 +1,9 @@ -import { UseMutationOptions, useMutation } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { components } from 'data/api' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' type SignBucketObjectParams = { projectRef: string @@ -40,7 +40,7 @@ export const useGetSignBucketObjectMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/storage/bucket-objects-list-mutation.ts b/apps/studio/data/storage/bucket-objects-list-mutation.ts index 1fe470e4ac1..3e1ba39f8b5 100644 --- a/apps/studio/data/storage/bucket-objects-list-mutation.ts +++ b/apps/studio/data/storage/bucket-objects-list-mutation.ts @@ -1,9 +1,9 @@ -import { UseMutationOptions, useMutation } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { components } from 'data/api' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' type ListBucketObjectsParams = { projectRef: string @@ -46,7 +46,7 @@ export const useGetSignBucketObjectMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/storage/bucket-update-mutation.ts b/apps/studio/data/storage/bucket-update-mutation.ts index 63dfcfcd31f..512d3fe11b8 100644 --- a/apps/studio/data/storage/bucket-update-mutation.ts +++ b/apps/studio/data/storage/bucket-update-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { components } from 'api-types' import { patch } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { storageKeys } from './keys' type BucketUpdateVariables = { @@ -58,7 +58,7 @@ export const useBucketUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/storage/buckets-query.ts b/apps/studio/data/storage/buckets-query.ts index 621e069d9d4..0cb30a07c19 100644 --- a/apps/studio/data/storage/buckets-query.ts +++ b/apps/studio/data/storage/buckets-query.ts @@ -1,10 +1,10 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { components } from 'api-types' import { get, handleError } from 'data/fetchers' import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject' import { PROJECT_STATUS } from 'lib/constants' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { storageKeys } from './keys' export type BucketsVariables = { projectRef?: string } @@ -30,7 +30,7 @@ export type BucketsError = ResponseError export const useBucketsQuery = ( { projectRef }: BucketsVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => { const { data: project } = useSelectedProjectQuery() const isActive = project?.status === PROJECT_STATUS.ACTIVE_HEALTHY diff --git a/apps/studio/data/storage/iceberg-namespace-create-mutation.ts b/apps/studio/data/storage/iceberg-namespace-create-mutation.ts index 8b8010a4c8e..ce1a74696f3 100644 --- a/apps/studio/data/storage/iceberg-namespace-create-mutation.ts +++ b/apps/studio/data/storage/iceberg-namespace-create-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { constructHeaders, fetchHandler, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { storageKeys } from './keys' type CreateIcebergNamespaceVariables = { @@ -65,7 +65,11 @@ export const useIcebergNamespaceCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + IcebergNamespaceCreateData, + ResponseError, + CreateIcebergNamespaceVariables + >, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/storage/iceberg-namespace-exists-query.ts b/apps/studio/data/storage/iceberg-namespace-exists-query.ts index 619ec73f6a4..b05e1eee118 100644 --- a/apps/studio/data/storage/iceberg-namespace-exists-query.ts +++ b/apps/studio/data/storage/iceberg-namespace-exists-query.ts @@ -1,7 +1,7 @@ -import { UseQueryOptions, useQuery } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { constructHeaders, fetchHandler, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { storageKeys } from './keys' type ExistsNamespaceVariables = { @@ -54,7 +54,7 @@ export const useIcebergNamespaceExistsQuery = = {} + }: UseCustomQueryOptions = {} ) => { return useQuery({ queryKey: storageKeys.icebergNamespace(params.catalogUri, params.warehouse, params.namespace), diff --git a/apps/studio/data/storage/iceberg-namespace-tables-query.ts b/apps/studio/data/storage/iceberg-namespace-tables-query.ts index 2e642578060..6fe81e573f8 100644 --- a/apps/studio/data/storage/iceberg-namespace-tables-query.ts +++ b/apps/studio/data/storage/iceberg-namespace-tables-query.ts @@ -1,7 +1,7 @@ -import { UseQueryOptions, useQuery } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { constructHeaders, fetchHandler, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { storageKeys } from './keys' type GetNamespaceTablesVariables = { @@ -65,7 +65,7 @@ export const useIcebergNamespaceTablesQuery = = {} + }: UseCustomQueryOptions = {} ) => { return useQuery({ queryKey: storageKeys.icebergNamespaceTables( diff --git a/apps/studio/data/storage/iceberg-namespaces-query.ts b/apps/studio/data/storage/iceberg-namespaces-query.ts index 7becfb28c12..035e86c4f8a 100644 --- a/apps/studio/data/storage/iceberg-namespaces-query.ts +++ b/apps/studio/data/storage/iceberg-namespaces-query.ts @@ -1,7 +1,7 @@ -import { UseQueryOptions, useQuery } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { constructHeaders, fetchHandler, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { storageKeys } from './keys' type GetNamespacesVariables = { @@ -55,7 +55,7 @@ export type IcebergNamespacesError = ResponseError export const useIcebergNamespacesQuery = ( params: GetNamespacesVariables, - { ...options }: UseQueryOptions = {} + { ...options }: UseCustomQueryOptions = {} ) => { return useQuery({ queryKey: storageKeys.icebergNamespaces(params.catalogUri, params.warehouse), diff --git a/apps/studio/data/storage/iceberg-wrapper-create-mutation.ts b/apps/studio/data/storage/iceberg-wrapper-create-mutation.ts index 0b2c08edf97..d8703c18241 100644 --- a/apps/studio/data/storage/iceberg-wrapper-create-mutation.ts +++ b/apps/studio/data/storage/iceberg-wrapper-create-mutation.ts @@ -4,7 +4,7 @@ import { WRAPPERS } from 'components/interfaces/Integrations/Wrappers/Wrappers.c import { getAnalyticsBucketFDWName, getAnalyticsBucketS3KeyName, -} from 'components/interfaces/Storage/AnalyticsBucketDetails/AnalyticsBucketDetails.utils' +} from 'components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/AnalyticsBucketDetails.utils' import { getCatalogURI, getConnectionURL, diff --git a/apps/studio/data/storage/keys.ts b/apps/studio/data/storage/keys.ts index 5d796b07b0d..2ff2c226d0e 100644 --- a/apps/studio/data/storage/keys.ts +++ b/apps/studio/data/storage/keys.ts @@ -2,6 +2,12 @@ export const storageKeys = { buckets: (projectRef: string | undefined) => ['projects', projectRef, 'buckets'] as const, analyticsBuckets: (projectRef: string | undefined) => ['projects', projectRef, 'analytics-buckets'] as const, + vectorBuckets: (projectRef: string | undefined) => + ['projects', projectRef, 'vector-buckets'] as const, + vectorBucket: (projectRef: string | undefined, vectorbucketName: string | undefined) => + ['projects', projectRef, 'vector-bucket', vectorbucketName] as const, + vectorBucketsIndexes: (projectRef: string | undefined, vectorBucketName: string | undefined) => + ['projects', projectRef, 'vector-buckets', vectorBucketName, 'indexes'] as const, archive: (projectRef: string | undefined) => ['projects', projectRef, 'archive'] as const, icebergNamespaces: (catalog: string, warehouse: string) => ['catalog', catalog, 'warehouse', warehouse, 'namespaces'] as const, diff --git a/apps/studio/data/storage/object-move-mutation.ts b/apps/studio/data/storage/object-move-mutation.ts index 7994f95ceeb..f1869fb523e 100644 --- a/apps/studio/data/storage/object-move-mutation.ts +++ b/apps/studio/data/storage/object-move-mutation.ts @@ -1,8 +1,8 @@ -import { UseMutationOptions, useMutation } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' type MoveStorageObjectParams = { projectRef: string @@ -42,7 +42,7 @@ export const useGetSignBucketObjectMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/storage/s3-access-key-create-mutation.ts b/apps/studio/data/storage/s3-access-key-create-mutation.ts index 68699bbcfe9..362d47ef557 100644 --- a/apps/studio/data/storage/s3-access-key-create-mutation.ts +++ b/apps/studio/data/storage/s3-access-key-create-mutation.ts @@ -1,8 +1,8 @@ -import { UseMutationOptions, useMutation, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { storageCredentialsKeys } from './s3-access-key-keys' type CreateS3AccessKeyCredentialVariables = { @@ -32,7 +32,11 @@ export function useS3AccessKeyCreateMutation({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + S3AccessKeyCreateData, + ResponseError, + CreateS3AccessKeyCredentialVariables + >, 'mutationFn' > = {}) { const queryClient = useQueryClient() diff --git a/apps/studio/data/storage/s3-access-key-delete-mutation.ts b/apps/studio/data/storage/s3-access-key-delete-mutation.ts index 1e92a9954ef..da77560d205 100644 --- a/apps/studio/data/storage/s3-access-key-delete-mutation.ts +++ b/apps/studio/data/storage/s3-access-key-delete-mutation.ts @@ -1,8 +1,8 @@ -import { UseMutationOptions, useMutation, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { del, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { storageCredentialsKeys } from './s3-access-key-keys' type S3AccessKeyDeleteVariables = { @@ -35,7 +35,7 @@ export function useS3AccessKeyDeleteMutation({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) { const queryClient = useQueryClient() diff --git a/apps/studio/data/storage/s3-access-key-query.ts b/apps/studio/data/storage/s3-access-key-query.ts index bf5990c4aaf..9f1a11962f4 100644 --- a/apps/studio/data/storage/s3-access-key-query.ts +++ b/apps/studio/data/storage/s3-access-key-query.ts @@ -1,9 +1,9 @@ -import { UseQueryOptions, useQuery } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { components } from 'api-types' import { get, handleError } from 'data/fetchers' import { IS_PLATFORM } from 'lib/constants' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { storageCredentialsKeys } from './s3-access-key-keys' type StorageCredentialsVariables = { projectRef?: string } @@ -31,7 +31,10 @@ export type StorageCredentialsData = Awaited( { projectRef }: StorageCredentialsVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: storageCredentialsKeys.credentials(projectRef), diff --git a/apps/studio/data/storage/storage-archive-create-mutation.ts b/apps/studio/data/storage/storage-archive-create-mutation.ts index 473502dc99e..e1ade6a6ff5 100644 --- a/apps/studio/data/storage/storage-archive-create-mutation.ts +++ b/apps/studio/data/storage/storage-archive-create-mutation.ts @@ -1,8 +1,8 @@ -import { UseMutationOptions, useMutation, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { storageKeys } from './keys' type StorageArchiveCreateVariables = { @@ -27,7 +27,7 @@ export function useStorageArchiveCreateMutation({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) { const queryClient = useQueryClient() diff --git a/apps/studio/data/storage/storage-archive-query.ts b/apps/studio/data/storage/storage-archive-query.ts index c5d715c383c..7eeabe1a790 100644 --- a/apps/studio/data/storage/storage-archive-query.ts +++ b/apps/studio/data/storage/storage-archive-query.ts @@ -1,7 +1,7 @@ -import { UseQueryOptions, useQuery } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { storageKeys } from './keys' type StorageArchiveVariables = { projectRef?: string } @@ -27,7 +27,10 @@ export type StorageArchiveData = Awaited> export const useStorageArchiveQuery = ( { projectRef }: StorageArchiveVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: storageKeys.archive(projectRef), diff --git a/apps/studio/data/storage/vector-bucket-create-mutation.ts b/apps/studio/data/storage/vector-bucket-create-mutation.ts new file mode 100644 index 00000000000..749b2a906e1 --- /dev/null +++ b/apps/studio/data/storage/vector-bucket-create-mutation.ts @@ -0,0 +1,56 @@ +import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { toast } from 'sonner' + +import { handleError, post } from 'data/fetchers' +import type { ResponseError } from 'types' +import { storageKeys } from './keys' + +type VectorBucketCreateVariables = { + projectRef: string + bucketName: string +} + +async function createVectorBucket({ projectRef, bucketName }: VectorBucketCreateVariables) { + if (!projectRef) throw new Error('projectRef is required') + if (!bucketName) throw new Error('Bucket name is required') + + const { data, error } = await post('/platform/storage/{ref}/vector-buckets', { + params: { path: { ref: projectRef } }, + body: { bucketName: bucketName }, + }) + + if (error) handleError(error) + + // [Joshen] JFYI typed incorrectly in API, to fix + return data as { name: string } +} + +type VectorBucketCreateData = Awaited> + +export const useVectorBucketCreateMutation = ({ + onSuccess, + onError, + ...options +}: Omit< + UseMutationOptions, + 'mutationFn' +> = {}) => { + const queryClient = useQueryClient() + + return useMutation({ + mutationFn: (vars) => createVectorBucket(vars), + async onSuccess(data, variables, context) { + const { projectRef } = variables + await queryClient.invalidateQueries(storageKeys.vectorBuckets(projectRef)) + await onSuccess?.(data, variables, context) + }, + async onError(data, variables, context) { + if (onError === undefined) { + toast.error(`Failed to create vector bucket: ${data.message}`) + } else { + onError(data, variables, context) + } + }, + ...options, + }) +} diff --git a/apps/studio/data/storage/vector-bucket-delete-mutation.ts b/apps/studio/data/storage/vector-bucket-delete-mutation.ts new file mode 100644 index 00000000000..2627fb9dd75 --- /dev/null +++ b/apps/studio/data/storage/vector-bucket-delete-mutation.ts @@ -0,0 +1,55 @@ +import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { toast } from 'sonner' + +import { del, handleError } from 'data/fetchers' +import type { ResponseError } from 'types' +import { storageKeys } from './keys' + +type VectorBucketDeleteVariables = { + projectRef: string + bucketName: string +} + +async function deleteVectorBucket({ projectRef, bucketName }: VectorBucketDeleteVariables) { + if (!projectRef) throw new Error('projectRef is required') + if (!bucketName) throw new Error('Bucket name is required') + + const { data, error } = await del('/platform/storage/{ref}/vector-buckets/{id}', { + params: { path: { ref: projectRef, id: bucketName } }, + }) + + if (error) handleError(error) + + // [Joshen] JFYI typed incorrectly in API, to fix + return data as { name: string } +} + +type VectorBucketDeleteData = Awaited> + +export const useVectorBucketDeleteMutation = ({ + onSuccess, + onError, + ...options +}: Omit< + UseMutationOptions, + 'mutationFn' +> = {}) => { + const queryClient = useQueryClient() + + return useMutation({ + mutationFn: (vars) => deleteVectorBucket(vars), + async onSuccess(data, variables, context) { + const { projectRef } = variables + await queryClient.invalidateQueries(storageKeys.vectorBuckets(projectRef)) + await onSuccess?.(data, variables, context) + }, + async onError(data, variables, context) { + if (onError === undefined) { + toast.error(`Failed to delete vector bucket: ${data.message}`) + } else { + onError(data, variables, context) + } + }, + ...options, + }) +} diff --git a/apps/studio/data/storage/vector-bucket-index-create-mutation.ts b/apps/studio/data/storage/vector-bucket-index-create-mutation.ts new file mode 100644 index 00000000000..ed78cbb21fb --- /dev/null +++ b/apps/studio/data/storage/vector-bucket-index-create-mutation.ts @@ -0,0 +1,67 @@ +import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { toast } from 'sonner' + +import type { components } from 'api-types' +import { handleError, post } from 'data/fetchers' +import type { ResponseError } from 'types' +import { storageKeys } from './keys' + +type VectorBucketIndexCreateVariables = components['schemas']['CreateBucketIndexBody'] & { + projectRef: string + bucketName: string +} + +async function createVectorBucketIndex({ + projectRef, + bucketName, + ...rest +}: VectorBucketIndexCreateVariables) { + if (!projectRef) throw new Error('projectRef is required') + if (!bucketName) throw new Error('Bucket name is required') + + const { data, error } = await post('/platform/storage/{ref}/vector-buckets/{id}/indexes', { + params: { path: { ref: projectRef, id: bucketName } }, + body: { + dataType: 'float32', + dimension: rest.dimension, + distanceMetric: rest.distanceMetric, + indexName: rest.indexName, + metadataKeys: rest.metadataKeys, + }, + }) + + if (error) handleError(error) + + // [Joshen] JFYI typed incorrectly in API, to fix + return data as { name: string } +} + +type VectorBucketIndexCreateData = Awaited> + +export const useVectorBucketIndexCreateMutation = ({ + onSuccess, + onError, + ...options +}: Omit< + UseMutationOptions, + 'mutationFn' +> = {}) => { + const queryClient = useQueryClient() + + return useMutation({ + mutationFn: (vars) => createVectorBucketIndex(vars), + async onSuccess(data, variables, context) { + const { projectRef, bucketName } = variables + await queryClient.invalidateQueries(storageKeys.vectorBucketsIndexes(projectRef, bucketName)) + await onSuccess?.(data, variables, context) + }, + async onError(data, variables, context) { + if (onError === undefined) { + toast.error(`Failed to create vector bucket index: ${data.message}`) + } else { + onError(data, variables, context) + } + }, + ...options, + }) +} diff --git a/apps/studio/data/storage/vector-bucket-index-delete-mutation.ts b/apps/studio/data/storage/vector-bucket-index-delete-mutation.ts new file mode 100644 index 00000000000..1f3f8514f51 --- /dev/null +++ b/apps/studio/data/storage/vector-bucket-index-delete-mutation.ts @@ -0,0 +1,64 @@ +import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { toast } from 'sonner' + +import { del, handleError } from 'data/fetchers' +import type { ResponseError } from 'types' +import { storageKeys } from './keys' + +type VectorBucketIndexDeleteVariables = { + projectRef: string + bucketName: string + indexName: string +} + +export async function deleteVectorBucketIndex({ + projectRef, + bucketName, + indexName, +}: VectorBucketIndexDeleteVariables) { + if (!projectRef) throw new Error('projectRef is required') + if (!bucketName) throw new Error('Bucket name is required') + if (!indexName) throw new Error('Index name is required') + + const { data, error } = await del( + '/platform/storage/{ref}/vector-buckets/{id}/indexes/{indexName}', + { + params: { path: { ref: projectRef, id: bucketName, indexName } }, + } + ) + + if (error) handleError(error) + + // [Joshen] JFYI typed incorrectly in API, to fix + return data as { name: string } +} + +type VectorBucketIndexDeleteData = Awaited> + +export const useVectorBucketIndexDeleteMutation = ({ + onSuccess, + onError, + ...options +}: Omit< + UseMutationOptions, + 'mutationFn' +> = {}) => { + const queryClient = useQueryClient() + + return useMutation({ + mutationFn: (vars) => deleteVectorBucketIndex(vars), + async onSuccess(data, variables, context) { + const { projectRef, bucketName } = variables + await queryClient.invalidateQueries(storageKeys.vectorBucketsIndexes(projectRef, bucketName)) + await onSuccess?.(data, variables, context) + }, + async onError(data, variables, context) { + if (onError === undefined) { + toast.error(`Failed to delete vector bucket index: ${data.message}`) + } else { + onError(data, variables, context) + } + }, + ...options, + }) +} diff --git a/apps/studio/data/storage/vector-bucket-query.ts b/apps/studio/data/storage/vector-bucket-query.ts new file mode 100644 index 00000000000..7d270036199 --- /dev/null +++ b/apps/studio/data/storage/vector-bucket-query.ts @@ -0,0 +1,49 @@ +import { useQuery, UseQueryOptions } from '@tanstack/react-query' + +import { components } from 'api-types' +import { get, handleError } from 'data/fetchers' +import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject' +import { PROJECT_STATUS } from 'lib/constants' +import type { ResponseError } from 'types' +import { storageKeys } from './keys' + +// [Joshen] JFYI typed incorrectly in API, to fix by adding creationTime to APi +export type VectorBucket = components['schemas']['StorageVectorBucketResponse'] & { + creationTime: string +} + +export type VectorBucketVariables = { projectRef?: string; vectorBucketName?: string } + +export async function getVectorBucket( + { projectRef, vectorBucketName }: VectorBucketVariables, + signal?: AbortSignal +) { + if (!projectRef) throw new Error('projectRef is required') + if (!vectorBucketName) throw new Error('vectorBucketName is required') + + const { data, error } = await get('/platform/storage/{ref}/vector-buckets/{id}', { + params: { path: { ref: projectRef, id: vectorBucketName } }, + signal, + }) + + if (error) handleError(error) + return data as VectorBucket +} + +export type VectorBucketData = Awaited> +export type VectorBucketError = ResponseError + +export const useVectorBucketQuery = ( + { projectRef, vectorBucketName }: VectorBucketVariables, + { enabled = true, ...options }: UseQueryOptions = {} +) => { + const { data: project } = useSelectedProjectQuery() + const isActive = project?.status === PROJECT_STATUS.ACTIVE_HEALTHY + + return useQuery({ + queryKey: storageKeys.vectorBucket(projectRef, vectorBucketName), + queryFn: ({ signal }) => getVectorBucket({ projectRef, vectorBucketName }, signal), + enabled: enabled && typeof projectRef !== 'undefined' && isActive, + ...options, + }) +} diff --git a/apps/studio/data/storage/vector-buckets-indexes-query.ts b/apps/studio/data/storage/vector-buckets-indexes-query.ts new file mode 100644 index 00000000000..16804b1babe --- /dev/null +++ b/apps/studio/data/storage/vector-buckets-indexes-query.ts @@ -0,0 +1,53 @@ +import { useQuery, UseQueryOptions } from '@tanstack/react-query' + +import { components } from 'api-types' +import { get, handleError } from 'data/fetchers' +import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject' +import { PROJECT_STATUS } from 'lib/constants' +import type { ResponseError } from 'types' +import { storageKeys } from './keys' + +export type VectorBucketIndex = + components['schemas']['StorageVectorBucketListIndexesResponse']['indexes'][number] +export type GetVectorBucketsIndexesVariables = { projectRef?: string; vectorBucketName?: string } + +export async function getVectorBucketsIndexes( + { projectRef, vectorBucketName }: GetVectorBucketsIndexesVariables, + signal?: AbortSignal +) { + if (!projectRef) throw new Error('projectRef is required') + if (!vectorBucketName) throw new Error('vectorBucketName is required') + + const { data, error } = await get('/platform/storage/{ref}/vector-buckets/{id}/indexes', { + params: { path: { ref: projectRef, id: vectorBucketName } }, + signal, + }) + + if (error) handleError(error) + return data +} + +export type VectorBucketsIndexesData = Awaited> +export type VectorBucketsIndexesError = ResponseError + +export const useVectorBucketsIndexesQuery = ( + { projectRef, vectorBucketName }: GetVectorBucketsIndexesVariables, + { + enabled = true, + ...options + }: UseQueryOptions = {} +) => { + const { data: project } = useSelectedProjectQuery() + const isActive = project?.status === PROJECT_STATUS.ACTIVE_HEALTHY + + return useQuery({ + queryKey: storageKeys.vectorBucketsIndexes(projectRef, vectorBucketName), + queryFn: ({ signal }) => getVectorBucketsIndexes({ projectRef, vectorBucketName }, signal), + enabled: + enabled && + isActive && + typeof projectRef !== 'undefined' && + typeof vectorBucketName !== 'undefined', + ...options, + }) +} diff --git a/apps/studio/data/storage/vector-buckets-query.ts b/apps/studio/data/storage/vector-buckets-query.ts new file mode 100644 index 00000000000..79ca60b04e4 --- /dev/null +++ b/apps/studio/data/storage/vector-buckets-query.ts @@ -0,0 +1,44 @@ +import { useQuery, UseQueryOptions } from '@tanstack/react-query' + +import { get, handleError } from 'data/fetchers' +import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject' +import { PROJECT_STATUS } from 'lib/constants' +import type { ResponseError } from 'types' +import { storageKeys } from './keys' + +export type VectorBucketsVariables = { projectRef?: string } + +export async function getVectorBuckets( + { projectRef }: VectorBucketsVariables, + signal?: AbortSignal +) { + if (!projectRef) throw new Error('projectRef is required') + + const { data, error } = await get('/platform/storage/{ref}/vector-buckets', { + params: { path: { ref: projectRef } }, + signal, + }) + + if (error) handleError(error) + + // [Joshen] JFYI typed incorrectly in API, to fix by adding creationTime to API + return data as { vectorBuckets: { vectorBucketName: string; creationTime: string }[] } +} + +export type VectorBucketsData = Awaited> +export type VectorBucketsError = ResponseError + +export const useVectorBucketsQuery = ( + { projectRef }: VectorBucketsVariables, + { enabled = true, ...options }: UseQueryOptions = {} +) => { + const { data: project } = useSelectedProjectQuery() + const isActive = project?.status === PROJECT_STATUS.ACTIVE_HEALTHY + + return useQuery({ + queryKey: storageKeys.vectorBuckets(projectRef), + queryFn: ({ signal }) => getVectorBuckets({ projectRef }, signal), + enabled: enabled && typeof projectRef !== 'undefined' && isActive, + ...options, + }) +} diff --git a/apps/studio/data/stripe/setup-intent-mutation.ts b/apps/studio/data/stripe/setup-intent-mutation.ts index 6cae09272f6..68caf34d4a1 100644 --- a/apps/studio/data/stripe/setup-intent-mutation.ts +++ b/apps/studio/data/stripe/setup-intent-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { components } from 'api-types' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type SetupIntentVariables = { hcaptchaToken: string @@ -26,7 +26,7 @@ export const useSetupIntent = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/subscriptions/org-plans-query.ts b/apps/studio/data/subscriptions/org-plans-query.ts index 502b2c420b3..d7239cc44ee 100644 --- a/apps/studio/data/subscriptions/org-plans-query.ts +++ b/apps/studio/data/subscriptions/org-plans-query.ts @@ -1,8 +1,9 @@ import { PermissionAction } from '@supabase/shared-types/out/constants' -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' import { useAsyncCheckPermissions } from 'hooks/misc/useCheckPermissions' +import { UseCustomQueryOptions } from 'types' import { subscriptionKeys } from './keys' export type OrgPlansVariables = { @@ -25,7 +26,7 @@ export type OrgPlansError = unknown export const useOrgPlansQuery = ( { orgSlug }: OrgPlansVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => { const { can: canReadSubscriptions } = useAsyncCheckPermissions( PermissionAction.BILLING_READ, diff --git a/apps/studio/data/subscriptions/org-subscription-confirm-pending-change.ts b/apps/studio/data/subscriptions/org-subscription-confirm-pending-change.ts index 564429b392e..82d1e2794c6 100644 --- a/apps/studio/data/subscriptions/org-subscription-confirm-pending-change.ts +++ b/apps/studio/data/subscriptions/org-subscription-confirm-pending-change.ts @@ -1,4 +1,4 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import type { components } from 'api-types' @@ -6,7 +6,7 @@ import { handleError, post } from 'data/fetchers' import { invoicesKeys } from 'data/invoices/keys' import { organizationKeys } from 'data/organizations/keys' import { usageKeys } from 'data/usage/keys' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { subscriptionKeys } from './keys' export type PendingSubscriptionChangeVariables = { @@ -47,7 +47,7 @@ export const useConfirmPendingSubscriptionChangeMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< PendingSubscriptionChangeData, ResponseError, PendingSubscriptionChangeVariables diff --git a/apps/studio/data/subscriptions/org-subscription-confirm-pending-create.ts b/apps/studio/data/subscriptions/org-subscription-confirm-pending-create.ts index 5124b82bbb0..07054aefcf9 100644 --- a/apps/studio/data/subscriptions/org-subscription-confirm-pending-create.ts +++ b/apps/studio/data/subscriptions/org-subscription-confirm-pending-create.ts @@ -1,4 +1,4 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import type { components } from 'api-types' @@ -6,7 +6,7 @@ import { handleError, post } from 'data/fetchers' import { organizationKeys } from 'data/organizations/keys' import { castOrganizationResponseToOrganization } from 'data/organizations/organizations-query' import { permissionKeys } from 'data/permissions/keys' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type PendingSubscriptionCreateVariables = { payment_intent_id: string @@ -41,7 +41,7 @@ export const useConfirmPendingSubscriptionCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< PendingSubscriptionCreateData, ResponseError, PendingSubscriptionCreateVariables diff --git a/apps/studio/data/subscriptions/org-subscription-query.ts b/apps/studio/data/subscriptions/org-subscription-query.ts index f8747efb49b..8b3fc04da3e 100644 --- a/apps/studio/data/subscriptions/org-subscription-query.ts +++ b/apps/studio/data/subscriptions/org-subscription-query.ts @@ -1,9 +1,9 @@ import { PermissionAction } from '@supabase/shared-types/out/constants' -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' import { useAsyncCheckPermissions } from 'hooks/misc/useCheckPermissions' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { subscriptionKeys } from './keys' export type OrgSubscriptionVariables = { @@ -33,7 +33,7 @@ export const useOrgSubscriptionQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => { // [Joshen] Thinking it makes sense to add this check at the RQ level - prevent // unnecessary requests, although this behaviour still needs handling on the UI diff --git a/apps/studio/data/subscriptions/org-subscription-update-mutation.ts b/apps/studio/data/subscriptions/org-subscription-update-mutation.ts index f03dc3777f5..8d17514fcd4 100644 --- a/apps/studio/data/subscriptions/org-subscription-update-mutation.ts +++ b/apps/studio/data/subscriptions/org-subscription-update-mutation.ts @@ -1,4 +1,4 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { handleError, put } from 'data/fetchers' import { invoicesKeys } from 'data/invoices/keys' import { organizationKeys } from 'data/organizations/keys' @@ -8,6 +8,7 @@ import { toast } from 'sonner' import type { ResponseError } from 'types/base' import { subscriptionKeys } from './keys' import type { SubscriptionTier } from './types' +import { UseCustomMutationOptions } from 'types' export type OrgSubscriptionUpdateVariables = { slug: string @@ -54,7 +55,11 @@ export const useOrgSubscriptionUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + OrgSubscriptionUpdateData, + ResponseError, + OrgSubscriptionUpdateVariables + >, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/subscriptions/project-addon-remove-mutation.ts b/apps/studio/data/subscriptions/project-addon-remove-mutation.ts index d842c89ecf6..077d21b0144 100644 --- a/apps/studio/data/subscriptions/project-addon-remove-mutation.ts +++ b/apps/studio/data/subscriptions/project-addon-remove-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { del, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { subscriptionKeys } from './keys' import type { AddonVariantId } from './types' @@ -38,7 +38,7 @@ export const useProjectAddonRemoveMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/subscriptions/project-addon-update-mutation.ts b/apps/studio/data/subscriptions/project-addon-update-mutation.ts index c77075da5c1..9765b15071d 100644 --- a/apps/studio/data/subscriptions/project-addon-update-mutation.ts +++ b/apps/studio/data/subscriptions/project-addon-update-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { subscriptionKeys } from './keys' import type { AddonVariantId, ProjectAddonType } from './types' @@ -45,7 +45,7 @@ export const useProjectAddonUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > & { suppressToast?: boolean } = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/subscriptions/project-addons-query.ts b/apps/studio/data/subscriptions/project-addons-query.ts index b92c843ae62..b061f037938 100644 --- a/apps/studio/data/subscriptions/project-addons-query.ts +++ b/apps/studio/data/subscriptions/project-addons-query.ts @@ -1,8 +1,8 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' import { IS_PLATFORM } from 'lib/constants' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { subscriptionKeys } from './keys' export type ProjectAddonsVariables = { @@ -32,7 +32,10 @@ export type ProjectAddonsError = ResponseError export const useProjectAddonsQuery = ( { projectRef }: ProjectAddonsVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: subscriptionKeys.addons(projectRef), diff --git a/apps/studio/data/support/generate-attachment-urls-mutation.ts b/apps/studio/data/support/generate-attachment-urls-mutation.ts index 74e47f003e1..65efe6a6353 100644 --- a/apps/studio/data/support/generate-attachment-urls-mutation.ts +++ b/apps/studio/data/support/generate-attachment-urls-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { constructHeaders } from 'data/fetchers' import { BASE_PATH } from 'lib/constants' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type GenerateAttachmentURLsResponse = { title: string @@ -52,7 +52,11 @@ export const useGenerateAttachmentURLsMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + GenerateAttachmentURLsData, + ResponseError, + GenerateAttachmentURLsVariables + >, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/table-editor/table-editor-query.ts b/apps/studio/data/table-editor/table-editor-query.ts index f92a7c55241..354456a1dbb 100644 --- a/apps/studio/data/table-editor/table-editor-query.ts +++ b/apps/studio/data/table-editor/table-editor-query.ts @@ -1,9 +1,10 @@ -import { QueryClient, useQuery, UseQueryOptions } from '@tanstack/react-query' +import { QueryClient, useQuery } from '@tanstack/react-query' import { executeSql, ExecuteSqlError } from '../sql/execute-sql-query' import { tableEditorKeys } from './keys' import { getTableEditorSql } from './table-editor-query-sql' import { Entity } from './table-editor-types' +import { UseCustomQueryOptions } from 'types' type TableEditorArgs = { id?: number @@ -41,7 +42,10 @@ export type TableEditorError = ExecuteSqlError export const useTableEditorQuery = ( { projectRef, connectionString, id }: TableEditorVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: tableEditorKeys.tableEditor(projectRef, id), diff --git a/apps/studio/data/table-rows/get-cell-value-mutation.ts b/apps/studio/data/table-rows/get-cell-value-mutation.ts index c18e319a94b..7cf2454078f 100644 --- a/apps/studio/data/table-rows/get-cell-value-mutation.ts +++ b/apps/studio/data/table-rows/get-cell-value-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { toast } from 'sonner' import { Query } from '@supabase/pg-meta/src/query' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export type GetCellValueVariables = { projectRef: string @@ -44,7 +44,7 @@ export const useGetCellValueMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { return useMutation({ diff --git a/apps/studio/data/table-rows/table-row-create-mutation.ts b/apps/studio/data/table-rows/table-row-create-mutation.ts index f182bc1c6f6..b242b1eb2e6 100644 --- a/apps/studio/data/table-rows/table-row-create-mutation.ts +++ b/apps/studio/data/table-rows/table-row-create-mutation.ts @@ -1,4 +1,4 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { Query } from '@supabase/pg-meta/src/query' @@ -7,7 +7,7 @@ import { useSendEventMutation } from 'data/telemetry/send-event-mutation' import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization' import { RoleImpersonationState, wrapWithRoleImpersonation } from 'lib/role-impersonation' import { isRoleImpersonationEnabled } from 'state/role-impersonation-state' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { tableRowKeys } from './keys' export type TableRowCreateVariables = { @@ -63,7 +63,7 @@ export const useTableRowCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/table-rows/table-row-delete-all-mutation.ts b/apps/studio/data/table-rows/table-row-delete-all-mutation.ts index fbbc44538fe..fbd0addedc2 100644 --- a/apps/studio/data/table-rows/table-row-delete-all-mutation.ts +++ b/apps/studio/data/table-rows/table-row-delete-all-mutation.ts @@ -1,4 +1,4 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { Query } from '@supabase/pg-meta/src/query' @@ -7,7 +7,7 @@ import { executeSql } from 'data/sql/execute-sql-query' import { Entity } from 'data/table-editor/table-editor-types' import { RoleImpersonationState, wrapWithRoleImpersonation } from 'lib/role-impersonation' import { isRoleImpersonationEnabled } from 'state/role-impersonation-state' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { tableRowKeys } from './keys' import { formatFilterValue } from './utils' @@ -67,7 +67,7 @@ export const useTableRowDeleteAllMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/table-rows/table-row-delete-mutation.tsx b/apps/studio/data/table-rows/table-row-delete-mutation.tsx index 5588dad5f31..44cd66eac91 100644 --- a/apps/studio/data/table-rows/table-row-delete-mutation.tsx +++ b/apps/studio/data/table-rows/table-row-delete-mutation.tsx @@ -1,4 +1,4 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { Query } from '@supabase/pg-meta/src/query' @@ -10,7 +10,7 @@ import { Entity } from 'data/table-editor/table-editor-types' import { DOCS_URL } from 'lib/constants' import { RoleImpersonationState, wrapWithRoleImpersonation } from 'lib/role-impersonation' import { isRoleImpersonationEnabled } from 'state/role-impersonation-state' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { tableRowKeys } from './keys' import { getPrimaryKeys } from './utils' @@ -67,7 +67,7 @@ export const useTableRowDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/table-rows/table-row-truncate-mutation.ts b/apps/studio/data/table-rows/table-row-truncate-mutation.ts index 9e7657571e8..1a998d54597 100644 --- a/apps/studio/data/table-rows/table-row-truncate-mutation.ts +++ b/apps/studio/data/table-rows/table-row-truncate-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { Query } from '@supabase/pg-meta/src/query' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { tableRowKeys } from './keys' export type TableRowTruncateVariables = { @@ -41,7 +41,7 @@ export const useTableRowTruncateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/table-rows/table-row-update-mutation.ts b/apps/studio/data/table-rows/table-row-update-mutation.ts index cb3e0985897..8f615247424 100644 --- a/apps/studio/data/table-rows/table-row-update-mutation.ts +++ b/apps/studio/data/table-rows/table-row-update-mutation.ts @@ -1,11 +1,11 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { Query } from '@supabase/pg-meta/src/query' import { executeSql } from 'data/sql/execute-sql-query' import { RoleImpersonationState, wrapWithRoleImpersonation } from 'lib/role-impersonation' import { isRoleImpersonationEnabled } from 'state/role-impersonation-state' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { tableRowKeys } from './keys' export type TableRowUpdateVariables = { @@ -69,7 +69,7 @@ export const useTableRowUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/table-rows/table-rows-count-query.ts b/apps/studio/data/table-rows/table-rows-count-query.ts index ccc5a00cb08..4016f7949b5 100644 --- a/apps/studio/data/table-rows/table-rows-count-query.ts +++ b/apps/studio/data/table-rows/table-rows-count-query.ts @@ -3,7 +3,7 @@ import { COUNT_ESTIMATE_SQL, THRESHOLD_COUNT, } from '@supabase/pg-meta/src/sql/studio/get-count-estimate' -import { QueryClient, useQuery, useQueryClient, type UseQueryOptions } from '@tanstack/react-query' +import { QueryClient, useQuery, useQueryClient } from '@tanstack/react-query' import { parseSupaTable } from 'components/grid/SupabaseGrid.utils' import type { Filter, SupaTable } from 'components/grid/types' @@ -13,6 +13,7 @@ import { isRoleImpersonationEnabled } from 'state/role-impersonation-state' import { executeSql, ExecuteSqlError } from '../sql/execute-sql-query' import { tableRowKeys } from './keys' import { formatFilterValue } from './utils' +import { UseCustomQueryOptions } from 'types' type GetTableRowsCountArgs = { table?: SupaTable @@ -145,7 +146,7 @@ export const useTableRowsCountQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => { const queryClient = useQueryClient() return useQuery({ diff --git a/apps/studio/data/table-rows/table-rows-query.ts b/apps/studio/data/table-rows/table-rows-query.ts index d6afca2f23c..cc96555f9aa 100644 --- a/apps/studio/data/table-rows/table-rows-query.ts +++ b/apps/studio/data/table-rows/table-rows-query.ts @@ -1,11 +1,6 @@ import { Query } from '@supabase/pg-meta/src/query' import { getTableRowsSql } from '@supabase/pg-meta/src/query/table-row-query' -import { - useQuery, - useQueryClient, - type QueryClient, - type UseQueryOptions, -} from '@tanstack/react-query' +import { useQuery, useQueryClient, type QueryClient } from '@tanstack/react-query' import { IS_PLATFORM } from 'common' import { parseSupaTable } from 'components/grid/SupabaseGrid.utils' @@ -17,10 +12,10 @@ import { wrapWithRoleImpersonation, } from 'lib/role-impersonation' import { isRoleImpersonationEnabled } from 'state/role-impersonation-state' +import { ResponseError, UseCustomQueryOptions } from 'types' import { ExecuteSqlError, executeSql } from '../sql/execute-sql-query' import { tableRowKeys } from './keys' import { formatFilterValue } from './utils' -import { ResponseError } from 'types' export interface GetTableRowsArgs { table?: SupaTable @@ -282,7 +277,7 @@ export async function getTableRows( export const useTableRowsQuery = ( { projectRef, connectionString, tableId, ...args }: Omit, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => { const queryClient = useQueryClient() return useQuery({ diff --git a/apps/studio/data/tables/table-create-mutation.ts b/apps/studio/data/tables/table-create-mutation.ts index 3a3717c5a93..eb2a22bfd14 100644 --- a/apps/studio/data/tables/table-create-mutation.ts +++ b/apps/studio/data/tables/table-create-mutation.ts @@ -1,9 +1,9 @@ import pgMeta from '@supabase/pg-meta' -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { tableKeys } from './keys' export type CreateTableBody = { @@ -39,7 +39,7 @@ export const useTableCreateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/tables/table-delete-mutation.ts b/apps/studio/data/tables/table-delete-mutation.ts index 79499c42387..cf68bcce577 100644 --- a/apps/studio/data/tables/table-delete-mutation.ts +++ b/apps/studio/data/tables/table-delete-mutation.ts @@ -1,12 +1,12 @@ import pgMeta from '@supabase/pg-meta' -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { entityTypeKeys } from 'data/entity-types/keys' import { executeSql } from 'data/sql/execute-sql-query' import { tableEditorKeys } from 'data/table-editor/keys' import { viewKeys } from 'data/views/keys' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { tableKeys } from './keys' export type TableDeleteVariables = { @@ -45,7 +45,7 @@ export const useTableDeleteMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/tables/table-retrieve-query.ts b/apps/studio/data/tables/table-retrieve-query.ts index 34f9f173f10..219860136e1 100644 --- a/apps/studio/data/tables/table-retrieve-query.ts +++ b/apps/studio/data/tables/table-retrieve-query.ts @@ -1,8 +1,8 @@ import pgMeta from '@supabase/pg-meta' -import { useQuery, type UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { tableKeys } from './keys' export type TablesVariables = { @@ -39,7 +39,7 @@ export const useTablesQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => { return useQuery({ queryKey: tableKeys.retrieve(projectRef, name, schema), diff --git a/apps/studio/data/tables/table-update-mutation.ts b/apps/studio/data/tables/table-update-mutation.ts index 7b8ce1134b1..fc65061fe8a 100644 --- a/apps/studio/data/tables/table-update-mutation.ts +++ b/apps/studio/data/tables/table-update-mutation.ts @@ -1,11 +1,11 @@ import pgMeta from '@supabase/pg-meta' -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { lintKeys } from 'data/lint/keys' import { executeSql } from 'data/sql/execute-sql-query' import { tableEditorKeys } from 'data/table-editor/keys' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { tableKeys } from './keys' import { CreateTableBody } from './table-create-mutation' @@ -53,7 +53,7 @@ export const useTableUpdateMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/tables/tables-query.ts b/apps/studio/data/tables/tables-query.ts index 5e9c35895ef..f0923b3ecc7 100644 --- a/apps/studio/data/tables/tables-query.ts +++ b/apps/studio/data/tables/tables-query.ts @@ -1,11 +1,11 @@ import type { PostgresTable } from '@supabase/postgres-meta' -import { useQuery, useQueryClient, type UseQueryOptions } from '@tanstack/react-query' +import { useQuery, useQueryClient } from '@tanstack/react-query' import { sortBy } from 'lodash' import { useCallback } from 'react' import { DEFAULT_PLATFORM_APPLICATION_NAME } from '@supabase/pg-meta/src/constants' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { tableKeys } from './keys' export type TablesVariables = { @@ -72,7 +72,7 @@ export type TablesError = ResponseError export const useTablesQuery = ( { projectRef, connectionString, schema, includeColumns }: TablesVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => { return useQuery({ queryKey: tableKeys.list(projectRef, schema, includeColumns), diff --git a/apps/studio/data/tables/tables-roles-access-query.ts b/apps/studio/data/tables/tables-roles-access-query.ts index 70bd5e0fc2a..32f5255f3b1 100644 --- a/apps/studio/data/tables/tables-roles-access-query.ts +++ b/apps/studio/data/tables/tables-roles-access-query.ts @@ -1,8 +1,9 @@ import { getTablesWithAnonAuthenticatedAccessSQL } from '@supabase/pg-meta/src/sql/studio/check-tables-anon-authenticated-access' -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { executeSql, ExecuteSqlError } from '../sql/execute-sql-query' import { tableKeys } from './keys' +import { UseCustomQueryOptions } from 'types' type TablesRolesAccessArgs = { schema: string @@ -37,7 +38,7 @@ export const useTablesRolesAccessQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: tableKeys.rolesAccess(projectRef, schema), diff --git a/apps/studio/data/telemetry/send-event-mutation.ts b/apps/studio/data/telemetry/send-event-mutation.ts index 1968853b7d2..68ad02967b4 100644 --- a/apps/studio/data/telemetry/send-event-mutation.ts +++ b/apps/studio/data/telemetry/send-event-mutation.ts @@ -1,11 +1,11 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { sendTelemetryEvent } from 'common' import { TelemetryEvent } from 'common/telemetry-constants' import { handleError } from 'data/fetchers' import { API_URL } from 'lib/constants' import { useRouter } from 'next/router' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' interface SendEventVariables { event: TelemetryEvent @@ -26,7 +26,10 @@ export const useSendEventMutation = ({ onSuccess, onError, ...options -}: Omit, 'mutationFn'> = {}) => { +}: Omit< + UseCustomMutationOptions, + 'mutationFn' +> = {}) => { const router = useRouter() return useMutation({ diff --git a/apps/studio/data/telemetry/send-reset-mutation.ts b/apps/studio/data/telemetry/send-reset-mutation.ts index b22b19a3880..7d609358883 100644 --- a/apps/studio/data/telemetry/send-reset-mutation.ts +++ b/apps/studio/data/telemetry/send-reset-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions } from '@tanstack/react-query' +import { useMutation } from '@tanstack/react-query' import { handleError, post } from 'data/fetchers' import { IS_PLATFORM } from 'lib/constants' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' export async function sendReset() { if (!IS_PLATFORM) return undefined @@ -18,7 +18,7 @@ export const useSendResetMutation = ({ onSuccess, onError, ...options -}: Omit, 'mutationFn'> = {}) => { +}: Omit, 'mutationFn'> = {}) => { return useMutation({ mutationFn: () => sendReset(), async onSuccess(data, variables, context) { diff --git a/apps/studio/data/third-party-auth/integration-create-mutation.ts b/apps/studio/data/third-party-auth/integration-create-mutation.ts index ab1d4d67cd7..571dbba49b7 100644 --- a/apps/studio/data/third-party-auth/integration-create-mutation.ts +++ b/apps/studio/data/third-party-auth/integration-create-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { handleError, post } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { keys } from './keys' export type CreateThirdPartyAuthVariables = { @@ -42,7 +42,11 @@ export const useCreateThirdPartyAuthIntegrationMutation = ({ onError, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions< + ThirdPartyIntegrationCreateData, + ResponseError, + CreateThirdPartyAuthVariables + >, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/third-party-auth/integration-delete-mutation.ts b/apps/studio/data/third-party-auth/integration-delete-mutation.ts index 493c91eec57..e703a26c0fa 100644 --- a/apps/studio/data/third-party-auth/integration-delete-mutation.ts +++ b/apps/studio/data/third-party-auth/integration-delete-mutation.ts @@ -1,8 +1,8 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { del, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { keys } from './keys' export type DeleteThirdPartyAuthIntegrationVariables = { @@ -33,7 +33,7 @@ export const useDeleteThirdPartyAuthIntegrationMutation = ({ onError, ...options }: Omit< - UseMutationOptions< + UseCustomMutationOptions< DeleteThirdPartyAuthIntegrationData, ResponseError, DeleteThirdPartyAuthIntegrationVariables diff --git a/apps/studio/data/third-party-auth/integrations-query.ts b/apps/studio/data/third-party-auth/integrations-query.ts index 04d7e4a3d11..20975a8fa66 100644 --- a/apps/studio/data/third-party-auth/integrations-query.ts +++ b/apps/studio/data/third-party-auth/integrations-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { components } from 'api-types' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { keys } from './keys' export type GetThirdPartyAuthIntegrationsVariables = { @@ -34,7 +34,7 @@ export const useThirdPartyAuthIntegrationsQuery = = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: keys.integrations(projectRef), diff --git a/apps/studio/data/usage/org-usage-query.ts b/apps/studio/data/usage/org-usage-query.ts index e8a9e7bdf4b..74c7138258a 100644 --- a/apps/studio/data/usage/org-usage-query.ts +++ b/apps/studio/data/usage/org-usage-query.ts @@ -1,9 +1,9 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import type { components } from 'data/api' import { get, handleError } from 'data/fetchers' import { IS_PLATFORM } from 'lib/constants' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { usageKeys } from './keys' export type OrgUsageVariables = { @@ -41,7 +41,7 @@ export type OrgUsageError = ResponseError export const useOrgUsageQuery = ( { orgSlug, projectRef, start, end }: OrgUsageVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: usageKeys.orgUsage( diff --git a/apps/studio/data/usage/resource-warnings-query.ts b/apps/studio/data/usage/resource-warnings-query.ts index 8304d8d5ca4..fff37917a5c 100644 --- a/apps/studio/data/usage/resource-warnings-query.ts +++ b/apps/studio/data/usage/resource-warnings-query.ts @@ -1,9 +1,9 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { IS_PLATFORM } from 'common' import type { components } from 'data/api' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { usageKeys } from './keys' export type ResourceWarningsVariables = { @@ -38,7 +38,7 @@ export const useResourceWarningsQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: usageKeys.resourceWarnings(variables.slug, variables.ref), diff --git a/apps/studio/data/utils/deployment-commit-query.ts b/apps/studio/data/utils/deployment-commit-query.ts index 775e2c417e4..f434268ac26 100644 --- a/apps/studio/data/utils/deployment-commit-query.ts +++ b/apps/studio/data/utils/deployment-commit-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { fetchHandler } from 'data/fetchers' import { BASE_PATH } from 'lib/constants' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' export async function getDeploymentCommit(signal?: AbortSignal) { const response = await fetchHandler(`${BASE_PATH}/api/get-deployment-commit`) @@ -13,7 +13,7 @@ export type DeploymentCommitData = Awaited({ enabled = true, ...options -}: UseQueryOptions = {}) => +}: UseCustomQueryOptions = {}) => useQuery({ queryKey: ['deployment-commit'], queryFn: ({ signal }) => getDeploymentCommit(signal), diff --git a/apps/studio/data/vault/vault-secret-create-mutation.ts b/apps/studio/data/vault/vault-secret-create-mutation.ts index 62a5d96e37b..e70c8462ceb 100644 --- a/apps/studio/data/vault/vault-secret-create-mutation.ts +++ b/apps/studio/data/vault/vault-secret-create-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { executeSql } from 'data/sql/execute-sql-query' import { quoteLiteral } from 'lib/pg-format' -import type { ResponseError, VaultSecret } from 'types' +import type { ResponseError, UseCustomMutationOptions, VaultSecret } from 'types' import { vaultSecretsKeys } from './keys' export type VaultSecretCreateVariables = { @@ -36,7 +36,7 @@ export const useVaultSecretCreateMutation = ({ onSuccess, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/vault/vault-secret-decrypted-value-query.ts b/apps/studio/data/vault/vault-secret-decrypted-value-query.ts index 4657fd2b31c..18e465b8945 100644 --- a/apps/studio/data/vault/vault-secret-decrypted-value-query.ts +++ b/apps/studio/data/vault/vault-secret-decrypted-value-query.ts @@ -1,7 +1,8 @@ import { Query } from '@supabase/pg-meta/src/query' -import { UseQueryOptions, useQuery } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { executeSql } from '../sql/execute-sql-query' import { vaultSecretsKeys } from './keys' +import { UseCustomQueryOptions } from 'types' const vaultSecretDecryptedValueQuery = (id: string) => { const sql = new Query() @@ -55,7 +56,7 @@ export const useVaultSecretDecryptedValueQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: vaultSecretsKeys.getDecryptedValue(projectRef, id), diff --git a/apps/studio/data/vault/vault-secret-delete-mutation.ts b/apps/studio/data/vault/vault-secret-delete-mutation.ts index 6ef380309b4..541243afa84 100644 --- a/apps/studio/data/vault/vault-secret-delete-mutation.ts +++ b/apps/studio/data/vault/vault-secret-delete-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { Query } from '@supabase/pg-meta/src/query' import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomMutationOptions } from 'types' import { vaultSecretsKeys } from './keys' export type VaultSecretDeleteVariables = { @@ -29,7 +29,7 @@ export const useVaultSecretDeleteMutation = ({ onSuccess, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/vault/vault-secret-update-mutation.ts b/apps/studio/data/vault/vault-secret-update-mutation.ts index 753aee03a8f..1619543e67a 100644 --- a/apps/studio/data/vault/vault-secret-update-mutation.ts +++ b/apps/studio/data/vault/vault-secret-update-mutation.ts @@ -1,9 +1,9 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' +import { useMutation, useQueryClient } from '@tanstack/react-query' import { toast } from 'sonner' import { executeSql } from 'data/sql/execute-sql-query' import { quoteLiteral } from 'lib/pg-format' -import type { ResponseError, VaultSecret } from 'types' +import type { ResponseError, UseCustomMutationOptions, VaultSecret } from 'types' import { vaultSecretsKeys } from './keys' export type VaultSecretUpdateVariables = { @@ -39,7 +39,7 @@ export const useVaultSecretUpdateMutation = ({ onSuccess, ...options }: Omit< - UseMutationOptions, + UseCustomMutationOptions, 'mutationFn' > = {}) => { const queryClient = useQueryClient() diff --git a/apps/studio/data/vault/vault-secrets-query.ts b/apps/studio/data/vault/vault-secrets-query.ts index 93ae6537e55..30b4ac0f2e8 100644 --- a/apps/studio/data/vault/vault-secrets-query.ts +++ b/apps/studio/data/vault/vault-secrets-query.ts @@ -1,6 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' import { Query } from '@supabase/pg-meta/src/query' -import type { VaultSecret } from 'types' +import { useQuery } from '@tanstack/react-query' + +import type { UseCustomQueryOptions, VaultSecret } from 'types' import { executeSql, ExecuteSqlError } from '../sql/execute-sql-query' import { vaultSecretsKeys } from './keys' @@ -37,7 +38,10 @@ export type VaultSecretsError = ExecuteSqlError export const useVaultSecretsQuery = ( { projectRef, connectionString }: VaultSecretsVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: vaultSecretsKeys.list(projectRef), diff --git a/apps/studio/data/views/views-query.ts b/apps/studio/data/views/views-query.ts index e271aa74546..31d6621e4bf 100644 --- a/apps/studio/data/views/views-query.ts +++ b/apps/studio/data/views/views-query.ts @@ -1,10 +1,10 @@ -import { UseQueryOptions, useQuery } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' +import { DEFAULT_PLATFORM_APPLICATION_NAME } from '@supabase/pg-meta/src/constants' import { PostgresView } from '@supabase/postgres-meta' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { viewKeys } from './keys' -import { DEFAULT_PLATFORM_APPLICATION_NAME } from '@supabase/pg-meta/src/constants' export type ViewsVariables = { projectRef?: string @@ -45,7 +45,7 @@ export type ViewsError = ResponseError export const useViewsQuery = ( { projectRef, connectionString, schema }: ViewsVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { enabled = true, ...options }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: schema ? viewKeys.listBySchema(projectRef, schema) : viewKeys.list(projectRef), diff --git a/apps/studio/data/workflow-runs/workflow-run-logs-query.ts b/apps/studio/data/workflow-runs/workflow-run-logs-query.ts index b2ee250781e..0cc924202b2 100644 --- a/apps/studio/data/workflow-runs/workflow-run-logs-query.ts +++ b/apps/studio/data/workflow-runs/workflow-run-logs-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { workflowRunKeys } from './keys' export type WorkflowRunLogsVariables = { @@ -42,7 +42,7 @@ export const useWorkflowRunLogsQuery = ( { enabled = true, ...options - }: UseQueryOptions = {} + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: workflowRunKeys.list(workflowRunId), diff --git a/apps/studio/data/workflow-runs/workflow-run-query.ts b/apps/studio/data/workflow-runs/workflow-run-query.ts index 7b76abb693b..ccd30669785 100644 --- a/apps/studio/data/workflow-runs/workflow-run-query.ts +++ b/apps/studio/data/workflow-runs/workflow-run-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { workflowRunKeys } from './keys' export type WorkflowRunVariables = { @@ -39,7 +39,10 @@ export type WorkflowRunError = ResponseError export const useWorkflowRunQuery = ( { projectRef, workflowRunId }: WorkflowRunVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: workflowRunKeys.detail(projectRef, workflowRunId), diff --git a/apps/studio/data/workflow-runs/workflow-runs-query.ts b/apps/studio/data/workflow-runs/workflow-runs-query.ts index c907eef42ab..5b36f3679d6 100644 --- a/apps/studio/data/workflow-runs/workflow-runs-query.ts +++ b/apps/studio/data/workflow-runs/workflow-runs-query.ts @@ -1,7 +1,7 @@ -import { useQuery, UseQueryOptions } from '@tanstack/react-query' +import { useQuery } from '@tanstack/react-query' import { get, handleError } from 'data/fetchers' -import type { ResponseError } from 'types' +import type { ResponseError, UseCustomQueryOptions } from 'types' import { workflowRunKeys } from './keys' export type WorkflowRunsVariables = { @@ -28,7 +28,10 @@ export type WorkflowRunsError = ResponseError export const useWorkflowRunsQuery = ( { projectRef }: WorkflowRunsVariables, - { enabled = true, ...options }: UseQueryOptions = {} + { + enabled = true, + ...options + }: UseCustomQueryOptions = {} ) => useQuery({ queryKey: workflowRunKeys.list(projectRef), diff --git a/apps/studio/lib/api/self-hosted/constants.ts b/apps/studio/lib/api/self-hosted/constants.ts index 495add28f54..f5d86acd30b 100644 --- a/apps/studio/lib/api/self-hosted/constants.ts +++ b/apps/studio/lib/api/self-hosted/constants.ts @@ -5,5 +5,6 @@ export const POSTGRES_PORT = process.env.POSTGRES_PORT || 5432 export const POSTGRES_HOST = process.env.POSTGRES_HOST || 'db' export const POSTGRES_DATABASE = process.env.POSTGRES_DB || 'postgres' export const POSTGRES_PASSWORD = process.env.POSTGRES_PASSWORD || 'postgres' -export const POSTGRES_USER_READ_WRITE = 'supabase_admin' -export const POSTGRES_USER_READ_ONLY = 'supabase_read_only_user' +export const POSTGRES_USER_READ_WRITE = process.env.POSTGRES_USER_READ_WRITE || 'supabase_admin' +export const POSTGRES_USER_READ_ONLY = + process.env.POSTGRES_USER_READ_ONLY || 'supabase_read_only_user' diff --git a/apps/studio/next.config.js b/apps/studio/next.config.js index 051184142f1..8ee8cdbdf9e 100644 --- a/apps/studio/next.config.js +++ b/apps/studio/next.config.js @@ -141,7 +141,17 @@ const nextConfig = { }, { source: '/project/:ref/storage', - destination: '/project/:ref/storage/buckets', + destination: '/project/:ref/storage/files', + permanent: true, + }, + { + source: '/project/:ref/storage/buckets', + destination: '/project/:ref/storage/files', + permanent: true, + }, + { + source: '/project/:ref/storage/buckets/:bucketId', + destination: '/project/:ref/storage/files/buckets/:bucketId', permanent: true, }, { diff --git a/apps/studio/package.json b/apps/studio/package.json index 008217919c5..294f7837d8f 100644 --- a/apps/studio/package.json +++ b/apps/studio/package.json @@ -112,8 +112,7 @@ "react-beautiful-dnd": "^13.1.0", "react-contexify": "^5.0.0", "react-data-grid": "7.0.0-beta.41", - "react-datepicker": "^4.18.0", - "react-day-picker": "^8.8.0", + "react-day-picker": "^9.11.1", "react-dnd": "^16.0.1", "react-dnd-html5-backend": "^16.0.1", "react-dom": "catalog:", diff --git a/apps/studio/pages/_app.tsx b/apps/studio/pages/_app.tsx index 5b96b0af328..98e834aec61 100644 --- a/apps/studio/pages/_app.tsx +++ b/apps/studio/pages/_app.tsx @@ -1,7 +1,6 @@ import 'react-data-grid/lib/styles.css' import 'styles/code.scss' import 'styles/contextMenu.scss' -import 'styles/date-picker.scss' import 'styles/editor.scss' import 'styles/graphiql-base.scss' import 'styles/grid.scss' diff --git a/apps/studio/pages/authorize.tsx b/apps/studio/pages/authorize.tsx index 51ffe39c285..8f1ee152887 100644 --- a/apps/studio/pages/authorize.tsx +++ b/apps/studio/pages/authorize.tsx @@ -1,8 +1,11 @@ +import { zodResolver } from '@hookform/resolvers/zod' import dayjs from 'dayjs' import Link from 'next/link' import { useRouter } from 'next/router' import { useEffect, useState } from 'react' +import { useForm } from 'react-hook-form' import { toast } from 'sonner' +import * as z from 'zod' import { useParams } from 'common' import { AuthorizeRequesterDetails } from 'components/interfaces/Organization/OAuthApps/AuthorizeRequesterDetails' @@ -24,6 +27,11 @@ import { CardFooter, CardHeader, CheckIcon, + Form_Shadcn_, + FormControl_Shadcn_, + FormField_Shadcn_, + FormItem_Shadcn_, + FormMessage_Shadcn_, Select_Shadcn_, SelectContent_Shadcn_, SelectItem_Shadcn_, @@ -41,7 +49,19 @@ const APIAuthorizationPage: NextPageWithLayout = () => { const { auth_id, organization_slug } = useParams() const [isApproving, setIsApproving] = useState(false) const [isDeclining, setIsDeclining] = useState(false) - const [selectedOrgSlug, setSelectedOrgSlug] = useState() + + const formSchema = z.object({ + selectedOrgSlug: z.string().min(1, 'Please select an organization'), + }) + + const form = useForm>({ + resolver: zodResolver(formSchema), + defaultValues: { selectedOrgSlug: '' }, + mode: 'onSubmit', + reValidateMode: 'onBlur', + }) + + const selectedOrgSlug = form.watch('selectedOrgSlug') const { data: organizations, @@ -76,36 +96,38 @@ const APIAuthorizationPage: NextPageWithLayout = () => { }, }) - const onApproveRequest = async () => { + const onApproveRequest = form.handleSubmit((values) => { if (!auth_id) { return toast.error('Unable to approve request: auth_id is missing ') } - if (!selectedOrgSlug) { - return toast.error('Unable to approve request: No organization selected') - } setIsApproving(true) - approveRequest({ id: auth_id, slug: selectedOrgSlug }, { onError: () => setIsApproving(false) }) - } + approveRequest( + { id: auth_id, slug: values.selectedOrgSlug }, + { onError: () => setIsApproving(false) } + ) + }) - const onDeclineRequest = async () => { + const onDeclineRequest = form.handleSubmit((values) => { if (!auth_id) { return toast.error('Unable to decline request: auth_id is missing ') } - if (!selectedOrgSlug) { - return toast.error('Unable to decline request: No organization selected') - } setIsDeclining(true) - declineRequest({ id: auth_id, slug: selectedOrgSlug }, { onError: () => setIsDeclining(false) }) - } + declineRequest( + { id: auth_id, slug: values.selectedOrgSlug }, + { onError: () => setIsDeclining(false) } + ) + }) useEffect(() => { if (isSuccessOrganizations && organizations.length > 0) { if (organization_slug) { - setSelectedOrgSlug(organizations.find(({ slug }) => slug === organization_slug)?.slug) - } else { - setSelectedOrgSlug(organizations[0].slug) + const preselected = organizations.find(({ slug }) => slug === organization_slug)?.slug + if (preselected) form.setValue('selectedOrgSlug', preselected) + } else if (!form.getValues('selectedOrgSlug') && organizations.length === 1) { + // If user only has one organization and none pre-selected via URL, default to it + form.setValue('selectedOrgSlug', organizations[0].slug) } } // eslint-disable-next-line react-hooks/exhaustive-deps @@ -253,43 +275,56 @@ const APIAuthorizationPage: NextPageWithLayout = () => { ) : ( - - - - - {organizations?.find((x) => x.slug === selectedOrgSlug)?.name} - - - - {(organizations ?? []).map((organization) => ( - + ( + + - {organization.name} - - ))} - - - + + + + + + + {(organizations ?? []).map((organization) => ( + + {organization.name} + + ))} + + + + + + + )} + /> + )} - )} - - - )} - - + const content = ( + { } if (mode === 'create') { - createLogDrain(logDrainValues) + setPendingLogDrainValues(logDrainValues) + setIsCreateConfirmModalOpen(true) } else { if (!logDrainValues.id || !selectedLogDrain?.token) { throw new Error('Log drain ID and token is required') @@ -159,8 +141,100 @@ const LogDrainsSettings: NextPageWithLayout = () => { )} - + + { + if (pendingLogDrainValues) { + createLogDrain(pendingLogDrainValues) + setPendingLogDrainValues(null) + } + setIsCreateConfirmModalOpen(false) + setOpen(false) + }} + onCancel={() => { + setIsCreateConfirmModalOpen(false) + setPendingLogDrainValues(null) + }} + > +
+

+ You are about to create a new log drain destination:{' '} + {pendingLogDrainValues?.name} +

+

+ This will incur an additional $60 per month{' '} + charge to your subscription. +

+

Are you sure you want to proceed?

+
+
+
) + + // [kemal]: Ordinarily would be bundled with the getLayout function below, however in this case we need access to some bits for the "Add destination" button to render as part of the in-built page header in . + if (logDrainsEnabled && !planLoading) { + return ( + + {!(logDrains?.length === 0) && ( +
+ + + +
+ )} + + } + secondaryActions={} + > + {content} +
+ ) + } + + return content } LogDrainsSettings.getLayout = (page) => ( @@ -168,4 +242,5 @@ LogDrainsSettings.getLayout = (page) => ( {page} ) + export default LogDrainsSettings diff --git a/apps/studio/pages/project/[ref]/storage/analytics/buckets/[bucketId].tsx b/apps/studio/pages/project/[ref]/storage/analytics/buckets/[bucketId].tsx index 7ea03e11ad7..81f27b65765 100644 --- a/apps/studio/pages/project/[ref]/storage/analytics/buckets/[bucketId].tsx +++ b/apps/studio/pages/project/[ref]/storage/analytics/buckets/[bucketId].tsx @@ -1,51 +1,31 @@ -import Link from 'next/link' - import { useParams } from 'common' -import { AnalyticBucketDetails } from 'components/interfaces/Storage/AnalyticsBucketDetails' -import StorageBucketsError from 'components/interfaces/Storage/StorageBucketsError' -import { useSelectedBucket } from 'components/interfaces/Storage/StorageExplorer/useSelectedBucket' +import { AnalyticBucketDetails } from 'components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails' +import { BUCKET_TYPES } from 'components/interfaces/Storage/Storage.constants' import DefaultLayout from 'components/layouts/DefaultLayout' +import { PageLayout } from 'components/layouts/PageLayout/PageLayout' import StorageLayout from 'components/layouts/StorageLayout/StorageLayout' -import { AnalyticsBucket } from 'data/storage/analytics-buckets-query' +import { DocsButton } from 'components/ui/DocsButton' import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject' -import { useStorageExplorerStateSnapshot } from 'state/storage-explorer' import type { NextPageWithLayout } from 'types' -import { Button } from 'ui' -import { Admonition } from 'ui-patterns' const AnalyticsBucketPage: NextPageWithLayout = () => { + const config = BUCKET_TYPES.analytics const { bucketId } = useParams() const { data: project } = useSelectedProjectQuery() - const { projectRef } = useStorageExplorerStateSnapshot() - const { bucket, error, isSuccess, isError } = useSelectedBucket() - - // [Joshen] Checking against projectRef from storage explorer to check if the store has initialized - // We can probably replace this with a better skeleton loader that's more representative of the page layout - if (!project || !projectRef) return null return ( -
- {isError && } - - {isSuccess ? ( - !bucket ? ( -
- - - -
- ) : ( - - ) - ) : null} -
+ ] : []} + > + + ) } diff --git a/apps/studio/pages/project/[ref]/storage/analytics/index.tsx b/apps/studio/pages/project/[ref]/storage/analytics/index.tsx index 180782e9a42..732e8d02bca 100644 --- a/apps/studio/pages/project/[ref]/storage/analytics/index.tsx +++ b/apps/studio/pages/project/[ref]/storage/analytics/index.tsx @@ -1,11 +1,16 @@ +import { useParams } from 'common' import { AnalyticsBuckets } from 'components/interfaces/Storage/AnalyticsBuckets' +import { BucketsComingSoon } from 'components/interfaces/Storage/BucketsComingSoon' import DefaultLayout from 'components/layouts/DefaultLayout' import { StorageBucketsLayout } from 'components/layouts/StorageLayout/StorageBucketsLayout' import StorageLayout from 'components/layouts/StorageLayout/StorageLayout' +import { useIsAnalyticsBucketsEnabled } from 'data/config/project-storage-config-query' import type { NextPageWithLayout } from 'types' const StorageAnalyticsPage: NextPageWithLayout = () => { - return + const { ref: projectRef } = useParams() + const isAnalyticsBucketsEnabled = useIsAnalyticsBucketsEnabled({ projectRef }) + return isAnalyticsBucketsEnabled ? : } StorageAnalyticsPage.getLayout = (page) => ( diff --git a/apps/studio/pages/project/[ref]/storage/buckets/[bucketId].tsx b/apps/studio/pages/project/[ref]/storage/buckets/[bucketId].tsx deleted file mode 100644 index 7881db3345d..00000000000 --- a/apps/studio/pages/project/[ref]/storage/buckets/[bucketId].tsx +++ /dev/null @@ -1,48 +0,0 @@ -import { useParams } from 'common' - -import { AnalyticBucketDetails } from 'components/interfaces/Storage/AnalyticsBucketDetails' -import StorageBucketsError from 'components/interfaces/Storage/StorageBucketsError' -import { StorageExplorer } from 'components/interfaces/Storage/StorageExplorer/StorageExplorer' -import { useSelectedBucket } from 'components/interfaces/Storage/StorageExplorer/useSelectedBucket' -import DefaultLayout from 'components/layouts/DefaultLayout' -import StorageLayout from 'components/layouts/StorageLayout/StorageLayout' -import { AnalyticsBucket } from 'data/storage/analytics-buckets-query' -import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject' -import { useStorageExplorerStateSnapshot } from 'state/storage-explorer' -import type { NextPageWithLayout } from 'types' - -const PageLayout: NextPageWithLayout = () => { - const { bucketId } = useParams() - const { data: project } = useSelectedProjectQuery() - const { projectRef } = useStorageExplorerStateSnapshot() - const { bucket, error, isSuccess, isError } = useSelectedBucket() - - // [Joshen] Checking against projectRef from storage explorer to check if the store has initialized - if (!project || !projectRef) return null - - return ( -
- {isError && } - - {isSuccess ? ( - !bucket ? ( -
-

Bucket {bucketId} cannot be found

-
- ) : bucket.type === 'ANALYTICS' ? ( - - ) : ( - - ) - ) : null} -
- ) -} - -PageLayout.getLayout = (page) => ( - - {page} - -) - -export default PageLayout diff --git a/apps/studio/pages/project/[ref]/storage/buckets/index.tsx b/apps/studio/pages/project/[ref]/storage/buckets/index.tsx deleted file mode 100644 index 6cefe0c843d..00000000000 --- a/apps/studio/pages/project/[ref]/storage/buckets/index.tsx +++ /dev/null @@ -1,57 +0,0 @@ -import { useParams } from 'common' -import { useRouter } from 'next/router' -import { useEffect } from 'react' - -import { useIsNewStorageUIEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext' -import { DEFAULT_BUCKET_TYPE } from 'components/interfaces/Storage/Storage.constants' -import StorageBucketsError from 'components/interfaces/Storage/StorageBucketsError' -import DefaultLayout from 'components/layouts/DefaultLayout' -import StorageLayout from 'components/layouts/StorageLayout/StorageLayout' -import ProductEmptyState from 'components/to-be-cleaned/ProductEmptyState' -import { useBucketsQuery } from 'data/storage/buckets-query' -import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject' -import { DOCS_URL } from 'lib/constants' -import type { NextPageWithLayout } from 'types' - -const PageLayout: NextPageWithLayout = () => { - const { ref } = useParams() - const router = useRouter() - const isStorageV2 = useIsNewStorageUIEnabled() - const { data: project } = useSelectedProjectQuery() - const { error, isError } = useBucketsQuery({ projectRef: ref }) - - useEffect(() => { - if (isStorageV2) { - router.replace(`/project/${ref}/storage/${DEFAULT_BUCKET_TYPE}`) - } - }, [isStorageV2, ref, router]) - - if (!project) return null - - if (isError) return - - return ( -
- -

- Create buckets to store and serve any type of digital content. -

-

- Make your buckets private or public depending on your security preference. -

-
-
- ) -} - -PageLayout.getLayout = (page) => ( - - {page} - -) - -export default PageLayout diff --git a/apps/studio/pages/project/[ref]/storage/index.tsx b/apps/studio/pages/project/[ref]/storage/index.tsx deleted file mode 100644 index 0b9672eb09d..00000000000 --- a/apps/studio/pages/project/[ref]/storage/index.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { useRouter } from 'next/router' -import { useEffect } from 'react' - -import { useParams } from 'common' -import { useIsNewStorageUIEnabled } from 'components/interfaces/App/FeaturePreview/FeaturePreviewContext' -import { DEFAULT_BUCKET_TYPE } from 'components/interfaces/Storage/Storage.constants' -import DefaultLayout from 'components/layouts/DefaultLayout' -import StorageLayout from 'components/layouts/StorageLayout/StorageLayout' -import type { NextPageWithLayout } from 'types' - -const Storage: NextPageWithLayout = () => { - const { ref } = useParams() - const router = useRouter() - const isStorageV2 = useIsNewStorageUIEnabled() - - useEffect(() => { - if (isStorageV2) { - router.replace(`/project/${ref}/storage/${DEFAULT_BUCKET_TYPE}`) - } else { - router.replace(`/project/${ref}/storage/buckets`) - } - }, [isStorageV2, ref, router]) - - return null -} - -Storage.getLayout = (page) => ( - - {page} - -) - -export default Storage diff --git a/apps/studio/pages/project/[ref]/storage/vectors/buckets/[bucketId].tsx b/apps/studio/pages/project/[ref]/storage/vectors/buckets/[bucketId].tsx new file mode 100644 index 00000000000..7dc4b3559b7 --- /dev/null +++ b/apps/studio/pages/project/[ref]/storage/vectors/buckets/[bucketId].tsx @@ -0,0 +1,35 @@ +import { useParams } from 'common' +import { BUCKET_TYPES } from 'components/interfaces/Storage/Storage.constants' +import { VectorBucketDetails } from 'components/interfaces/Storage/VectorBuckets/VectorBucketDetails' +import DefaultLayout from 'components/layouts/DefaultLayout' +import { PageLayout } from 'components/layouts/PageLayout/PageLayout' +import StorageLayout from 'components/layouts/StorageLayout/StorageLayout' +import { DocsButton } from 'components/ui/DocsButton' +import { useStorageExplorerStateSnapshot } from 'state/storage-explorer' +import type { NextPageWithLayout } from 'types' + +const VectorsBucketPage: NextPageWithLayout = () => { + const config = BUCKET_TYPES['vectors'] + const { bucketId } = useParams() + const { projectRef } = useStorageExplorerStateSnapshot() + + return ( + ] : []} + > +
+ +
+
+ ) +} + +VectorsBucketPage.getLayout = (page) => ( + + {page} + +) + +export default VectorsBucketPage diff --git a/apps/studio/pages/project/[ref]/storage/vectors/index.tsx b/apps/studio/pages/project/[ref]/storage/vectors/index.tsx index edc9ae1886b..0177e3311f7 100644 --- a/apps/studio/pages/project/[ref]/storage/vectors/index.tsx +++ b/apps/studio/pages/project/[ref]/storage/vectors/index.tsx @@ -1,11 +1,16 @@ -import { VectorsBuckets } from 'components/interfaces/Storage/VectorsBuckets' +import { useParams } from 'common' +import { BucketsComingSoon } from 'components/interfaces/Storage/BucketsComingSoon' +import { VectorsBuckets } from 'components/interfaces/Storage/VectorBuckets' import DefaultLayout from 'components/layouts/DefaultLayout' import { StorageBucketsLayout } from 'components/layouts/StorageLayout/StorageBucketsLayout' import StorageLayout from 'components/layouts/StorageLayout/StorageLayout' +import { useIsVectorBucketsEnabled } from 'data/config/project-storage-config-query' import type { NextPageWithLayout } from 'types' const StorageVectorsPage: NextPageWithLayout = () => { - return + const { ref: projectRef } = useParams() + const isVectorBucketsEnabled = useIsVectorBucketsEnabled({ projectRef }) + return isVectorBucketsEnabled ? : } StorageVectorsPage.getLayout = (page) => ( diff --git a/apps/studio/state/sql-editor-v2.ts b/apps/studio/state/sql-editor-v2.ts index dda6f89c397..cd3181d4474 100644 --- a/apps/studio/state/sql-editor-v2.ts +++ b/apps/studio/state/sql-editor-v2.ts @@ -299,9 +299,9 @@ async function upsertSnippet( if (shouldInvalidate) { const queryClient = getQueryClient() await Promise.all([ - queryClient.invalidateQueries(contentKeys.count(projectRef, 'sql')), - queryClient.invalidateQueries(contentKeys.sqlSnippets(projectRef)), - queryClient.invalidateQueries(contentKeys.folders(projectRef)), + queryClient.invalidateQueries({ queryKey: contentKeys.count(projectRef, 'sql') }), + queryClient.invalidateQueries({ queryKey: contentKeys.sqlSnippets(projectRef) }), + queryClient.invalidateQueries({ queryKey: contentKeys.folders(projectRef) }), ]) } diff --git a/apps/studio/styles/date-picker.scss b/apps/studio/styles/date-picker.scss deleted file mode 100644 index 7825357eb34..00000000000 --- a/apps/studio/styles/date-picker.scss +++ /dev/null @@ -1,104 +0,0 @@ -/* // date picker */ - -.react-datepicker__input-container input { - @apply block w-full text-base md:text-sm bg-white border border-background-surface-100 rounded shadow-sm; -} - -.react-datepicker-popper { - @apply z-40 w-72 text-sm bg-surface-100 shadow px-3 py-2 border-2 border-background rounded; -} - -.react-datepicker-left { - @apply absolute left-0 right-auto top-11 transform-none #{!important}; -} - -.react-datepicker-right { - @apply absolute right-0 left-auto top-11 transform-none #{!important}; -} - -.react-datepicker__portal { - @apply absolute z-10 w-72 text-sm transform-none bg-studio shadow px-3 py-2 top-12 right-0 border-2 border-background rounded; -} - -.react-datepicker__month-container { - @apply flex flex-col; -} - -.react-datepicker__month { - @apply flex flex-col; - @apply -space-y-px; -} - -.react-datepicker__current-month { - @apply ml-2.5 text-lg font-semibold text-border-stronger; -} - -.react-datepicker__week { - @apply flex -space-x-px; -} - -.react-datepicker__day-names { - @apply flex -space-x-px text-foreground-lighter font-normal text-center text-xs; -} - -.react-datepicker__day-name { - @apply w-10 h-10 flex items-center justify-center py-1 rounded-full; -} - -.react-datepicker__navigation { - @apply absolute top-2; -} - -.react-datepicker__navigation--previous { - @apply right-12 w-10 h-10 rounded transition flex items-center justify-center hover:bg-studio; -} - -.react-datepicker__navigation--next { - @apply right-4 w-10 h-10 rounded transition flex items-center justify-center hover:bg-studio; -} - -.react-datepicker__day { - @apply w-10 h-10 flex items-center font-normal justify-center text-sm leading-loose transition text-foreground-light cursor-pointer; - /* @apply mb-1 py-1; */ - @apply -space-y-px; - @apply border border-default; -} - -.react-datepicker__day--disabled { - @apply cursor-not-allowed opacity-40 hover:bg-transparent; -} - -.react-datepicker__day--outside-month { - @apply text-border-stronger; -} - -.react-datepicker__day--in-range { - @apply bg-brand-400 text-scale-fixed-100 border-brand-300 text-foreground; -} - -.react-datepicker__day--in-selecting-range { - @apply bg-brand-400 text-scale-fixed-100 border-brand-400 text-foreground; -} - -.react-datepicker__day--selecting-range-start, -.react-datepicker__day--selecting-range-end { - @apply bg-brand-300 text-foreground hover:bg-brand-400; -} - -.react-datepicker__day--selected, -.react-datepicker__day--selected.react-datepicker__day--highlighted { - @apply bg-brand text-foreground; -} - -.react-datepicker__day--range-start, -.react-datepicker__day--range-end { - @apply bg-brand text-foreground; -} - -.react-datepicker__day--highlighted { - @apply bg-overlay-hover text-foreground-light; -} - -.react-datepicker__aria-live { - @apply sr-only; -} diff --git a/apps/studio/tests/features/logs/Logs.Datepickers.test.tsx b/apps/studio/tests/features/logs/Logs.Datepickers.test.tsx index 82ecd7f9384..ebc02f424c0 100644 --- a/apps/studio/tests/features/logs/Logs.Datepickers.test.tsx +++ b/apps/studio/tests/features/logs/Logs.Datepickers.test.tsx @@ -71,8 +71,8 @@ test('renders datepicker selected dates in local time', async () => { `${from.format('DD MMM')}, ${from.format('HH:mm')} - ${to.format('DD MMM')}, ${to.format('HH:mm')}` ) // selected date should be in local time - await screen.findByText('25', { selector: "*[class*='--range-start'" }) - await screen.findByText('27', { selector: "*[class*='--range-end'" }) + await screen.findByText('25', { selector: "*[aria-label*='selected'" }) + await screen.findByText('27', { selector: "*[aria-label*='selected'" }) }) test('datepicker onSubmit will return ISO string of selected dates', async () => { @@ -99,7 +99,7 @@ test('datepicker onSubmit will return ISO string of selected dates', async () => // Find and click on first date const day15Element = await screen.findByText(day15.format('D')) - userEvent.click(day15Element) + userEvent.dblClick(day15Element) // Find and click on second date const day16Element = await screen.findByText(day16.format('D')) diff --git a/apps/studio/types/base.ts b/apps/studio/types/base.ts index 1c477202c4c..81f5a5aff08 100644 --- a/apps/studio/types/base.ts +++ b/apps/studio/types/base.ts @@ -1,8 +1,8 @@ -import { PermissionAction } from '@supabase/shared-types/out/constants' -import { OrganizationBase } from 'data/organizations/organizations-query' -import { PlanId } from 'data/subscriptions/types' -import jsonLogic from 'json-logic-js' -import { ManagedBy } from 'lib/constants/infrastructure' +import type { PermissionAction } from '@supabase/shared-types/out/constants' +import type { OrganizationBase } from 'data/organizations/organizations-query' +import type { PlanId } from 'data/subscriptions/types' +import type jsonLogic from 'json-logic-js' +import type { ManagedBy } from 'lib/constants/infrastructure' export interface Organization extends OrganizationBase { managed_by: ManagedBy diff --git a/apps/studio/types/index.ts b/apps/studio/types/index.ts index e53ca46b6e0..5fe47deabdb 100644 --- a/apps/studio/types/index.ts +++ b/apps/studio/types/index.ts @@ -10,5 +10,6 @@ export { export type * from './form' export type * from './next' export { isNextPageWithLayout } from './next' +export type * from './react-query' export type * from './ui' export type * from './userContent' diff --git a/apps/studio/types/react-query.ts b/apps/studio/types/react-query.ts new file mode 100644 index 00000000000..bbee81fc593 --- /dev/null +++ b/apps/studio/types/react-query.ts @@ -0,0 +1,28 @@ +import type { + QueryKey, + UseInfiniteQueryOptions, + UseMutationOptions, + UseQueryOptions, +} from '@tanstack/react-query' + +export type UseCustomQueryOptions< + TQueryFnData = unknown, + TError = unknown, + TData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +> = UseQueryOptions + +export type UseCustomMutationOptions< + TData = unknown, + TError = unknown, + TVariables = void, + TContext = unknown, +> = UseMutationOptions + +export type UseCustomInfiniteQueryOptions< + TQueryFnData = unknown, + TError = unknown, + TData = TQueryFnData, + TQueryData = TQueryFnData, + TQueryKey extends QueryKey = QueryKey, +> = UseInfiniteQueryOptions diff --git a/apps/www/_events/2025-12-02__supabase-athens-meetup.mdx b/apps/www/_events/2025-12-02__supabase-athens-meetup.mdx new file mode 100644 index 00000000000..eb46efc7a56 --- /dev/null +++ b/apps/www/_events/2025-12-02__supabase-athens-meetup.mdx @@ -0,0 +1,12 @@ +--- +title: 'Supabase Athens Meetup' +type: 'meetup' +onDemand: false +disable_page_build: true +link: { href: https://www.meetup.com/supabase-athens-community/events/311840751/, target: '_blank' } +date: '2025-12-02T19:00:00.000+02:00' +timezone: 'Europe/Athens' +duration: '2 hours' +categories: + - meetup +--- diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 0f7f372f831..54884e5c1ec 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -383,7 +383,6 @@ services: LOGFLARE_PRIVATE_ACCESS_TOKEN: ${LOGFLARE_PRIVATE_ACCESS_TOKEN} LOGFLARE_SINGLE_TENANT: true LOGFLARE_SUPABASE_MODE: true - LOGFLARE_MIN_CLUSTER_SIZE: 1 # Comment variables to use Big Query backend for analytics POSTGRES_BACKEND_URL: postgresql://supabase_admin:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/_supabase diff --git a/e2e/studio/features/table-editor.spec.ts b/e2e/studio/features/table-editor.spec.ts index 106a928f067..35781606356 100644 --- a/e2e/studio/features/table-editor.spec.ts +++ b/e2e/studio/features/table-editor.spec.ts @@ -205,23 +205,11 @@ test.describe.serial('table editor', () => { await expect(page.getByLabel(`View ${authTableSso}`)).toBeVisible() await expect(page.getByLabel(`View ${authTableMfa}`)).toBeVisible() - // filter by querying + // can find auth tables await page.getByRole('textbox', { name: 'Search tables...' }).fill('mfa') await waitForTableToLoad(page, ref, 'auth') // load tables await expect(page.getByLabel(`View ${authTableSso}`)).not.toBeVisible() await expect(page.getByLabel(`View ${authTableMfa}`)).toBeVisible() - - // navigate to policies page when view policies action is clicked - await page.getByRole('button', { name: `View ${authTableMfa}` }).click() - await page.waitForURL(/\/editor\/\d+\?schema=auth$/) - await page - .getByRole('button', { name: `View ${authTableMfa}` }) - .getByRole('button') - .nth(1) - .click() - await page.getByRole('menuitem', { name: 'View policies' }).click() - await page.waitForURL(/.*\/policies\?schema=auth/) - expect(page.url()).toContain('auth/policies?schema=auth') }) test('should show rls accordingly', async ({ ref }) => { diff --git a/packages/api-types/types/api.d.ts b/packages/api-types/types/api.d.ts index 89941bc713e..c5085b443b4 100644 --- a/packages/api-types/types/api.d.ts +++ b/packages/api-types/types/api.d.ts @@ -471,10 +471,12 @@ export interface paths { * Gets project's logs * @description Executes a SQL query on the project's logs. * - * Either the 'iso_timestamp_start' and 'iso_timestamp_end' parameters must be provided. + * Either the `iso_timestamp_start` and `iso_timestamp_end` parameters must be provided. * If both are not provided, only the last 1 minute of logs will be queried. * The timestamp range must be no more than 24 hours and is rounded to the nearest minute. If the range is more than 24 hours, a validation error will be thrown. * + * Note: Unless the `sql` parameter is provided, only edge_logs will be queried. See the [log query docs](/docs/guides/telemetry/logs?queryGroups=product&product=postgres&queryGroups=source&source=edge_logs#querying-with-the-logs-explorer:~:text=logs%20from%20the-,Sources,-drop%2Ddown%3A) for all available sources. + * */ get: operations['v1-get-project-logs'] put?: never @@ -2537,6 +2539,7 @@ export interface components { /** @enum {string} */ message: 'ok' } + DeleteSecretsBody: string[] DeployFunctionResponse: { /** Format: int64 */ created_at?: number @@ -3349,6 +3352,7 @@ export interface components { iceberg_catalog: boolean list_v2: boolean } + databasePoolMode: string external: { /** @enum {string} */ upstreamTarget: 'main' | 'canary' @@ -3366,6 +3370,7 @@ export interface components { } /** Format: int64 */ fileSizeLimit: number + migrationVersion: string } StreamableFile: Record SubdomainAvailabilityResponse: { @@ -4300,7 +4305,7 @@ export interface components { V1RestorePointResponse: { name: string /** @enum {string} */ - status: 'AVAILABLE' | 'PENDING' | 'REMOVED' + status: 'AVAILABLE' | 'PENDING' | 'REMOVED' | 'FAILED' } V1RunQueryBody: { parameters?: unknown[] @@ -5517,6 +5522,7 @@ export interface operations { query?: { iso_timestamp_end?: string iso_timestamp_start?: string + /** @description Custom SQL query to execute on the logs. See [querying logs](/docs/guides/telemetry/logs?queryGroups=product&product=postgres&queryGroups=source&source=edge_logs#querying-with-the-logs-explorer) for more details. */ sql?: string } header?: never @@ -10399,7 +10405,7 @@ export interface operations { } requestBody: { content: { - 'application/json': string[] + 'application/json': components['schemas']['DeleteSecretsBody'] } } responses: { diff --git a/packages/api-types/types/platform.d.ts b/packages/api-types/types/platform.d.ts index 802ab87b7d3..2a9186388b7 100644 --- a/packages/api-types/types/platform.d.ts +++ b/packages/api-types/types/platform.d.ts @@ -2029,23 +2029,6 @@ export interface paths { patch?: never trace?: never } - '/platform/profile/password-check': { - parameters: { - query?: never - header?: never - path?: never - cookie?: never - } - get?: never - put?: never - /** Check password strength */ - post: operations['PasswordCheckController_checkPassword'] - delete?: never - options?: never - head?: never - patch?: never - trace?: never - } '/platform/profile/permissions': { parameters: { query?: never @@ -3870,6 +3853,41 @@ export interface paths { patch?: never trace?: never } + '/platform/storage/{ref}/analytics-buckets': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** Gets list of analytics buckets */ + get: operations['StorageAnalyticsBucketsController_getBuckets'] + put?: never + /** Create an analytics bucket */ + post: operations['StorageAnalyticsBucketsController_createBucket'] + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/platform/storage/{ref}/analytics-buckets/{id}': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + post?: never + /** Deletes an analytics bucket */ + delete: operations['StorageAnalyticsBucketIdController_deleteBucket'] + options?: never + head?: never + patch?: never + trace?: never + } '/platform/storage/{ref}/archive': { parameters: { query?: never @@ -4130,6 +4148,77 @@ export interface paths { patch?: never trace?: never } + '/platform/storage/{ref}/vector-buckets': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** Gets list of vector buckets */ + get: operations['StorageVectorBucketsController_getBuckets'] + put?: never + /** Create vector bucket */ + post: operations['StorageVectorBucketsController_createBucket'] + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/platform/storage/{ref}/vector-buckets/{id}': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** Gets bucket */ + get: operations['StorageVectorBucketIdController_getBucket'] + put?: never + post?: never + /** Deletes bucket */ + delete: operations['StorageVectorBucketIdController_deleteBucket'] + options?: never + head?: never + patch?: never + trace?: never + } + '/platform/storage/{ref}/vector-buckets/{id}/indexes': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + /** Gets bucket indexes */ + get: operations['StorageVectorBucketIdIndexesController_getBucketIndexes'] + put?: never + /** Create index in vector bucket */ + post: operations['StorageVectorBucketIdIndexesController_createBucketIndex'] + delete?: never + options?: never + head?: never + patch?: never + trace?: never + } + '/platform/storage/{ref}/vector-buckets/{id}/indexes/{indexName}': { + parameters: { + query?: never + header?: never + path?: never + cookie?: never + } + get?: never + put?: never + post?: never + /** Deletes bucket index */ + delete: operations['StorageVectorBucketIdIndexesController_deleteBucketIndex'] + options?: never + head?: never + patch?: never + trace?: never + } '/platform/stripe/invoices/overdue': { parameters: { query?: never @@ -4700,6 +4789,16 @@ export interface components { | 'sentry' | 's3' } + CreateBucketIndexBody: { + /** @enum {string} */ + dataType: 'float32' + dimension: number + /** @enum {string} */ + distanceMetric: 'cosine' | 'euclidean' | 'dotproduct' + indexName: string + /** @default [] */ + metadataKeys?: string[] + } CreateCliLoginSessionBody: { public_key: string /** Format: uuid */ @@ -5116,7 +5215,7 @@ export interface components { * @description Namespace * @example my-namespace */ - namespace: string + namespace?: string /** * @description Project ref * @example abcdefghijklmnopqrst @@ -5192,7 +5291,7 @@ export interface components { * @description Namespace * @example my-namespace */ - namespace: string + namespace?: string /** * @description Project ref * @example abcdefghijklmnopqrst @@ -5449,6 +5548,9 @@ export interface components { metadata_xml_url: string user_name_mapping?: string[] } + CreateStorageAnalyticsBucketBody: { + bucketName: string + } CreateStorageBucketBody: { allowed_mime_types?: string[] file_size_limit?: number @@ -5466,6 +5568,9 @@ export interface components { id: string secret_key: string } + CreateStorageVectorBucketBody: { + bucketName: string + } CreateTaxIdBody: { country?: string type: string @@ -7415,18 +7520,6 @@ export interface components { organization_id: number overdue_invoice_count: number } - PasswordCheckBody: { - password: string - } - PasswordCheckResponse: { - result: { - feedback: { - suggestions: string[] - warning: string - } - score: number - } - } PauseStatusResponse: { can_restore: boolean last_paused_on: string | null @@ -8207,7 +8300,7 @@ export interface components { * @description Namespace * @example my-namespace */ - namespace: string + namespace?: string /** * @description Project ref * @example abcdefghijklmnopqrst @@ -8295,7 +8388,7 @@ export interface components { * @description Namespace * @example my-namespace */ - namespace: string + namespace?: string /** * @description Project ref * @example abcdefghijklmnopqrst @@ -8955,6 +9048,27 @@ export interface components { /** Format: uri */ redirectTo?: string } + StorageAnalyticsBucketDeleteResponse: { + message: string + } + StorageAnalyticsBucketResponse: { + created_at: string + format: string + id: string + /** @enum {string} */ + type: 'ANALYTICS' + updated_at: string + } + StorageAnalyticsBucketsResponse: { + data: { + created_at: string + format: string + id: string + /** @enum {string} */ + type: 'ANALYTICS' + updated_at: string + }[] + } StorageBucketResponse: { allowed_mime_types?: string[] created_at: string @@ -8972,6 +9086,7 @@ export interface components { iceberg_catalog: boolean list_v2: boolean } + databasePoolMode: string external: { /** @enum {string} */ upstreamTarget: 'main' | 'canary' @@ -8989,6 +9104,7 @@ export interface components { } /** Format: int64 */ fileSizeLimit: number + migrationVersion: string } StorageListResponseV2: { folders: { @@ -9041,6 +9157,31 @@ export interface components { owner: string updated_at: string } + StorageVectorBucketListIndexesResponse: { + indexes: { + creationTime?: number + /** @enum {string} */ + dataType: 'float32' + dimension: number + /** @enum {string} */ + distanceMetric: 'cosine' | 'euclidean' | 'dotproduct' + indexName: string + metadataConfiguration?: { + nonFilterableMetadataKeys?: string[] + } + vectorBucketName: string + }[] + nextToken?: string + } + StorageVectorBucketResponse: { + vectorBucketName: string + } + StorageVectorBucketsResponse: { + nextToken?: string + vectorBuckets: { + vectorBucketName: string + }[] + } StreamableFile: Record SupavisorConfigResponse: { connection_string: string @@ -9889,7 +10030,7 @@ export interface components { * @description Namespace * @example my-namespace */ - namespace: string + namespace?: string /** * @description Project ref * @example abcdefghijklmnopqrst @@ -9965,7 +10106,7 @@ export interface components { * @description Namespace * @example my-namespace */ - namespace: string + namespace?: string /** * @description Project ref * @example abcdefghijklmnopqrst @@ -16841,36 +16982,6 @@ export interface operations { } } } - PasswordCheckController_checkPassword: { - parameters: { - query?: never - header?: never - path?: never - cookie?: never - } - requestBody: { - content: { - 'application/json': components['schemas']['PasswordCheckBody'] - } - } - responses: { - 201: { - headers: { - [name: string]: unknown - } - content: { - 'application/json': components['schemas']['PasswordCheckResponse'] - } - } - /** @description Failed to check password strength */ - 500: { - headers: { - [name: string]: unknown - } - content?: never - } - } - } PermissionsController_getPermissions: { parameters: { query?: never @@ -23886,6 +23997,173 @@ export interface operations { } } } + StorageAnalyticsBucketsController_getBuckets: { + parameters: { + query?: { + /** @description Number of buckets to return per page */ + limit?: number + /** @description Number of buckets to skip */ + offset?: number + /** @description Search buckets by name */ + search?: string + /** @description Sort column for buckets */ + sortColumn?: 'id' | 'name' | 'created_at' | 'updated_at' + /** @description Sort order for buckets */ + sortOrder?: 'asc' | 'desc' + } + header?: never + path: { + /** @description Project ref */ + ref: string + } + cookie?: never + } + requestBody?: never + responses: { + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['StorageAnalyticsBucketsResponse'] + } + } + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Forbidden action */ + 403: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Rate limit exceeded */ + 429: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Failed to get list of analytics buckets */ + 500: { + headers: { + [name: string]: unknown + } + content?: never + } + } + } + StorageAnalyticsBucketsController_createBucket: { + parameters: { + query?: never + header?: never + path: { + /** @description Project ref */ + ref: string + } + cookie?: never + } + requestBody: { + content: { + 'application/json': components['schemas']['CreateStorageAnalyticsBucketBody'] + } + } + responses: { + 201: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['StorageAnalyticsBucketResponse'] + } + } + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Forbidden action */ + 403: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Rate limit exceeded */ + 429: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Failed to create analytics bucket */ + 500: { + headers: { + [name: string]: unknown + } + content?: never + } + } + } + StorageAnalyticsBucketIdController_deleteBucket: { + parameters: { + query?: never + header?: never + path: { + /** @description Storage bucket id */ + id: string + /** @description Project ref */ + ref: string + } + cookie?: never + } + requestBody?: never + responses: { + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['StorageAnalyticsBucketDeleteResponse'] + } + } + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Forbidden action */ + 403: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Rate limit exceeded */ + 429: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Failed to delete analytics bucket */ + 500: { + headers: { + [name: string]: unknown + } + content?: never + } + } + } StorageArchiveController_getArchive: { parameters: { query?: never @@ -24946,6 +25224,366 @@ export interface operations { } } } + StorageVectorBucketsController_getBuckets: { + parameters: { + query?: { + nextToken?: string + } + header?: never + path: { + /** @description Project ref */ + ref: string + } + cookie?: never + } + requestBody?: never + responses: { + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['StorageVectorBucketsResponse'] + } + } + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Forbidden action */ + 403: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Rate limit exceeded */ + 429: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Failed to get list of vector buckets */ + 500: { + headers: { + [name: string]: unknown + } + content?: never + } + } + } + StorageVectorBucketsController_createBucket: { + parameters: { + query?: never + header?: never + path: { + /** @description Project ref */ + ref: string + } + cookie?: never + } + requestBody: { + content: { + 'application/json': components['schemas']['CreateStorageVectorBucketBody'] + } + } + responses: { + 201: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Forbidden action */ + 403: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Rate limit exceeded */ + 429: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Failed to create vector bucket */ + 500: { + headers: { + [name: string]: unknown + } + content?: never + } + } + } + StorageVectorBucketIdController_getBucket: { + parameters: { + query?: never + header?: never + path: { + id: string + /** @description Project ref */ + ref: string + } + cookie?: never + } + requestBody?: never + responses: { + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['StorageVectorBucketResponse'] + } + } + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Forbidden action */ + 403: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Rate limit exceeded */ + 429: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Failed to get bucket */ + 500: { + headers: { + [name: string]: unknown + } + content?: never + } + } + } + StorageVectorBucketIdController_deleteBucket: { + parameters: { + query?: never + header?: never + path: { + id: string + /** @description Project ref */ + ref: string + } + cookie?: never + } + requestBody?: never + responses: { + 200: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Forbidden action */ + 403: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Rate limit exceeded */ + 429: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Failed to delete bucket */ + 500: { + headers: { + [name: string]: unknown + } + content?: never + } + } + } + StorageVectorBucketIdIndexesController_getBucketIndexes: { + parameters: { + query?: never + header?: never + path: { + id: string + /** @description Project ref */ + ref: string + } + cookie?: never + } + requestBody?: never + responses: { + 200: { + headers: { + [name: string]: unknown + } + content: { + 'application/json': components['schemas']['StorageVectorBucketListIndexesResponse'] + } + } + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Forbidden action */ + 403: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Rate limit exceeded */ + 429: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Failed to get bucket indexes */ + 500: { + headers: { + [name: string]: unknown + } + content?: never + } + } + } + StorageVectorBucketIdIndexesController_createBucketIndex: { + parameters: { + query?: never + header?: never + path: { + id: string + /** @description Project ref */ + ref: string + } + cookie?: never + } + requestBody: { + content: { + 'application/json': components['schemas']['CreateBucketIndexBody'] + } + } + responses: { + 201: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Forbidden action */ + 403: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Rate limit exceeded */ + 429: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Failed to create vector bucket index */ + 500: { + headers: { + [name: string]: unknown + } + content?: never + } + } + } + StorageVectorBucketIdIndexesController_deleteBucketIndex: { + parameters: { + query?: never + header?: never + path: { + /** @description Vector storage bucket name */ + id: string + /** @description Vector storage bucket index name */ + indexName: string + /** @description Project ref */ + ref: string + } + cookie?: never + } + requestBody?: never + responses: { + 200: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Unauthorized */ + 401: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Forbidden action */ + 403: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Rate limit exceeded */ + 429: { + headers: { + [name: string]: unknown + } + content?: never + } + /** @description Failed to delete bucket index */ + 500: { + headers: { + [name: string]: unknown + } + content?: never + } + } + } InvoicesController_getOverdueInvoices: { parameters: { query?: never diff --git a/packages/common/constants/local-storage.ts b/packages/common/constants/local-storage.ts index b9b8bcf2947..af70e1874ac 100644 --- a/packages/common/constants/local-storage.ts +++ b/packages/common/constants/local-storage.ts @@ -17,7 +17,6 @@ export const LOCAL_STORAGE_KEYS = { UI_ONBOARDING_NEW_PAGE_SHOWN: 'supabase-ui-onboarding-new-page-shown', UI_PREVIEW_BRANCHING_2_0: 'supabase-ui-branching-2-0', UI_PREVIEW_ADVISOR_RULES: 'supabase-ui-advisor-rules', - UI_PREVIEW_NEW_STORAGE_UI: 'new-storage-ui', UI_PREVIEW_SECURITY_NOTIFICATIONS: 'security-notifications', NEW_LAYOUT_NOTICE_ACKNOWLEDGED: 'new-layout-notice-acknowledge', diff --git a/packages/pg-meta/src/sql/studio/get-users-paginated.ts b/packages/pg-meta/src/sql/studio/get-users-paginated.ts index edd2b9e821e..280aa9b36ac 100644 --- a/packages/pg-meta/src/sql/studio/get-users-paginated.ts +++ b/packages/pg-meta/src/sql/studio/get-users-paginated.ts @@ -42,19 +42,28 @@ function prefixToUUID(prefix: string, max: boolean) { return mapped.join('') } -function stringRange(prefix: string) { +function stringRange(prefix: string): [string, string | undefined] { if (!prefix) { return [prefix, undefined] } - const lastChar = prefix.charCodeAt(prefix.length - 1) + const lastCharCode = prefix.charCodeAt(prefix.length - 1) + const TILDE_CHAR_CODE = 126 // '~' + const Z_CHAR_CODE = 122 // 'z' - if (lastChar >= `~`.charCodeAt(0)) { - // not ASCII - return [prefix, prefix] + // 'z' (122): append '~' to avoid PostgreSQL collation issues with '{' + if (lastCharCode === Z_CHAR_CODE) { + return [prefix, prefix + '~'] } - return [prefix, prefix.substring(0, prefix.length - 1) + String.fromCharCode(lastChar + 1)] + // '~' (126) or beyond: append space since we can't increment further + if (lastCharCode >= TILDE_CHAR_CODE) { + return [prefix, prefix + ' '] + } + + // All other characters: increment the last character + const upperBound = prefix.substring(0, prefix.length - 1) + String.fromCharCode(lastCharCode + 1) + return [prefix, upperBound] } export const getPaginatedUsersSQL = ({ diff --git a/packages/ui-patterns/src/McpUrlBuilder/components/McpConfigurationDisplay.tsx b/packages/ui-patterns/src/McpUrlBuilder/components/McpConfigurationDisplay.tsx index 6d4ba541437..da996a49ad1 100644 --- a/packages/ui-patterns/src/McpUrlBuilder/components/McpConfigurationDisplay.tsx +++ b/packages/ui-patterns/src/McpUrlBuilder/components/McpConfigurationDisplay.tsx @@ -54,9 +54,16 @@ export function McpConfigurationDisplay({ )} + {selectedClient.primaryInstructions && selectedClient.primaryInstructions(clientConfig)} + {selectedClient.configFile && (
- {mcpButtonData ? 'Or add' : 'Add'} this configuration to{' '} + {selectedClient.primaryInstructions + ? 'Alternatively, add' + : mcpButtonData + ? 'Or add' + : 'Add'}{' '} + this configuration to{' '} {selectedClient.configFile}:
)} diff --git a/packages/ui-patterns/src/McpUrlBuilder/constants.tsx b/packages/ui-patterns/src/McpUrlBuilder/constants.tsx index 823059b22c0..e507b6266c6 100644 --- a/packages/ui-patterns/src/McpUrlBuilder/constants.tsx +++ b/packages/ui-patterns/src/McpUrlBuilder/constants.tsx @@ -119,7 +119,7 @@ export const MCP_CLIENTS: McpClient[] = [ key: 'claude-code', label: 'Claude Code', icon: 'claude', - configFile: '~/.claude.json', + configFile: '.mcp.json', externalDocsUrl: 'https://docs.anthropic.com/en/docs/claude-code/mcp', transformConfig: (config): ClaudeCodeMcpConfig => { return { @@ -131,17 +131,18 @@ export const MCP_CLIENTS: McpClient[] = [ }, } }, - alternateInstructions: (_config) => { + primaryInstructions: (_config) => { const config = _config as ClaudeCodeMcpConfig - const command = `claude mcp add --transport http supabase "${config.mcpServers.supabase.url}"` + const command = `claude mcp add --scope project --transport http supabase "${config.mcpServers.supabase.url}"` return (

- Alternatively, add the MCP server using the command line: + Add the MCP server to your project config using the command line:

) }, + alternateInstructions: () => ( +
+

+ After configuring the MCP server, you need to authenticate. In a regular terminal (not the + IDE extension) run: +

+ +

+ Select the "supabase" server, then "Authenticate" to begin the authentication flow. +

+
+ ), }, ] diff --git a/packages/ui-patterns/src/McpUrlBuilder/types.ts b/packages/ui-patterns/src/McpUrlBuilder/types.ts index 7b6ae930012..bf24a7ddc8c 100644 --- a/packages/ui-patterns/src/McpUrlBuilder/types.ts +++ b/packages/ui-patterns/src/McpUrlBuilder/types.ts @@ -13,6 +13,7 @@ export interface McpClient { configFile?: string generateDeepLink?: (config: McpClientConfig) => string | null transformConfig?: (config: McpClientBaseConfig) => McpClientConfig + primaryInstructions?: (config: McpClientConfig) => React.ReactNode alternateInstructions?: (config: McpClientConfig) => React.ReactNode } diff --git a/packages/ui-patterns/src/MobileSheetNav/MobileSheetNav.tsx b/packages/ui-patterns/src/MobileSheetNav/MobileSheetNav.tsx index 872d4952af9..5ed69ad389d 100644 --- a/packages/ui-patterns/src/MobileSheetNav/MobileSheetNav.tsx +++ b/packages/ui-patterns/src/MobileSheetNav/MobileSheetNav.tsx @@ -16,9 +16,10 @@ const MobileSheetNav: React.FC<{ const router = useRouter() const { width } = useWindowSize() + const pathWithoutQuery = router?.asPath?.split('?')?.[0] useEffect(() => { onOpenChange(false) - }, [router?.asPath]) + }, [pathWithoutQuery]) useEffect(() => { onOpenChange(false) diff --git a/packages/ui-patterns/src/admonition.tsx b/packages/ui-patterns/src/admonition.tsx index 6c046091cc0..a04d8f99dc3 100644 --- a/packages/ui-patterns/src/admonition.tsx +++ b/packages/ui-patterns/src/admonition.tsx @@ -1,5 +1,5 @@ import { cva } from 'class-variance-authority' -import { forwardRef } from 'react' +import { forwardRef, ReactNode } from 'react' import { Alert_Shadcn_, AlertDescription_Shadcn_, AlertTitle_Shadcn_, cn } from 'ui' export interface AdmonitionProps { @@ -20,6 +20,8 @@ export interface AdmonitionProps { title?: React.ComponentProps description?: React.ComponentProps } + layout?: 'horizontal' | 'vertical' + actions?: ReactNode } const admonitionToAlertMapping: Record< @@ -91,7 +93,18 @@ export const Admonition = forwardRef< React.ComponentPropsWithoutRef & AdmonitionProps >( ( - { type = 'note', variant, showIcon = true, label, title, description, children, ...props }, + { + type = 'note', + variant, + showIcon = true, + label, + title, + description, + children, + layout = 'vertical', + actions, + ...props + }, ref ) => { const typeMapped = variant ? admonitionToAlertMapping[variant] : admonitionToAlertMapping[type] @@ -113,38 +126,49 @@ export const Admonition = forwardRef< ) : showIcon ? ( ) : null} - {label || title ? ( - <> - - {label || title} - - {description && ( - - {description} - - )} - {/* // children is to handle Docs and MDX issues with children and

elements */} - {children && ( - + {label || title ? ( +

+ - {children} - - )} - - ) : ( -
- {children} -
- )} + {label || title} +
+ {description && ( + + {description} + + )} + {/* // children is to handle Docs and MDX issues with children and

elements */} + {children && ( + + {children} + + )} +

+ ) : ( +
+ {children} +
+ )} + {actions} +
) } diff --git a/packages/ui/package.json b/packages/ui/package.json index 5d1d5bbdacd..448077706bb 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -66,7 +66,7 @@ "react": "catalog:", "react-accessible-treeview": "^2.11.2", "react-copy-to-clipboard": "^5.1.0", - "react-day-picker": "^8.8.0", + "react-day-picker": "^9.11.1", "react-dom": "catalog:", "react-hook-form": "^7.45.0", "react-intersection-observer": "^9.8.2", diff --git a/packages/ui/src/components/ShadowScrollArea/index.tsx b/packages/ui/src/components/ShadowScrollArea/index.tsx index 2d162ec859e..36b3cce7ffe 100644 --- a/packages/ui/src/components/ShadowScrollArea/index.tsx +++ b/packages/ui/src/components/ShadowScrollArea/index.tsx @@ -5,6 +5,7 @@ import { useHorizontalScroll } from '../hooks/use-horizontal-scroll' interface ShadowScrollAreaProps extends React.HTMLAttributes { children: React.ReactNode + containerClassName?: string stickyLastColumn?: boolean } @@ -15,7 +16,7 @@ interface ShadowScrollAreaProps extends React.HTMLAttributes { */ const ShadowScrollArea = React.forwardRef( - ({ className, children, stickyLastColumn, ...props }, ref) => { + ({ className, containerClassName, children, stickyLastColumn, ...props }, ref) => { const containerRef = React.useRef(null) const { hasHorizontalScroll, canScrollLeft, canScrollRight } = useHorizontalScroll(containerRef) @@ -33,7 +34,7 @@ const ShadowScrollArea = React.forwardRef ) return ( -
+
function Calendar({ className, classNames, showOutsideDays = true, ...props }: CalendarProps) { - // [Joshen] Wondering if this is a bug with react-day-picker v8 whereby a single selected date - // has styles applied for both day_range_start and day_range_end. This might be fixed with the latest - // version of react-day-picker, but in case we can opt for a pure tailwind solution instead of JS const fullDateRangeSelected = props.mode === 'range' && !!props.selected?.from && !!props.selected?.to + const { + months, + month, + month_caption, + caption_label, + button_previous, + button_next, + month_grid, + weekdays, + weekday, + week, + day, + day_button, + selected, + today, + outside, + disabled, + range_start, + range_middle, + range_end, + hidden, + ...restClassNames + } = classNames ?? {} + return ( *:not(nav)+*]:ml-4 sm:space-y-0', + months + ), + month: cn('space-y-4', month), + month_caption: cn('flex justify-center pt-1 relative items-center', month_caption), + caption_label: cn('text-sm font-medium', caption_label), + button_previous: cn( buttonVariants({ variant: 'outline' }), - 'h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100' + 'h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100', + 'z-[5]', + 'aria-disabled:opacity-25 aria-disabled:hover:opacity-25 aria-disabled:cursor-not-allowed', + 'absolute left-0 top-0', + button_previous ), - nav_button_previous: 'absolute left-1', - nav_button_next: 'absolute right-1', - table: 'w-full border-collapse space-y-1', - head_row: 'flex', - head_cell: 'text-foreground-muted rounded-md w-9 font-normal text-[0.8rem]', - row: 'flex w-full mt-2', - cell: cn( - 'text-center text-sm p-0 relative [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md', - 'last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20' + button_next: cn( + buttonVariants({ variant: 'outline' }), + 'h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100', + 'z-[5]', + 'aria-disabled:opacity-25 aria-disabled:hover:opacity-25 aria-disabled:cursor-not-allowed', + 'absolute right-0 top-0', + button_next ), + month_grid: cn('w-full border-collapse space-y-1', month_grid), + weekdays: cn('flex', weekdays), + weekday: cn('text-foreground-muted rounded-md w-9 font-normal text-[0.8rem]', weekday), + week: cn('flex w-full mt-2', week), day: cn( - buttonVariants({ variant: 'ghost' }), - 'h-9 w-9 p-0 font-normal aria-selected:opacity-100' + 'text-center text-sm p-0 relative [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md', + 'last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20', + day ), - day_selected: 'bg-brand-500 text-foreground text-foreground', - day_today: 'bg-accent text-accent-foreground', - day_outside: 'text-foreground-muted opacity-50', - day_disabled: 'text-foreground-muted opacity-50', - day_range_start: cn(fullDateRangeSelected && 'bg-brand-500 rounded-r-none'), - day_range_middle: 'aria-selected:bg-brand-400 rounded-none', - day_range_end: cn(fullDateRangeSelected && 'bg-brand-500 rounded-l-none'), - day_hidden: 'invisible', - ...classNames, + day_button: cn( + buttonVariants({ variant: 'ghost' }), + 'h-9 w-9 p-0 font-normal aria-selected:opacity-100', + day_button + ), + selected: cn('bg-brand-500 text-foreground text-foreground', selected), + today: cn('bg-accent text-accent-foreground', today), + outside: cn('text-foreground-muted opacity-50', outside), + disabled: cn('text-foreground-muted opacity-50', disabled), + range_start: cn(fullDateRangeSelected && 'bg-brand-500 rounded-r-none', range_start), + range_middle: cn('aria-selected:bg-brand-400 rounded-none', range_middle), + range_end: cn(fullDateRangeSelected && 'bg-brand-500 rounded-l-none', range_end), + hidden: cn('invisible', hidden), + ...restClassNames, }} components={{ - IconLeft: () => , - IconRight: () => , + Chevron: (props) => { + const { className, ...rest } = props + + if (props.orientation === 'left') { + return ( + + ) + } else { + return ( + + ) + } + }, }} {...props} /> diff --git a/packages/ui/src/components/shadcn/ui/table.tsx b/packages/ui/src/components/shadcn/ui/table.tsx index 49810340a41..33fa0c8a9db 100644 --- a/packages/ui/src/components/shadcn/ui/table.tsx +++ b/packages/ui/src/components/shadcn/ui/table.tsx @@ -1,10 +1,11 @@ +import type { ComponentProps } from 'react' import * as React from 'react' import { cn } from '../../../lib/utils/cn' import { ShadowScrollArea } from '../../ShadowScrollArea' interface TableProps extends React.HTMLAttributes { - containerProps?: React.HTMLAttributes + containerProps?: Partial> } const Table = React.forwardRef( diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 66acebfa293..7d151f3d8e1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -259,6 +259,9 @@ importers: react: specifier: 'catalog:' version: 18.3.1 + react-day-picker: + specifier: ^9.11.1 + version: 9.11.1(react@18.3.1) react-docgen: specifier: ^7.0.3 version: 7.0.3(supports-color@8.1.1) @@ -397,7 +400,7 @@ importers: version: 1.0.3(@types/react-dom@18.3.0)(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@sentry/nextjs': specifier: ^10.3.0 - version: 10.3.0(@opentelemetry/context-async-hooks@2.0.1(@opentelemetry/api@1.9.0))(@opentelemetry/core@2.0.1(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.0.1(@opentelemetry/api@1.9.0))(encoding@0.1.13)(next@15.5.2(@babel/core@7.28.4(supports-color@8.1.1))(@opentelemetry/api@1.9.0)(@playwright/test@1.56.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.4))(react@18.3.1)(supports-color@8.1.1)(webpack@5.94.0) + version: 10.3.0(@opentelemetry/context-async-hooks@2.0.1(@opentelemetry/api@1.9.0))(@opentelemetry/core@2.0.1(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.0.1(@opentelemetry/api@1.9.0))(encoding@0.1.13)(next@15.5.2(@opentelemetry/api@1.9.0)(@playwright/test@1.56.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.4))(react@18.3.1)(supports-color@8.1.1)(webpack@5.94.0) '@supabase/supabase-js': specifier: 'catalog:' version: 2.78.0 @@ -812,7 +815,7 @@ importers: version: 1.1.3(@types/react-dom@18.3.0)(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@sentry/nextjs': specifier: ^10.3.0 - version: 10.3.0(@opentelemetry/context-async-hooks@2.0.1(@opentelemetry/api@1.9.0))(@opentelemetry/core@2.0.1(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.0.1(@opentelemetry/api@1.9.0))(encoding@0.1.13)(next@15.5.2(@babel/core@7.28.4(supports-color@8.1.1))(@opentelemetry/api@1.9.0)(@playwright/test@1.56.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.4))(react@18.3.1)(supports-color@8.1.1)(webpack@5.94.0) + version: 10.3.0(@opentelemetry/context-async-hooks@2.0.1(@opentelemetry/api@1.9.0))(@opentelemetry/core@2.0.1(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.0.1(@opentelemetry/api@1.9.0))(encoding@0.1.13)(next@15.5.2(@opentelemetry/api@1.9.0)(@playwright/test@1.56.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.4))(react@18.3.1)(supports-color@8.1.1)(webpack@5.94.0) '@std/path': specifier: npm:@jsr/std__path@^1.0.8 version: '@jsr/std__path@1.0.8' @@ -990,12 +993,9 @@ importers: react-data-grid: specifier: 7.0.0-beta.41 version: 7.0.0-beta.41(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - react-datepicker: - specifier: ^4.18.0 - version: 4.18.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1) react-day-picker: - specifier: ^8.8.0 - version: 8.8.0(date-fns@2.30.0)(react@18.3.1) + specifier: ^9.11.1 + version: 9.11.1(react@18.3.1) react-dnd: specifier: ^16.0.1 version: 16.0.1(@types/hoist-non-react-statics@3.3.2)(@types/node@22.13.14)(@types/react@18.3.3)(react@18.3.1) @@ -1474,7 +1474,7 @@ importers: version: 1.114.27(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@tanstack/react-start': specifier: ^1.114.25 - version: 1.114.27(@electric-sql/pglite@0.2.15)(@tanstack/react-router@1.114.27(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@types/node@22.13.14)(aws4fetch@1.0.20)(babel-plugin-macros@3.1.0)(db0@0.3.1(@electric-sql/pglite@0.2.15)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3)))(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(encoding@0.1.13)(ioredis@5.6.0(supports-color@8.1.1))(jiti@2.5.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.4)(supports-color@8.1.1)(terser@5.39.0)(tsx@4.20.3)(typescript@5.9.2)(vite@7.1.11(@types/node@22.13.14)(jiti@2.5.1)(sass@1.77.4)(terser@5.39.0)(tsx@4.20.3)(yaml@2.8.1))(webpack@5.94.0(esbuild@0.25.2))(yaml@2.8.1) + version: 1.114.27(@electric-sql/pglite@0.2.15)(@tanstack/react-router@1.114.27(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@types/node@22.13.14)(aws4fetch@1.0.20)(babel-plugin-macros@3.1.0)(db0@0.3.1(@electric-sql/pglite@0.2.15)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3)))(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(ioredis@5.6.0(supports-color@8.1.1))(jiti@2.5.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.4)(supports-color@8.1.1)(terser@5.39.0)(tsx@4.20.3)(typescript@5.9.2)(vite@7.1.11(@types/node@22.13.14)(jiti@2.5.1)(sass@1.77.4)(terser@5.39.0)(tsx@4.20.3)(yaml@2.8.1))(webpack@5.94.0(esbuild@0.25.2))(yaml@2.8.1) '@types/common-tags': specifier: ^1.8.4 version: 1.8.4 @@ -1576,7 +1576,7 @@ importers: version: 1.0.5(@types/react-dom@18.3.0)(@types/react@18.3.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@sentry/nextjs': specifier: ^10 - version: 10.3.0(@opentelemetry/context-async-hooks@2.0.1(@opentelemetry/api@1.9.0))(@opentelemetry/core@2.0.1(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.0.1(@opentelemetry/api@1.9.0))(encoding@0.1.13)(next@15.5.2(@babel/core@7.28.4(supports-color@8.1.1))(@opentelemetry/api@1.9.0)(@playwright/test@1.56.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.4))(react@18.3.1)(supports-color@8.1.1)(webpack@5.94.0) + version: 10.3.0(@opentelemetry/context-async-hooks@2.0.1(@opentelemetry/api@1.9.0))(@opentelemetry/core@2.0.1(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.0.1(@opentelemetry/api@1.9.0))(encoding@0.1.13)(next@15.5.2(@opentelemetry/api@1.9.0)(@playwright/test@1.56.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.4))(react@18.3.1)(supports-color@8.1.1)(webpack@5.94.0) '@supabase/supabase-js': specifier: 'catalog:' version: 2.78.0 @@ -2300,8 +2300,8 @@ importers: specifier: ^5.1.0 version: 5.1.0(react@18.3.1) react-day-picker: - specifier: ^8.8.0 - version: 8.8.0(date-fns@2.30.0)(react@18.3.1) + specifier: ^9.11.1 + version: 9.11.1(react@18.3.1) react-dom: specifier: 'catalog:' version: 18.3.1(react@18.3.1) @@ -3414,6 +3414,9 @@ packages: '@date-fns/tz@1.2.0': resolution: {integrity: sha512-LBrd7MiJZ9McsOgxqWX7AaxrDjcFVjWH/tIKJd7pnR7McaslGYOP1QmmiBXdJH/H/yLCT+rcQ7FaPBUxRGUtrg==} + '@date-fns/tz@1.4.1': + resolution: {integrity: sha512-P5LUNhtbj6YfI3iJjw5EL9eUAG6OitD0W3fWQcpQjDRc/QIsL0tRNuO1PcDvPccWL1fSTXXdE1ds+l95DV/OFA==} + '@deno/shim-deno-test@0.5.0': resolution: {integrity: sha512-4nMhecpGlPi0cSzT67L+Tm+GOJqvuk8gqHBziqcUQOarnuIax1z96/gJHCSIz2Z0zhxE6Rzwb3IZXPtFh51j+w==} @@ -11446,6 +11449,9 @@ packages: dataloader@2.2.3: resolution: {integrity: sha512-y2krtASINtPFS1rSDjacrFgn1dcUuoREVabwlOGOe4SdxenREqwjwjElAdwvbGM7kgZz9a3KVicWR7vcz8rnzA==} + date-fns-jalali@4.1.0-0: + resolution: {integrity: sha512-hTIP/z+t+qKwBDcmmsnmjWTduxCg+5KfdqWQvb2X/8C9+knYY6epN/pfxdDuyVlSVeFz0sM5eEfwIUQ70U4ckg==} + date-fns@2.30.0: resolution: {integrity: sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==} engines: {node: '>=0.11'} @@ -16782,23 +16788,17 @@ packages: react: ^18.0 react-dom: ^18.0 - react-datepicker@4.18.0: - resolution: {integrity: sha512-0MYt3HmLbHVk1sw4v+RCbLAVg5TA3jWP7RyjZbo53PC+SEi+pjdgc92lB53ai/ENZaTOhbXmgni9GzvMrorMAw==} - peerDependencies: - react: ^16.9.0 || ^17 || ^18 - react-dom: ^16.9.0 || ^17 || ^18 - react-datepicker@7.6.0: resolution: {integrity: sha512-9cQH6Z/qa4LrGhzdc3XoHbhrxNcMi9MKjZmYgF/1MNNaJwvdSjv3Xd+jjvrEEbKEf71ZgCA3n7fQbdwd70qCRw==} peerDependencies: react: ^16.9.0 || ^17 || ^18 || ^19 || ^19.0.0-rc react-dom: ^16.9.0 || ^17 || ^18 || ^19 || ^19.0.0-rc - react-day-picker@8.8.0: - resolution: {integrity: sha512-QIC3uOuyGGbtypbd5QEggsCSqVaPNu8kzUWquZ7JjW9fuWB9yv7WyixKmnaFelTLXFdq7h7zU6n/aBleBqe/dA==} + react-day-picker@9.11.1: + resolution: {integrity: sha512-l3ub6o8NlchqIjPKrRFUCkTUEq6KwemQlfv3XZzzwpUeGwmDJ+0u0Upmt38hJyd7D/vn2dQoOoLV/qAp0o3uUw==} + engines: {node: '>=18'} peerDependencies: - date-fns: ^2.28.0 - react: ^16.8.0 || ^17.0.0 || ^18.0.0 + react: '>=16.8.0' react-devtools-inline@4.4.0: resolution: {integrity: sha512-ES0GolSrKO8wsKbsEkVeiR/ZAaHQTY4zDh1UW8DImVmm8oaGLl3ijJDvSGe+qDRKPZdPRnDtWWnSvvrgxXdThQ==} @@ -16933,12 +16933,6 @@ packages: react: ^16.8.0 || ^17.0.0 || ^18.0.0 react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 - react-onclickoutside@6.13.0: - resolution: {integrity: sha512-ty8So6tcUpIb+ZE+1HAhbLROvAIJYyJe/1vRrrcmW+jLsaM+/powDRqxzo6hSh9CuRZGSL1Q8mvcF5WRD93a0A==} - peerDependencies: - react: ^15.5.x || ^16.x || ^17.x || ^18.x - react-dom: ^15.5.x || ^16.x || ^17.x || ^18.x - react-popper@2.3.0: resolution: {integrity: sha512-e1hj8lL3uM+sgSR4Lxzn5h1GxBlpa4CQz0XLF8kx4MDrDRWY0Ena4c97PUeSX9i5W3UAfDP0z0FXCTQkoXUl3Q==} peerDependencies: @@ -21802,6 +21796,8 @@ snapshots: '@date-fns/tz@1.2.0': {} + '@date-fns/tz@1.4.1': {} + '@deno/shim-deno-test@0.5.0': {} '@deno/shim-deno@0.19.2': @@ -27570,7 +27566,7 @@ snapshots: '@sentry/core@10.3.0': {} - '@sentry/nextjs@10.3.0(@opentelemetry/context-async-hooks@2.0.1(@opentelemetry/api@1.9.0))(@opentelemetry/core@2.0.1(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.0.1(@opentelemetry/api@1.9.0))(encoding@0.1.13)(next@15.5.2(@babel/core@7.28.4(supports-color@8.1.1))(@opentelemetry/api@1.9.0)(@playwright/test@1.56.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.4))(react@18.3.1)(supports-color@8.1.1)(webpack@5.94.0)': + '@sentry/nextjs@10.3.0(@opentelemetry/context-async-hooks@2.0.1(@opentelemetry/api@1.9.0))(@opentelemetry/core@2.0.1(@opentelemetry/api@1.9.0))(@opentelemetry/sdk-trace-base@2.0.1(@opentelemetry/api@1.9.0))(encoding@0.1.13)(next@15.5.2(@opentelemetry/api@1.9.0)(@playwright/test@1.56.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.4))(react@18.3.1)(supports-color@8.1.1)(webpack@5.94.0)': dependencies: '@opentelemetry/api': 1.9.0 '@opentelemetry/semantic-conventions': 1.36.0 @@ -28639,7 +28635,7 @@ snapshots: tiny-invariant: 1.3.3 tiny-warning: 1.0.3 - '@tanstack/react-start-client@1.114.27(@electric-sql/pglite@0.2.15)(@types/node@22.13.14)(aws4fetch@1.0.20)(db0@0.3.1(@electric-sql/pglite@0.2.15)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3)))(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(encoding@0.1.13)(ioredis@5.6.0(supports-color@8.1.1))(jiti@2.5.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.4)(supports-color@8.1.1)(terser@5.39.0)(tsx@4.20.3)(typescript@5.9.2)(yaml@2.8.1)': + '@tanstack/react-start-client@1.114.27(@electric-sql/pglite@0.2.15)(@types/node@22.13.14)(aws4fetch@1.0.20)(db0@0.3.1(@electric-sql/pglite@0.2.15)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3)))(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(ioredis@5.6.0(supports-color@8.1.1))(jiti@2.5.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.4)(supports-color@8.1.1)(terser@5.39.0)(tsx@4.20.3)(typescript@5.9.2)(yaml@2.8.1)': dependencies: '@tanstack/react-router': 1.114.27(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@tanstack/router-core': 1.114.25 @@ -28650,7 +28646,7 @@ snapshots: react-dom: 18.3.1(react@18.3.1) tiny-invariant: 1.3.3 tiny-warning: 1.0.3 - vinxi: 0.5.3(@electric-sql/pglite@0.2.15)(@types/node@22.13.14)(aws4fetch@1.0.20)(db0@0.3.1(@electric-sql/pglite@0.2.15)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3)))(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(encoding@0.1.13)(ioredis@5.6.0(supports-color@8.1.1))(jiti@2.5.1)(sass@1.77.4)(supports-color@8.1.1)(terser@5.39.0)(tsx@4.20.3)(typescript@5.9.2)(yaml@2.8.1) + vinxi: 0.5.3(@electric-sql/pglite@0.2.15)(@types/node@22.13.14)(aws4fetch@1.0.20)(db0@0.3.1(@electric-sql/pglite@0.2.15)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3)))(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(ioredis@5.6.0(supports-color@8.1.1))(jiti@2.5.1)(sass@1.77.4)(supports-color@8.1.1)(terser@5.39.0)(tsx@4.20.3)(typescript@5.9.2)(yaml@2.8.1) transitivePeerDependencies: - '@azure/app-configuration' - '@azure/cosmos' @@ -28694,7 +28690,7 @@ snapshots: - xml2js - yaml - '@tanstack/react-start-config@1.114.27(@electric-sql/pglite@0.2.15)(@tanstack/react-router@1.114.27(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@types/node@22.13.14)(aws4fetch@1.0.20)(babel-plugin-macros@3.1.0)(db0@0.3.1(@electric-sql/pglite@0.2.15)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3)))(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(encoding@0.1.13)(ioredis@5.6.0(supports-color@8.1.1))(jiti@2.5.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.4)(supports-color@8.1.1)(terser@5.39.0)(tsx@4.20.3)(typescript@5.9.2)(vite@7.1.11(@types/node@22.13.14)(jiti@2.5.1)(sass@1.77.4)(terser@5.39.0)(tsx@4.20.3)(yaml@2.8.1))(webpack@5.94.0(esbuild@0.25.2))(yaml@2.8.1)': + '@tanstack/react-start-config@1.114.27(@electric-sql/pglite@0.2.15)(@tanstack/react-router@1.114.27(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@types/node@22.13.14)(aws4fetch@1.0.20)(babel-plugin-macros@3.1.0)(db0@0.3.1(@electric-sql/pglite@0.2.15)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3)))(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(ioredis@5.6.0(supports-color@8.1.1))(jiti@2.5.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.4)(supports-color@8.1.1)(terser@5.39.0)(tsx@4.20.3)(typescript@5.9.2)(vite@7.1.11(@types/node@22.13.14)(jiti@2.5.1)(sass@1.77.4)(terser@5.39.0)(tsx@4.20.3)(yaml@2.8.1))(webpack@5.94.0(esbuild@0.25.2))(yaml@2.8.1)': dependencies: '@tanstack/react-start-plugin': 1.114.12(@types/node@22.13.14)(jiti@2.5.1)(sass@1.77.4)(supports-color@8.1.1)(terser@5.39.0)(tsx@4.20.3)(yaml@2.8.1) '@tanstack/router-core': 1.114.25 @@ -28704,11 +28700,11 @@ snapshots: '@tanstack/start-server-functions-handler': 1.114.25 '@vitejs/plugin-react': 4.3.4(supports-color@8.1.1)(vite@7.1.11(@types/node@22.13.14)(jiti@2.5.1)(sass@1.77.4)(terser@5.39.0)(tsx@4.20.3)(yaml@2.8.1)) import-meta-resolve: 4.1.0 - nitropack: 2.11.7(@electric-sql/pglite@0.2.15)(aws4fetch@1.0.20)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(encoding@0.1.13)(supports-color@8.1.1)(typescript@5.9.2) + nitropack: 2.11.7(@electric-sql/pglite@0.2.15)(aws4fetch@1.0.20)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(supports-color@8.1.1)(typescript@5.9.2) ofetch: 1.4.1 react: 18.3.1 react-dom: 18.3.1(react@18.3.1) - vinxi: 0.5.3(@electric-sql/pglite@0.2.15)(@types/node@22.13.14)(aws4fetch@1.0.20)(db0@0.3.1(@electric-sql/pglite@0.2.15)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3)))(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(encoding@0.1.13)(ioredis@5.6.0(supports-color@8.1.1))(jiti@2.5.1)(sass@1.77.4)(supports-color@8.1.1)(terser@5.39.0)(tsx@4.20.3)(typescript@5.9.2)(yaml@2.8.1) + vinxi: 0.5.3(@electric-sql/pglite@0.2.15)(@types/node@22.13.14)(aws4fetch@1.0.20)(db0@0.3.1(@electric-sql/pglite@0.2.15)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3)))(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(ioredis@5.6.0(supports-color@8.1.1))(jiti@2.5.1)(sass@1.77.4)(supports-color@8.1.1)(terser@5.39.0)(tsx@4.20.3)(typescript@5.9.2)(yaml@2.8.1) vite: 7.1.11(@types/node@22.13.14)(jiti@2.5.1)(sass@1.77.4)(terser@5.39.0)(tsx@4.20.3)(yaml@2.8.1) zod: 3.25.76 transitivePeerDependencies: @@ -28786,11 +28782,11 @@ snapshots: - tsx - yaml - '@tanstack/react-start-router-manifest@1.114.25(@electric-sql/pglite@0.2.15)(@types/node@22.13.14)(aws4fetch@1.0.20)(db0@0.3.1(@electric-sql/pglite@0.2.15)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3)))(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(encoding@0.1.13)(ioredis@5.6.0(supports-color@8.1.1))(jiti@2.5.1)(sass@1.77.4)(supports-color@8.1.1)(terser@5.39.0)(tsx@4.20.3)(typescript@5.9.2)(yaml@2.8.1)': + '@tanstack/react-start-router-manifest@1.114.25(@electric-sql/pglite@0.2.15)(@types/node@22.13.14)(aws4fetch@1.0.20)(db0@0.3.1(@electric-sql/pglite@0.2.15)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3)))(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(ioredis@5.6.0(supports-color@8.1.1))(jiti@2.5.1)(sass@1.77.4)(supports-color@8.1.1)(terser@5.39.0)(tsx@4.20.3)(typescript@5.9.2)(yaml@2.8.1)': dependencies: '@tanstack/router-core': 1.114.25 tiny-invariant: 1.3.3 - vinxi: 0.5.3(@electric-sql/pglite@0.2.15)(@types/node@22.13.14)(aws4fetch@1.0.20)(db0@0.3.1(@electric-sql/pglite@0.2.15)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3)))(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(encoding@0.1.13)(ioredis@5.6.0(supports-color@8.1.1))(jiti@2.5.1)(sass@1.77.4)(supports-color@8.1.1)(terser@5.39.0)(tsx@4.20.3)(typescript@5.9.2)(yaml@2.8.1) + vinxi: 0.5.3(@electric-sql/pglite@0.2.15)(@types/node@22.13.14)(aws4fetch@1.0.20)(db0@0.3.1(@electric-sql/pglite@0.2.15)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3)))(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(ioredis@5.6.0(supports-color@8.1.1))(jiti@2.5.1)(sass@1.77.4)(supports-color@8.1.1)(terser@5.39.0)(tsx@4.20.3)(typescript@5.9.2)(yaml@2.8.1) transitivePeerDependencies: - '@azure/app-configuration' - '@azure/cosmos' @@ -28849,13 +28845,13 @@ snapshots: tiny-warning: 1.0.3 unctx: 2.4.1 - '@tanstack/react-start@1.114.27(@electric-sql/pglite@0.2.15)(@tanstack/react-router@1.114.27(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@types/node@22.13.14)(aws4fetch@1.0.20)(babel-plugin-macros@3.1.0)(db0@0.3.1(@electric-sql/pglite@0.2.15)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3)))(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(encoding@0.1.13)(ioredis@5.6.0(supports-color@8.1.1))(jiti@2.5.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.4)(supports-color@8.1.1)(terser@5.39.0)(tsx@4.20.3)(typescript@5.9.2)(vite@7.1.11(@types/node@22.13.14)(jiti@2.5.1)(sass@1.77.4)(terser@5.39.0)(tsx@4.20.3)(yaml@2.8.1))(webpack@5.94.0(esbuild@0.25.2))(yaml@2.8.1)': + '@tanstack/react-start@1.114.27(@electric-sql/pglite@0.2.15)(@tanstack/react-router@1.114.27(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@types/node@22.13.14)(aws4fetch@1.0.20)(babel-plugin-macros@3.1.0)(db0@0.3.1(@electric-sql/pglite@0.2.15)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3)))(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(ioredis@5.6.0(supports-color@8.1.1))(jiti@2.5.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.4)(supports-color@8.1.1)(terser@5.39.0)(tsx@4.20.3)(typescript@5.9.2)(vite@7.1.11(@types/node@22.13.14)(jiti@2.5.1)(sass@1.77.4)(terser@5.39.0)(tsx@4.20.3)(yaml@2.8.1))(webpack@5.94.0(esbuild@0.25.2))(yaml@2.8.1)': dependencies: - '@tanstack/react-start-client': 1.114.27(@electric-sql/pglite@0.2.15)(@types/node@22.13.14)(aws4fetch@1.0.20)(db0@0.3.1(@electric-sql/pglite@0.2.15)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3)))(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(encoding@0.1.13)(ioredis@5.6.0(supports-color@8.1.1))(jiti@2.5.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.4)(supports-color@8.1.1)(terser@5.39.0)(tsx@4.20.3)(typescript@5.9.2)(yaml@2.8.1) - '@tanstack/react-start-config': 1.114.27(@electric-sql/pglite@0.2.15)(@tanstack/react-router@1.114.27(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@types/node@22.13.14)(aws4fetch@1.0.20)(babel-plugin-macros@3.1.0)(db0@0.3.1(@electric-sql/pglite@0.2.15)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3)))(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(encoding@0.1.13)(ioredis@5.6.0(supports-color@8.1.1))(jiti@2.5.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.4)(supports-color@8.1.1)(terser@5.39.0)(tsx@4.20.3)(typescript@5.9.2)(vite@7.1.11(@types/node@22.13.14)(jiti@2.5.1)(sass@1.77.4)(terser@5.39.0)(tsx@4.20.3)(yaml@2.8.1))(webpack@5.94.0(esbuild@0.25.2))(yaml@2.8.1) - '@tanstack/react-start-router-manifest': 1.114.25(@electric-sql/pglite@0.2.15)(@types/node@22.13.14)(aws4fetch@1.0.20)(db0@0.3.1(@electric-sql/pglite@0.2.15)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3)))(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(encoding@0.1.13)(ioredis@5.6.0(supports-color@8.1.1))(jiti@2.5.1)(sass@1.77.4)(supports-color@8.1.1)(terser@5.39.0)(tsx@4.20.3)(typescript@5.9.2)(yaml@2.8.1) + '@tanstack/react-start-client': 1.114.27(@electric-sql/pglite@0.2.15)(@types/node@22.13.14)(aws4fetch@1.0.20)(db0@0.3.1(@electric-sql/pglite@0.2.15)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3)))(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(ioredis@5.6.0(supports-color@8.1.1))(jiti@2.5.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.4)(supports-color@8.1.1)(terser@5.39.0)(tsx@4.20.3)(typescript@5.9.2)(yaml@2.8.1) + '@tanstack/react-start-config': 1.114.27(@electric-sql/pglite@0.2.15)(@tanstack/react-router@1.114.27(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@types/node@22.13.14)(aws4fetch@1.0.20)(babel-plugin-macros@3.1.0)(db0@0.3.1(@electric-sql/pglite@0.2.15)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3)))(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(ioredis@5.6.0(supports-color@8.1.1))(jiti@2.5.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.77.4)(supports-color@8.1.1)(terser@5.39.0)(tsx@4.20.3)(typescript@5.9.2)(vite@7.1.11(@types/node@22.13.14)(jiti@2.5.1)(sass@1.77.4)(terser@5.39.0)(tsx@4.20.3)(yaml@2.8.1))(webpack@5.94.0(esbuild@0.25.2))(yaml@2.8.1) + '@tanstack/react-start-router-manifest': 1.114.25(@electric-sql/pglite@0.2.15)(@types/node@22.13.14)(aws4fetch@1.0.20)(db0@0.3.1(@electric-sql/pglite@0.2.15)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3)))(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(ioredis@5.6.0(supports-color@8.1.1))(jiti@2.5.1)(sass@1.77.4)(supports-color@8.1.1)(terser@5.39.0)(tsx@4.20.3)(typescript@5.9.2)(yaml@2.8.1) '@tanstack/react-start-server': 1.114.27(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@tanstack/start-api-routes': 1.114.25(@electric-sql/pglite@0.2.15)(@types/node@22.13.14)(aws4fetch@1.0.20)(db0@0.3.1(@electric-sql/pglite@0.2.15)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3)))(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(encoding@0.1.13)(ioredis@5.6.0(supports-color@8.1.1))(jiti@2.5.1)(sass@1.77.4)(supports-color@8.1.1)(terser@5.39.0)(tsx@4.20.3)(typescript@5.9.2)(yaml@2.8.1) + '@tanstack/start-api-routes': 1.114.25(@electric-sql/pglite@0.2.15)(@types/node@22.13.14)(aws4fetch@1.0.20)(db0@0.3.1(@electric-sql/pglite@0.2.15)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3)))(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(ioredis@5.6.0(supports-color@8.1.1))(jiti@2.5.1)(sass@1.77.4)(supports-color@8.1.1)(terser@5.39.0)(tsx@4.20.3)(typescript@5.9.2)(yaml@2.8.1) '@tanstack/start-server-functions-client': 1.114.25(@types/node@22.13.14)(babel-plugin-macros@3.1.0)(jiti@2.5.1)(sass@1.77.4)(supports-color@8.1.1)(terser@5.39.0)(tsx@4.20.3)(yaml@2.8.1) '@tanstack/start-server-functions-handler': 1.114.25 '@tanstack/start-server-functions-server': 1.114.12(@types/node@22.13.14)(babel-plugin-macros@3.1.0)(jiti@2.5.1)(sass@1.77.4)(supports-color@8.1.1)(terser@5.39.0)(tsx@4.20.3)(yaml@2.8.1) @@ -29006,11 +29002,11 @@ snapshots: - tsx - yaml - '@tanstack/start-api-routes@1.114.25(@electric-sql/pglite@0.2.15)(@types/node@22.13.14)(aws4fetch@1.0.20)(db0@0.3.1(@electric-sql/pglite@0.2.15)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3)))(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(encoding@0.1.13)(ioredis@5.6.0(supports-color@8.1.1))(jiti@2.5.1)(sass@1.77.4)(supports-color@8.1.1)(terser@5.39.0)(tsx@4.20.3)(typescript@5.9.2)(yaml@2.8.1)': + '@tanstack/start-api-routes@1.114.25(@electric-sql/pglite@0.2.15)(@types/node@22.13.14)(aws4fetch@1.0.20)(db0@0.3.1(@electric-sql/pglite@0.2.15)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3)))(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(ioredis@5.6.0(supports-color@8.1.1))(jiti@2.5.1)(sass@1.77.4)(supports-color@8.1.1)(terser@5.39.0)(tsx@4.20.3)(typescript@5.9.2)(yaml@2.8.1)': dependencies: '@tanstack/router-core': 1.114.25 '@tanstack/start-server-core': 1.114.25 - vinxi: 0.5.3(@electric-sql/pglite@0.2.15)(@types/node@22.13.14)(aws4fetch@1.0.20)(db0@0.3.1(@electric-sql/pglite@0.2.15)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3)))(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(encoding@0.1.13)(ioredis@5.6.0(supports-color@8.1.1))(jiti@2.5.1)(sass@1.77.4)(supports-color@8.1.1)(terser@5.39.0)(tsx@4.20.3)(typescript@5.9.2)(yaml@2.8.1) + vinxi: 0.5.3(@electric-sql/pglite@0.2.15)(@types/node@22.13.14)(aws4fetch@1.0.20)(db0@0.3.1(@electric-sql/pglite@0.2.15)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3)))(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(ioredis@5.6.0(supports-color@8.1.1))(jiti@2.5.1)(sass@1.77.4)(supports-color@8.1.1)(terser@5.39.0)(tsx@4.20.3)(typescript@5.9.2)(yaml@2.8.1) transitivePeerDependencies: - '@azure/app-configuration' - '@azure/cosmos' @@ -29899,7 +29895,7 @@ snapshots: optionalDependencies: '@aws-sdk/credential-provider-web-identity': 3.830.0 - '@vercel/nft@0.29.2(encoding@0.1.13)(rollup@4.50.2)(supports-color@8.1.1)': + '@vercel/nft@0.29.2(rollup@4.50.2)(supports-color@8.1.1)': dependencies: '@mapbox/node-pre-gyp': 2.0.0(encoding@0.1.13)(supports-color@8.1.1) '@rollup/pluginutils': 5.1.4(rollup@4.50.2) @@ -31933,6 +31929,8 @@ snapshots: dataloader@2.2.3: {} + date-fns-jalali@4.1.0-0: {} + date-fns@2.30.0: dependencies: '@babel/runtime': 7.26.10 @@ -36713,7 +36711,7 @@ snapshots: nice-try@1.0.5: {} - nitropack@2.11.7(@electric-sql/pglite@0.2.15)(aws4fetch@1.0.20)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(encoding@0.1.13)(supports-color@8.1.1)(typescript@5.9.2): + nitropack@2.11.7(@electric-sql/pglite@0.2.15)(aws4fetch@1.0.20)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(supports-color@8.1.1)(typescript@5.9.2): dependencies: '@cloudflare/kv-asset-handler': 0.4.0 '@netlify/functions': 3.0.4 @@ -36724,7 +36722,7 @@ snapshots: '@rollup/plugin-node-resolve': 16.0.1(rollup@4.50.2) '@rollup/plugin-replace': 6.0.2(rollup@4.50.2) '@rollup/plugin-terser': 0.4.4(rollup@4.50.2) - '@vercel/nft': 0.29.2(encoding@0.1.13)(rollup@4.50.2)(supports-color@8.1.1) + '@vercel/nft': 0.29.2(rollup@4.50.2)(supports-color@8.1.1) archiver: 7.0.1 c12: 3.0.2(magicast@0.3.5) chokidar: 4.0.3 @@ -38574,17 +38572,6 @@ snapshots: react: 18.3.1 react-dom: 18.3.1(react@18.3.1) - react-datepicker@4.18.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1): - dependencies: - '@popperjs/core': 2.11.8 - classnames: 2.3.2 - date-fns: 2.30.0 - prop-types: 15.8.1 - react: 18.3.1 - react-dom: 18.3.1(react@18.3.1) - react-onclickoutside: 6.13.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - react-popper: 2.3.0(@popperjs/core@2.11.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - react-datepicker@7.6.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1): dependencies: '@floating-ui/react': 0.27.12(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -38593,9 +38580,11 @@ snapshots: react: 18.3.1 react-dom: 18.3.1(react@18.3.1) - react-day-picker@8.8.0(date-fns@2.30.0)(react@18.3.1): + react-day-picker@9.11.1(react@18.3.1): dependencies: - date-fns: 2.30.0 + '@date-fns/tz': 1.4.1 + date-fns: 4.1.0 + date-fns-jalali: 4.1.0-0 react: 18.3.1 react-devtools-inline@4.4.0: @@ -38775,11 +38764,6 @@ snapshots: react: 18.3.1 react-dom: 18.3.1(react@18.3.1) - react-onclickoutside@6.13.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1): - dependencies: - react: 18.3.1 - react-dom: 18.3.1(react@18.3.1) - react-popper@2.3.0(@popperjs/core@2.11.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1): dependencies: '@popperjs/core': 2.11.8 @@ -41678,7 +41662,7 @@ snapshots: d3-time: 3.1.0 d3-timer: 3.0.1 - vinxi@0.5.3(@electric-sql/pglite@0.2.15)(@types/node@22.13.14)(aws4fetch@1.0.20)(db0@0.3.1(@electric-sql/pglite@0.2.15)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3)))(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(encoding@0.1.13)(ioredis@5.6.0(supports-color@8.1.1))(jiti@2.5.1)(sass@1.77.4)(supports-color@8.1.1)(terser@5.39.0)(tsx@4.20.3)(typescript@5.9.2)(yaml@2.8.1): + vinxi@0.5.3(@electric-sql/pglite@0.2.15)(@types/node@22.13.14)(aws4fetch@1.0.20)(db0@0.3.1(@electric-sql/pglite@0.2.15)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3)))(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(ioredis@5.6.0(supports-color@8.1.1))(jiti@2.5.1)(sass@1.77.4)(supports-color@8.1.1)(terser@5.39.0)(tsx@4.20.3)(typescript@5.9.2)(yaml@2.8.1): dependencies: '@babel/core': 7.28.4(supports-color@8.1.1) '@babel/plugin-syntax-jsx': 7.27.1(@babel/core@7.28.4(supports-color@8.1.1)) @@ -41700,7 +41684,7 @@ snapshots: hookable: 5.5.3 http-proxy: 1.18.1 micromatch: 4.0.8 - nitropack: 2.11.7(@electric-sql/pglite@0.2.15)(aws4fetch@1.0.20)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(encoding@0.1.13)(supports-color@8.1.1)(typescript@5.9.2) + nitropack: 2.11.7(@electric-sql/pglite@0.2.15)(aws4fetch@1.0.20)(drizzle-orm@0.44.2(@electric-sql/pglite@0.2.15)(@opentelemetry/api@1.9.0)(@types/pg@8.15.4)(pg@8.16.3))(supports-color@8.1.1)(typescript@5.9.2) node-fetch-native: 1.6.6 path-to-regexp: 6.3.0 pathe: 1.1.2 diff --git a/turbo.json b/turbo.json index a7c1ac8706a..2137fa130e1 100644 --- a/turbo.json +++ b/turbo.json @@ -89,6 +89,8 @@ "PG_META_CRYPTO_KEY", "POSTGRES_PASSWORD", "POSTGRES_HOST", + "POSTGRES_USER_READ_WRITE", + "POSTGRES_USER_READ_ONLY", "POSTGRES_DB", "POSTGRES_PORT", "READ_ONLY_URL",