aws-amplify 6.14.1 → 6.14.2-unstable.42f6332.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.
|
@@ -22,6 +22,13 @@ exports.DefaultAmplify = {
|
|
|
22
22
|
*/
|
|
23
23
|
configure(resourceConfig, libraryOptions) {
|
|
24
24
|
const resolvedResourceConfig = (0, utils_1.parseAmplifyConfig)(resourceConfig);
|
|
25
|
+
const cookieBasedKeyValueStorage = new core_1.CookieStorage({ sameSite: 'lax' });
|
|
26
|
+
const resolvedKeyValueStorage = libraryOptions?.ssr
|
|
27
|
+
? cookieBasedKeyValueStorage
|
|
28
|
+
: core_1.defaultStorage;
|
|
29
|
+
const resolvedCredentialsProvider = libraryOptions?.ssr
|
|
30
|
+
? new cognito_1.CognitoAWSCredentialsAndIdentityIdProvider(new cognito_1.DefaultIdentityIdStore(cookieBasedKeyValueStorage))
|
|
31
|
+
: cognito_1.cognitoCredentialsProvider;
|
|
25
32
|
// If no Auth config is provided, no special handling will be required, configure as is.
|
|
26
33
|
// Otherwise, we can assume an Auth config is provided from here on.
|
|
27
34
|
if (!resolvedResourceConfig.Auth) {
|
|
@@ -39,14 +46,12 @@ exports.DefaultAmplify = {
|
|
|
39
46
|
cognito_1.cognitoUserPoolsTokenProvider.setAuthConfig(resolvedResourceConfig.Auth);
|
|
40
47
|
cognito_1.cognitoUserPoolsTokenProvider.setKeyValueStorage(
|
|
41
48
|
// TODO: allow configure with a public interface
|
|
42
|
-
|
|
43
|
-
? new core_1.CookieStorage({ sameSite: 'lax' })
|
|
44
|
-
: core_1.defaultStorage);
|
|
49
|
+
resolvedKeyValueStorage);
|
|
45
50
|
core_1.Amplify.configure(resolvedResourceConfig, {
|
|
46
51
|
...libraryOptions,
|
|
47
52
|
Auth: {
|
|
48
53
|
tokenProvider: cognito_1.cognitoUserPoolsTokenProvider,
|
|
49
|
-
credentialsProvider:
|
|
54
|
+
credentialsProvider: resolvedCredentialsProvider,
|
|
50
55
|
},
|
|
51
56
|
});
|
|
52
57
|
return;
|
|
@@ -54,16 +59,16 @@ exports.DefaultAmplify = {
|
|
|
54
59
|
// At this point, Auth libraryOptions would have been previously configured and no overriding
|
|
55
60
|
// Auth options were given, so we should preserve the currently configured Auth libraryOptions.
|
|
56
61
|
if (libraryOptions) {
|
|
62
|
+
const authLibraryOptions = core_1.Amplify.libraryOptions.Auth;
|
|
57
63
|
// If ssr is provided through libraryOptions, we should respect the intentional reconfiguration.
|
|
58
64
|
if (libraryOptions.ssr !== undefined) {
|
|
59
65
|
cognito_1.cognitoUserPoolsTokenProvider.setKeyValueStorage(
|
|
60
66
|
// TODO: allow configure with a public interface
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
: core_1.defaultStorage);
|
|
67
|
+
resolvedKeyValueStorage);
|
|
68
|
+
authLibraryOptions.credentialsProvider = resolvedCredentialsProvider;
|
|
64
69
|
}
|
|
65
70
|
core_1.Amplify.configure(resolvedResourceConfig, {
|
|
66
|
-
Auth:
|
|
71
|
+
Auth: authLibraryOptions,
|
|
67
72
|
...libraryOptions,
|
|
68
73
|
});
|
|
69
74
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initSingleton.js","sources":["../../src/initSingleton.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DefaultAmplify = void 0;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst cognito_1 = require(\"./auth/cognito\");\nexports.DefaultAmplify = {\n /**\n * Configures Amplify with the {@link resourceConfig} and {@link libraryOptions}.\n *\n * @param resourceConfig The {@link ResourcesConfig} object that is typically imported from the\n * `amplifyconfiguration.json` file. It can also be an object literal created inline when calling `Amplify.configure`.\n * @param libraryOptions The {@link LibraryOptions} additional options for the library.\n *\n * @example\n * import config from './amplifyconfiguration.json';\n *\n * Amplify.configure(config);\n */\n configure(resourceConfig, libraryOptions) {\n const resolvedResourceConfig = (0, utils_1.parseAmplifyConfig)(resourceConfig);\n // If no Auth config is provided, no special handling will be required, configure as is.\n // Otherwise, we can assume an Auth config is provided from here on.\n if (!resolvedResourceConfig.Auth) {\n core_1.Amplify.configure(resolvedResourceConfig, libraryOptions);\n return;\n }\n // If Auth options are provided, always just configure as is.\n // Otherwise, we can assume no Auth libraryOptions were provided from here on.\n if (libraryOptions?.Auth) {\n core_1.Amplify.configure(resolvedResourceConfig, libraryOptions);\n return;\n }\n // If no Auth libraryOptions were previously configured, then always add default providers.\n if (!core_1.Amplify.libraryOptions.Auth) {\n cognito_1.cognitoUserPoolsTokenProvider.setAuthConfig(resolvedResourceConfig.Auth);\n cognito_1.cognitoUserPoolsTokenProvider.setKeyValueStorage(\n // TODO: allow configure with a public interface\n
|
|
1
|
+
{"version":3,"file":"initSingleton.js","sources":["../../src/initSingleton.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DefaultAmplify = void 0;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst cognito_1 = require(\"./auth/cognito\");\nexports.DefaultAmplify = {\n /**\n * Configures Amplify with the {@link resourceConfig} and {@link libraryOptions}.\n *\n * @param resourceConfig The {@link ResourcesConfig} object that is typically imported from the\n * `amplifyconfiguration.json` file. It can also be an object literal created inline when calling `Amplify.configure`.\n * @param libraryOptions The {@link LibraryOptions} additional options for the library.\n *\n * @example\n * import config from './amplifyconfiguration.json';\n *\n * Amplify.configure(config);\n */\n configure(resourceConfig, libraryOptions) {\n const resolvedResourceConfig = (0, utils_1.parseAmplifyConfig)(resourceConfig);\n const cookieBasedKeyValueStorage = new core_1.CookieStorage({ sameSite: 'lax' });\n const resolvedKeyValueStorage = libraryOptions?.ssr\n ? cookieBasedKeyValueStorage\n : core_1.defaultStorage;\n const resolvedCredentialsProvider = libraryOptions?.ssr\n ? new cognito_1.CognitoAWSCredentialsAndIdentityIdProvider(new cognito_1.DefaultIdentityIdStore(cookieBasedKeyValueStorage))\n : cognito_1.cognitoCredentialsProvider;\n // If no Auth config is provided, no special handling will be required, configure as is.\n // Otherwise, we can assume an Auth config is provided from here on.\n if (!resolvedResourceConfig.Auth) {\n core_1.Amplify.configure(resolvedResourceConfig, libraryOptions);\n return;\n }\n // If Auth options are provided, always just configure as is.\n // Otherwise, we can assume no Auth libraryOptions were provided from here on.\n if (libraryOptions?.Auth) {\n core_1.Amplify.configure(resolvedResourceConfig, libraryOptions);\n return;\n }\n // If no Auth libraryOptions were previously configured, then always add default providers.\n if (!core_1.Amplify.libraryOptions.Auth) {\n cognito_1.cognitoUserPoolsTokenProvider.setAuthConfig(resolvedResourceConfig.Auth);\n cognito_1.cognitoUserPoolsTokenProvider.setKeyValueStorage(\n // TODO: allow configure with a public interface\n resolvedKeyValueStorage);\n core_1.Amplify.configure(resolvedResourceConfig, {\n ...libraryOptions,\n Auth: {\n tokenProvider: cognito_1.cognitoUserPoolsTokenProvider,\n credentialsProvider: resolvedCredentialsProvider,\n },\n });\n return;\n }\n // At this point, Auth libraryOptions would have been previously configured and no overriding\n // Auth options were given, so we should preserve the currently configured Auth libraryOptions.\n if (libraryOptions) {\n const authLibraryOptions = core_1.Amplify.libraryOptions.Auth;\n // If ssr is provided through libraryOptions, we should respect the intentional reconfiguration.\n if (libraryOptions.ssr !== undefined) {\n cognito_1.cognitoUserPoolsTokenProvider.setKeyValueStorage(\n // TODO: allow configure with a public interface\n resolvedKeyValueStorage);\n authLibraryOptions.credentialsProvider = resolvedCredentialsProvider;\n }\n core_1.Amplify.configure(resolvedResourceConfig, {\n Auth: authLibraryOptions,\n ...libraryOptions,\n });\n return;\n }\n // Finally, if there were no libraryOptions given at all, we should simply not touch the currently\n // configured libraryOptions.\n core_1.Amplify.configure(resolvedResourceConfig);\n },\n /**\n * Returns the {@link ResourcesConfig} object passed in as the `resourceConfig` parameter when calling\n * `Amplify.configure`.\n *\n * @returns An {@link ResourcesConfig} object.\n */\n getConfig() {\n return core_1.Amplify.getConfig();\n },\n};\n"],"names":[],"mappings":"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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Amplify, CookieStorage, defaultStorage } from '@aws-amplify/core';
|
|
2
2
|
import { parseAmplifyConfig } from '@aws-amplify/core/internals/utils';
|
|
3
|
-
import {
|
|
3
|
+
import { CognitoAWSCredentialsAndIdentityIdProvider, DefaultIdentityIdStore, cognitoCredentialsProvider, cognitoUserPoolsTokenProvider } from '@aws-amplify/auth/cognito';
|
|
4
4
|
|
|
5
5
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
6
6
|
// SPDX-License-Identifier: Apache-2.0
|
|
@@ -19,6 +19,13 @@ const DefaultAmplify = {
|
|
|
19
19
|
*/
|
|
20
20
|
configure(resourceConfig, libraryOptions) {
|
|
21
21
|
const resolvedResourceConfig = parseAmplifyConfig(resourceConfig);
|
|
22
|
+
const cookieBasedKeyValueStorage = new CookieStorage({ sameSite: 'lax' });
|
|
23
|
+
const resolvedKeyValueStorage = libraryOptions?.ssr
|
|
24
|
+
? cookieBasedKeyValueStorage
|
|
25
|
+
: defaultStorage;
|
|
26
|
+
const resolvedCredentialsProvider = libraryOptions?.ssr
|
|
27
|
+
? new CognitoAWSCredentialsAndIdentityIdProvider(new DefaultIdentityIdStore(cookieBasedKeyValueStorage))
|
|
28
|
+
: cognitoCredentialsProvider;
|
|
22
29
|
// If no Auth config is provided, no special handling will be required, configure as is.
|
|
23
30
|
// Otherwise, we can assume an Auth config is provided from here on.
|
|
24
31
|
if (!resolvedResourceConfig.Auth) {
|
|
@@ -36,14 +43,12 @@ const DefaultAmplify = {
|
|
|
36
43
|
cognitoUserPoolsTokenProvider.setAuthConfig(resolvedResourceConfig.Auth);
|
|
37
44
|
cognitoUserPoolsTokenProvider.setKeyValueStorage(
|
|
38
45
|
// TODO: allow configure with a public interface
|
|
39
|
-
|
|
40
|
-
? new CookieStorage({ sameSite: 'lax' })
|
|
41
|
-
: defaultStorage);
|
|
46
|
+
resolvedKeyValueStorage);
|
|
42
47
|
Amplify.configure(resolvedResourceConfig, {
|
|
43
48
|
...libraryOptions,
|
|
44
49
|
Auth: {
|
|
45
50
|
tokenProvider: cognitoUserPoolsTokenProvider,
|
|
46
|
-
credentialsProvider:
|
|
51
|
+
credentialsProvider: resolvedCredentialsProvider,
|
|
47
52
|
},
|
|
48
53
|
});
|
|
49
54
|
return;
|
|
@@ -51,16 +56,16 @@ const DefaultAmplify = {
|
|
|
51
56
|
// At this point, Auth libraryOptions would have been previously configured and no overriding
|
|
52
57
|
// Auth options were given, so we should preserve the currently configured Auth libraryOptions.
|
|
53
58
|
if (libraryOptions) {
|
|
59
|
+
const authLibraryOptions = Amplify.libraryOptions.Auth;
|
|
54
60
|
// If ssr is provided through libraryOptions, we should respect the intentional reconfiguration.
|
|
55
61
|
if (libraryOptions.ssr !== undefined) {
|
|
56
62
|
cognitoUserPoolsTokenProvider.setKeyValueStorage(
|
|
57
63
|
// TODO: allow configure with a public interface
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
: defaultStorage);
|
|
64
|
+
resolvedKeyValueStorage);
|
|
65
|
+
authLibraryOptions.credentialsProvider = resolvedCredentialsProvider;
|
|
61
66
|
}
|
|
62
67
|
Amplify.configure(resolvedResourceConfig, {
|
|
63
|
-
Auth:
|
|
68
|
+
Auth: authLibraryOptions,
|
|
64
69
|
...libraryOptions,
|
|
65
70
|
});
|
|
66
71
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initSingleton.mjs","sources":["../../src/initSingleton.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Amplify, CookieStorage, defaultStorage, } from '@aws-amplify/core';\nimport { parseAmplifyConfig, } from '@aws-amplify/core/internals/utils';\nimport { cognitoCredentialsProvider, cognitoUserPoolsTokenProvider, } from './auth/cognito';\nexport const DefaultAmplify = {\n /**\n * Configures Amplify with the {@link resourceConfig} and {@link libraryOptions}.\n *\n * @param resourceConfig The {@link ResourcesConfig} object that is typically imported from the\n * `amplifyconfiguration.json` file. It can also be an object literal created inline when calling `Amplify.configure`.\n * @param libraryOptions The {@link LibraryOptions} additional options for the library.\n *\n * @example\n * import config from './amplifyconfiguration.json';\n *\n * Amplify.configure(config);\n */\n configure(resourceConfig, libraryOptions) {\n const resolvedResourceConfig = parseAmplifyConfig(resourceConfig);\n // If no Auth config is provided, no special handling will be required, configure as is.\n // Otherwise, we can assume an Auth config is provided from here on.\n if (!resolvedResourceConfig.Auth) {\n Amplify.configure(resolvedResourceConfig, libraryOptions);\n return;\n }\n // If Auth options are provided, always just configure as is.\n // Otherwise, we can assume no Auth libraryOptions were provided from here on.\n if (libraryOptions?.Auth) {\n Amplify.configure(resolvedResourceConfig, libraryOptions);\n return;\n }\n // If no Auth libraryOptions were previously configured, then always add default providers.\n if (!Amplify.libraryOptions.Auth) {\n cognitoUserPoolsTokenProvider.setAuthConfig(resolvedResourceConfig.Auth);\n cognitoUserPoolsTokenProvider.setKeyValueStorage(\n // TODO: allow configure with a public interface\n
|
|
1
|
+
{"version":3,"file":"initSingleton.mjs","sources":["../../src/initSingleton.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Amplify, CookieStorage, defaultStorage, } from '@aws-amplify/core';\nimport { parseAmplifyConfig, } from '@aws-amplify/core/internals/utils';\nimport { CognitoAWSCredentialsAndIdentityIdProvider, DefaultIdentityIdStore, cognitoCredentialsProvider, cognitoUserPoolsTokenProvider, } from './auth/cognito';\nexport const DefaultAmplify = {\n /**\n * Configures Amplify with the {@link resourceConfig} and {@link libraryOptions}.\n *\n * @param resourceConfig The {@link ResourcesConfig} object that is typically imported from the\n * `amplifyconfiguration.json` file. It can also be an object literal created inline when calling `Amplify.configure`.\n * @param libraryOptions The {@link LibraryOptions} additional options for the library.\n *\n * @example\n * import config from './amplifyconfiguration.json';\n *\n * Amplify.configure(config);\n */\n configure(resourceConfig, libraryOptions) {\n const resolvedResourceConfig = parseAmplifyConfig(resourceConfig);\n const cookieBasedKeyValueStorage = new CookieStorage({ sameSite: 'lax' });\n const resolvedKeyValueStorage = libraryOptions?.ssr\n ? cookieBasedKeyValueStorage\n : defaultStorage;\n const resolvedCredentialsProvider = libraryOptions?.ssr\n ? new CognitoAWSCredentialsAndIdentityIdProvider(new DefaultIdentityIdStore(cookieBasedKeyValueStorage))\n : cognitoCredentialsProvider;\n // If no Auth config is provided, no special handling will be required, configure as is.\n // Otherwise, we can assume an Auth config is provided from here on.\n if (!resolvedResourceConfig.Auth) {\n Amplify.configure(resolvedResourceConfig, libraryOptions);\n return;\n }\n // If Auth options are provided, always just configure as is.\n // Otherwise, we can assume no Auth libraryOptions were provided from here on.\n if (libraryOptions?.Auth) {\n Amplify.configure(resolvedResourceConfig, libraryOptions);\n return;\n }\n // If no Auth libraryOptions were previously configured, then always add default providers.\n if (!Amplify.libraryOptions.Auth) {\n cognitoUserPoolsTokenProvider.setAuthConfig(resolvedResourceConfig.Auth);\n cognitoUserPoolsTokenProvider.setKeyValueStorage(\n // TODO: allow configure with a public interface\n resolvedKeyValueStorage);\n Amplify.configure(resolvedResourceConfig, {\n ...libraryOptions,\n Auth: {\n tokenProvider: cognitoUserPoolsTokenProvider,\n credentialsProvider: resolvedCredentialsProvider,\n },\n });\n return;\n }\n // At this point, Auth libraryOptions would have been previously configured and no overriding\n // Auth options were given, so we should preserve the currently configured Auth libraryOptions.\n if (libraryOptions) {\n const authLibraryOptions = Amplify.libraryOptions.Auth;\n // If ssr is provided through libraryOptions, we should respect the intentional reconfiguration.\n if (libraryOptions.ssr !== undefined) {\n cognitoUserPoolsTokenProvider.setKeyValueStorage(\n // TODO: allow configure with a public interface\n resolvedKeyValueStorage);\n authLibraryOptions.credentialsProvider = resolvedCredentialsProvider;\n }\n Amplify.configure(resolvedResourceConfig, {\n Auth: authLibraryOptions,\n ...libraryOptions,\n });\n return;\n }\n // Finally, if there were no libraryOptions given at all, we should simply not touch the currently\n // configured libraryOptions.\n Amplify.configure(resolvedResourceConfig);\n },\n /**\n * Returns the {@link ResourcesConfig} object passed in as the `resourceConfig` parameter when calling\n * `Amplify.configure`.\n *\n * @returns An {@link ResourcesConfig} object.\n */\n getConfig() {\n return Amplify.getConfig();\n },\n};\n"],"names":[],"mappings":";;;;AAAA;AACA;AAIY,MAAC,cAAc,GAAG;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,cAAc,EAAE,cAAc,EAAE;AAC9C,QAAQ,MAAM,sBAAsB,GAAG,kBAAkB,CAAC,cAAc,CAAC;AACzE,QAAQ,MAAM,0BAA0B,GAAG,IAAI,aAAa,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AACjF,QAAQ,MAAM,uBAAuB,GAAG,cAAc,EAAE;AACxD,cAAc;AACd,cAAc,cAAc;AAC5B,QAAQ,MAAM,2BAA2B,GAAG,cAAc,EAAE;AAC5D,cAAc,IAAI,0CAA0C,CAAC,IAAI,sBAAsB,CAAC,0BAA0B,CAAC;AACnH,cAAc,0BAA0B;AACxC;AACA;AACA,QAAQ,IAAI,CAAC,sBAAsB,CAAC,IAAI,EAAE;AAC1C,YAAY,OAAO,CAAC,SAAS,CAAC,sBAAsB,EAAE,cAAc,CAAC;AACrE,YAAY;AACZ;AACA;AACA;AACA,QAAQ,IAAI,cAAc,EAAE,IAAI,EAAE;AAClC,YAAY,OAAO,CAAC,SAAS,CAAC,sBAAsB,EAAE,cAAc,CAAC;AACrE,YAAY;AACZ;AACA;AACA,QAAQ,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE;AAC1C,YAAY,6BAA6B,CAAC,aAAa,CAAC,sBAAsB,CAAC,IAAI,CAAC;AACpF,YAAY,6BAA6B,CAAC,kBAAkB;AAC5D;AACA,YAAY,uBAAuB,CAAC;AACpC,YAAY,OAAO,CAAC,SAAS,CAAC,sBAAsB,EAAE;AACtD,gBAAgB,GAAG,cAAc;AACjC,gBAAgB,IAAI,EAAE;AACtB,oBAAoB,aAAa,EAAE,6BAA6B;AAChE,oBAAoB,mBAAmB,EAAE,2BAA2B;AACpE,iBAAiB;AACjB,aAAa,CAAC;AACd,YAAY;AACZ;AACA;AACA;AACA,QAAQ,IAAI,cAAc,EAAE;AAC5B,YAAY,MAAM,kBAAkB,GAAG,OAAO,CAAC,cAAc,CAAC,IAAI;AAClE;AACA,YAAY,IAAI,cAAc,CAAC,GAAG,KAAK,SAAS,EAAE;AAClD,gBAAgB,6BAA6B,CAAC,kBAAkB;AAChE;AACA,gBAAgB,uBAAuB,CAAC;AACxC,gBAAgB,kBAAkB,CAAC,mBAAmB,GAAG,2BAA2B;AACpF;AACA,YAAY,OAAO,CAAC,SAAS,CAAC,sBAAsB,EAAE;AACtD,gBAAgB,IAAI,EAAE,kBAAkB;AACxC,gBAAgB,GAAG,cAAc;AACjC,aAAa,CAAC;AACd,YAAY;AACZ;AACA;AACA;AACA,QAAQ,OAAO,CAAC,SAAS,CAAC,sBAAsB,CAAC;AACjD,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,GAAG;AAChB,QAAQ,OAAO,OAAO,CAAC,SAAS,EAAE;AAClC,KAAK;AACL;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aws-amplify",
|
|
3
|
-
"version": "6.14.
|
|
3
|
+
"version": "6.14.2-unstable.42f6332.0+42f6332",
|
|
4
4
|
"description": "AWS Amplify is a JavaScript library for Frontend and mobile developers building cloud-enabled applications.",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.mjs",
|
|
@@ -293,13 +293,13 @@
|
|
|
293
293
|
"utils"
|
|
294
294
|
],
|
|
295
295
|
"dependencies": {
|
|
296
|
-
"@aws-amplify/analytics": "7.0.
|
|
297
|
-
"@aws-amplify/api": "6.3.
|
|
298
|
-
"@aws-amplify/auth": "6.12.
|
|
299
|
-
"@aws-amplify/core": "6.11.
|
|
300
|
-
"@aws-amplify/datastore": "5.0.
|
|
301
|
-
"@aws-amplify/notifications": "2.0.
|
|
302
|
-
"@aws-amplify/storage": "6.8.
|
|
296
|
+
"@aws-amplify/analytics": "7.0.78-unstable.42f6332.0+42f6332",
|
|
297
|
+
"@aws-amplify/api": "6.3.9-unstable.42f6332.0+42f6332",
|
|
298
|
+
"@aws-amplify/auth": "6.12.2-unstable.42f6332.0+42f6332",
|
|
299
|
+
"@aws-amplify/core": "6.11.2-unstable.42f6332.0+42f6332",
|
|
300
|
+
"@aws-amplify/datastore": "5.0.80-unstable.42f6332.0+42f6332",
|
|
301
|
+
"@aws-amplify/notifications": "2.0.78-unstable.42f6332.0+42f6332",
|
|
302
|
+
"@aws-amplify/storage": "6.8.2-unstable.42f6332.0+42f6332",
|
|
303
303
|
"tslib": "^2.5.0"
|
|
304
304
|
},
|
|
305
305
|
"devDependencies": {
|
|
@@ -535,5 +535,5 @@
|
|
|
535
535
|
"limit": "23.49 kB"
|
|
536
536
|
}
|
|
537
537
|
],
|
|
538
|
-
"gitHead": "
|
|
538
|
+
"gitHead": "42f6332678b8c1670becf5fa5ce98daeb602ed9f"
|
|
539
539
|
}
|
package/src/initSingleton.ts
CHANGED
|
@@ -14,6 +14,8 @@ import {
|
|
|
14
14
|
} from '@aws-amplify/core/internals/utils';
|
|
15
15
|
|
|
16
16
|
import {
|
|
17
|
+
CognitoAWSCredentialsAndIdentityIdProvider,
|
|
18
|
+
DefaultIdentityIdStore,
|
|
17
19
|
cognitoCredentialsProvider,
|
|
18
20
|
cognitoUserPoolsTokenProvider,
|
|
19
21
|
} from './auth/cognito';
|
|
@@ -36,6 +38,15 @@ export const DefaultAmplify = {
|
|
|
36
38
|
libraryOptions?: LibraryOptions,
|
|
37
39
|
): void {
|
|
38
40
|
const resolvedResourceConfig = parseAmplifyConfig(resourceConfig);
|
|
41
|
+
const cookieBasedKeyValueStorage = new CookieStorage({ sameSite: 'lax' });
|
|
42
|
+
const resolvedKeyValueStorage = libraryOptions?.ssr
|
|
43
|
+
? cookieBasedKeyValueStorage
|
|
44
|
+
: defaultStorage;
|
|
45
|
+
const resolvedCredentialsProvider = libraryOptions?.ssr
|
|
46
|
+
? new CognitoAWSCredentialsAndIdentityIdProvider(
|
|
47
|
+
new DefaultIdentityIdStore(cookieBasedKeyValueStorage),
|
|
48
|
+
)
|
|
49
|
+
: cognitoCredentialsProvider;
|
|
39
50
|
|
|
40
51
|
// If no Auth config is provided, no special handling will be required, configure as is.
|
|
41
52
|
// Otherwise, we can assume an Auth config is provided from here on.
|
|
@@ -58,16 +69,14 @@ export const DefaultAmplify = {
|
|
|
58
69
|
cognitoUserPoolsTokenProvider.setAuthConfig(resolvedResourceConfig.Auth);
|
|
59
70
|
cognitoUserPoolsTokenProvider.setKeyValueStorage(
|
|
60
71
|
// TODO: allow configure with a public interface
|
|
61
|
-
|
|
62
|
-
? new CookieStorage({ sameSite: 'lax' })
|
|
63
|
-
: defaultStorage,
|
|
72
|
+
resolvedKeyValueStorage,
|
|
64
73
|
);
|
|
65
74
|
|
|
66
75
|
Amplify.configure(resolvedResourceConfig, {
|
|
67
76
|
...libraryOptions,
|
|
68
77
|
Auth: {
|
|
69
78
|
tokenProvider: cognitoUserPoolsTokenProvider,
|
|
70
|
-
credentialsProvider:
|
|
79
|
+
credentialsProvider: resolvedCredentialsProvider,
|
|
71
80
|
},
|
|
72
81
|
});
|
|
73
82
|
|
|
@@ -77,18 +86,19 @@ export const DefaultAmplify = {
|
|
|
77
86
|
// At this point, Auth libraryOptions would have been previously configured and no overriding
|
|
78
87
|
// Auth options were given, so we should preserve the currently configured Auth libraryOptions.
|
|
79
88
|
if (libraryOptions) {
|
|
89
|
+
const authLibraryOptions = Amplify.libraryOptions.Auth;
|
|
80
90
|
// If ssr is provided through libraryOptions, we should respect the intentional reconfiguration.
|
|
81
91
|
if (libraryOptions.ssr !== undefined) {
|
|
82
92
|
cognitoUserPoolsTokenProvider.setKeyValueStorage(
|
|
83
93
|
// TODO: allow configure with a public interface
|
|
84
|
-
|
|
85
|
-
? new CookieStorage({ sameSite: 'lax' })
|
|
86
|
-
: defaultStorage,
|
|
94
|
+
resolvedKeyValueStorage,
|
|
87
95
|
);
|
|
96
|
+
|
|
97
|
+
authLibraryOptions.credentialsProvider = resolvedCredentialsProvider;
|
|
88
98
|
}
|
|
89
99
|
|
|
90
100
|
Amplify.configure(resolvedResourceConfig, {
|
|
91
|
-
Auth:
|
|
101
|
+
Auth: authLibraryOptions,
|
|
92
102
|
...libraryOptions,
|
|
93
103
|
});
|
|
94
104
|
|