aws-amplify 6.0.2-unstable.ff4e8d7.0 → 6.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/initSingleton.js +37 -16
- package/dist/cjs/initSingleton.js.map +1 -1
- package/dist/esm/initSingleton.mjs +37 -16
- package/dist/esm/initSingleton.mjs.map +1 -1
- package/package.json +29 -15
- package/src/initSingleton.ts +43 -25
|
@@ -16,30 +16,51 @@ exports.DefaultAmplify = {
|
|
|
16
16
|
else {
|
|
17
17
|
resolvedResourceConfig = resourceConfig;
|
|
18
18
|
}
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
if (resolvedResourceConfig.Auth
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
// If no Auth config is provided, no special handling will be required, configure as is.
|
|
20
|
+
// Otherwise, we can assume an Auth config is provided from here on.
|
|
21
|
+
if (!resolvedResourceConfig.Auth) {
|
|
22
|
+
return core_1.Amplify.configure(resolvedResourceConfig, libraryOptions);
|
|
23
|
+
}
|
|
24
|
+
// If Auth options are provided, always just configure as is.
|
|
25
|
+
// Otherwise, we can assume no Auth libraryOptions were provided from here on.
|
|
26
|
+
if (libraryOptions?.Auth) {
|
|
27
|
+
return core_1.Amplify.configure(resolvedResourceConfig, libraryOptions);
|
|
28
|
+
}
|
|
29
|
+
// If no Auth libraryOptions were previously configured, then always add default providers.
|
|
30
|
+
if (!core_1.Amplify.libraryOptions.Auth) {
|
|
24
31
|
cognito_1.cognitoUserPoolsTokenProvider.setAuthConfig(resolvedResourceConfig.Auth);
|
|
25
|
-
|
|
32
|
+
cognito_1.cognitoUserPoolsTokenProvider.setKeyValueStorage(
|
|
33
|
+
// TODO: allow configure with a public interface
|
|
34
|
+
libraryOptions?.ssr
|
|
35
|
+
? new core_1.CookieStorage({ sameSite: 'lax' })
|
|
36
|
+
: core_1.defaultStorage);
|
|
37
|
+
return core_1.Amplify.configure(resolvedResourceConfig, {
|
|
26
38
|
...libraryOptions,
|
|
27
39
|
Auth: {
|
|
28
40
|
tokenProvider: cognito_1.cognitoUserPoolsTokenProvider,
|
|
29
41
|
credentialsProvider: cognito_1.cognitoCredentialsProvider,
|
|
30
42
|
},
|
|
31
|
-
};
|
|
32
|
-
cognito_1.cognitoUserPoolsTokenProvider.setKeyValueStorage(libraryOptions?.ssr
|
|
33
|
-
? // TODO: allow configure with a public interface
|
|
34
|
-
new core_1.CookieStorage({
|
|
35
|
-
sameSite: 'lax',
|
|
36
|
-
})
|
|
37
|
-
: core_1.defaultStorage);
|
|
38
|
-
core_1.Amplify.configure(resolvedResourceConfig, libraryOptionsWithDefaultAuthProviders);
|
|
43
|
+
});
|
|
39
44
|
}
|
|
40
|
-
|
|
41
|
-
|
|
45
|
+
// At this point, Auth libraryOptions would have been previously configured and no overriding
|
|
46
|
+
// Auth options were given, so we should preserve the currently configured Auth libraryOptions.
|
|
47
|
+
if (libraryOptions) {
|
|
48
|
+
// If ssr is provided through libraryOptions, we should respect the intentional reconfiguration.
|
|
49
|
+
if (libraryOptions.ssr !== undefined) {
|
|
50
|
+
cognito_1.cognitoUserPoolsTokenProvider.setKeyValueStorage(
|
|
51
|
+
// TODO: allow configure with a public interface
|
|
52
|
+
libraryOptions.ssr
|
|
53
|
+
? new core_1.CookieStorage({ sameSite: 'lax' })
|
|
54
|
+
: core_1.defaultStorage);
|
|
55
|
+
}
|
|
56
|
+
return core_1.Amplify.configure(resolvedResourceConfig, {
|
|
57
|
+
Auth: core_1.Amplify.libraryOptions.Auth,
|
|
58
|
+
...libraryOptions,
|
|
59
|
+
});
|
|
42
60
|
}
|
|
61
|
+
// Finally, if there were no libraryOptions given at all, we should simply not touch the currently
|
|
62
|
+
// configured libraryOptions.
|
|
63
|
+
core_1.Amplify.configure(resolvedResourceConfig);
|
|
43
64
|
},
|
|
44
65
|
getConfig() {
|
|
45
66
|
return core_1.Amplify.getConfig();
|
|
@@ -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 configure(resourceConfig, libraryOptions) {\n let resolvedResourceConfig;\n if (Object.keys(resourceConfig).some(key => key.startsWith('aws_'))) {\n resolvedResourceConfig = (0, utils_1.parseAWSExports)(resourceConfig);\n }\n else {\n resolvedResourceConfig = resourceConfig;\n }\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 configure(resourceConfig, libraryOptions) {\n let resolvedResourceConfig;\n if (Object.keys(resourceConfig).some(key => key.startsWith('aws_'))) {\n resolvedResourceConfig = (0, utils_1.parseAWSExports)(resourceConfig);\n }\n else {\n resolvedResourceConfig = resourceConfig;\n }\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 return core_1.Amplify.configure(resolvedResourceConfig, libraryOptions);\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 return core_1.Amplify.configure(resolvedResourceConfig, libraryOptions);\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 libraryOptions?.ssr\n ? new core_1.CookieStorage({ sameSite: 'lax' })\n : core_1.defaultStorage);\n return core_1.Amplify.configure(resolvedResourceConfig, {\n ...libraryOptions,\n Auth: {\n tokenProvider: cognito_1.cognitoUserPoolsTokenProvider,\n credentialsProvider: cognito_1.cognitoCredentialsProvider,\n },\n });\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 // 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 libraryOptions.ssr\n ? new core_1.CookieStorage({ sameSite: 'lax' })\n : core_1.defaultStorage);\n }\n return core_1.Amplify.configure(resolvedResourceConfig, {\n Auth: core_1.Amplify.libraryOptions.Auth,\n ...libraryOptions,\n });\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 getConfig() {\n return core_1.Amplify.getConfig();\n },\n};\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,cAAc,GAAG,KAAK,CAAC,CAAC;AAChC;AACA;AACA,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC5C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC7D,MAAM,SAAS,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAC5C,OAAO,CAAC,cAAc,GAAG;AACzB,IAAI,SAAS,CAAC,cAAc,EAAE,c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7E,iBAAiB;AACjB,aAAa,CAAC,CAAC;AACf,SAAS;AACT;AACA;AACA,QAAQ,IAAI,cAAc,EAAE;AAC5B;AACA,YAAY,IAAI,cAAc,CAAC,GAAG,KAAK,SAAS,EAAE;AAClD,gBAAgB,SAAS,CAAC,6BAA6B,CAAC,kBAAkB;AAC1E;AACA,gBAAgB,cAAc,CAAC,GAAG;AAClC,sBAAsB,IAAI,MAAM,CAAC,aAAa,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AACnE,sBAAsB,MAAM,CAAC,cAAc,CAAC,CAAC;AAC7C,aAAa;AACb,YAAY,OAAO,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,sBAAsB,EAAE;AACpE,gBAAgB,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI;AACxD,gBAAgB,GAAG,cAAc;AACjC,aAAa,CAAC,CAAC;AACf,SAAS;AACT;AACA;AACA,QAAQ,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAC;AACzD,KAAK;AACL,IAAI,SAAS,GAAG;AAChB,QAAQ,OAAO,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;AAC1C,KAAK;AACL,CAAC;;"}
|
|
@@ -13,30 +13,51 @@ const DefaultAmplify = {
|
|
|
13
13
|
else {
|
|
14
14
|
resolvedResourceConfig = resourceConfig;
|
|
15
15
|
}
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
if (resolvedResourceConfig.Auth
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
// If no Auth config is provided, no special handling will be required, configure as is.
|
|
17
|
+
// Otherwise, we can assume an Auth config is provided from here on.
|
|
18
|
+
if (!resolvedResourceConfig.Auth) {
|
|
19
|
+
return Amplify.configure(resolvedResourceConfig, libraryOptions);
|
|
20
|
+
}
|
|
21
|
+
// If Auth options are provided, always just configure as is.
|
|
22
|
+
// Otherwise, we can assume no Auth libraryOptions were provided from here on.
|
|
23
|
+
if (libraryOptions?.Auth) {
|
|
24
|
+
return Amplify.configure(resolvedResourceConfig, libraryOptions);
|
|
25
|
+
}
|
|
26
|
+
// If no Auth libraryOptions were previously configured, then always add default providers.
|
|
27
|
+
if (!Amplify.libraryOptions.Auth) {
|
|
21
28
|
cognitoUserPoolsTokenProvider.setAuthConfig(resolvedResourceConfig.Auth);
|
|
22
|
-
|
|
29
|
+
cognitoUserPoolsTokenProvider.setKeyValueStorage(
|
|
30
|
+
// TODO: allow configure with a public interface
|
|
31
|
+
libraryOptions?.ssr
|
|
32
|
+
? new CookieStorage({ sameSite: 'lax' })
|
|
33
|
+
: defaultStorage);
|
|
34
|
+
return Amplify.configure(resolvedResourceConfig, {
|
|
23
35
|
...libraryOptions,
|
|
24
36
|
Auth: {
|
|
25
37
|
tokenProvider: cognitoUserPoolsTokenProvider,
|
|
26
38
|
credentialsProvider: cognitoCredentialsProvider,
|
|
27
39
|
},
|
|
28
|
-
};
|
|
29
|
-
cognitoUserPoolsTokenProvider.setKeyValueStorage(libraryOptions?.ssr
|
|
30
|
-
? // TODO: allow configure with a public interface
|
|
31
|
-
new CookieStorage({
|
|
32
|
-
sameSite: 'lax',
|
|
33
|
-
})
|
|
34
|
-
: defaultStorage);
|
|
35
|
-
Amplify.configure(resolvedResourceConfig, libraryOptionsWithDefaultAuthProviders);
|
|
40
|
+
});
|
|
36
41
|
}
|
|
37
|
-
|
|
38
|
-
|
|
42
|
+
// At this point, Auth libraryOptions would have been previously configured and no overriding
|
|
43
|
+
// Auth options were given, so we should preserve the currently configured Auth libraryOptions.
|
|
44
|
+
if (libraryOptions) {
|
|
45
|
+
// If ssr is provided through libraryOptions, we should respect the intentional reconfiguration.
|
|
46
|
+
if (libraryOptions.ssr !== undefined) {
|
|
47
|
+
cognitoUserPoolsTokenProvider.setKeyValueStorage(
|
|
48
|
+
// TODO: allow configure with a public interface
|
|
49
|
+
libraryOptions.ssr
|
|
50
|
+
? new CookieStorage({ sameSite: 'lax' })
|
|
51
|
+
: defaultStorage);
|
|
52
|
+
}
|
|
53
|
+
return Amplify.configure(resolvedResourceConfig, {
|
|
54
|
+
Auth: Amplify.libraryOptions.Auth,
|
|
55
|
+
...libraryOptions,
|
|
56
|
+
});
|
|
39
57
|
}
|
|
58
|
+
// Finally, if there were no libraryOptions given at all, we should simply not touch the currently
|
|
59
|
+
// configured libraryOptions.
|
|
60
|
+
Amplify.configure(resolvedResourceConfig);
|
|
40
61
|
},
|
|
41
62
|
getConfig() {
|
|
42
63
|
return Amplify.getConfig();
|
|
@@ -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 { parseAWSExports, } from '@aws-amplify/core/internals/utils';\nimport { cognitoUserPoolsTokenProvider, cognitoCredentialsProvider, } from './auth/cognito';\nexport const DefaultAmplify = {\n configure(resourceConfig, libraryOptions) {\n let resolvedResourceConfig;\n if (Object.keys(resourceConfig).some(key => key.startsWith('aws_'))) {\n resolvedResourceConfig = parseAWSExports(resourceConfig);\n }\n else {\n resolvedResourceConfig = resourceConfig;\n }\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 { parseAWSExports, } from '@aws-amplify/core/internals/utils';\nimport { cognitoUserPoolsTokenProvider, cognitoCredentialsProvider, } from './auth/cognito';\nexport const DefaultAmplify = {\n configure(resourceConfig, libraryOptions) {\n let resolvedResourceConfig;\n if (Object.keys(resourceConfig).some(key => key.startsWith('aws_'))) {\n resolvedResourceConfig = parseAWSExports(resourceConfig);\n }\n else {\n resolvedResourceConfig = resourceConfig;\n }\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 return Amplify.configure(resolvedResourceConfig, libraryOptions);\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 return Amplify.configure(resolvedResourceConfig, libraryOptions);\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 libraryOptions?.ssr\n ? new CookieStorage({ sameSite: 'lax' })\n : defaultStorage);\n return Amplify.configure(resolvedResourceConfig, {\n ...libraryOptions,\n Auth: {\n tokenProvider: cognitoUserPoolsTokenProvider,\n credentialsProvider: cognitoCredentialsProvider,\n },\n });\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 // 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 libraryOptions.ssr\n ? new CookieStorage({ sameSite: 'lax' })\n : defaultStorage);\n }\n return Amplify.configure(resolvedResourceConfig, {\n Auth: Amplify.libraryOptions.Auth,\n ...libraryOptions,\n });\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 getConfig() {\n return Amplify.getConfig();\n },\n};\n"],"names":[],"mappings":";;;;AAAA;AACA;AAIY,MAAC,cAAc,GAAG;AAC9B,IAAI,SAAS,CAAC,cAAc,EAAE,cAAc,EAAE;AAC9C,QAAQ,IAAI,sBAAsB,CAAC;AACnC,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,cAAc,C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B,IAAI,aAAa,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AAC5D,sBAAsB,cAAc,CAAC,CAAC;AACtC,aAAa;AACb,YAAY,OAAO,OAAO,CAAC,SAAS,CAAC,sBAAsB,EAAE;AAC7D,gBAAgB,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC,IAAI;AACjD,gBAAgB,GAAG,cAAc;AACjC,aAAa,CAAC,CAAC;AACf,SAAS;AACT;AACA;AACA,QAAQ,OAAO,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAC;AAClD,KAAK;AACL,IAAI,SAAS,GAAG;AAChB,QAAQ,OAAO,OAAO,CAAC,SAAS,EAAE,CAAC;AACnC,KAAK;AACL;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aws-amplify",
|
|
3
|
-
"version": "6.0.2
|
|
3
|
+
"version": "6.0.2",
|
|
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",
|
|
@@ -36,6 +36,17 @@
|
|
|
36
36
|
"import": "./dist/esm/api/server.mjs",
|
|
37
37
|
"require": "./dist/cjs/api/server.js"
|
|
38
38
|
},
|
|
39
|
+
"./data": {
|
|
40
|
+
"types": "./dist/esm/api/index.d.ts",
|
|
41
|
+
"import": "./dist/esm/api/index.mjs",
|
|
42
|
+
"require": "./dist/cjs/api/index.js",
|
|
43
|
+
"react-native": "./src/api/index.ts"
|
|
44
|
+
},
|
|
45
|
+
"./data/server": {
|
|
46
|
+
"types": "./dist/esm/api/server.d.ts",
|
|
47
|
+
"import": "./dist/esm/api/server.mjs",
|
|
48
|
+
"require": "./dist/cjs/api/server.js"
|
|
49
|
+
},
|
|
39
50
|
"./datastore": {
|
|
40
51
|
"types": "./dist/esm/datastore/index.d.ts",
|
|
41
52
|
"import": "./dist/esm/datastore/index.mjs",
|
|
@@ -146,6 +157,9 @@
|
|
|
146
157
|
"api": [
|
|
147
158
|
"./dist/esm/api/index.d.ts"
|
|
148
159
|
],
|
|
160
|
+
"data": [
|
|
161
|
+
"./dist/esm/api/index.d.ts"
|
|
162
|
+
],
|
|
149
163
|
"api/server": [
|
|
150
164
|
"./dist/esm/api/server.d.ts"
|
|
151
165
|
],
|
|
@@ -250,13 +264,13 @@
|
|
|
250
264
|
"utils"
|
|
251
265
|
],
|
|
252
266
|
"dependencies": {
|
|
253
|
-
"@aws-amplify/analytics": "7.0.2
|
|
254
|
-
"@aws-amplify/api": "6.0.2
|
|
255
|
-
"@aws-amplify/auth": "6.0.2
|
|
256
|
-
"@aws-amplify/core": "6.0.2
|
|
257
|
-
"@aws-amplify/datastore": "5.0.2
|
|
258
|
-
"@aws-amplify/notifications": "2.0.2
|
|
259
|
-
"@aws-amplify/storage": "6.0.2
|
|
267
|
+
"@aws-amplify/analytics": "7.0.2",
|
|
268
|
+
"@aws-amplify/api": "6.0.2",
|
|
269
|
+
"@aws-amplify/auth": "6.0.2",
|
|
270
|
+
"@aws-amplify/core": "6.0.2",
|
|
271
|
+
"@aws-amplify/datastore": "5.0.2",
|
|
272
|
+
"@aws-amplify/notifications": "2.0.2",
|
|
273
|
+
"@aws-amplify/storage": "6.0.2",
|
|
260
274
|
"tslib": "^2.5.0"
|
|
261
275
|
},
|
|
262
276
|
"devDependencies": {
|
|
@@ -311,19 +325,19 @@
|
|
|
311
325
|
"name": "[API] generateClient (AppSync)",
|
|
312
326
|
"path": "./dist/esm/api/index.mjs",
|
|
313
327
|
"import": "{ generateClient }",
|
|
314
|
-
"limit": "
|
|
328
|
+
"limit": "35.89 kB"
|
|
315
329
|
},
|
|
316
330
|
{
|
|
317
331
|
"name": "[API] REST API handlers",
|
|
318
332
|
"path": "./dist/esm/api/index.mjs",
|
|
319
333
|
"import": "{ get, post, put, del, patch, head, isCancelError }",
|
|
320
|
-
"limit": "
|
|
334
|
+
"limit": "15.0 kB"
|
|
321
335
|
},
|
|
322
336
|
{
|
|
323
337
|
"name": "[Auth] signUp (Cognito)",
|
|
324
338
|
"path": "./dist/esm/auth/index.mjs",
|
|
325
339
|
"import": "{ signUp }",
|
|
326
|
-
"limit": "
|
|
340
|
+
"limit": "31.00 kB"
|
|
327
341
|
},
|
|
328
342
|
{
|
|
329
343
|
"name": "[Auth] resetPassword (Cognito)",
|
|
@@ -341,7 +355,7 @@
|
|
|
341
355
|
"name": "[Auth] signIn (Cognito)",
|
|
342
356
|
"path": "./dist/esm/auth/index.mjs",
|
|
343
357
|
"import": "{ signIn }",
|
|
344
|
-
"limit": "
|
|
358
|
+
"limit": "30.00 kB"
|
|
345
359
|
},
|
|
346
360
|
{
|
|
347
361
|
"name": "[Auth] resendSignUpCode (Cognito)",
|
|
@@ -353,7 +367,7 @@
|
|
|
353
367
|
"name": "[Auth] confirmSignUp (Cognito)",
|
|
354
368
|
"path": "./dist/esm/auth/index.mjs",
|
|
355
369
|
"import": "{ confirmSignUp }",
|
|
356
|
-
"limit": "
|
|
370
|
+
"limit": "31.00 kB"
|
|
357
371
|
},
|
|
358
372
|
{
|
|
359
373
|
"name": "[Auth] confirmSignIn (Cognito)",
|
|
@@ -389,7 +403,7 @@
|
|
|
389
403
|
"name": "[Auth] setUpTOTP (Cognito)",
|
|
390
404
|
"path": "./dist/esm/auth/index.mjs",
|
|
391
405
|
"import": "{ setUpTOTP }",
|
|
392
|
-
"limit": "
|
|
406
|
+
"limit": "13.50 kB"
|
|
393
407
|
},
|
|
394
408
|
{
|
|
395
409
|
"name": "[Auth] updateUserAttributes (Cognito)",
|
|
@@ -516,5 +530,5 @@
|
|
|
516
530
|
"dual-publish-tmp"
|
|
517
531
|
]
|
|
518
532
|
},
|
|
519
|
-
"gitHead": "
|
|
533
|
+
"gitHead": "e9c04a6d233f812b2888aa51a71b66a4040af8c0"
|
|
520
534
|
}
|
package/src/initSingleton.ts
CHANGED
|
@@ -29,39 +29,57 @@ export const DefaultAmplify = {
|
|
|
29
29
|
resolvedResourceConfig = resourceConfig as ResourcesConfig;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
//
|
|
33
|
-
//
|
|
34
|
-
if (
|
|
35
|
-
resolvedResourceConfig
|
|
36
|
-
|
|
37
|
-
!Amplify.libraryOptions.Auth
|
|
38
|
-
) {
|
|
39
|
-
cognitoUserPoolsTokenProvider.setAuthConfig(resolvedResourceConfig.Auth);
|
|
32
|
+
// If no Auth config is provided, no special handling will be required, configure as is.
|
|
33
|
+
// Otherwise, we can assume an Auth config is provided from here on.
|
|
34
|
+
if (!resolvedResourceConfig.Auth) {
|
|
35
|
+
return Amplify.configure(resolvedResourceConfig, libraryOptions);
|
|
36
|
+
}
|
|
40
37
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
};
|
|
38
|
+
// If Auth options are provided, always just configure as is.
|
|
39
|
+
// Otherwise, we can assume no Auth libraryOptions were provided from here on.
|
|
40
|
+
if (libraryOptions?.Auth) {
|
|
41
|
+
return Amplify.configure(resolvedResourceConfig, libraryOptions);
|
|
42
|
+
}
|
|
48
43
|
|
|
44
|
+
// If no Auth libraryOptions were previously configured, then always add default providers.
|
|
45
|
+
if (!Amplify.libraryOptions.Auth) {
|
|
46
|
+
cognitoUserPoolsTokenProvider.setAuthConfig(resolvedResourceConfig.Auth);
|
|
49
47
|
cognitoUserPoolsTokenProvider.setKeyValueStorage(
|
|
48
|
+
// TODO: allow configure with a public interface
|
|
50
49
|
libraryOptions?.ssr
|
|
51
|
-
?
|
|
52
|
-
new CookieStorage({
|
|
53
|
-
sameSite: 'lax',
|
|
54
|
-
})
|
|
50
|
+
? new CookieStorage({ sameSite: 'lax' })
|
|
55
51
|
: defaultStorage
|
|
56
52
|
);
|
|
53
|
+
return Amplify.configure(resolvedResourceConfig, {
|
|
54
|
+
...libraryOptions,
|
|
55
|
+
Auth: {
|
|
56
|
+
tokenProvider: cognitoUserPoolsTokenProvider,
|
|
57
|
+
credentialsProvider: cognitoCredentialsProvider,
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
}
|
|
57
61
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
// At this point, Auth libraryOptions would have been previously configured and no overriding
|
|
63
|
+
// Auth options were given, so we should preserve the currently configured Auth libraryOptions.
|
|
64
|
+
if (libraryOptions) {
|
|
65
|
+
// If ssr is provided through libraryOptions, we should respect the intentional reconfiguration.
|
|
66
|
+
if (libraryOptions.ssr !== undefined) {
|
|
67
|
+
cognitoUserPoolsTokenProvider.setKeyValueStorage(
|
|
68
|
+
// TODO: allow configure with a public interface
|
|
69
|
+
libraryOptions.ssr
|
|
70
|
+
? new CookieStorage({ sameSite: 'lax' })
|
|
71
|
+
: defaultStorage
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
return Amplify.configure(resolvedResourceConfig, {
|
|
75
|
+
Auth: Amplify.libraryOptions.Auth,
|
|
76
|
+
...libraryOptions,
|
|
77
|
+
});
|
|
64
78
|
}
|
|
79
|
+
|
|
80
|
+
// Finally, if there were no libraryOptions given at all, we should simply not touch the currently
|
|
81
|
+
// configured libraryOptions.
|
|
82
|
+
Amplify.configure(resolvedResourceConfig);
|
|
65
83
|
},
|
|
66
84
|
getConfig(): ResourcesConfig {
|
|
67
85
|
return Amplify.getConfig();
|