@faable/auth-js 1.3.0 → 1.3.2
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/dts/Base.d.ts +7 -0
- package/dist/dts/BaseLog.d.ts +10 -0
- package/dist/dts/FaableAuthApi.d.ts +13 -0
- package/dist/dts/FaableAuthClient.d.ts +231 -0
- package/dist/dts/entrypoints/faableauth.d.ts +6 -0
- package/dist/dts/lib/constants.d.ts +10 -0
- package/dist/dts/lib/errors.d.ts +82 -0
- package/dist/dts/lib/fetch.d.ts +11 -0
- package/dist/dts/lib/globals.d.ts +4 -0
- package/dist/dts/lib/helpers.d.ts +52 -0
- package/dist/dts/lib/jwt.d.ts +55 -0
- package/dist/dts/lib/local-storage.d.ts +12 -0
- package/dist/dts/lib/storage_helpers.d.ts +4 -0
- package/dist/dts/lib/types.d.ts +383 -0
- package/dist/dts/lib/url_helpers.d.ts +7 -0
- package/dist/dts/lib/version.d.ts +1 -0
- package/dist/dts/lock/Lock.d.ts +19 -0
- package/dist/dts/lock/locks.d.ts +63 -0
- package/dist/dts/utils.d.ts +17 -0
- package/dist/faableauth.js +1 -1
- package/dist/faableauth.js.map +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
import { AuthError } from "./errors";
|
|
2
|
+
import { LockFunc } from "../lock/locks";
|
|
3
|
+
import { BaseLogOptions } from "../BaseLog";
|
|
4
|
+
/**
|
|
5
|
+
* @ignore
|
|
6
|
+
*/
|
|
7
|
+
export interface AuthenticationResult {
|
|
8
|
+
state: string;
|
|
9
|
+
code?: string;
|
|
10
|
+
error?: string;
|
|
11
|
+
error_description?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare class User {
|
|
14
|
+
name?: string;
|
|
15
|
+
profile?: string;
|
|
16
|
+
picture?: string;
|
|
17
|
+
email?: string;
|
|
18
|
+
website?: string;
|
|
19
|
+
birthdate?: string;
|
|
20
|
+
locale?: string;
|
|
21
|
+
sub?: string;
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The state of the application before the user was redirected to the login page.
|
|
26
|
+
*/
|
|
27
|
+
export type AppState = {
|
|
28
|
+
returnTo?: string;
|
|
29
|
+
[key: string]: any;
|
|
30
|
+
};
|
|
31
|
+
export interface AuthorizationParams {
|
|
32
|
+
/**
|
|
33
|
+
* - `'page'`: displays the UI with a full page view
|
|
34
|
+
* - `'popup'`: displays the UI with a popup window
|
|
35
|
+
* - `'touch'`: displays the UI in a way that leverages a touch interface
|
|
36
|
+
* - `'wap'`: displays the UI with a "feature phone" type interface
|
|
37
|
+
*/
|
|
38
|
+
display?: "page" | "popup" | "touch" | "wap";
|
|
39
|
+
/**
|
|
40
|
+
* - `'none'`: do not prompt user for login or consent on reauthentication
|
|
41
|
+
* - `'login'`: prompt user for reauthentication
|
|
42
|
+
* - `'consent'`: prompt user for consent before processing request
|
|
43
|
+
* - `'select_account'`: prompt user to select an account
|
|
44
|
+
*/
|
|
45
|
+
prompt?: "none" | "login" | "consent" | "select_account";
|
|
46
|
+
/**
|
|
47
|
+
* Maximum allowable elapsed time (in seconds) since authentication.
|
|
48
|
+
* If the last time the user authenticated is greater than this value,
|
|
49
|
+
* the user must be reauthenticated.
|
|
50
|
+
*/
|
|
51
|
+
max_age?: string | number;
|
|
52
|
+
/**
|
|
53
|
+
* The space-separated list of language tags, ordered by preference.
|
|
54
|
+
* For example: `'fr-CA fr en'`.
|
|
55
|
+
*/
|
|
56
|
+
ui_locales?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Previously issued ID Token.
|
|
59
|
+
*/
|
|
60
|
+
id_token_hint?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Provides a hint to Auth0 as to what flow should be displayed.
|
|
63
|
+
* The default behavior is to show a login page but you can override
|
|
64
|
+
* this by passing 'signup' to show the signup page instead.
|
|
65
|
+
*
|
|
66
|
+
* This only affects the New Universal Login Experience.
|
|
67
|
+
*/
|
|
68
|
+
screen_hint?: "signup" | "login" | string;
|
|
69
|
+
/**
|
|
70
|
+
* The user's email address or other identifier. When your app knows
|
|
71
|
+
* which user is trying to authenticate, you can provide this parameter
|
|
72
|
+
* to pre-fill the email box or select the right session for sign-in.
|
|
73
|
+
*
|
|
74
|
+
* This currently only affects the classic Lock experience.
|
|
75
|
+
*/
|
|
76
|
+
login_hint?: string;
|
|
77
|
+
acr_values?: string;
|
|
78
|
+
/**
|
|
79
|
+
* The default scope to be used on authentication requests.
|
|
80
|
+
*
|
|
81
|
+
* This defaults to `profile email` if not set. If you are setting extra scopes and require
|
|
82
|
+
* `profile` and `email` to be included then you must include them in the provided scope.
|
|
83
|
+
*
|
|
84
|
+
* Note: The `openid` scope is **always applied** regardless of this setting.
|
|
85
|
+
*/
|
|
86
|
+
scope?: string;
|
|
87
|
+
/**
|
|
88
|
+
* The default audience to be used for requesting API access.
|
|
89
|
+
*/
|
|
90
|
+
audience?: string;
|
|
91
|
+
/**
|
|
92
|
+
* The name of the connection configured for your application.
|
|
93
|
+
* If null, it will redirect to the Auth0 Login Page and show
|
|
94
|
+
* the Login Widget.
|
|
95
|
+
*/
|
|
96
|
+
connection?: string;
|
|
97
|
+
/**
|
|
98
|
+
* The Id of an organization to log in to.
|
|
99
|
+
*
|
|
100
|
+
* This will specify an `organization` parameter in your user's login request and will add a step to validate
|
|
101
|
+
* the `org_id` claim in your user's ID Token.
|
|
102
|
+
*/
|
|
103
|
+
organization?: string;
|
|
104
|
+
/**
|
|
105
|
+
* The Id of an invitation to accept. This is available from the user invitation URL that is given when participating in a user invitation flow.
|
|
106
|
+
*/
|
|
107
|
+
invitation?: string;
|
|
108
|
+
/**
|
|
109
|
+
* The default URL where Auth0 will redirect your browser to with
|
|
110
|
+
* the authentication result. It must be whitelisted in
|
|
111
|
+
* the "Allowed Callback URLs" field in your Auth0 Application's
|
|
112
|
+
* settings. If not provided here, it should be provided in the other
|
|
113
|
+
* methods that provide authentication.
|
|
114
|
+
*/
|
|
115
|
+
redirect_uri?: string;
|
|
116
|
+
/**
|
|
117
|
+
* If you need to send custom parameters to the Authorization Server,
|
|
118
|
+
* make sure to use the original parameter name.
|
|
119
|
+
*/
|
|
120
|
+
[key: string]: any;
|
|
121
|
+
}
|
|
122
|
+
interface BaseLoginOptions {
|
|
123
|
+
/**
|
|
124
|
+
* URL parameters that will be sent back to the Authorization Server. This can be known parameters
|
|
125
|
+
* defined by Auth0 or custom parameters that you define.
|
|
126
|
+
*/
|
|
127
|
+
authorizationParams?: AuthorizationParams;
|
|
128
|
+
}
|
|
129
|
+
export interface RedirectLoginOptions<TAppState = any> extends BaseLoginOptions {
|
|
130
|
+
/**
|
|
131
|
+
* Used to store state before doing the redirect
|
|
132
|
+
*/
|
|
133
|
+
appState?: TAppState;
|
|
134
|
+
}
|
|
135
|
+
export interface IdToken {
|
|
136
|
+
__raw: string;
|
|
137
|
+
name?: string;
|
|
138
|
+
given_name?: string;
|
|
139
|
+
family_name?: string;
|
|
140
|
+
middle_name?: string;
|
|
141
|
+
nickname?: string;
|
|
142
|
+
preferred_username?: string;
|
|
143
|
+
profile?: string;
|
|
144
|
+
picture?: string;
|
|
145
|
+
website?: string;
|
|
146
|
+
email?: string;
|
|
147
|
+
email_verified?: boolean;
|
|
148
|
+
gender?: string;
|
|
149
|
+
birthdate?: string;
|
|
150
|
+
zoneinfo?: string;
|
|
151
|
+
locale?: string;
|
|
152
|
+
phone_number?: string;
|
|
153
|
+
phone_number_verified?: boolean;
|
|
154
|
+
address?: string;
|
|
155
|
+
updated_at?: string;
|
|
156
|
+
iss?: string;
|
|
157
|
+
aud?: string;
|
|
158
|
+
exp?: number;
|
|
159
|
+
nbf?: number;
|
|
160
|
+
iat?: number;
|
|
161
|
+
jti?: string;
|
|
162
|
+
azp?: string;
|
|
163
|
+
nonce?: string;
|
|
164
|
+
auth_time?: string;
|
|
165
|
+
at_hash?: string;
|
|
166
|
+
c_hash?: string;
|
|
167
|
+
acr?: string;
|
|
168
|
+
amr?: string;
|
|
169
|
+
sub_jwk?: string;
|
|
170
|
+
cnf?: string;
|
|
171
|
+
sid?: string;
|
|
172
|
+
org_id?: string;
|
|
173
|
+
[key: string]: any;
|
|
174
|
+
}
|
|
175
|
+
export interface GetTokenSilentlyOptions {
|
|
176
|
+
/**
|
|
177
|
+
* When `off`, ignores the cache and always sends a
|
|
178
|
+
* request to Auth0.
|
|
179
|
+
* When `cache-only`, only reads from the cache and never sends a request to Auth0.
|
|
180
|
+
* Defaults to `on`, where it both reads from the cache and sends a request to Auth0 as needed.
|
|
181
|
+
*/
|
|
182
|
+
cacheMode?: "on" | "off" | "cache-only";
|
|
183
|
+
/**
|
|
184
|
+
* Parameters that will be sent back to Auth0 as part of a request.
|
|
185
|
+
*/
|
|
186
|
+
authorizationParams?: {
|
|
187
|
+
/**
|
|
188
|
+
* There's no actual redirect when getting a token silently,
|
|
189
|
+
* but, according to the spec, a `redirect_uri` param is required.
|
|
190
|
+
* Auth0 uses this parameter to validate that the current `origin`
|
|
191
|
+
* matches the `redirect_uri` `origin` when sending the response.
|
|
192
|
+
* It must be whitelisted in the "Allowed Web Origins" in your
|
|
193
|
+
* Auth0 Application's settings.
|
|
194
|
+
*/
|
|
195
|
+
redirect_uri?: string;
|
|
196
|
+
/**
|
|
197
|
+
* The scope that was used in the authentication request
|
|
198
|
+
*/
|
|
199
|
+
scope?: string;
|
|
200
|
+
/**
|
|
201
|
+
* The audience that was used in the authentication request
|
|
202
|
+
*/
|
|
203
|
+
audience?: string;
|
|
204
|
+
/**
|
|
205
|
+
* If you need to send custom parameters to the Authorization Server,
|
|
206
|
+
* make sure to use the original parameter name.
|
|
207
|
+
*/
|
|
208
|
+
[key: string]: any;
|
|
209
|
+
};
|
|
210
|
+
/** A maximum number of seconds to wait before declaring the background /authorize call as failed for timeout
|
|
211
|
+
* Defaults to 60s.
|
|
212
|
+
*/
|
|
213
|
+
timeoutInSeconds?: number;
|
|
214
|
+
/**
|
|
215
|
+
* If true, the full response from the /oauth/token endpoint (or the cache, if the cache was used) is returned
|
|
216
|
+
* (minus `refresh_token` if one was issued). Otherwise, just the access token is returned.
|
|
217
|
+
*
|
|
218
|
+
* The default is `false`.
|
|
219
|
+
*/
|
|
220
|
+
detailedResponse?: boolean;
|
|
221
|
+
}
|
|
222
|
+
export type GetTokenSilentlyVerboseResponse = Omit<TokenEndpointResponse, "refresh_token">;
|
|
223
|
+
export type TokenEndpointResponse = {
|
|
224
|
+
id_token: string;
|
|
225
|
+
access_token: string;
|
|
226
|
+
refresh_token?: string;
|
|
227
|
+
expires_in: number;
|
|
228
|
+
scope?: string;
|
|
229
|
+
};
|
|
230
|
+
export type FaableAuthClientConfig = {
|
|
231
|
+
domain: string;
|
|
232
|
+
scope?: string;
|
|
233
|
+
audience?: string;
|
|
234
|
+
redirect_uri?: string;
|
|
235
|
+
clientId: string;
|
|
236
|
+
authorizationParams?: AuthorizationParams;
|
|
237
|
+
cookieDomain?: string;
|
|
238
|
+
useRefreshTokens?: boolean;
|
|
239
|
+
flowType?: AuthFlowType;
|
|
240
|
+
storage?: SupportedStorage;
|
|
241
|
+
storageKey?: string;
|
|
242
|
+
/**
|
|
243
|
+
* Provide your own locking mechanism based on the environment. By default no locking is done at this time.
|
|
244
|
+
*
|
|
245
|
+
* @experimental
|
|
246
|
+
*/
|
|
247
|
+
lock?: LockFunc;
|
|
248
|
+
} & BaseLogOptions;
|
|
249
|
+
type AnyFunction = (...args: any[]) => any;
|
|
250
|
+
type MaybePromisify<T> = T | Promise<T>;
|
|
251
|
+
type PromisifyMethods<T> = {
|
|
252
|
+
[K in keyof T]: T[K] extends AnyFunction ? (...args: Parameters<T[K]>) => MaybePromisify<ReturnType<T[K]>> : T[K];
|
|
253
|
+
};
|
|
254
|
+
export type SupportedStorage = PromisifyMethods<Pick<Storage, "getItem" | "setItem" | "removeItem">> & {
|
|
255
|
+
/**
|
|
256
|
+
* If set to `true` signals to the library that the storage medium is used
|
|
257
|
+
* on a server and the values may not be authentic, such as reading from
|
|
258
|
+
* request cookies. Implementations should not set this to true if the client
|
|
259
|
+
* is used on a server that reads storage information from authenticated
|
|
260
|
+
* sources, such as a secure database or file.
|
|
261
|
+
*/
|
|
262
|
+
isServer?: boolean;
|
|
263
|
+
};
|
|
264
|
+
export type Provider = "google" | "github";
|
|
265
|
+
export type AuthFlowType = "implicit" | "pkce";
|
|
266
|
+
export type SignInWithOAuthConnection = {
|
|
267
|
+
/** Default connection is used if not setted. */
|
|
268
|
+
connection?: string;
|
|
269
|
+
/** A URL to send the user to after they are confirmed. */
|
|
270
|
+
redirectTo?: string;
|
|
271
|
+
/** A space-separated list of scopes granted to the OAuth application. */
|
|
272
|
+
scopes?: string;
|
|
273
|
+
/** An object of query params */
|
|
274
|
+
queryParams?: {
|
|
275
|
+
[key: string]: string;
|
|
276
|
+
};
|
|
277
|
+
/** If set to true does not immediately redirect the current browser context to visit the OAuth authorization page for the provider. */
|
|
278
|
+
skipBrowserRedirect?: boolean;
|
|
279
|
+
};
|
|
280
|
+
export type OAuthResponse = {
|
|
281
|
+
data: {
|
|
282
|
+
url: string;
|
|
283
|
+
};
|
|
284
|
+
error: null;
|
|
285
|
+
} | {
|
|
286
|
+
data: {
|
|
287
|
+
url: null;
|
|
288
|
+
};
|
|
289
|
+
error: AuthError;
|
|
290
|
+
};
|
|
291
|
+
export interface Session {
|
|
292
|
+
/**
|
|
293
|
+
* The oauth provider token. If present, this can be used to make external API requests to the oauth provider used.
|
|
294
|
+
*/
|
|
295
|
+
provider_token?: string | null;
|
|
296
|
+
/**
|
|
297
|
+
* The oauth provider refresh token. If present, this can be used to refresh the provider_token via the oauth provider's API.
|
|
298
|
+
* Not all oauth providers return a provider refresh token. If the provider_refresh_token is missing, please refer to the oauth provider's documentation for information on how to obtain the provider refresh token.
|
|
299
|
+
*/
|
|
300
|
+
provider_refresh_token?: string | null;
|
|
301
|
+
/**
|
|
302
|
+
* The access token jwt. It is recommended to set the JWT_EXPIRY to a shorter expiry value.
|
|
303
|
+
*/
|
|
304
|
+
access_token: string;
|
|
305
|
+
/**
|
|
306
|
+
* A one-time used refresh token that never expires.
|
|
307
|
+
*/
|
|
308
|
+
refresh_token: string;
|
|
309
|
+
/**
|
|
310
|
+
* The number of seconds until the token expires (since it was issued). Returned when a login is confirmed.
|
|
311
|
+
*/
|
|
312
|
+
expires_in: number;
|
|
313
|
+
/**
|
|
314
|
+
* A timestamp of when the token will expire. Returned when a login is confirmed.
|
|
315
|
+
*/
|
|
316
|
+
expires_at?: number;
|
|
317
|
+
token_type: string;
|
|
318
|
+
user: User;
|
|
319
|
+
}
|
|
320
|
+
export type AuthResponse = {
|
|
321
|
+
data: {
|
|
322
|
+
user: User | null;
|
|
323
|
+
session: Session | null;
|
|
324
|
+
};
|
|
325
|
+
error: null;
|
|
326
|
+
} | {
|
|
327
|
+
data: {
|
|
328
|
+
user: null;
|
|
329
|
+
session: null;
|
|
330
|
+
};
|
|
331
|
+
error: AuthError;
|
|
332
|
+
};
|
|
333
|
+
export type AuthChangeEventMFA = "MFA_CHALLENGE_VERIFIED";
|
|
334
|
+
export type AuthChangeEvent = "INITIAL_SESSION" | "PASSWORD_RECOVERY" | "SIGNED_IN" | "SIGNED_OUT" | "TOKEN_REFRESHED" | "USER_UPDATED" | AuthChangeEventMFA;
|
|
335
|
+
export interface Subscription {
|
|
336
|
+
/**
|
|
337
|
+
* The subscriber UUID. This will be set by the client.
|
|
338
|
+
*/
|
|
339
|
+
id: string;
|
|
340
|
+
/**
|
|
341
|
+
* The function to call every time there is an event. eg: (eventName) => {}
|
|
342
|
+
*/
|
|
343
|
+
callback: (event: AuthChangeEvent, session: Session | null) => void;
|
|
344
|
+
/**
|
|
345
|
+
* Call this to remove the listener.
|
|
346
|
+
*/
|
|
347
|
+
unsubscribe: () => void;
|
|
348
|
+
}
|
|
349
|
+
export type SignOut = {
|
|
350
|
+
/**
|
|
351
|
+
* Determines which sessions should be
|
|
352
|
+
* logged out. Global means all
|
|
353
|
+
* sessions by this account. Local
|
|
354
|
+
* means only this session. Others
|
|
355
|
+
* means all other sessions except the
|
|
356
|
+
* current one. When using others,
|
|
357
|
+
* there is no sign-out event fired on
|
|
358
|
+
* the current session!
|
|
359
|
+
*/
|
|
360
|
+
scope?: "global" | "local" | "others";
|
|
361
|
+
};
|
|
362
|
+
export type InitializeResult = {
|
|
363
|
+
error: AuthError | null;
|
|
364
|
+
};
|
|
365
|
+
export type UserResponse = {
|
|
366
|
+
data: {
|
|
367
|
+
user: User;
|
|
368
|
+
};
|
|
369
|
+
error: null;
|
|
370
|
+
} | {
|
|
371
|
+
data: {
|
|
372
|
+
user: null;
|
|
373
|
+
};
|
|
374
|
+
error: AuthError;
|
|
375
|
+
};
|
|
376
|
+
export type CallRefreshTokenResult = {
|
|
377
|
+
session: Session;
|
|
378
|
+
error: null;
|
|
379
|
+
} | {
|
|
380
|
+
session: null;
|
|
381
|
+
error: AuthError;
|
|
382
|
+
};
|
|
383
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const version = "0.0.0";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Base } from "../Base";
|
|
2
|
+
import { BaseLogOptions } from "../BaseLog";
|
|
3
|
+
import { LockFunc } from "./locks";
|
|
4
|
+
type LockOptions = {
|
|
5
|
+
storageKey: string;
|
|
6
|
+
lock?: LockFunc;
|
|
7
|
+
} & BaseLogOptions;
|
|
8
|
+
export declare class Lock extends Base {
|
|
9
|
+
protected lock: LockFunc;
|
|
10
|
+
lockAcquired: boolean;
|
|
11
|
+
protected pendingInLock: Promise<any>[];
|
|
12
|
+
protected storageKey: string;
|
|
13
|
+
constructor(options: LockOptions);
|
|
14
|
+
/**
|
|
15
|
+
* Acquires a global lock based on the storage key.
|
|
16
|
+
*/
|
|
17
|
+
_acquireLock<R>(acquireTimeout: number, fn: () => Promise<R>): Promise<R>;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provide your own global lock implementation instead of the default
|
|
3
|
+
* implementation. The function should acquire a lock for the duration of the
|
|
4
|
+
* `fn` async function, such that no other client instances will be able to
|
|
5
|
+
* hold it at the same time.
|
|
6
|
+
*
|
|
7
|
+
* @experimental
|
|
8
|
+
*
|
|
9
|
+
* @param name Name of the lock to be acquired.
|
|
10
|
+
* @param acquireTimeout If negative, no timeout should occur. If positive it
|
|
11
|
+
* should throw an Error with an `isAcquireTimeout`
|
|
12
|
+
* property set to true if the operation fails to be
|
|
13
|
+
* acquired after this much time (ms).
|
|
14
|
+
* @param fn The operation to execute when the lock is acquired.
|
|
15
|
+
*/
|
|
16
|
+
export type LockFunc = <R>(name: string, acquireTimeout: number, fn: () => Promise<R>) => Promise<R>;
|
|
17
|
+
/**
|
|
18
|
+
* @experimental
|
|
19
|
+
*/
|
|
20
|
+
export declare const internals: {
|
|
21
|
+
/**
|
|
22
|
+
* @experimental
|
|
23
|
+
*/
|
|
24
|
+
debug: boolean;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* An error thrown when a lock cannot be acquired after some amount of time.
|
|
28
|
+
*
|
|
29
|
+
* Use the {@link #isAcquireTimeout} property instead of checking with `instanceof`.
|
|
30
|
+
*/
|
|
31
|
+
export declare abstract class LockAcquireTimeoutError extends Error {
|
|
32
|
+
readonly isAcquireTimeout = true;
|
|
33
|
+
constructor(message: string);
|
|
34
|
+
}
|
|
35
|
+
export declare class NavigatorLockAcquireTimeoutError extends LockAcquireTimeoutError {
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Implements a global exclusive lock using the Navigator LockManager API. It
|
|
39
|
+
* is available on all browsers released after 2022-03-15 with Safari being the
|
|
40
|
+
* last one to release support. If the API is not available, this function will
|
|
41
|
+
* throw. Make sure you check availablility before configuring {@link
|
|
42
|
+
* GoTrueClient}.
|
|
43
|
+
*
|
|
44
|
+
* You can turn on debugging by setting the `supabase.gotrue-js.locks.debug`
|
|
45
|
+
* local storage item to `true`.
|
|
46
|
+
*
|
|
47
|
+
* Internals:
|
|
48
|
+
*
|
|
49
|
+
* Since the LockManager API does not preserve stack traces for the async
|
|
50
|
+
* function passed in the `request` method, a trick is used where acquiring the
|
|
51
|
+
* lock releases a previously started promise to run the operation in the `fn`
|
|
52
|
+
* function. The lock waits for that promise to finish (with or without error),
|
|
53
|
+
* while the function will finally wait for the result anyway.
|
|
54
|
+
*
|
|
55
|
+
* @param name Name of the lock to be acquired.
|
|
56
|
+
* @param acquireTimeout If negative, no timeout. If 0 an error is thrown if
|
|
57
|
+
* the lock can't be acquired without waiting. If positive, the lock acquire
|
|
58
|
+
* will time out after so many milliseconds. An error is
|
|
59
|
+
* a timeout if it has `isAcquireTimeout` set to true.
|
|
60
|
+
* @param fn The operation to run once the lock is acquired.
|
|
61
|
+
*/
|
|
62
|
+
export declare function navigatorLock<R>(name: string, acquireTimeout: number, fn: () => Promise<R>): Promise<R>;
|
|
63
|
+
export declare function lockNoOp<R>(name: string, acquireTimeout: number, fn: () => Promise<R>): Promise<R>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AuthenticationResult } from "./lib/types";
|
|
2
|
+
export declare const parseAuthenticationResult: (queryString: string) => AuthenticationResult;
|
|
3
|
+
export declare const createQueryParams: ({ clientId: client_id, ...params }: any) => string;
|
|
4
|
+
/**
|
|
5
|
+
* @ignore
|
|
6
|
+
*/
|
|
7
|
+
export declare const getTokenIssuer: (issuer: string | undefined, domainUrl: string) => string;
|
|
8
|
+
export declare const getDomain: (domainUrl: string) => string;
|
|
9
|
+
export declare const encode: (value: string) => string;
|
|
10
|
+
export declare const decode: (value: string) => string;
|
|
11
|
+
export declare const urlDecodeB64: (input: string) => string;
|
|
12
|
+
export declare const bufferToBase64UrlEncoded: (input: number[] | Uint8Array) => string;
|
|
13
|
+
export declare const parseNumber: (value: any) => number | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* @ignore
|
|
16
|
+
*/
|
|
17
|
+
export declare const buildIsAuthenticatedCookieName: (clientId: string) => string;
|
package/dist/faableauth.js
CHANGED