@aws-amplify/core 6.0.1-console-preview.deaebd5.0 → 6.0.1-console-preview.b5a42af.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 (80) hide show
  1. package/lib/AwsClients/CognitoIdentity/getCredentialsForIdentity.d.ts +2 -1
  2. package/lib/AwsClients/CognitoIdentity/getId.d.ts +2 -1
  3. package/lib/AwsClients/Pinpoint/getInAppMessages.d.ts +3 -2
  4. package/lib/AwsClients/Pinpoint/putEvents.d.ts +3 -2
  5. package/lib/AwsClients/Pinpoint/updateEndpoint.d.ts +3 -2
  6. package/lib/Cache/AsyncStorageCache.d.ts +1 -1
  7. package/lib/Cache/AsyncStorageCache.js +20 -22
  8. package/lib/Platform/version.d.ts +1 -1
  9. package/lib/Platform/version.js +1 -1
  10. package/lib/Reachability/Reachability.native.d.ts +2 -2
  11. package/lib/clients/handlers/fetch.js +2 -1
  12. package/lib/clients/middleware/signing/signer/signatureV4/index.native.d.ts +0 -1
  13. package/lib/clients/middleware/signing/signer/signatureV4/index.native.js +2 -1
  14. package/lib/clients/types/http.d.ts +16 -0
  15. package/lib/libraryUtils.d.ts +1 -1
  16. package/lib/parseAWSExports.js +24 -8
  17. package/lib/providers/pinpoint/index.d.ts +1 -0
  18. package/lib/providers/pinpoint/index.js +3 -0
  19. package/lib/singleton/API/types.d.ts +66 -29
  20. package/lib/singleton/Auth/utils/index.js +1 -1
  21. package/lib/singleton/Notifications/InAppMessaging/types.d.ts +2 -0
  22. package/lib/singleton/Notifications/InAppMessaging/types.js +4 -0
  23. package/lib/singleton/Notifications/types.d.ts +4 -0
  24. package/lib/singleton/Notifications/types.js +4 -0
  25. package/lib/singleton/types.d.ts +2 -0
  26. package/lib/storage/DefaultStorage.native.d.ts +2 -2
  27. package/lib/storage/DefaultStorage.native.js +3 -24
  28. package/lib/tsconfig.tsbuildinfo +1 -1
  29. package/lib/utils/globalHelpers/index.native.d.ts +0 -1
  30. package/lib/utils/globalHelpers/index.native.js +2 -1
  31. package/lib-esm/AwsClients/CognitoIdentity/getCredentialsForIdentity.d.ts +2 -1
  32. package/lib-esm/AwsClients/CognitoIdentity/getId.d.ts +2 -1
  33. package/lib-esm/AwsClients/Pinpoint/getInAppMessages.d.ts +3 -2
  34. package/lib-esm/AwsClients/Pinpoint/putEvents.d.ts +3 -2
  35. package/lib-esm/AwsClients/Pinpoint/updateEndpoint.d.ts +3 -2
  36. package/lib-esm/Cache/AsyncStorageCache.d.ts +1 -1
  37. package/lib-esm/Cache/AsyncStorageCache.js +2 -1
  38. package/lib-esm/Platform/version.d.ts +1 -1
  39. package/lib-esm/Platform/version.js +1 -1
  40. package/lib-esm/Reachability/Reachability.native.d.ts +2 -2
  41. package/lib-esm/clients/handlers/fetch.js +2 -1
  42. package/lib-esm/clients/middleware/signing/signer/signatureV4/index.native.d.ts +0 -1
  43. package/lib-esm/clients/middleware/signing/signer/signatureV4/index.native.js +2 -1
  44. package/lib-esm/clients/types/http.d.ts +16 -0
  45. package/lib-esm/libraryUtils.d.ts +1 -1
  46. package/lib-esm/parseAWSExports.js +24 -8
  47. package/lib-esm/providers/pinpoint/index.d.ts +1 -0
  48. package/lib-esm/providers/pinpoint/index.js +1 -0
  49. package/lib-esm/singleton/API/types.d.ts +66 -29
  50. package/lib-esm/singleton/Auth/utils/index.js +1 -1
  51. package/lib-esm/singleton/Notifications/InAppMessaging/types.d.ts +2 -0
  52. package/lib-esm/singleton/Notifications/InAppMessaging/types.js +3 -0
  53. package/lib-esm/singleton/Notifications/types.d.ts +4 -0
  54. package/lib-esm/singleton/Notifications/types.js +3 -0
  55. package/lib-esm/singleton/types.d.ts +2 -0
  56. package/lib-esm/storage/DefaultStorage.native.d.ts +2 -2
  57. package/lib-esm/storage/DefaultStorage.native.js +3 -24
  58. package/lib-esm/tsconfig.tsbuildinfo +1 -1
  59. package/lib-esm/utils/globalHelpers/index.native.d.ts +0 -1
  60. package/lib-esm/utils/globalHelpers/index.native.js +2 -1
  61. package/package.json +3 -9
  62. package/src/Cache/AsyncStorageCache.ts +2 -1
  63. package/src/Platform/version.ts +1 -1
  64. package/src/Reachability/Reachability.native.ts +4 -2
  65. package/src/clients/handlers/fetch.ts +5 -1
  66. package/src/clients/middleware/signing/signer/signatureV4/index.native.ts +3 -1
  67. package/src/clients/types/http.ts +18 -0
  68. package/src/libraryUtils.ts +1 -1
  69. package/src/parseAWSExports.ts +38 -7
  70. package/src/providers/pinpoint/index.ts +1 -0
  71. package/src/singleton/API/types.ts +77 -26
  72. package/src/singleton/Auth/utils/index.ts +1 -1
  73. package/src/singleton/Notifications/InAppMessaging/types.ts +6 -0
  74. package/src/singleton/Notifications/types.ts +8 -0
  75. package/src/singleton/types.ts +2 -1
  76. package/src/storage/DefaultStorage.native.ts +6 -26
  77. package/src/utils/globalHelpers/index.native.ts +3 -1
  78. package/polyfills/URL/index.ts +0 -14
  79. package/polyfills/URL/tsconfig.json +0 -10
  80. package/polyfills/URL/webpack.config.js +0 -43
@@ -39,14 +39,14 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
39
39
  };
40
40
  Object.defineProperty(exports, "__esModule", { value: true });
41
41
  exports.DefaultStorage = void 0;
42
- var errors_1 = require("../errors");
43
- var ASYNC_STORAGE_MODULE = '@react-native-async-storage/async-storage';
42
+ var react_native_1 = require("@aws-amplify/react-native");
44
43
  var MEMORY_KEY_PREFIX = '@MemoryStorage:';
45
44
  /**
46
45
  * @internal
47
46
  */
48
47
  var DefaultStorage = /** @class */ (function () {
49
48
  function DefaultStorage() {
49
+ this.asyncStorage = (0, react_native_1.loadAsyncStorage)();
50
50
  }
51
51
  /**
52
52
  * This is used to set a specific item in storage
@@ -55,7 +55,6 @@ var DefaultStorage = /** @class */ (function () {
55
55
  * @returns {string} value that was set
56
56
  */
57
57
  DefaultStorage.prototype.setItem = function (key, value) {
58
- this.assertModule(this.asyncStorage);
59
58
  return this.asyncStorage.setItem("".concat(MEMORY_KEY_PREFIX).concat(key), value);
60
59
  };
61
60
  /**
@@ -65,7 +64,6 @@ var DefaultStorage = /** @class */ (function () {
65
64
  * @returns {string} the data item
66
65
  */
67
66
  DefaultStorage.prototype.getItem = function (key) {
68
- this.assertModule(this.asyncStorage);
69
67
  return this.asyncStorage.getItem("".concat(MEMORY_KEY_PREFIX).concat(key));
70
68
  };
71
69
  /**
@@ -74,7 +72,6 @@ var DefaultStorage = /** @class */ (function () {
74
72
  * @returns {string} value - value that was deleted
75
73
  */
76
74
  DefaultStorage.prototype.removeItem = function (key) {
77
- this.assertModule(this.asyncStorage);
78
75
  return this.asyncStorage.removeItem("".concat(MEMORY_KEY_PREFIX).concat(key));
79
76
  };
80
77
  /**
@@ -86,9 +83,7 @@ var DefaultStorage = /** @class */ (function () {
86
83
  var allKeys;
87
84
  return __generator(this, function (_a) {
88
85
  switch (_a.label) {
89
- case 0:
90
- this.assertModule(this.asyncStorage);
91
- return [4 /*yield*/, this.asyncStorage.getAllKeys()];
86
+ case 0: return [4 /*yield*/, this.asyncStorage.getAllKeys()];
92
87
  case 1:
93
88
  allKeys = _a.sent();
94
89
  return [2 /*return*/, this.asyncStorage.multiRemove(allKeys.filter(function (key) { return key.startsWith(MEMORY_KEY_PREFIX); }))];
@@ -96,22 +91,6 @@ var DefaultStorage = /** @class */ (function () {
96
91
  });
97
92
  });
98
93
  };
99
- DefaultStorage.prototype.assertModule = function (asyncStorage) {
100
- if (!!asyncStorage) {
101
- return;
102
- }
103
- try {
104
- this.asyncStorage = require(ASYNC_STORAGE_MODULE)
105
- .default;
106
- }
107
- catch (err) {
108
- throw new errors_1.AmplifyError({
109
- name: 'NativeModuleException',
110
- message: "Unable to find ".concat(ASYNC_STORAGE_MODULE),
111
- recoverySuggestion: "Make sure to install ".concat(ASYNC_STORAGE_MODULE),
112
- });
113
- }
114
- };
115
94
  return DefaultStorage;
116
95
  }());
117
96
  exports.DefaultStorage = DefaultStorage;