@aws-amplify/core 6.0.1-preview-testing.64b45b1.0 → 6.0.1-preview-testing.034e780.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/Pinpoint/getInAppMessages.d.ts +1 -1
- package/lib/AwsClients/Pinpoint/putEvents.d.ts +1 -1
- package/lib/AwsClients/Pinpoint/updateEndpoint.d.ts +1 -1
- package/lib/Platform/version.d.ts +1 -1
- package/lib/Platform/version.js +1 -1
- package/lib/clients/types/aws.d.ts +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +1 -3
- package/lib/libraryUtils.d.ts +2 -0
- package/lib/libraryUtils.js +4 -2
- 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/Pinpoint/getInAppMessages.d.ts +1 -1
- package/lib-esm/AwsClients/Pinpoint/putEvents.d.ts +1 -1
- package/lib-esm/AwsClients/Pinpoint/updateEndpoint.d.ts +1 -1
- package/lib-esm/Platform/version.d.ts +1 -1
- package/lib-esm/Platform/version.js +1 -1
- package/lib-esm/clients/types/aws.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 -0
- package/lib-esm/libraryUtils.js +1 -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 -2
- package/src/Platform/version.ts +1 -1
- package/src/clients/types/aws.ts +4 -1
- package/src/index.ts +0 -2
- package/src/libraryUtils.ts +2 -1
- 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
|
@@ -14,7 +14,7 @@ export declare const getInAppMessages: (config: {
|
|
|
14
14
|
userAgentValue?: string | undefined;
|
|
15
15
|
} & {
|
|
16
16
|
uriEscapePath?: boolean | undefined;
|
|
17
|
-
credentials: import("@
|
|
17
|
+
credentials: import("@smithy/types/dist-types/identity/awsCredentialIdentity").AwsCredentialIdentity | (() => Promise<import("@smithy/types/dist-types/identity/awsCredentialIdentity").AwsCredentialIdentity>);
|
|
18
18
|
region: string;
|
|
19
19
|
abortSignal?: AbortSignal | undefined;
|
|
20
20
|
cache?: RequestCache | undefined;
|
|
@@ -14,7 +14,7 @@ export declare const putEvents: (config: {
|
|
|
14
14
|
userAgentValue?: string | undefined;
|
|
15
15
|
} & {
|
|
16
16
|
uriEscapePath?: boolean | undefined;
|
|
17
|
-
credentials: import("@
|
|
17
|
+
credentials: import("@smithy/types/dist-types/identity/awsCredentialIdentity").AwsCredentialIdentity | (() => Promise<import("@smithy/types/dist-types/identity/awsCredentialIdentity").AwsCredentialIdentity>);
|
|
18
18
|
region: string;
|
|
19
19
|
abortSignal?: AbortSignal | undefined;
|
|
20
20
|
cache?: RequestCache | undefined;
|
|
@@ -14,7 +14,7 @@ export declare const updateEndpoint: (config: {
|
|
|
14
14
|
userAgentValue?: string | undefined;
|
|
15
15
|
} & {
|
|
16
16
|
uriEscapePath?: boolean | undefined;
|
|
17
|
-
credentials: import("@
|
|
17
|
+
credentials: import("@smithy/types/dist-types/identity/awsCredentialIdentity").AwsCredentialIdentity | (() => Promise<import("@smithy/types/dist-types/identity/awsCredentialIdentity").AwsCredentialIdentity>);
|
|
18
18
|
region: string;
|
|
19
19
|
abortSignal?: AbortSignal | undefined;
|
|
20
20
|
cache?: RequestCache | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "6.0.1-preview-testing.
|
|
1
|
+
export declare const version = "6.0.1-preview-testing.034e780.0+034e780";
|
package/lib/Platform/version.js
CHANGED
|
@@ -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.
|
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.MemoryKeyValueStorage = exports.SessionStorage = exports.CookieStorage = exports.LocalStorage = exports.MemoryStorage = exports.StorageHelper = 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
|
*/
|
|
@@ -35,5 +35,3 @@ Object.defineProperty(exports, "InMemoryCache", { enumerable: true, get: functio
|
|
|
35
35
|
// Internationalization utilities
|
|
36
36
|
var I18n_1 = require("./I18n");
|
|
37
37
|
Object.defineProperty(exports, "I18n", { enumerable: true, get: function () { return I18n_1.I18n; } });
|
|
38
|
-
var parseAWSExports_1 = require("./parseAWSExports");
|
|
39
|
-
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';
|
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.Linking = exports.AsyncStorage = exports.AppState = exports.AmplifyErrorString = exports.AmplifyError = exports.missingConfig = exports.invalidParameter = exports.asserts = exports.urlSafeEncode = exports.urlSafeDecode = exports.retry = exports.jitteredExponentialRetry = exports.jitteredBackoff = void 0;
|
|
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.Linking = exports.AsyncStorage = exports.AppState = 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; } });
|
|
@@ -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;
|
package/lib/singleton/types.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { AnalyticsConfig } from './Analytics/types';
|
|
2
2
|
import { AuthConfig, LibraryAuthOptions, AuthUserPoolConfig, AuthIdentityPoolConfig, AuthUserPoolAndIdentityPoolConfig, GetCredentialsOptions, CognitoIdentityPoolConfig } from './Auth/types';
|
|
3
3
|
import { LibraryStorageOptions, StorageAccessLevel, StorageConfig } from './Storage/types';
|
|
4
|
+
export type LegacyConfig = {
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated The field should not be used.
|
|
7
|
+
*/
|
|
8
|
+
aws_project_region?: string;
|
|
9
|
+
};
|
|
4
10
|
export type ResourcesConfig = {
|
|
5
11
|
Analytics?: AnalyticsConfig;
|
|
6
12
|
Auth?: AuthConfig;
|