@aws-amplify/core 6.0.1-console-preview.7739091.0 → 6.0.1-console-preview.047a1dd.0
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/lib/AwsClients/CognitoIdentity/base.d.ts +12 -4
- package/lib/AwsClients/CognitoIdentity/base.js +1 -0
- package/lib/AwsClients/CognitoIdentity/getCredentialsForIdentity.d.ts +15 -3
- package/lib/AwsClients/CognitoIdentity/getId.d.ts +15 -3
- package/lib/AwsClients/Pinpoint/base.d.ts +10 -2
- package/lib/AwsClients/Pinpoint/getInAppMessages.d.ts +17 -3
- package/lib/AwsClients/Pinpoint/putEvents.d.ts +17 -3
- package/lib/AwsClients/Pinpoint/updateEndpoint.d.ts +17 -3
- package/lib/Platform/version.d.ts +1 -1
- package/lib/Platform/version.js +1 -1
- package/lib/clients/handlers/authenticated.d.ts +1 -1
- package/lib/clients/handlers/fetch.js +2 -1
- package/lib/clients/handlers/unauthenticated.d.ts +1 -1
- package/lib/clients/internal/composeServiceApi.d.ts +5 -3
- package/lib/clients/types/aws.d.ts +1 -5
- package/lib/clients/types/http.d.ts +8 -0
- package/lib/clients/types/index.d.ts +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +1 -3
- package/lib/libraryUtils.d.ts +2 -1
- package/lib/libraryUtils.js +4 -6
- package/lib/providers/pinpoint/types/buffer.d.ts +1 -1
- package/lib/providers/pinpoint/types/pinpoint.d.ts +1 -1
- package/lib/providers/pinpoint/utils/PinpointEventBuffer.js +7 -5
- package/lib/providers/pinpoint/utils/isAppInForeground.d.ts +1 -0
- package/lib/{RNComponents → providers/pinpoint/utils}/isAppInForeground.js +1 -4
- package/lib/providers/pinpoint/utils/isAppInForeground.native.d.ts +1 -0
- package/lib/providers/pinpoint/utils/isAppInForeground.native.js +9 -0
- package/lib/singleton/Amplify.d.ts +2 -2
- package/lib/singleton/Amplify.js +9 -1
- package/lib/singleton/Auth/index.d.ts +2 -1
- package/lib/singleton/Auth/index.js +22 -12
- package/lib/singleton/Auth/utils/index.js +3 -3
- package/lib/singleton/types.d.ts +6 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib-esm/AwsClients/CognitoIdentity/base.d.ts +12 -4
- package/lib-esm/AwsClients/CognitoIdentity/base.js +1 -0
- package/lib-esm/AwsClients/CognitoIdentity/getCredentialsForIdentity.d.ts +15 -3
- package/lib-esm/AwsClients/CognitoIdentity/getId.d.ts +15 -3
- package/lib-esm/AwsClients/Pinpoint/base.d.ts +10 -2
- package/lib-esm/AwsClients/Pinpoint/getInAppMessages.d.ts +17 -3
- package/lib-esm/AwsClients/Pinpoint/putEvents.d.ts +17 -3
- package/lib-esm/AwsClients/Pinpoint/updateEndpoint.d.ts +17 -3
- package/lib-esm/Platform/version.d.ts +1 -1
- package/lib-esm/Platform/version.js +1 -1
- package/lib-esm/clients/handlers/authenticated.d.ts +1 -1
- package/lib-esm/clients/handlers/fetch.js +2 -1
- package/lib-esm/clients/handlers/unauthenticated.d.ts +1 -1
- package/lib-esm/clients/internal/composeServiceApi.d.ts +5 -3
- package/lib-esm/clients/types/aws.d.ts +1 -5
- package/lib-esm/clients/types/http.d.ts +8 -0
- package/lib-esm/clients/types/index.d.ts +1 -1
- package/lib-esm/index.d.ts +0 -1
- package/lib-esm/index.js +0 -1
- package/lib-esm/libraryUtils.d.ts +2 -1
- package/lib-esm/libraryUtils.js +1 -1
- package/lib-esm/providers/pinpoint/types/buffer.d.ts +1 -1
- package/lib-esm/providers/pinpoint/types/pinpoint.d.ts +1 -1
- package/lib-esm/providers/pinpoint/utils/PinpointEventBuffer.js +7 -5
- package/lib-esm/providers/pinpoint/utils/isAppInForeground.js +3 -0
- package/lib-esm/providers/pinpoint/utils/isAppInForeground.native.js +5 -0
- package/lib-esm/singleton/Amplify.d.ts +2 -2
- package/lib-esm/singleton/Amplify.js +9 -1
- package/lib-esm/singleton/Auth/index.d.ts +2 -1
- package/lib-esm/singleton/Auth/index.js +22 -12
- package/lib-esm/singleton/Auth/utils/index.js +3 -3
- package/lib-esm/singleton/types.d.ts +6 -0
- package/lib-esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -3
- package/src/AwsClients/CognitoIdentity/base.ts +2 -2
- package/src/AwsClients/Pinpoint/base.ts +2 -6
- package/src/Platform/version.ts +1 -1
- package/src/clients/handlers/authenticated.ts +2 -1
- package/src/clients/handlers/fetch.ts +2 -1
- package/src/clients/handlers/unauthenticated.ts +2 -1
- package/src/clients/internal/composeServiceApi.ts +10 -3
- package/src/clients/types/aws.ts +4 -11
- package/src/clients/types/http.ts +8 -0
- package/src/clients/types/index.ts +0 -1
- package/src/index.ts +0 -2
- package/src/libraryUtils.ts +2 -2
- package/src/providers/pinpoint/types/buffer.ts +1 -1
- package/src/providers/pinpoint/types/pinpoint.ts +1 -1
- package/src/providers/pinpoint/utils/PinpointEventBuffer.ts +16 -12
- package/src/providers/pinpoint/utils/isAppInForeground.native.ts +7 -0
- package/src/providers/pinpoint/utils/isAppInForeground.ts +4 -0
- package/src/singleton/Amplify.ts +12 -3
- package/src/singleton/Auth/index.ts +9 -2
- package/src/singleton/Auth/utils/index.ts +3 -3
- package/src/singleton/types.ts +7 -0
- package/lib/RNComponents/index.d.ts +0 -6
- package/lib/RNComponents/index.js +0 -16
- package/lib/RNComponents/reactnative.d.ts +0 -3
- package/lib/RNComponents/reactnative.js +0 -14
- package/lib-esm/RNComponents/index.d.ts +0 -6
- package/lib-esm/RNComponents/index.js +0 -13
- package/lib-esm/RNComponents/isAppInForeground.js +0 -6
- package/lib-esm/RNComponents/reactnative.d.ts +0 -3
- package/lib-esm/RNComponents/reactnative.js +0 -6
- package/src/RNComponents/index.ts +0 -16
- package/src/RNComponents/isAppInForeground.ts +0 -8
- package/src/RNComponents/reactnative.ts +0 -6
- /package/lib-esm/{RNComponents → providers/pinpoint/utils}/isAppInForeground.d.ts +0 -0
- /package/{lib/RNComponents/isAppInForeground.d.ts → lib-esm/providers/pinpoint/utils/isAppInForeground.native.d.ts} +0 -0
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
import { Endpoint, Headers, HttpRequest, HttpResponse } from '../../clients';
|
|
2
|
-
import { DefaultConfigOptions } from '../../clients/types';
|
|
1
|
+
import { Endpoint, EndpointResolverOptions, Headers, HttpRequest, HttpResponse } from '../../clients';
|
|
3
2
|
/**
|
|
4
3
|
* A Cognito Identity-specific transfer handler that does NOT sign requests, and
|
|
5
4
|
* disables caching.
|
|
6
5
|
*
|
|
7
6
|
* @internal
|
|
8
7
|
*/
|
|
9
|
-
export declare const cognitoIdentityTransferHandler: (request: HttpRequest, options: import("../../clients").UserAgentOptions & import("../../clients").RetryOptions<HttpResponse>) => Promise<HttpResponse>;
|
|
8
|
+
export declare const cognitoIdentityTransferHandler: (request: HttpRequest, options: import("../../clients").UserAgentOptions & import("../../clients").RetryOptions<HttpResponse> & import("../../clients").HttpTransferOptions) => Promise<HttpResponse>;
|
|
10
9
|
/**
|
|
11
10
|
* @internal
|
|
12
11
|
*/
|
|
13
|
-
export declare const defaultConfig:
|
|
12
|
+
export declare const defaultConfig: {
|
|
13
|
+
service: string;
|
|
14
|
+
endpointResolver: ({ region }: EndpointResolverOptions) => {
|
|
15
|
+
url: URL;
|
|
16
|
+
};
|
|
17
|
+
retryDecider: (response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>;
|
|
18
|
+
computeDelay: (attempt: number) => number;
|
|
19
|
+
userAgentValue: string;
|
|
20
|
+
cache: string;
|
|
21
|
+
};
|
|
14
22
|
/**
|
|
15
23
|
* @internal
|
|
16
24
|
*/
|
|
@@ -86,6 +86,7 @@ exports.defaultConfig = {
|
|
|
86
86
|
retryDecider: (0, retry_1.getRetryDecider)(clients_1.parseJsonError),
|
|
87
87
|
computeDelay: retry_1.jitteredBackoff,
|
|
88
88
|
userAgentValue: (0, Platform_1.getAmplifyUserAgent)(),
|
|
89
|
+
cache: 'no-store',
|
|
89
90
|
};
|
|
90
91
|
(0, detectFramework_1.observeFrameworkChanges)(function () {
|
|
91
92
|
exports.defaultConfig.userAgentValue = (0, Platform_1.getAmplifyUserAgent)();
|
|
@@ -1,9 +1,21 @@
|
|
|
1
|
-
import { HttpResponse } from '../../clients';
|
|
1
|
+
import { Endpoint, HttpResponse } from '../../clients';
|
|
2
2
|
import type { GetCredentialsForIdentityCommandInput as GetCredentialsForIdentityInput, GetCredentialsForIdentityCommandOutput as GetCredentialsForIdentityOutput } from './types';
|
|
3
3
|
export type { GetCredentialsForIdentityInput, GetCredentialsForIdentityOutput };
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
7
|
-
export declare const getCredentialsForIdentity: (config:
|
|
8
|
-
|
|
7
|
+
export declare const getCredentialsForIdentity: (config: {
|
|
8
|
+
service?: string | undefined;
|
|
9
|
+
endpointResolver?: (((options: import("../../clients").EndpointResolverOptions, input?: any) => Endpoint) & (({ region }: import("../../clients").EndpointResolverOptions) => {
|
|
10
|
+
url: URL;
|
|
11
|
+
})) | undefined;
|
|
12
|
+
retryDecider?: (((response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>) & ((response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>)) | undefined;
|
|
13
|
+
computeDelay?: ((attempt: number) => number) | undefined;
|
|
14
|
+
userAgentValue?: string | undefined;
|
|
15
|
+
cache?: "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload" | undefined;
|
|
16
|
+
} & {
|
|
17
|
+
region: string;
|
|
18
|
+
abortSignal?: AbortSignal | undefined;
|
|
19
|
+
maxAttempts?: number | undefined;
|
|
20
|
+
userAgentHeader?: string | undefined;
|
|
9
21
|
}, input: GetCredentialsForIdentityInput) => Promise<GetCredentialsForIdentityOutput>;
|
|
@@ -1,9 +1,21 @@
|
|
|
1
|
-
import { HttpResponse } from '../../clients';
|
|
1
|
+
import { Endpoint, HttpResponse } from '../../clients';
|
|
2
2
|
import { GetIdCommandInput as GetIdInput, GetIdCommandOutput as GetIdOutput } from './types';
|
|
3
3
|
export type { GetIdInput, GetIdOutput };
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
7
|
-
export declare const getId: (config:
|
|
8
|
-
|
|
7
|
+
export declare const getId: (config: {
|
|
8
|
+
service?: string | undefined;
|
|
9
|
+
endpointResolver?: (((options: import("../../clients").EndpointResolverOptions, input?: any) => Endpoint) & (({ region }: import("../../clients").EndpointResolverOptions) => {
|
|
10
|
+
url: URL;
|
|
11
|
+
})) | undefined;
|
|
12
|
+
retryDecider?: (((response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>) & ((response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>)) | undefined;
|
|
13
|
+
computeDelay?: ((attempt: number) => number) | undefined;
|
|
14
|
+
userAgentValue?: string | undefined;
|
|
15
|
+
cache?: "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload" | undefined;
|
|
16
|
+
} & {
|
|
17
|
+
region: string;
|
|
18
|
+
abortSignal?: AbortSignal | undefined;
|
|
19
|
+
maxAttempts?: number | undefined;
|
|
20
|
+
userAgentHeader?: string | undefined;
|
|
9
21
|
}, input: GetIdInput) => Promise<GetIdOutput>;
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { EndpointResolverOptions, Headers } from '../../clients/types';
|
|
2
2
|
/**
|
|
3
3
|
* @internal
|
|
4
4
|
*/
|
|
5
|
-
export declare const defaultConfig:
|
|
5
|
+
export declare const defaultConfig: {
|
|
6
|
+
service: string;
|
|
7
|
+
endpointResolver: ({ region }: EndpointResolverOptions) => {
|
|
8
|
+
url: URL;
|
|
9
|
+
};
|
|
10
|
+
retryDecider: (response?: import("../../clients/types").HttpResponse | undefined, error?: unknown) => Promise<boolean>;
|
|
11
|
+
computeDelay: (attempt: number) => number;
|
|
12
|
+
userAgentValue: string;
|
|
13
|
+
};
|
|
6
14
|
/**
|
|
7
15
|
* @internal
|
|
8
16
|
*/
|
|
@@ -1,9 +1,23 @@
|
|
|
1
|
-
import { HttpResponse } from '../../clients/types';
|
|
1
|
+
import { Endpoint, HttpResponse } from '../../clients/types';
|
|
2
2
|
import type { GetInAppMessagesCommandInput as GetInAppMessagesInput, GetInAppMessagesCommandOutput as GetInAppMessagesOutput } from './types';
|
|
3
3
|
export type { GetInAppMessagesInput, GetInAppMessagesOutput };
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
7
|
-
export declare const getInAppMessages: (config:
|
|
8
|
-
|
|
7
|
+
export declare const getInAppMessages: (config: {
|
|
8
|
+
service?: string | undefined;
|
|
9
|
+
endpointResolver?: (((options: import("../../clients/types").EndpointResolverOptions, input?: any) => Endpoint) & (({ region }: import("../../clients/types").EndpointResolverOptions) => {
|
|
10
|
+
url: URL;
|
|
11
|
+
})) | undefined;
|
|
12
|
+
retryDecider?: (((response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>) & ((response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>)) | undefined;
|
|
13
|
+
computeDelay?: ((attempt: number) => number) | undefined;
|
|
14
|
+
userAgentValue?: string | undefined;
|
|
15
|
+
} & {
|
|
16
|
+
uriEscapePath?: boolean | undefined;
|
|
17
|
+
credentials: import("@smithy/types/dist-types/identity/awsCredentialIdentity").AwsCredentialIdentity | (() => Promise<import("@smithy/types/dist-types/identity/awsCredentialIdentity").AwsCredentialIdentity>);
|
|
18
|
+
region: string;
|
|
19
|
+
abortSignal?: AbortSignal | undefined;
|
|
20
|
+
cache?: RequestCache | undefined;
|
|
21
|
+
maxAttempts?: number | undefined;
|
|
22
|
+
userAgentHeader?: string | undefined;
|
|
9
23
|
}, input: GetInAppMessagesInput) => Promise<GetInAppMessagesOutput>;
|
|
@@ -1,9 +1,23 @@
|
|
|
1
|
-
import { HttpResponse } from '../../clients/types';
|
|
1
|
+
import { Endpoint, HttpResponse } from '../../clients/types';
|
|
2
2
|
import type { PutEventsCommandInput as PutEventsInput, PutEventsCommandOutput as PutEventsOutput } from './types';
|
|
3
3
|
export type { PutEventsInput, PutEventsOutput };
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
7
|
-
export declare const putEvents: (config:
|
|
8
|
-
|
|
7
|
+
export declare const putEvents: (config: {
|
|
8
|
+
service?: string | undefined;
|
|
9
|
+
endpointResolver?: (((options: import("../../clients/types").EndpointResolverOptions, input?: any) => Endpoint) & (({ region }: import("../../clients/types").EndpointResolverOptions) => {
|
|
10
|
+
url: URL;
|
|
11
|
+
})) | undefined;
|
|
12
|
+
retryDecider?: (((response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>) & ((response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>)) | undefined;
|
|
13
|
+
computeDelay?: ((attempt: number) => number) | undefined;
|
|
14
|
+
userAgentValue?: string | undefined;
|
|
15
|
+
} & {
|
|
16
|
+
uriEscapePath?: boolean | undefined;
|
|
17
|
+
credentials: import("@smithy/types/dist-types/identity/awsCredentialIdentity").AwsCredentialIdentity | (() => Promise<import("@smithy/types/dist-types/identity/awsCredentialIdentity").AwsCredentialIdentity>);
|
|
18
|
+
region: string;
|
|
19
|
+
abortSignal?: AbortSignal | undefined;
|
|
20
|
+
cache?: RequestCache | undefined;
|
|
21
|
+
maxAttempts?: number | undefined;
|
|
22
|
+
userAgentHeader?: string | undefined;
|
|
9
23
|
}, input: PutEventsInput) => Promise<PutEventsOutput>;
|
|
@@ -1,9 +1,23 @@
|
|
|
1
|
-
import { HttpResponse } from '../../clients/types';
|
|
1
|
+
import { Endpoint, HttpResponse } from '../../clients/types';
|
|
2
2
|
import type { UpdateEndpointCommandInput as UpdateEndpointInput, UpdateEndpointCommandOutput as UpdateEndpointOutput } from './types';
|
|
3
3
|
export type { UpdateEndpointInput, UpdateEndpointOutput };
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
7
|
-
export declare const updateEndpoint: (config:
|
|
8
|
-
|
|
7
|
+
export declare const updateEndpoint: (config: {
|
|
8
|
+
service?: string | undefined;
|
|
9
|
+
endpointResolver?: (((options: import("../../clients/types").EndpointResolverOptions, input?: any) => Endpoint) & (({ region }: import("../../clients/types").EndpointResolverOptions) => {
|
|
10
|
+
url: URL;
|
|
11
|
+
})) | undefined;
|
|
12
|
+
retryDecider?: (((response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>) & ((response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>)) | undefined;
|
|
13
|
+
computeDelay?: ((attempt: number) => number) | undefined;
|
|
14
|
+
userAgentValue?: string | undefined;
|
|
15
|
+
} & {
|
|
16
|
+
uriEscapePath?: boolean | undefined;
|
|
17
|
+
credentials: import("@smithy/types/dist-types/identity/awsCredentialIdentity").AwsCredentialIdentity | (() => Promise<import("@smithy/types/dist-types/identity/awsCredentialIdentity").AwsCredentialIdentity>);
|
|
18
|
+
region: string;
|
|
19
|
+
abortSignal?: AbortSignal | undefined;
|
|
20
|
+
cache?: RequestCache | undefined;
|
|
21
|
+
maxAttempts?: number | undefined;
|
|
22
|
+
userAgentHeader?: string | undefined;
|
|
9
23
|
}, input: UpdateEndpointInput) => Promise<UpdateEndpointOutput>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "6.0.1-console-preview.
|
|
1
|
+
export declare const version = "6.0.1-console-preview.047a1dd.0+047a1dd";
|
package/lib/Platform/version.js
CHANGED
|
@@ -2,4 +2,4 @@ import { RetryOptions } from '../middleware/retry';
|
|
|
2
2
|
import { SigningOptions } from '../middleware/signing';
|
|
3
3
|
import { UserAgentOptions } from '../middleware/userAgent';
|
|
4
4
|
import { HttpRequest, HttpResponse } from '../types';
|
|
5
|
-
export declare const authenticatedHandler: (request: HttpRequest, options: UserAgentOptions & RetryOptions<HttpResponse> & SigningOptions) => Promise<HttpResponse>;
|
|
5
|
+
export declare const authenticatedHandler: (request: HttpRequest, options: UserAgentOptions & RetryOptions<HttpResponse> & SigningOptions & import("../types").HttpTransferOptions) => Promise<HttpResponse>;
|
|
@@ -57,7 +57,7 @@ var shouldSendBody = function (method) {
|
|
|
57
57
|
// TODO[AllanZhengYP]: we need to provide isCanceledError utility
|
|
58
58
|
var fetchTransferHandler = function (_a, _b) {
|
|
59
59
|
var url = _a.url, method = _a.method, headers = _a.headers, body = _a.body;
|
|
60
|
-
var abortSignal = _b.abortSignal;
|
|
60
|
+
var abortSignal = _b.abortSignal, cache = _b.cache;
|
|
61
61
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
62
62
|
var resp, e_1, responseHeaders, httpResponse, bodyWithMixin;
|
|
63
63
|
var _c, _d;
|
|
@@ -70,6 +70,7 @@ var fetchTransferHandler = function (_a, _b) {
|
|
|
70
70
|
headers: headers,
|
|
71
71
|
body: shouldSendBody(method) ? body : undefined,
|
|
72
72
|
signal: abortSignal,
|
|
73
|
+
cache: cache,
|
|
73
74
|
})];
|
|
74
75
|
case 1:
|
|
75
76
|
resp = _e.sent();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { RetryOptions } from '../middleware/retry';
|
|
2
2
|
import { UserAgentOptions } from '../middleware/userAgent';
|
|
3
3
|
import { HttpRequest, HttpResponse } from '../types';
|
|
4
|
-
export declare const unauthenticatedHandler: (request: HttpRequest, options: UserAgentOptions & RetryOptions<HttpResponse>) => Promise<HttpResponse>;
|
|
4
|
+
export declare const unauthenticatedHandler: (request: HttpRequest, options: UserAgentOptions & RetryOptions<HttpResponse> & import("../types").HttpTransferOptions) => Promise<HttpResponse>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { ServiceClientOptions } from '../types/aws';
|
|
2
2
|
import { TransferHandler, Endpoint } from '../types/core';
|
|
3
3
|
import { HttpRequest, HttpResponse } from '../types/http';
|
|
4
|
-
export declare const composeServiceApi: <TransferHandlerOptions, Input, Output, DefaultConfig>(transferHandler: TransferHandler<HttpRequest, HttpResponse, TransferHandlerOptions>, serializer: (input: Input, endpoint: Endpoint) => Promise<HttpRequest> | HttpRequest, deserializer: (output: HttpResponse) => Promise<Output>, defaultConfig: Partial<DefaultConfig>) => (config: OptionalizeKey<TransferHandlerOptions & ServiceClientOptions & Partial<DefaultConfig> & InferEndpointResolverOptionType<DefaultConfig>,
|
|
5
|
-
type OptionalizeKey<
|
|
6
|
-
[
|
|
4
|
+
export declare const composeServiceApi: <TransferHandlerOptions, Input, Output, DefaultConfig>(transferHandler: TransferHandler<HttpRequest, HttpResponse, TransferHandlerOptions>, serializer: (input: Input, endpoint: Endpoint) => Promise<HttpRequest> | HttpRequest, deserializer: (output: HttpResponse) => Promise<Output>, defaultConfig: Partial<DefaultConfig>) => (config: OptionalizeKey<TransferHandlerOptions & ServiceClientOptions & Partial<DefaultConfig> & InferEndpointResolverOptionType<DefaultConfig>, DefaultConfig>, input: Input) => Promise<Output>;
|
|
5
|
+
type OptionalizeKey<InputType, InputDefaultsType> = {
|
|
6
|
+
[KeyWithDefaultValue in keyof InputDefaultsType]?: KeyWithDefaultValue extends keyof InputType ? InputType[KeyWithDefaultValue] : never;
|
|
7
|
+
} & {
|
|
8
|
+
[KeyWithoutDefaultValue in keyof Omit<InputType, keyof InputDefaultsType>]: InputType[KeyWithoutDefaultValue];
|
|
7
9
|
};
|
|
8
10
|
type InferEndpointResolverOptionType<T> = T extends {
|
|
9
11
|
endpointResolver: (options: infer EndpointOptions) => any;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MetadataBearer } from '@aws-sdk/types';
|
|
2
2
|
import { Endpoint } from './core';
|
|
3
3
|
import { HttpResponse } from './http';
|
|
4
|
-
export type { Credentials, MetadataBearer } from '@aws-sdk/types';
|
|
4
|
+
export type { AwsCredentialIdentity as Credentials, MetadataBearer, } from '@aws-sdk/types';
|
|
5
5
|
export type SourceData = string | ArrayBuffer | ArrayBufferView;
|
|
6
6
|
/**
|
|
7
7
|
* Basic option type for endpoint resolvers. It contains region only.
|
|
@@ -18,7 +18,3 @@ export interface ServiceClientOptions {
|
|
|
18
18
|
* This function is protocol-specific (e.g. JSON, XML, etc.)
|
|
19
19
|
*/
|
|
20
20
|
export type ErrorParser = (response?: HttpResponse) => Promise<(Error & MetadataBearer) | undefined>;
|
|
21
|
-
/**
|
|
22
|
-
* Default config options for the `composeServiceApi`.
|
|
23
|
-
*/
|
|
24
|
-
export type DefaultConfigOptions<TransferHandlerOptions extends Record<string, unknown> = Record<string, unknown>> = Partial<TransferHandlerOptions & ServiceClientOptions>;
|
|
@@ -26,5 +26,13 @@ export interface HttpResponse extends Response {
|
|
|
26
26
|
}
|
|
27
27
|
export interface HttpTransferOptions {
|
|
28
28
|
abortSignal?: AbortSignal;
|
|
29
|
+
/**
|
|
30
|
+
* Cache mode for the request. Note that this is only effective when the underlying HTTP handler is fetch.
|
|
31
|
+
* For XHR handler, or Node.js `"http(s)"` module or running on React Native, this option is ignored.
|
|
32
|
+
* Instead, you can configure the `Cache-Control` headers to achieve similar effects.
|
|
33
|
+
* @default 'default'
|
|
34
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Request/cache}
|
|
35
|
+
*/
|
|
36
|
+
cache?: RequestCache;
|
|
29
37
|
}
|
|
30
38
|
export type HttpTransferHandler = TransferHandler<HttpRequest, HttpResponse, HttpTransferOptions>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { Middleware, MiddlewareHandler, Request, Response, TransferHandler, Endpoint, } from './core';
|
|
2
2
|
export { Headers, HttpRequest, HttpResponse, HttpTransferHandler, HttpTransferOptions, ResponseBodyMixin, } from './http';
|
|
3
|
-
export { Credentials, EndpointResolverOptions, ErrorParser, ServiceClientOptions,
|
|
3
|
+
export { Credentials, EndpointResolverOptions, ErrorParser, ServiceClientOptions, } from './aws';
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.
|
|
5
|
+
exports.I18n = exports.Cache = exports.BrowserStorageCache = exports.InMemoryCache = exports.sharedInMemoryStorage = exports.sessionStorage = exports.defaultStorage = exports.CookieStorage = exports.getId = exports.getCredentialsForIdentity = exports.clearCredentials = exports.AmplifyClassV6 = exports.fetchAuthSession = exports.Amplify = exports.Hub = void 0;
|
|
6
6
|
/*
|
|
7
7
|
This file maps top-level exports from `@aws-amplify/core`. These are intended to be potentially customer-facing exports.
|
|
8
8
|
*/
|
|
@@ -33,5 +33,3 @@ Object.defineProperty(exports, "InMemoryCache", { enumerable: true, get: functio
|
|
|
33
33
|
// Internationalization utilities
|
|
34
34
|
var I18n_1 = require("./I18n");
|
|
35
35
|
Object.defineProperty(exports, "I18n", { enumerable: true, get: function () { return I18n_1.I18n; } });
|
|
36
|
-
var parseAWSExports_1 = require("./parseAWSExports");
|
|
37
|
-
Object.defineProperty(exports, "parseAWSExports", { enumerable: true, get: function () { return parseAWSExports_1.parseAWSExports; } });
|
package/lib/libraryUtils.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { isBrowser, filenameToContentType, generateRandomString, isEmpty, isStrictObject, isTextFile, isWebWorker, makeQuerablePromise, objectLessAttributes, sortByField, transferKeyToLowerCase, transferKeyToUpperCase, } from './Util/JS';
|
|
2
|
+
export { parseAWSExports } from './parseAWSExports';
|
|
3
|
+
export { LegacyConfig } from './singleton/types';
|
|
2
4
|
export { JWT, StrictUnion, CognitoIdentityPoolConfig, } from './singleton/Auth/types';
|
|
3
5
|
export { decodeJWT, assertTokenProviderConfig, assertIdentityPooIdConfig, assertOAuthConfig, } from './singleton/Auth/utils';
|
|
4
6
|
export { isTokenExpired } from './singleton/Auth';
|
|
@@ -14,7 +16,6 @@ export { ServiceWorker } from './ServiceWorker';
|
|
|
14
16
|
export { AWS_CLOUDWATCH_CATEGORY, BackgroundManagerNotOpenError, BackgroundProcessManager, BackgroundProcessManagerState, DateUtils, Mutex, NO_CREDS_ERROR_STRING, NonRetryableError, RETRY_ERROR_CODES, Reachability, isNonRetryableError, jitteredBackoff, jitteredExponentialRetry, retry, urlSafeDecode, urlSafeEncode, } from './Util';
|
|
15
17
|
export { asserts } from './Util/errors/AssertError';
|
|
16
18
|
export { invalidParameter, missingConfig, AmplifyError, AmplifyErrorString, } from './Util/Errors';
|
|
17
|
-
export { AppState, AsyncStorage, Linking } from './RNComponents';
|
|
18
19
|
export { ErrorParams, AmplifyErrorMap, ServiceError } from './types';
|
|
19
20
|
export { INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER, USER_AGENT_HEADER, } from './Util/Constants';
|
|
20
21
|
export { fetchAuthSession } from './singleton/apis/internal/fetchAuthSession';
|
package/lib/libraryUtils.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.
|
|
6
|
-
exports.AMPLIFY_SYMBOL = exports.fetchAuthSession = exports.USER_AGENT_HEADER = exports.INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER = exports.
|
|
5
|
+
exports.Reachability = exports.RETRY_ERROR_CODES = exports.NonRetryableError = exports.NO_CREDS_ERROR_STRING = exports.Mutex = exports.DateUtils = exports.BackgroundProcessManagerState = exports.BackgroundProcessManager = exports.BackgroundManagerNotOpenError = exports.AWS_CLOUDWATCH_CATEGORY = exports.ServiceWorker = exports.Constants = exports.StorageAction = exports.PushNotificationAction = exports.PubSubAction = exports.PredictionsAction = exports.InAppMessagingAction = exports.InteractionsAction = exports.GeoAction = exports.Framework = exports.DataStoreAction = exports.Category = exports.AnalyticsAction = exports.AuthAction = exports.ApiAction = exports.getAmplifyUserAgent = exports.getAmplifyUserAgentObject = exports.Platform = exports.ClientDevice = exports.Logger = exports.ConsoleLogger = exports.Signer = exports.isTokenExpired = exports.assertOAuthConfig = exports.assertIdentityPooIdConfig = exports.assertTokenProviderConfig = exports.decodeJWT = exports.parseAWSExports = exports.transferKeyToUpperCase = exports.transferKeyToLowerCase = exports.sortByField = exports.objectLessAttributes = exports.makeQuerablePromise = exports.isWebWorker = exports.isTextFile = exports.isStrictObject = exports.isEmpty = exports.generateRandomString = exports.filenameToContentType = exports.isBrowser = void 0;
|
|
6
|
+
exports.AMPLIFY_SYMBOL = exports.fetchAuthSession = exports.USER_AGENT_HEADER = exports.INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER = exports.AmplifyErrorString = exports.AmplifyError = exports.missingConfig = exports.invalidParameter = exports.asserts = exports.urlSafeEncode = exports.urlSafeDecode = exports.retry = exports.jitteredExponentialRetry = exports.jitteredBackoff = exports.isNonRetryableError = void 0;
|
|
7
7
|
/*
|
|
8
8
|
This file maps top-level exports from `@aws-amplify/core/internals/utils`. These are intended to be internal
|
|
9
9
|
utils for use throughout the library.
|
|
@@ -22,6 +22,8 @@ Object.defineProperty(exports, "objectLessAttributes", { enumerable: true, get:
|
|
|
22
22
|
Object.defineProperty(exports, "sortByField", { enumerable: true, get: function () { return JS_1.sortByField; } });
|
|
23
23
|
Object.defineProperty(exports, "transferKeyToLowerCase", { enumerable: true, get: function () { return JS_1.transferKeyToLowerCase; } });
|
|
24
24
|
Object.defineProperty(exports, "transferKeyToUpperCase", { enumerable: true, get: function () { return JS_1.transferKeyToUpperCase; } });
|
|
25
|
+
var parseAWSExports_1 = require("./parseAWSExports");
|
|
26
|
+
Object.defineProperty(exports, "parseAWSExports", { enumerable: true, get: function () { return parseAWSExports_1.parseAWSExports; } });
|
|
25
27
|
// Auth utilities
|
|
26
28
|
var utils_1 = require("./singleton/Auth/utils");
|
|
27
29
|
Object.defineProperty(exports, "decodeJWT", { enumerable: true, get: function () { return utils_1.decodeJWT; } });
|
|
@@ -89,10 +91,6 @@ Object.defineProperty(exports, "invalidParameter", { enumerable: true, get: func
|
|
|
89
91
|
Object.defineProperty(exports, "missingConfig", { enumerable: true, get: function () { return Errors_1.missingConfig; } });
|
|
90
92
|
Object.defineProperty(exports, "AmplifyError", { enumerable: true, get: function () { return Errors_1.AmplifyError; } });
|
|
91
93
|
Object.defineProperty(exports, "AmplifyErrorString", { enumerable: true, get: function () { return Errors_1.AmplifyErrorString; } });
|
|
92
|
-
var RNComponents_1 = require("./RNComponents");
|
|
93
|
-
Object.defineProperty(exports, "AppState", { enumerable: true, get: function () { return RNComponents_1.AppState; } });
|
|
94
|
-
Object.defineProperty(exports, "AsyncStorage", { enumerable: true, get: function () { return RNComponents_1.AsyncStorage; } });
|
|
95
|
-
Object.defineProperty(exports, "Linking", { enumerable: true, get: function () { return RNComponents_1.Linking; } });
|
|
96
94
|
var Constants_1 = require("./Util/Constants");
|
|
97
95
|
Object.defineProperty(exports, "INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER", { enumerable: true, get: function () { return Constants_1.INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER; } });
|
|
98
96
|
Object.defineProperty(exports, "USER_AGENT_HEADER", { enumerable: true, get: function () { return Constants_1.USER_AGENT_HEADER; } });
|
|
@@ -3,7 +3,7 @@ import { PinpointAnalyticsEvent, PinpointSession } from './pinpoint';
|
|
|
3
3
|
export type EventBufferConfig = {
|
|
4
4
|
appId: string;
|
|
5
5
|
bufferSize: number;
|
|
6
|
-
credentials: AuthSession['credentials'];
|
|
6
|
+
credentials: Required<AuthSession>['credentials'];
|
|
7
7
|
identityId: AuthSession['identityId'];
|
|
8
8
|
flushInterval: number;
|
|
9
9
|
flushSize: number;
|
|
@@ -24,7 +24,7 @@ export type PinpointAnalyticsEvent = {
|
|
|
24
24
|
type PinpointCommonParameters = {
|
|
25
25
|
appId: string;
|
|
26
26
|
category: SupportedCategory;
|
|
27
|
-
credentials: AuthSession['credentials'];
|
|
27
|
+
credentials: Required<AuthSession>['credentials'];
|
|
28
28
|
identityId?: AuthSession['identityId'];
|
|
29
29
|
region: string;
|
|
30
30
|
userAgentValue?: string;
|
|
@@ -77,7 +77,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
77
77
|
exports.PinpointEventBuffer = void 0;
|
|
78
78
|
var Logger_1 = require("../../../Logger");
|
|
79
79
|
var Pinpoint_1 = require("../../../AwsClients/Pinpoint");
|
|
80
|
-
var isAppInForeground_1 = require("
|
|
80
|
+
var isAppInForeground_1 = require("./isAppInForeground");
|
|
81
81
|
var logger = new Logger_1.ConsoleLogger('PinpointEventBuffer');
|
|
82
82
|
var RETRYABLE_CODES = [429, 500];
|
|
83
83
|
var ACCEPTED_CODES = [202];
|
|
@@ -94,7 +94,9 @@ var PinpointEventBuffer = /** @class */ (function () {
|
|
|
94
94
|
PinpointEventBuffer.prototype.push = function (event) {
|
|
95
95
|
var _a;
|
|
96
96
|
if (this._buffer.length >= this._config.bufferSize) {
|
|
97
|
-
logger.debug('Exceeded Pinpoint event buffer limits, event dropped.', {
|
|
97
|
+
logger.debug('Exceeded Pinpoint event buffer limits, event dropped.', {
|
|
98
|
+
eventId: event.eventId,
|
|
99
|
+
});
|
|
98
100
|
return;
|
|
99
101
|
}
|
|
100
102
|
this._buffer.push((_a = {}, _a[event.eventId] = event, _a));
|
|
@@ -233,7 +235,7 @@ var PinpointEventBuffer = /** @class */ (function () {
|
|
|
233
235
|
logger.warn('Pinpoint event failed to send.', {
|
|
234
236
|
eventId: eventId,
|
|
235
237
|
name: name,
|
|
236
|
-
message: Message
|
|
238
|
+
message: Message,
|
|
237
239
|
});
|
|
238
240
|
});
|
|
239
241
|
});
|
|
@@ -253,14 +255,14 @@ var PinpointEventBuffer = /** @class */ (function () {
|
|
|
253
255
|
logger.debug('Resending event.', {
|
|
254
256
|
eventId: eventId,
|
|
255
257
|
name: name,
|
|
256
|
-
remainingAttempts: bufferedEvent.resendLimit
|
|
258
|
+
remainingAttempts: bufferedEvent.resendLimit,
|
|
257
259
|
});
|
|
258
260
|
eligibleEvents.push((_a = {}, _a[eventId] = bufferedEvent, _a));
|
|
259
261
|
return;
|
|
260
262
|
}
|
|
261
263
|
logger.debug('No retry attempts remaining for event.', {
|
|
262
264
|
eventId: eventId,
|
|
263
|
-
name: name
|
|
265
|
+
name: name,
|
|
264
266
|
});
|
|
265
267
|
});
|
|
266
268
|
// add the events to the front of the buffer
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isAppInForeground: () => boolean;
|
|
@@ -3,8 +3,5 @@
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.isAppInForeground = void 0;
|
|
6
|
-
var
|
|
7
|
-
var isAppInForeground = function () {
|
|
8
|
-
return _1.AppState.currentState === 'active';
|
|
9
|
-
};
|
|
6
|
+
var isAppInForeground = function () { return true; };
|
|
10
7
|
exports.isAppInForeground = isAppInForeground;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isAppInForeground: () => boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.isAppInForeground = void 0;
|
|
6
|
+
// @ts-ignore: missing type definition
|
|
7
|
+
var react_native_1 = require("react-native");
|
|
8
|
+
var isAppInForeground = function () { return react_native_1.AppState.currentState === 'active'; };
|
|
9
|
+
exports.isAppInForeground = isAppInForeground;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AuthClass } from './Auth';
|
|
2
|
-
import { LibraryOptions, ResourcesConfig } from './types';
|
|
2
|
+
import { LegacyConfig, LibraryOptions, ResourcesConfig } from './types';
|
|
3
3
|
export declare class AmplifyClass {
|
|
4
4
|
resourcesConfig: ResourcesConfig;
|
|
5
5
|
libraryOptions: LibraryOptions;
|
|
@@ -19,7 +19,7 @@ export declare class AmplifyClass {
|
|
|
19
19
|
* @param resourceConfig - Back-end resource configuration. Typically provided via the `aws-exports.js` file.
|
|
20
20
|
* @param libraryOptions - Additional options for customizing the behavior of the library.
|
|
21
21
|
*/
|
|
22
|
-
configure(resourcesConfig: ResourcesConfig, libraryOptions?: LibraryOptions): void;
|
|
22
|
+
configure(resourcesConfig: ResourcesConfig | LegacyConfig, libraryOptions?: LibraryOptions): void;
|
|
23
23
|
/**
|
|
24
24
|
* Provides access to the current back-end resource configuration for the Library.
|
|
25
25
|
*
|
package/lib/singleton/Amplify.js
CHANGED
|
@@ -27,6 +27,7 @@ exports.Amplify = exports.AmplifyClass = void 0;
|
|
|
27
27
|
// SPDX-License-Identifier: Apache-2.0
|
|
28
28
|
var Auth_1 = require("./Auth");
|
|
29
29
|
var Hub_1 = require("../Hub");
|
|
30
|
+
var parseAWSExports_1 = require("../parseAWSExports");
|
|
30
31
|
// TODO(v6): add default AuthTokenStore for each platform
|
|
31
32
|
var AmplifyClass = /** @class */ (function () {
|
|
32
33
|
function AmplifyClass() {
|
|
@@ -46,7 +47,14 @@ var AmplifyClass = /** @class */ (function () {
|
|
|
46
47
|
*/
|
|
47
48
|
AmplifyClass.prototype.configure = function (resourcesConfig, libraryOptions) {
|
|
48
49
|
if (libraryOptions === void 0) { libraryOptions = {}; }
|
|
49
|
-
|
|
50
|
+
var resolvedResourceConfig;
|
|
51
|
+
if (Object.keys(resourcesConfig).some(function (key) { return key.startsWith('aws_'); })) {
|
|
52
|
+
resolvedResourceConfig = (0, parseAWSExports_1.parseAWSExports)(resourcesConfig);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
resolvedResourceConfig = resourcesConfig;
|
|
56
|
+
}
|
|
57
|
+
this.resourcesConfig = mergeResourceConfig(this.resourcesConfig, resolvedResourceConfig);
|
|
50
58
|
this.libraryOptions = mergeLibraryOptions(this.libraryOptions, libraryOptions);
|
|
51
59
|
this.Auth.configure(this.resourcesConfig.Auth, this.libraryOptions.Auth);
|
|
52
60
|
Hub_1.Hub.dispatch('core', {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuthConfig, AuthSession, FetchAuthSessionOptions, LibraryAuthOptions } from './types';
|
|
1
|
+
import { AuthConfig, AuthSession, AuthTokens, FetchAuthSessionOptions, LibraryAuthOptions } from './types';
|
|
2
2
|
export declare function isTokenExpired({ expiresAt, clockDrift, }: {
|
|
3
3
|
expiresAt: number;
|
|
4
4
|
clockDrift: number;
|
|
@@ -20,4 +20,5 @@ export declare class AuthClass {
|
|
|
20
20
|
configure(authResourcesConfig: AuthConfig, authOptions?: LibraryAuthOptions): void;
|
|
21
21
|
fetchAuthSession(options?: FetchAuthSessionOptions): Promise<AuthSession>;
|
|
22
22
|
clearCredentials(): Promise<void>;
|
|
23
|
+
getTokens(options: FetchAuthSessionOptions): Promise<AuthTokens | undefined>;
|
|
23
24
|
}
|
|
@@ -61,20 +61,19 @@ var AuthClass = /** @class */ (function () {
|
|
|
61
61
|
this.authOptions = authOptions;
|
|
62
62
|
};
|
|
63
63
|
AuthClass.prototype.fetchAuthSession = function (options) {
|
|
64
|
-
var _a, _b, _c, _d, _e, _f
|
|
64
|
+
var _a, _b, _c, _d, _e, _f;
|
|
65
65
|
if (options === void 0) { options = {}; }
|
|
66
66
|
return __awaiter(this, void 0, void 0, function () {
|
|
67
67
|
var tokens, credentialsAndIdentityId, userSub;
|
|
68
|
-
return __generator(this, function (
|
|
69
|
-
switch (
|
|
70
|
-
case 0: return [4 /*yield*/,
|
|
68
|
+
return __generator(this, function (_g) {
|
|
69
|
+
switch (_g.label) {
|
|
70
|
+
case 0: return [4 /*yield*/, this.getTokens(options)];
|
|
71
71
|
case 1:
|
|
72
72
|
// Get tokens will throw if session cannot be refreshed (network or service error) or return null if not available
|
|
73
|
-
tokens =
|
|
74
|
-
(_c = (_k.sent())) !== null && _c !== void 0 ? _c : undefined;
|
|
73
|
+
tokens = _g.sent();
|
|
75
74
|
if (!tokens) return [3 /*break*/, 3];
|
|
76
|
-
userSub = (
|
|
77
|
-
return [4 /*yield*/, ((
|
|
75
|
+
userSub = (_b = (_a = tokens.accessToken) === null || _a === void 0 ? void 0 : _a.payload) === null || _b === void 0 ? void 0 : _b.sub;
|
|
76
|
+
return [4 /*yield*/, ((_d = (_c = this.authOptions) === null || _c === void 0 ? void 0 : _c.credentialsProvider) === null || _d === void 0 ? void 0 : _d.getCredentialsAndIdentityId({
|
|
78
77
|
authConfig: this.authConfig,
|
|
79
78
|
tokens: tokens,
|
|
80
79
|
authenticated: true,
|
|
@@ -83,9 +82,9 @@ var AuthClass = /** @class */ (function () {
|
|
|
83
82
|
case 2:
|
|
84
83
|
// getCredentialsAndIdentityId will throw if cannot get credentials (network or service error)
|
|
85
84
|
credentialsAndIdentityId =
|
|
86
|
-
|
|
85
|
+
_g.sent();
|
|
87
86
|
return [3 /*break*/, 5];
|
|
88
|
-
case 3: return [4 /*yield*/, ((
|
|
87
|
+
case 3: return [4 /*yield*/, ((_f = (_e = this.authOptions) === null || _e === void 0 ? void 0 : _e.credentialsProvider) === null || _f === void 0 ? void 0 : _f.getCredentialsAndIdentityId({
|
|
89
88
|
authConfig: this.authConfig,
|
|
90
89
|
authenticated: false,
|
|
91
90
|
forceRefresh: options.forceRefresh,
|
|
@@ -93,8 +92,8 @@ var AuthClass = /** @class */ (function () {
|
|
|
93
92
|
case 4:
|
|
94
93
|
// getCredentialsAndIdentityId will throw if cannot get credentials (network or service error)
|
|
95
94
|
credentialsAndIdentityId =
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
_g.sent();
|
|
96
|
+
_g.label = 5;
|
|
98
97
|
case 5: return [2 /*return*/, {
|
|
99
98
|
tokens: tokens,
|
|
100
99
|
credentials: credentialsAndIdentityId === null || credentialsAndIdentityId === void 0 ? void 0 : credentialsAndIdentityId.credentials,
|
|
@@ -119,6 +118,17 @@ var AuthClass = /** @class */ (function () {
|
|
|
119
118
|
});
|
|
120
119
|
});
|
|
121
120
|
};
|
|
121
|
+
AuthClass.prototype.getTokens = function (options) {
|
|
122
|
+
var _a, _b, _c;
|
|
123
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
124
|
+
return __generator(this, function (_d) {
|
|
125
|
+
switch (_d.label) {
|
|
126
|
+
case 0: return [4 /*yield*/, ((_b = (_a = this.authOptions) === null || _a === void 0 ? void 0 : _a.tokenProvider) === null || _b === void 0 ? void 0 : _b.getTokens(options))];
|
|
127
|
+
case 1: return [2 /*return*/, ((_c = (_d.sent())) !== null && _c !== void 0 ? _c : undefined)];
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
};
|
|
122
132
|
return AuthClass;
|
|
123
133
|
}());
|
|
124
134
|
exports.AuthClass = AuthClass;
|
|
@@ -36,9 +36,9 @@ exports.assertOAuthConfig = assertOAuthConfig;
|
|
|
36
36
|
function assertIdentityPooIdConfig(cognitoConfig) {
|
|
37
37
|
var validConfig = !!(cognitoConfig === null || cognitoConfig === void 0 ? void 0 : cognitoConfig.identityPoolId);
|
|
38
38
|
return (0, AssertError_1.asserts)(validConfig, {
|
|
39
|
-
name: '
|
|
40
|
-
message: '
|
|
41
|
-
recoverySuggestion: 'Make sure
|
|
39
|
+
name: 'InvalidIdentityPoolIdException',
|
|
40
|
+
message: 'Invalid identity pool id provided.',
|
|
41
|
+
recoverySuggestion: 'Make sure a valid identityPoolId is given in the config.',
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
exports.assertIdentityPooIdConfig = assertIdentityPooIdConfig;
|