@supabase/server 0.1.1-rc.26 → 0.1.1-rc.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,78 +0,0 @@
1
- //#region src/errors.d.ts
2
- /**
3
- * Thrown when a required environment variable is missing or malformed.
4
- *
5
- * Has a fixed `status` of `500` since environment errors are server-side
6
- * configuration issues, not client errors.
7
- *
8
- * @example
9
- * ```ts
10
- * import { EnvError } from '@supabase/server'
11
- *
12
- * try {
13
- * const client = createAdminClient()
14
- * } catch (e) {
15
- * if (e instanceof EnvError) {
16
- * console.error(`Config issue [${e.code}]: ${e.message}`)
17
- * // → "Config issue [MISSING_SUPABASE_URL]: SUPABASE_URL is required but not set"
18
- * }
19
- * }
20
- * ```
21
- */
22
- declare class EnvError extends Error {
23
- /** Always `500` — environment errors are server-side issues. */
24
- readonly status = 500;
25
- /**
26
- * Machine-readable error code.
27
- *
28
- * Known codes:
29
- * - `"MISSING_SUPABASE_URL"` — `SUPABASE_URL` not set
30
- * - `"MISSING_PUBLISHABLE_KEY"` — No publishable key found
31
- * - `"MISSING_SECRET_KEY"` — No secret key found
32
- * - `"ENV_ERROR"` — Generic environment error
33
- */
34
- readonly code: string;
35
- constructor(message: string, code?: string);
36
- }
37
- /**
38
- * Thrown when authentication or authorization fails.
39
- *
40
- * Carries an HTTP `status` code suitable for returning directly in a response
41
- * (typically `401` for invalid credentials, `500` for server-side auth failures).
42
- *
43
- * @example
44
- * ```ts
45
- * import { AuthError, createSupabaseContext } from '@supabase/server'
46
- *
47
- * const { data: ctx, error } = await createSupabaseContext(request, { allow: 'user' })
48
- * if (error) {
49
- * // error is an AuthError
50
- * return Response.json(
51
- * { error: error.message, code: error.code },
52
- * { status: error.status },
53
- * )
54
- * }
55
- * ```
56
- */
57
- declare class AuthError extends Error {
58
- /**
59
- * HTTP status code.
60
- *
61
- * - `401` — Invalid or missing credentials
62
- * - `500` — Server-side auth failure (e.g., missing JWKS, env misconfiguration)
63
- */
64
- readonly status: number;
65
- /**
66
- * Machine-readable error code.
67
- *
68
- * Known codes:
69
- * - `"INVALID_CREDENTIALS"` — No credential matched any allowed auth mode
70
- * - `"CLIENT_ERROR"` — Failed to create a Supabase client after auth succeeded
71
- * - `"AUTH_ERROR"` — Generic authentication error
72
- * - Any `EnvError` code (propagated when env resolution fails during auth)
73
- */
74
- readonly code: string;
75
- constructor(message: string, code?: string, status?: number);
76
- }
77
- //#endregion
78
- export { EnvError as n, AuthError as t };
@@ -1,78 +0,0 @@
1
- //#region src/errors.d.ts
2
- /**
3
- * Thrown when a required environment variable is missing or malformed.
4
- *
5
- * Has a fixed `status` of `500` since environment errors are server-side
6
- * configuration issues, not client errors.
7
- *
8
- * @example
9
- * ```ts
10
- * import { EnvError } from '@supabase/server'
11
- *
12
- * try {
13
- * const client = createAdminClient()
14
- * } catch (e) {
15
- * if (e instanceof EnvError) {
16
- * console.error(`Config issue [${e.code}]: ${e.message}`)
17
- * // → "Config issue [MISSING_SUPABASE_URL]: SUPABASE_URL is required but not set"
18
- * }
19
- * }
20
- * ```
21
- */
22
- declare class EnvError extends Error {
23
- /** Always `500` — environment errors are server-side issues. */
24
- readonly status = 500;
25
- /**
26
- * Machine-readable error code.
27
- *
28
- * Known codes:
29
- * - `"MISSING_SUPABASE_URL"` — `SUPABASE_URL` not set
30
- * - `"MISSING_PUBLISHABLE_KEY"` — No publishable key found
31
- * - `"MISSING_SECRET_KEY"` — No secret key found
32
- * - `"ENV_ERROR"` — Generic environment error
33
- */
34
- readonly code: string;
35
- constructor(message: string, code?: string);
36
- }
37
- /**
38
- * Thrown when authentication or authorization fails.
39
- *
40
- * Carries an HTTP `status` code suitable for returning directly in a response
41
- * (typically `401` for invalid credentials, `500` for server-side auth failures).
42
- *
43
- * @example
44
- * ```ts
45
- * import { AuthError, createSupabaseContext } from '@supabase/server'
46
- *
47
- * const { data: ctx, error } = await createSupabaseContext(request, { allow: 'user' })
48
- * if (error) {
49
- * // error is an AuthError
50
- * return Response.json(
51
- * { error: error.message, code: error.code },
52
- * { status: error.status },
53
- * )
54
- * }
55
- * ```
56
- */
57
- declare class AuthError extends Error {
58
- /**
59
- * HTTP status code.
60
- *
61
- * - `401` — Invalid or missing credentials
62
- * - `500` — Server-side auth failure (e.g., missing JWKS, env misconfiguration)
63
- */
64
- readonly status: number;
65
- /**
66
- * Machine-readable error code.
67
- *
68
- * Known codes:
69
- * - `"INVALID_CREDENTIALS"` — No credential matched any allowed auth mode
70
- * - `"CLIENT_ERROR"` — Failed to create a Supabase client after auth succeeded
71
- * - `"AUTH_ERROR"` — Generic authentication error
72
- * - Any `EnvError` code (propagated when env resolution fails during auth)
73
- */
74
- readonly code: string;
75
- constructor(message: string, code?: string, status?: number);
76
- }
77
- //#endregion
78
- export { EnvError as n, AuthError as t };