diff --git a/apps/studio/lib/api/apiWrapper.ts b/apps/studio/lib/api/apiWrapper.ts index b12d397cc03..595e025bc2c 100644 --- a/apps/studio/lib/api/apiWrapper.ts +++ b/apps/studio/lib/api/apiWrapper.ts @@ -1,3 +1,4 @@ +import * as Sentry from '@sentry/nextjs' import type { JwtPayload } from '@supabase/supabase-js' import type { NextApiRequest, NextApiResponse } from 'next' @@ -24,7 +25,7 @@ export function isResponseOk(response: T | ResponseFailure | undefined): resp // Purpose of this apiWrapper is to function like a global catchall for ANY errors // It's a safety net as the API service should never drop, nor fail -async function apiWrapper( +export async function apiWrapper( req: NextApiRequest, res: NextApiResponse, handler: ( @@ -50,11 +51,9 @@ async function apiWrapper( claims = response } - return handler(req, res, claims) + return await handler(req, res, claims) } catch (error) { + Sentry.captureException(error) return res.status(500).json({ error }) } } - -export { apiWrapper } -export default apiWrapper diff --git a/apps/studio/lib/api/apiWrappers.test.ts b/apps/studio/lib/api/apiWrappers.test.ts index fafb8bd753a..c089d55562d 100644 --- a/apps/studio/lib/api/apiWrappers.test.ts +++ b/apps/studio/lib/api/apiWrappers.test.ts @@ -1,9 +1,10 @@ +import * as Sentry from '@sentry/nextjs' import type { JwtPayload } from '@supabase/supabase-js' import type { NextApiRequest, NextApiResponse } from 'next' import { beforeEach, describe, expect, it, vi } from 'vitest' import { apiAuthenticate } from './apiAuthenticate' -import apiWrapper from './apiWrapper' +import { apiWrapper } from './apiWrapper' import { ResponseError } from '@/types' vi.mock('@/lib/constants', () => ({ @@ -15,6 +16,10 @@ vi.mock('./apiAuthenticate', () => ({ apiAuthenticate: vi.fn(), })) +vi.mock('@sentry/nextjs', () => ({ + captureException: vi.fn(), +})) + describe('apiWrapper', () => { const mockReq = {} as NextApiRequest const mockRes = { @@ -59,4 +64,14 @@ describe('apiWrapper', () => { expect(mockRes.status).toHaveBeenCalledWith(401) expect(mockHandler).not.toHaveBeenCalled() }) + + it('should report to Sentry and return 500 when the handler throws', async () => { + const mockError = new Error('boom') + mockHandler.mockRejectedValue(mockError) + + await apiWrapper(mockReq, mockRes, mockHandler, { withAuth: false }) + expect(Sentry.captureException).toHaveBeenCalledWith(mockError) + expect(mockRes.status).toHaveBeenCalledWith(500) + expect(mockRes.json).toHaveBeenCalledWith({ error: mockError }) + }) }) diff --git a/apps/studio/pages/api/ai/code/complete.ts b/apps/studio/pages/api/ai/code/complete.ts index 1c2d8218662..326400a381e 100644 --- a/apps/studio/pages/api/ai/code/complete.ts +++ b/apps/studio/pages/api/ai/code/complete.ts @@ -18,7 +18,7 @@ import { SECURITY_PROMPT, SQL_COMPLETION_INSTRUCTIONS, } from '@/lib/ai/prompts' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { executeQuery } from '@/lib/api/self-hosted/query' export const maxDuration = 60 diff --git a/apps/studio/pages/api/ai/feedback/classify.ts b/apps/studio/pages/api/ai/feedback/classify.ts index 9703fa0b52d..f04f1415797 100644 --- a/apps/studio/pages/api/ai/feedback/classify.ts +++ b/apps/studio/pages/api/ai/feedback/classify.ts @@ -4,7 +4,7 @@ import { z } from 'zod' import { getModel } from '@/lib/ai/model' import { DEFAULT_COMPLETION_MODEL } from '@/lib/ai/model.utils' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' async function handler(req: NextApiRequest, res: NextApiResponse) { const { method } = req diff --git a/apps/studio/pages/api/ai/feedback/rate.ts b/apps/studio/pages/api/ai/feedback/rate.ts index 597958cbf3c..9842828342b 100644 --- a/apps/studio/pages/api/ai/feedback/rate.ts +++ b/apps/studio/pages/api/ai/feedback/rate.ts @@ -11,7 +11,7 @@ import { IS_TRACING_ENABLED, isTracingAllowed } from '@/lib/ai/braintrust-logger import { getModel } from '@/lib/ai/model' import { DEFAULT_COMPLETION_MODEL } from '@/lib/ai/model.utils' import { sanitizeMessagePart } from '@/lib/ai/tools/tool-sanitizer' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' export const maxDuration = 30 diff --git a/apps/studio/pages/api/ai/onboarding/design.ts b/apps/studio/pages/api/ai/onboarding/design.ts index d568932cf5f..b2714c20e27 100644 --- a/apps/studio/pages/api/ai/onboarding/design.ts +++ b/apps/studio/pages/api/ai/onboarding/design.ts @@ -5,7 +5,7 @@ import { z } from 'zod' import { getModel } from '@/lib/ai/model' import { DEFAULT_COMPLETION_MODEL } from '@/lib/ai/model.utils' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' export const maxDuration = 60 diff --git a/apps/studio/pages/api/ai/sql/check-api-key.ts b/apps/studio/pages/api/ai/sql/check-api-key.ts index 15410b6858f..90702687eac 100644 --- a/apps/studio/pages/api/ai/sql/check-api-key.ts +++ b/apps/studio/pages/api/ai/sql/check-api-key.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' const wrapper = (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler, { withAuth: true }) diff --git a/apps/studio/pages/api/ai/sql/cron-v2.ts b/apps/studio/pages/api/ai/sql/cron-v2.ts index 21acb114ecb..9dee66aabe0 100644 --- a/apps/studio/pages/api/ai/sql/cron-v2.ts +++ b/apps/studio/pages/api/ai/sql/cron-v2.ts @@ -5,7 +5,7 @@ import { z } from 'zod' import { getModel } from '@/lib/ai/model' import { DEFAULT_COMPLETION_MODEL } from '@/lib/ai/model.utils' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' const cronSchema = z.object({ cron_expression: z.string().describe('The generated cron expression.'), diff --git a/apps/studio/pages/api/ai/sql/filter-v1.ts b/apps/studio/pages/api/ai/sql/filter-v1.ts index af85f0021e2..e4633e00f4a 100644 --- a/apps/studio/pages/api/ai/sql/filter-v1.ts +++ b/apps/studio/pages/api/ai/sql/filter-v1.ts @@ -4,7 +4,7 @@ import { NextApiRequest, NextApiResponse } from 'next' import { getModel } from '@/lib/ai/model' import { DEFAULT_COMPLETION_MODEL } from '@/lib/ai/model.utils' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { filterGroupSchemaForAI, requestSchema, diff --git a/apps/studio/pages/api/ai/sql/generate-v4.ts b/apps/studio/pages/api/ai/sql/generate-v4.ts index aa48b2cea79..3bb67ff91b1 100644 --- a/apps/studio/pages/api/ai/sql/generate-v4.ts +++ b/apps/studio/pages/api/ai/sql/generate-v4.ts @@ -20,7 +20,7 @@ import { type AssistantModelId, } from '@/lib/ai/model.utils' import { getTools } from '@/lib/ai/tools' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { executeQuery } from '@/lib/api/self-hosted/query' import { getURL } from '@/lib/helpers' diff --git a/apps/studio/pages/api/ai/sql/parse-client-code.ts b/apps/studio/pages/api/ai/sql/parse-client-code.ts index 4340fdf1c2c..4998d55f9ff 100644 --- a/apps/studio/pages/api/ai/sql/parse-client-code.ts +++ b/apps/studio/pages/api/ai/sql/parse-client-code.ts @@ -5,7 +5,7 @@ import { z } from 'zod' import { getModel } from '@/lib/ai/model' import { DEFAULT_COMPLETION_MODEL } from '@/lib/ai/model.utils' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' const codeSchema = z.object({ sql: z diff --git a/apps/studio/pages/api/ai/sql/policy.ts b/apps/studio/pages/api/ai/sql/policy.ts index 8cb27ed7061..c5d6e40cd1f 100644 --- a/apps/studio/pages/api/ai/sql/policy.ts +++ b/apps/studio/pages/api/ai/sql/policy.ts @@ -10,7 +10,7 @@ import { getModel } from '@/lib/ai/model' import { DEFAULT_COMPLETION_MODEL } from '@/lib/ai/model.utils' import { RLS_PROMPT } from '@/lib/ai/prompts' import { getTools } from '@/lib/ai/tools' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' const policySchema = z.object({ sql: z.string().describe('The generated Postgres CREATE POLICY statement.'), diff --git a/apps/studio/pages/api/ai/sql/title-v2.ts b/apps/studio/pages/api/ai/sql/title-v2.ts index e40420e4069..2a5fad3a064 100644 --- a/apps/studio/pages/api/ai/sql/title-v2.ts +++ b/apps/studio/pages/api/ai/sql/title-v2.ts @@ -5,7 +5,7 @@ import { z } from 'zod' import { getModel } from '@/lib/ai/model' import { DEFAULT_COMPLETION_MODEL } from '@/lib/ai/model.utils' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' const titleSchema = z.object({ title: z diff --git a/apps/studio/pages/api/generate-attachment-url.ts b/apps/studio/pages/api/generate-attachment-url.ts index 6110a36891b..7b2ced31a93 100644 --- a/apps/studio/pages/api/generate-attachment-url.ts +++ b/apps/studio/pages/api/generate-attachment-url.ts @@ -3,7 +3,7 @@ import type { NextApiRequest, NextApiResponse } from 'next' import z from 'zod' import { DASHBOARD_LOG_BUCKET } from '@/components/interfaces/Support/dashboard-logs' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { getUserClaims } from '@/lib/gotrue' export const maxDuration = 120 diff --git a/apps/studio/pages/api/platform/auth/[ref]/invite.ts b/apps/studio/pages/api/platform/auth/[ref]/invite.ts index ae8a119dfa6..851bd4acaeb 100644 --- a/apps/studio/pages/api/platform/auth/[ref]/invite.ts +++ b/apps/studio/pages/api/platform/auth/[ref]/invite.ts @@ -2,7 +2,7 @@ import { NextApiRequest, NextApiResponse } from 'next' import { fetchPost } from '@/data/fetchers' import { constructHeaders } from '@/lib/api/apiHelpers' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/auth/[ref]/magiclink.ts b/apps/studio/pages/api/platform/auth/[ref]/magiclink.ts index 249858996a0..aecdb052991 100644 --- a/apps/studio/pages/api/platform/auth/[ref]/magiclink.ts +++ b/apps/studio/pages/api/platform/auth/[ref]/magiclink.ts @@ -2,7 +2,7 @@ import { NextApiRequest, NextApiResponse } from 'next' import { fetchPost } from '@/data/fetchers' import { constructHeaders } from '@/lib/api/apiHelpers' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/auth/[ref]/otp.ts b/apps/studio/pages/api/platform/auth/[ref]/otp.ts index f4b6e0bc9a7..b0a5b1af2d3 100644 --- a/apps/studio/pages/api/platform/auth/[ref]/otp.ts +++ b/apps/studio/pages/api/platform/auth/[ref]/otp.ts @@ -2,7 +2,7 @@ import { NextApiRequest, NextApiResponse } from 'next' import { fetchPost } from '@/data/fetchers' import { constructHeaders } from '@/lib/api/apiHelpers' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/auth/[ref]/recover.ts b/apps/studio/pages/api/platform/auth/[ref]/recover.ts index e4edcd7959b..a96f673c9a2 100644 --- a/apps/studio/pages/api/platform/auth/[ref]/recover.ts +++ b/apps/studio/pages/api/platform/auth/[ref]/recover.ts @@ -2,7 +2,7 @@ import { NextApiRequest, NextApiResponse } from 'next' import { fetchPost } from '@/data/fetchers' import { constructHeaders } from '@/lib/api/apiHelpers' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/auth/[ref]/users/[id]/factors.ts b/apps/studio/pages/api/platform/auth/[ref]/users/[id]/factors.ts index dc03b15282b..cadfdb1678e 100644 --- a/apps/studio/pages/api/platform/auth/[ref]/users/[id]/factors.ts +++ b/apps/studio/pages/api/platform/auth/[ref]/users/[id]/factors.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { selfHostedSupabaseAdmin as supabase } from '@/lib/api/self-hosted-admin' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/auth/[ref]/users/[id]/index.ts b/apps/studio/pages/api/platform/auth/[ref]/users/[id]/index.ts index 78d0186402b..2276004f5eb 100644 --- a/apps/studio/pages/api/platform/auth/[ref]/users/[id]/index.ts +++ b/apps/studio/pages/api/platform/auth/[ref]/users/[id]/index.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { selfHostedSupabaseAdmin as supabase } from '@/lib/api/self-hosted-admin' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/auth/[ref]/users/index.ts b/apps/studio/pages/api/platform/auth/[ref]/users/index.ts index 4e7be6cf014..6bdf9e8c2e3 100644 --- a/apps/studio/pages/api/platform/auth/[ref]/users/index.ts +++ b/apps/studio/pages/api/platform/auth/[ref]/users/index.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { selfHostedSupabaseAdmin as supabase } from '@/lib/api/self-hosted-admin' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/database/[ref]/pooling.ts b/apps/studio/pages/api/platform/database/[ref]/pooling.ts index b67f8be2c11..8bdc884488a 100644 --- a/apps/studio/pages/api/platform/database/[ref]/pooling.ts +++ b/apps/studio/pages/api/platform/database/[ref]/pooling.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/deployment-mode.ts b/apps/studio/pages/api/platform/deployment-mode.ts index fbc17165639..3a6e9f98179 100644 --- a/apps/studio/pages/api/platform/deployment-mode.ts +++ b/apps/studio/pages/api/platform/deployment-mode.ts @@ -1,7 +1,7 @@ import { NextApiRequest, NextApiResponse } from 'next' import type { DeploymentModeResponse } from '@/data/config/deployment-mode-query' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { IS_CLI } from '@/lib/constants' export default function deploymentMode(req: NextApiRequest, res: NextApiResponse) { diff --git a/apps/studio/pages/api/platform/integrations/[slug].ts b/apps/studio/pages/api/platform/integrations/[slug].ts index 8a1c9ef0168..c5811b4c435 100644 --- a/apps/studio/pages/api/platform/integrations/[slug].ts +++ b/apps/studio/pages/api/platform/integrations/[slug].ts @@ -1,7 +1,7 @@ import { paths } from 'api-types' import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/integrations/github/authorization.ts b/apps/studio/pages/api/platform/integrations/github/authorization.ts index 91bc37b52e2..da9c53e43e4 100644 --- a/apps/studio/pages/api/platform/integrations/github/authorization.ts +++ b/apps/studio/pages/api/platform/integrations/github/authorization.ts @@ -1,7 +1,7 @@ import { paths } from 'api-types' import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/integrations/github/connections.ts b/apps/studio/pages/api/platform/integrations/github/connections.ts index b579c1ea9d9..8c755a0a219 100644 --- a/apps/studio/pages/api/platform/integrations/github/connections.ts +++ b/apps/studio/pages/api/platform/integrations/github/connections.ts @@ -1,7 +1,7 @@ import { paths } from 'api-types' import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/integrations/github/repositories.ts b/apps/studio/pages/api/platform/integrations/github/repositories.ts index 69beeaceb68..76c0f483532 100644 --- a/apps/studio/pages/api/platform/integrations/github/repositories.ts +++ b/apps/studio/pages/api/platform/integrations/github/repositories.ts @@ -1,7 +1,7 @@ import { paths } from 'api-types' import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/organizations/[slug]/billing/subscription.ts b/apps/studio/pages/api/platform/organizations/[slug]/billing/subscription.ts index 6c286dbb588..f585fc29b4e 100644 --- a/apps/studio/pages/api/platform/organizations/[slug]/billing/subscription.ts +++ b/apps/studio/pages/api/platform/organizations/[slug]/billing/subscription.ts @@ -1,7 +1,7 @@ import { paths } from 'api-types' import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/organizations/index.ts b/apps/studio/pages/api/platform/organizations/index.ts index b7442f248f7..66792663c79 100644 --- a/apps/studio/pages/api/platform/organizations/index.ts +++ b/apps/studio/pages/api/platform/organizations/index.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/pg-meta/[ref]/column-privileges.ts b/apps/studio/pages/api/platform/pg-meta/[ref]/column-privileges.ts index 67871cce297..82ef618fa5d 100644 --- a/apps/studio/pages/api/platform/pg-meta/[ref]/column-privileges.ts +++ b/apps/studio/pages/api/platform/pg-meta/[ref]/column-privileges.ts @@ -3,7 +3,7 @@ import { NextApiRequest, NextApiResponse } from 'next' import { getPgMetaRedirectUrl } from './tables' import { fetchGet } from '@/data/fetchers' import { constructHeaders } from '@/lib/api/apiHelpers' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler, { withAuth: true }) diff --git a/apps/studio/pages/api/platform/pg-meta/[ref]/extensions.ts b/apps/studio/pages/api/platform/pg-meta/[ref]/extensions.ts index 785f1bc84d4..501f2686c2f 100644 --- a/apps/studio/pages/api/platform/pg-meta/[ref]/extensions.ts +++ b/apps/studio/pages/api/platform/pg-meta/[ref]/extensions.ts @@ -2,7 +2,7 @@ import { NextApiRequest, NextApiResponse } from 'next' import { fetchGet } from '@/data/fetchers' import { constructHeaders } from '@/lib/api/apiHelpers' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { PG_META_URL } from '@/lib/constants' export default (req: NextApiRequest, res: NextApiResponse) => diff --git a/apps/studio/pages/api/platform/pg-meta/[ref]/foreign-tables.ts b/apps/studio/pages/api/platform/pg-meta/[ref]/foreign-tables.ts index 41bf785c932..b811183a7a5 100644 --- a/apps/studio/pages/api/platform/pg-meta/[ref]/foreign-tables.ts +++ b/apps/studio/pages/api/platform/pg-meta/[ref]/foreign-tables.ts @@ -3,7 +3,7 @@ import { NextApiRequest, NextApiResponse } from 'next' import { getPgMetaRedirectUrl } from './tables' import { fetchGet } from '@/data/fetchers' import { constructHeaders } from '@/lib/api/apiHelpers' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler, { withAuth: true }) diff --git a/apps/studio/pages/api/platform/pg-meta/[ref]/materialized-views.ts b/apps/studio/pages/api/platform/pg-meta/[ref]/materialized-views.ts index edf2a26996e..16f7cc78367 100644 --- a/apps/studio/pages/api/platform/pg-meta/[ref]/materialized-views.ts +++ b/apps/studio/pages/api/platform/pg-meta/[ref]/materialized-views.ts @@ -3,7 +3,7 @@ import { NextApiRequest, NextApiResponse } from 'next' import { getPgMetaRedirectUrl } from './tables' import { fetchGet } from '@/data/fetchers' import { constructHeaders } from '@/lib/api/apiHelpers' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler, { withAuth: true }) diff --git a/apps/studio/pages/api/platform/pg-meta/[ref]/policies.ts b/apps/studio/pages/api/platform/pg-meta/[ref]/policies.ts index 80f6cd54b55..66b1b6a58d5 100644 --- a/apps/studio/pages/api/platform/pg-meta/[ref]/policies.ts +++ b/apps/studio/pages/api/platform/pg-meta/[ref]/policies.ts @@ -2,7 +2,7 @@ import { NextApiRequest, NextApiResponse } from 'next' import { fetchGet } from '@/data/fetchers' import { constructHeaders } from '@/lib/api/apiHelpers' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { PG_META_URL } from '@/lib/constants' export default (req: NextApiRequest, res: NextApiResponse) => diff --git a/apps/studio/pages/api/platform/pg-meta/[ref]/publications.ts b/apps/studio/pages/api/platform/pg-meta/[ref]/publications.ts index 0a527b6752a..1bac7e46fe8 100644 --- a/apps/studio/pages/api/platform/pg-meta/[ref]/publications.ts +++ b/apps/studio/pages/api/platform/pg-meta/[ref]/publications.ts @@ -2,7 +2,7 @@ import { NextApiRequest, NextApiResponse } from 'next' import { fetchGet } from '@/data/fetchers' import { constructHeaders } from '@/lib/api/apiHelpers' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { PG_META_URL } from '@/lib/constants' export default (req: NextApiRequest, res: NextApiResponse) => diff --git a/apps/studio/pages/api/platform/pg-meta/[ref]/query/index.ts b/apps/studio/pages/api/platform/pg-meta/[ref]/query/index.ts index 1a4df85bbd6..876abdb32e0 100644 --- a/apps/studio/pages/api/platform/pg-meta/[ref]/query/index.ts +++ b/apps/studio/pages/api/platform/pg-meta/[ref]/query/index.ts @@ -1,7 +1,7 @@ import { NextApiRequest, NextApiResponse } from 'next' import { constructHeaders } from '@/lib/api/apiHelpers' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { executeQuery } from '@/lib/api/self-hosted/query' import { PgMetaDatabaseError } from '@/lib/api/self-hosted/types' diff --git a/apps/studio/pages/api/platform/pg-meta/[ref]/tables.ts b/apps/studio/pages/api/platform/pg-meta/[ref]/tables.ts index f985726d16b..3ab17d27ed4 100644 --- a/apps/studio/pages/api/platform/pg-meta/[ref]/tables.ts +++ b/apps/studio/pages/api/platform/pg-meta/[ref]/tables.ts @@ -2,7 +2,7 @@ import { NextApiRequest, NextApiResponse } from 'next' import { fetchGet } from '@/data/fetchers' import { constructHeaders } from '@/lib/api/apiHelpers' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { PG_META_URL } from '@/lib/constants' export default (req: NextApiRequest, res: NextApiResponse) => diff --git a/apps/studio/pages/api/platform/pg-meta/[ref]/triggers.ts b/apps/studio/pages/api/platform/pg-meta/[ref]/triggers.ts index db34495f12a..2d5a186b64b 100644 --- a/apps/studio/pages/api/platform/pg-meta/[ref]/triggers.ts +++ b/apps/studio/pages/api/platform/pg-meta/[ref]/triggers.ts @@ -2,7 +2,7 @@ import { NextApiRequest, NextApiResponse } from 'next' import { fetchGet } from '@/data/fetchers' import { constructHeaders } from '@/lib/api/apiHelpers' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { PG_META_URL } from '@/lib/constants' export default (req: NextApiRequest, res: NextApiResponse) => diff --git a/apps/studio/pages/api/platform/pg-meta/[ref]/types.ts b/apps/studio/pages/api/platform/pg-meta/[ref]/types.ts index 5fe6f446137..bd96f926a6d 100644 --- a/apps/studio/pages/api/platform/pg-meta/[ref]/types.ts +++ b/apps/studio/pages/api/platform/pg-meta/[ref]/types.ts @@ -2,7 +2,7 @@ import { NextApiRequest, NextApiResponse } from 'next' import { fetchGet } from '@/data/fetchers' import { constructHeaders } from '@/lib/api/apiHelpers' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { PG_META_URL } from '@/lib/constants' export default (req: NextApiRequest, res: NextApiResponse) => diff --git a/apps/studio/pages/api/platform/pg-meta/[ref]/views.ts b/apps/studio/pages/api/platform/pg-meta/[ref]/views.ts index 7295c1a243a..f45b43c92ca 100644 --- a/apps/studio/pages/api/platform/pg-meta/[ref]/views.ts +++ b/apps/studio/pages/api/platform/pg-meta/[ref]/views.ts @@ -3,7 +3,7 @@ import { NextApiRequest, NextApiResponse } from 'next' import { getPgMetaRedirectUrl } from './tables' import { fetchGet } from '@/data/fetchers' import { constructHeaders } from '@/lib/api/apiHelpers' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler, { withAuth: true }) diff --git a/apps/studio/pages/api/platform/profile/index.ts b/apps/studio/pages/api/platform/profile/index.ts index ac2acec7e8e..3f99d8e4649 100644 --- a/apps/studio/pages/api/platform/profile/index.ts +++ b/apps/studio/pages/api/platform/profile/index.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { DEFAULT_PROJECT } from '@/lib/constants/api' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/projects/[ref]/analytics/endpoints/[name].ts b/apps/studio/pages/api/platform/projects/[ref]/analytics/endpoints/[name].ts index 8adc8b3359f..9e5fb626ec6 100644 --- a/apps/studio/pages/api/platform/projects/[ref]/analytics/endpoints/[name].ts +++ b/apps/studio/pages/api/platform/projects/[ref]/analytics/endpoints/[name].ts @@ -1,7 +1,7 @@ import assert from 'node:assert' import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { retrieveAnalyticsData } from '@/lib/api/self-hosted/logs' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/projects/[ref]/analytics/log-drains.ts b/apps/studio/pages/api/platform/projects/[ref]/analytics/log-drains.ts index 970191817f9..85ad0acd9eb 100644 --- a/apps/studio/pages/api/platform/projects/[ref]/analytics/log-drains.ts +++ b/apps/studio/pages/api/platform/projects/[ref]/analytics/log-drains.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { PROJECT_ANALYTICS_URL } from '@/lib/constants/api' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/projects/[ref]/analytics/log-drains/[uuid].ts b/apps/studio/pages/api/platform/projects/[ref]/analytics/log-drains/[uuid].ts index e2c8a7424af..8896838e49b 100644 --- a/apps/studio/pages/api/platform/projects/[ref]/analytics/log-drains/[uuid].ts +++ b/apps/studio/pages/api/platform/projects/[ref]/analytics/log-drains/[uuid].ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { PROJECT_ANALYTICS_URL } from '@/lib/constants/api' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/projects/[ref]/api-keys/temporary.ts b/apps/studio/pages/api/platform/projects/[ref]/api-keys/temporary.ts index 134226b2806..11b5d7c3f64 100644 --- a/apps/studio/pages/api/platform/projects/[ref]/api-keys/temporary.ts +++ b/apps/studio/pages/api/platform/projects/[ref]/api-keys/temporary.ts @@ -1,7 +1,7 @@ import { components } from 'api-types' import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' type ProjectAppConfig = components['schemas']['ProjectSettingsResponse']['app_config'] & { protocol?: string diff --git a/apps/studio/pages/api/platform/projects/[ref]/api/graphql.ts b/apps/studio/pages/api/platform/projects/[ref]/api/graphql.ts index bf333896e5c..4ab77b5ee72 100644 --- a/apps/studio/pages/api/platform/projects/[ref]/api/graphql.ts +++ b/apps/studio/pages/api/platform/projects/[ref]/api/graphql.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/projects/[ref]/api/rest.ts b/apps/studio/pages/api/platform/projects/[ref]/api/rest.ts index 662f7cf4ec3..fec8d8838f0 100644 --- a/apps/studio/pages/api/platform/projects/[ref]/api/rest.ts +++ b/apps/studio/pages/api/platform/projects/[ref]/api/rest.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/projects/[ref]/billing/addons.ts b/apps/studio/pages/api/platform/projects/[ref]/billing/addons.ts index e054c9cc3f5..4d10b2ebb11 100644 --- a/apps/studio/pages/api/platform/projects/[ref]/billing/addons.ts +++ b/apps/studio/pages/api/platform/projects/[ref]/billing/addons.ts @@ -1,7 +1,7 @@ import { paths } from 'api-types' import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/projects/[ref]/config/index.ts b/apps/studio/pages/api/platform/projects/[ref]/config/index.ts index aa20df2c678..be30b3b11b7 100644 --- a/apps/studio/pages/api/platform/projects/[ref]/config/index.ts +++ b/apps/studio/pages/api/platform/projects/[ref]/config/index.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/projects/[ref]/config/postgrest.ts b/apps/studio/pages/api/platform/projects/[ref]/config/postgrest.ts index b8514526b91..8c95bc36e35 100644 --- a/apps/studio/pages/api/platform/projects/[ref]/config/postgrest.ts +++ b/apps/studio/pages/api/platform/projects/[ref]/config/postgrest.ts @@ -1,7 +1,7 @@ import { components } from 'api-types' import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { DEFAULT_EXPOSED_SCHEMAS } from '@/lib/api/self-hosted/constants' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/projects/[ref]/config/secrets/update-status.ts b/apps/studio/pages/api/platform/projects/[ref]/config/secrets/update-status.ts index 77fa4ea4044..de6082badcf 100644 --- a/apps/studio/pages/api/platform/projects/[ref]/config/secrets/update-status.ts +++ b/apps/studio/pages/api/platform/projects/[ref]/config/secrets/update-status.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' export default function updateStatus(req: NextApiRequest, res: NextApiResponse) { return apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/projects/[ref]/content/count.ts b/apps/studio/pages/api/platform/projects/[ref]/content/count.ts index dc3c09f68a0..e9832690647 100644 --- a/apps/studio/pages/api/platform/projects/[ref]/content/count.ts +++ b/apps/studio/pages/api/platform/projects/[ref]/content/count.ts @@ -1,7 +1,7 @@ import { paths } from 'api-types' import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { getSnippets } from '@/lib/api/snippets.utils' const wrappedHandler = (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/projects/[ref]/content/folders/[id].ts b/apps/studio/pages/api/platform/projects/[ref]/content/folders/[id].ts index ac599cef62b..4707d568515 100644 --- a/apps/studio/pages/api/platform/projects/[ref]/content/folders/[id].ts +++ b/apps/studio/pages/api/platform/projects/[ref]/content/folders/[id].ts @@ -1,7 +1,7 @@ import { paths } from 'api-types' import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { getFolders, getSnippets } from '@/lib/api/snippets.utils' const wrappedHandler = (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/projects/[ref]/content/folders/index.ts b/apps/studio/pages/api/platform/projects/[ref]/content/folders/index.ts index be8f426d3e0..18e2c24177b 100644 --- a/apps/studio/pages/api/platform/projects/[ref]/content/folders/index.ts +++ b/apps/studio/pages/api/platform/projects/[ref]/content/folders/index.ts @@ -1,7 +1,7 @@ import { paths } from 'api-types' import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { createFolder, deleteFolder, getFolders, getSnippets } from '@/lib/api/snippets.utils' const wrappedHandler = (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/projects/[ref]/content/index.ts b/apps/studio/pages/api/platform/projects/[ref]/content/index.ts index bf700e882f0..9d4530f98a1 100644 --- a/apps/studio/pages/api/platform/projects/[ref]/content/index.ts +++ b/apps/studio/pages/api/platform/projects/[ref]/content/index.ts @@ -3,7 +3,7 @@ import { compact } from 'lodash' import { NextApiRequest, NextApiResponse } from 'next' import { z } from 'zod' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { deleteSnippet, getSnippets, diff --git a/apps/studio/pages/api/platform/projects/[ref]/content/item/[id].ts b/apps/studio/pages/api/platform/projects/[ref]/content/item/[id].ts index 388a9578662..5adcd07f300 100644 --- a/apps/studio/pages/api/platform/projects/[ref]/content/item/[id].ts +++ b/apps/studio/pages/api/platform/projects/[ref]/content/item/[id].ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { getSnippet } from '@/lib/api/snippets.utils' const wrappedHandler = (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/projects/[ref]/databases.ts b/apps/studio/pages/api/platform/projects/[ref]/databases.ts index 4a932fe9f30..ec39409b6dc 100644 --- a/apps/studio/pages/api/platform/projects/[ref]/databases.ts +++ b/apps/studio/pages/api/platform/projects/[ref]/databases.ts @@ -1,7 +1,7 @@ import { paths } from 'api-types' import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { POSTGRES_PORT } from '@/lib/api/self-hosted/constants' import { PROJECT_DB_HOST, PROJECT_REST_URL } from '@/lib/constants/api' diff --git a/apps/studio/pages/api/platform/projects/[ref]/index.ts b/apps/studio/pages/api/platform/projects/[ref]/index.ts index ccfac100752..15731dbd680 100644 --- a/apps/studio/pages/api/platform/projects/[ref]/index.ts +++ b/apps/studio/pages/api/platform/projects/[ref]/index.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { DEFAULT_PROJECT, PROJECT_REST_URL } from '@/lib/constants/api' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/projects/[ref]/infra-monitoring.ts b/apps/studio/pages/api/platform/projects/[ref]/infra-monitoring.ts index e1cc4c1a31d..66e57cf3a85 100644 --- a/apps/studio/pages/api/platform/projects/[ref]/infra-monitoring.ts +++ b/apps/studio/pages/api/platform/projects/[ref]/infra-monitoring.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/projects/[ref]/run-lints.ts b/apps/studio/pages/api/platform/projects/[ref]/run-lints.ts index 1ced5a45457..041fe1ce10b 100644 --- a/apps/studio/pages/api/platform/projects/[ref]/run-lints.ts +++ b/apps/studio/pages/api/platform/projects/[ref]/run-lints.ts @@ -1,7 +1,7 @@ import { NextApiRequest, NextApiResponse } from 'next' import { constructHeaders } from '@/lib/api/apiHelpers' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { DEFAULT_EXPOSED_SCHEMAS } from '@/lib/api/self-hosted/constants' import { getLints } from '@/lib/api/self-hosted/lints' diff --git a/apps/studio/pages/api/platform/projects/[ref]/settings.ts b/apps/studio/pages/api/platform/projects/[ref]/settings.ts index 3d7da804559..d57678dd1a3 100644 --- a/apps/studio/pages/api/platform/projects/[ref]/settings.ts +++ b/apps/studio/pages/api/platform/projects/[ref]/settings.ts @@ -1,7 +1,7 @@ import { components } from 'api-types' import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { getProjectSettings } from '@/lib/api/self-hosted/settings' type ProjectAppConfig = components['schemas']['ProjectSettingsResponse']['app_config'] & { diff --git a/apps/studio/pages/api/platform/projects/index.ts b/apps/studio/pages/api/platform/projects/index.ts index f426cdab804..d2ea564789a 100644 --- a/apps/studio/pages/api/platform/projects/index.ts +++ b/apps/studio/pages/api/platform/projects/index.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { DEFAULT_PROJECT } from '@/lib/constants/api' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/props/org/[slug].tsx b/apps/studio/pages/api/platform/props/org/[slug].tsx index 5f6c214eb59..eb38e9e34dd 100644 --- a/apps/studio/pages/api/platform/props/org/[slug].tsx +++ b/apps/studio/pages/api/platform/props/org/[slug].tsx @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/props/project/[ref]/api.ts b/apps/studio/pages/api/platform/props/project/[ref]/api.ts index eed87d7ddc6..37fa1901301 100644 --- a/apps/studio/pages/api/platform/props/project/[ref]/api.ts +++ b/apps/studio/pages/api/platform/props/project/[ref]/api.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { POSTGRES_PORT } from '@/lib/api/self-hosted/constants' import { DEFAULT_PROJECT, diff --git a/apps/studio/pages/api/platform/props/project/[ref]/index.ts b/apps/studio/pages/api/platform/props/project/[ref]/index.ts index fd60280a161..9e71eb3987f 100644 --- a/apps/studio/pages/api/platform/props/project/[ref]/index.ts +++ b/apps/studio/pages/api/platform/props/project/[ref]/index.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { DEFAULT_PROJECT } from '@/lib/constants/api' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/empty.ts b/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/empty.ts index 1d6987f90ce..8bb75c87066 100644 --- a/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/empty.ts +++ b/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/empty.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { selfHostedSupabaseAdmin as supabase } from '@/lib/api/self-hosted-admin' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/index.ts b/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/index.ts index f986a0570d2..a7ba289cc9a 100644 --- a/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/index.ts +++ b/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/index.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { selfHostedSupabaseAdmin as supabase } from '@/lib/api/self-hosted-admin' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/objects/download.ts b/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/objects/download.ts index 6edfca45816..5b316fd3daf 100644 --- a/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/objects/download.ts +++ b/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/objects/download.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { selfHostedSupabaseAdmin as supabase } from '@/lib/api/self-hosted-admin' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/objects/index.ts b/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/objects/index.ts index 861d0e2f8a0..2eabc6d1b35 100644 --- a/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/objects/index.ts +++ b/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/objects/index.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { selfHostedSupabaseAdmin as supabase } from '@/lib/api/self-hosted-admin' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/objects/list.ts b/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/objects/list.ts index d9e76d9fa2b..fbdb995b29c 100644 --- a/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/objects/list.ts +++ b/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/objects/list.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { selfHostedSupabaseAdmin as supabase } from '@/lib/api/self-hosted-admin' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/objects/move.ts b/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/objects/move.ts index 9978c8b17cf..50dfe1b62f1 100644 --- a/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/objects/move.ts +++ b/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/objects/move.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { selfHostedSupabaseAdmin as supabase } from '@/lib/api/self-hosted-admin' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/objects/public-url.ts b/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/objects/public-url.ts index 886d19886d7..3d402b64c71 100644 --- a/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/objects/public-url.ts +++ b/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/objects/public-url.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { selfHostedSupabaseAdmin as supabase } from '@/lib/api/self-hosted-admin' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/objects/sign-multi.ts b/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/objects/sign-multi.ts index 472f20c2e5e..4b28ae603d3 100644 --- a/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/objects/sign-multi.ts +++ b/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/objects/sign-multi.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { selfHostedSupabaseAdmin as supabase } from '@/lib/api/self-hosted-admin' const wrappedHandler = (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/objects/sign.ts b/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/objects/sign.ts index f077d8201c8..42d7644001d 100644 --- a/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/objects/sign.ts +++ b/apps/studio/pages/api/platform/storage/[ref]/buckets/[id]/objects/sign.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { selfHostedSupabaseAdmin as supabase } from '@/lib/api/self-hosted-admin' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/storage/[ref]/buckets/index.ts b/apps/studio/pages/api/platform/storage/[ref]/buckets/index.ts index 45d11d1895e..eee30b93f24 100644 --- a/apps/studio/pages/api/platform/storage/[ref]/buckets/index.ts +++ b/apps/studio/pages/api/platform/storage/[ref]/buckets/index.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { selfHostedSupabaseAdmin as supabase } from '@/lib/api/self-hosted-admin' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/platform/storage/[ref]/vector-buckets/[id]/index.ts b/apps/studio/pages/api/platform/storage/[ref]/vector-buckets/[id]/index.ts index b9b0f56cb84..71d16f6a643 100644 --- a/apps/studio/pages/api/platform/storage/[ref]/vector-buckets/[id]/index.ts +++ b/apps/studio/pages/api/platform/storage/[ref]/vector-buckets/[id]/index.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { selfHostedSupabaseAdmin as supabase } from '@/lib/api/self-hosted-admin' // eslint-disable-next-line import/no-anonymous-default-export diff --git a/apps/studio/pages/api/platform/storage/[ref]/vector-buckets/[id]/indexes/[indexName].ts b/apps/studio/pages/api/platform/storage/[ref]/vector-buckets/[id]/indexes/[indexName].ts index a34c6f86c9d..6bfd43baab7 100644 --- a/apps/studio/pages/api/platform/storage/[ref]/vector-buckets/[id]/indexes/[indexName].ts +++ b/apps/studio/pages/api/platform/storage/[ref]/vector-buckets/[id]/indexes/[indexName].ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { selfHostedSupabaseAdmin as supabase } from '@/lib/api/self-hosted-admin' // eslint-disable-next-line import/no-anonymous-default-export diff --git a/apps/studio/pages/api/platform/storage/[ref]/vector-buckets/[id]/indexes/index.ts b/apps/studio/pages/api/platform/storage/[ref]/vector-buckets/[id]/indexes/index.ts index cc3d5e071da..e040a0b783a 100644 --- a/apps/studio/pages/api/platform/storage/[ref]/vector-buckets/[id]/indexes/index.ts +++ b/apps/studio/pages/api/platform/storage/[ref]/vector-buckets/[id]/indexes/index.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { selfHostedSupabaseAdmin as supabase } from '@/lib/api/self-hosted-admin' // eslint-disable-next-line import/no-anonymous-default-export diff --git a/apps/studio/pages/api/platform/storage/[ref]/vector-buckets/index.ts b/apps/studio/pages/api/platform/storage/[ref]/vector-buckets/index.ts index 9aea341ef1d..5f26ffa93f2 100644 --- a/apps/studio/pages/api/platform/storage/[ref]/vector-buckets/index.ts +++ b/apps/studio/pages/api/platform/storage/[ref]/vector-buckets/index.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { selfHostedSupabaseAdmin as supabase } from '@/lib/api/self-hosted-admin' // eslint-disable-next-line import/no-anonymous-default-export diff --git a/apps/studio/pages/api/platform/telemetry/event.ts b/apps/studio/pages/api/platform/telemetry/event.ts index ec1e56dde13..057279a8671 100644 --- a/apps/studio/pages/api/platform/telemetry/event.ts +++ b/apps/studio/pages/api/platform/telemetry/event.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/v1/projects/[ref]/api-keys.ts b/apps/studio/pages/api/v1/projects/[ref]/api-keys.ts index 2b7878f12ba..8d1511ea9fb 100644 --- a/apps/studio/pages/api/v1/projects/[ref]/api-keys.ts +++ b/apps/studio/pages/api/v1/projects/[ref]/api-keys.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { applyRevealToApiKey, getNonPlatformApiKeys, diff --git a/apps/studio/pages/api/v1/projects/[ref]/api-keys/[id].ts b/apps/studio/pages/api/v1/projects/[ref]/api-keys/[id].ts index 650e58098fb..6b7185ea01a 100644 --- a/apps/studio/pages/api/v1/projects/[ref]/api-keys/[id].ts +++ b/apps/studio/pages/api/v1/projects/[ref]/api-keys/[id].ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { getNonPlatformApiKeyById, parseRevealQuery } from '@/lib/api/self-hosted/api-keys' const apiKeyByIdRoute = (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler) diff --git a/apps/studio/pages/api/v1/projects/[ref]/config/auth/signing-keys/index.ts b/apps/studio/pages/api/v1/projects/[ref]/config/auth/signing-keys/index.ts index db5119e24a7..546c8a627e3 100644 --- a/apps/studio/pages/api/v1/projects/[ref]/config/auth/signing-keys/index.ts +++ b/apps/studio/pages/api/v1/projects/[ref]/config/auth/signing-keys/index.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { getLegacySigningKey } from '@/lib/api/self-hosted/signing-keys' export default function signingKeys(req: NextApiRequest, res: NextApiResponse) { diff --git a/apps/studio/pages/api/v1/projects/[ref]/config/auth/signing-keys/legacy.ts b/apps/studio/pages/api/v1/projects/[ref]/config/auth/signing-keys/legacy.ts index e518e2bffe7..be5c0a593f7 100644 --- a/apps/studio/pages/api/v1/projects/[ref]/config/auth/signing-keys/legacy.ts +++ b/apps/studio/pages/api/v1/projects/[ref]/config/auth/signing-keys/legacy.ts @@ -1,6 +1,6 @@ import { NextApiRequest, NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { getLegacySigningKey } from '@/lib/api/self-hosted/signing-keys' export default function legacySigningKey(req: NextApiRequest, res: NextApiResponse) { diff --git a/apps/studio/pages/api/v1/projects/[ref]/database/migrations.ts b/apps/studio/pages/api/v1/projects/[ref]/database/migrations.ts index b35eb39c161..1f545c4aa19 100644 --- a/apps/studio/pages/api/v1/projects/[ref]/database/migrations.ts +++ b/apps/studio/pages/api/v1/projects/[ref]/database/migrations.ts @@ -1,7 +1,7 @@ import { NextApiRequest, NextApiResponse } from 'next' import { constructHeaders } from '@/lib/api/apiHelpers' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { applyAndTrackMigrations, listMigrationVersions } from '@/lib/api/self-hosted/migrations' import { PgMetaDatabaseError } from '@/lib/api/self-hosted/types' diff --git a/apps/studio/pages/api/v1/projects/[ref]/functions/[slug]/body.ts b/apps/studio/pages/api/v1/projects/[ref]/functions/[slug]/body.ts index 0ffb91ed316..730f20423fe 100644 --- a/apps/studio/pages/api/v1/projects/[ref]/functions/[slug]/body.ts +++ b/apps/studio/pages/api/v1/projects/[ref]/functions/[slug]/body.ts @@ -2,7 +2,7 @@ import { createReadStream } from 'node:fs' import { pipeline } from 'node:stream/promises' import { type NextApiRequest, type NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { getFunctionsArtifactStore } from '@/lib/api/self-hosted/functions' import { uuidv4 } from '@/lib/helpers' diff --git a/apps/studio/pages/api/v1/projects/[ref]/functions/[slug]/index.ts b/apps/studio/pages/api/v1/projects/[ref]/functions/[slug]/index.ts index 82466601ae2..bda25f00d92 100644 --- a/apps/studio/pages/api/v1/projects/[ref]/functions/[slug]/index.ts +++ b/apps/studio/pages/api/v1/projects/[ref]/functions/[slug]/index.ts @@ -1,7 +1,7 @@ import type { components } from 'api-types' import { type NextApiRequest, type NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { getFunctionsArtifactStore } from '@/lib/api/self-hosted/functions' import { uuidv4 } from '@/lib/helpers' diff --git a/apps/studio/pages/api/v1/projects/[ref]/functions/index.ts b/apps/studio/pages/api/v1/projects/[ref]/functions/index.ts index db0b14c0069..f2c1757ad78 100644 --- a/apps/studio/pages/api/v1/projects/[ref]/functions/index.ts +++ b/apps/studio/pages/api/v1/projects/[ref]/functions/index.ts @@ -1,7 +1,7 @@ import type { components } from 'api-types' import { type NextApiRequest, type NextApiResponse } from 'next' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { getFunctionsArtifactStore } from '@/lib/api/self-hosted/functions' import { uuidv4 } from '@/lib/helpers' diff --git a/apps/studio/pages/api/v1/projects/[ref]/types/typescript.ts b/apps/studio/pages/api/v1/projects/[ref]/types/typescript.ts index c0f684f4efd..cf1defc2f10 100644 --- a/apps/studio/pages/api/v1/projects/[ref]/types/typescript.ts +++ b/apps/studio/pages/api/v1/projects/[ref]/types/typescript.ts @@ -1,7 +1,7 @@ import { NextApiRequest, NextApiResponse } from 'next' import { constructHeaders } from '@/lib/api/apiHelpers' -import apiWrapper from '@/lib/api/apiWrapper' +import { apiWrapper } from '@/lib/api/apiWrapper' import { generateTypescriptTypes } from '@/lib/api/self-hosted/generate-types' import { ResponseError } from '@/types'