@aws-amplify/core 6.0.1-console-preview.5f040a2.0 → 6.0.1-console-preview.23dc225.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 (260) hide show
  1. package/lib/Cache/StorageCache.d.ts +14 -31
  2. package/lib/Cache/StorageCache.js +97 -102
  3. package/lib/Cache/StorageCache.native.d.ts +19 -0
  4. package/lib/Cache/StorageCache.native.js +164 -0
  5. package/lib/Cache/{AsyncStorageCache.d.ts → StorageCacheCommon.d.ts} +124 -99
  6. package/lib/Cache/{AsyncStorageCache.js → StorageCacheCommon.js} +497 -432
  7. package/lib/Cache/constants.d.ts +6 -0
  8. package/lib/Cache/constants.js +17 -0
  9. package/lib/Cache/index.d.ts +2 -0
  10. package/lib/Cache/index.js +7 -0
  11. package/lib/Cache/types/cache.d.ts +38 -0
  12. package/lib/Cache/types/index.d.ts +1 -1
  13. package/lib/Cache/types/index.js +1 -1
  14. package/lib/Cache/{Utils → utils}/CacheList.d.ts +1 -1
  15. package/lib/Cache/{Utils → utils}/CacheList.js +2 -1
  16. package/lib/Cache/utils/cacheHelpers.d.ts +14 -0
  17. package/lib/Cache/utils/cacheHelpers.js +51 -0
  18. package/lib/Cache/{Utils → utils}/errorHelpers.d.ts +0 -1
  19. package/lib/Cache/{Utils → utils}/errorHelpers.js +0 -4
  20. package/lib/Cache/utils/index.d.ts +2 -0
  21. package/lib/Cache/utils/index.js +12 -0
  22. package/lib/Hub/index.d.ts +7 -0
  23. package/lib/Hub/index.js +8 -1
  24. package/lib/Platform/customUserAgent.d.ts +16 -0
  25. package/lib/Platform/customUserAgent.js +70 -0
  26. package/lib/Platform/index.js +10 -1
  27. package/lib/Platform/types.d.ts +33 -1
  28. package/lib/Platform/types.js +1 -0
  29. package/lib/Platform/version.d.ts +1 -1
  30. package/lib/Platform/version.js +1 -1
  31. package/lib/Reachability/Reachability.d.ts +1 -0
  32. package/lib/Reachability/Reachability.js +36 -0
  33. package/lib/Signer/Signer.js +3 -2
  34. package/lib/awsClients/cognitoIdentity/base.js +2 -1
  35. package/lib/awsClients/pinpoint/base.js +2 -1
  36. package/lib/awsClients/pinpoint/getInAppMessages.js +2 -1
  37. package/lib/awsClients/pinpoint/putEvents.js +2 -1
  38. package/lib/awsClients/pinpoint/updateEndpoint.js +2 -1
  39. package/lib/clients/middleware/signing/signer/signatureV4/index.d.ts +0 -1
  40. package/lib/clients/middleware/signing/signer/signatureV4/index.js +0 -1
  41. package/lib/clients/middleware/signing/signer/signatureV4/presignUrl.js +2 -1
  42. package/lib/index.d.ts +2 -5
  43. package/lib/index.js +3 -6
  44. package/lib/libraryUtils.d.ts +7 -5
  45. package/lib/libraryUtils.js +11 -6
  46. package/lib/parseAWSExports.js +75 -14
  47. package/lib/providers/pinpoint/apis/flushEvents.d.ts +2 -2
  48. package/lib/providers/pinpoint/apis/record.js +3 -3
  49. package/lib/providers/pinpoint/apis/updateEndpoint.js +6 -6
  50. package/lib/singleton/API/types.d.ts +4 -3
  51. package/lib/singleton/Amplify.d.ts +2 -2
  52. package/lib/singleton/Amplify.js +6 -5
  53. package/lib/singleton/Auth/types.d.ts +28 -1
  54. package/lib/singleton/Cache/types.d.ts +18 -0
  55. package/lib/singleton/Cache/types.js +4 -0
  56. package/lib/singleton/types.d.ts +3 -1
  57. package/lib/storage/DefaultStorage.js +1 -1
  58. package/lib/storage/utils.d.ts +1 -1
  59. package/lib/storage/utils.js +3 -3
  60. package/lib/tsconfig.tsbuildinfo +1 -1
  61. package/lib/utils/amplifyUrl/index.d.ts +13 -0
  62. package/lib/utils/amplifyUrl/index.js +10 -0
  63. package/lib/utils/amplifyUrl/polyfill.d.ts +0 -0
  64. package/lib/utils/amplifyUrl/polyfill.js +4 -0
  65. package/lib/utils/amplifyUrl/polyfill.native.d.ts +1 -0
  66. package/lib/utils/amplifyUuid/index.d.ts +3 -0
  67. package/lib/utils/amplifyUuid/index.js +9 -0
  68. package/lib/utils/amplifyUuid/polyfill.d.ts +0 -0
  69. package/lib/utils/amplifyUuid/polyfill.js +4 -0
  70. package/lib/utils/amplifyUuid/polyfill.native.d.ts +1 -0
  71. package/lib/utils/amplifyUuid/polyfill.native.js +6 -0
  72. package/lib/utils/deepFreeze.d.ts +1 -0
  73. package/lib/utils/deepFreeze.js +38 -0
  74. package/lib/{ClientDevice/android.d.ts → utils/getClientInfo/getClientInfo.android.d.ts} +1 -1
  75. package/lib/{ClientDevice/android.js → utils/getClientInfo/getClientInfo.android.js} +4 -4
  76. package/lib/{ClientDevice/browser.d.ts → utils/getClientInfo/getClientInfo.d.ts} +1 -9
  77. package/lib/{ClientDevice/ios.d.ts → utils/getClientInfo/getClientInfo.ios.d.ts} +1 -1
  78. package/lib/{ClientDevice/ios.js → utils/getClientInfo/getClientInfo.ios.js} +4 -4
  79. package/lib/{ClientDevice/browser.js → utils/getClientInfo/getClientInfo.js} +6 -18
  80. package/lib/utils/getClientInfo/index.d.ts +1 -0
  81. package/lib/utils/getClientInfo/index.js +7 -0
  82. package/lib/utils/index.d.ts +2 -0
  83. package/lib/utils/index.js +5 -1
  84. package/lib-esm/Cache/StorageCache.d.ts +14 -31
  85. package/lib-esm/Cache/StorageCache.js +97 -102
  86. package/lib-esm/Cache/StorageCache.native.d.ts +19 -0
  87. package/lib-esm/Cache/StorageCache.native.js +161 -0
  88. package/lib-esm/Cache/{AsyncStorageCache.d.ts → StorageCacheCommon.d.ts} +124 -99
  89. package/lib-esm/Cache/{AsyncStorageCache.js → StorageCacheCommon.js} +496 -430
  90. package/lib-esm/Cache/constants.d.ts +6 -0
  91. package/lib-esm/Cache/constants.js +14 -0
  92. package/lib-esm/Cache/index.d.ts +2 -0
  93. package/lib-esm/Cache/index.js +4 -0
  94. package/lib-esm/Cache/types/cache.d.ts +38 -0
  95. package/lib-esm/Cache/types/index.d.ts +1 -1
  96. package/lib-esm/Cache/types/index.js +1 -1
  97. package/lib-esm/Cache/{Utils → utils}/CacheList.d.ts +1 -1
  98. package/lib-esm/Cache/{Utils → utils}/CacheList.js +1 -1
  99. package/lib-esm/Cache/utils/cacheHelpers.d.ts +14 -0
  100. package/lib-esm/Cache/utils/cacheHelpers.js +44 -0
  101. package/lib-esm/Cache/{Utils → utils}/errorHelpers.d.ts +0 -1
  102. package/lib-esm/Cache/{Utils → utils}/errorHelpers.js +0 -4
  103. package/lib-esm/Cache/utils/index.d.ts +2 -0
  104. package/lib-esm/Cache/utils/index.js +4 -0
  105. package/lib-esm/Hub/index.d.ts +7 -0
  106. package/lib-esm/Hub/index.js +7 -0
  107. package/lib-esm/Platform/customUserAgent.d.ts +16 -0
  108. package/lib-esm/Platform/customUserAgent.js +65 -0
  109. package/lib-esm/Platform/index.js +10 -1
  110. package/lib-esm/Platform/types.d.ts +33 -1
  111. package/lib-esm/Platform/types.js +1 -0
  112. package/lib-esm/Platform/version.d.ts +1 -1
  113. package/lib-esm/Platform/version.js +1 -1
  114. package/lib-esm/Reachability/Reachability.d.ts +1 -0
  115. package/lib-esm/Reachability/Reachability.js +36 -0
  116. package/lib-esm/Signer/Signer.js +3 -2
  117. package/lib-esm/awsClients/cognitoIdentity/base.js +2 -1
  118. package/lib-esm/awsClients/pinpoint/base.js +2 -1
  119. package/lib-esm/awsClients/pinpoint/getInAppMessages.js +2 -1
  120. package/lib-esm/awsClients/pinpoint/putEvents.js +2 -1
  121. package/lib-esm/awsClients/pinpoint/updateEndpoint.js +2 -1
  122. package/lib-esm/clients/middleware/signing/signer/signatureV4/index.d.ts +0 -1
  123. package/lib-esm/clients/middleware/signing/signer/signatureV4/index.js +0 -1
  124. package/lib-esm/clients/middleware/signing/signer/signatureV4/presignUrl.js +2 -1
  125. package/lib-esm/index.d.ts +2 -5
  126. package/lib-esm/index.js +1 -4
  127. package/lib-esm/libraryUtils.d.ts +7 -5
  128. package/lib-esm/libraryUtils.js +5 -3
  129. package/lib-esm/parseAWSExports.js +75 -14
  130. package/lib-esm/providers/pinpoint/apis/flushEvents.d.ts +2 -2
  131. package/lib-esm/providers/pinpoint/apis/record.js +3 -3
  132. package/lib-esm/providers/pinpoint/apis/updateEndpoint.js +6 -6
  133. package/lib-esm/singleton/API/types.d.ts +4 -3
  134. package/lib-esm/singleton/Amplify.d.ts +2 -2
  135. package/lib-esm/singleton/Amplify.js +6 -5
  136. package/lib-esm/singleton/Auth/types.d.ts +28 -1
  137. package/lib-esm/singleton/Cache/types.d.ts +18 -0
  138. package/lib-esm/singleton/Cache/types.js +3 -0
  139. package/lib-esm/singleton/types.d.ts +3 -1
  140. package/lib-esm/storage/DefaultStorage.js +2 -2
  141. package/lib-esm/storage/utils.d.ts +1 -1
  142. package/lib-esm/storage/utils.js +1 -1
  143. package/lib-esm/tsconfig.tsbuildinfo +1 -1
  144. package/lib-esm/utils/amplifyUrl/index.d.ts +13 -0
  145. package/lib-esm/utils/amplifyUrl/index.js +6 -0
  146. package/lib-esm/utils/amplifyUuid/index.d.ts +3 -0
  147. package/lib-esm/utils/amplifyUuid/index.js +6 -0
  148. package/lib-esm/utils/amplifyUuid/polyfill.native.js +4 -0
  149. package/lib-esm/utils/deepFreeze.d.ts +1 -0
  150. package/lib-esm/utils/deepFreeze.js +34 -0
  151. package/lib-esm/{ClientDevice/android.d.ts → utils/getClientInfo/getClientInfo.android.d.ts} +1 -1
  152. package/lib-esm/{ClientDevice/android.js → utils/getClientInfo/getClientInfo.android.js} +2 -2
  153. package/lib-esm/{ClientDevice/browser.d.ts → utils/getClientInfo/getClientInfo.d.ts} +1 -9
  154. package/lib-esm/{ClientDevice/ios.d.ts → utils/getClientInfo/getClientInfo.ios.d.ts} +1 -1
  155. package/lib-esm/{ClientDevice/ios.js → utils/getClientInfo/getClientInfo.ios.js} +2 -2
  156. package/lib-esm/{ClientDevice/browser.js → utils/getClientInfo/getClientInfo.js} +4 -14
  157. package/lib-esm/utils/getClientInfo/index.d.ts +1 -0
  158. package/lib-esm/utils/getClientInfo/index.js +3 -0
  159. package/lib-esm/utils/index.d.ts +2 -0
  160. package/lib-esm/utils/index.js +2 -0
  161. package/package.json +7 -17
  162. package/src/Cache/StorageCache.native.ts +65 -0
  163. package/src/Cache/StorageCache.ts +61 -158
  164. package/src/Cache/StorageCacheCommon.ts +581 -0
  165. package/src/Cache/constants.ts +18 -0
  166. package/src/Cache/index.ts +6 -0
  167. package/src/Cache/types/cache.ts +51 -0
  168. package/src/Cache/types/index.ts +1 -1
  169. package/src/Cache/{Utils → utils}/CacheList.ts +185 -185
  170. package/src/Cache/utils/cacheHelpers.ts +52 -0
  171. package/src/Cache/{Utils → utils}/errorHelpers.ts +0 -4
  172. package/src/Cache/{Utils → utils}/index.ts +4 -5
  173. package/src/Hub/index.ts +8 -0
  174. package/src/Platform/customUserAgent.ts +75 -0
  175. package/src/Platform/index.ts +14 -1
  176. package/src/Platform/types.ts +45 -1
  177. package/src/Platform/version.ts +1 -1
  178. package/src/Reachability/Reachability.ts +14 -0
  179. package/src/Signer/Signer.ts +3 -2
  180. package/src/awsClients/cognitoIdentity/base.ts +4 -1
  181. package/src/awsClients/pinpoint/base.ts +2 -1
  182. package/src/awsClients/pinpoint/getInAppMessages.ts +2 -1
  183. package/src/awsClients/pinpoint/putEvents.ts +2 -1
  184. package/src/awsClients/pinpoint/updateEndpoint.ts +2 -1
  185. package/src/clients/middleware/signing/signer/signatureV4/index.ts +0 -2
  186. package/src/clients/middleware/signing/signer/signatureV4/presignUrl.ts +2 -1
  187. package/src/index.ts +3 -4
  188. package/src/libraryUtils.ts +17 -10
  189. package/src/parseAWSExports.ts +76 -13
  190. package/src/providers/pinpoint/apis/flushEvents.ts +2 -2
  191. package/src/providers/pinpoint/apis/record.ts +3 -3
  192. package/src/providers/pinpoint/apis/updateEndpoint.ts +6 -6
  193. package/src/singleton/API/types.ts +4 -3
  194. package/src/singleton/Amplify.ts +10 -8
  195. package/src/singleton/Auth/types.ts +50 -1
  196. package/src/singleton/Cache/types.ts +27 -0
  197. package/src/singleton/types.ts +3 -1
  198. package/src/storage/DefaultStorage.ts +2 -2
  199. package/src/storage/utils.ts +1 -1
  200. package/src/utils/amplifyUrl/index.ts +9 -0
  201. package/src/{clients/middleware/signing/signer/signatureV4/polyfills/index.native.ts → utils/amplifyUrl/polyfill.native.ts} +1 -0
  202. package/src/utils/amplifyUuid/index.ts +9 -0
  203. package/src/utils/amplifyUuid/polyfill.native.ts +6 -0
  204. package/src/utils/amplifyUuid/polyfill.ts +4 -0
  205. package/src/utils/deepFreeze.ts +16 -0
  206. package/src/{ClientDevice/android.ts → utils/getClientInfo/getClientInfo.android.ts} +2 -2
  207. package/src/{ClientDevice/ios.ts → utils/getClientInfo/getClientInfo.ios.ts} +3 -3
  208. package/src/{ClientDevice/browser.ts → utils/getClientInfo/getClientInfo.ts} +4 -16
  209. package/src/utils/getClientInfo/index.ts +4 -0
  210. package/src/utils/index.ts +2 -0
  211. package/lib/Cache/BrowserStorageCache.d.ts +0 -166
  212. package/lib/Cache/BrowserStorageCache.js +0 -456
  213. package/lib/Cache/InMemoryCache.d.ts +0 -129
  214. package/lib/Cache/InMemoryCache.js +0 -342
  215. package/lib/Cache/Utils/CacheUtils.d.ts +0 -25
  216. package/lib/Cache/Utils/CacheUtils.js +0 -86
  217. package/lib/Cache/Utils/index.d.ts +0 -2
  218. package/lib/Cache/Utils/index.js +0 -16
  219. package/lib/Cache/reactnative.d.ts +0 -3
  220. package/lib/Cache/reactnative.js +0 -8
  221. package/lib/Cache/types/Cache.d.ts +0 -55
  222. package/lib/ClientDevice/index.d.ts +0 -23
  223. package/lib/ClientDevice/index.js +0 -18
  224. package/lib/ClientDevice/reactnative.d.ts +0 -7
  225. package/lib/ClientDevice/reactnative.js +0 -24
  226. package/lib-esm/Cache/BrowserStorageCache.d.ts +0 -166
  227. package/lib-esm/Cache/BrowserStorageCache.js +0 -453
  228. package/lib-esm/Cache/InMemoryCache.d.ts +0 -129
  229. package/lib-esm/Cache/InMemoryCache.js +0 -339
  230. package/lib-esm/Cache/Utils/CacheUtils.d.ts +0 -25
  231. package/lib-esm/Cache/Utils/CacheUtils.js +0 -79
  232. package/lib-esm/Cache/Utils/index.d.ts +0 -2
  233. package/lib-esm/Cache/Utils/index.js +0 -4
  234. package/lib-esm/Cache/reactnative.d.ts +0 -3
  235. package/lib-esm/Cache/reactnative.js +0 -6
  236. package/lib-esm/Cache/types/Cache.d.ts +0 -55
  237. package/lib-esm/ClientDevice/index.d.ts +0 -23
  238. package/lib-esm/ClientDevice/index.js +0 -15
  239. package/lib-esm/ClientDevice/reactnative.d.ts +0 -7
  240. package/lib-esm/ClientDevice/reactnative.js +0 -21
  241. package/src/Cache/AsyncStorageCache.ts +0 -495
  242. package/src/Cache/BrowserStorageCache.ts +0 -504
  243. package/src/Cache/CHANGELOG.md +0 -1239
  244. package/src/Cache/InMemoryCache.ts +0 -347
  245. package/src/Cache/Utils/CacheUtils.ts +0 -90
  246. package/src/Cache/reactnative.ts +0 -9
  247. package/src/Cache/types/Cache.ts +0 -75
  248. package/src/ClientDevice/index.ts +0 -14
  249. package/src/ClientDevice/reactnative.ts +0 -18
  250. package/lib/Cache/types/{Cache.js → cache.js} +0 -0
  251. package/lib/{clients/middleware/signing/signer/signatureV4/polyfills/index.native.js → utils/amplifyUrl/polyfill.native.js} +1 -1
  252. /package/lib-esm/Cache/types/{Cache.js → cache.js} +0 -0
  253. /package/lib-esm/{clients/middleware/signing/signer/signatureV4/polyfills/index.d.ts → utils/amplifyUrl/polyfill.d.ts} +0 -0
  254. /package/lib-esm/{clients/middleware/signing/signer/signatureV4/polyfills/index.js → utils/amplifyUrl/polyfill.js} +0 -0
  255. /package/lib-esm/{clients/middleware/signing/signer/signatureV4/polyfills/index.native.d.ts → utils/amplifyUrl/polyfill.native.d.ts} +0 -0
  256. /package/lib-esm/{clients/middleware/signing/signer/signatureV4/polyfills/index.native.js → utils/amplifyUrl/polyfill.native.js} +0 -0
  257. /package/{lib/clients/middleware/signing/signer/signatureV4/polyfills/index.d.ts → lib-esm/utils/amplifyUuid/polyfill.d.ts} +0 -0
  258. /package/{lib/clients/middleware/signing/signer/signatureV4/polyfills/index.js → lib-esm/utils/amplifyUuid/polyfill.js} +0 -0
  259. /package/{lib/clients/middleware/signing/signer/signatureV4/polyfills/index.native.d.ts → lib-esm/utils/amplifyUuid/polyfill.native.d.ts} +0 -0
  260. /package/src/{clients/middleware/signing/signer/signatureV4/polyfills/index.ts → utils/amplifyUrl/polyfill.ts} +0 -0
package/lib/index.d.ts CHANGED
@@ -1,14 +1,11 @@
1
1
  export { Hub } from './Hub';
2
2
  export { HubCapsule, HubCallback, HubPayload } from './Hub/types';
3
3
  export { TokenProvider, AuthTokens, FetchAuthSessionOptions, AWSCredentialsAndIdentityIdProvider, AWSCredentialsAndIdentityId, Identity, OAuthConfig, CognitoUserPoolConfig, } from './singleton/Auth/types';
4
- export { AuthConfig, AuthUserPoolConfig, AuthUserPoolAndIdentityPoolConfig, StorageAccessLevel, StorageConfig, GetCredentialsOptions, ResourcesConfig, LibraryOptions, AnalyticsConfig, GeoConfig, } from './singleton/types';
4
+ export { AuthConfig, AuthUserPoolConfig, AuthUserPoolAndIdentityPoolConfig, APIConfig, CacheConfig, StorageAccessLevel, StorageConfig, GetCredentialsOptions, ResourcesConfig, LibraryOptions, AnalyticsConfig, GeoConfig, } from './singleton/types';
5
5
  export { Amplify, fetchAuthSession, AmplifyClass as AmplifyClassV6, clearCredentials, } from './singleton';
6
6
  export { getCredentialsForIdentity, getId, GetCredentialsForIdentityInput, GetCredentialsForIdentityOutput, } from './awsClients/cognitoIdentity';
7
7
  export { UserProfile } from './types';
8
8
  export { CookieStorage, defaultStorage, sessionStorage, sharedInMemoryStorage, } from './storage';
9
9
  export { KeyValueStorageInterface } from './types';
10
- import { BrowserStorageCache } from './Cache/BrowserStorageCache';
11
- export { InMemoryCache } from './Cache/InMemoryCache';
12
- export { BrowserStorageCache };
13
- export { BrowserStorageCache as Cache };
10
+ export { Cache } from './Cache';
14
11
  export { I18n } from './I18n';
package/lib/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.I18n = exports.Cache = exports.BrowserStorageCache = exports.InMemoryCache = exports.sharedInMemoryStorage = exports.sessionStorage = exports.defaultStorage = exports.CookieStorage = exports.getId = exports.getCredentialsForIdentity = exports.clearCredentials = exports.AmplifyClassV6 = exports.fetchAuthSession = exports.Amplify = exports.Hub = void 0;
5
+ exports.I18n = exports.Cache = exports.sharedInMemoryStorage = exports.sessionStorage = exports.defaultStorage = exports.CookieStorage = exports.getId = exports.getCredentialsForIdentity = exports.clearCredentials = exports.AmplifyClassV6 = exports.fetchAuthSession = exports.Amplify = exports.Hub = void 0;
6
6
  /*
7
7
  This file maps top-level exports from `@aws-amplify/core`. These are intended to be potentially customer-facing exports.
8
8
  */
@@ -25,11 +25,8 @@ Object.defineProperty(exports, "defaultStorage", { enumerable: true, get: functi
25
25
  Object.defineProperty(exports, "sessionStorage", { enumerable: true, get: function () { return storage_1.sessionStorage; } });
26
26
  Object.defineProperty(exports, "sharedInMemoryStorage", { enumerable: true, get: function () { return storage_1.sharedInMemoryStorage; } });
27
27
  // Cache exports
28
- var BrowserStorageCache_1 = require("./Cache/BrowserStorageCache");
29
- Object.defineProperty(exports, "BrowserStorageCache", { enumerable: true, get: function () { return BrowserStorageCache_1.BrowserStorageCache; } });
30
- Object.defineProperty(exports, "Cache", { enumerable: true, get: function () { return BrowserStorageCache_1.BrowserStorageCache; } });
31
- var InMemoryCache_1 = require("./Cache/InMemoryCache");
32
- Object.defineProperty(exports, "InMemoryCache", { enumerable: true, get: function () { return InMemoryCache_1.InMemoryCache; } });
28
+ var Cache_1 = require("./Cache");
29
+ Object.defineProperty(exports, "Cache", { enumerable: true, get: function () { return Cache_1.Cache; } });
33
30
  // Internationalization utilities
34
31
  var I18n_1 = require("./I18n");
35
32
  Object.defineProperty(exports, "I18n", { enumerable: true, get: function () { return I18n_1.I18n; } });
@@ -1,15 +1,17 @@
1
1
  export { generateRandomString, isBrowser, isNonRetryableError, isWebWorker, jitteredBackoff, jitteredExponentialRetry, NonRetryableError, retry, urlSafeDecode, urlSafeEncode, } from './utils';
2
2
  export { parseAWSExports } from './parseAWSExports';
3
3
  export { LegacyConfig } from './singleton/types';
4
- export { JWT, StrictUnion, CognitoIdentityPoolConfig, JwtPayload, } from './singleton/Auth/types';
4
+ export { amplifyUuid } from './utils/amplifyUuid';
5
+ export { AmplifyUrl, AmplifyUrlSearchParams } from './utils/amplifyUrl';
5
6
  export { decodeJWT, assertTokenProviderConfig, assertIdentityPoolIdConfig, assertOAuthConfig, } from './singleton/Auth/utils';
6
7
  export { isTokenExpired } from './singleton/Auth';
7
- export { APIAuthMode, DocumentType } from './singleton/API/types';
8
+ export { GraphQLAuthMode, DocumentType } from './singleton/API/types';
8
9
  export { Signer } from './Signer';
10
+ export { JWT, StrictUnion, CognitoIdentityPoolConfig, JwtPayload, AuthStandardAttributeKey, AuthVerifiableAttributeKey, AWSCredentials } from './singleton/Auth/types';
9
11
  export { ConsoleLogger, ConsoleLogger as Logger } from './Logger';
10
- export { ClientDevice } from './ClientDevice';
11
12
  export { Platform, getAmplifyUserAgentObject, getAmplifyUserAgent, } from './Platform';
12
- export { ApiAction, AuthAction, AnalyticsAction, Category, CustomUserAgentDetails, DataStoreAction, Framework, GeoAction, InteractionsAction, InAppMessagingAction, PredictionsAction, PubSubAction, PushNotificationAction, StorageAction, } from './Platform/types';
13
+ export { ApiAction, AuthAction, AnalyticsAction, Category, CustomUserAgentDetails, DataStoreAction, Framework, GeoAction, InteractionsAction, InAppMessagingAction, PredictionsAction, PubSubAction, PushNotificationAction, StorageAction, SetCustomUserAgentInput, } from './Platform/types';
14
+ export { setCustomUserAgent } from './Platform/customUserAgent';
13
15
  export { ServiceWorker } from './ServiceWorker';
14
16
  export { BackgroundProcessManager } from './BackgroundProcessManager';
15
17
  export { Mutex } from './Mutex';
@@ -21,4 +23,4 @@ export { fetchAuthSession } from './singleton/apis/internal/fetchAuthSession';
21
23
  export { AMPLIFY_SYMBOL } from './Hub';
22
24
  export { base64Decoder, base64Encoder } from './utils/convert';
23
25
  export { getCrypto } from './utils/globalHelpers';
24
- export { HubClass } from './Hub';
26
+ export { HubInternal } from './Hub';
@@ -2,8 +2,8 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.base64Encoder = exports.base64Decoder = exports.AMPLIFY_SYMBOL = exports.fetchAuthSession = exports.USER_AGENT_HEADER = exports.INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER = exports.AmplifyErrorCode = exports.createAssertionFunction = exports.PlatformNotSupportedError = exports.AmplifyError = exports.Reachability = exports.Mutex = exports.BackgroundProcessManager = exports.ServiceWorker = exports.StorageAction = exports.PushNotificationAction = exports.PubSubAction = exports.PredictionsAction = exports.InAppMessagingAction = exports.InteractionsAction = exports.GeoAction = exports.Framework = exports.DataStoreAction = exports.Category = exports.AnalyticsAction = exports.AuthAction = exports.ApiAction = exports.getAmplifyUserAgent = exports.getAmplifyUserAgentObject = exports.Platform = exports.ClientDevice = exports.Logger = exports.ConsoleLogger = exports.Signer = exports.isTokenExpired = exports.assertOAuthConfig = exports.assertIdentityPoolIdConfig = exports.assertTokenProviderConfig = exports.decodeJWT = exports.parseAWSExports = exports.urlSafeEncode = exports.urlSafeDecode = exports.retry = exports.NonRetryableError = exports.jitteredExponentialRetry = exports.jitteredBackoff = exports.isWebWorker = exports.isNonRetryableError = exports.isBrowser = exports.generateRandomString = void 0;
6
- exports.HubClass = exports.getCrypto = void 0;
5
+ exports.fetchAuthSession = exports.USER_AGENT_HEADER = exports.INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER = exports.AmplifyErrorCode = exports.createAssertionFunction = exports.PlatformNotSupportedError = exports.AmplifyError = exports.Reachability = exports.Mutex = exports.BackgroundProcessManager = exports.ServiceWorker = exports.setCustomUserAgent = exports.StorageAction = exports.PushNotificationAction = exports.PubSubAction = exports.PredictionsAction = exports.InAppMessagingAction = exports.InteractionsAction = exports.GeoAction = exports.Framework = exports.DataStoreAction = exports.Category = exports.AnalyticsAction = exports.AuthAction = exports.ApiAction = exports.getAmplifyUserAgent = exports.getAmplifyUserAgentObject = exports.Platform = exports.Logger = exports.ConsoleLogger = exports.Signer = exports.isTokenExpired = exports.assertOAuthConfig = exports.assertIdentityPoolIdConfig = exports.assertTokenProviderConfig = exports.decodeJWT = exports.AmplifyUrlSearchParams = exports.AmplifyUrl = exports.amplifyUuid = exports.parseAWSExports = exports.urlSafeEncode = exports.urlSafeDecode = exports.retry = exports.NonRetryableError = exports.jitteredExponentialRetry = exports.jitteredBackoff = exports.isWebWorker = exports.isNonRetryableError = exports.isBrowser = exports.generateRandomString = void 0;
6
+ exports.HubInternal = exports.getCrypto = exports.base64Encoder = exports.base64Decoder = exports.AMPLIFY_SYMBOL = void 0;
7
7
  /*
8
8
  This file maps top-level exports from `@aws-amplify/core/internals/utils`. These are intended to be internal
9
9
  utils for use throughout the library.
@@ -22,6 +22,11 @@ Object.defineProperty(exports, "urlSafeDecode", { enumerable: true, get: functio
22
22
  Object.defineProperty(exports, "urlSafeEncode", { enumerable: true, get: function () { return utils_1.urlSafeEncode; } });
23
23
  var parseAWSExports_1 = require("./parseAWSExports");
24
24
  Object.defineProperty(exports, "parseAWSExports", { enumerable: true, get: function () { return parseAWSExports_1.parseAWSExports; } });
25
+ var amplifyUuid_1 = require("./utils/amplifyUuid");
26
+ Object.defineProperty(exports, "amplifyUuid", { enumerable: true, get: function () { return amplifyUuid_1.amplifyUuid; } });
27
+ var amplifyUrl_1 = require("./utils/amplifyUrl");
28
+ Object.defineProperty(exports, "AmplifyUrl", { enumerable: true, get: function () { return amplifyUrl_1.AmplifyUrl; } });
29
+ Object.defineProperty(exports, "AmplifyUrlSearchParams", { enumerable: true, get: function () { return amplifyUrl_1.AmplifyUrlSearchParams; } });
25
30
  // Auth utilities
26
31
  var utils_2 = require("./singleton/Auth/utils");
27
32
  Object.defineProperty(exports, "decodeJWT", { enumerable: true, get: function () { return utils_2.decodeJWT; } });
@@ -36,9 +41,7 @@ Object.defineProperty(exports, "Signer", { enumerable: true, get: function () {
36
41
  var Logger_1 = require("./Logger");
37
42
  Object.defineProperty(exports, "ConsoleLogger", { enumerable: true, get: function () { return Logger_1.ConsoleLogger; } });
38
43
  Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return Logger_1.ConsoleLogger; } });
39
- // Platform & device utils
40
- var ClientDevice_1 = require("./ClientDevice");
41
- Object.defineProperty(exports, "ClientDevice", { enumerable: true, get: function () { return ClientDevice_1.ClientDevice; } });
44
+ // Platform & user-agent utilities
42
45
  var Platform_1 = require("./Platform");
43
46
  Object.defineProperty(exports, "Platform", { enumerable: true, get: function () { return Platform_1.Platform; } });
44
47
  Object.defineProperty(exports, "getAmplifyUserAgentObject", { enumerable: true, get: function () { return Platform_1.getAmplifyUserAgentObject; } });
@@ -57,6 +60,8 @@ Object.defineProperty(exports, "PredictionsAction", { enumerable: true, get: fun
57
60
  Object.defineProperty(exports, "PubSubAction", { enumerable: true, get: function () { return types_1.PubSubAction; } });
58
61
  Object.defineProperty(exports, "PushNotificationAction", { enumerable: true, get: function () { return types_1.PushNotificationAction; } });
59
62
  Object.defineProperty(exports, "StorageAction", { enumerable: true, get: function () { return types_1.StorageAction; } });
63
+ var customUserAgent_1 = require("./Platform/customUserAgent");
64
+ Object.defineProperty(exports, "setCustomUserAgent", { enumerable: true, get: function () { return customUserAgent_1.setCustomUserAgent; } });
60
65
  // Service worker
61
66
  var ServiceWorker_1 = require("./ServiceWorker");
62
67
  Object.defineProperty(exports, "ServiceWorker", { enumerable: true, get: function () { return ServiceWorker_1.ServiceWorker; } });
@@ -87,4 +92,4 @@ var globalHelpers_1 = require("./utils/globalHelpers");
87
92
  Object.defineProperty(exports, "getCrypto", { enumerable: true, get: function () { return globalHelpers_1.getCrypto; } });
88
93
  // Hub
89
94
  var Hub_2 = require("./Hub");
90
- Object.defineProperty(exports, "HubClass", { enumerable: true, get: function () { return Hub_2.HubClass; } });
95
+ Object.defineProperty(exports, "HubInternal", { enumerable: true, get: function () { return Hub_2.HubInternal; } });
@@ -10,6 +10,31 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
+ var __read = (this && this.__read) || function (o, n) {
14
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
15
+ if (!m) return o;
16
+ var i = m.call(o), r, ar = [], e;
17
+ try {
18
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
19
+ }
20
+ catch (error) { e = { error: error }; }
21
+ finally {
22
+ try {
23
+ if (r && !r.done && (m = i["return"])) m.call(i);
24
+ }
25
+ finally { if (e) throw e.error; }
26
+ }
27
+ return ar;
28
+ };
29
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
30
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
31
+ if (ar || !(i in from)) {
32
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
33
+ ar[i] = from[i];
34
+ }
35
+ }
36
+ return to.concat(ar || Array.prototype.slice.call(from));
37
+ };
13
38
  Object.defineProperty(exports, "__esModule", { value: true });
14
39
  exports.parseAWSExports = void 0;
15
40
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
@@ -33,9 +58,9 @@ var authTypeMapping = {
33
58
  * @returns A {@link ResourcesConfig} object.
34
59
  */
35
60
  var parseAWSExports = function (config) {
36
- var _a;
61
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
37
62
  if (config === void 0) { config = {}; }
38
- var aws_appsync_apiKey = config.aws_appsync_apiKey, aws_appsync_authenticationType = config.aws_appsync_authenticationType, aws_appsync_graphqlEndpoint = config.aws_appsync_graphqlEndpoint, aws_appsync_region = config.aws_appsync_region, aws_cognito_identity_pool_id = config.aws_cognito_identity_pool_id, aws_cognito_sign_up_verification_method = config.aws_cognito_sign_up_verification_method, aws_mandatory_sign_in = config.aws_mandatory_sign_in, aws_mobile_analytics_app_id = config.aws_mobile_analytics_app_id, aws_mobile_analytics_app_region = config.aws_mobile_analytics_app_region, aws_user_files_s3_bucket = config.aws_user_files_s3_bucket, aws_user_files_s3_bucket_region = config.aws_user_files_s3_bucket_region, aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing = config.aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing, aws_user_pools_id = config.aws_user_pools_id, aws_user_pools_web_client_id = config.aws_user_pools_web_client_id, geo = config.geo, oauth = config.oauth, aws_cloud_logic_custom = config.aws_cloud_logic_custom, Notifications = config.Notifications;
63
+ var aws_appsync_apiKey = config.aws_appsync_apiKey, aws_appsync_authenticationType = config.aws_appsync_authenticationType, aws_appsync_graphqlEndpoint = config.aws_appsync_graphqlEndpoint, aws_appsync_region = config.aws_appsync_region, aws_cognito_identity_pool_id = config.aws_cognito_identity_pool_id, aws_cognito_sign_up_verification_method = config.aws_cognito_sign_up_verification_method, aws_cognito_mfa_configuration = config.aws_cognito_mfa_configuration, aws_cognito_mfa_types = config.aws_cognito_mfa_types, aws_cognito_password_protection_settings = config.aws_cognito_password_protection_settings, aws_cognito_verification_mechanisms = config.aws_cognito_verification_mechanisms, aws_cognito_signup_attributes = config.aws_cognito_signup_attributes, aws_cognito_username_attributes = config.aws_cognito_username_attributes, aws_mandatory_sign_in = config.aws_mandatory_sign_in, aws_mobile_analytics_app_id = config.aws_mobile_analytics_app_id, aws_mobile_analytics_app_region = config.aws_mobile_analytics_app_region, aws_user_files_s3_bucket = config.aws_user_files_s3_bucket, aws_user_files_s3_bucket_region = config.aws_user_files_s3_bucket_region, aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing = config.aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing, aws_user_pools_id = config.aws_user_pools_id, aws_user_pools_web_client_id = config.aws_user_pools_web_client_id, geo = config.geo, oauth = config.oauth, aws_cloud_logic_custom = config.aws_cloud_logic_custom, Notifications = config.Notifications;
39
64
  var amplifyConfig = {};
40
65
  // Analytics
41
66
  if (aws_mobile_analytics_app_id) {
@@ -49,7 +74,7 @@ var parseAWSExports = function (config) {
49
74
  // Notifications
50
75
  if (Notifications) {
51
76
  if ((_a = Notifications.InAppMessaging) === null || _a === void 0 ? void 0 : _a.AWSPinpoint) {
52
- var _b = Notifications.InAppMessaging.AWSPinpoint, appId = _b.appId, region = _b.region;
77
+ var _p = Notifications.InAppMessaging.AWSPinpoint, appId = _p.appId, region = _p.region;
53
78
  amplifyConfig.Notifications = {
54
79
  InAppMessaging: {
55
80
  Pinpoint: {
@@ -76,12 +101,50 @@ var parseAWSExports = function (config) {
76
101
  };
77
102
  }
78
103
  // Auth
104
+ var mfaConfig = aws_cognito_mfa_configuration
105
+ ? {
106
+ status: aws_cognito_mfa_configuration &&
107
+ aws_cognito_mfa_configuration.toLowerCase(),
108
+ totpEnabled: (_b = aws_cognito_mfa_types === null || aws_cognito_mfa_types === void 0 ? void 0 : aws_cognito_mfa_types.includes('TOTP')) !== null && _b !== void 0 ? _b : false,
109
+ smsEnabled: (_c = aws_cognito_mfa_types === null || aws_cognito_mfa_types === void 0 ? void 0 : aws_cognito_mfa_types.includes('SMS')) !== null && _c !== void 0 ? _c : false,
110
+ }
111
+ : undefined;
112
+ var passwordFormatConfig = aws_cognito_password_protection_settings
113
+ ? {
114
+ minLength: aws_cognito_password_protection_settings.passwordPolicyMinLength,
115
+ requireLowercase: (_e = (_d = aws_cognito_password_protection_settings.passwordPolicyCharacters) === null || _d === void 0 ? void 0 : _d.includes('REQUIRES_LOWERCASE')) !== null && _e !== void 0 ? _e : false,
116
+ requireUppercase: (_g = (_f = aws_cognito_password_protection_settings.passwordPolicyCharacters) === null || _f === void 0 ? void 0 : _f.includes('REQUIRES_UPPERCASE')) !== null && _g !== void 0 ? _g : false,
117
+ requireNumbers: (_j = (_h = aws_cognito_password_protection_settings.passwordPolicyCharacters) === null || _h === void 0 ? void 0 : _h.includes('REQUIRES_NUMBERS')) !== null && _j !== void 0 ? _j : false,
118
+ requireSpecialCharacters: (_l = (_k = aws_cognito_password_protection_settings.passwordPolicyCharacters) === null || _k === void 0 ? void 0 : _k.includes('REQUIRES_SYMBOLS')) !== null && _l !== void 0 ? _l : false,
119
+ }
120
+ : undefined;
121
+ var mergedUserAttributes = Array.from(new Set(__spreadArray(__spreadArray([], __read((aws_cognito_verification_mechanisms !== null && aws_cognito_verification_mechanisms !== void 0 ? aws_cognito_verification_mechanisms : [])), false), __read((aws_cognito_signup_attributes !== null && aws_cognito_signup_attributes !== void 0 ? aws_cognito_signup_attributes : [])), false)));
122
+ var userAttributesConfig = mergedUserAttributes.map(function (s) {
123
+ var _a;
124
+ return (_a = {},
125
+ _a[s.toLowerCase()] = {
126
+ required: true, // All user attributes generated by the CLI will be required
127
+ },
128
+ _a);
129
+ });
130
+ var loginWithEmailEnabled = (_m = aws_cognito_username_attributes === null || aws_cognito_username_attributes === void 0 ? void 0 : aws_cognito_username_attributes.includes('EMAIL')) !== null && _m !== void 0 ? _m : false;
131
+ var loginWithPhoneEnabled = (_o = aws_cognito_username_attributes === null || aws_cognito_username_attributes === void 0 ? void 0 : aws_cognito_username_attributes.includes('PHONE_NUMBER')) !== null && _o !== void 0 ? _o : false;
79
132
  if (aws_cognito_identity_pool_id || aws_user_pools_id) {
80
133
  amplifyConfig.Auth = {
81
- Cognito: __assign({ identityPoolId: aws_cognito_identity_pool_id, allowGuestAccess: aws_mandatory_sign_in !== 'enable', signUpVerificationMethod: aws_cognito_sign_up_verification_method, userPoolClientId: aws_user_pools_web_client_id, userPoolId: aws_user_pools_id }, (oauth &&
82
- Object.keys(oauth).length > 0 && {
83
- loginWith: getOAuthConfig(oauth),
84
- })),
134
+ Cognito: {
135
+ identityPoolId: aws_cognito_identity_pool_id,
136
+ allowGuestAccess: aws_mandatory_sign_in !== 'enable',
137
+ signUpVerificationMethod: aws_cognito_sign_up_verification_method,
138
+ userAttributes: userAttributesConfig,
139
+ userPoolClientId: aws_user_pools_web_client_id,
140
+ userPoolId: aws_user_pools_id,
141
+ mfa: mfaConfig,
142
+ passwordFormat: passwordFormatConfig,
143
+ loginWith: __assign({ username: loginWithEmailEnabled || loginWithPhoneEnabled ? false : true, email: loginWithEmailEnabled, phone: loginWithPhoneEnabled }, (oauth &&
144
+ Object.keys(oauth).length > 0 && {
145
+ oauth: getOAuthConfig(oauth),
146
+ })),
147
+ },
85
148
  };
86
149
  }
87
150
  // Storage
@@ -120,12 +183,10 @@ var getRedirectUrl = function (redirectStr) {
120
183
  var getOAuthConfig = function (_a) {
121
184
  var domain = _a.domain, scope = _a.scope, redirectSignIn = _a.redirectSignIn, redirectSignOut = _a.redirectSignOut, responseType = _a.responseType;
122
185
  return ({
123
- oauth: {
124
- domain: domain,
125
- scopes: scope,
126
- redirectSignIn: getRedirectUrl(redirectSignIn),
127
- redirectSignOut: getRedirectUrl(redirectSignOut),
128
- responseType: responseType,
129
- },
186
+ domain: domain,
187
+ scopes: scope,
188
+ redirectSignIn: getRedirectUrl(redirectSignIn),
189
+ redirectSignOut: getRedirectUrl(redirectSignOut),
190
+ responseType: responseType,
130
191
  });
131
192
  };
@@ -1,2 +1,2 @@
1
- import { Credentials } from '@aws-sdk/types';
2
- export declare const flushEvents: (appId: string, region: string, credentials: Credentials, identityId?: string, userAgentValue?: string) => void;
1
+ import { AWSCredentials } from '../../../libraryUtils';
2
+ export declare const flushEvents: (appId: string, region: string, credentials: AWSCredentials, identityId?: string, userAgentValue?: string) => void;
@@ -39,7 +39,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
39
39
  };
40
40
  Object.defineProperty(exports, "__esModule", { value: true });
41
41
  exports.record = void 0;
42
- var uuid_1 = require("uuid");
42
+ var amplifyUuid_1 = require("../../../utils/amplifyUuid");
43
43
  var utils_1 = require("../utils");
44
44
  var constants_1 = require("../utils/constants");
45
45
  var updateEndpoint_1 = require("./updateEndpoint");
@@ -58,7 +58,7 @@ var record = function (_a) {
58
58
  switch (_b.label) {
59
59
  case 0:
60
60
  timestampISOString = new Date().toISOString();
61
- eventId = (0, uuid_1.v4)();
61
+ eventId = (0, amplifyUuid_1.amplifyUuid)();
62
62
  return [4 /*yield*/, (0, utils_1.getEndpointId)(appId, category)];
63
63
  case 1:
64
64
  endpointId = _b.sent();
@@ -97,7 +97,7 @@ var record = function (_a) {
97
97
  }
98
98
  // Generate session if required
99
99
  if (!session) {
100
- sessionId = (0, uuid_1.v4)();
100
+ sessionId = (0, amplifyUuid_1.amplifyUuid)();
101
101
  session = {
102
102
  Id: sessionId,
103
103
  StartTimestamp: timestampISOString,
@@ -50,8 +50,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
50
50
  };
51
51
  Object.defineProperty(exports, "__esModule", { value: true });
52
52
  exports.updateEndpoint = void 0;
53
- var uuid_1 = require("uuid");
54
- var ClientDevice_1 = require("../../../ClientDevice");
53
+ var amplifyUuid_1 = require("../../../utils/amplifyUuid");
54
+ var getClientInfo_1 = require("../../../utils/getClientInfo");
55
55
  var pinpoint_1 = require("../../../awsClients/pinpoint");
56
56
  var utils_1 = require("../utils");
57
57
  /**
@@ -66,9 +66,9 @@ var updateEndpoint = function (_a) {
66
66
  case 0: return [4 /*yield*/, (0, utils_1.getEndpointId)(appId, category)];
67
67
  case 1:
68
68
  endpointId = _c.sent();
69
- createdEndpointId = !endpointId ? (0, uuid_1.v4)() : undefined;
69
+ createdEndpointId = !endpointId ? (0, amplifyUuid_1.amplifyUuid)() : undefined;
70
70
  _b = userProfile !== null && userProfile !== void 0 ? userProfile : {}, customProperties = _b.customProperties, demographic = _b.demographic, email = _b.email, location = _b.location, metrics = _b.metrics, name = _b.name, plan = _b.plan;
71
- clientInfo = ClientDevice_1.ClientDevice.clientInfo();
71
+ clientInfo = (0, getClientInfo_1.getClientInfo)();
72
72
  mergedDemographic = __assign({ appVersion: clientInfo.appVersion, make: clientInfo.make, model: clientInfo.model, modelVersion: clientInfo.version, platform: clientInfo.platform }, demographic);
73
73
  shouldAddAttributes = email || customProperties || name || plan;
74
74
  attributes = __assign(__assign(__assign(__assign({}, (email && { email: [email] })), (name && { name: [name] })), (plan && { plan: [plan] })), customProperties);
@@ -76,7 +76,7 @@ var updateEndpoint = function (_a) {
76
76
  ApplicationId: appId,
77
77
  EndpointId: endpointId !== null && endpointId !== void 0 ? endpointId : createdEndpointId,
78
78
  EndpointRequest: {
79
- RequestId: (0, uuid_1.v4)(),
79
+ RequestId: (0, amplifyUuid_1.amplifyUuid)(),
80
80
  EffectiveDate: new Date().toISOString(),
81
81
  ChannelType: channelType,
82
82
  Address: address,
@@ -112,7 +112,7 @@ var updateEndpoint = function (_a) {
112
112
  _c.sent();
113
113
  // if we had to create an endpoint id, we need to now cache it
114
114
  if (!!createdEndpointId) {
115
- (0, utils_1.cacheEndpointId)(appId, category, createdEndpointId);
115
+ return [2 /*return*/, (0, utils_1.cacheEndpointId)(appId, category, createdEndpointId)];
116
116
  }
117
117
  return [2 /*return*/];
118
118
  }
@@ -3,8 +3,9 @@ export type LibraryAPIOptions = {
3
3
  GraphQL?: {
4
4
  headers?: (options: {
5
5
  query: string;
6
- variables: Record<string, DocumentType>;
6
+ variables?: Record<string, DocumentType>;
7
7
  }) => Promise<Headers>;
8
+ withCredentials?: boolean;
8
9
  };
9
10
  REST?: {
10
11
  headers?: (options: {
@@ -37,7 +38,7 @@ type APIGraphQLConfig = {
37
38
  /**
38
39
  * Default auth mode for all the API calls to given service.
39
40
  */
40
- defaultAuthMode: APIAuthMode;
41
+ defaultAuthMode: GraphQLAuthMode;
41
42
  };
42
43
  type APIRestConfig = {
43
44
  /**
@@ -62,7 +63,7 @@ export type APIConfig = {
62
63
  REST?: Record<string, APIRestConfig>;
63
64
  GraphQL?: APIGraphQLConfig;
64
65
  };
65
- export type APIAuthMode = 'apiKey' | 'oidc' | 'userPool' | 'iam' | 'lambda' | 'none';
66
+ export type GraphQLAuthMode = 'apiKey' | 'oidc' | 'userPool' | 'iam' | 'lambda' | 'none';
66
67
  /**
67
68
  * Type representing a plain JavaScript object that can be serialized to JSON.
68
69
  */
@@ -23,9 +23,9 @@ export declare class AmplifyClass {
23
23
  /**
24
24
  * Provides access to the current back-end resource configuration for the Library.
25
25
  *
26
- * @returns Returns the current back-end resource configuration.
26
+ * @returns Returns the immutable back-end resource configuration.
27
27
  */
28
- getConfig(): ResourcesConfig;
28
+ getConfig(): Readonly<ResourcesConfig>;
29
29
  }
30
30
  /**
31
31
  * The `Amplify` utility is used to configure the library.
@@ -28,13 +28,12 @@ exports.Amplify = exports.AmplifyClass = void 0;
28
28
  var Auth_1 = require("./Auth");
29
29
  var Hub_1 = require("../Hub");
30
30
  var parseAWSExports_1 = require("../parseAWSExports");
31
- // TODO(v6): add default AuthTokenStore for each platform
31
+ var utils_1 = require("../utils");
32
32
  var AmplifyClass = /** @class */ (function () {
33
33
  function AmplifyClass() {
34
34
  this.resourcesConfig = {};
35
- this.Auth = new Auth_1.AuthClass();
36
- // TODO(v6): add default providers for getting started
37
35
  this.libraryOptions = {};
36
+ this.Auth = new Auth_1.AuthClass();
38
37
  }
39
38
  /**
40
39
  * Configures Amplify for use with your back-end resources.
@@ -56,6 +55,8 @@ var AmplifyClass = /** @class */ (function () {
56
55
  }
57
56
  this.resourcesConfig = mergeResourceConfig(this.resourcesConfig, resolvedResourceConfig);
58
57
  this.libraryOptions = mergeLibraryOptions(this.libraryOptions, libraryOptions);
58
+ // Make resource config immutable
59
+ this.resourcesConfig = (0, utils_1.deepFreeze)(this.resourcesConfig);
59
60
  this.Auth.configure(this.resourcesConfig.Auth, this.libraryOptions.Auth);
60
61
  Hub_1.Hub.dispatch('core', {
61
62
  event: 'configure',
@@ -65,10 +66,10 @@ var AmplifyClass = /** @class */ (function () {
65
66
  /**
66
67
  * Provides access to the current back-end resource configuration for the Library.
67
68
  *
68
- * @returns Returns the current back-end resource configuration.
69
+ * @returns Returns the immutable back-end resource configuration.
69
70
  */
70
71
  AmplifyClass.prototype.getConfig = function () {
71
- return JSON.parse(JSON.stringify(this.resourcesConfig));
72
+ return this.resourcesConfig;
72
73
  };
73
74
  return AmplifyClass;
74
75
  }());
@@ -50,6 +50,11 @@ export type AuthTokens = {
50
50
  idToken?: JWT;
51
51
  accessToken: JWT;
52
52
  };
53
+ export type AuthStandardAttributeKey = 'address' | 'birthdate' | 'email_verified' | 'family_name' | 'gender' | 'given_name' | 'locale' | 'middle_name' | 'name' | 'nickname' | 'phone_number_verified' | 'picture' | 'preferred_username' | 'profile' | 'sub' | 'updated_at' | 'website' | 'zoneinfo' | AuthVerifiableAttributeKey;
54
+ export type AuthVerifiableAttributeKey = 'email' | 'phone_number';
55
+ export type AuthConfigUserAttributes = Partial<Record<AuthStandardAttributeKey, {
56
+ required: boolean;
57
+ }>>;
53
58
  export type AuthConfig = StrictUnion<AuthIdentityPoolConfig | AuthUserPoolConfig | AuthUserPoolAndIdentityPoolConfig>;
54
59
  type UnionKeys<T> = T extends T ? keyof T : never;
55
60
  type StrictUnionHelper<T, TAll> = T extends any ? T & Partial<Record<Exclude<UnionKeys<TAll>, keyof T>, never>> : never;
@@ -59,6 +64,11 @@ export type AuthIdentityPoolConfig = {
59
64
  userPoolClientId?: never;
60
65
  userPoolId?: never;
61
66
  loginWith?: never;
67
+ signUpVerificationMethod?: never;
68
+ userAttributes?: never;
69
+ mfa?: never;
70
+ passwordFormat?: never;
71
+ endpoint?: never;
62
72
  };
63
73
  };
64
74
  export type CognitoIdentityPoolConfig = {
@@ -77,7 +87,24 @@ export type CognitoUserPoolConfig = {
77
87
  signUpVerificationMethod?: 'code' | 'link';
78
88
  loginWith?: {
79
89
  oauth?: OAuthConfig;
90
+ username?: boolean;
91
+ email?: boolean;
92
+ phone?: boolean;
80
93
  };
94
+ userAttributes?: AuthConfigUserAttributes;
95
+ mfa?: {
96
+ status?: 'on' | 'off' | 'optional';
97
+ totpEnabled?: boolean;
98
+ smsEnabled?: boolean;
99
+ };
100
+ passwordFormat?: {
101
+ minLength?: number;
102
+ requireLowercase?: boolean;
103
+ requireUppercase?: boolean;
104
+ requireNumbers?: boolean;
105
+ requireSpecialCharacters?: boolean;
106
+ };
107
+ endpoint?: string;
81
108
  };
82
109
  export type OAuthConfig = {
83
110
  domain: string;
@@ -119,7 +146,7 @@ export type AWSCredentialsAndIdentityId = {
119
146
  credentials: AWSCredentials;
120
147
  identityId?: string;
121
148
  };
122
- type AWSCredentials = {
149
+ export type AWSCredentials = {
123
150
  accessKeyId: string;
124
151
  secretAccessKey: string;
125
152
  sessionToken?: string;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Cache instance options
3
+ */
4
+ export interface CacheConfig {
5
+ /** Prepend to key to avoid conflicts */
6
+ keyPrefix: string;
7
+ /** Cache capacity, in bytes */
8
+ capacityInBytes: number;
9
+ /** Max size of one item */
10
+ itemMaxSize: number;
11
+ /** Time to live, in milliseconds */
12
+ defaultTTL: number;
13
+ /** Warn when over threshold percentage of capacity, maximum 1 */
14
+ warningThreshold: number;
15
+ /** default priority number put on cached items */
16
+ defaultPriority: number;
17
+ storage?: Storage;
18
+ }
@@ -0,0 +1,4 @@
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 });
@@ -1,6 +1,7 @@
1
1
  import { APIConfig, LibraryAPIOptions } from './API/types';
2
2
  import { AnalyticsConfig } from './Analytics/types';
3
3
  import { AuthConfig, LibraryAuthOptions, AuthUserPoolConfig, AuthIdentityPoolConfig, AuthUserPoolAndIdentityPoolConfig, GetCredentialsOptions, CognitoIdentityPoolConfig } from './Auth/types';
4
+ import { CacheConfig } from './Cache/types';
4
5
  import { GeoConfig } from './Geo/types';
5
6
  import { LibraryStorageOptions, StorageAccessLevel, StorageConfig } from './Storage/types';
6
7
  import { I18nConfig } from '../I18n/types';
@@ -15,6 +16,7 @@ export type ResourcesConfig = {
15
16
  API?: APIConfig;
16
17
  Analytics?: AnalyticsConfig;
17
18
  Auth?: AuthConfig;
19
+ Cache?: CacheConfig;
18
20
  I18n?: I18nConfig;
19
21
  Notifications?: NotificationsConfig;
20
22
  Storage?: StorageConfig;
@@ -26,4 +28,4 @@ export type LibraryOptions = {
26
28
  Storage?: LibraryStorageOptions;
27
29
  ssr?: boolean;
28
30
  };
29
- export { APIConfig, AuthConfig, AuthUserPoolConfig, AuthIdentityPoolConfig, AuthUserPoolAndIdentityPoolConfig, GetCredentialsOptions, StorageAccessLevel, StorageConfig, AnalyticsConfig, CognitoIdentityPoolConfig, GeoConfig, };
31
+ export { APIConfig, AuthConfig, AuthUserPoolConfig, AuthIdentityPoolConfig, AuthUserPoolAndIdentityPoolConfig, CacheConfig, GetCredentialsOptions, StorageAccessLevel, StorageConfig, AnalyticsConfig, CognitoIdentityPoolConfig, GeoConfig, };
@@ -26,7 +26,7 @@ var utils_1 = require("./utils");
26
26
  var DefaultStorage = /** @class */ (function (_super) {
27
27
  __extends(DefaultStorage, _super);
28
28
  function DefaultStorage() {
29
- return _super.call(this, (0, utils_1.getDefaultStorageWithFallback)()) || this;
29
+ return _super.call(this, (0, utils_1.getLocalStorageWithFallback)()) || this;
30
30
  }
31
31
  return DefaultStorage;
32
32
  }(KeyValueStorage_1.KeyValueStorage));
@@ -2,7 +2,7 @@
2
2
  * @internal
3
3
  * @returns Either a reference to window.localStorage or an in-memory storage as fallback
4
4
  */
5
- export declare const getDefaultStorageWithFallback: () => Storage;
5
+ export declare const getLocalStorageWithFallback: () => Storage;
6
6
  /**
7
7
  * @internal
8
8
  * @returns Either a reference to window.sessionStorage or an in-memory storage as fallback
@@ -2,18 +2,18 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.getSessionStorageWithFallback = exports.getDefaultStorageWithFallback = void 0;
5
+ exports.getSessionStorageWithFallback = exports.getLocalStorageWithFallback = void 0;
6
6
  var InMemoryStorage_1 = require("./InMemoryStorage");
7
7
  /**
8
8
  * @internal
9
9
  * @returns Either a reference to window.localStorage or an in-memory storage as fallback
10
10
  */
11
- var getDefaultStorageWithFallback = function () {
11
+ var getLocalStorageWithFallback = function () {
12
12
  return typeof window !== 'undefined' && window.localStorage
13
13
  ? window.localStorage
14
14
  : new InMemoryStorage_1.InMemoryStorage();
15
15
  };
16
- exports.getDefaultStorageWithFallback = getDefaultStorageWithFallback;
16
+ exports.getLocalStorageWithFallback = getLocalStorageWithFallback;
17
17
  /**
18
18
  * @internal
19
19
  * @returns Either a reference to window.sessionStorage or an in-memory storage as fallback