aws-amplify 6.12.4-unstable.289f3e8.0 → 6.12.4-unstable.b8f57f2.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.
Files changed (33) hide show
  1. package/adapter-core/internals/package.json +7 -0
  2. package/api/internals/package.json +7 -0
  3. package/dist/cjs/adapter-core/constants.js +8 -0
  4. package/dist/cjs/adapter-core/constants.js.map +1 -0
  5. package/dist/cjs/adapter-core/index.js +10 -1
  6. package/dist/cjs/adapter-core/index.js.map +1 -1
  7. package/dist/cjs/adapter-core/internals.js +15 -0
  8. package/dist/cjs/adapter-core/internals.js.map +1 -0
  9. package/dist/cjs/adapter-core/storageFactories/createKeyValueStorageFromCookieStorageAdapter.js +10 -6
  10. package/dist/cjs/adapter-core/storageFactories/createKeyValueStorageFromCookieStorageAdapter.js.map +1 -1
  11. package/dist/cjs/api/internals.js +9 -0
  12. package/dist/cjs/api/internals.js.map +1 -0
  13. package/dist/esm/adapter-core/constants.d.ts +1 -0
  14. package/dist/esm/adapter-core/constants.mjs +6 -0
  15. package/dist/esm/adapter-core/constants.mjs.map +1 -0
  16. package/dist/esm/adapter-core/index.d.ts +2 -0
  17. package/dist/esm/adapter-core/index.mjs +2 -0
  18. package/dist/esm/adapter-core/index.mjs.map +1 -1
  19. package/dist/esm/adapter-core/internals.d.ts +3 -0
  20. package/dist/esm/adapter-core/internals.mjs +3 -0
  21. package/dist/esm/adapter-core/internals.mjs.map +1 -0
  22. package/dist/esm/adapter-core/storageFactories/createKeyValueStorageFromCookieStorageAdapter.d.ts +1 -1
  23. package/dist/esm/adapter-core/storageFactories/createKeyValueStorageFromCookieStorageAdapter.mjs +11 -6
  24. package/dist/esm/adapter-core/storageFactories/createKeyValueStorageFromCookieStorageAdapter.mjs.map +1 -1
  25. package/dist/esm/api/internals.d.ts +1 -0
  26. package/dist/esm/api/internals.mjs +2 -0
  27. package/dist/esm/api/internals.mjs.map +1 -0
  28. package/package.json +26 -9
  29. package/src/adapter-core/constants.ts +4 -0
  30. package/src/adapter-core/index.ts +9 -0
  31. package/src/adapter-core/internals.ts +17 -0
  32. package/src/adapter-core/storageFactories/createKeyValueStorageFromCookieStorageAdapter.ts +13 -5
  33. package/src/api/internals.ts +10 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "aws-amplify/adapter-core/internals",
3
+ "types": "../../dist/esm/adapter-core/internals.d.ts",
4
+ "main": "../../dist/cjs/adapter-core/internals.js",
5
+ "module": "../../dist/esm/adapter-core/internals.mjs",
6
+ "sideEffects": false
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "aws-amplify/api/internals",
3
+ "main": "../../dist/cjs/api/internals.js",
4
+ "browser": "../../dist/esm/api/internals.mjs",
5
+ "module": "../../dist/esm/api/internals.mjs",
6
+ "typings": "../../dist/esm/api/internals.d.ts"
7
+ }
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ // SPDX-License-Identifier: Apache-2.0
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DEFAULT_AUTH_TOKEN_COOKIES_MAX_AGE = void 0;
7
+ exports.DEFAULT_AUTH_TOKEN_COOKIES_MAX_AGE = 365 * 24 * 60 * 60; // 1 year in seconds
8
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sources":["../../../src/adapter-core/constants.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DEFAULT_AUTH_TOKEN_COOKIES_MAX_AGE = void 0;\nexports.DEFAULT_AUTH_TOKEN_COOKIES_MAX_AGE = 365 * 24 * 60 * 60; // 1 year in seconds\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,kCAAkC,GAAG,KAAK,CAAC,CAAC;AACpD,OAAO,CAAC,kCAAkC,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;;"}
@@ -3,7 +3,7 @@
3
3
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
4
  // SPDX-License-Identifier: Apache-2.0
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createUserPoolsTokenProvider = exports.createAWSCredentialsAndIdentityIdProvider = exports.createKeyValueStorageFromCookieStorageAdapter = exports.runWithAmplifyServerContext = void 0;
6
+ exports.DEFAULT_AUTH_TOKEN_COOKIES_MAX_AGE = exports.AUTH_KEY_PREFIX = exports.createKeysForAuthStorage = exports.validateState = exports.generateCodeVerifier = exports.getRedirectUrl = exports.generateState = exports.createUserPoolsTokenProvider = exports.createAWSCredentialsAndIdentityIdProvider = exports.createKeyValueStorageFromCookieStorageAdapter = exports.runWithAmplifyServerContext = void 0;
7
7
  var runWithAmplifyServerContext_1 = require("./runWithAmplifyServerContext");
8
8
  Object.defineProperty(exports, "runWithAmplifyServerContext", { enumerable: true, get: function () { return runWithAmplifyServerContext_1.runWithAmplifyServerContext; } });
9
9
  var storageFactories_1 = require("./storageFactories");
@@ -11,4 +11,13 @@ Object.defineProperty(exports, "createKeyValueStorageFromCookieStorageAdapter",
11
11
  var cognito_1 = require("./authProvidersFactories/cognito");
12
12
  Object.defineProperty(exports, "createAWSCredentialsAndIdentityIdProvider", { enumerable: true, get: function () { return cognito_1.createAWSCredentialsAndIdentityIdProvider; } });
13
13
  Object.defineProperty(exports, "createUserPoolsTokenProvider", { enumerable: true, get: function () { return cognito_1.createUserPoolsTokenProvider; } });
14
+ var cognito_2 = require("@aws-amplify/auth/cognito");
15
+ Object.defineProperty(exports, "generateState", { enumerable: true, get: function () { return cognito_2.generateState; } });
16
+ Object.defineProperty(exports, "getRedirectUrl", { enumerable: true, get: function () { return cognito_2.getRedirectUrl; } });
17
+ Object.defineProperty(exports, "generateCodeVerifier", { enumerable: true, get: function () { return cognito_2.generateCodeVerifier; } });
18
+ Object.defineProperty(exports, "validateState", { enumerable: true, get: function () { return cognito_2.validateState; } });
19
+ Object.defineProperty(exports, "createKeysForAuthStorage", { enumerable: true, get: function () { return cognito_2.createKeysForAuthStorage; } });
20
+ Object.defineProperty(exports, "AUTH_KEY_PREFIX", { enumerable: true, get: function () { return cognito_2.AUTH_KEY_PREFIX; } });
21
+ var constants_1 = require("./constants");
22
+ Object.defineProperty(exports, "DEFAULT_AUTH_TOKEN_COOKIES_MAX_AGE", { enumerable: true, get: function () { return constants_1.DEFAULT_AUTH_TOKEN_COOKIES_MAX_AGE; } });
14
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/adapter-core/index.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createUserPoolsTokenProvider = exports.createAWSCredentialsAndIdentityIdProvider = exports.createKeyValueStorageFromCookieStorageAdapter = exports.runWithAmplifyServerContext = void 0;\nvar runWithAmplifyServerContext_1 = require(\"./runWithAmplifyServerContext\");\nObject.defineProperty(exports, \"runWithAmplifyServerContext\", { enumerable: true, get: function () { return runWithAmplifyServerContext_1.runWithAmplifyServerContext; } });\nvar storageFactories_1 = require(\"./storageFactories\");\nObject.defineProperty(exports, \"createKeyValueStorageFromCookieStorageAdapter\", { enumerable: true, get: function () { return storageFactories_1.createKeyValueStorageFromCookieStorageAdapter; } });\nvar cognito_1 = require(\"./authProvidersFactories/cognito\");\nObject.defineProperty(exports, \"createAWSCredentialsAndIdentityIdProvider\", { enumerable: true, get: function () { return cognito_1.createAWSCredentialsAndIdentityIdProvider; } });\nObject.defineProperty(exports, \"createUserPoolsTokenProvider\", { enumerable: true, get: function () { return cognito_1.createUserPoolsTokenProvider; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,4BAA4B,GAAG,OAAO,CAAC,yCAAyC,GAAG,OAAO,CAAC,6CAA6C,GAAG,OAAO,CAAC,2BAA2B,GAAG,KAAK,CAAC,CAAC;AAChM,IAAI,6BAA6B,GAAG,OAAO,CAAC,+BAA+B,CAAC,CAAC;AAC7E,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,6BAA6B,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,6BAA6B,CAAC,2BAA2B,CAAC,EAAE,EAAE,CAAC,CAAC;AAC5K,IAAI,kBAAkB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AACvD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,+CAA+C,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,kBAAkB,CAAC,6CAA6C,CAAC,EAAE,EAAE,CAAC,CAAC;AACrM,IAAI,SAAS,GAAG,OAAO,CAAC,kCAAkC,CAAC,CAAC;AAC5D,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,2CAA2C,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,SAAS,CAAC,yCAAyC,CAAC,EAAE,EAAE,CAAC,CAAC;AACpL,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,8BAA8B,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,SAAS,CAAC,4BAA4B,CAAC,EAAE,EAAE,CAAC;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/adapter-core/index.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DEFAULT_AUTH_TOKEN_COOKIES_MAX_AGE = exports.AUTH_KEY_PREFIX = exports.createKeysForAuthStorage = exports.validateState = exports.generateCodeVerifier = exports.getRedirectUrl = exports.generateState = exports.createUserPoolsTokenProvider = exports.createAWSCredentialsAndIdentityIdProvider = exports.createKeyValueStorageFromCookieStorageAdapter = exports.runWithAmplifyServerContext = void 0;\nvar runWithAmplifyServerContext_1 = require(\"./runWithAmplifyServerContext\");\nObject.defineProperty(exports, \"runWithAmplifyServerContext\", { enumerable: true, get: function () { return runWithAmplifyServerContext_1.runWithAmplifyServerContext; } });\nvar storageFactories_1 = require(\"./storageFactories\");\nObject.defineProperty(exports, \"createKeyValueStorageFromCookieStorageAdapter\", { enumerable: true, get: function () { return storageFactories_1.createKeyValueStorageFromCookieStorageAdapter; } });\nvar cognito_1 = require(\"./authProvidersFactories/cognito\");\nObject.defineProperty(exports, \"createAWSCredentialsAndIdentityIdProvider\", { enumerable: true, get: function () { return cognito_1.createAWSCredentialsAndIdentityIdProvider; } });\nObject.defineProperty(exports, \"createUserPoolsTokenProvider\", { enumerable: true, get: function () { return cognito_1.createUserPoolsTokenProvider; } });\nvar cognito_2 = require(\"@aws-amplify/auth/cognito\");\nObject.defineProperty(exports, \"generateState\", { enumerable: true, get: function () { return cognito_2.generateState; } });\nObject.defineProperty(exports, \"getRedirectUrl\", { enumerable: true, get: function () { return cognito_2.getRedirectUrl; } });\nObject.defineProperty(exports, \"generateCodeVerifier\", { enumerable: true, get: function () { return cognito_2.generateCodeVerifier; } });\nObject.defineProperty(exports, \"validateState\", { enumerable: true, get: function () { return cognito_2.validateState; } });\nObject.defineProperty(exports, \"createKeysForAuthStorage\", { enumerable: true, get: function () { return cognito_2.createKeysForAuthStorage; } });\nObject.defineProperty(exports, \"AUTH_KEY_PREFIX\", { enumerable: true, get: function () { return cognito_2.AUTH_KEY_PREFIX; } });\nvar constants_1 = require(\"./constants\");\nObject.defineProperty(exports, \"DEFAULT_AUTH_TOKEN_COOKIES_MAX_AGE\", { enumerable: true, get: function () { return constants_1.DEFAULT_AUTH_TOKEN_COOKIES_MAX_AGE; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,kCAAkC,GAAG,OAAO,CAAC,eAAe,GAAG,OAAO,CAAC,wBAAwB,GAAG,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,oBAAoB,GAAG,OAAO,CAAC,cAAc,GAAG,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,4BAA4B,GAAG,OAAO,CAAC,yCAAyC,GAAG,OAAO,CAAC,6CAA6C,GAAG,OAAO,CAAC,2BAA2B,GAAG,KAAK,CAAC,CAAC;AAClZ,IAAI,6BAA6B,GAAG,OAAO,CAAC,+BAA+B,CAAC,CAAC;AAC7E,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,6BAA6B,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,6BAA6B,CAAC,2BAA2B,CAAC,EAAE,EAAE,CAAC,CAAC;AAC5K,IAAI,kBAAkB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AACvD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,+CAA+C,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,kBAAkB,CAAC,6CAA6C,CAAC,EAAE,EAAE,CAAC,CAAC;AACrM,IAAI,SAAS,GAAG,OAAO,CAAC,kCAAkC,CAAC,CAAC;AAC5D,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,2CAA2C,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,SAAS,CAA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AAC,EAAE,EAAE,CAAC,CAAC;AAChI,IAAI,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AACzC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,oCAAoC,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,WAAW,CAAC,kCAAkC,CAAC,EAAE,EAAE,CAAC;;"}
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ // SPDX-License-Identifier: Apache-2.0
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.decodeJWT = exports.urlSafeEncode = exports.assertTokenProviderConfig = exports.assertOAuthConfig = exports.getAmplifyServerContext = exports.AmplifyServerContextError = void 0;
7
+ var adapter_core_1 = require("@aws-amplify/core/internals/adapter-core");
8
+ Object.defineProperty(exports, "AmplifyServerContextError", { enumerable: true, get: function () { return adapter_core_1.AmplifyServerContextError; } });
9
+ Object.defineProperty(exports, "getAmplifyServerContext", { enumerable: true, get: function () { return adapter_core_1.getAmplifyServerContext; } });
10
+ var utils_1 = require("@aws-amplify/core/internals/utils");
11
+ Object.defineProperty(exports, "assertOAuthConfig", { enumerable: true, get: function () { return utils_1.assertOAuthConfig; } });
12
+ Object.defineProperty(exports, "assertTokenProviderConfig", { enumerable: true, get: function () { return utils_1.assertTokenProviderConfig; } });
13
+ Object.defineProperty(exports, "urlSafeEncode", { enumerable: true, get: function () { return utils_1.urlSafeEncode; } });
14
+ Object.defineProperty(exports, "decodeJWT", { enumerable: true, get: function () { return utils_1.decodeJWT; } });
15
+ //# sourceMappingURL=internals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internals.js","sources":["../../../src/adapter-core/internals.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.decodeJWT = exports.urlSafeEncode = exports.assertTokenProviderConfig = exports.assertOAuthConfig = exports.getAmplifyServerContext = exports.AmplifyServerContextError = void 0;\nvar adapter_core_1 = require(\"@aws-amplify/core/internals/adapter-core\");\nObject.defineProperty(exports, \"AmplifyServerContextError\", { enumerable: true, get: function () { return adapter_core_1.AmplifyServerContextError; } });\nObject.defineProperty(exports, \"getAmplifyServerContext\", { enumerable: true, get: function () { return adapter_core_1.getAmplifyServerContext; } });\nvar utils_1 = require(\"@aws-amplify/core/internals/utils\");\nObject.defineProperty(exports, \"assertOAuthConfig\", { enumerable: true, get: function () { return utils_1.assertOAuthConfig; } });\nObject.defineProperty(exports, \"assertTokenProviderConfig\", { enumerable: true, get: function () { return utils_1.assertTokenProviderConfig; } });\nObject.defineProperty(exports, \"urlSafeEncode\", { enumerable: true, get: function () { return utils_1.urlSafeEncode; } });\nObject.defineProperty(exports, \"decodeJWT\", { enumerable: true, get: function () { return utils_1.decodeJWT; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,yBAAyB,GAAG,OAAO,CAAC,iBAAiB,GAAG,OAAO,CAAC,uBAAuB,GAAG,OAAO,CAAC,yBAAyB,GAAG,KAAK,CAAC,CAAC;AACzL,IAAI,cAAc,GAAG,OAAO,CAAC,0CAA0C,CAAC,CAAC;AACzE,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,2BAA2B,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,cAAc,CAAC,yBAAyB,CAAC,EAAE,EAAE,CAAC,CAAC;AACzJ,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,yBAAyB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,cAAc,CAAC,uBAAuB,CAAC,EAAE,EAAE,CAAC,CAAC;AACrJ,IAAI,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC3D,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,mBAAmB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,OAAO,CAAC,iBAAiB,CAAC,EAAE,EAAE,CAAC,CAAC;AAClI,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,2BAA2B,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,OAAO,CAAC,yBAAyB,CAAC,EAAE,EAAE,CAAC,CAAC;AAClJ,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,OAAO,CAAC,aAAa,CAAC,EAAE,EAAE,CAAC,CAAC;AAC1H,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,OAAO,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC;;"}
@@ -4,31 +4,35 @@
4
4
  // SPDX-License-Identifier: Apache-2.0
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.createKeyValueStorageFromCookieStorageAdapter = exports.defaultSetCookieOptions = void 0;
7
+ const constants_1 = require("../constants");
7
8
  exports.defaultSetCookieOptions = {
8
9
  // TODO: allow configure with a public interface
9
10
  sameSite: 'lax',
10
11
  secure: true,
11
12
  path: '/',
12
13
  };
13
- const ONE_YEAR_IN_MS = 365 * 24 * 60 * 60 * 1000;
14
14
  /**
15
15
  * Creates a Key Value storage interface using the `cookieStorageAdapter` as the
16
16
  * underlying storage.
17
17
  * @param cookieStorageAdapter An implementation of the `Adapter` in {@link CookieStorage}.
18
18
  * @returns An object that implements {@link KeyValueStorageInterface}.
19
19
  */
20
- const createKeyValueStorageFromCookieStorageAdapter = (cookieStorageAdapter, validator) => {
20
+ const createKeyValueStorageFromCookieStorageAdapter = (cookieStorageAdapter, validator, setCookieOptions = {}) => {
21
21
  return {
22
22
  setItem(key, value) {
23
23
  // Delete the cookie item first then set it. This results:
24
24
  // SetCookie: key=;expires=1970-01-01;(path='current-path') <- remove path'ed cookies
25
25
  // SetCookie: key=value;expires=Date.now() + 365 days;path=/;secure=true
26
26
  cookieStorageAdapter.delete(key);
27
- // TODO(HuiSF): follow up the default CookieSerializeOptions values
28
- cookieStorageAdapter.set(key, value, {
27
+ const mergedCookieOptions = {
29
28
  ...exports.defaultSetCookieOptions,
30
- expires: new Date(Date.now() + ONE_YEAR_IN_MS),
31
- });
29
+ ...setCookieOptions,
30
+ };
31
+ // when expires and maxAge both are not specified, we set a default maxAge
32
+ if (!mergedCookieOptions.expires && !mergedCookieOptions.maxAge) {
33
+ mergedCookieOptions.maxAge = constants_1.DEFAULT_AUTH_TOKEN_COOKIES_MAX_AGE;
34
+ }
35
+ cookieStorageAdapter.set(key, value, mergedCookieOptions);
32
36
  return Promise.resolve();
33
37
  },
34
38
  async getItem(key) {
@@ -1 +1 @@
1
- {"version":3,"file":"createKeyValueStorageFromCookieStorageAdapter.js","sources":["../../../../src/adapter-core/storageFactories/createKeyValueStorageFromCookieStorageAdapter.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createKeyValueStorageFromCookieStorageAdapter = exports.defaultSetCookieOptions = void 0;\nexports.defaultSetCookieOptions = {\n // TODO: allow configure with a public interface\n sameSite: 'lax',\n secure: true,\n path: '/',\n};\nconst ONE_YEAR_IN_MS = 365 * 24 * 60 * 60 * 1000;\n/**\n * Creates a Key Value storage interface using the `cookieStorageAdapter` as the\n * underlying storage.\n * @param cookieStorageAdapter An implementation of the `Adapter` in {@link CookieStorage}.\n * @returns An object that implements {@link KeyValueStorageInterface}.\n */\nconst createKeyValueStorageFromCookieStorageAdapter = (cookieStorageAdapter, validator) => {\n return {\n setItem(key, value) {\n // Delete the cookie item first then set it. This results:\n // SetCookie: key=;expires=1970-01-01;(path='current-path') <- remove path'ed cookies\n // SetCookie: key=value;expires=Date.now() + 365 days;path=/;secure=true\n cookieStorageAdapter.delete(key);\n // TODO(HuiSF): follow up the default CookieSerializeOptions values\n cookieStorageAdapter.set(key, value, {\n ...exports.defaultSetCookieOptions,\n expires: new Date(Date.now() + ONE_YEAR_IN_MS),\n });\n return Promise.resolve();\n },\n async getItem(key) {\n const cookie = cookieStorageAdapter.get(key);\n const value = cookie?.value ?? null;\n if (value && validator?.getItem) {\n const isValid = await validator.getItem(key, value);\n if (!isValid)\n return null;\n }\n return value;\n },\n removeItem(key) {\n cookieStorageAdapter.delete(key);\n return Promise.resolve();\n },\n clear() {\n // TODO(HuiSF): follow up the implementation.\n throw new Error('This method has not implemented.');\n },\n };\n};\nexports.createKeyValueStorageFromCookieStorageAdapter = createKeyValueStorageFromCookieStorageAdapter;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,6CAA6C,GAAG,OAAO,CAAC,uBAAuB,GAAG,KAAK,CAAC,CAAC;AACjG,OAAO,CAAC,uBAAuB,GAAG;AAClC;AACA,IAAI,QAAQ,EAAE,KAAK;AACnB,IAAI,MAAM,EAAE,IAAI;AAChB,IAAI,IAAI,EAAE,GAAG;AACb,CAAC,CAAC;AACF,MAAM,cAAc,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AACjD;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,6CAA6C,GAAG,CAAC,oBAAoB,EAAE,SAAS,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orageFromCookieStorageAdapter.js","sources":["../../../../src/adapter-core/storageFactories/createKeyValueStorageFromCookieStorageAdapter.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createKeyValueStorageFromCookieStorageAdapter = exports.defaultSetCookieOptions = void 0;\nconst constants_1 = require(\"../constants\");\nexports.defaultSetCookieOptions = {\n // TODO: allow configure with a public interface\n sameSite: 'lax',\n secure: true,\n path: '/',\n};\n/**\n * Creates a Key Value storage interface using the `cookieStorageAdapter` as the\n * underlying storage.\n * @param cookieStorageAdapter An implementation of the `Adapter` in {@link CookieStorage}.\n * @returns An object that implements {@link KeyValueStorageInterface}.\n */\nconst createKeyValueStorageFromCookieStorageAdapter = (cookieStorageAdapter, validator, setCookieOptions = {}) => {\n return {\n setItem(key, value) {\n // Delete the cookie item first then set it. This results:\n // SetCookie: key=;expires=1970-01-01;(path='current-path') <- remove path'ed cookies\n // SetCookie: key=value;expires=Date.now() + 365 days;path=/;secure=true\n cookieStorageAdapter.delete(key);\n const mergedCookieOptions = {\n ...exports.defaultSetCookieOptions,\n ...setCookieOptions,\n };\n // when expires and maxAge both are not specified, we set a default maxAge\n if (!mergedCookieOptions.expires && !mergedCookieOptions.maxAge) {\n mergedCookieOptions.maxAge = constants_1.DEFAULT_AUTH_TOKEN_COOKIES_MAX_AGE;\n }\n cookieStorageAdapter.set(key, value, mergedCookieOptions);\n return Promise.resolve();\n },\n async getItem(key) {\n const cookie = cookieStorageAdapter.get(key);\n const value = cookie?.value ?? null;\n if (value && validator?.getItem) {\n const isValid = await validator.getItem(key, value);\n if (!isValid)\n return null;\n }\n return value;\n },\n removeItem(key) {\n cookieStorageAdapter.delete(key);\n return Promise.resolve();\n },\n clear() {\n // TODO(HuiSF): follow up the implementation.\n throw new Error('This method has not implemented.');\n },\n };\n};\nexports.createKeyValueStorageFromCookieStorageAdapter = create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zD,YAAY,MAAM,KAAK,GAAG,MAAM,EAAE,KAAK,IAAI,IAAI,CAAC;AAChD,YAAY,IAAI,KAAK,IAAI,SAAS,EAAE,OAAO,EAAE;AAC7C,gBAAgB,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AACpE,gBAAgB,IAAI,CAAC,OAAO;AAC5B,oBAAoB,OAAO,IAAI,CAAC;AAChC,aAAa;AACb,YAAY,OAAO,KAAK,CAAC;AACzB,SAAS;AACT,QAAQ,UAAU,CAAC,GAAG,EAAE;AACxB,YAAY,oBAAoB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAC7C,YAAY,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;AACrC,SAAS;AACT,QAAQ,KAAK,GAAG;AAChB;AACA,YAAY,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;AAChE,SAAS;AACT,KAAK,CAAC;AACN,CAAC,CAAC;AACF,OAAO,CAAC,6CAA6C,GAAG,6CAA6C;;"}
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
+ // SPDX-License-Identifier: Apache-2.0
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.generateClientWithAmplifyInstance = void 0;
7
+ var internals_1 = require("@aws-amplify/api/internals");
8
+ Object.defineProperty(exports, "generateClientWithAmplifyInstance", { enumerable: true, get: function () { return internals_1.generateClientWithAmplifyInstance; } });
9
+ //# sourceMappingURL=internals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internals.js","sources":["../../../src/api/internals.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.generateClientWithAmplifyInstance = void 0;\nvar internals_1 = require(\"@aws-amplify/api/internals\");\nObject.defineProperty(exports, \"generateClientWithAmplifyInstance\", { enumerable: true, get: function () { return internals_1.generateClientWithAmplifyInstance; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,iCAAiC,GAAG,KAAK,CAAC,CAAC;AACnD,IAAI,WAAW,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;AACxD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,mCAAmC,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,WAAW,CAAC,iCAAiC,CAAC,EAAE,EAAE,CAAC;;"}
@@ -0,0 +1 @@
1
+ export declare const DEFAULT_AUTH_TOKEN_COOKIES_MAX_AGE: number;
@@ -0,0 +1,6 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ const DEFAULT_AUTH_TOKEN_COOKIES_MAX_AGE = 365 * 24 * 60 * 60; // 1 year in seconds
4
+
5
+ export { DEFAULT_AUTH_TOKEN_COOKIES_MAX_AGE };
6
+ //# sourceMappingURL=constants.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.mjs","sources":["../../../src/adapter-core/constants.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport const DEFAULT_AUTH_TOKEN_COOKIES_MAX_AGE = 365 * 24 * 60 * 60; // 1 year in seconds\n"],"names":[],"mappings":"AAAA;AACA;AACY,MAAC,kCAAkC,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG;;;;"}
@@ -3,3 +3,5 @@ export { createKeyValueStorageFromCookieStorageAdapter } from './storageFactorie
3
3
  export { createAWSCredentialsAndIdentityIdProvider, createUserPoolsTokenProvider, } from './authProvidersFactories/cognito';
4
4
  export { LegacyConfig, AmplifyOutputs, } from '@aws-amplify/core/internals/utils';
5
5
  export { AmplifyServer, CookieStorage, } from '@aws-amplify/core/internals/adapter-core';
6
+ export { generateState, getRedirectUrl, generateCodeVerifier, validateState, createKeysForAuthStorage, AUTH_KEY_PREFIX, } from '@aws-amplify/auth/cognito';
7
+ export { DEFAULT_AUTH_TOKEN_COOKIES_MAX_AGE } from './constants';
@@ -2,4 +2,6 @@ export { runWithAmplifyServerContext } from './runWithAmplifyServerContext.mjs';
2
2
  export { createKeyValueStorageFromCookieStorageAdapter } from './storageFactories/createKeyValueStorageFromCookieStorageAdapter.mjs';
3
3
  export { createUserPoolsTokenProvider } from './authProvidersFactories/cognito/createUserPoolsTokenProvider.mjs';
4
4
  export { createAWSCredentialsAndIdentityIdProvider } from './authProvidersFactories/cognito/createAWSCredentialsAndIdentityIdProvider.mjs';
5
+ export { AUTH_KEY_PREFIX, createKeysForAuthStorage, generateCodeVerifier, generateState, getRedirectUrl, validateState } from '@aws-amplify/auth/cognito';
6
+ export { DEFAULT_AUTH_TOKEN_COOKIES_MAX_AGE } from './constants.mjs';
5
7
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
@@ -0,0 +1,3 @@
1
+ export { KeyValueStorageMethodValidator, AmplifyServerContextError, getAmplifyServerContext, AmplifyServer, CookieStorage, } from '@aws-amplify/core/internals/adapter-core';
2
+ export { OAuthConfig } from '@aws-amplify/core';
3
+ export { assertOAuthConfig, assertTokenProviderConfig, urlSafeEncode, decodeJWT, } from '@aws-amplify/core/internals/utils';
@@ -0,0 +1,3 @@
1
+ export { AmplifyServerContextError, getAmplifyServerContext } from '@aws-amplify/core/internals/adapter-core';
2
+ export { assertOAuthConfig, assertTokenProviderConfig, decodeJWT, urlSafeEncode } from '@aws-amplify/core/internals/utils';
3
+ //# sourceMappingURL=internals.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internals.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -7,4 +7,4 @@ export declare const defaultSetCookieOptions: CookieStorage.SetCookieOptions;
7
7
  * @param cookieStorageAdapter An implementation of the `Adapter` in {@link CookieStorage}.
8
8
  * @returns An object that implements {@link KeyValueStorageInterface}.
9
9
  */
10
- export declare const createKeyValueStorageFromCookieStorageAdapter: (cookieStorageAdapter: CookieStorage.Adapter, validator?: KeyValueStorageMethodValidator) => KeyValueStorageInterface;
10
+ export declare const createKeyValueStorageFromCookieStorageAdapter: (cookieStorageAdapter: CookieStorage.Adapter, validator?: KeyValueStorageMethodValidator, setCookieOptions?: CookieStorage.SetCookieOptions) => KeyValueStorageInterface;
@@ -1,3 +1,5 @@
1
+ import { DEFAULT_AUTH_TOKEN_COOKIES_MAX_AGE } from '../constants.mjs';
2
+
1
3
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
4
  // SPDX-License-Identifier: Apache-2.0
3
5
  const defaultSetCookieOptions = {
@@ -6,25 +8,28 @@ const defaultSetCookieOptions = {
6
8
  secure: true,
7
9
  path: '/',
8
10
  };
9
- const ONE_YEAR_IN_MS = 365 * 24 * 60 * 60 * 1000;
10
11
  /**
11
12
  * Creates a Key Value storage interface using the `cookieStorageAdapter` as the
12
13
  * underlying storage.
13
14
  * @param cookieStorageAdapter An implementation of the `Adapter` in {@link CookieStorage}.
14
15
  * @returns An object that implements {@link KeyValueStorageInterface}.
15
16
  */
16
- const createKeyValueStorageFromCookieStorageAdapter = (cookieStorageAdapter, validator) => {
17
+ const createKeyValueStorageFromCookieStorageAdapter = (cookieStorageAdapter, validator, setCookieOptions = {}) => {
17
18
  return {
18
19
  setItem(key, value) {
19
20
  // Delete the cookie item first then set it. This results:
20
21
  // SetCookie: key=;expires=1970-01-01;(path='current-path') <- remove path'ed cookies
21
22
  // SetCookie: key=value;expires=Date.now() + 365 days;path=/;secure=true
22
23
  cookieStorageAdapter.delete(key);
23
- // TODO(HuiSF): follow up the default CookieSerializeOptions values
24
- cookieStorageAdapter.set(key, value, {
24
+ const mergedCookieOptions = {
25
25
  ...defaultSetCookieOptions,
26
- expires: new Date(Date.now() + ONE_YEAR_IN_MS),
27
- });
26
+ ...setCookieOptions,
27
+ };
28
+ // when expires and maxAge both are not specified, we set a default maxAge
29
+ if (!mergedCookieOptions.expires && !mergedCookieOptions.maxAge) {
30
+ mergedCookieOptions.maxAge = DEFAULT_AUTH_TOKEN_COOKIES_MAX_AGE;
31
+ }
32
+ cookieStorageAdapter.set(key, value, mergedCookieOptions);
28
33
  return Promise.resolve();
29
34
  },
30
35
  async getItem(key) {
@@ -1 +1 @@
1
- {"version":3,"file":"createKeyValueStorageFromCookieStorageAdapter.mjs","sources":["../../../../src/adapter-core/storageFactories/createKeyValueStorageFromCookieStorageAdapter.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport const defaultSetCookieOptions = {\n // TODO: allow configure with a public interface\n sameSite: 'lax',\n secure: true,\n path: '/',\n};\nconst ONE_YEAR_IN_MS = 365 * 24 * 60 * 60 * 1000;\n/**\n * Creates a Key Value storage interface using the `cookieStorageAdapter` as the\n * underlying storage.\n * @param cookieStorageAdapter An implementation of the `Adapter` in {@link CookieStorage}.\n * @returns An object that implements {@link KeyValueStorageInterface}.\n */\nexport const createKeyValueStorageFromCookieStorageAdapter = (cookieStorageAdapter, validator) => {\n return {\n setItem(key, value) {\n // Delete the cookie item first then set it. This results:\n // SetCookie: key=;expires=1970-01-01;(path='current-path') <- remove path'ed cookies\n // SetCookie: key=value;expires=Date.now() + 365 days;path=/;secure=true\n cookieStorageAdapter.delete(key);\n // TODO(HuiSF): follow up the default CookieSerializeOptions values\n cookieStorageAdapter.set(key, value, {\n ...defaultSetCookieOptions,\n expires: new Date(Date.now() + ONE_YEAR_IN_MS),\n });\n return Promise.resolve();\n },\n async getItem(key) {\n const cookie = cookieStorageAdapter.get(key);\n const value = cookie?.value ?? null;\n if (value && validator?.getItem) {\n const isValid = await validator.getItem(key, value);\n if (!isValid)\n return null;\n }\n return value;\n },\n removeItem(key) {\n cookieStorageAdapter.delete(key);\n return Promise.resolve();\n },\n clear() {\n // TODO(HuiSF): follow up the implementation.\n throw new Error('This method has not implemented.');\n },\n };\n};\n"],"names":[],"mappings":"AAAA;AACA;AACY,MAAC,uBAAuB,GAAG;AACvC;AACA,IAAI,QAAQ,EAAE,KAAK;AACnB,IAAI,MAAM,EAAE,IAAI;AAChB,IAAI,IAAI,EAAE,GAAG;AACb,EAAE;AACF,MAAM,cAAc,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AACjD;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,6CAA6C,GAAG,CAAC,oBAAoB,EAAE,SAAS,KAAK;AAClG,IAAI,OAAO;AACX,QAAQ,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE;AAC5B;AACA;AACA;AACA,YAAY,oBAAoB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAC7C;AACA,YAAY,oBAAoB,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE;AACjD,gBAAgB,GAAG,uBAAuB;AAC1C,gBAAgB,OAAO,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,cAAc,CAAC;AAC9D,aAAa,CAAC,CAAC;AACf,YAAY,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;AACrC,SAAS;AACT,QAAQ,MAAM,OAAO,CAAC,GAAG,EAAE;AAC3B,YAAY,MAAM,MAAM,GAAG,oBAAoB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACzD,YAAY,MAAM,KAAK,GAAG,MAAM,EAAE,KAAK,IAAI,IAAI,CAAC;AAChD,YAAY,IAAI,KAAK,IAAI,SAAS,EAAE,OAAO,EAAE;AAC7C,gBAAgB,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AACpE,gBAAgB,IAAI,CAAC,OAAO;AAC5B,oBAAoB,OAAO,IAAI,CAAC;AAChC,aAAa;AACb,YAAY,OAAO,KAAK,CAAC;AACzB,SAAS;AACT,QAAQ,UAAU,CAAC,GAAG,EAAE;AACxB,YAAY,oBAAoB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAC7C,YAAY,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;AACrC,SAAS;AACT,QAAQ,KAAK,GAAG;AAChB;AACA,YAAY,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;AAChE,SAAS;AACT,KAAK,CAAC;AACN;;;;"}
1
+ {"version":3,"file":"createKeyValueStorageFromCookieStorageAdapter.mjs","sources":["../../../../src/adapter-core/storageFactories/createKeyValueStorageFromCookieStorageAdapter.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { DEFAULT_AUTH_TOKEN_COOKIES_MAX_AGE } from '../constants';\nexport const defaultSetCookieOptions = {\n // TODO: allow configure with a public interface\n sameSite: 'lax',\n secure: true,\n path: '/',\n};\n/**\n * Creates a Key Value storage interface using the `cookieStorageAdapter` as the\n * underlying storage.\n * @param cookieStorageAdapter An implementation of the `Adapter` in {@link CookieStorage}.\n * @returns An object that implements {@link KeyValueStorageInterface}.\n */\nexport const createKeyValueStorageFromCookieStorageAdapter = (cookieStorageAdapter, validator, setCookieOptions = {}) => {\n return {\n setItem(key, value) {\n // Delete the cookie item first then set it. This results:\n // SetCookie: key=;expires=1970-01-01;(path='current-path') <- remove path'ed cookies\n // SetCookie: key=value;expires=Date.now() + 365 days;path=/;secure=true\n cookieStorageAdapter.delete(key);\n const mergedCookieOptions = {\n ...defaultSetCookieOptions,\n ...setCookieOptions,\n };\n // when expires and maxAge both are not specified, we set a default maxAge\n if (!mergedCookieOptions.expires && !mergedCookieOptions.maxAge) {\n mergedCookieOptions.maxAge = DEFAULT_AUTH_TOKEN_COOKIES_MAX_AGE;\n }\n cookieStorageAdapter.set(key, value, mergedCookieOptions);\n return Promise.resolve();\n },\n async getItem(key) {\n const cookie = cookieStorageAdapter.get(key);\n const value = cookie?.value ?? null;\n if (value && validator?.getItem) {\n const isValid = await validator.getItem(key, value);\n if (!isValid)\n return null;\n }\n return value;\n },\n removeItem(key) {\n cookieStorageAdapter.delete(key);\n return Promise.resolve();\n },\n clear() {\n // TODO(HuiSF): follow up the implementation.\n throw new Error('This method has not implemented.');\n },\n };\n};\n"],"names":[],"mappings":";;AAAA;AACA;AAEY,MAAC,uBAAuB,GAAG;AACvC;AACA,IAAI,QAAQ,EAAE,KAAK;AACnB,IAAI,MAAM,EAAE,IAAI;AAChB,IAAI,IAAI,EAAE,GAAG;AACb,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,6CAA6C,GAAG,CAAC,oBAAoB,EAAE,SAAS,EAAE,gBAAgB,GAAG,EAAE,KAAK;AACzH,IAAI,OAAO;AACX,QAAQ,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE;AAC5B;AACA;AACA;AACA,YAAY,oBAAoB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAC7C,YAAY,MAAM,mBAAmB,GAAG;AACxC,gBAAgB,GAAG,uBAAuB;AAC1C,gBAAgB,GAAG,gBAAgB;AACnC,aAAa,CAAC;AACd;AACA,YAAY,IAAI,CAAC,mBAAmB,CAAC,OAAO,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAAE;AAC7E,gBAAgB,mBAAmB,CAAC,MAAM,GAAG,kCAAkC,CAAC;AAChF,aAAa;AACb,YAAY,oBAAoB,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,mBAAmB,CAAC,CAAC;AACtE,YAAY,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;AACrC,SAAS;AACT,QAAQ,MAAM,OAAO,CAAC,GAAG,EAAE;AAC3B,YAAY,MAAM,MAAM,GAAG,oBAAoB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACzD,YAAY,MAAM,KAAK,GAAG,MAAM,EAAE,KAAK,IAAI,IAAI,CAAC;AAChD,YAAY,IAAI,KAAK,IAAI,SAAS,EAAE,OAAO,EAAE;AAC7C,gBAAgB,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;AACpE,gBAAgB,IAAI,CAAC,OAAO;AAC5B,oBAAoB,OAAO,IAAI,CAAC;AAChC,aAAa;AACb,YAAY,OAAO,KAAK,CAAC;AACzB,SAAS;AACT,QAAQ,UAAU,CAAC,GAAG,EAAE;AACxB,YAAY,oBAAoB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAC7C,YAAY,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;AACrC,SAAS;AACT,QAAQ,KAAK,GAAG;AAChB;AACA,YAAY,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;AAChE,SAAS;AACT,KAAK,CAAC;AACN;;;;"}
@@ -0,0 +1 @@
1
+ export { generateClientWithAmplifyInstance, V6ClientSSRCookies, V6ClientSSRRequest, CommonPublicClientOptions, DefaultCommonClientOptions, } from '@aws-amplify/api/internals';
@@ -0,0 +1,2 @@
1
+ export { generateClientWithAmplifyInstance } from '@aws-amplify/api/internals';
2
+ //# sourceMappingURL=internals.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internals.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aws-amplify",
3
- "version": "6.12.4-unstable.289f3e8.0+289f3e8",
3
+ "version": "6.12.4-unstable.b8f57f2.0+b8f57f2",
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",
@@ -31,6 +31,12 @@
31
31
  "require": "./dist/cjs/api/index.js",
32
32
  "react-native": "./src/api/index.ts"
33
33
  },
34
+ "./api/internals": {
35
+ "types": "./dist/esm/api/internals.d.ts",
36
+ "import": "./dist/esm/api/internals.mjs",
37
+ "require": "./dist/cjs/api/internals.js",
38
+ "react-native": "./src/api/internals.ts"
39
+ },
34
40
  "./api/server": {
35
41
  "types": "./dist/esm/api/server.d.ts",
36
42
  "import": "./dist/esm/api/server.mjs",
@@ -155,6 +161,11 @@
155
161
  "import": "./dist/esm/adapter-core/index.mjs",
156
162
  "require": "./dist/cjs/adapter-core/index.js"
157
163
  },
164
+ "./adapter-core/internals": {
165
+ "types": "./dist/esm/adapter-core/internals.d.ts",
166
+ "import": "./dist/esm/adapter-core/internals.mjs",
167
+ "require": "./dist/cjs/adapter-core/internals.js"
168
+ },
158
169
  "./package.json": "./package.json"
159
170
  },
160
171
  "typesVersions": {
@@ -168,6 +179,9 @@
168
179
  "api/server": [
169
180
  "./dist/esm/api/server.d.ts"
170
181
  ],
182
+ "api/server/internals": [
183
+ "./dist/esm/api/internals.d.ts"
184
+ ],
171
185
  "utils": [
172
186
  "./dist/esm/utils/index.d.ts"
173
187
  ],
@@ -227,6 +241,9 @@
227
241
  ],
228
242
  "adapter-core": [
229
243
  "./dist/esm/adapter-core/index.d.ts"
244
+ ],
245
+ "adapter-core/internals": [
246
+ "./dist/esm/adapter-core/internals.d.ts"
230
247
  ]
231
248
  }
232
249
  },
@@ -276,13 +293,13 @@
276
293
  "utils"
277
294
  ],
278
295
  "dependencies": {
279
- "@aws-amplify/analytics": "7.0.69-unstable.289f3e8.0+289f3e8",
280
- "@aws-amplify/api": "6.2.4-unstable.289f3e8.0+289f3e8",
281
- "@aws-amplify/auth": "6.10.3-unstable.289f3e8.0+289f3e8",
282
- "@aws-amplify/core": "6.9.4-unstable.289f3e8.0+289f3e8",
283
- "@aws-amplify/datastore": "5.0.71-unstable.289f3e8.0+289f3e8",
284
- "@aws-amplify/notifications": "2.0.69-unstable.289f3e8.0+289f3e8",
285
- "@aws-amplify/storage": "6.7.10-unstable.289f3e8.0+289f3e8",
296
+ "@aws-amplify/analytics": "7.0.69-unstable.b8f57f2.0+b8f57f2",
297
+ "@aws-amplify/api": "6.2.4-unstable.b8f57f2.0+b8f57f2",
298
+ "@aws-amplify/auth": "6.10.3-unstable.b8f57f2.0+b8f57f2",
299
+ "@aws-amplify/core": "6.9.4-unstable.b8f57f2.0+b8f57f2",
300
+ "@aws-amplify/datastore": "5.0.71-unstable.b8f57f2.0+b8f57f2",
301
+ "@aws-amplify/notifications": "2.0.69-unstable.b8f57f2.0+b8f57f2",
302
+ "@aws-amplify/storage": "6.7.10-unstable.b8f57f2.0+b8f57f2",
286
303
  "tslib": "^2.5.0"
287
304
  },
288
305
  "devDependencies": {
@@ -518,5 +535,5 @@
518
535
  "limit": "23.00 kB"
519
536
  }
520
537
  ],
521
- "gitHead": "289f3e8d1bbf8c95abffb553b612699f43cdccb5"
538
+ "gitHead": "b8f57f25ea29e027fd90727979c386d9deeeb41e"
522
539
  }
@@ -0,0 +1,4 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export const DEFAULT_AUTH_TOKEN_COOKIES_MAX_AGE = 365 * 24 * 60 * 60; // 1 year in seconds
@@ -15,3 +15,12 @@ export {
15
15
  AmplifyServer,
16
16
  CookieStorage,
17
17
  } from '@aws-amplify/core/internals/adapter-core';
18
+ export {
19
+ generateState,
20
+ getRedirectUrl,
21
+ generateCodeVerifier,
22
+ validateState,
23
+ createKeysForAuthStorage,
24
+ AUTH_KEY_PREFIX,
25
+ } from '@aws-amplify/auth/cognito';
26
+ export { DEFAULT_AUTH_TOKEN_COOKIES_MAX_AGE } from './constants';
@@ -0,0 +1,17 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export {
5
+ KeyValueStorageMethodValidator,
6
+ AmplifyServerContextError,
7
+ getAmplifyServerContext,
8
+ AmplifyServer,
9
+ CookieStorage,
10
+ } from '@aws-amplify/core/internals/adapter-core';
11
+ export { OAuthConfig } from '@aws-amplify/core';
12
+ export {
13
+ assertOAuthConfig,
14
+ assertTokenProviderConfig,
15
+ urlSafeEncode,
16
+ decodeJWT,
17
+ } from '@aws-amplify/core/internals/utils';
@@ -7,13 +7,14 @@ import {
7
7
  KeyValueStorageMethodValidator,
8
8
  } from '@aws-amplify/core/internals/adapter-core';
9
9
 
10
+ import { DEFAULT_AUTH_TOKEN_COOKIES_MAX_AGE } from '../constants';
11
+
10
12
  export const defaultSetCookieOptions: CookieStorage.SetCookieOptions = {
11
13
  // TODO: allow configure with a public interface
12
14
  sameSite: 'lax',
13
15
  secure: true,
14
16
  path: '/',
15
17
  };
16
- const ONE_YEAR_IN_MS = 365 * 24 * 60 * 60 * 1000;
17
18
 
18
19
  /**
19
20
  * Creates a Key Value storage interface using the `cookieStorageAdapter` as the
@@ -24,6 +25,7 @@ const ONE_YEAR_IN_MS = 365 * 24 * 60 * 60 * 1000;
24
25
  export const createKeyValueStorageFromCookieStorageAdapter = (
25
26
  cookieStorageAdapter: CookieStorage.Adapter,
26
27
  validator?: KeyValueStorageMethodValidator,
28
+ setCookieOptions: CookieStorage.SetCookieOptions = {},
27
29
  ): KeyValueStorageInterface => {
28
30
  return {
29
31
  setItem(key, value) {
@@ -32,11 +34,17 @@ export const createKeyValueStorageFromCookieStorageAdapter = (
32
34
  // SetCookie: key=value;expires=Date.now() + 365 days;path=/;secure=true
33
35
  cookieStorageAdapter.delete(key);
34
36
 
35
- // TODO(HuiSF): follow up the default CookieSerializeOptions values
36
- cookieStorageAdapter.set(key, value, {
37
+ const mergedCookieOptions = {
37
38
  ...defaultSetCookieOptions,
38
- expires: new Date(Date.now() + ONE_YEAR_IN_MS),
39
- });
39
+ ...setCookieOptions,
40
+ };
41
+
42
+ // when expires and maxAge both are not specified, we set a default maxAge
43
+ if (!mergedCookieOptions.expires && !mergedCookieOptions.maxAge) {
44
+ mergedCookieOptions.maxAge = DEFAULT_AUTH_TOKEN_COOKIES_MAX_AGE;
45
+ }
46
+
47
+ cookieStorageAdapter.set(key, value, mergedCookieOptions);
40
48
 
41
49
  return Promise.resolve();
42
50
  },
@@ -0,0 +1,10 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export {
5
+ generateClientWithAmplifyInstance,
6
+ V6ClientSSRCookies,
7
+ V6ClientSSRRequest,
8
+ CommonPublicClientOptions,
9
+ DefaultCommonClientOptions,
10
+ } from '@aws-amplify/api/internals';