@aws-amplify/core 5.8.2 → 6.0.1-console-preview.7919075.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 (300) hide show
  1. package/README.md +3 -0
  2. package/lib/Amplify.d.ts +18 -17
  3. package/lib/Amplify.js +9 -0
  4. package/lib/AwsClients/CognitoIdentity/base.d.ts +3 -10
  5. package/lib/AwsClients/CognitoIdentity/getCredentialsForIdentity.d.ts +3 -17
  6. package/lib/AwsClients/CognitoIdentity/getCredentialsForIdentity.js +8 -8
  7. package/lib/AwsClients/CognitoIdentity/getId.d.ts +3 -17
  8. package/lib/AwsClients/Pinpoint/base.d.ts +2 -10
  9. package/lib/AwsClients/Pinpoint/getInAppMessages.d.ts +3 -17
  10. package/lib/AwsClients/Pinpoint/getInAppMessages.js +1 -1
  11. package/lib/AwsClients/Pinpoint/putEvents.d.ts +3 -17
  12. package/lib/AwsClients/Pinpoint/putEvents.js +6 -0
  13. package/lib/AwsClients/Pinpoint/updateEndpoint.d.ts +3 -17
  14. package/lib/AwsClients/Pinpoint/updateEndpoint.js +2 -2
  15. package/lib/Cache/AsyncStorageCache.d.ts +154 -0
  16. package/lib/Cache/AsyncStorageCache.js +744 -0
  17. package/lib/Cache/BrowserStorageCache.d.ts +166 -0
  18. package/lib/Cache/BrowserStorageCache.js +469 -0
  19. package/lib/Cache/InMemoryCache.d.ts +129 -0
  20. package/lib/Cache/InMemoryCache.js +349 -0
  21. package/lib/Cache/StorageCache.d.ts +39 -0
  22. package/lib/Cache/StorageCache.js +121 -0
  23. package/lib/Cache/Utils/CacheList.d.ts +89 -0
  24. package/lib/Cache/Utils/CacheList.js +196 -0
  25. package/lib/Cache/Utils/CacheUtils.d.ts +25 -0
  26. package/lib/Cache/Utils/CacheUtils.js +88 -0
  27. package/lib/Cache/Utils/index.d.ts +2 -0
  28. package/lib/Cache/Utils/index.js +16 -0
  29. package/lib/Cache/reactnative.d.ts +3 -0
  30. package/lib/Cache/reactnative.js +8 -0
  31. package/lib/Cache/types/Cache.d.ts +55 -0
  32. package/lib/Cache/types/Cache.js +4 -0
  33. package/lib/Cache/types/index.d.ts +1 -0
  34. package/lib/Cache/types/index.js +19 -0
  35. package/lib/ClientDevice/android.js +3 -2
  36. package/lib/ClientDevice/ios.d.ts +2 -2
  37. package/lib/ClientDevice/ios.js +3 -2
  38. package/lib/ClientDevice/reactnative.js +3 -2
  39. package/lib/Credentials.d.ts +1 -1
  40. package/lib/Credentials.js +2 -1
  41. package/lib/Errors.d.ts +19 -0
  42. package/lib/Errors.js +50 -1
  43. package/lib/Hub.js +1 -0
  44. package/lib/I18n/I18n.d.ts +29 -9
  45. package/lib/I18n/I18n.js +30 -5
  46. package/lib/I18n/index.d.ts +18 -5
  47. package/lib/I18n/index.js +35 -5
  48. package/lib/I18n/types.d.ts +4 -1
  49. package/lib/I18n/types.js +3 -0
  50. package/lib/JS.d.ts +6 -6
  51. package/lib/Logger/ConsoleLogger.d.ts +11 -11
  52. package/lib/OAuthHelper/GoogleOAuth.js +2 -1
  53. package/lib/Platform/detectFramework.js +2 -1
  54. package/lib/Platform/detection/Next.d.ts +1 -1
  55. package/lib/Platform/detection/React.js +1 -0
  56. package/lib/Platform/version.d.ts +1 -1
  57. package/lib/Platform/version.js +1 -1
  58. package/lib/Providers/AWSCloudWatchProvider.d.ts +2 -2
  59. package/lib/Providers/AWSCloudWatchProvider.js +35 -12
  60. package/lib/RNComponents/index.d.ts +1 -1
  61. package/lib/RNComponents/reactnative.js +3 -2
  62. package/lib/ServiceWorker/ServiceWorker.d.ts +4 -4
  63. package/lib/ServiceWorker/ServiceWorker.js +37 -11
  64. package/lib/Signer.d.ts +14 -1
  65. package/lib/StorageHelper/cookieStorage.d.ts +13 -0
  66. package/lib/StorageHelper/cookieStorage.js +167 -0
  67. package/lib/StorageHelper/inMemoryStorage.d.ts +10 -0
  68. package/lib/StorageHelper/inMemoryStorage.js +82 -0
  69. package/lib/StorageHelper/index.d.ts +7 -3
  70. package/lib/StorageHelper/index.js +9 -1
  71. package/lib/StorageHelper/localStorage.d.ts +32 -0
  72. package/lib/StorageHelper/localStorage.js +114 -0
  73. package/lib/StorageHelper/reactnative.d.ts +71 -1
  74. package/lib/StorageHelper/reactnative.js +154 -10
  75. package/lib/StorageHelper/sessionStorage.d.ts +32 -0
  76. package/lib/StorageHelper/sessionStorage.js +114 -0
  77. package/lib/UniversalStorage/index.d.ts +2 -2
  78. package/lib/Util/BackgroundProcessManager.d.ts +2 -2
  79. package/lib/Util/BackgroundProcessManager.js +1 -0
  80. package/lib/Util/DateUtils.d.ts +12 -1
  81. package/lib/Util/Reachability.js +7 -5
  82. package/lib/Util/Reachability.native.d.ts +3 -2
  83. package/lib/Util/StringUtils.js +3 -10
  84. package/lib/Util/errors/AssertError.d.ts +2 -0
  85. package/lib/Util/errors/AssertError.js +11 -0
  86. package/lib/clients/middleware/retry/defaultRetryDecider.d.ts +1 -1
  87. package/lib/clients/middleware/retry/defaultRetryDecider.js +17 -13
  88. package/lib/clients/middleware/retry/isClockSkewError.js +1 -1
  89. package/lib/clients/middleware/retry/middleware.d.ts +1 -1
  90. package/lib/clients/middleware/retry/middleware.js +13 -13
  91. package/lib/clients/middleware/signing/signer/signatureV4/utils/dataHashHelpers.js +1 -1
  92. package/lib/clients/serde/responseInfo.js +1 -1
  93. package/lib/clients/types/aws.d.ts +4 -0
  94. package/lib/clients/types/index.d.ts +1 -1
  95. package/lib/constants.d.ts +7 -0
  96. package/lib/constants.js +9 -1
  97. package/lib/index.d.ts +18 -4
  98. package/lib/index.js +32 -5
  99. package/lib/parseAWSExports.d.ts +1 -1
  100. package/lib/singleton/Auth/index.d.ts +30 -0
  101. package/lib/singleton/Auth/index.js +133 -0
  102. package/lib/singleton/Auth/types.d.ts +95 -0
  103. package/lib/singleton/Auth/types.js +6 -0
  104. package/lib/singleton/Auth/utils/index.d.ts +5 -0
  105. package/lib/singleton/Auth/utils/index.js +52 -0
  106. package/lib/singleton/Storage/types.d.ts +14 -0
  107. package/lib/singleton/Storage/types.js +4 -0
  108. package/lib/singleton/index.d.ts +46 -0
  109. package/lib/singleton/index.js +160 -0
  110. package/lib/singleton/types.d.ts +21 -0
  111. package/lib/singleton/types.js +4 -0
  112. package/lib/tsconfig.tsbuildinfo +1 -1
  113. package/lib/types/types.d.ts +31 -1
  114. package/lib/types/types.js +2 -0
  115. package/lib-esm/Amplify.d.ts +18 -17
  116. package/lib-esm/Amplify.js +9 -0
  117. package/lib-esm/AwsClients/CognitoIdentity/base.d.ts +3 -10
  118. package/lib-esm/AwsClients/CognitoIdentity/getCredentialsForIdentity.d.ts +3 -17
  119. package/lib-esm/AwsClients/CognitoIdentity/getCredentialsForIdentity.js +8 -8
  120. package/lib-esm/AwsClients/CognitoIdentity/getId.d.ts +3 -17
  121. package/lib-esm/AwsClients/Pinpoint/base.d.ts +2 -10
  122. package/lib-esm/AwsClients/Pinpoint/getInAppMessages.d.ts +3 -17
  123. package/lib-esm/AwsClients/Pinpoint/getInAppMessages.js +1 -1
  124. package/lib-esm/AwsClients/Pinpoint/putEvents.d.ts +3 -17
  125. package/lib-esm/AwsClients/Pinpoint/putEvents.js +6 -0
  126. package/lib-esm/AwsClients/Pinpoint/updateEndpoint.d.ts +3 -17
  127. package/lib-esm/AwsClients/Pinpoint/updateEndpoint.js +2 -2
  128. package/lib-esm/Cache/AsyncStorageCache.d.ts +154 -0
  129. package/lib-esm/Cache/AsyncStorageCache.js +737 -0
  130. package/lib-esm/Cache/BrowserStorageCache.d.ts +166 -0
  131. package/lib-esm/Cache/BrowserStorageCache.js +466 -0
  132. package/lib-esm/Cache/InMemoryCache.d.ts +129 -0
  133. package/lib-esm/Cache/InMemoryCache.js +346 -0
  134. package/lib-esm/Cache/StorageCache.d.ts +39 -0
  135. package/lib-esm/Cache/StorageCache.js +118 -0
  136. package/lib-esm/Cache/Utils/CacheList.d.ts +89 -0
  137. package/lib-esm/Cache/Utils/CacheList.js +194 -0
  138. package/lib-esm/Cache/Utils/CacheUtils.d.ts +25 -0
  139. package/lib-esm/Cache/Utils/CacheUtils.js +81 -0
  140. package/lib-esm/Cache/Utils/index.d.ts +2 -0
  141. package/lib-esm/Cache/Utils/index.js +4 -0
  142. package/lib-esm/Cache/reactnative.d.ts +3 -0
  143. package/lib-esm/Cache/reactnative.js +6 -0
  144. package/lib-esm/Cache/types/Cache.d.ts +55 -0
  145. package/lib-esm/Cache/types/Cache.js +3 -0
  146. package/lib-esm/Cache/types/index.d.ts +1 -0
  147. package/lib-esm/Cache/types/index.js +3 -0
  148. package/lib-esm/ClientDevice/android.js +1 -0
  149. package/lib-esm/ClientDevice/ios.d.ts +2 -2
  150. package/lib-esm/ClientDevice/ios.js +1 -0
  151. package/lib-esm/ClientDevice/reactnative.js +1 -0
  152. package/lib-esm/Credentials.d.ts +1 -1
  153. package/lib-esm/Credentials.js +2 -1
  154. package/lib-esm/Errors.d.ts +19 -0
  155. package/lib-esm/Errors.js +49 -0
  156. package/lib-esm/Hub.js +1 -0
  157. package/lib-esm/I18n/I18n.d.ts +29 -9
  158. package/lib-esm/I18n/I18n.js +30 -5
  159. package/lib-esm/I18n/index.d.ts +18 -5
  160. package/lib-esm/I18n/index.js +35 -5
  161. package/lib-esm/I18n/types.d.ts +4 -1
  162. package/lib-esm/I18n/types.js +3 -0
  163. package/lib-esm/JS.d.ts +6 -6
  164. package/lib-esm/Logger/ConsoleLogger.d.ts +11 -11
  165. package/lib-esm/OAuthHelper/GoogleOAuth.js +2 -1
  166. package/lib-esm/Platform/detectFramework.js +2 -1
  167. package/lib-esm/Platform/detection/Next.d.ts +1 -1
  168. package/lib-esm/Platform/detection/React.js +1 -0
  169. package/lib-esm/Platform/version.d.ts +1 -1
  170. package/lib-esm/Platform/version.js +1 -1
  171. package/lib-esm/Providers/AWSCloudWatchProvider.d.ts +2 -2
  172. package/lib-esm/Providers/AWSCloudWatchProvider.js +33 -10
  173. package/lib-esm/RNComponents/index.d.ts +1 -1
  174. package/lib-esm/RNComponents/reactnative.js +1 -0
  175. package/lib-esm/ServiceWorker/ServiceWorker.d.ts +4 -4
  176. package/lib-esm/ServiceWorker/ServiceWorker.js +37 -11
  177. package/lib-esm/Signer.d.ts +14 -1
  178. package/lib-esm/StorageHelper/cookieStorage.d.ts +13 -0
  179. package/lib-esm/StorageHelper/cookieStorage.js +141 -0
  180. package/lib-esm/StorageHelper/inMemoryStorage.d.ts +10 -0
  181. package/lib-esm/StorageHelper/inMemoryStorage.js +79 -0
  182. package/lib-esm/StorageHelper/index.d.ts +7 -3
  183. package/lib-esm/StorageHelper/index.js +4 -0
  184. package/lib-esm/StorageHelper/localStorage.d.ts +32 -0
  185. package/lib-esm/StorageHelper/localStorage.js +111 -0
  186. package/lib-esm/StorageHelper/reactnative.d.ts +71 -1
  187. package/lib-esm/StorageHelper/reactnative.js +153 -9
  188. package/lib-esm/StorageHelper/sessionStorage.d.ts +32 -0
  189. package/lib-esm/StorageHelper/sessionStorage.js +111 -0
  190. package/lib-esm/UniversalStorage/index.d.ts +2 -2
  191. package/lib-esm/Util/BackgroundProcessManager.d.ts +2 -2
  192. package/lib-esm/Util/BackgroundProcessManager.js +1 -0
  193. package/lib-esm/Util/DateUtils.d.ts +12 -1
  194. package/lib-esm/Util/Reachability.js +5 -3
  195. package/lib-esm/Util/Reachability.native.d.ts +3 -2
  196. package/lib-esm/Util/StringUtils.js +3 -10
  197. package/lib-esm/Util/errors/AssertError.d.ts +2 -0
  198. package/lib-esm/Util/errors/AssertError.js +7 -0
  199. package/lib-esm/clients/middleware/retry/defaultRetryDecider.d.ts +1 -1
  200. package/lib-esm/clients/middleware/retry/defaultRetryDecider.js +17 -13
  201. package/lib-esm/clients/middleware/retry/isClockSkewError.js +1 -1
  202. package/lib-esm/clients/middleware/retry/middleware.d.ts +1 -1
  203. package/lib-esm/clients/middleware/retry/middleware.js +13 -13
  204. package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/dataHashHelpers.js +1 -1
  205. package/lib-esm/clients/serde/responseInfo.js +1 -1
  206. package/lib-esm/clients/types/aws.d.ts +4 -0
  207. package/lib-esm/clients/types/index.d.ts +1 -1
  208. package/lib-esm/constants.d.ts +7 -0
  209. package/lib-esm/constants.js +8 -0
  210. package/lib-esm/index.d.ts +18 -4
  211. package/lib-esm/index.js +15 -3
  212. package/lib-esm/parseAWSExports.d.ts +1 -1
  213. package/lib-esm/singleton/Auth/index.d.ts +30 -0
  214. package/lib-esm/singleton/Auth/index.js +129 -0
  215. package/lib-esm/singleton/Auth/types.d.ts +95 -0
  216. package/lib-esm/singleton/Auth/types.js +5 -0
  217. package/lib-esm/singleton/Auth/utils/index.d.ts +5 -0
  218. package/lib-esm/singleton/Auth/utils/index.js +45 -0
  219. package/lib-esm/singleton/Storage/types.d.ts +14 -0
  220. package/lib-esm/singleton/Storage/types.js +3 -0
  221. package/lib-esm/singleton/index.d.ts +46 -0
  222. package/lib-esm/singleton/index.js +156 -0
  223. package/lib-esm/singleton/types.d.ts +21 -0
  224. package/lib-esm/singleton/types.js +3 -0
  225. package/lib-esm/tsconfig.tsbuildinfo +1 -1
  226. package/lib-esm/types/types.d.ts +31 -1
  227. package/lib-esm/types/types.js +2 -0
  228. package/package.json +38 -15
  229. package/src/Amplify.ts +9 -3
  230. package/src/AwsClients/CognitoIdentity/base.ts +2 -1
  231. package/src/AwsClients/CognitoIdentity/getCredentialsForIdentity.ts +13 -6
  232. package/src/AwsClients/Pinpoint/base.ts +6 -2
  233. package/src/AwsClients/Pinpoint/getInAppMessages.ts +1 -1
  234. package/src/AwsClients/Pinpoint/putEvents.ts +6 -0
  235. package/src/AwsClients/Pinpoint/updateEndpoint.ts +2 -2
  236. package/src/Cache/AsyncStorageCache.ts +500 -0
  237. package/src/Cache/BrowserStorageCache.ts +517 -0
  238. package/src/Cache/CHANGELOG.md +1227 -0
  239. package/src/Cache/InMemoryCache.ts +354 -0
  240. package/src/Cache/StorageCache.ts +157 -0
  241. package/src/Cache/Utils/CacheList.ts +198 -0
  242. package/src/Cache/Utils/CacheUtils.ts +92 -0
  243. package/src/Cache/Utils/index.ts +11 -0
  244. package/src/Cache/reactnative.ts +9 -0
  245. package/src/Cache/types/Cache.ts +75 -0
  246. package/src/Cache/types/index.ts +4 -0
  247. package/src/ClientDevice/android.ts +1 -1
  248. package/src/ClientDevice/ios.ts +2 -2
  249. package/src/ClientDevice/reactnative.ts +1 -1
  250. package/src/Credentials.ts +19 -17
  251. package/src/Errors.ts +41 -0
  252. package/src/Hub.ts +1 -0
  253. package/src/I18n/I18n.ts +40 -12
  254. package/src/I18n/index.ts +45 -12
  255. package/src/I18n/types.ts +3 -0
  256. package/src/JS.ts +24 -17
  257. package/src/Logger/ConsoleLogger.ts +10 -10
  258. package/src/OAuthHelper/FacebookOAuth.ts +2 -2
  259. package/src/OAuthHelper/GoogleOAuth.ts +9 -6
  260. package/src/Platform/detectFramework.ts +1 -1
  261. package/src/Platform/detection/React.ts +5 -3
  262. package/src/Platform/version.ts +1 -1
  263. package/src/Providers/AWSCloudWatchProvider.ts +39 -14
  264. package/src/RNComponents/index.ts +1 -1
  265. package/src/RNComponents/reactnative.ts +1 -1
  266. package/src/ServiceWorker/ServiceWorker.ts +58 -18
  267. package/src/Signer.ts +22 -3
  268. package/src/StorageHelper/cookieStorage.ts +99 -0
  269. package/src/StorageHelper/inMemoryStorage.ts +32 -0
  270. package/src/StorageHelper/index.ts +6 -1
  271. package/src/StorageHelper/localStorage.ts +60 -0
  272. package/src/StorageHelper/reactnative.ts +94 -14
  273. package/src/StorageHelper/sessionStorage.ts +60 -0
  274. package/src/Util/BackgroundProcessManager.ts +33 -9
  275. package/src/Util/DateUtils.ts +14 -5
  276. package/src/Util/Reachability.native.ts +3 -2
  277. package/src/Util/Reachability.ts +9 -7
  278. package/src/Util/Retry.ts +2 -1
  279. package/src/Util/StringUtils.ts +3 -10
  280. package/src/Util/errors/AssertError.ts +11 -0
  281. package/src/clients/handlers/fetch.ts +2 -2
  282. package/src/clients/middleware/retry/defaultRetryDecider.ts +12 -6
  283. package/src/clients/middleware/retry/isClockSkewError.ts +1 -1
  284. package/src/clients/middleware/retry/middleware.ts +9 -9
  285. package/src/clients/middleware/signing/middleware.ts +1 -1
  286. package/src/clients/middleware/signing/signer/signatureV4/utils/dataHashHelpers.ts +1 -1
  287. package/src/clients/serde/responseInfo.ts +2 -1
  288. package/src/clients/types/aws.ts +10 -0
  289. package/src/clients/types/index.ts +1 -0
  290. package/src/constants.ts +16 -0
  291. package/src/global.d.ts +11 -0
  292. package/src/index.ts +66 -4
  293. package/src/parseAWSExports.ts +1 -1
  294. package/src/singleton/Auth/index.ts +113 -0
  295. package/src/singleton/Auth/types.ts +129 -0
  296. package/src/singleton/Auth/utils/index.ts +68 -0
  297. package/src/singleton/Storage/types.ts +21 -0
  298. package/src/singleton/index.ts +144 -0
  299. package/src/singleton/types.ts +48 -0
  300. package/src/types/types.ts +38 -1
@@ -62,11 +62,13 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
62
62
  return to.concat(ar || Array.prototype.slice.call(from));
63
63
  };
64
64
  import { CloudWatchLogsClient, CreateLogGroupCommand, CreateLogStreamCommand, DescribeLogGroupsCommand, DescribeLogStreamsCommand, GetLogEventsCommand, PutLogEventsCommand, } from '@aws-sdk/client-cloudwatch-logs';
65
- import { Credentials } from '../..';
65
+ import { Credentials } from '../Credentials';
66
66
  import { ConsoleLogger as Logger } from '../Logger';
67
67
  import { getAmplifyUserAgentObject } from '../Platform';
68
68
  import { parseAWSExports } from '../parseAWSExports';
69
69
  import { AWS_CLOUDWATCH_BASE_BUFFER_SIZE, AWS_CLOUDWATCH_CATEGORY, AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE, AWS_CLOUDWATCH_MAX_EVENT_SIZE, AWS_CLOUDWATCH_PROVIDER_NAME, NO_CREDS_ERROR_STRING, RETRY_ERROR_CODES, } from '../Util/Constants';
70
+ import { asserts } from '../Util/errors/AssertError';
71
+ import { AWS_CLOUD_WATCH_PROVIDER_OPTIONS_EXCEPTION } from '../constants';
70
72
  var logger = new Logger('AWSCloudWatch');
71
73
  var AWSCloudWatchProvider = /** @class */ (function () {
72
74
  function AWSCloudWatchProvider(config) {
@@ -387,6 +389,7 @@ var AWSCloudWatchProvider = /** @class */ (function () {
387
389
  });
388
390
  };
389
391
  AWSCloudWatchProvider.prototype._initCloudWatchLogs = function () {
392
+ assertsAWSClouldWatchOptions(this._config);
390
393
  return new CloudWatchLogsClient({
391
394
  region: this._config.region,
392
395
  credentials: this._config.credentials,
@@ -401,6 +404,7 @@ var AWSCloudWatchProvider = /** @class */ (function () {
401
404
  switch (_a.label) {
402
405
  case 0: return [4 /*yield*/, Credentials.get()
403
406
  .then(function (credentials) {
407
+ assertsAWSClouldWatchOptions(_this._config);
404
408
  if (!credentials)
405
409
  return false;
406
410
  var cred = Credentials.shear(credentials);
@@ -423,12 +427,21 @@ var AWSCloudWatchProvider = /** @class */ (function () {
423
427
  return __generator(this, function (_a) {
424
428
  switch (_a.label) {
425
429
  case 0:
430
+ assertsAWSClouldWatchOptions(this._config);
426
431
  if (this._nextSequenceToken && this._nextSequenceToken.length > 0) {
427
432
  return [2 /*return*/, this._nextSequenceToken];
428
433
  }
429
434
  _a.label = 1;
430
435
  case 1:
431
436
  _a.trys.push([1, 4, , 5]);
437
+ asserts(this._config.logGroupName !== undefined, {
438
+ name: AWS_CLOUD_WATCH_PROVIDER_OPTIONS_EXCEPTION,
439
+ message: ' log group name is undefined',
440
+ });
441
+ asserts(this._config.logStreamName !== undefined, {
442
+ name: AWS_CLOUD_WATCH_PROVIDER_OPTIONS_EXCEPTION,
443
+ message: ' log stream name is undefined',
444
+ });
432
445
  return [4 /*yield*/, this._validateLogGroupExistsAndCreate(this._config.logGroupName)];
433
446
  case 2:
434
447
  _a.sent();
@@ -455,9 +468,12 @@ var AWSCloudWatchProvider = /** @class */ (function () {
455
468
  return __generator(this, function (_a) {
456
469
  switch (_a.label) {
457
470
  case 0:
458
- _a.trys.push([0, 3, , 4]);
459
- return [4 /*yield*/, this._getNextSequenceToken()];
471
+ assertsAWSClouldWatchOptions(this._config);
472
+ _a.label = 1;
460
473
  case 1:
474
+ _a.trys.push([1, 4, , 5]);
475
+ return [4 /*yield*/, this._getNextSequenceToken()];
476
+ case 2:
461
477
  seqToken = _a.sent();
462
478
  logBatch = this._currentLogBatch.length === 0
463
479
  ? this._getBufferedBatchOfLogs()
@@ -470,16 +486,16 @@ var AWSCloudWatchProvider = /** @class */ (function () {
470
486
  };
471
487
  this._dataTracker.eventUploadInProgress = true;
472
488
  return [4 /*yield*/, this._sendLogEvents(putLogsPayload)];
473
- case 2:
489
+ case 3:
474
490
  sendLogEventsResponse = _a.sent();
475
- this._nextSequenceToken = sendLogEventsResponse.nextSequenceToken;
491
+ this._nextSequenceToken = sendLogEventsResponse === null || sendLogEventsResponse === void 0 ? void 0 : sendLogEventsResponse.nextSequenceToken;
476
492
  this._dataTracker.eventUploadInProgress = false;
477
493
  this._currentLogBatch = [];
478
494
  return [2 /*return*/, sendLogEventsResponse];
479
- case 3:
495
+ case 4:
480
496
  err_5 = _a.sent();
481
497
  logger.error("error during _safeUploadLogEvents: ".concat(err_5));
482
- if (RETRY_ERROR_CODES.includes(err_5.name)) {
498
+ if (err_5 instanceof Error && RETRY_ERROR_CODES.includes(err_5.name)) {
483
499
  this._getNewSequenceTokenAndSubmit({
484
500
  logEvents: this._currentLogBatch,
485
501
  logGroupName: this._config.logGroupName,
@@ -490,13 +506,14 @@ var AWSCloudWatchProvider = /** @class */ (function () {
490
506
  this._dataTracker.eventUploadInProgress = false;
491
507
  throw err_5;
492
508
  }
493
- return [3 /*break*/, 4];
494
- case 4: return [2 /*return*/];
509
+ return [3 /*break*/, 5];
510
+ case 5: return [2 /*return*/];
495
511
  }
496
512
  });
497
513
  });
498
514
  };
499
515
  AWSCloudWatchProvider.prototype._getBufferedBatchOfLogs = function () {
516
+ var _a;
500
517
  /**
501
518
  * CloudWatch has restrictions on the size of the log events that get sent up.
502
519
  * We need to track both the size of each event and the total size of the batch
@@ -516,7 +533,7 @@ var AWSCloudWatchProvider = /** @class */ (function () {
516
533
  if (eventSize > AWS_CLOUDWATCH_MAX_EVENT_SIZE) {
517
534
  var errString = "Log entry exceeds maximum size for CloudWatch logs. Log size: ".concat(eventSize, ". Truncating log message.");
518
535
  logger.warn(errString);
519
- currentEvent.message = currentEvent.message.substring(0, eventSize);
536
+ currentEvent.message = (_a = currentEvent.message) === null || _a === void 0 ? void 0 : _a.substring(0, eventSize);
520
537
  }
521
538
  if (totalByteSize + eventSize > AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE)
522
539
  break;
@@ -590,4 +607,10 @@ var AWSCloudWatchProvider = /** @class */ (function () {
590
607
  AWSCloudWatchProvider.CATEGORY = AWS_CLOUDWATCH_CATEGORY;
591
608
  return AWSCloudWatchProvider;
592
609
  }());
610
+ function assertsAWSClouldWatchOptions(options) {
611
+ return asserts(options !== undefined, {
612
+ name: AWS_CLOUD_WATCH_PROVIDER_OPTIONS_EXCEPTION,
613
+ message: 'AWSCloudWatchProviderOptions cannot be undefined',
614
+ });
615
+ }
593
616
  export { AWSCloudWatchProvider };
@@ -1,5 +1,5 @@
1
1
  export declare const Linking: {};
2
2
  export declare const AppState: {
3
- addEventListener: (action: any, handler: any) => any;
3
+ addEventListener: (action: any, handler: any) => undefined;
4
4
  };
5
5
  export declare const AsyncStorage: any;
@@ -1,5 +1,6 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
+ // @ts-ignore
3
4
  import { Linking, AppState } from 'react-native';
4
5
  import AsyncStorage from '@react-native-async-storage/async-storage';
5
6
  export { Linking, AppState, AsyncStorage };
@@ -11,10 +11,10 @@
11
11
  * events based on the service worker lifecycle.
12
12
  */
13
13
  export declare class ServiceWorkerClass {
14
- private _serviceWorker;
15
- private _registration;
16
- private _publicKey;
17
- private _subscription;
14
+ private _serviceWorker?;
15
+ private _registration?;
16
+ private _publicKey?;
17
+ private _subscription?;
18
18
  private _logger;
19
19
  constructor();
20
20
  /**
@@ -15,6 +15,9 @@
15
15
  import { ConsoleLogger as Logger } from '../Logger';
16
16
  import { browserOrNode } from '../JS';
17
17
  import { Amplify } from '../Amplify';
18
+ import { asserts } from '../Util/errors/AssertError';
19
+ import { AmplifyError } from '../Errors';
20
+ import { SERVICE_WORKER_EXCEPTION } from '../constants';
18
21
  /**
19
22
  * Provides a means to registering a service worker in the browser
20
23
  * and communicating with it via postMessage events.
@@ -37,6 +40,10 @@ var ServiceWorkerClass = /** @class */ (function () {
37
40
  * Get the currently active service worker
38
41
  */
39
42
  get: function () {
43
+ asserts(this._serviceWorker !== undefined, {
44
+ name: SERVICE_WORKER_EXCEPTION,
45
+ message: 'Service Worker instance is undefined',
46
+ });
40
47
  return this._serviceWorker;
41
48
  },
42
49
  enumerable: false,
@@ -83,11 +90,18 @@ var ServiceWorkerClass = /** @class */ (function () {
83
90
  })
84
91
  .catch(function (error) {
85
92
  _this._logger.debug("Service Worker Registration Failed ".concat(error));
86
- return reject(error);
93
+ return reject(new AmplifyError({
94
+ name: SERVICE_WORKER_EXCEPTION,
95
+ message: 'Service Worker not available',
96
+ underlyingError: error,
97
+ }));
87
98
  });
88
99
  }
89
100
  else {
90
- return reject(new Error('Service Worker not available'));
101
+ return reject(new AmplifyError({
102
+ name: SERVICE_WORKER_EXCEPTION,
103
+ message: 'Service Worker not available',
104
+ }));
91
105
  }
92
106
  });
93
107
  };
@@ -104,11 +118,17 @@ var ServiceWorkerClass = /** @class */ (function () {
104
118
  */
105
119
  ServiceWorkerClass.prototype.enablePush = function (publicKey) {
106
120
  var _this = this;
107
- if (!this._registration)
108
- throw new Error('Service Worker not registered');
121
+ asserts(this._registration !== undefined, {
122
+ name: SERVICE_WORKER_EXCEPTION,
123
+ message: 'Service Worker registration is undefined',
124
+ });
109
125
  this._publicKey = publicKey;
110
126
  return new Promise(function (resolve, reject) {
111
127
  if (browserOrNode().isBrowser) {
128
+ asserts(_this._registration !== undefined, {
129
+ name: SERVICE_WORKER_EXCEPTION,
130
+ message: 'Service Worker registration is undefined',
131
+ });
112
132
  _this._registration.pushManager.getSubscription().then(function (subscription) {
113
133
  if (subscription) {
114
134
  _this._subscription = subscription;
@@ -117,8 +137,7 @@ var ServiceWorkerClass = /** @class */ (function () {
117
137
  }
118
138
  else {
119
139
  _this._logger.debug("User is NOT subscribed to push");
120
- return _this._registration.pushManager
121
- .subscribe({
140
+ return _this._registration.pushManager.subscribe({
122
141
  userVisibleOnly: true,
123
142
  applicationServerKey: _this._urlB64ToUint8Array(publicKey),
124
143
  })
@@ -134,7 +153,10 @@ var ServiceWorkerClass = /** @class */ (function () {
134
153
  });
135
154
  }
136
155
  else {
137
- return reject(new Error('Service Worker not available'));
156
+ return reject(new AmplifyError({
157
+ name: SERVICE_WORKER_EXCEPTION,
158
+ message: 'Service Worker not available',
159
+ }));
138
160
  }
139
161
  });
140
162
  };
@@ -173,10 +195,11 @@ var ServiceWorkerClass = /** @class */ (function () {
173
195
  **/
174
196
  ServiceWorkerClass.prototype._setupListeners = function () {
175
197
  var _this = this;
176
- this._serviceWorker.addEventListener('statechange', function (event) {
177
- var currentState = _this._serviceWorker.state;
198
+ this.serviceWorker.addEventListener('statechange', function (event) {
199
+ var currentState = _this.serviceWorker.state;
178
200
  _this._logger.debug("ServiceWorker statechange: ".concat(currentState));
179
- if (Amplify.Analytics && typeof Amplify.Analytics.record === 'function') {
201
+ Amplify.Analytics;
202
+ if (isAmplifyWithAnalytics(Amplify)) {
180
203
  Amplify.Analytics.record({
181
204
  name: 'ServiceWorker',
182
205
  attributes: {
@@ -185,10 +208,13 @@ var ServiceWorkerClass = /** @class */ (function () {
185
208
  });
186
209
  }
187
210
  });
188
- this._serviceWorker.addEventListener('message', function (event) {
211
+ this.serviceWorker.addEventListener('message', function (event) {
189
212
  _this._logger.debug("ServiceWorker message event: ".concat(event));
190
213
  });
191
214
  };
192
215
  return ServiceWorkerClass;
193
216
  }());
194
217
  export { ServiceWorkerClass };
218
+ function isAmplifyWithAnalytics(amplify) {
219
+ return amplify.Analytics && typeof amplify.Analytics.record === 'function';
220
+ }
@@ -35,7 +35,20 @@ export declare class Signer {
35
35
  *
36
36
  * @returns {object} Signed HTTP request
37
37
  */
38
- static sign(request: any, accessInfo: any, serviceInfo: any): any;
38
+ static sign(request: {
39
+ headers: any;
40
+ body?: BodyInit;
41
+ data?: any;
42
+ url: string;
43
+ method: string;
44
+ }, accessInfo: {
45
+ access_key: string;
46
+ secret_key: string;
47
+ session_token: string;
48
+ }, serviceInfo: {
49
+ service: string;
50
+ region: string;
51
+ }): any;
39
52
  static signUrl(urlToSign: string, accessInfo: any, serviceInfo?: any, expiration?: number): string;
40
53
  static signUrl(request: any, accessInfo: any, serviceInfo?: any, expiration?: number): string;
41
54
  }
@@ -0,0 +1,13 @@
1
+ import { CookieStorageData, KeyValueStorageInterface, SameSite } from '../types';
2
+ export declare class CookieStorage implements KeyValueStorageInterface {
3
+ domain?: string;
4
+ path: string;
5
+ expires?: number;
6
+ secure?: boolean;
7
+ sameSite?: SameSite;
8
+ constructor(data?: CookieStorageData);
9
+ setItem(key: string, value: string): Promise<void>;
10
+ getItem(key: string): Promise<string>;
11
+ removeItem(key: string): Promise<void>;
12
+ clear(): Promise<void>;
13
+ }
@@ -0,0 +1,141 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
38
+ // SPDX-License-Identifier: Apache-2.0
39
+ // @ts-ignore
40
+ import * as Cookies from 'js-cookie';
41
+ var CookieStorage = /** @class */ (function () {
42
+ function CookieStorage(data) {
43
+ if (data === void 0) { data = {}; }
44
+ if (data.domain) {
45
+ this.domain = data.domain;
46
+ }
47
+ if (data.path) {
48
+ this.path = data.path;
49
+ }
50
+ else {
51
+ this.path = '/';
52
+ }
53
+ if (Object.prototype.hasOwnProperty.call(data, 'expires')) {
54
+ this.expires = data.expires;
55
+ }
56
+ else {
57
+ this.expires = 365;
58
+ }
59
+ if (Object.prototype.hasOwnProperty.call(data, 'secure')) {
60
+ this.secure = data.secure;
61
+ }
62
+ else {
63
+ this.secure = true;
64
+ }
65
+ if (data.hasOwnProperty('sameSite')) {
66
+ if (!data.sameSite ||
67
+ !['strict', 'lax', 'none'].includes(data.sameSite)) {
68
+ throw new Error('The sameSite value of cookieStorage must be "lax", "strict" or "none".');
69
+ }
70
+ if (data.sameSite === 'none' && !this.secure) {
71
+ throw new Error('sameSite = None requires the Secure attribute in latest browser versions.');
72
+ }
73
+ this.sameSite = data.sameSite;
74
+ }
75
+ }
76
+ CookieStorage.prototype.setItem = function (key, value) {
77
+ return __awaiter(this, void 0, void 0, function () {
78
+ var options;
79
+ return __generator(this, function (_a) {
80
+ options = {
81
+ path: this.path,
82
+ expires: this.expires,
83
+ domain: this.domain,
84
+ secure: this.secure,
85
+ };
86
+ if (this.sameSite) {
87
+ options.sameSite = this.sameSite;
88
+ }
89
+ Cookies.set(key, value, options);
90
+ return [2 /*return*/, Cookies.get(key)];
91
+ });
92
+ });
93
+ };
94
+ CookieStorage.prototype.getItem = function (key) {
95
+ return __awaiter(this, void 0, void 0, function () {
96
+ return __generator(this, function (_a) {
97
+ return [2 /*return*/, Cookies.get(key)];
98
+ });
99
+ });
100
+ };
101
+ CookieStorage.prototype.removeItem = function (key) {
102
+ return __awaiter(this, void 0, void 0, function () {
103
+ var options;
104
+ return __generator(this, function (_a) {
105
+ options = {
106
+ path: this.path,
107
+ expires: this.expires,
108
+ domain: this.domain,
109
+ secure: this.secure,
110
+ };
111
+ if (this.sameSite) {
112
+ options.sameSite = this.sameSite;
113
+ }
114
+ Cookies.remove(key, options);
115
+ return [2 /*return*/];
116
+ });
117
+ });
118
+ };
119
+ CookieStorage.prototype.clear = function () {
120
+ return __awaiter(this, void 0, void 0, function () {
121
+ var cookies, numKeys, promiseArray, index;
122
+ return __generator(this, function (_a) {
123
+ switch (_a.label) {
124
+ case 0:
125
+ cookies = Cookies.get();
126
+ numKeys = Object.keys(cookies).length;
127
+ promiseArray = [];
128
+ for (index = 0; index < numKeys; ++index) {
129
+ promiseArray.push(this.removeItem(Object.keys(cookies)[index]));
130
+ }
131
+ return [4 /*yield*/, Promise.all(promiseArray)];
132
+ case 1:
133
+ _a.sent();
134
+ return [2 /*return*/];
135
+ }
136
+ });
137
+ });
138
+ };
139
+ return CookieStorage;
140
+ }());
141
+ export { CookieStorage };
@@ -0,0 +1,10 @@
1
+ import { KeyValueStorageInterface } from '../types';
2
+ declare class MemoryKeyValueStorageClass implements KeyValueStorageInterface {
3
+ myStorage: Record<string, string>;
4
+ setItem(key: string, value: string): Promise<void>;
5
+ getItem(key: string): Promise<string | null>;
6
+ removeItem(key: string): Promise<void>;
7
+ clear(): Promise<void>;
8
+ }
9
+ export declare const MemoryKeyValueStorage: MemoryKeyValueStorageClass;
10
+ export {};
@@ -0,0 +1,79 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
+ return new (P || (P = Promise))(function (resolve, reject) {
6
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10
+ });
11
+ };
12
+ var __generator = (this && this.__generator) || function (thisArg, body) {
13
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
14
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
15
+ function verb(n) { return function (v) { return step([n, v]); }; }
16
+ function step(op) {
17
+ if (f) throw new TypeError("Generator is already executing.");
18
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
19
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
20
+ if (y = 0, t) op = [op[0] & 2, t.value];
21
+ switch (op[0]) {
22
+ case 0: case 1: t = op; break;
23
+ case 4: _.label++; return { value: op[1], done: false };
24
+ case 5: _.label++; y = op[1]; op = [0]; continue;
25
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
26
+ default:
27
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
28
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
29
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
30
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
31
+ if (t[2]) _.ops.pop();
32
+ _.trys.pop(); continue;
33
+ }
34
+ op = body.call(thisArg, _);
35
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
36
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
37
+ }
38
+ };
39
+ var MemoryKeyValueStorageClass = /** @class */ (function () {
40
+ function MemoryKeyValueStorageClass() {
41
+ this.myStorage = {};
42
+ }
43
+ MemoryKeyValueStorageClass.prototype.setItem = function (key, value) {
44
+ return __awaiter(this, void 0, void 0, function () {
45
+ return __generator(this, function (_a) {
46
+ this.myStorage[key] = value;
47
+ return [2 /*return*/];
48
+ });
49
+ });
50
+ };
51
+ MemoryKeyValueStorageClass.prototype.getItem = function (key) {
52
+ return __awaiter(this, void 0, void 0, function () {
53
+ return __generator(this, function (_a) {
54
+ return [2 /*return*/, this.myStorage[key]];
55
+ });
56
+ });
57
+ };
58
+ MemoryKeyValueStorageClass.prototype.removeItem = function (key) {
59
+ return __awaiter(this, void 0, void 0, function () {
60
+ return __generator(this, function (_a) {
61
+ delete this.myStorage[key];
62
+ return [2 /*return*/];
63
+ });
64
+ });
65
+ };
66
+ MemoryKeyValueStorageClass.prototype.clear = function () {
67
+ return __awaiter(this, void 0, void 0, function () {
68
+ var _this = this;
69
+ return __generator(this, function (_a) {
70
+ Object.keys(this.myStorage).forEach(function (key) {
71
+ delete _this.myStorage[key];
72
+ });
73
+ return [2 /*return*/];
74
+ });
75
+ });
76
+ };
77
+ return MemoryKeyValueStorageClass;
78
+ }());
79
+ export var MemoryKeyValueStorage = new MemoryKeyValueStorageClass();
@@ -6,14 +6,14 @@ export declare class MemoryStorage {
6
6
  * @param {object} value - the value
7
7
  * @returns {string} value that was set
8
8
  */
9
- static setItem(key: string, value: any): any;
9
+ static setItem(key: string, value: any): string;
10
10
  /**
11
11
  * This is used to get a specific key from storage
12
12
  * @param {string} key - the key for the item
13
13
  * This is used to clear the storage
14
14
  * @returns {string} the data item
15
15
  */
16
- static getItem(key: string): any;
16
+ static getItem(key: string): string | undefined;
17
17
  /**
18
18
  * This is used to remove an item from storage
19
19
  * @param {string} key - the key being set
@@ -24,7 +24,7 @@ export declare class MemoryStorage {
24
24
  * This is used to clear the storage
25
25
  * @returns {string} nothing
26
26
  */
27
- static clear(): {};
27
+ static clear(): Record<string, string>;
28
28
  }
29
29
  export declare class StorageHelper {
30
30
  private storageWindow;
@@ -39,3 +39,7 @@ export declare class StorageHelper {
39
39
  */
40
40
  getStorage(): any;
41
41
  }
42
+ export { SessionStorage } from './sessionStorage';
43
+ export { LocalStorage } from './localStorage';
44
+ export { MemoryKeyValueStorage } from './inMemoryStorage';
45
+ export { CookieStorage } from './cookieStorage';
@@ -70,3 +70,7 @@ var StorageHelper = /** @class */ (function () {
70
70
  return StorageHelper;
71
71
  }());
72
72
  export { StorageHelper };
73
+ export { SessionStorage } from './sessionStorage';
74
+ export { LocalStorage } from './localStorage';
75
+ export { MemoryKeyValueStorage } from './inMemoryStorage';
76
+ export { CookieStorage } from './cookieStorage';
@@ -0,0 +1,32 @@
1
+ import { KeyValueStorageInterface } from "../types";
2
+ declare class LocalStorageClass implements KeyValueStorageInterface {
3
+ storage?: Storage;
4
+ constructor();
5
+ /**
6
+ * This is used to set a specific item in storage
7
+ * @param {string} key - the key for the item
8
+ * @param {object} value - the value
9
+ * @returns {string} value that was set
10
+ */
11
+ setItem(key: string, value: string): Promise<void>;
12
+ /**
13
+ * This is used to get a specific key from storage
14
+ * @param {string} key - the key for the item
15
+ * This is used to clear the storage
16
+ * @returns {string} the data item
17
+ */
18
+ getItem(key: string): Promise<string | null>;
19
+ /**
20
+ * This is used to remove an item from storage
21
+ * @param {string} key - the key being set
22
+ * @returns {string} value - value that was deleted
23
+ */
24
+ removeItem(key: string): Promise<void>;
25
+ /**
26
+ * This is used to clear the storage
27
+ * @returns {string} nothing
28
+ */
29
+ clear(): Promise<void>;
30
+ }
31
+ export declare const LocalStorage: LocalStorageClass;
32
+ export {};