@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.
- package/README.md +5 -2
- package/dist/adapters/hono/index.cjs +1 -1
- package/dist/adapters/hono/index.d.cts +1 -1
- package/dist/adapters/hono/index.d.mts +1 -1
- package/dist/adapters/hono/index.mjs +1 -1
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.d.cts +12 -18
- package/dist/core/index.d.mts +12 -18
- package/dist/core/index.mjs +1 -1
- package/dist/{create-supabase-context-CmWaH3s6.mjs → create-supabase-context-Bmwyha9p.mjs} +18 -7
- package/dist/{create-supabase-context-DcVorGKG.cjs → create-supabase-context-DDIAxA8h.cjs} +18 -7
- package/dist/errors-CAH-RRA3.d.mts +109 -0
- package/dist/errors-O2ugIMec.d.cts +109 -0
- package/dist/index.cjs +13 -3
- package/dist/index.d.cts +4 -4
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +4 -4
- package/dist/{types-ClmJ8pi8.d.mts → types-BmWSIuH7.d.mts} +46 -2
- package/dist/{types-CnKoFCMX.d.cts → types-X7xYi2LN.d.cts} +46 -2
- package/dist/{verify-auth-2S7zFfR-.mjs → verify-auth-Bt2uGltH.mjs} +98 -33
- package/dist/{verify-auth-DvRVnjdq.cjs → verify-auth-DrgvEuKo.cjs} +157 -32
- package/package.json +1 -1
- package/dist/errors-5ivL23qo.d.mts +0 -78
- package/dist/errors-BmSsOAvx.d.cts +0 -78
|
@@ -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 };
|