@supabase/auth-js 2.81.1 → 2.81.2-canary.1
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/dist/main/GoTrueAdminApi.d.ts +13 -0
- package/dist/main/GoTrueAdminApi.d.ts.map +1 -1
- package/dist/main/GoTrueAdminApi.js +13 -0
- package/dist/main/GoTrueAdminApi.js.map +1 -1
- package/dist/main/GoTrueClient.d.ts +11 -0
- package/dist/main/GoTrueClient.d.ts.map +1 -1
- package/dist/main/GoTrueClient.js +11 -0
- package/dist/main/GoTrueClient.js.map +1 -1
- package/dist/main/lib/errors.d.ts +127 -0
- package/dist/main/lib/errors.d.ts.map +1 -1
- package/dist/main/lib/errors.js +127 -0
- package/dist/main/lib/errors.js.map +1 -1
- package/dist/main/lib/locks.d.ts +43 -0
- package/dist/main/lib/locks.d.ts.map +1 -1
- package/dist/main/lib/locks.js +43 -0
- package/dist/main/lib/locks.js.map +1 -1
- package/dist/main/lib/version.d.ts +1 -1
- package/dist/main/lib/version.d.ts.map +1 -1
- package/dist/main/lib/version.js +1 -1
- package/dist/main/lib/version.js.map +1 -1
- package/dist/module/GoTrueAdminApi.d.ts +13 -0
- package/dist/module/GoTrueAdminApi.d.ts.map +1 -1
- package/dist/module/GoTrueAdminApi.js +13 -0
- package/dist/module/GoTrueAdminApi.js.map +1 -1
- package/dist/module/GoTrueClient.d.ts +11 -0
- package/dist/module/GoTrueClient.d.ts.map +1 -1
- package/dist/module/GoTrueClient.js +11 -0
- package/dist/module/GoTrueClient.js.map +1 -1
- package/dist/module/lib/errors.d.ts +127 -0
- package/dist/module/lib/errors.d.ts.map +1 -1
- package/dist/module/lib/errors.js +127 -0
- package/dist/module/lib/errors.js.map +1 -1
- package/dist/module/lib/locks.d.ts +43 -0
- package/dist/module/lib/locks.d.ts.map +1 -1
- package/dist/module/lib/locks.js +43 -0
- package/dist/module/lib/locks.js.map +1 -1
- package/dist/module/lib/version.d.ts +1 -1
- package/dist/module/lib/version.d.ts.map +1 -1
- package/dist/module/lib/version.js +1 -1
- package/dist/module/lib/version.js.map +1 -1
- package/dist/tsconfig.module.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/GoTrueAdminApi.ts +13 -0
- package/src/GoTrueClient.ts +11 -0
- package/src/lib/errors.ts +127 -0
- package/src/lib/locks.ts +43 -0
- package/src/lib/version.ts +1 -1
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { WeakPasswordReasons } from './types';
|
|
2
2
|
import { ErrorCode } from './error-codes';
|
|
3
|
+
/**
|
|
4
|
+
* Base error thrown by Supabase Auth helpers.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { AuthError } from '@supabase/auth-js'
|
|
9
|
+
*
|
|
10
|
+
* throw new AuthError('Unexpected auth error', 500, 'unexpected')
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
3
13
|
export declare class AuthError extends Error {
|
|
4
14
|
/**
|
|
5
15
|
* Error code associated with the error. Most errors coming from
|
|
@@ -14,30 +24,107 @@ export declare class AuthError extends Error {
|
|
|
14
24
|
constructor(message: string, status?: number, code?: string);
|
|
15
25
|
}
|
|
16
26
|
export declare function isAuthError(error: unknown): error is AuthError;
|
|
27
|
+
/**
|
|
28
|
+
* Error returned directly from the GoTrue REST API.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* import { AuthApiError } from '@supabase/auth-js'
|
|
33
|
+
*
|
|
34
|
+
* throw new AuthApiError('Invalid credentials', 400, 'invalid_credentials')
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
17
37
|
export declare class AuthApiError extends AuthError {
|
|
18
38
|
status: number;
|
|
19
39
|
constructor(message: string, status: number, code: string | undefined);
|
|
20
40
|
}
|
|
21
41
|
export declare function isAuthApiError(error: unknown): error is AuthApiError;
|
|
42
|
+
/**
|
|
43
|
+
* Wraps non-standard errors so callers can inspect the root cause.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* import { AuthUnknownError } from '@supabase/auth-js'
|
|
48
|
+
*
|
|
49
|
+
* try {
|
|
50
|
+
* await someAuthCall()
|
|
51
|
+
* } catch (err) {
|
|
52
|
+
* throw new AuthUnknownError('Auth failed', err)
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
22
56
|
export declare class AuthUnknownError extends AuthError {
|
|
23
57
|
originalError: unknown;
|
|
24
58
|
constructor(message: string, originalError: unknown);
|
|
25
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Flexible error class used to create named auth errors at runtime.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* import { CustomAuthError } from '@supabase/auth-js'
|
|
66
|
+
*
|
|
67
|
+
* throw new CustomAuthError('My custom auth error', 'MyAuthError', 400, 'custom_code')
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
26
70
|
export declare class CustomAuthError extends AuthError {
|
|
27
71
|
name: string;
|
|
28
72
|
status: number;
|
|
29
73
|
constructor(message: string, name: string, status: number, code: string | undefined);
|
|
30
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Error thrown when an operation requires a session but none is present.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* import { AuthSessionMissingError } from '@supabase/auth-js'
|
|
81
|
+
*
|
|
82
|
+
* throw new AuthSessionMissingError()
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
31
85
|
export declare class AuthSessionMissingError extends CustomAuthError {
|
|
32
86
|
constructor();
|
|
33
87
|
}
|
|
34
88
|
export declare function isAuthSessionMissingError(error: any): error is AuthSessionMissingError;
|
|
89
|
+
/**
|
|
90
|
+
* Error thrown when the token response is malformed.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```ts
|
|
94
|
+
* import { AuthInvalidTokenResponseError } from '@supabase/auth-js'
|
|
95
|
+
*
|
|
96
|
+
* throw new AuthInvalidTokenResponseError()
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
35
99
|
export declare class AuthInvalidTokenResponseError extends CustomAuthError {
|
|
36
100
|
constructor();
|
|
37
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* Error thrown when email/password credentials are invalid.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```ts
|
|
107
|
+
* import { AuthInvalidCredentialsError } from '@supabase/auth-js'
|
|
108
|
+
*
|
|
109
|
+
* throw new AuthInvalidCredentialsError('Email or password is incorrect')
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
38
112
|
export declare class AuthInvalidCredentialsError extends CustomAuthError {
|
|
39
113
|
constructor(message: string);
|
|
40
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* Error thrown when implicit grant redirects contain an error.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```ts
|
|
120
|
+
* import { AuthImplicitGrantRedirectError } from '@supabase/auth-js'
|
|
121
|
+
*
|
|
122
|
+
* throw new AuthImplicitGrantRedirectError('OAuth redirect failed', {
|
|
123
|
+
* error: 'access_denied',
|
|
124
|
+
* code: 'oauth_error',
|
|
125
|
+
* })
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
41
128
|
export declare class AuthImplicitGrantRedirectError extends CustomAuthError {
|
|
42
129
|
details: {
|
|
43
130
|
error: string;
|
|
@@ -58,6 +145,16 @@ export declare class AuthImplicitGrantRedirectError extends CustomAuthError {
|
|
|
58
145
|
};
|
|
59
146
|
}
|
|
60
147
|
export declare function isAuthImplicitGrantRedirectError(error: any): error is AuthImplicitGrantRedirectError;
|
|
148
|
+
/**
|
|
149
|
+
* Error thrown during PKCE code exchanges.
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```ts
|
|
153
|
+
* import { AuthPKCEGrantCodeExchangeError } from '@supabase/auth-js'
|
|
154
|
+
*
|
|
155
|
+
* throw new AuthPKCEGrantCodeExchangeError('PKCE exchange failed')
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
61
158
|
export declare class AuthPKCEGrantCodeExchangeError extends CustomAuthError {
|
|
62
159
|
details: {
|
|
63
160
|
error: string;
|
|
@@ -77,6 +174,16 @@ export declare class AuthPKCEGrantCodeExchangeError extends CustomAuthError {
|
|
|
77
174
|
} | null;
|
|
78
175
|
};
|
|
79
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* Error thrown when a transient fetch issue occurs.
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* ```ts
|
|
182
|
+
* import { AuthRetryableFetchError } from '@supabase/auth-js'
|
|
183
|
+
*
|
|
184
|
+
* throw new AuthRetryableFetchError('Service temporarily unavailable', 503)
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
80
187
|
export declare class AuthRetryableFetchError extends CustomAuthError {
|
|
81
188
|
constructor(message: string, status: number);
|
|
82
189
|
}
|
|
@@ -86,6 +193,16 @@ export declare function isAuthRetryableFetchError(error: unknown): error is Auth
|
|
|
86
193
|
* weak. Inspect the reasons to identify what password strength rules are
|
|
87
194
|
* inadequate.
|
|
88
195
|
*/
|
|
196
|
+
/**
|
|
197
|
+
* Error thrown when a supplied password is considered weak.
|
|
198
|
+
*
|
|
199
|
+
* @example
|
|
200
|
+
* ```ts
|
|
201
|
+
* import { AuthWeakPasswordError } from '@supabase/auth-js'
|
|
202
|
+
*
|
|
203
|
+
* throw new AuthWeakPasswordError('Password too short', 400, ['min_length'])
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
89
206
|
export declare class AuthWeakPasswordError extends CustomAuthError {
|
|
90
207
|
/**
|
|
91
208
|
* Reasons why the password is deemed weak.
|
|
@@ -94,6 +211,16 @@ export declare class AuthWeakPasswordError extends CustomAuthError {
|
|
|
94
211
|
constructor(message: string, status: number, reasons: WeakPasswordReasons[]);
|
|
95
212
|
}
|
|
96
213
|
export declare function isAuthWeakPasswordError(error: unknown): error is AuthWeakPasswordError;
|
|
214
|
+
/**
|
|
215
|
+
* Error thrown when a JWT cannot be verified or parsed.
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* ```ts
|
|
219
|
+
* import { AuthInvalidJwtError } from '@supabase/auth-js'
|
|
220
|
+
*
|
|
221
|
+
* throw new AuthInvalidJwtError('Token signature is invalid')
|
|
222
|
+
* ```
|
|
223
|
+
*/
|
|
97
224
|
export declare class AuthInvalidJwtError extends CustomAuthError {
|
|
98
225
|
constructor(message: string);
|
|
99
226
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/lib/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAEzC,qBAAa,SAAU,SAAQ,KAAK;IAClC;;;;;OAKG;IACH,IAAI,EAAE,SAAS,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,GAAG,SAAS,CAAA;IAE3C,8CAA8C;IAC9C,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IAE1B,SAAS,CAAC,aAAa,UAAO;gBAElB,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;CAM5D;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAE9D;AAED,qBAAa,YAAa,SAAQ,SAAS;IACzC,MAAM,EAAE,MAAM,CAAA;gBAEF,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS;CAMtE;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAEpE;AAED,qBAAa,gBAAiB,SAAQ,SAAS;IAC7C,aAAa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ACjE,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAO;gBAE1C,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAW;IAKnF,MAAM;;;;;mBAPY,MAAM;kBAAQ,MAAM;;;CAevC;AAED;;;;;;;;;GASG;AACH,qBAAa,uBAAwB,SAAQ,eAAe;gBAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAG5C;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,uBAAuB,CAE1F;AAED;;;;GAIG;AACH;;;;;;;;;GASG;AACH,qBAAa,qBAAsB,SAAQ,eAAe;IACxD;;OAEG;IACH,OAAO,EAAE,mBAAmB,EAAE,CAAA;gBAElB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,EAAE;CAK5E;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,qBAAqB,CAEtF;AAED;;;;;;;;;GASG;AACH,qBAAa,mBAAoB,SAAQ,eAAe;gBAC1C,OAAO,EAAE,MAAM;CAG5B"}
|
package/dist/main/lib/errors.js
CHANGED
|
@@ -7,6 +7,16 @@ exports.isAuthSessionMissingError = isAuthSessionMissingError;
|
|
|
7
7
|
exports.isAuthImplicitGrantRedirectError = isAuthImplicitGrantRedirectError;
|
|
8
8
|
exports.isAuthRetryableFetchError = isAuthRetryableFetchError;
|
|
9
9
|
exports.isAuthWeakPasswordError = isAuthWeakPasswordError;
|
|
10
|
+
/**
|
|
11
|
+
* Base error thrown by Supabase Auth helpers.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* import { AuthError } from '@supabase/auth-js'
|
|
16
|
+
*
|
|
17
|
+
* throw new AuthError('Unexpected auth error', 500, 'unexpected')
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
10
20
|
class AuthError extends Error {
|
|
11
21
|
constructor(message, status, code) {
|
|
12
22
|
super(message);
|
|
@@ -20,6 +30,16 @@ exports.AuthError = AuthError;
|
|
|
20
30
|
function isAuthError(error) {
|
|
21
31
|
return typeof error === 'object' && error !== null && '__isAuthError' in error;
|
|
22
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Error returned directly from the GoTrue REST API.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* import { AuthApiError } from '@supabase/auth-js'
|
|
39
|
+
*
|
|
40
|
+
* throw new AuthApiError('Invalid credentials', 400, 'invalid_credentials')
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
23
43
|
class AuthApiError extends AuthError {
|
|
24
44
|
constructor(message, status, code) {
|
|
25
45
|
super(message, status, code);
|
|
@@ -32,6 +52,20 @@ exports.AuthApiError = AuthApiError;
|
|
|
32
52
|
function isAuthApiError(error) {
|
|
33
53
|
return isAuthError(error) && error.name === 'AuthApiError';
|
|
34
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Wraps non-standard errors so callers can inspect the root cause.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* import { AuthUnknownError } from '@supabase/auth-js'
|
|
61
|
+
*
|
|
62
|
+
* try {
|
|
63
|
+
* await someAuthCall()
|
|
64
|
+
* } catch (err) {
|
|
65
|
+
* throw new AuthUnknownError('Auth failed', err)
|
|
66
|
+
* }
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
35
69
|
class AuthUnknownError extends AuthError {
|
|
36
70
|
constructor(message, originalError) {
|
|
37
71
|
super(message);
|
|
@@ -40,6 +74,16 @@ class AuthUnknownError extends AuthError {
|
|
|
40
74
|
}
|
|
41
75
|
}
|
|
42
76
|
exports.AuthUnknownError = AuthUnknownError;
|
|
77
|
+
/**
|
|
78
|
+
* Flexible error class used to create named auth errors at runtime.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* import { CustomAuthError } from '@supabase/auth-js'
|
|
83
|
+
*
|
|
84
|
+
* throw new CustomAuthError('My custom auth error', 'MyAuthError', 400, 'custom_code')
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
43
87
|
class CustomAuthError extends AuthError {
|
|
44
88
|
constructor(message, name, status, code) {
|
|
45
89
|
super(message, status, code);
|
|
@@ -48,6 +92,16 @@ class CustomAuthError extends AuthError {
|
|
|
48
92
|
}
|
|
49
93
|
}
|
|
50
94
|
exports.CustomAuthError = CustomAuthError;
|
|
95
|
+
/**
|
|
96
|
+
* Error thrown when an operation requires a session but none is present.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* import { AuthSessionMissingError } from '@supabase/auth-js'
|
|
101
|
+
*
|
|
102
|
+
* throw new AuthSessionMissingError()
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
51
105
|
class AuthSessionMissingError extends CustomAuthError {
|
|
52
106
|
constructor() {
|
|
53
107
|
super('Auth session missing!', 'AuthSessionMissingError', 400, undefined);
|
|
@@ -57,18 +111,51 @@ exports.AuthSessionMissingError = AuthSessionMissingError;
|
|
|
57
111
|
function isAuthSessionMissingError(error) {
|
|
58
112
|
return isAuthError(error) && error.name === 'AuthSessionMissingError';
|
|
59
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* Error thrown when the token response is malformed.
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```ts
|
|
119
|
+
* import { AuthInvalidTokenResponseError } from '@supabase/auth-js'
|
|
120
|
+
*
|
|
121
|
+
* throw new AuthInvalidTokenResponseError()
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
60
124
|
class AuthInvalidTokenResponseError extends CustomAuthError {
|
|
61
125
|
constructor() {
|
|
62
126
|
super('Auth session or user missing', 'AuthInvalidTokenResponseError', 500, undefined);
|
|
63
127
|
}
|
|
64
128
|
}
|
|
65
129
|
exports.AuthInvalidTokenResponseError = AuthInvalidTokenResponseError;
|
|
130
|
+
/**
|
|
131
|
+
* Error thrown when email/password credentials are invalid.
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```ts
|
|
135
|
+
* import { AuthInvalidCredentialsError } from '@supabase/auth-js'
|
|
136
|
+
*
|
|
137
|
+
* throw new AuthInvalidCredentialsError('Email or password is incorrect')
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
66
140
|
class AuthInvalidCredentialsError extends CustomAuthError {
|
|
67
141
|
constructor(message) {
|
|
68
142
|
super(message, 'AuthInvalidCredentialsError', 400, undefined);
|
|
69
143
|
}
|
|
70
144
|
}
|
|
71
145
|
exports.AuthInvalidCredentialsError = AuthInvalidCredentialsError;
|
|
146
|
+
/**
|
|
147
|
+
* Error thrown when implicit grant redirects contain an error.
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```ts
|
|
151
|
+
* import { AuthImplicitGrantRedirectError } from '@supabase/auth-js'
|
|
152
|
+
*
|
|
153
|
+
* throw new AuthImplicitGrantRedirectError('OAuth redirect failed', {
|
|
154
|
+
* error: 'access_denied',
|
|
155
|
+
* code: 'oauth_error',
|
|
156
|
+
* })
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
72
159
|
class AuthImplicitGrantRedirectError extends CustomAuthError {
|
|
73
160
|
constructor(message, details = null) {
|
|
74
161
|
super(message, 'AuthImplicitGrantRedirectError', 500, undefined);
|
|
@@ -88,6 +175,16 @@ exports.AuthImplicitGrantRedirectError = AuthImplicitGrantRedirectError;
|
|
|
88
175
|
function isAuthImplicitGrantRedirectError(error) {
|
|
89
176
|
return isAuthError(error) && error.name === 'AuthImplicitGrantRedirectError';
|
|
90
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* Error thrown during PKCE code exchanges.
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* ```ts
|
|
183
|
+
* import { AuthPKCEGrantCodeExchangeError } from '@supabase/auth-js'
|
|
184
|
+
*
|
|
185
|
+
* throw new AuthPKCEGrantCodeExchangeError('PKCE exchange failed')
|
|
186
|
+
* ```
|
|
187
|
+
*/
|
|
91
188
|
class AuthPKCEGrantCodeExchangeError extends CustomAuthError {
|
|
92
189
|
constructor(message, details = null) {
|
|
93
190
|
super(message, 'AuthPKCEGrantCodeExchangeError', 500, undefined);
|
|
@@ -104,6 +201,16 @@ class AuthPKCEGrantCodeExchangeError extends CustomAuthError {
|
|
|
104
201
|
}
|
|
105
202
|
}
|
|
106
203
|
exports.AuthPKCEGrantCodeExchangeError = AuthPKCEGrantCodeExchangeError;
|
|
204
|
+
/**
|
|
205
|
+
* Error thrown when a transient fetch issue occurs.
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* ```ts
|
|
209
|
+
* import { AuthRetryableFetchError } from '@supabase/auth-js'
|
|
210
|
+
*
|
|
211
|
+
* throw new AuthRetryableFetchError('Service temporarily unavailable', 503)
|
|
212
|
+
* ```
|
|
213
|
+
*/
|
|
107
214
|
class AuthRetryableFetchError extends CustomAuthError {
|
|
108
215
|
constructor(message, status) {
|
|
109
216
|
super(message, 'AuthRetryableFetchError', status, undefined);
|
|
@@ -118,6 +225,16 @@ function isAuthRetryableFetchError(error) {
|
|
|
118
225
|
* weak. Inspect the reasons to identify what password strength rules are
|
|
119
226
|
* inadequate.
|
|
120
227
|
*/
|
|
228
|
+
/**
|
|
229
|
+
* Error thrown when a supplied password is considered weak.
|
|
230
|
+
*
|
|
231
|
+
* @example
|
|
232
|
+
* ```ts
|
|
233
|
+
* import { AuthWeakPasswordError } from '@supabase/auth-js'
|
|
234
|
+
*
|
|
235
|
+
* throw new AuthWeakPasswordError('Password too short', 400, ['min_length'])
|
|
236
|
+
* ```
|
|
237
|
+
*/
|
|
121
238
|
class AuthWeakPasswordError extends CustomAuthError {
|
|
122
239
|
constructor(message, status, reasons) {
|
|
123
240
|
super(message, 'AuthWeakPasswordError', status, 'weak_password');
|
|
@@ -128,6 +245,16 @@ exports.AuthWeakPasswordError = AuthWeakPasswordError;
|
|
|
128
245
|
function isAuthWeakPasswordError(error) {
|
|
129
246
|
return isAuthError(error) && error.name === 'AuthWeakPasswordError';
|
|
130
247
|
}
|
|
248
|
+
/**
|
|
249
|
+
* Error thrown when a JWT cannot be verified or parsed.
|
|
250
|
+
*
|
|
251
|
+
* @example
|
|
252
|
+
* ```ts
|
|
253
|
+
* import { AuthInvalidJwtError } from '@supabase/auth-js'
|
|
254
|
+
*
|
|
255
|
+
* throw new AuthInvalidJwtError('Token signature is invalid')
|
|
256
|
+
* ```
|
|
257
|
+
*/
|
|
131
258
|
class AuthInvalidJwtError extends CustomAuthError {
|
|
132
259
|
constructor(message) {
|
|
133
260
|
super(message, 'AuthInvalidJwtError', 400, 'invalid_jwt');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/lib/errors.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/lib/errors.ts"],"names":[],"mappings":";;;AAmCA,kCAEC;AAuBD,wCAEC;AA+DD,8DAEC;AAgED,4EAIC;AA8CD,8DAEC;AA8BD,0DAEC;AAhRD;;;;;;;;;GASG;AACH,MAAa,SAAU,SAAQ,KAAK;IAclC,YAAY,OAAe,EAAE,MAAe,EAAE,IAAa;QACzD,KAAK,CAAC,OAAO,CAAC,CAAA;QAHN,kBAAa,GAAG,IAAI,CAAA;QAI5B,IAAI,CAAC,IAAI,GAAG,WAAW,CAAA;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;CACF;AApBD,8BAoBC;AAED,SAAgB,WAAW,CAAC,KAAc;IACxC,OAAO,OAAO,KAAK,KAAK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AAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED,MAAM;QACJ,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAA;IACH,CAAC;CACF;AAhBD,wEAgBC;AAED;;;;;;;;;GASG;AACH,MAAa,uBAAwB,SAAQ,eAAe;IAC1D,YAAY,OAAe,EAAE,MAAc;QACzC,KAAK,CAAC,OAAO,EAAE,yBAAyB,EAAE,MAAM,EAAE,SAAS,CAAC,CAAA;IAC9D,CAAC;CACF;AAJD,0DAIC;AAED,SAAgB,yBAAyB,CAAC,KAAc;IACtD,OAAO,WAAW,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,yBAAyB,CAAA;AACvE,CAAC;AAED;;;;GAIG;AACH;;;;;;;;;GASG;AACH,MAAa,qBAAsB,SAAQ,eAAe;IAMxD,YAAY,OAAe,EAAE,MAAc,EAAE,OAA8B;QACzE,KAAK,CAAC,OAAO,EAAE,uBAAuB,EAAE,MAAM,EAAE,eAAe,CAAC,CAAA;QAEhE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;CACF;AAXD,sDAWC;AAED,SAAgB,uBAAuB,CAAC,KAAc;IACpD,OAAO,WAAW,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,uBAAuB,CAAA;AACrE,CAAC;AAED;;;;;;;;;GASG;AACH,MAAa,mBAAoB,SAAQ,eAAe;IACtD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,qBAAqB,EAAE,GAAG,EAAE,aAAa,CAAC,CAAA;IAC3D,CAAC;CACF;AAJD,kDAIC"}
|
package/dist/main/lib/locks.d.ts
CHANGED
|
@@ -11,13 +11,44 @@ export declare const internals: {
|
|
|
11
11
|
* An error thrown when a lock cannot be acquired after some amount of time.
|
|
12
12
|
*
|
|
13
13
|
* Use the {@link #isAcquireTimeout} property instead of checking with `instanceof`.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* import { LockAcquireTimeoutError } from '@supabase/auth-js'
|
|
18
|
+
*
|
|
19
|
+
* class CustomLockError extends LockAcquireTimeoutError {
|
|
20
|
+
* constructor() {
|
|
21
|
+
* super('Lock timed out')
|
|
22
|
+
* }
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
14
25
|
*/
|
|
15
26
|
export declare abstract class LockAcquireTimeoutError extends Error {
|
|
16
27
|
readonly isAcquireTimeout = true;
|
|
17
28
|
constructor(message: string);
|
|
18
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Error thrown when the browser Navigator Lock API fails to acquire a lock.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* import { NavigatorLockAcquireTimeoutError } from '@supabase/auth-js'
|
|
36
|
+
*
|
|
37
|
+
* throw new NavigatorLockAcquireTimeoutError('Lock timed out')
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
19
40
|
export declare class NavigatorLockAcquireTimeoutError extends LockAcquireTimeoutError {
|
|
20
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Error thrown when the process-level lock helper cannot acquire a lock.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* import { ProcessLockAcquireTimeoutError } from '@supabase/auth-js'
|
|
48
|
+
*
|
|
49
|
+
* throw new ProcessLockAcquireTimeoutError('Lock timed out')
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
21
52
|
export declare class ProcessLockAcquireTimeoutError extends LockAcquireTimeoutError {
|
|
22
53
|
}
|
|
23
54
|
/**
|
|
@@ -44,6 +75,12 @@ export declare class ProcessLockAcquireTimeoutError extends LockAcquireTimeoutEr
|
|
|
44
75
|
* will time out after so many milliseconds. An error is
|
|
45
76
|
* a timeout if it has `isAcquireTimeout` set to true.
|
|
46
77
|
* @param fn The operation to run once the lock is acquired.
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* await navigatorLock('sync-user', 1000, async () => {
|
|
81
|
+
* await refreshSession()
|
|
82
|
+
* })
|
|
83
|
+
* ```
|
|
47
84
|
*/
|
|
48
85
|
export declare function navigatorLock<R>(name: string, acquireTimeout: number, fn: () => Promise<R>): Promise<R>;
|
|
49
86
|
/**
|
|
@@ -59,6 +96,12 @@ export declare function navigatorLock<R>(name: string, acquireTimeout: number, f
|
|
|
59
96
|
* will time out after so many milliseconds. An error is
|
|
60
97
|
* a timeout if it has `isAcquireTimeout` set to true.
|
|
61
98
|
* @param fn The operation to run once the lock is acquired.
|
|
99
|
+
* @example
|
|
100
|
+
* ```ts
|
|
101
|
+
* await processLock('migrate', 5000, async () => {
|
|
102
|
+
* await runMigration()
|
|
103
|
+
* })
|
|
104
|
+
* ```
|
|
62
105
|
*/
|
|
63
106
|
export declare function processLock<R>(name: string, acquireTimeout: number, fn: () => Promise<R>): Promise<R>;
|
|
64
107
|
//# sourceMappingURL=locks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locks.d.ts","sourceRoot":"","sources":["../../../src/lib/locks.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,SAAS;IACpB;;OAEG;;CAOJ,CAAA;AAED
|
|
1
|
+
{"version":3,"file":"locks.d.ts","sourceRoot":"","sources":["../../../src/lib/locks.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,SAAS;IACpB;;OAEG;;CAOJ,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,8BAAsB,uBAAwB,SAAQ,KAAK;IACzD,SAAgB,gBAAgB,QAAO;gBAE3B,OAAO,EAAE,MAAM;CAG5B;AAED;;;;;;;;;GASG;AACH,qBAAa,gCAAiC,SAAQ,uBAAuB;CAAG;AAChF;;;;;;;;;GASG;AACH,qBAAa,8BAA+B,SAAQ,uBAAuB;CAAG;AAE9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAsB,aAAa,CAAC,CAAC,EACnC,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,MAAM,EACtB,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,CAAC,CAAC,CA0FZ;AAID;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,WAAW,CAAC,CAAC,EACjC,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,MAAM,EACtB,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,CAAC,CAAC,CAkDZ"}
|
package/dist/main/lib/locks.js
CHANGED
|
@@ -20,6 +20,17 @@ exports.internals = {
|
|
|
20
20
|
* An error thrown when a lock cannot be acquired after some amount of time.
|
|
21
21
|
*
|
|
22
22
|
* Use the {@link #isAcquireTimeout} property instead of checking with `instanceof`.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* import { LockAcquireTimeoutError } from '@supabase/auth-js'
|
|
27
|
+
*
|
|
28
|
+
* class CustomLockError extends LockAcquireTimeoutError {
|
|
29
|
+
* constructor() {
|
|
30
|
+
* super('Lock timed out')
|
|
31
|
+
* }
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
23
34
|
*/
|
|
24
35
|
class LockAcquireTimeoutError extends Error {
|
|
25
36
|
constructor(message) {
|
|
@@ -28,9 +39,29 @@ class LockAcquireTimeoutError extends Error {
|
|
|
28
39
|
}
|
|
29
40
|
}
|
|
30
41
|
exports.LockAcquireTimeoutError = LockAcquireTimeoutError;
|
|
42
|
+
/**
|
|
43
|
+
* Error thrown when the browser Navigator Lock API fails to acquire a lock.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* import { NavigatorLockAcquireTimeoutError } from '@supabase/auth-js'
|
|
48
|
+
*
|
|
49
|
+
* throw new NavigatorLockAcquireTimeoutError('Lock timed out')
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
31
52
|
class NavigatorLockAcquireTimeoutError extends LockAcquireTimeoutError {
|
|
32
53
|
}
|
|
33
54
|
exports.NavigatorLockAcquireTimeoutError = NavigatorLockAcquireTimeoutError;
|
|
55
|
+
/**
|
|
56
|
+
* Error thrown when the process-level lock helper cannot acquire a lock.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* import { ProcessLockAcquireTimeoutError } from '@supabase/auth-js'
|
|
61
|
+
*
|
|
62
|
+
* throw new ProcessLockAcquireTimeoutError('Lock timed out')
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
34
65
|
class ProcessLockAcquireTimeoutError extends LockAcquireTimeoutError {
|
|
35
66
|
}
|
|
36
67
|
exports.ProcessLockAcquireTimeoutError = ProcessLockAcquireTimeoutError;
|
|
@@ -58,6 +89,12 @@ exports.ProcessLockAcquireTimeoutError = ProcessLockAcquireTimeoutError;
|
|
|
58
89
|
* will time out after so many milliseconds. An error is
|
|
59
90
|
* a timeout if it has `isAcquireTimeout` set to true.
|
|
60
91
|
* @param fn The operation to run once the lock is acquired.
|
|
92
|
+
* @example
|
|
93
|
+
* ```ts
|
|
94
|
+
* await navigatorLock('sync-user', 1000, async () => {
|
|
95
|
+
* await refreshSession()
|
|
96
|
+
* })
|
|
97
|
+
* ```
|
|
61
98
|
*/
|
|
62
99
|
async function navigatorLock(name, acquireTimeout, fn) {
|
|
63
100
|
if (exports.internals.debug) {
|
|
@@ -143,6 +180,12 @@ const PROCESS_LOCKS = {};
|
|
|
143
180
|
* will time out after so many milliseconds. An error is
|
|
144
181
|
* a timeout if it has `isAcquireTimeout` set to true.
|
|
145
182
|
* @param fn The operation to run once the lock is acquired.
|
|
183
|
+
* @example
|
|
184
|
+
* ```ts
|
|
185
|
+
* await processLock('migrate', 5000, async () => {
|
|
186
|
+
* await runMigration()
|
|
187
|
+
* })
|
|
188
|
+
* ```
|
|
146
189
|
*/
|
|
147
190
|
async function processLock(name, acquireTimeout, fn) {
|
|
148
191
|
var _a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locks.js","sourceRoot":"","sources":["../../../src/lib/locks.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"locks.js","sourceRoot":"","sources":["../../../src/lib/locks.ts"],"names":[],"mappings":";;;AA+FA,sCA8FC;AAwBD,kCAsDC;AA3QD,uCAAgD;AAEhD;;GAEG;AACU,QAAA,SAAS,GAAG;IACvB;;OAEG;IACH,KAAK,EAAE,CAAC,CAAC,CACP,UAAU;QACV,IAAA,8BAAoB,GAAE;QACtB,UAAU,CAAC,YAAY;QACvB,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,gCAAgC,CAAC,KAAK,MAAM,CAC7E;CACF,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAsB,uBAAwB,SAAQ,KAAK;IAGzD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QAHA,qBAAgB,GAAG,IAAI,CAAA;IAIvC,CAAC;CACF;AAND,0DAMC;AAED;;;;;;;;;GASG;AACH,MAAa,gCAAiC,SAAQ,uBAAuB;CAAG;AAAhF,4EAAgF;AAChF;;;;;;;;;GASG;AACH,MAAa,8BAA+B,SAAQ,uBAAuB;CAAG;AAA9E,wEAA8E;AAE9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACI,KAAK,UAAU,aAAa,CACjC,IAAY,EACZ,cAAsB,EACtB,EAAoB;IAEpB,IAAI,iBAAS,CAAC,KAAK,EAAE,CAAC;QACpB,OAAO,CAAC,GAAG,CAAC,kDAAkD,EAAE,IAAI,EAAE,cAAc,CAAC,CAAA;IACvF,CAAC;IAED,MAAM,eAAe,GAAG,IAAI,UAAU,CAAC,eAAe,EAAE,CAAA;IAExD,IAAI,cAAc,GA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AM,EAAE,EAAE;gBACxB,UAAU,CAAC,GAAG,EAAE;oBACd,MAAM,CACJ,IAAI,8BAA8B,CAChC,oCAAoC,IAAI,aAAa,CACtD,CACF,CAAA;gBACH,CAAC,EAAE,cAAc,CAAC,CAAA;YACpB,CAAC,CAAC;YACJ,CAAC,CAAC,IAAI;KACT,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CACnB;SACE,KAAK,CAAC,CAAC,CAAM,EAAE,EAAE;QAChB,IAAI,CAAC,IAAI,CAAC,CAAC,gBAAgB,EAAE,CAAC;YAC5B,MAAM,CAAC,CAAA;QACT,CAAC;QAED,OAAO,IAAI,CAAA;IACb,CAAC,CAAC;SACD,IAAI,CAAC,KAAK,IAAI,EAAE;QACf,uEAAuE;QACvE,sDAAsD;QACtD,OAAO,MAAM,EAAE,EAAE,CAAA;IACnB,CAAC,CAAC,CAAA;IAEJ,aAAa,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,KAAK,CAAC,KAAK,EAAE,CAAM,EAAE,EAAE;QAC5D,IAAI,CAAC,IAAI,CAAC,CAAC,gBAAgB,EAAE,CAAC;YAC5B,wEAAwE;YACxE,kEAAkE;YAClE,MAAM,iBAAiB,CAAA;YAEvB,OAAO,IAAI,CAAA;QACb,CAAC;QAED,MAAM,CAAC,CAAA;IACT,CAAC,CAAC,CAAA;IAEF,yEAAyE;IACzE,yCAAyC;IACzC,OAAO,MAAM,gBAAgB,CAAA;AAC/B,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "2.81.1";
|
|
1
|
+
export declare const version = "2.81.2-canary.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/lib/version.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/lib/version.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,OAAO,oBAAoB,CAAA"}
|
package/dist/main/lib/version.js
CHANGED
|
@@ -7,5 +7,5 @@ exports.version = void 0;
|
|
|
7
7
|
// - Debugging and support (identifying which version is running)
|
|
8
8
|
// - Telemetry and logging (version reporting in errors/analytics)
|
|
9
9
|
// - Ensuring build artifacts match the published package version
|
|
10
|
-
exports.version = '2.81.1';
|
|
10
|
+
exports.version = '2.81.2-canary.1';
|
|
11
11
|
//# sourceMappingURL=version.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/lib/version.ts"],"names":[],"mappings":";;;AAAA,6EAA6E;AAC7E,gEAAgE;AAChE,uEAAuE;AACvE,iEAAiE;AACjE,kEAAkE;AAClE,iEAAiE;AACpD,QAAA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/lib/version.ts"],"names":[],"mappings":";;;AAAA,6EAA6E;AAC7E,gEAAgE;AAChE,uEAAuE;AACvE,iEAAiE;AACjE,kEAAkE;AAClE,iEAAiE;AACpD,QAAA,OAAO,GAAG,iBAAiB,CAAA"}
|
|
@@ -14,6 +14,19 @@ export default class GoTrueAdminApi {
|
|
|
14
14
|
[key: string]: string;
|
|
15
15
|
};
|
|
16
16
|
protected fetch: Fetch;
|
|
17
|
+
/**
|
|
18
|
+
* Creates an admin API client that can be used to manage users and OAuth clients.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { GoTrueAdminApi } from '@supabase/auth-js'
|
|
23
|
+
*
|
|
24
|
+
* const admin = new GoTrueAdminApi({
|
|
25
|
+
* url: 'https://xyzcompany.supabase.co/auth/v1',
|
|
26
|
+
* headers: { Authorization: `Bearer ${process.env.SUPABASE_SERVICE_ROLE_KEY}` },
|
|
27
|
+
* })
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
17
30
|
constructor({ url, headers, fetch, }: {
|
|
18
31
|
url: string;
|
|
19
32
|
headers?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoTrueAdminApi.d.ts","sourceRoot":"","sources":["../../src/GoTrueAdminApi.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EAKN,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,iBAAiB,EAKjB,UAAU,EAEV,YAAY,EACZ,mBAAmB,EAKpB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,SAAS,EAAe,MAAM,cAAc,CAAA;AAErD,MAAM,CAAC,OAAO,OAAO,cAAc;IACjC,+CAA+C;IAC/C,GAAG,EAAE,iBAAiB,CAAA;IAEtB;;;OAGG;IACH,KAAK,EAAE,mBAAmB,CAAA;IAE1B,SAAS,CAAC,GAAG,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,OAAO,EAAE;QACjB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KACtB,CAAA;IACD,SAAS,CAAC,KAAK,EAAE,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"GoTrueAdminApi.d.ts","sourceRoot":"","sources":["../../src/GoTrueAdminApi.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EAKN,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,iBAAiB,EAKjB,UAAU,EAEV,YAAY,EACZ,mBAAmB,EAKpB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,SAAS,EAAe,MAAM,cAAc,CAAA;AAErD,MAAM,CAAC,OAAO,OAAO,cAAc;IACjC,+CAA+C;IAC/C,GAAG,EAAE,iBAAiB,CAAA;IAEtB;;;OAGG;IACH,KAAK,EAAE,mB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AE,EAAE,CAAA;SAAE,CAAC;QAAC,KAAK,EAAE,SAAS,CAAA;KAAE,CAC5C;IAmCD;;;;;;OAMG;IACG,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAiBrD;;;;;;OAMG;IACG,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,mBAAmB,GAAG,OAAO,CAAC,YAAY,CAAC;IAkBzF;;;;;;;;OAQG;IACG,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,gBAAgB,UAAQ,GAAG,OAAO,CAAC,YAAY,CAAC;YAoB/D,YAAY;YA2BZ,aAAa;IA0B3B;;;;;OAKG;YACW,iBAAiB;IAmC/B;;;;;OAKG;YACW,kBAAkB;IAkBhC;;;;;OAKG;YACW,eAAe;IAiB7B;;;;;OAKG;YACW,kBAAkB;IAqBhC;;;;;OAKG;YACW,kBAAkB;IAkBhC;;;;;OAKG;YACW,4BAA4B;CAqB3C"}
|
|
@@ -4,6 +4,19 @@ import { resolveFetch, validateUUID } from './lib/helpers';
|
|
|
4
4
|
import { SIGN_OUT_SCOPES, } from './lib/types';
|
|
5
5
|
import { isAuthError } from './lib/errors';
|
|
6
6
|
export default class GoTrueAdminApi {
|
|
7
|
+
/**
|
|
8
|
+
* Creates an admin API client that can be used to manage users and OAuth clients.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { GoTrueAdminApi } from '@supabase/auth-js'
|
|
13
|
+
*
|
|
14
|
+
* const admin = new GoTrueAdminApi({
|
|
15
|
+
* url: 'https://xyzcompany.supabase.co/auth/v1',
|
|
16
|
+
* headers: { Authorization: `Bearer ${process.env.SUPABASE_SERVICE_ROLE_KEY}` },
|
|
17
|
+
* })
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
7
20
|
constructor({ url = '', headers = {}, fetch, }) {
|
|
8
21
|
this.url = url;
|
|
9
22
|
this.headers = headers;
|