@auth0/auth0-spa-js 2.19.0 → 2.19.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.
Files changed (50) hide show
  1. package/dist/auth0-spa-js.development.js +38 -24
  2. package/dist/auth0-spa-js.development.js.map +1 -1
  3. package/dist/auth0-spa-js.production.esm.js +1 -1
  4. package/dist/auth0-spa-js.production.esm.js.map +1 -1
  5. package/dist/auth0-spa-js.production.js +1 -1
  6. package/dist/auth0-spa-js.production.js.map +1 -1
  7. package/dist/lib/auth0-spa-js.cjs.js +38 -24
  8. package/dist/lib/auth0-spa-js.cjs.js.map +1 -1
  9. package/dist/typings/Auth0Client.d.ts +476 -476
  10. package/dist/typings/Auth0Client.utils.d.ts +90 -90
  11. package/dist/typings/MyAccountApiClient.d.ts +92 -92
  12. package/dist/typings/TokenExchange.d.ts +77 -77
  13. package/dist/typings/api.d.ts +33 -33
  14. package/dist/typings/cache/cache-localstorage.d.ts +7 -7
  15. package/dist/typings/cache/cache-manager.d.ts +69 -69
  16. package/dist/typings/cache/cache-memory.d.ts +4 -4
  17. package/dist/typings/cache/index.d.ts +4 -4
  18. package/dist/typings/cache/key-manifest.d.ts +12 -12
  19. package/dist/typings/cache/shared.d.ts +68 -68
  20. package/dist/typings/constants.d.ts +58 -58
  21. package/dist/typings/dpop/dpop.d.ts +17 -17
  22. package/dist/typings/dpop/storage.d.ts +27 -27
  23. package/dist/typings/dpop/utils.d.ts +15 -15
  24. package/dist/typings/errors.d.ts +96 -96
  25. package/dist/typings/fetcher.d.ts +54 -54
  26. package/dist/typings/global.d.ts +826 -826
  27. package/dist/typings/http.d.ts +11 -11
  28. package/dist/typings/index.d.ts +24 -24
  29. package/dist/typings/jwt.d.ts +21 -21
  30. package/dist/typings/lock.d.ts +32 -32
  31. package/dist/typings/mfa/MfaApiClient.d.ts +225 -225
  32. package/dist/typings/mfa/MfaContextManager.d.ts +79 -79
  33. package/dist/typings/mfa/constants.d.ts +23 -23
  34. package/dist/typings/mfa/errors.d.ts +117 -117
  35. package/dist/typings/mfa/index.d.ts +4 -4
  36. package/dist/typings/mfa/types.d.ts +181 -181
  37. package/dist/typings/mfa/utils.d.ts +23 -23
  38. package/dist/typings/promise-utils.d.ts +2 -2
  39. package/dist/typings/scope.d.ts +35 -35
  40. package/dist/typings/storage.d.ts +26 -26
  41. package/dist/typings/transaction-manager.d.ts +33 -33
  42. package/dist/typings/utils.d.ts +36 -36
  43. package/dist/typings/version.d.ts +2 -2
  44. package/dist/typings/worker/token.worker.d.ts +1 -1
  45. package/dist/typings/worker/worker.types.d.ts +27 -27
  46. package/dist/typings/worker/worker.utils.d.ts +13 -13
  47. package/package.json +1 -1
  48. package/src/api.ts +15 -11
  49. package/src/cache/cache-manager.ts +28 -9
  50. package/src/version.ts +1 -1
@@ -1,96 +1,96 @@
1
- /**
2
- * MFA requirements from an mfa_required error response
3
- */
4
- export interface MfaRequirements {
5
- /** Required enrollment types */
6
- enroll?: Array<{
7
- type: string;
8
- }>;
9
- /** Required challenge types */
10
- challenge?: Array<{
11
- type: string;
12
- }>;
13
- }
14
- /**
15
- * Thrown when network requests to the Auth server fail.
16
- */
17
- export declare class GenericError extends Error {
18
- error: string;
19
- error_description: string;
20
- constructor(error: string, error_description: string);
21
- static fromPayload({ error, error_description }: {
22
- error: string;
23
- error_description: string;
24
- }): GenericError;
25
- }
26
- /**
27
- * Thrown when handling the redirect callback fails, will be one of Auth0's
28
- * Authentication API's Standard Error Responses: https://auth0.com/docs/api/authentication?javascript#standard-error-responses
29
- */
30
- export declare class AuthenticationError extends GenericError {
31
- state: string;
32
- appState: any;
33
- constructor(error: string, error_description: string, state: string, appState?: any);
34
- }
35
- /**
36
- * Thrown when handling the redirect callback for the connect flow fails, will be one of Auth0's
37
- * Authentication API's Standard Error Responses: https://auth0.com/docs/api/authentication?javascript#standard-error-responses
38
- */
39
- export declare class ConnectError extends GenericError {
40
- connection: string;
41
- state: string;
42
- appState: any;
43
- constructor(error: string, error_description: string, connection: string, state: string, appState?: any);
44
- }
45
- /**
46
- * Thrown when silent auth times out (usually due to a configuration issue) or
47
- * when network requests to the Auth server timeout.
48
- */
49
- export declare class TimeoutError extends GenericError {
50
- constructor();
51
- }
52
- /**
53
- * Error thrown when the login popup times out (if the user does not complete auth)
54
- */
55
- export declare class PopupTimeoutError extends TimeoutError {
56
- popup: Window;
57
- constructor(popup: Window);
58
- }
59
- export declare class PopupCancelledError extends GenericError {
60
- popup: Window;
61
- constructor(popup: Window);
62
- }
63
- export declare class PopupOpenError extends GenericError {
64
- constructor();
65
- }
66
- /**
67
- * Error thrown when the token exchange results in a `mfa_required` error
68
- */
69
- export declare class MfaRequiredError extends GenericError {
70
- mfa_token: string;
71
- mfa_requirements: MfaRequirements;
72
- constructor(error: string, error_description: string, mfa_token: string, mfa_requirements: MfaRequirements);
73
- }
74
- /**
75
- * Error thrown when there is no refresh token to use
76
- */
77
- export declare class MissingRefreshTokenError extends GenericError {
78
- audience: string;
79
- scope: string;
80
- constructor(audience: string, scope: string);
81
- }
82
- /**
83
- * Error thrown when there are missing scopes after refreshing a token
84
- */
85
- export declare class MissingScopesError extends GenericError {
86
- audience: string;
87
- scope: string;
88
- constructor(audience: string, scope: string);
89
- }
90
- /**
91
- * Error thrown when the wrong DPoP nonce is used and a potential subsequent retry wasn't able to fix it.
92
- */
93
- export declare class UseDpopNonceError extends GenericError {
94
- newDpopNonce: string | undefined;
95
- constructor(newDpopNonce: string | undefined);
96
- }
1
+ /**
2
+ * MFA requirements from an mfa_required error response
3
+ */
4
+ export interface MfaRequirements {
5
+ /** Required enrollment types */
6
+ enroll?: Array<{
7
+ type: string;
8
+ }>;
9
+ /** Required challenge types */
10
+ challenge?: Array<{
11
+ type: string;
12
+ }>;
13
+ }
14
+ /**
15
+ * Thrown when network requests to the Auth server fail.
16
+ */
17
+ export declare class GenericError extends Error {
18
+ error: string;
19
+ error_description: string;
20
+ constructor(error: string, error_description: string);
21
+ static fromPayload({ error, error_description }: {
22
+ error: string;
23
+ error_description: string;
24
+ }): GenericError;
25
+ }
26
+ /**
27
+ * Thrown when handling the redirect callback fails, will be one of Auth0's
28
+ * Authentication API's Standard Error Responses: https://auth0.com/docs/api/authentication?javascript#standard-error-responses
29
+ */
30
+ export declare class AuthenticationError extends GenericError {
31
+ state: string;
32
+ appState: any;
33
+ constructor(error: string, error_description: string, state: string, appState?: any);
34
+ }
35
+ /**
36
+ * Thrown when handling the redirect callback for the connect flow fails, will be one of Auth0's
37
+ * Authentication API's Standard Error Responses: https://auth0.com/docs/api/authentication?javascript#standard-error-responses
38
+ */
39
+ export declare class ConnectError extends GenericError {
40
+ connection: string;
41
+ state: string;
42
+ appState: any;
43
+ constructor(error: string, error_description: string, connection: string, state: string, appState?: any);
44
+ }
45
+ /**
46
+ * Thrown when silent auth times out (usually due to a configuration issue) or
47
+ * when network requests to the Auth server timeout.
48
+ */
49
+ export declare class TimeoutError extends GenericError {
50
+ constructor();
51
+ }
52
+ /**
53
+ * Error thrown when the login popup times out (if the user does not complete auth)
54
+ */
55
+ export declare class PopupTimeoutError extends TimeoutError {
56
+ popup: Window;
57
+ constructor(popup: Window);
58
+ }
59
+ export declare class PopupCancelledError extends GenericError {
60
+ popup: Window;
61
+ constructor(popup: Window);
62
+ }
63
+ export declare class PopupOpenError extends GenericError {
64
+ constructor();
65
+ }
66
+ /**
67
+ * Error thrown when the token exchange results in a `mfa_required` error
68
+ */
69
+ export declare class MfaRequiredError extends GenericError {
70
+ mfa_token: string;
71
+ mfa_requirements: MfaRequirements;
72
+ constructor(error: string, error_description: string, mfa_token: string, mfa_requirements: MfaRequirements);
73
+ }
74
+ /**
75
+ * Error thrown when there is no refresh token to use
76
+ */
77
+ export declare class MissingRefreshTokenError extends GenericError {
78
+ audience: string;
79
+ scope: string;
80
+ constructor(audience: string, scope: string);
81
+ }
82
+ /**
83
+ * Error thrown when there are missing scopes after refreshing a token
84
+ */
85
+ export declare class MissingScopesError extends GenericError {
86
+ audience: string;
87
+ scope: string;
88
+ constructor(audience: string, scope: string);
89
+ }
90
+ /**
91
+ * Error thrown when the wrong DPoP nonce is used and a potential subsequent retry wasn't able to fix it.
92
+ */
93
+ export declare class UseDpopNonceError extends GenericError {
94
+ newDpopNonce: string | undefined;
95
+ constructor(newDpopNonce: string | undefined);
96
+ }
@@ -1,54 +1,54 @@
1
- import { GetTokenSilentlyVerboseResponse } from './global';
2
- export type ResponseHeaders = Record<string, string | null | undefined> | [string, string][] | {
3
- get(name: string): string | null | undefined;
4
- };
5
- export type CustomFetchMinimalOutput = {
6
- status: number;
7
- headers: ResponseHeaders;
8
- };
9
- export type CustomFetchImpl<TOutput extends CustomFetchMinimalOutput> = (req: Request) => Promise<TOutput>;
10
- export type AuthParams = {
11
- scope?: string[];
12
- audience?: string;
13
- };
14
- type AccessTokenFactory = (authParams?: AuthParams) => Promise<string | GetTokenSilentlyVerboseResponse>;
15
- export type FetcherConfig<TOutput extends CustomFetchMinimalOutput> = {
16
- getAccessToken?: AccessTokenFactory;
17
- baseUrl?: string;
18
- fetch?: CustomFetchImpl<TOutput>;
19
- dpopNonceId?: string;
20
- };
21
- export type FetcherHooks = {
22
- isDpopEnabled: () => boolean;
23
- getAccessToken: AccessTokenFactory;
24
- getDpopNonce: () => Promise<string | undefined>;
25
- setDpopNonce: (nonce: string) => Promise<void>;
26
- generateDpopProof: (params: {
27
- url: string;
28
- method: string;
29
- nonce?: string;
30
- accessToken: string;
31
- }) => Promise<string>;
32
- };
33
- export type FetchWithAuthCallbacks<TOutput> = {
34
- onUseDpopNonceError?(): Promise<TOutput>;
35
- };
36
- export declare class Fetcher<TOutput extends CustomFetchMinimalOutput> {
37
- protected readonly config: Omit<FetcherConfig<TOutput>, 'fetch'> & Required<Pick<FetcherConfig<TOutput>, 'fetch'>>;
38
- protected readonly hooks: FetcherHooks;
39
- constructor(config: FetcherConfig<TOutput>, hooks: FetcherHooks);
40
- protected isAbsoluteUrl(url: string): boolean;
41
- protected buildUrl(baseUrl: string | undefined, url: string | undefined): string;
42
- protected getAccessToken(authParams?: AuthParams): Promise<string | GetTokenSilentlyVerboseResponse>;
43
- protected extractUrl(info: RequestInfo | URL): string;
44
- protected buildBaseRequest(info: RequestInfo | URL, init: RequestInit | undefined): Request;
45
- protected setAuthorizationHeader(request: Request, accessToken: string, tokenType?: string): void;
46
- protected setDpopProofHeader(request: Request, accessToken: string): Promise<void>;
47
- protected prepareRequest(request: Request, authParams?: AuthParams): Promise<void>;
48
- protected getHeader(headers: ResponseHeaders, name: string): string;
49
- protected hasUseDpopNonceError(response: TOutput): boolean;
50
- protected handleResponse(response: TOutput, callbacks: FetchWithAuthCallbacks<TOutput>): Promise<TOutput>;
51
- protected internalFetchWithAuth(info: RequestInfo | URL, init: RequestInit | undefined, callbacks: FetchWithAuthCallbacks<TOutput>, authParams?: AuthParams): Promise<TOutput>;
52
- fetchWithAuth(info: RequestInfo | URL, init?: RequestInit, authParams?: AuthParams): Promise<TOutput>;
53
- }
54
- export {};
1
+ import { GetTokenSilentlyVerboseResponse } from './global';
2
+ export type ResponseHeaders = Record<string, string | null | undefined> | [string, string][] | {
3
+ get(name: string): string | null | undefined;
4
+ };
5
+ export type CustomFetchMinimalOutput = {
6
+ status: number;
7
+ headers: ResponseHeaders;
8
+ };
9
+ export type CustomFetchImpl<TOutput extends CustomFetchMinimalOutput> = (req: Request) => Promise<TOutput>;
10
+ export type AuthParams = {
11
+ scope?: string[];
12
+ audience?: string;
13
+ };
14
+ type AccessTokenFactory = (authParams?: AuthParams) => Promise<string | GetTokenSilentlyVerboseResponse>;
15
+ export type FetcherConfig<TOutput extends CustomFetchMinimalOutput> = {
16
+ getAccessToken?: AccessTokenFactory;
17
+ baseUrl?: string;
18
+ fetch?: CustomFetchImpl<TOutput>;
19
+ dpopNonceId?: string;
20
+ };
21
+ export type FetcherHooks = {
22
+ isDpopEnabled: () => boolean;
23
+ getAccessToken: AccessTokenFactory;
24
+ getDpopNonce: () => Promise<string | undefined>;
25
+ setDpopNonce: (nonce: string) => Promise<void>;
26
+ generateDpopProof: (params: {
27
+ url: string;
28
+ method: string;
29
+ nonce?: string;
30
+ accessToken: string;
31
+ }) => Promise<string>;
32
+ };
33
+ export type FetchWithAuthCallbacks<TOutput> = {
34
+ onUseDpopNonceError?(): Promise<TOutput>;
35
+ };
36
+ export declare class Fetcher<TOutput extends CustomFetchMinimalOutput> {
37
+ protected readonly config: Omit<FetcherConfig<TOutput>, 'fetch'> & Required<Pick<FetcherConfig<TOutput>, 'fetch'>>;
38
+ protected readonly hooks: FetcherHooks;
39
+ constructor(config: FetcherConfig<TOutput>, hooks: FetcherHooks);
40
+ protected isAbsoluteUrl(url: string): boolean;
41
+ protected buildUrl(baseUrl: string | undefined, url: string | undefined): string;
42
+ protected getAccessToken(authParams?: AuthParams): Promise<string | GetTokenSilentlyVerboseResponse>;
43
+ protected extractUrl(info: RequestInfo | URL): string;
44
+ protected buildBaseRequest(info: RequestInfo | URL, init: RequestInit | undefined): Request;
45
+ protected setAuthorizationHeader(request: Request, accessToken: string, tokenType?: string): void;
46
+ protected setDpopProofHeader(request: Request, accessToken: string): Promise<void>;
47
+ protected prepareRequest(request: Request, authParams?: AuthParams): Promise<void>;
48
+ protected getHeader(headers: ResponseHeaders, name: string): string;
49
+ protected hasUseDpopNonceError(response: TOutput): boolean;
50
+ protected handleResponse(response: TOutput, callbacks: FetchWithAuthCallbacks<TOutput>): Promise<TOutput>;
51
+ protected internalFetchWithAuth(info: RequestInfo | URL, init: RequestInit | undefined, callbacks: FetchWithAuthCallbacks<TOutput>, authParams?: AuthParams): Promise<TOutput>;
52
+ fetchWithAuth(info: RequestInfo | URL, init?: RequestInit, authParams?: AuthParams): Promise<TOutput>;
53
+ }
54
+ export {};