@aws-amplify/core 6.0.1-console-preview.047a1dd.0 → 6.0.1-next.51e478e.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 (122) hide show
  1. package/lib/Cache/Utils/CacheUtils.js +4 -2
  2. package/lib/Platform/version.d.ts +1 -1
  3. package/lib/Platform/version.js +1 -1
  4. package/lib/RNComponents/index.d.ts +6 -0
  5. package/lib/RNComponents/index.js +16 -0
  6. package/lib/{providers/pinpoint/utils → RNComponents}/isAppInForeground.js +4 -1
  7. package/lib/RNComponents/reactnative.d.ts +3 -0
  8. package/lib/RNComponents/reactnative.js +14 -0
  9. package/lib/{storage/CookieStorage.d.ts → StorageHelper/cookieStorage.d.ts} +3 -4
  10. package/lib/{storage/CookieStorage.js → StorageHelper/cookieStorage.js} +83 -35
  11. package/lib/StorageHelper/inMemoryStorage.d.ts +10 -0
  12. package/lib/StorageHelper/inMemoryStorage.js +82 -0
  13. package/lib/StorageHelper/index.d.ts +45 -0
  14. package/lib/StorageHelper/index.js +83 -0
  15. package/lib/{storage/DefaultStorage.native.d.ts → StorageHelper/localStorage.d.ts} +6 -7
  16. package/lib/{storage/KeyValueStorage.js → StorageHelper/localStorage.js} +15 -13
  17. package/lib/StorageHelper/reactnative.d.ts +83 -0
  18. package/lib/StorageHelper/reactnative.js +250 -0
  19. package/lib/{storage/KeyValueStorage.d.ts → StorageHelper/sessionStorage.d.ts} +4 -5
  20. package/lib/{storage/DefaultStorage.native.js → StorageHelper/sessionStorage.js} +43 -46
  21. package/lib/index.d.ts +1 -1
  22. package/lib/index.js +8 -6
  23. package/lib/libraryUtils.d.ts +1 -0
  24. package/lib/libraryUtils.js +5 -1
  25. package/lib/parseAWSExports.js +1 -20
  26. package/lib/providers/pinpoint/utils/PinpointEventBuffer.js +5 -7
  27. package/lib/singleton/types.d.ts +1 -4
  28. package/lib/tsconfig.tsbuildinfo +1 -1
  29. package/lib/types/storage.d.ts +0 -3
  30. package/lib-esm/Cache/Utils/CacheUtils.js +4 -2
  31. package/lib-esm/Platform/version.d.ts +1 -1
  32. package/lib-esm/Platform/version.js +1 -1
  33. package/lib-esm/RNComponents/index.d.ts +6 -0
  34. package/lib-esm/RNComponents/index.js +13 -0
  35. package/lib-esm/RNComponents/isAppInForeground.js +6 -0
  36. package/lib-esm/RNComponents/reactnative.d.ts +3 -0
  37. package/lib-esm/RNComponents/reactnative.js +6 -0
  38. package/lib-esm/{storage/CookieStorage.d.ts → StorageHelper/cookieStorage.d.ts} +3 -4
  39. package/lib-esm/{storage/CookieStorage.js → StorageHelper/cookieStorage.js} +61 -36
  40. package/lib-esm/StorageHelper/inMemoryStorage.d.ts +10 -0
  41. package/lib-esm/StorageHelper/inMemoryStorage.js +79 -0
  42. package/lib-esm/StorageHelper/index.d.ts +45 -0
  43. package/lib-esm/StorageHelper/index.js +76 -0
  44. package/lib-esm/{storage/DefaultStorage.native.d.ts → StorageHelper/localStorage.d.ts} +6 -7
  45. package/lib-esm/{storage/KeyValueStorage.js → StorageHelper/localStorage.js} +14 -12
  46. package/lib-esm/StorageHelper/reactnative.d.ts +83 -0
  47. package/lib-esm/StorageHelper/reactnative.js +244 -0
  48. package/lib-esm/{storage/KeyValueStorage.d.ts → StorageHelper/sessionStorage.d.ts} +4 -5
  49. package/lib-esm/{storage/DefaultStorage.native.js → StorageHelper/sessionStorage.js} +42 -45
  50. package/lib-esm/index.d.ts +1 -1
  51. package/lib-esm/index.js +1 -1
  52. package/lib-esm/libraryUtils.d.ts +1 -0
  53. package/lib-esm/libraryUtils.js +1 -0
  54. package/lib-esm/parseAWSExports.js +1 -20
  55. package/lib-esm/providers/pinpoint/utils/PinpointEventBuffer.js +5 -7
  56. package/lib-esm/singleton/types.d.ts +1 -4
  57. package/lib-esm/tsconfig.tsbuildinfo +1 -1
  58. package/lib-esm/types/storage.d.ts +0 -3
  59. package/package.json +4 -3
  60. package/src/Cache/Utils/CacheUtils.ts +4 -2
  61. package/src/Platform/version.ts +1 -1
  62. package/src/RNComponents/index.ts +16 -0
  63. package/src/RNComponents/isAppInForeground.ts +8 -0
  64. package/src/RNComponents/reactnative.ts +6 -0
  65. package/src/StorageHelper/cookieStorage.ts +99 -0
  66. package/src/StorageHelper/inMemoryStorage.ts +32 -0
  67. package/src/StorageHelper/index.ts +78 -0
  68. package/src/StorageHelper/localStorage.ts +60 -0
  69. package/src/StorageHelper/reactnative.ts +182 -0
  70. package/src/{storage/KeyValueStorage.ts → StorageHelper/sessionStorage.ts} +13 -10
  71. package/src/index.ts +6 -4
  72. package/src/libraryUtils.ts +1 -0
  73. package/src/parseAWSExports.ts +0 -26
  74. package/src/providers/pinpoint/utils/PinpointEventBuffer.ts +12 -16
  75. package/src/singleton/types.ts +1 -4
  76. package/src/types/storage.ts +0 -4
  77. package/lib/providers/pinpoint/utils/isAppInForeground.native.d.ts +0 -1
  78. package/lib/providers/pinpoint/utils/isAppInForeground.native.js +0 -9
  79. package/lib/singleton/API/types.d.ts +0 -34
  80. package/lib/singleton/API/types.js +0 -2
  81. package/lib/storage/CookieStorage.native.d.ts +0 -7
  82. package/lib/storage/CookieStorage.native.js +0 -32
  83. package/lib/storage/DefaultStorage.d.ts +0 -7
  84. package/lib/storage/DefaultStorage.js +0 -33
  85. package/lib/storage/InMemoryStorage.d.ts +0 -12
  86. package/lib/storage/InMemoryStorage.js +0 -41
  87. package/lib/storage/SessionStorage.d.ts +0 -7
  88. package/lib/storage/SessionStorage.js +0 -33
  89. package/lib/storage/index.d.ts +0 -7
  90. package/lib/storage/index.js +0 -14
  91. package/lib/storage/utils.d.ts +0 -10
  92. package/lib/storage/utils.js +0 -26
  93. package/lib-esm/providers/pinpoint/utils/isAppInForeground.js +0 -3
  94. package/lib-esm/providers/pinpoint/utils/isAppInForeground.native.d.ts +0 -1
  95. package/lib-esm/providers/pinpoint/utils/isAppInForeground.native.js +0 -5
  96. package/lib-esm/singleton/API/types.d.ts +0 -34
  97. package/lib-esm/singleton/API/types.js +0 -1
  98. package/lib-esm/storage/CookieStorage.native.d.ts +0 -7
  99. package/lib-esm/storage/CookieStorage.native.js +0 -29
  100. package/lib-esm/storage/DefaultStorage.d.ts +0 -7
  101. package/lib-esm/storage/DefaultStorage.js +0 -30
  102. package/lib-esm/storage/InMemoryStorage.d.ts +0 -12
  103. package/lib-esm/storage/InMemoryStorage.js +0 -38
  104. package/lib-esm/storage/SessionStorage.d.ts +0 -7
  105. package/lib-esm/storage/SessionStorage.js +0 -30
  106. package/lib-esm/storage/index.d.ts +0 -7
  107. package/lib-esm/storage/index.js +0 -10
  108. package/lib-esm/storage/utils.d.ts +0 -10
  109. package/lib-esm/storage/utils.js +0 -21
  110. package/src/providers/pinpoint/utils/isAppInForeground.native.ts +0 -7
  111. package/src/providers/pinpoint/utils/isAppInForeground.ts +0 -4
  112. package/src/singleton/API/types.ts +0 -31
  113. package/src/storage/CookieStorage.native.ts +0 -13
  114. package/src/storage/CookieStorage.ts +0 -72
  115. package/src/storage/DefaultStorage.native.ts +0 -78
  116. package/src/storage/DefaultStorage.ts +0 -14
  117. package/src/storage/InMemoryStorage.ts +0 -36
  118. package/src/storage/SessionStorage.ts +0 -14
  119. package/src/storage/index.ts +0 -13
  120. package/src/storage/utils.ts +0 -22
  121. /package/lib/{providers/pinpoint/utils → RNComponents}/isAppInForeground.d.ts +0 -0
  122. /package/lib-esm/{providers/pinpoint/utils → RNComponents}/isAppInForeground.d.ts +0 -0
@@ -1,7 +1,6 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { APIConfig, LibraryAPIOptions } from './API/types';
5
4
  import { AnalyticsConfig } from './Analytics/types';
6
5
  import {
7
6
  AuthConfig,
@@ -26,7 +25,7 @@ export type LegacyConfig = {
26
25
  };
27
26
 
28
27
  export type ResourcesConfig = {
29
- API?: APIConfig;
28
+ // API?: {};
30
29
  Analytics?: AnalyticsConfig;
31
30
  Auth?: AuthConfig;
32
31
  // Cache?: CacheConfig;
@@ -39,14 +38,12 @@ export type ResourcesConfig = {
39
38
  };
40
39
 
41
40
  export type LibraryOptions = {
42
- API?: LibraryAPIOptions;
43
41
  Auth?: LibraryAuthOptions;
44
42
  Storage?: LibraryStorageOptions;
45
43
  ssr?: boolean;
46
44
  };
47
45
 
48
46
  export {
49
- APIConfig,
50
47
  AuthConfig,
51
48
  AuthUserPoolConfig,
52
49
  AuthIdentityPoolConfig,
@@ -13,10 +13,6 @@ export type SameSite = 'strict' | 'lax' | 'none';
13
13
  export type CookieStorageData = {
14
14
  domain?: string;
15
15
  path?: string;
16
-
17
- /**
18
- * Expiration in days
19
- */
20
16
  expires?: number;
21
17
  secure?: boolean;
22
18
  sameSite?: SameSite;
@@ -1 +0,0 @@
1
- export declare const isAppInForeground: () => boolean;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- // SPDX-License-Identifier: Apache-2.0
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.isAppInForeground = void 0;
6
- // @ts-ignore: missing type definition
7
- var react_native_1 = require("react-native");
8
- var isAppInForeground = function () { return react_native_1.AppState.currentState === 'active'; };
9
- exports.isAppInForeground = isAppInForeground;
@@ -1,34 +0,0 @@
1
- export type LibraryAPIOptions = {
2
- AppSync: {
3
- query: string;
4
- variables?: object;
5
- authMode?: any;
6
- authToken?: string;
7
- /**
8
- * @deprecated This property should not be used
9
- */
10
- userAgentSuffix?: string;
11
- };
12
- customHeaders: Function;
13
- };
14
- export type APIConfig = {
15
- AppSync?: {
16
- defaultAuthMode?: GraphQLAuthMode;
17
- region?: string;
18
- endpoint?: string;
19
- modelIntrospectionSchema?: any;
20
- };
21
- };
22
- export type GraphQLAuthMode = {
23
- type: 'apiKey';
24
- apiKey: string;
25
- } | {
26
- type: 'jwt';
27
- token: 'id' | 'access';
28
- } | {
29
- type: 'iam';
30
- } | {
31
- type: 'lambda';
32
- } | {
33
- type: 'custom';
34
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,7 +0,0 @@
1
- import { KeyValueStorage } from './KeyValueStorage';
2
- /**
3
- * @internal
4
- */
5
- export declare class CookieStorage extends KeyValueStorage {
6
- constructor();
7
- }
@@ -1,32 +0,0 @@
1
- "use strict";
2
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- // SPDX-License-Identifier: Apache-2.0
4
- var __extends = (this && this.__extends) || (function () {
5
- var extendStatics = function (d, b) {
6
- extendStatics = Object.setPrototypeOf ||
7
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
8
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
9
- return extendStatics(d, b);
10
- };
11
- return function (d, b) {
12
- if (typeof b !== "function" && b !== null)
13
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
14
- extendStatics(d, b);
15
- function __() { this.constructor = d; }
16
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
17
- };
18
- })();
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.CookieStorage = void 0;
21
- var KeyValueStorage_1 = require("./KeyValueStorage");
22
- /**
23
- * @internal
24
- */
25
- var CookieStorage = /** @class */ (function (_super) {
26
- __extends(CookieStorage, _super);
27
- function CookieStorage() {
28
- return _super.call(this) || this;
29
- }
30
- return CookieStorage;
31
- }(KeyValueStorage_1.KeyValueStorage));
32
- exports.CookieStorage = CookieStorage;
@@ -1,7 +0,0 @@
1
- import { KeyValueStorage } from './KeyValueStorage';
2
- /**
3
- * @internal
4
- */
5
- export declare class DefaultStorage extends KeyValueStorage {
6
- constructor();
7
- }
@@ -1,33 +0,0 @@
1
- "use strict";
2
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- // SPDX-License-Identifier: Apache-2.0
4
- var __extends = (this && this.__extends) || (function () {
5
- var extendStatics = function (d, b) {
6
- extendStatics = Object.setPrototypeOf ||
7
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
8
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
9
- return extendStatics(d, b);
10
- };
11
- return function (d, b) {
12
- if (typeof b !== "function" && b !== null)
13
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
14
- extendStatics(d, b);
15
- function __() { this.constructor = d; }
16
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
17
- };
18
- })();
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.DefaultStorage = void 0;
21
- var KeyValueStorage_1 = require("./KeyValueStorage");
22
- var utils_1 = require("./utils");
23
- /**
24
- * @internal
25
- */
26
- var DefaultStorage = /** @class */ (function (_super) {
27
- __extends(DefaultStorage, _super);
28
- function DefaultStorage() {
29
- return _super.call(this, (0, utils_1.getDefaultStorageWithFallback)()) || this;
30
- }
31
- return DefaultStorage;
32
- }(KeyValueStorage_1.KeyValueStorage));
33
- exports.DefaultStorage = DefaultStorage;
@@ -1,12 +0,0 @@
1
- /**
2
- * @internal
3
- */
4
- export declare class InMemoryStorage implements Storage {
5
- storage: Map<string, string>;
6
- get length(): number;
7
- key(index: number): string | null;
8
- setItem(key: string, value: string): void;
9
- getItem(key: string): string | null;
10
- removeItem(key: string): void;
11
- clear(): void;
12
- }
@@ -1,41 +0,0 @@
1
- "use strict";
2
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- // SPDX-License-Identifier: Apache-2.0
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.InMemoryStorage = void 0;
6
- /**
7
- * @internal
8
- */
9
- var InMemoryStorage = /** @class */ (function () {
10
- function InMemoryStorage() {
11
- this.storage = new Map();
12
- }
13
- Object.defineProperty(InMemoryStorage.prototype, "length", {
14
- get: function () {
15
- return this.storage.size;
16
- },
17
- enumerable: false,
18
- configurable: true
19
- });
20
- InMemoryStorage.prototype.key = function (index) {
21
- if (index > this.length - 1) {
22
- return null;
23
- }
24
- return Array.from(this.storage.keys())[index];
25
- };
26
- InMemoryStorage.prototype.setItem = function (key, value) {
27
- this.storage.set(key, value);
28
- };
29
- InMemoryStorage.prototype.getItem = function (key) {
30
- var _a;
31
- return (_a = this.storage.get(key)) !== null && _a !== void 0 ? _a : null;
32
- };
33
- InMemoryStorage.prototype.removeItem = function (key) {
34
- this.storage.delete(key);
35
- };
36
- InMemoryStorage.prototype.clear = function () {
37
- this.storage.clear();
38
- };
39
- return InMemoryStorage;
40
- }());
41
- exports.InMemoryStorage = InMemoryStorage;
@@ -1,7 +0,0 @@
1
- import { KeyValueStorage } from './KeyValueStorage';
2
- /**
3
- * @internal
4
- */
5
- export declare class SessionStorage extends KeyValueStorage {
6
- constructor();
7
- }
@@ -1,33 +0,0 @@
1
- "use strict";
2
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- // SPDX-License-Identifier: Apache-2.0
4
- var __extends = (this && this.__extends) || (function () {
5
- var extendStatics = function (d, b) {
6
- extendStatics = Object.setPrototypeOf ||
7
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
8
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
9
- return extendStatics(d, b);
10
- };
11
- return function (d, b) {
12
- if (typeof b !== "function" && b !== null)
13
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
14
- extendStatics(d, b);
15
- function __() { this.constructor = d; }
16
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
17
- };
18
- })();
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.SessionStorage = void 0;
21
- var KeyValueStorage_1 = require("./KeyValueStorage");
22
- var utils_1 = require("./utils");
23
- /**
24
- * @internal
25
- */
26
- var SessionStorage = /** @class */ (function (_super) {
27
- __extends(SessionStorage, _super);
28
- function SessionStorage() {
29
- return _super.call(this, (0, utils_1.getSessionStorageWithFallback)()) || this;
30
- }
31
- return SessionStorage;
32
- }(KeyValueStorage_1.KeyValueStorage));
33
- exports.SessionStorage = SessionStorage;
@@ -1,7 +0,0 @@
1
- import { DefaultStorage } from './DefaultStorage';
2
- import { KeyValueStorage } from './KeyValueStorage';
3
- import { SessionStorage } from './SessionStorage';
4
- export { CookieStorage } from './CookieStorage';
5
- export declare const defaultStorage: DefaultStorage;
6
- export declare const sessionStorage: SessionStorage;
7
- export declare const sharedInMemoryStorage: KeyValueStorage;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- // SPDX-License-Identifier: Apache-2.0
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.sharedInMemoryStorage = exports.sessionStorage = exports.defaultStorage = exports.CookieStorage = void 0;
6
- var DefaultStorage_1 = require("./DefaultStorage");
7
- var InMemoryStorage_1 = require("./InMemoryStorage");
8
- var KeyValueStorage_1 = require("./KeyValueStorage");
9
- var SessionStorage_1 = require("./SessionStorage");
10
- var CookieStorage_1 = require("./CookieStorage");
11
- Object.defineProperty(exports, "CookieStorage", { enumerable: true, get: function () { return CookieStorage_1.CookieStorage; } });
12
- exports.defaultStorage = new DefaultStorage_1.DefaultStorage();
13
- exports.sessionStorage = new SessionStorage_1.SessionStorage();
14
- exports.sharedInMemoryStorage = new KeyValueStorage_1.KeyValueStorage(new InMemoryStorage_1.InMemoryStorage());
@@ -1,10 +0,0 @@
1
- /**
2
- * @internal
3
- * @returns Either a reference to window.localStorage or an in-memory storage as fallback
4
- */
5
- export declare const getDefaultStorageWithFallback: () => Storage;
6
- /**
7
- * @internal
8
- * @returns Either a reference to window.sessionStorage or an in-memory storage as fallback
9
- */
10
- export declare const getSessionStorageWithFallback: () => Storage;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- // SPDX-License-Identifier: Apache-2.0
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.getSessionStorageWithFallback = exports.getDefaultStorageWithFallback = void 0;
6
- var InMemoryStorage_1 = require("./InMemoryStorage");
7
- /**
8
- * @internal
9
- * @returns Either a reference to window.localStorage or an in-memory storage as fallback
10
- */
11
- var getDefaultStorageWithFallback = function () {
12
- return typeof window !== 'undefined' && window.localStorage
13
- ? window.localStorage
14
- : new InMemoryStorage_1.InMemoryStorage();
15
- };
16
- exports.getDefaultStorageWithFallback = getDefaultStorageWithFallback;
17
- /**
18
- * @internal
19
- * @returns Either a reference to window.sessionStorage or an in-memory storage as fallback
20
- */
21
- var getSessionStorageWithFallback = function () {
22
- return typeof window !== 'undefined' && window.sessionStorage
23
- ? window.sessionStorage
24
- : new InMemoryStorage_1.InMemoryStorage();
25
- };
26
- exports.getSessionStorageWithFallback = getSessionStorageWithFallback;
@@ -1,3 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- export var isAppInForeground = function () { return true; };
@@ -1 +0,0 @@
1
- export declare const isAppInForeground: () => boolean;
@@ -1,5 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- // @ts-ignore: missing type definition
4
- import { AppState } from 'react-native';
5
- export var isAppInForeground = function () { return AppState.currentState === 'active'; };
@@ -1,34 +0,0 @@
1
- export type LibraryAPIOptions = {
2
- AppSync: {
3
- query: string;
4
- variables?: object;
5
- authMode?: any;
6
- authToken?: string;
7
- /**
8
- * @deprecated This property should not be used
9
- */
10
- userAgentSuffix?: string;
11
- };
12
- customHeaders: Function;
13
- };
14
- export type APIConfig = {
15
- AppSync?: {
16
- defaultAuthMode?: GraphQLAuthMode;
17
- region?: string;
18
- endpoint?: string;
19
- modelIntrospectionSchema?: any;
20
- };
21
- };
22
- export type GraphQLAuthMode = {
23
- type: 'apiKey';
24
- apiKey: string;
25
- } | {
26
- type: 'jwt';
27
- token: 'id' | 'access';
28
- } | {
29
- type: 'iam';
30
- } | {
31
- type: 'lambda';
32
- } | {
33
- type: 'custom';
34
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,7 +0,0 @@
1
- import { KeyValueStorage } from './KeyValueStorage';
2
- /**
3
- * @internal
4
- */
5
- export declare class CookieStorage extends KeyValueStorage {
6
- constructor();
7
- }
@@ -1,29 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- var __extends = (this && this.__extends) || (function () {
4
- var extendStatics = function (d, b) {
5
- extendStatics = Object.setPrototypeOf ||
6
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
7
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
8
- return extendStatics(d, b);
9
- };
10
- return function (d, b) {
11
- if (typeof b !== "function" && b !== null)
12
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
13
- extendStatics(d, b);
14
- function __() { this.constructor = d; }
15
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
16
- };
17
- })();
18
- import { KeyValueStorage } from './KeyValueStorage';
19
- /**
20
- * @internal
21
- */
22
- var CookieStorage = /** @class */ (function (_super) {
23
- __extends(CookieStorage, _super);
24
- function CookieStorage() {
25
- return _super.call(this) || this;
26
- }
27
- return CookieStorage;
28
- }(KeyValueStorage));
29
- export { CookieStorage };
@@ -1,7 +0,0 @@
1
- import { KeyValueStorage } from './KeyValueStorage';
2
- /**
3
- * @internal
4
- */
5
- export declare class DefaultStorage extends KeyValueStorage {
6
- constructor();
7
- }
@@ -1,30 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- var __extends = (this && this.__extends) || (function () {
4
- var extendStatics = function (d, b) {
5
- extendStatics = Object.setPrototypeOf ||
6
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
7
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
8
- return extendStatics(d, b);
9
- };
10
- return function (d, b) {
11
- if (typeof b !== "function" && b !== null)
12
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
13
- extendStatics(d, b);
14
- function __() { this.constructor = d; }
15
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
16
- };
17
- })();
18
- import { KeyValueStorage } from './KeyValueStorage';
19
- import { getDefaultStorageWithFallback } from './utils';
20
- /**
21
- * @internal
22
- */
23
- var DefaultStorage = /** @class */ (function (_super) {
24
- __extends(DefaultStorage, _super);
25
- function DefaultStorage() {
26
- return _super.call(this, getDefaultStorageWithFallback()) || this;
27
- }
28
- return DefaultStorage;
29
- }(KeyValueStorage));
30
- export { DefaultStorage };
@@ -1,12 +0,0 @@
1
- /**
2
- * @internal
3
- */
4
- export declare class InMemoryStorage implements Storage {
5
- storage: Map<string, string>;
6
- get length(): number;
7
- key(index: number): string | null;
8
- setItem(key: string, value: string): void;
9
- getItem(key: string): string | null;
10
- removeItem(key: string): void;
11
- clear(): void;
12
- }
@@ -1,38 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- /**
4
- * @internal
5
- */
6
- var InMemoryStorage = /** @class */ (function () {
7
- function InMemoryStorage() {
8
- this.storage = new Map();
9
- }
10
- Object.defineProperty(InMemoryStorage.prototype, "length", {
11
- get: function () {
12
- return this.storage.size;
13
- },
14
- enumerable: false,
15
- configurable: true
16
- });
17
- InMemoryStorage.prototype.key = function (index) {
18
- if (index > this.length - 1) {
19
- return null;
20
- }
21
- return Array.from(this.storage.keys())[index];
22
- };
23
- InMemoryStorage.prototype.setItem = function (key, value) {
24
- this.storage.set(key, value);
25
- };
26
- InMemoryStorage.prototype.getItem = function (key) {
27
- var _a;
28
- return (_a = this.storage.get(key)) !== null && _a !== void 0 ? _a : null;
29
- };
30
- InMemoryStorage.prototype.removeItem = function (key) {
31
- this.storage.delete(key);
32
- };
33
- InMemoryStorage.prototype.clear = function () {
34
- this.storage.clear();
35
- };
36
- return InMemoryStorage;
37
- }());
38
- export { InMemoryStorage };
@@ -1,7 +0,0 @@
1
- import { KeyValueStorage } from './KeyValueStorage';
2
- /**
3
- * @internal
4
- */
5
- export declare class SessionStorage extends KeyValueStorage {
6
- constructor();
7
- }
@@ -1,30 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- var __extends = (this && this.__extends) || (function () {
4
- var extendStatics = function (d, b) {
5
- extendStatics = Object.setPrototypeOf ||
6
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
7
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
8
- return extendStatics(d, b);
9
- };
10
- return function (d, b) {
11
- if (typeof b !== "function" && b !== null)
12
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
13
- extendStatics(d, b);
14
- function __() { this.constructor = d; }
15
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
16
- };
17
- })();
18
- import { KeyValueStorage } from './KeyValueStorage';
19
- import { getSessionStorageWithFallback } from './utils';
20
- /**
21
- * @internal
22
- */
23
- var SessionStorage = /** @class */ (function (_super) {
24
- __extends(SessionStorage, _super);
25
- function SessionStorage() {
26
- return _super.call(this, getSessionStorageWithFallback()) || this;
27
- }
28
- return SessionStorage;
29
- }(KeyValueStorage));
30
- export { SessionStorage };
@@ -1,7 +0,0 @@
1
- import { DefaultStorage } from './DefaultStorage';
2
- import { KeyValueStorage } from './KeyValueStorage';
3
- import { SessionStorage } from './SessionStorage';
4
- export { CookieStorage } from './CookieStorage';
5
- export declare const defaultStorage: DefaultStorage;
6
- export declare const sessionStorage: SessionStorage;
7
- export declare const sharedInMemoryStorage: KeyValueStorage;
@@ -1,10 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { DefaultStorage } from './DefaultStorage';
4
- import { InMemoryStorage } from './InMemoryStorage';
5
- import { KeyValueStorage } from './KeyValueStorage';
6
- import { SessionStorage } from './SessionStorage';
7
- export { CookieStorage } from './CookieStorage';
8
- export var defaultStorage = new DefaultStorage();
9
- export var sessionStorage = new SessionStorage();
10
- export var sharedInMemoryStorage = new KeyValueStorage(new InMemoryStorage());
@@ -1,10 +0,0 @@
1
- /**
2
- * @internal
3
- * @returns Either a reference to window.localStorage or an in-memory storage as fallback
4
- */
5
- export declare const getDefaultStorageWithFallback: () => Storage;
6
- /**
7
- * @internal
8
- * @returns Either a reference to window.sessionStorage or an in-memory storage as fallback
9
- */
10
- export declare const getSessionStorageWithFallback: () => Storage;
@@ -1,21 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { InMemoryStorage } from './InMemoryStorage';
4
- /**
5
- * @internal
6
- * @returns Either a reference to window.localStorage or an in-memory storage as fallback
7
- */
8
- export var getDefaultStorageWithFallback = function () {
9
- return typeof window !== 'undefined' && window.localStorage
10
- ? window.localStorage
11
- : new InMemoryStorage();
12
- };
13
- /**
14
- * @internal
15
- * @returns Either a reference to window.sessionStorage or an in-memory storage as fallback
16
- */
17
- export var getSessionStorageWithFallback = function () {
18
- return typeof window !== 'undefined' && window.sessionStorage
19
- ? window.sessionStorage
20
- : new InMemoryStorage();
21
- };
@@ -1,7 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- // @ts-ignore: missing type definition
5
- import { AppState } from 'react-native';
6
-
7
- export const isAppInForeground = () => AppState.currentState === 'active';
@@ -1,4 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- export const isAppInForeground = () => true;