@aws-amplify/core 6.5.2-unstable.168ecff.0 → 6.5.2-unstable.4606279.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.
- package/dist/cjs/Platform/version.js +1 -1
- package/dist/cjs/Platform/version.js.map +1 -1
- package/dist/cjs/storage/utils.js +32 -6
- package/dist/cjs/storage/utils.js.map +1 -1
- package/dist/esm/Platform/version.d.ts +1 -1
- package/dist/esm/Platform/version.mjs +1 -1
- package/dist/esm/Platform/version.mjs.map +1 -1
- package/dist/esm/storage/utils.d.ts +0 -4
- package/dist/esm/storage/utils.mjs +32 -6
- package/dist/esm/storage/utils.mjs.map +1 -1
- package/package.json +4 -4
- package/src/Platform/version.ts +1 -1
- package/src/storage/utils.ts +37 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sources":["../../../src/Platform/version.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.version = void 0;\n// generated by genversion\nexports.version = '6.8.1-unstable.
|
|
1
|
+
{"version":3,"file":"version.js","sources":["../../../src/Platform/version.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.version = void 0;\n// generated by genversion\nexports.version = '6.8.1-unstable.4606279.0+4606279';\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC;AACzB;AACA,OAAO,CAAC,OAAO,GAAG,kCAAkC;;"}
|
|
@@ -4,21 +4,47 @@
|
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getSessionStorageWithFallback = exports.getLocalStorageWithFallback = void 0;
|
|
7
|
+
const Logger_1 = require("../Logger");
|
|
7
8
|
const InMemoryStorage_1 = require("./InMemoryStorage");
|
|
8
9
|
/**
|
|
9
10
|
* @internal
|
|
10
11
|
* @returns Either a reference to window.localStorage or an in-memory storage as fallback
|
|
11
12
|
*/
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const logger = new Logger_1.ConsoleLogger('CoreStorageUtils');
|
|
14
|
+
const getLocalStorageWithFallback = () => {
|
|
15
|
+
try {
|
|
16
|
+
// Attempt to use localStorage directly
|
|
17
|
+
if (typeof window !== 'undefined' && window.localStorage) {
|
|
18
|
+
return window.localStorage;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
// Handle any errors related to localStorage access
|
|
23
|
+
logger.error('LocalStorage access failed:', e);
|
|
24
|
+
}
|
|
25
|
+
// Return in-memory storage as a fallback if localStorage is not accessible
|
|
26
|
+
return new InMemoryStorage_1.InMemoryStorage();
|
|
27
|
+
};
|
|
15
28
|
exports.getLocalStorageWithFallback = getLocalStorageWithFallback;
|
|
16
29
|
/**
|
|
17
30
|
* @internal
|
|
18
31
|
* @returns Either a reference to window.sessionStorage or an in-memory storage as fallback
|
|
19
32
|
*/
|
|
20
|
-
const getSessionStorageWithFallback = () =>
|
|
21
|
-
|
|
22
|
-
|
|
33
|
+
const getSessionStorageWithFallback = () => {
|
|
34
|
+
try {
|
|
35
|
+
// Attempt to use sessionStorage directly
|
|
36
|
+
if (typeof window !== 'undefined' && window.sessionStorage) {
|
|
37
|
+
// Verify we can actually use it by testing access
|
|
38
|
+
window.sessionStorage.getItem('test');
|
|
39
|
+
return window.sessionStorage;
|
|
40
|
+
}
|
|
41
|
+
throw new Error('sessionStorage is not defined');
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
// Handle any errors related to sessionStorage access
|
|
45
|
+
logger.error('SessionStorage access failed:', e);
|
|
46
|
+
return new InMemoryStorage_1.InMemoryStorage();
|
|
47
|
+
}
|
|
48
|
+
};
|
|
23
49
|
exports.getSessionStorageWithFallback = getSessionStorageWithFallback;
|
|
24
50
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../src/storage/utils.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.getSessionStorageWithFallback = exports.getLocalStorageWithFallback = void 0;\nconst InMemoryStorage_1 = require(\"./InMemoryStorage\");\n/**\n * @internal\n * @returns Either a reference to window.localStorage or an in-memory storage as fallback\n */\nconst getLocalStorageWithFallback = () => typeof window !== 'undefined' && window.localStorage\n
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../src/storage/utils.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.getSessionStorageWithFallback = exports.getLocalStorageWithFallback = void 0;\nconst Logger_1 = require(\"../Logger\");\nconst InMemoryStorage_1 = require(\"./InMemoryStorage\");\n/**\n * @internal\n * @returns Either a reference to window.localStorage or an in-memory storage as fallback\n */\nconst logger = new Logger_1.ConsoleLogger('CoreStorageUtils');\nconst getLocalStorageWithFallback = () => {\n try {\n // Attempt to use localStorage directly\n if (typeof window !== 'undefined' && window.localStorage) {\n return window.localStorage;\n }\n }\n catch (e) {\n // Handle any errors related to localStorage access\n logger.error('LocalStorage access failed:', e);\n }\n // Return in-memory storage as a fallback if localStorage is not accessible\n return new InMemoryStorage_1.InMemoryStorage();\n};\nexports.getLocalStorageWithFallback = getLocalStorageWithFallback;\n/**\n * @internal\n * @returns Either a reference to window.sessionStorage or an in-memory storage as fallback\n */\nconst getSessionStorageWithFallback = () => {\n try {\n // Attempt to use sessionStorage directly\n if (typeof window !== 'undefined' && window.sessionStorage) {\n // Verify we can actually use it by testing access\n window.sessionStorage.getItem('test');\n return window.sessionStorage;\n }\n throw new Error('sessionStorage is not defined');\n }\n catch (e) {\n // Handle any errors related to sessionStorage access\n logger.error('SessionStorage access failed:', e);\n return new InMemoryStorage_1.InMemoryStorage();\n }\n};\nexports.getSessionStorageWithFallback = getSessionStorageWithFallback;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,6BAA6B,GAAG,OAAO,CAAC,2BAA2B,GAAG,KAAK,CAAC,CAAC;AACrF,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AACtC,MAAM,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AACvD;AACA;AACA;AACA;AACA,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;AAC9D,MAAM,2BAA2B,GAAG,MAAM;AAC1C,IAAI,IAAI;AACR;AACA,QAAQ,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,YAAY,EAAE;AAClE,YAAY,OAAO,MAAM,CAAC,YAAY,CAAC;AACvC,SAAS;AACT,KAAK;AACL,IAAI,OAAO,CAAC,EAAE;AACd;AACA,QAAQ,MAAM,CAAC,KAAK,CAAC,6BAA6B,EAAE,CAAC,CAAC,CAAC;AACvD,KAAK;AACL;AACA,IAAI,OAAO,IAAI,iBAAiB,CAAC,eAAe,EAAE,CAAC;AACnD,CAAC,CAAC;AACF,OAAO,CAAC,2BAA2B,GAAG,2BAA2B,CAAC;AAClE;AACA;AACA;AACA;AACA,MAAM,6BAA6B,GAAG,MAAM;AAC5C,IAAI,IAAI;AACR;AACA,QAAQ,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,cAAc,EAAE;AACpE;AACA,YAAY,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAClD,YAAY,OAAO,MAAM,CAAC,cAAc,CAAC;AACzC,SAAS;AACT,QAAQ,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;AACzD,KAAK;AACL,IAAI,OAAO,CAAC,EAAE;AACd;AACA,QAAQ,MAAM,CAAC,KAAK,CAAC,+BAA+B,EAAE,CAAC,CAAC,CAAC;AACzD,QAAQ,OAAO,IAAI,iBAAiB,CAAC,eAAe,EAAE,CAAC;AACvD,KAAK;AACL,CAAC,CAAC;AACF,OAAO,CAAC,6BAA6B,GAAG,6BAA6B;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "6.8.1-unstable.
|
|
1
|
+
export declare const version = "6.8.1-unstable.4606279.0+4606279";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.mjs","sources":["../../../src/Platform/version.ts"],"sourcesContent":["// generated by genversion\nexport const version = '6.8.1-unstable.
|
|
1
|
+
{"version":3,"file":"version.mjs","sources":["../../../src/Platform/version.ts"],"sourcesContent":["// generated by genversion\nexport const version = '6.8.1-unstable.4606279.0+4606279';\n"],"names":[],"mappings":"AAAA;AACY,MAAC,OAAO,GAAG;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ConsoleLogger } from '../Logger/ConsoleLogger.mjs';
|
|
1
2
|
import { InMemoryStorage } from './InMemoryStorage.mjs';
|
|
2
3
|
|
|
3
4
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
@@ -6,16 +7,41 @@ import { InMemoryStorage } from './InMemoryStorage.mjs';
|
|
|
6
7
|
* @internal
|
|
7
8
|
* @returns Either a reference to window.localStorage or an in-memory storage as fallback
|
|
8
9
|
*/
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const logger = new ConsoleLogger('CoreStorageUtils');
|
|
11
|
+
const getLocalStorageWithFallback = () => {
|
|
12
|
+
try {
|
|
13
|
+
// Attempt to use localStorage directly
|
|
14
|
+
if (typeof window !== 'undefined' && window.localStorage) {
|
|
15
|
+
return window.localStorage;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
catch (e) {
|
|
19
|
+
// Handle any errors related to localStorage access
|
|
20
|
+
logger.error('LocalStorage access failed:', e);
|
|
21
|
+
}
|
|
22
|
+
// Return in-memory storage as a fallback if localStorage is not accessible
|
|
23
|
+
return new InMemoryStorage();
|
|
24
|
+
};
|
|
12
25
|
/**
|
|
13
26
|
* @internal
|
|
14
27
|
* @returns Either a reference to window.sessionStorage or an in-memory storage as fallback
|
|
15
28
|
*/
|
|
16
|
-
const getSessionStorageWithFallback = () =>
|
|
17
|
-
|
|
18
|
-
|
|
29
|
+
const getSessionStorageWithFallback = () => {
|
|
30
|
+
try {
|
|
31
|
+
// Attempt to use sessionStorage directly
|
|
32
|
+
if (typeof window !== 'undefined' && window.sessionStorage) {
|
|
33
|
+
// Verify we can actually use it by testing access
|
|
34
|
+
window.sessionStorage.getItem('test');
|
|
35
|
+
return window.sessionStorage;
|
|
36
|
+
}
|
|
37
|
+
throw new Error('sessionStorage is not defined');
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
// Handle any errors related to sessionStorage access
|
|
41
|
+
logger.error('SessionStorage access failed:', e);
|
|
42
|
+
return new InMemoryStorage();
|
|
43
|
+
}
|
|
44
|
+
};
|
|
19
45
|
|
|
20
46
|
export { getLocalStorageWithFallback, getSessionStorageWithFallback };
|
|
21
47
|
//# sourceMappingURL=utils.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.mjs","sources":["../../../src/storage/utils.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { InMemoryStorage } from './InMemoryStorage';\n/**\n * @internal\n * @returns Either a reference to window.localStorage or an in-memory storage as fallback\n */\nexport const getLocalStorageWithFallback = () => typeof window !== 'undefined' && window.localStorage\n
|
|
1
|
+
{"version":3,"file":"utils.mjs","sources":["../../../src/storage/utils.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ConsoleLogger } from '../Logger';\nimport { InMemoryStorage } from './InMemoryStorage';\n/**\n * @internal\n * @returns Either a reference to window.localStorage or an in-memory storage as fallback\n */\nconst logger = new ConsoleLogger('CoreStorageUtils');\nexport const getLocalStorageWithFallback = () => {\n try {\n // Attempt to use localStorage directly\n if (typeof window !== 'undefined' && window.localStorage) {\n return window.localStorage;\n }\n }\n catch (e) {\n // Handle any errors related to localStorage access\n logger.error('LocalStorage access failed:', e);\n }\n // Return in-memory storage as a fallback if localStorage is not accessible\n return new InMemoryStorage();\n};\n/**\n * @internal\n * @returns Either a reference to window.sessionStorage or an in-memory storage as fallback\n */\nexport const getSessionStorageWithFallback = () => {\n try {\n // Attempt to use sessionStorage directly\n if (typeof window !== 'undefined' && window.sessionStorage) {\n // Verify we can actually use it by testing access\n window.sessionStorage.getItem('test');\n return window.sessionStorage;\n }\n throw new Error('sessionStorage is not defined');\n }\n catch (e) {\n // Handle any errors related to sessionStorage access\n logger.error('SessionStorage access failed:', e);\n return new InMemoryStorage();\n }\n};\n"],"names":[],"mappings":";;;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,kBAAkB,CAAC,CAAC;AACzC,MAAC,2BAA2B,GAAG,MAAM;AACjD,IAAI,IAAI;AACR;AACA,QAAQ,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,YAAY,EAAE;AAClE,YAAY,OAAO,MAAM,CAAC,YAAY,CAAC;AACvC,SAAS;AACT,KAAK;AACL,IAAI,OAAO,CAAC,EAAE;AACd;AACA,QAAQ,MAAM,CAAC,KAAK,CAAC,6BAA6B,EAAE,CAAC,CAAC,CAAC;AACvD,KAAK;AACL;AACA,IAAI,OAAO,IAAI,eAAe,EAAE,CAAC;AACjC,EAAE;AACF;AACA;AACA;AACA;AACY,MAAC,6BAA6B,GAAG,MAAM;AACnD,IAAI,IAAI;AACR;AACA,QAAQ,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,cAAc,EAAE;AACpE;AACA,YAAY,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAClD,YAAY,OAAO,MAAM,CAAC,cAAc,CAAC;AACzC,SAAS;AACT,QAAQ,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;AACzD,KAAK;AACL,IAAI,OAAO,CAAC,EAAE;AACd;AACA,QAAQ,MAAM,CAAC,KAAK,CAAC,+BAA+B,EAAE,CAAC,CAAC,CAAC;AACzD,QAAQ,OAAO,IAAI,eAAe,EAAE,CAAC;AACrC,KAAK;AACL;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/core",
|
|
3
|
-
"version": "6.5.2-unstable.
|
|
3
|
+
"version": "6.5.2-unstable.4606279.0+4606279",
|
|
4
4
|
"description": "Core category of aws-amplify",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.mjs",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"uuid": "^9.0.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@aws-amplify/react-native": "1.1.7-unstable.
|
|
63
|
+
"@aws-amplify/react-native": "1.1.7-unstable.4606279.0+4606279",
|
|
64
64
|
"@types/js-cookie": "3.0.2",
|
|
65
65
|
"genversion": "^2.2.0",
|
|
66
66
|
"typescript": "5.0.2"
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"name": "Cache (default browser storage)",
|
|
107
107
|
"path": "./dist/esm/index.mjs",
|
|
108
108
|
"import": "{ Cache }",
|
|
109
|
-
"limit": "3.
|
|
109
|
+
"limit": "3.4 kB"
|
|
110
110
|
}
|
|
111
111
|
],
|
|
112
112
|
"exports": {
|
|
@@ -192,5 +192,5 @@
|
|
|
192
192
|
]
|
|
193
193
|
}
|
|
194
194
|
},
|
|
195
|
-
"gitHead": "
|
|
195
|
+
"gitHead": "460627966350c67db890dd908e882885e93624a7"
|
|
196
196
|
}
|
package/src/Platform/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// generated by genversion
|
|
2
|
-
export const version = '6.8.1-unstable.
|
|
2
|
+
export const version = '6.8.1-unstable.4606279.0+4606279';
|
package/src/storage/utils.ts
CHANGED
|
@@ -1,22 +1,51 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import { ConsoleLogger } from '../Logger';
|
|
5
|
+
|
|
4
6
|
import { InMemoryStorage } from './InMemoryStorage';
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* @internal
|
|
8
10
|
* @returns Either a reference to window.localStorage or an in-memory storage as fallback
|
|
9
11
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
|
|
13
|
+
const logger = new ConsoleLogger('CoreStorageUtils');
|
|
14
|
+
|
|
15
|
+
export const getLocalStorageWithFallback = (): Storage => {
|
|
16
|
+
try {
|
|
17
|
+
// Attempt to use localStorage directly
|
|
18
|
+
if (typeof window !== 'undefined' && window.localStorage) {
|
|
19
|
+
return window.localStorage;
|
|
20
|
+
}
|
|
21
|
+
} catch (e) {
|
|
22
|
+
// Handle any errors related to localStorage access
|
|
23
|
+
logger.error('LocalStorage access failed:', e);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Return in-memory storage as a fallback if localStorage is not accessible
|
|
27
|
+
return new InMemoryStorage();
|
|
28
|
+
};
|
|
14
29
|
|
|
15
30
|
/**
|
|
16
31
|
* @internal
|
|
17
32
|
* @returns Either a reference to window.sessionStorage or an in-memory storage as fallback
|
|
18
33
|
*/
|
|
19
|
-
export const getSessionStorageWithFallback = (): Storage =>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
34
|
+
export const getSessionStorageWithFallback = (): Storage => {
|
|
35
|
+
try {
|
|
36
|
+
// Attempt to use sessionStorage directly
|
|
37
|
+
if (typeof window !== 'undefined' && window.sessionStorage) {
|
|
38
|
+
// Verify we can actually use it by testing access
|
|
39
|
+
window.sessionStorage.getItem('test');
|
|
40
|
+
|
|
41
|
+
return window.sessionStorage;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
throw new Error('sessionStorage is not defined');
|
|
45
|
+
} catch (e) {
|
|
46
|
+
// Handle any errors related to sessionStorage access
|
|
47
|
+
logger.error('SessionStorage access failed:', e);
|
|
48
|
+
|
|
49
|
+
return new InMemoryStorage();
|
|
50
|
+
}
|
|
51
|
+
};
|