aws-amplify 6.12.3-monitoring-instrument.47a7bda.0 → 6.12.3-server-auth.fd0687d.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 +3 -0
  26. package/dist/esm/api/internals.mjs +2 -0
  27. package/dist/esm/api/internals.mjs.map +1 -0
  28. package/package.json +52 -35
  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 +12 -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,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,CAAC;AAC1J,IAAI,SAAS,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;AACrD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,SAAS,CAAC,aAAa,CAAC,EAAE,EAAE,CAAC,CAAC;AAC5H,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,gBAAgB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,SAAS,CAAC,cAAc,CAAC,EAAE,EAAE,CAAC,CAAC;AAC9H,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,sBAAsB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,SAAS,CAAC,oBAAoB,CAAC,EAAE,EAAE,CAAC,CAAC;AAC1I,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,SAAS,CAAC,aAAa,CAAC,EAAE,EAAE,CAAC,CAAC;AAC5H,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,0BAA0B,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,SAAS,CAAC,wBAAwB,CAAC,EAAE,EAAE,CAAC,CAAC;AAClJ,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,iBAAiB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,SAAS,CAAC,eAAe,CAAC,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,KAAK;AAC3F,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,OAAO,CAAC,uBAAuB;AAClD,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,CAAC,CAAC;AACF,OAAO,CAAC,6CAA6C,GAAG,6CAA6C;;"}
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;\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 = 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,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAC5C,OAAO,CAAC,uBAAuB,GAAG;AAClC;AACA,IAAI,QAAQ,EAAE,KAAK;AACnB,IAAI,MAAM,EAAE,IAAI;AAChB,IAAI,IAAI,EAAE,GAAG;AACb,CAAC,CAAC;AACF;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,6CAA6C,GAAG,CAAC,oBAAoB,EAAE,SAAS,EAAE,gBAAgB,GAAG,EAAE,KAAK;AAClH,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,OAAO,CAAC,uBAAuB;AAClD,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,WAAW,CAAC,kCAAkC,CAAC;AAC5F,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,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,3 @@
1
+ export { generateClientWithAmplifyInstance } from '@aws-amplify/api/internals';
2
+ export { V6ClientSSRCookies, V6ClientSSRRequest, } from '@aws-amplify/api-graphql';
3
+ export { CommonPublicClientOptions, DefaultCommonClientOptions, } from '@aws-amplify/api-graphql/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.3-monitoring-instrument.47a7bda.0+47a7bda",
3
+ "version": "6.12.3-server-auth.fd0687d.0+fd0687d",
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.68-monitoring-instrument.47a7bda.0+47a7bda",
280
- "@aws-amplify/api": "6.2.3-monitoring-instrument.47a7bda.0+47a7bda",
281
- "@aws-amplify/auth": "6.10.2-monitoring-instrument.47a7bda.0+47a7bda",
282
- "@aws-amplify/core": "6.9.3-monitoring-instrument.47a7bda.0+47a7bda",
283
- "@aws-amplify/datastore": "5.0.70-monitoring-instrument.47a7bda.0+47a7bda",
284
- "@aws-amplify/notifications": "2.0.68-monitoring-instrument.47a7bda.0+47a7bda",
285
- "@aws-amplify/storage": "6.7.9-monitoring-instrument.47a7bda.0+47a7bda",
296
+ "@aws-amplify/analytics": "7.0.68-server-auth.fd0687d.0+fd0687d",
297
+ "@aws-amplify/api": "6.2.3-server-auth.fd0687d.0+fd0687d",
298
+ "@aws-amplify/auth": "6.10.2-server-auth.fd0687d.0+fd0687d",
299
+ "@aws-amplify/core": "6.9.3-server-auth.fd0687d.0+fd0687d",
300
+ "@aws-amplify/datastore": "5.0.70-server-auth.fd0687d.0+fd0687d",
301
+ "@aws-amplify/notifications": "2.0.68-server-auth.fd0687d.0+fd0687d",
302
+ "@aws-amplify/storage": "6.7.9-server-auth.fd0687d.0+fd0687d",
286
303
  "tslib": "^2.5.0"
287
304
  },
288
305
  "devDependencies": {
@@ -293,7 +310,7 @@
293
310
  "name": "[Analytics] record (Pinpoint)",
294
311
  "path": "./dist/esm/analytics/index.mjs",
295
312
  "import": "{ record }",
296
- "limit": "17.80 kB"
313
+ "limit": "17.63 kB"
297
314
  },
298
315
  {
299
316
  "name": "[Analytics] record (Kinesis)",
@@ -317,7 +334,7 @@
317
334
  "name": "[Analytics] identifyUser (Pinpoint)",
318
335
  "path": "./dist/esm/analytics/index.mjs",
319
336
  "import": "{ identifyUser }",
320
- "limit": "16.31 kB"
337
+ "limit": "16.14 kB"
321
338
  },
322
339
  {
323
340
  "name": "[Analytics] enable",
@@ -335,7 +352,7 @@
335
352
  "name": "[API] generateClient (AppSync)",
336
353
  "path": "./dist/esm/api/index.mjs",
337
354
  "import": "{ generateClient }",
338
- "limit": "45.57 kB"
355
+ "limit": "45.47 kB"
339
356
  },
340
357
  {
341
358
  "name": "[API] REST API handlers",
@@ -353,13 +370,13 @@
353
370
  "name": "[Auth] resetPassword (Cognito)",
354
371
  "path": "./dist/esm/auth/index.mjs",
355
372
  "import": "{ resetPassword }",
356
- "limit": "12.88 kB"
373
+ "limit": "12.71 kB"
357
374
  },
358
375
  {
359
376
  "name": "[Auth] confirmResetPassword (Cognito)",
360
377
  "path": "./dist/esm/auth/index.mjs",
361
378
  "import": "{ confirmResetPassword }",
362
- "limit": "12.83 kB"
379
+ "limit": "12.66 kB"
363
380
  },
364
381
  {
365
382
  "name": "[Auth] signIn (Cognito)",
@@ -371,7 +388,7 @@
371
388
  "name": "[Auth] resendSignUpCode (Cognito)",
372
389
  "path": "./dist/esm/auth/index.mjs",
373
390
  "import": "{ resendSignUpCode }",
374
- "limit": "12.84 kB"
391
+ "limit": "12.68 kB"
375
392
  },
376
393
  {
377
394
  "name": "[Auth] confirmSignUp (Cognito)",
@@ -383,31 +400,31 @@
383
400
  "name": "[Auth] confirmSignIn (Cognito)",
384
401
  "path": "./dist/esm/auth/index.mjs",
385
402
  "import": "{ confirmSignIn }",
386
- "limit": "28.76 kB"
403
+ "limit": "28.66 kB"
387
404
  },
388
405
  {
389
406
  "name": "[Auth] updateMFAPreference (Cognito)",
390
407
  "path": "./dist/esm/auth/index.mjs",
391
408
  "import": "{ updateMFAPreference }",
392
- "limit": "12.31 kB"
409
+ "limit": "12.15 kB"
393
410
  },
394
411
  {
395
412
  "name": "[Auth] fetchMFAPreference (Cognito)",
396
413
  "path": "./dist/esm/auth/index.mjs",
397
414
  "import": "{ fetchMFAPreference }",
398
- "limit": "12.33 kB"
415
+ "limit": "12.18 kB"
399
416
  },
400
417
  {
401
418
  "name": "[Auth] verifyTOTPSetup (Cognito)",
402
419
  "path": "./dist/esm/auth/index.mjs",
403
420
  "import": "{ verifyTOTPSetup }",
404
- "limit": "13.19 kB"
421
+ "limit": "13.02 kB"
405
422
  },
406
423
  {
407
424
  "name": "[Auth] updatePassword (Cognito)",
408
425
  "path": "./dist/esm/auth/index.mjs",
409
426
  "import": "{ updatePassword }",
410
- "limit": "13.19 kB"
427
+ "limit": "13.03 kB"
411
428
  },
412
429
  {
413
430
  "name": "[Auth] setUpTOTP (Cognito)",
@@ -419,19 +436,19 @@
419
436
  "name": "[Auth] updateUserAttributes (Cognito)",
420
437
  "path": "./dist/esm/auth/index.mjs",
421
438
  "import": "{ updateUserAttributes }",
422
- "limit": "12.4 kB"
439
+ "limit": "12.24 kB"
423
440
  },
424
441
  {
425
442
  "name": "[Auth] getCurrentUser (Cognito)",
426
443
  "path": "./dist/esm/auth/index.mjs",
427
444
  "import": "{ getCurrentUser }",
428
- "limit": "8.13 kB"
445
+ "limit": "8.09 kB"
429
446
  },
430
447
  {
431
448
  "name": "[Auth] confirmUserAttribute (Cognito)",
432
449
  "path": "./dist/esm/auth/index.mjs",
433
450
  "import": "{ confirmUserAttribute }",
434
- "limit": "13.18 kB"
451
+ "limit": "13.02 kB"
435
452
  },
436
453
  {
437
454
  "name": "[Auth] signInWithRedirect (Cognito)",
@@ -443,13 +460,13 @@
443
460
  "name": "[Auth] fetchUserAttributes (Cognito)",
444
461
  "path": "./dist/esm/auth/index.mjs",
445
462
  "import": "{ fetchUserAttributes }",
446
- "limit": "12.23 kB"
463
+ "limit": "12.07 kB"
447
464
  },
448
465
  {
449
466
  "name": "[Auth] Basic Auth Flow (Cognito)",
450
467
  "path": "./dist/esm/auth/index.mjs",
451
468
  "import": "{ signIn, signOut, fetchAuthSession, confirmSignIn }",
452
- "limit": "31 kB"
469
+ "limit": "30.89 kB"
453
470
  },
454
471
  {
455
472
  "name": "[Auth] OAuth Auth Flow (Cognito)",
@@ -461,62 +478,62 @@
461
478
  "name": "[Auth] Associate WebAuthN Credential (Cognito)",
462
479
  "path": "./dist/esm/auth/index.mjs",
463
480
  "import": "{ associateWebAuthnCredential }",
464
- "limit": "13.73 kB"
481
+ "limit": "13.59 kB"
465
482
  },
466
483
  {
467
484
  "name": "[Auth] List WebAuthN Credentials (Cognito)",
468
485
  "path": "./dist/esm/auth/index.mjs",
469
486
  "import": "{ listWebAuthnCredentials }",
470
- "limit": "12.33 kB"
487
+ "limit": "12.18 kB"
471
488
  },
472
489
  {
473
490
  "name": "[Auth] Delete WebAuthN Credential (Cognito)",
474
491
  "path": "./dist/esm/auth/index.mjs",
475
492
  "import": "{ deleteWebAuthnCredential }",
476
- "limit": "12.2 kB"
493
+ "limit": "12.04 kB"
477
494
  },
478
495
  {
479
496
  "name": "[Storage] copy (S3)",
480
497
  "path": "./dist/esm/storage/index.mjs",
481
498
  "import": "{ copy }",
482
- "limit": "16.53 kB"
499
+ "limit": "16.39 kB"
483
500
  },
484
501
  {
485
502
  "name": "[Storage] downloadData (S3)",
486
503
  "path": "./dist/esm/storage/index.mjs",
487
504
  "import": "{ downloadData }",
488
- "limit": "16.87 kB"
505
+ "limit": "16.73 kB"
489
506
  },
490
507
  {
491
508
  "name": "[Storage] getProperties (S3)",
492
509
  "path": "./dist/esm/storage/index.mjs",
493
510
  "import": "{ getProperties }",
494
- "limit": "16.1 kB"
511
+ "limit": "15.99 kB"
495
512
  },
496
513
  {
497
514
  "name": "[Storage] getUrl (S3)",
498
515
  "path": "./dist/esm/storage/index.mjs",
499
516
  "import": "{ getUrl }",
500
- "limit": "17.37 kB"
517
+ "limit": "17.22 kB"
501
518
  },
502
519
  {
503
520
  "name": "[Storage] list (S3)",
504
521
  "path": "./dist/esm/storage/index.mjs",
505
522
  "import": "{ list }",
506
- "limit": "16.93 kB"
523
+ "limit": "16.77 kB"
507
524
  },
508
525
  {
509
526
  "name": "[Storage] remove (S3)",
510
527
  "path": "./dist/esm/storage/index.mjs",
511
528
  "import": "{ remove }",
512
- "limit": "15.99 kB"
529
+ "limit": "15.83 kB"
513
530
  },
514
531
  {
515
532
  "name": "[Storage] uploadData (S3)",
516
533
  "path": "./dist/esm/storage/index.mjs",
517
534
  "import": "{ uploadData }",
518
- "limit": "23.21 kB"
535
+ "limit": "22.95 kB"
519
536
  }
520
537
  ],
521
- "gitHead": "47a7bdac4c9e840586737c77ec0d56cd9569110e"
538
+ "gitHead": "fd0687da0f8c50b474126a516789d10639f5ce96"
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,12 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export { generateClientWithAmplifyInstance } from '@aws-amplify/api/internals';
5
+ export {
6
+ V6ClientSSRCookies,
7
+ V6ClientSSRRequest,
8
+ } from '@aws-amplify/api-graphql';
9
+ export {
10
+ CommonPublicClientOptions,
11
+ DefaultCommonClientOptions,
12
+ } from '@aws-amplify/api-graphql/internals';