@aws-amplify/core 6.0.17-unstable.e316a2e.0 → 6.0.17

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 (454) hide show
  1. package/dist/cjs/BackgroundProcessManager/BackgroundProcessManager.js +11 -16
  2. package/dist/cjs/BackgroundProcessManager/BackgroundProcessManager.js.map +1 -1
  3. package/dist/cjs/Cache/StorageCacheCommon.js +5 -5
  4. package/dist/cjs/Cache/StorageCacheCommon.js.map +1 -1
  5. package/dist/cjs/Cache/utils/CacheList.js +2 -2
  6. package/dist/cjs/Cache/utils/CacheList.js.map +1 -1
  7. package/dist/cjs/Hub/index.js +2 -2
  8. package/dist/cjs/Hub/index.js.map +1 -1
  9. package/dist/cjs/I18n/I18n.js +8 -13
  10. package/dist/cjs/I18n/I18n.js.map +1 -1
  11. package/dist/cjs/I18n/index.js +4 -4
  12. package/dist/cjs/I18n/index.js.map +1 -1
  13. package/dist/cjs/Logger/ConsoleLogger.js +7 -7
  14. package/dist/cjs/Logger/ConsoleLogger.js.map +1 -1
  15. package/dist/cjs/Mutex/Mutex.js +4 -1
  16. package/dist/cjs/Mutex/Mutex.js.map +1 -1
  17. package/dist/cjs/Platform/detectFramework.js +3 -1
  18. package/dist/cjs/Platform/detectFramework.js.map +1 -1
  19. package/dist/cjs/Platform/detection/Angular.js +2 -4
  20. package/dist/cjs/Platform/detection/Angular.js.map +1 -1
  21. package/dist/cjs/Platform/detection/Expo.js +1 -2
  22. package/dist/cjs/Platform/detection/Expo.js.map +1 -1
  23. package/dist/cjs/Platform/detection/Next.js +3 -2
  24. package/dist/cjs/Platform/detection/Next.js.map +1 -1
  25. package/dist/cjs/Platform/detection/Nuxt.js +3 -4
  26. package/dist/cjs/Platform/detection/Nuxt.js.map +1 -1
  27. package/dist/cjs/Platform/index.js +1 -1
  28. package/dist/cjs/Platform/index.js.map +1 -1
  29. package/dist/cjs/Platform/version.js +1 -1
  30. package/dist/cjs/Platform/version.js.map +1 -1
  31. package/dist/cjs/Reachability/Reachability.js +6 -2
  32. package/dist/cjs/Reachability/Reachability.js.map +1 -1
  33. package/dist/cjs/ServiceWorker/ServiceWorker.js +11 -11
  34. package/dist/cjs/ServiceWorker/ServiceWorker.js.map +1 -1
  35. package/dist/cjs/Signer/DateUtils.js +1 -1
  36. package/dist/cjs/Signer/DateUtils.js.map +1 -1
  37. package/dist/cjs/Signer/Signer.js +3 -3
  38. package/dist/cjs/Signer/Signer.js.map +1 -1
  39. package/dist/cjs/adapterCore/serverContext/serverContext.js +1 -1
  40. package/dist/cjs/adapterCore/serverContext/serverContext.js.map +1 -1
  41. package/dist/cjs/awsClients/cognitoIdentity/base.js +2 -2
  42. package/dist/cjs/awsClients/cognitoIdentity/base.js.map +1 -1
  43. package/dist/cjs/awsClients/cognitoIdentity/getCredentialsForIdentity.js +1 -1
  44. package/dist/cjs/awsClients/cognitoIdentity/getCredentialsForIdentity.js.map +1 -1
  45. package/dist/cjs/awsClients/cognitoIdentity/getId.js +1 -1
  46. package/dist/cjs/awsClients/cognitoIdentity/getId.js.map +1 -1
  47. package/dist/cjs/awsClients/pinpoint/getInAppMessages.js +1 -1
  48. package/dist/cjs/awsClients/pinpoint/getInAppMessages.js.map +1 -1
  49. package/dist/cjs/awsClients/pinpoint/putEvents.js +1 -1
  50. package/dist/cjs/awsClients/pinpoint/putEvents.js.map +1 -1
  51. package/dist/cjs/awsClients/pinpoint/types.js +0 -1
  52. package/dist/cjs/awsClients/pinpoint/types.js.map +1 -1
  53. package/dist/cjs/awsClients/pinpoint/updateEndpoint.js +1 -1
  54. package/dist/cjs/awsClients/pinpoint/updateEndpoint.js.map +1 -1
  55. package/dist/cjs/clients/handlers/authenticated.js +3 -3
  56. package/dist/cjs/clients/handlers/authenticated.js.map +1 -1
  57. package/dist/cjs/clients/handlers/unauthenticated.js +1 -1
  58. package/dist/cjs/clients/handlers/unauthenticated.js.map +1 -1
  59. package/dist/cjs/clients/index.js +4 -4
  60. package/dist/cjs/clients/index.js.map +1 -1
  61. package/dist/cjs/clients/internal/composeServiceApi.js +1 -1
  62. package/dist/cjs/clients/internal/composeServiceApi.js.map +1 -1
  63. package/dist/cjs/clients/internal/composeTransferHandler.js +1 -1
  64. package/dist/cjs/clients/internal/composeTransferHandler.js.map +1 -1
  65. package/dist/cjs/clients/middleware/retry/defaultRetryDecider.js +2 -2
  66. package/dist/cjs/clients/middleware/retry/defaultRetryDecider.js.map +1 -1
  67. package/dist/cjs/clients/middleware/retry/index.js +2 -2
  68. package/dist/cjs/clients/middleware/retry/index.js.map +1 -1
  69. package/dist/cjs/clients/middleware/retry/jitteredBackoff.js +1 -1
  70. package/dist/cjs/clients/middleware/retry/jitteredBackoff.js.map +1 -1
  71. package/dist/cjs/clients/middleware/retry/middleware.js +6 -6
  72. package/dist/cjs/clients/middleware/retry/middleware.js.map +1 -1
  73. package/dist/cjs/clients/middleware/signing/index.js +2 -2
  74. package/dist/cjs/clients/middleware/signing/index.js.map +1 -1
  75. package/dist/cjs/clients/middleware/signing/middleware.js +3 -3
  76. package/dist/cjs/clients/middleware/signing/middleware.js.map +1 -1
  77. package/dist/cjs/clients/middleware/signing/signer/signatureV4/presignUrl.js +1 -2
  78. package/dist/cjs/clients/middleware/signing/signer/signatureV4/presignUrl.js.map +1 -1
  79. package/dist/cjs/clients/middleware/signing/signer/signatureV4/utils/getFormattedDates.js +1 -1
  80. package/dist/cjs/clients/middleware/signing/signer/signatureV4/utils/getFormattedDates.js.map +1 -1
  81. package/dist/cjs/clients/middleware/userAgent/index.js +2 -2
  82. package/dist/cjs/clients/middleware/userAgent/index.js.map +1 -1
  83. package/dist/cjs/clients/middleware/userAgent/middleware.js +3 -3
  84. package/dist/cjs/clients/middleware/userAgent/middleware.js.map +1 -1
  85. package/dist/cjs/clients/serde/json.js +1 -1
  86. package/dist/cjs/clients/serde/json.js.map +1 -1
  87. package/dist/cjs/errors/errorHelpers.js +1 -1
  88. package/dist/cjs/errors/errorHelpers.js.map +1 -1
  89. package/dist/cjs/parseAWSExports.js +1 -1
  90. package/dist/cjs/parseAWSExports.js.map +1 -1
  91. package/dist/cjs/providers/pinpoint/apis/updateEndpoint.js +1 -1
  92. package/dist/cjs/providers/pinpoint/apis/updateEndpoint.js.map +1 -1
  93. package/dist/cjs/providers/pinpoint/utils/PinpointEventBuffer.js +2 -3
  94. package/dist/cjs/providers/pinpoint/utils/PinpointEventBuffer.js.map +1 -1
  95. package/dist/cjs/providers/pinpoint/utils/isAppInForeground.native.js +0 -1
  96. package/dist/cjs/providers/pinpoint/utils/isAppInForeground.native.js.map +1 -1
  97. package/dist/cjs/singleton/Amplify.js +1 -1
  98. package/dist/cjs/singleton/Amplify.js.map +1 -1
  99. package/dist/cjs/singleton/Auth/index.js +2 -6
  100. package/dist/cjs/singleton/Auth/index.js.map +1 -1
  101. package/dist/cjs/singleton/Auth/utils/index.js +4 -4
  102. package/dist/cjs/singleton/Auth/utils/index.js.map +1 -1
  103. package/dist/cjs/singleton/apis/fetchAuthSession.js +1 -1
  104. package/dist/cjs/singleton/apis/fetchAuthSession.js.map +1 -1
  105. package/dist/cjs/storage/CookieStorage.js +8 -4
  106. package/dist/cjs/storage/CookieStorage.js.map +1 -1
  107. package/dist/cjs/storage/CookieStorage.native.js +0 -3
  108. package/dist/cjs/storage/CookieStorage.native.js.map +1 -1
  109. package/dist/cjs/utils/WordArray.js +2 -2
  110. package/dist/cjs/utils/WordArray.js.map +1 -1
  111. package/dist/cjs/utils/deDupeAsyncFunction.js +8 -8
  112. package/dist/cjs/utils/deDupeAsyncFunction.js.map +1 -1
  113. package/dist/cjs/utils/getClientInfo/getClientInfo.android.js +2 -3
  114. package/dist/cjs/utils/getClientInfo/getClientInfo.android.js.map +1 -1
  115. package/dist/cjs/utils/getClientInfo/getClientInfo.ios.js +2 -3
  116. package/dist/cjs/utils/getClientInfo/getClientInfo.ios.js.map +1 -1
  117. package/dist/cjs/utils/queuedStorage/createQueuedStorage.native.js +2 -2
  118. package/dist/cjs/utils/queuedStorage/createQueuedStorage.native.js.map +1 -1
  119. package/dist/cjs/utils/retry/NonRetryableError.js +2 -2
  120. package/dist/cjs/utils/retry/NonRetryableError.js.map +1 -1
  121. package/dist/cjs/utils/retry/retry.js +15 -6
  122. package/dist/cjs/utils/retry/retry.js.map +1 -1
  123. package/dist/esm/BackgroundProcessManager/BackgroundProcessManager.d.ts +2 -8
  124. package/dist/esm/BackgroundProcessManager/BackgroundProcessManager.mjs +11 -16
  125. package/dist/esm/BackgroundProcessManager/BackgroundProcessManager.mjs.map +1 -1
  126. package/dist/esm/BackgroundProcessManager/types.d.ts +3 -3
  127. package/dist/esm/Cache/StorageCacheCommon.mjs +5 -5
  128. package/dist/esm/Cache/StorageCacheCommon.mjs.map +1 -1
  129. package/dist/esm/Cache/types/cache.d.ts +1 -1
  130. package/dist/esm/Cache/utils/CacheList.mjs +2 -2
  131. package/dist/esm/Cache/utils/CacheList.mjs.map +1 -1
  132. package/dist/esm/Hub/index.d.ts +4 -4
  133. package/dist/esm/Hub/index.mjs +2 -2
  134. package/dist/esm/Hub/index.mjs.map +1 -1
  135. package/dist/esm/Hub/types/AuthTypes.d.ts +11 -11
  136. package/dist/esm/Hub/types/HubTypes.d.ts +8 -8
  137. package/dist/esm/I18n/I18n.d.ts +0 -6
  138. package/dist/esm/I18n/I18n.mjs +8 -13
  139. package/dist/esm/I18n/I18n.mjs.map +1 -1
  140. package/dist/esm/I18n/index.mjs +4 -4
  141. package/dist/esm/I18n/index.mjs.map +1 -1
  142. package/dist/esm/Logger/ConsoleLogger.d.ts +1 -1
  143. package/dist/esm/Logger/ConsoleLogger.mjs +7 -7
  144. package/dist/esm/Logger/ConsoleLogger.mjs.map +1 -1
  145. package/dist/esm/Mutex/Mutex.mjs +4 -1
  146. package/dist/esm/Mutex/Mutex.mjs.map +1 -1
  147. package/dist/esm/Mutex/types.d.ts +2 -6
  148. package/dist/esm/Platform/detectFramework.mjs +3 -1
  149. package/dist/esm/Platform/detectFramework.mjs.map +1 -1
  150. package/dist/esm/Platform/detection/Angular.mjs +2 -4
  151. package/dist/esm/Platform/detection/Angular.mjs.map +1 -1
  152. package/dist/esm/Platform/detection/Expo.mjs +1 -2
  153. package/dist/esm/Platform/detection/Expo.mjs.map +1 -1
  154. package/dist/esm/Platform/detection/Next.mjs +3 -2
  155. package/dist/esm/Platform/detection/Next.mjs.map +1 -1
  156. package/dist/esm/Platform/detection/Nuxt.mjs +3 -4
  157. package/dist/esm/Platform/detection/Nuxt.mjs.map +1 -1
  158. package/dist/esm/Platform/detection/index.mjs.map +1 -1
  159. package/dist/esm/Platform/index.d.ts +2 -2
  160. package/dist/esm/Platform/index.mjs +1 -1
  161. package/dist/esm/Platform/index.mjs.map +1 -1
  162. package/dist/esm/Platform/types.d.ts +12 -12
  163. package/dist/esm/Platform/version.d.ts +1 -1
  164. package/dist/esm/Platform/version.mjs +1 -1
  165. package/dist/esm/Platform/version.mjs.map +1 -1
  166. package/dist/esm/Reachability/Reachability.mjs +6 -2
  167. package/dist/esm/Reachability/Reachability.mjs.map +1 -1
  168. package/dist/esm/Reachability/types.d.ts +2 -2
  169. package/dist/esm/ServiceWorker/ServiceWorker.d.ts +0 -1
  170. package/dist/esm/ServiceWorker/ServiceWorker.mjs +11 -11
  171. package/dist/esm/ServiceWorker/ServiceWorker.mjs.map +1 -1
  172. package/dist/esm/Signer/DateUtils.d.ts +9 -9
  173. package/dist/esm/Signer/DateUtils.mjs +1 -1
  174. package/dist/esm/Signer/DateUtils.mjs.map +1 -1
  175. package/dist/esm/Signer/Signer.mjs +3 -3
  176. package/dist/esm/Signer/Signer.mjs.map +1 -1
  177. package/dist/esm/adapterCore/serverContext/serverContext.d.ts +1 -1
  178. package/dist/esm/adapterCore/serverContext/serverContext.mjs +1 -1
  179. package/dist/esm/adapterCore/serverContext/serverContext.mjs.map +1 -1
  180. package/dist/esm/adapterCore/serverContext/types/amplifyServer.d.ts +7 -9
  181. package/dist/esm/awsClients/cognitoIdentity/base.d.ts +1 -1
  182. package/dist/esm/awsClients/cognitoIdentity/base.mjs +2 -2
  183. package/dist/esm/awsClients/cognitoIdentity/base.mjs.map +1 -1
  184. package/dist/esm/awsClients/cognitoIdentity/getCredentialsForIdentity.d.ts +2 -6
  185. package/dist/esm/awsClients/cognitoIdentity/getCredentialsForIdentity.mjs +1 -1
  186. package/dist/esm/awsClients/cognitoIdentity/getCredentialsForIdentity.mjs.map +1 -1
  187. package/dist/esm/awsClients/cognitoIdentity/getId.d.ts +2 -6
  188. package/dist/esm/awsClients/cognitoIdentity/getId.mjs +1 -1
  189. package/dist/esm/awsClients/cognitoIdentity/getId.mjs.map +1 -1
  190. package/dist/esm/awsClients/cognitoIdentity/types.d.ts +2 -4
  191. package/dist/esm/awsClients/pinpoint/base.mjs.map +1 -1
  192. package/dist/esm/awsClients/pinpoint/getInAppMessages.d.ts +1 -1
  193. package/dist/esm/awsClients/pinpoint/getInAppMessages.mjs +1 -1
  194. package/dist/esm/awsClients/pinpoint/getInAppMessages.mjs.map +1 -1
  195. package/dist/esm/awsClients/pinpoint/putEvents.d.ts +1 -1
  196. package/dist/esm/awsClients/pinpoint/putEvents.mjs +1 -1
  197. package/dist/esm/awsClients/pinpoint/putEvents.mjs.map +1 -1
  198. package/dist/esm/awsClients/pinpoint/types.d.ts +3 -6
  199. package/dist/esm/awsClients/pinpoint/updateEndpoint.d.ts +1 -1
  200. package/dist/esm/awsClients/pinpoint/updateEndpoint.mjs +1 -1
  201. package/dist/esm/awsClients/pinpoint/updateEndpoint.mjs.map +1 -1
  202. package/dist/esm/clients/handlers/authenticated.mjs +6 -6
  203. package/dist/esm/clients/handlers/authenticated.mjs.map +1 -1
  204. package/dist/esm/clients/handlers/unauthenticated.mjs +3 -3
  205. package/dist/esm/clients/handlers/unauthenticated.mjs.map +1 -1
  206. package/dist/esm/clients/index.d.ts +3 -3
  207. package/dist/esm/clients/index.mjs +3 -3
  208. package/dist/esm/clients/internal/composeServiceApi.d.ts +2 -2
  209. package/dist/esm/clients/internal/composeServiceApi.mjs +1 -1
  210. package/dist/esm/clients/internal/composeServiceApi.mjs.map +1 -1
  211. package/dist/esm/clients/internal/composeTransferHandler.d.ts +2 -2
  212. package/dist/esm/clients/internal/composeTransferHandler.mjs +1 -1
  213. package/dist/esm/clients/internal/composeTransferHandler.mjs.map +1 -1
  214. package/dist/esm/clients/middleware/retry/defaultRetryDecider.d.ts +1 -1
  215. package/dist/esm/clients/middleware/retry/defaultRetryDecider.mjs +2 -2
  216. package/dist/esm/clients/middleware/retry/defaultRetryDecider.mjs.map +1 -1
  217. package/dist/esm/clients/middleware/retry/index.d.ts +1 -1
  218. package/dist/esm/clients/middleware/retry/index.mjs +1 -1
  219. package/dist/esm/clients/middleware/retry/jitteredBackoff.mjs.map +1 -1
  220. package/dist/esm/clients/middleware/retry/middleware.d.ts +3 -3
  221. package/dist/esm/clients/middleware/retry/middleware.mjs +5 -5
  222. package/dist/esm/clients/middleware/retry/middleware.mjs.map +1 -1
  223. package/dist/esm/clients/middleware/signing/index.d.ts +1 -1
  224. package/dist/esm/clients/middleware/signing/index.mjs +1 -1
  225. package/dist/esm/clients/middleware/signing/middleware.d.ts +1 -1
  226. package/dist/esm/clients/middleware/signing/middleware.mjs +2 -2
  227. package/dist/esm/clients/middleware/signing/middleware.mjs.map +1 -1
  228. package/dist/esm/clients/middleware/signing/signer/signatureV4/presignUrl.d.ts +1 -1
  229. package/dist/esm/clients/middleware/signing/signer/signatureV4/presignUrl.mjs +1 -2
  230. package/dist/esm/clients/middleware/signing/signer/signatureV4/presignUrl.mjs.map +1 -1
  231. package/dist/esm/clients/middleware/signing/signer/signatureV4/utils/getFormattedDates.mjs +1 -1
  232. package/dist/esm/clients/middleware/signing/signer/signatureV4/utils/getFormattedDates.mjs.map +1 -1
  233. package/dist/esm/clients/middleware/userAgent/index.d.ts +1 -1
  234. package/dist/esm/clients/middleware/userAgent/index.mjs +1 -1
  235. package/dist/esm/clients/middleware/userAgent/middleware.d.ts +1 -1
  236. package/dist/esm/clients/middleware/userAgent/middleware.mjs +2 -2
  237. package/dist/esm/clients/middleware/userAgent/middleware.mjs.map +1 -1
  238. package/dist/esm/clients/serde/json.mjs +1 -1
  239. package/dist/esm/clients/serde/json.mjs.map +1 -1
  240. package/dist/esm/clients/types/aws.d.ts +3 -3
  241. package/dist/esm/clients/types/core.d.ts +3 -5
  242. package/dist/esm/errors/APIError.d.ts +1 -1
  243. package/dist/esm/errors/errorHelpers.mjs +1 -1
  244. package/dist/esm/errors/errorHelpers.mjs.map +1 -1
  245. package/dist/esm/parseAWSExports.mjs +1 -1
  246. package/dist/esm/parseAWSExports.mjs.map +1 -1
  247. package/dist/esm/providers/kinesis/types/kinesis.d.ts +2 -2
  248. package/dist/esm/providers/kinesis-firehose/types/kinesis-firehose.d.ts +2 -2
  249. package/dist/esm/providers/personalize/types/personalize.d.ts +2 -2
  250. package/dist/esm/providers/pinpoint/apis/updateEndpoint.mjs +1 -1
  251. package/dist/esm/providers/pinpoint/apis/updateEndpoint.mjs.map +1 -1
  252. package/dist/esm/providers/pinpoint/types/buffer.d.ts +6 -8
  253. package/dist/esm/providers/pinpoint/types/pinpoint.d.ts +10 -10
  254. package/dist/esm/providers/pinpoint/utils/PinpointEventBuffer.d.ts +1 -1
  255. package/dist/esm/providers/pinpoint/utils/PinpointEventBuffer.mjs +2 -3
  256. package/dist/esm/providers/pinpoint/utils/PinpointEventBuffer.mjs.map +1 -1
  257. package/dist/esm/providers/pinpoint/utils/getEventBuffer.d.ts +1 -1
  258. package/dist/esm/providers/pinpoint/utils/isAppInForeground.native.mjs +0 -1
  259. package/dist/esm/providers/pinpoint/utils/isAppInForeground.native.mjs.map +1 -1
  260. package/dist/esm/singleton/API/types.d.ts +35 -37
  261. package/dist/esm/singleton/Amplify.d.ts +1 -1
  262. package/dist/esm/singleton/Amplify.mjs +1 -1
  263. package/dist/esm/singleton/Amplify.mjs.map +1 -1
  264. package/dist/esm/singleton/Auth/index.d.ts +0 -1
  265. package/dist/esm/singleton/Auth/index.mjs +2 -6
  266. package/dist/esm/singleton/Auth/index.mjs.map +1 -1
  267. package/dist/esm/singleton/Auth/types.d.ts +53 -52
  268. package/dist/esm/singleton/Auth/utils/index.d.ts +1 -1
  269. package/dist/esm/singleton/Auth/utils/index.mjs +4 -4
  270. package/dist/esm/singleton/Auth/utils/index.mjs.map +1 -1
  271. package/dist/esm/singleton/Geo/types.d.ts +3 -3
  272. package/dist/esm/singleton/Interactions/types.d.ts +4 -4
  273. package/dist/esm/singleton/Notifications/types.d.ts +5 -5
  274. package/dist/esm/singleton/Predictions/types.d.ts +28 -28
  275. package/dist/esm/singleton/Storage/types.d.ts +2 -2
  276. package/dist/esm/singleton/apis/fetchAuthSession.mjs +1 -1
  277. package/dist/esm/singleton/apis/fetchAuthSession.mjs.map +1 -1
  278. package/dist/esm/singleton/types.d.ts +8 -8
  279. package/dist/esm/storage/CookieStorage.mjs +8 -4
  280. package/dist/esm/storage/CookieStorage.mjs.map +1 -1
  281. package/dist/esm/storage/CookieStorage.native.d.ts +0 -1
  282. package/dist/esm/storage/CookieStorage.native.mjs +0 -3
  283. package/dist/esm/storage/CookieStorage.native.mjs.map +1 -1
  284. package/dist/esm/types/core.d.ts +2 -2
  285. package/dist/esm/types/errors.d.ts +4 -4
  286. package/dist/esm/types/storage.d.ts +2 -2
  287. package/dist/esm/utils/WordArray.mjs +2 -2
  288. package/dist/esm/utils/WordArray.mjs.map +1 -1
  289. package/dist/esm/utils/deDupeAsyncFunction.d.ts +1 -5
  290. package/dist/esm/utils/deDupeAsyncFunction.mjs +8 -8
  291. package/dist/esm/utils/deDupeAsyncFunction.mjs.map +1 -1
  292. package/dist/esm/utils/getClientInfo/getClientInfo.android.mjs +0 -1
  293. package/dist/esm/utils/getClientInfo/getClientInfo.android.mjs.map +1 -1
  294. package/dist/esm/utils/getClientInfo/getClientInfo.ios.mjs +0 -1
  295. package/dist/esm/utils/getClientInfo/getClientInfo.ios.mjs.map +1 -1
  296. package/dist/esm/utils/globalHelpers/index.native.mjs.map +1 -1
  297. package/dist/esm/utils/queuedStorage/createQueuedStorage.native.mjs +2 -2
  298. package/dist/esm/utils/queuedStorage/createQueuedStorage.native.mjs.map +1 -1
  299. package/dist/esm/utils/retry/NonRetryableError.d.ts +0 -1
  300. package/dist/esm/utils/retry/NonRetryableError.mjs +2 -2
  301. package/dist/esm/utils/retry/NonRetryableError.mjs.map +1 -1
  302. package/dist/esm/utils/retry/retry.mjs +15 -6
  303. package/dist/esm/utils/retry/retry.mjs.map +1 -1
  304. package/dist/esm/utils/sessionListener/SessionListener.d.ts +1 -1
  305. package/dist/esm/utils/sessionListener/SessionListener.native.d.ts +1 -1
  306. package/dist/esm/utils/sessionListener/types.d.ts +2 -2
  307. package/package.json +5 -4
  308. package/src/BackgroundProcessManager/BackgroundProcessManager.ts +29 -34
  309. package/src/BackgroundProcessManager/types.ts +3 -3
  310. package/src/Cache/StorageCache.native.ts +5 -0
  311. package/src/Cache/StorageCache.ts +2 -0
  312. package/src/Cache/StorageCacheCommon.ts +49 -29
  313. package/src/Cache/types/cache.ts +2 -1
  314. package/src/Cache/utils/CacheList.ts +6 -3
  315. package/src/Cache/utils/cacheHelpers.ts +2 -1
  316. package/src/Hub/index.ts +15 -15
  317. package/src/Hub/types/AuthTypes.ts +11 -11
  318. package/src/Hub/types/HubTypes.ts +11 -8
  319. package/src/I18n/I18n.ts +10 -16
  320. package/src/I18n/index.ts +7 -7
  321. package/src/Logger/ConsoleLogger.ts +11 -9
  322. package/src/Logger/types.ts +1 -1
  323. package/src/Mutex/Mutex.ts +8 -4
  324. package/src/Mutex/types.ts +3 -7
  325. package/src/Platform/customUserAgent.ts +3 -3
  326. package/src/Platform/detectFramework.ts +4 -1
  327. package/src/Platform/detection/Angular.ts +4 -4
  328. package/src/Platform/detection/Expo.ts +1 -2
  329. package/src/Platform/detection/Next.ts +5 -2
  330. package/src/Platform/detection/Nuxt.ts +5 -4
  331. package/src/Platform/detection/index.ts +9 -9
  332. package/src/Platform/index.ts +4 -4
  333. package/src/Platform/types.ts +12 -12
  334. package/src/Platform/version.ts +1 -1
  335. package/src/Reachability/Reachability.native.ts +6 -3
  336. package/src/Reachability/Reachability.ts +12 -6
  337. package/src/Reachability/types.ts +2 -2
  338. package/src/ServiceWorker/ServiceWorker.ts +28 -23
  339. package/src/Signer/DateUtils.ts +16 -16
  340. package/src/Signer/Signer.ts +19 -13
  341. package/src/adapterCore/serverContext/serverContext.ts +6 -5
  342. package/src/adapterCore/serverContext/serverContextRegistry.ts +2 -1
  343. package/src/adapterCore/serverContext/types/amplifyServer.ts +15 -17
  344. package/src/adapterCore/serverContext/types/cookieStorage.ts +1 -1
  345. package/src/awsClients/cognitoIdentity/base.ts +16 -12
  346. package/src/awsClients/cognitoIdentity/getCredentialsForIdentity.ts +13 -10
  347. package/src/awsClients/cognitoIdentity/getId.ts +12 -9
  348. package/src/awsClients/cognitoIdentity/types.ts +3 -3
  349. package/src/awsClients/pinpoint/base.ts +1 -1
  350. package/src/awsClients/pinpoint/getInAppMessages.ts +8 -5
  351. package/src/awsClients/pinpoint/putEvents.ts +8 -5
  352. package/src/awsClients/pinpoint/types.ts +3 -4
  353. package/src/awsClients/pinpoint/updateEndpoint.ts +8 -5
  354. package/src/clients/endpoints/getDnsSuffix.ts +1 -0
  355. package/src/clients/handlers/authenticated.ts +14 -7
  356. package/src/clients/handlers/fetch.ts +1 -1
  357. package/src/clients/handlers/unauthenticated.ts +8 -4
  358. package/src/clients/index.ts +6 -3
  359. package/src/clients/internal/composeServiceApi.ts +8 -7
  360. package/src/clients/internal/composeTransferHandler.ts +16 -15
  361. package/src/clients/middleware/retry/defaultRetryDecider.ts +5 -3
  362. package/src/clients/middleware/retry/index.ts +1 -1
  363. package/src/clients/middleware/retry/jitteredBackoff.ts +3 -1
  364. package/src/clients/middleware/retry/middleware.ts +12 -9
  365. package/src/clients/middleware/signing/index.ts +1 -1
  366. package/src/clients/middleware/signing/middleware.ts +5 -2
  367. package/src/clients/middleware/signing/signer/signatureV4/presignUrl.ts +4 -4
  368. package/src/clients/middleware/signing/signer/signatureV4/signRequest.ts +2 -1
  369. package/src/clients/middleware/signing/signer/signatureV4/utils/dataHashHelpers.ts +4 -2
  370. package/src/clients/middleware/signing/signer/signatureV4/utils/getCanonicalQueryString.ts +2 -1
  371. package/src/clients/middleware/signing/signer/signatureV4/utils/getCanonicalRequest.ts +2 -1
  372. package/src/clients/middleware/signing/signer/signatureV4/utils/getCanonicalUri.ts +1 -1
  373. package/src/clients/middleware/signing/signer/signatureV4/utils/getCredentialScope.ts +1 -1
  374. package/src/clients/middleware/signing/signer/signatureV4/utils/getFormattedDates.ts +2 -1
  375. package/src/clients/middleware/signing/signer/signatureV4/utils/getHashedPayload.ts +3 -0
  376. package/src/clients/middleware/signing/signer/signatureV4/utils/getSignature.ts +4 -3
  377. package/src/clients/middleware/signing/signer/signatureV4/utils/getSigningKey.ts +3 -1
  378. package/src/clients/middleware/signing/signer/signatureV4/utils/getSigningValues.ts +3 -1
  379. package/src/clients/middleware/signing/signer/signatureV4/utils/getStringToSign.ts +2 -2
  380. package/src/clients/middleware/signing/utils/getUpdatedSystemClockOffset.ts +2 -1
  381. package/src/clients/middleware/signing/utils/isClockSkewed.ts +2 -2
  382. package/src/clients/middleware/userAgent/index.ts +1 -1
  383. package/src/clients/middleware/userAgent/middleware.ts +3 -1
  384. package/src/clients/serde/json.ts +6 -2
  385. package/src/clients/serde/responseInfo.ts +6 -2
  386. package/src/clients/types/aws.ts +6 -3
  387. package/src/clients/types/core.ts +6 -8
  388. package/src/clients/types/http.ts +2 -1
  389. package/src/clients/utils/memoization.ts +2 -0
  390. package/src/errors/APIError.ts +3 -2
  391. package/src/errors/PlatformNotSupportedError.ts +1 -0
  392. package/src/errors/createAssertionFunction.ts +2 -1
  393. package/src/errors/errorHelpers.ts +2 -1
  394. package/src/parseAWSExports.ts +16 -15
  395. package/src/providers/kinesis/types/kinesis.ts +2 -2
  396. package/src/providers/kinesis-firehose/types/kinesis-firehose.ts +2 -2
  397. package/src/providers/personalize/types/personalize.ts +2 -2
  398. package/src/providers/pinpoint/apis/updateEndpoint.ts +2 -2
  399. package/src/providers/pinpoint/types/buffer.ts +7 -8
  400. package/src/providers/pinpoint/types/pinpoint.ts +11 -10
  401. package/src/providers/pinpoint/utils/PinpointEventBuffer.ts +11 -21
  402. package/src/providers/pinpoint/utils/cacheEndpointId.ts +3 -1
  403. package/src/providers/pinpoint/utils/getCacheKey.ts +1 -1
  404. package/src/providers/pinpoint/utils/getEndpointId.ts +3 -1
  405. package/src/providers/pinpoint/utils/getEventBuffer.ts +2 -1
  406. package/src/providers/pinpoint/utils/isAppInForeground.native.ts +0 -1
  407. package/src/providers/pinpoint/utils/resolveEndpointId.ts +1 -0
  408. package/src/singleton/API/types.ts +35 -33
  409. package/src/singleton/Amplify.ts +8 -6
  410. package/src/singleton/Auth/index.ts +9 -13
  411. package/src/singleton/Auth/types.ts +59 -51
  412. package/src/singleton/Auth/utils/index.ts +16 -28
  413. package/src/singleton/Geo/types.ts +3 -3
  414. package/src/singleton/Interactions/types.ts +4 -4
  415. package/src/singleton/Notifications/types.ts +6 -5
  416. package/src/singleton/Predictions/types.ts +28 -28
  417. package/src/singleton/Storage/types.ts +2 -2
  418. package/src/singleton/apis/fetchAuthSession.ts +2 -1
  419. package/src/singleton/apis/internal/fetchAuthSession.ts +1 -1
  420. package/src/singleton/apis/server/fetchAuthSession.ts +2 -2
  421. package/src/singleton/types.ts +10 -10
  422. package/src/storage/CookieStorage.native.ts +1 -5
  423. package/src/storage/CookieStorage.ts +12 -6
  424. package/src/storage/DefaultStorage.native.ts +3 -1
  425. package/src/storage/InMemoryStorage.ts +1 -0
  426. package/src/storage/KeyValueStorage.ts +1 -0
  427. package/src/types/core.ts +3 -3
  428. package/src/types/errors.ts +5 -5
  429. package/src/types/storage.ts +2 -2
  430. package/src/utils/WordArray.ts +2 -2
  431. package/src/utils/convert/base64/base64Encoder.ts +1 -0
  432. package/src/utils/convert/types.ts +1 -1
  433. package/src/utils/cryptoSecureRandomInt.ts +1 -0
  434. package/src/utils/deDupeAsyncFunction.ts +15 -20
  435. package/src/utils/generateRandomString.ts +1 -1
  436. package/src/utils/getClientInfo/getClientInfo.android.ts +3 -2
  437. package/src/utils/getClientInfo/getClientInfo.ios.ts +4 -2
  438. package/src/utils/getClientInfo/getClientInfo.ts +3 -3
  439. package/src/utils/globalHelpers/index.native.ts +2 -1
  440. package/src/utils/haveCredentialsChanged.ts +5 -2
  441. package/src/utils/isWebWorker.ts +1 -0
  442. package/src/utils/queuedStorage/createQueuedStorage.native.ts +9 -6
  443. package/src/utils/queuedStorage/createQueuedStorage.ts +7 -3
  444. package/src/utils/queuedStorage/types.ts +1 -1
  445. package/src/utils/retry/NonRetryableError.ts +0 -3
  446. package/src/utils/retry/isNonRetryableError.ts +1 -0
  447. package/src/utils/retry/jitteredBackoff.ts +3 -1
  448. package/src/utils/retry/jitteredExponentialRetry.ts +1 -1
  449. package/src/utils/retry/retry.ts +22 -8
  450. package/src/utils/sessionListener/SessionListener.native.ts +4 -3
  451. package/src/utils/sessionListener/SessionListener.ts +4 -3
  452. package/src/utils/sessionListener/index.ts +1 -0
  453. package/src/utils/sessionListener/types.ts +2 -2
  454. package/src/utils/urlSafeDecode.ts +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"Amplify.mjs","sources":["../../../src/singleton/Amplify.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AuthClass } from './Auth';\nimport { Hub, AMPLIFY_SYMBOL } from '../Hub';\nimport { parseAWSExports } from '../parseAWSExports';\nimport { deepFreeze } from '../utils';\nimport { ADD_OAUTH_LISTENER } from './constants';\nexport class AmplifyClass {\n constructor() {\n this.oAuthListener = undefined;\n this.resourcesConfig = {};\n this.libraryOptions = {};\n this.Auth = new AuthClass();\n }\n /**\n * Configures Amplify for use with your back-end resources.\n *\n * @remarks\n * This API does not perform any merging of either `resourcesConfig` or `libraryOptions`. The most recently\n * provided values will be used after configuration.\n *\n * @remarks\n * `configure` can be used to specify additional library options where available for supported categories.\n *\n * @param resourceConfig - Back-end resource configuration. Typically provided via the `aws-exports.js` file.\n * @param libraryOptions - Additional options for customizing the behavior of the library.\n */\n configure(resourcesConfig, libraryOptions) {\n let resolvedResourceConfig;\n if (Object.keys(resourcesConfig).some(key => key.startsWith('aws_'))) {\n resolvedResourceConfig = parseAWSExports(resourcesConfig);\n }\n else {\n resolvedResourceConfig = resourcesConfig;\n }\n this.resourcesConfig = resolvedResourceConfig;\n if (libraryOptions) {\n this.libraryOptions = libraryOptions;\n }\n // Make resource config immutable\n this.resourcesConfig = deepFreeze(this.resourcesConfig);\n this.Auth.configure(this.resourcesConfig.Auth, this.libraryOptions.Auth);\n Hub.dispatch('core', {\n event: 'configure',\n data: this.resourcesConfig,\n }, 'Configure', AMPLIFY_SYMBOL);\n this.notifyOAuthListener();\n }\n /**\n * Provides access to the current back-end resource configuration for the Library.\n *\n * @returns Returns the immutable back-end resource configuration.\n */\n getConfig() {\n return this.resourcesConfig;\n }\n /** @internal */\n [ADD_OAUTH_LISTENER](listener) {\n if (this.resourcesConfig.Auth?.Cognito.loginWith?.oauth) {\n // when Amplify has been configured with a valid OAuth config while adding the listener, run it directly\n listener(this.resourcesConfig.Auth?.Cognito);\n }\n else {\n // otherwise register the listener and run it later when Amplify gets configured with a valid oauth config\n this.oAuthListener = listener;\n }\n }\n notifyOAuthListener() {\n if (!this.resourcesConfig.Auth?.Cognito.loginWith?.oauth ||\n !this.oAuthListener) {\n return;\n }\n this.oAuthListener(this.resourcesConfig.Auth?.Cognito);\n // the listener should only be notified once with a valid oauth config\n this.oAuthListener = undefined;\n }\n}\n/**\n * The `Amplify` utility is used to configure the library.\n *\n * @remarks\n * `Amplify` is responsible for orchestrating cross-category communication within the library.\n */\nexport const Amplify = new AmplifyClass();\n"],"names":[],"mappings":";;;;;;;;AAAA;AACA;AAMO,MAAM,YAAY,CAAC;AAC1B,IAAI,WAA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AACA;AACA;AACA;AACA,IAAI,SAAS,GAAG;AAChB,QAAQ,OAAO,IAAI,CAAC,eAAe,CAAC;AACpC,KAAK;AACL;AACA,IAAI,CAAC,kBAAkB,CAAC,CAAC,QAAQ,EAAE;AACnC,QAAQ,IAAI,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,SAAS,EAAE,KAAK,EAAE;AACjE;AACA,YAAY,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACzD,SAAS;AACT,aAAa;AACb;AACA,YAAY,IAAI,CAAC,aAAa,GAAG,QAAQ,CAAC;AAC1C,SAAS;AACT,KAAK;AACL,IAAI,mBAAmB,GAAG;AAC1B,QAAQ,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,SAAS,EAAE,KAAK;AAChE,YAAY,CAAC,IAAI,CAAC,aAAa,EAAE;AACjC,YAAY,OAAO;AACnB,SAAS;AACT,QAAQ,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC/D;AACA,QAAQ,IAAI,CAAC,aAAa,GAAG,SAAS,CAAC;AACvC,KAAK;AACL,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,OAAO,GAAG,IAAI,YAAY;;;;"}
1
+ {"version":3,"file":"Amplify.mjs","sources":["../../../src/singleton/Amplify.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AMPLIFY_SYMBOL, Hub } from '../Hub';\nimport { parseAWSExports } from '../parseAWSExports';\nimport { deepFreeze } from '../utils';\nimport { AuthClass } from './Auth';\nimport { ADD_OAUTH_LISTENER } from './constants';\nexport class AmplifyClass {\n constructor() {\n this.oAuthListener = undefined;\n this.resourcesConfig = {};\n this.libraryOptions = {};\n this.Auth = new AuthClass();\n }\n /**\n * Configures Amplify for use with your back-end resources.\n *\n * @remarks\n * This API does not perform any merging of either `resourcesConfig` or `libraryOptions`. The most recently\n * provided values will be used after configuration.\n *\n * @remarks\n * `configure` can be used to specify additional library options where available for supported categories.\n *\n * @param resourceConfig - Back-end resource configuration. Typically provided via the `aws-exports.js` file.\n * @param libraryOptions - Additional options for customizing the behavior of the library.\n */\n configure(resourcesConfig, libraryOptions) {\n let resolvedResourceConfig;\n if (Object.keys(resourcesConfig).some(key => key.startsWith('aws_'))) {\n resolvedResourceConfig = parseAWSExports(resourcesConfig);\n }\n else {\n resolvedResourceConfig = resourcesConfig;\n }\n this.resourcesConfig = resolvedResourceConfig;\n if (libraryOptions) {\n this.libraryOptions = libraryOptions;\n }\n // Make resource config immutable\n this.resourcesConfig = deepFreeze(this.resourcesConfig);\n this.Auth.configure(this.resourcesConfig.Auth, this.libraryOptions.Auth);\n Hub.dispatch('core', {\n event: 'configure',\n data: this.resourcesConfig,\n }, 'Configure', AMPLIFY_SYMBOL);\n this.notifyOAuthListener();\n }\n /**\n * Provides access to the current back-end resource configuration for the Library.\n *\n * @returns Returns the immutable back-end resource configuration.\n */\n getConfig() {\n return this.resourcesConfig;\n }\n /** @internal */\n [ADD_OAUTH_LISTENER](listener) {\n if (this.resourcesConfig.Auth?.Cognito.loginWith?.oauth) {\n // when Amplify has been configured with a valid OAuth config while adding the listener, run it directly\n listener(this.resourcesConfig.Auth?.Cognito);\n }\n else {\n // otherwise register the listener and run it later when Amplify gets configured with a valid oauth config\n this.oAuthListener = listener;\n }\n }\n notifyOAuthListener() {\n if (!this.resourcesConfig.Auth?.Cognito.loginWith?.oauth ||\n !this.oAuthListener) {\n return;\n }\n this.oAuthListener(this.resourcesConfig.Auth?.Cognito);\n // the listener should only be notified once with a valid oauth config\n this.oAuthListener = undefined;\n }\n}\n/**\n * The `Amplify` utility is used to configure the library.\n *\n * @remarks\n * `Amplify` is responsible for orchestrating cross-category communication within the library.\n */\nexport const Amplify = new AmplifyClass();\n"],"names":[],"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ACxC,QAAQ,IAAI,CAAC,mBAAmB,EAAE,CAAC;AACnC,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,GAAG;AAChB,QAAQ,OAAO,IAAI,CAAC,eAAe,CAAC;AACpC,KAAK;AACL;AACA,IAAI,CAAC,kBAAkB,CAAC,CAAC,QAAQ,EAAE;AACnC,QAAQ,IAAI,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,SAAS,EAAE,KAAK,EAAE;AACjE;AACA,YAAY,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACzD,SAAS;AACT,aAAa;AACb;AACA,YAAY,IAAI,CAAC,aAAa,GAAG,QAAQ,CAAC;AAC1C,SAAS;AACT,KAAK;AACL,IAAI,mBAAmB,GAAG;AAC1B,QAAQ,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,SAAS,EAAE,KAAK;AAChE,YAAY,CAAC,IAAI,CAAC,aAAa,EAAE;AACjC,YAAY,OAAO;AACnB,SAAS;AACT,QAAQ,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC/D;AACA,QAAQ,IAAI,CAAC,aAAa,GAAG,SAAS,CAAC;AACvC,KAAK;AACL,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,OAAO,GAAG,IAAI,YAAY;;;;"}
@@ -6,7 +6,6 @@ export declare function isTokenExpired({ expiresAt, clockDrift, }: {
6
6
  export declare class AuthClass {
7
7
  private authConfig?;
8
8
  private authOptions?;
9
- constructor();
10
9
  /**
11
10
  * Configure Auth category
12
11
  *
@@ -3,7 +3,6 @@ function isTokenExpired({ expiresAt, clockDrift, }) {
3
3
  return currentTime + clockDrift > expiresAt;
4
4
  }
5
5
  class AuthClass {
6
- constructor() { }
7
6
  /**
8
7
  * Configure Auth category
9
8
  *
@@ -28,11 +27,10 @@ class AuthClass {
28
27
  * @returns Promise of current auth session {@link AuthSession}.
29
28
  */
30
29
  async fetchAuthSession(options = {}) {
31
- let tokens;
32
30
  let credentialsAndIdentityId;
33
31
  let userSub;
34
32
  // Get tokens will throw if session cannot be refreshed (network or service error) or return null if not available
35
- tokens = await this.getTokens(options);
33
+ const tokens = await this.getTokens(options);
36
34
  if (tokens) {
37
35
  userSub = tokens.accessToken?.payload?.sub;
38
36
  // getCredentialsAndIdentityId will throw if cannot get credentials (network or service error)
@@ -61,9 +59,7 @@ class AuthClass {
61
59
  };
62
60
  }
63
61
  async clearCredentials() {
64
- if (this.authOptions?.credentialsProvider) {
65
- return await this.authOptions.credentialsProvider.clearCredentialsAndIdentityId();
66
- }
62
+ await this.authOptions?.credentialsProvider?.clearCredentialsAndIdentityId();
67
63
  }
68
64
  async getTokens(options) {
69
65
  return ((await this.authOptions?.tokenProvider?.getTokens(options)) ?? undefined);
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../../../src/singleton/Auth/index.ts"],"sourcesContent":["export function isTokenExpired({ expiresAt, clockDrift, }) {\n const currentTime = Date.now();\n return currentTime + clockDrift > expiresAt;\n}\nexport class AuthClass {\n constructor() { }\n /**\n * Configure Auth category\n *\n * @internal\n *\n * @param authResourcesConfig - Resources configurations required by Auth providers.\n * @param authOptions - Client options used by library\n *\n * @returns void\n */\n configure(authResourcesConfig, authOptions) {\n this.authConfig = authResourcesConfig;\n this.authOptions = authOptions;\n }\n /**\n * Fetch the auth tokens, and the temporary AWS credentials and identity if they are configured. By default it\n * does not refresh the auth tokens or credentials if they are loaded in storage already. You can force a refresh\n * with `{ forceRefresh: true }` input.\n *\n * @param options - Options configuring the fetch behavior.\n *\n * @returns Promise of current auth session {@link AuthSession}.\n */\n async fetchAuthSession(options = {}) {\n let tokens;\n let credentialsAndIdentityId;\n let userSub;\n // Get tokens will throw if session cannot be refreshed (network or service error) or return null if not available\n tokens = await this.getTokens(options);\n if (tokens) {\n userSub = tokens.accessToken?.payload?.sub;\n // getCredentialsAndIdentityId will throw if cannot get credentials (network or service error)\n credentialsAndIdentityId =\n await this.authOptions?.credentialsProvider?.getCredentialsAndIdentityId({\n authConfig: this.authConfig,\n tokens,\n authenticated: true,\n forceRefresh: options.forceRefresh,\n });\n }\n else {\n // getCredentialsAndIdentityId will throw if cannot get credentials (network or service error)\n credentialsAndIdentityId =\n await this.authOptions?.credentialsProvider?.getCredentialsAndIdentityId({\n authConfig: this.authConfig,\n authenticated: false,\n forceRefresh: options.forceRefresh,\n });\n }\n return {\n tokens,\n credentials: credentialsAndIdentityId?.credentials,\n identityId: credentialsAndIdentityId?.identityId,\n userSub,\n };\n }\n async clearCredentials() {\n if (this.authOptions?.credentialsProvider) {\n return await this.authOptions.credentialsProvider.clearCredentialsAndIdentityId();\n }\n }\n async getTokens(options) {\n return ((await this.authOptions?.tokenProvider?.getTokens(options)) ?? undefined);\n }\n}\n"],"names":[],"mappings":"AAAO,SAAS,cAAc,CAAC,EAAE,SAAS,EAAE,UAAU,GAAG,EAAE;AAC3D,IAAI,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;AACnC,IAAI,OAAO,WAAW,GAAG,UAAU,GAAG,SAAS,CAAC;AAChD,CAAC;AACM,MAAM,SAAS,CAAC;AACvB,IAAI,WAAW,GAAG,GAAG;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,mBAAmB,EAAE,WAAW,EAAE;AAChD,QAAQ,IAAI,CAAC,UAAU,GAAG,mBAAmB,CAAC;AAC9C,QAAQ,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;AACvC,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,MAAM,gBAAgB,CAAC,OAAO,GAAG,EAAE,EAAE;AACzC,QAAQ,IAAI,MAAM,CAAC;AACnB,QAAQ,IAAI,wBAAwB,CAAC;AACrC,QAAQ,IAAI,OAAO,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,OAAO,CAAC,KAAK,SAAS,EAAE;AAC1F,KAAK;AACL;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../../../src/singleton/Auth/index.ts"],"sourcesContent":["export function isTokenExpired({ expiresAt, clockDrift, }) {\n const currentTime = Date.now();\n return currentTime + clockDrift > expiresAt;\n}\nexport class AuthClass {\n /**\n * Configure Auth category\n *\n * @internal\n *\n * @param authResourcesConfig - Resources configurations required by Auth providers.\n * @param authOptions - Client options used by library\n *\n * @returns void\n */\n configure(authResourcesConfig, authOptions) {\n this.authConfig = authResourcesConfig;\n this.authOptions = authOptions;\n }\n /**\n * Fetch the auth tokens, and the temporary AWS credentials and identity if they are configured. By default it\n * does not refresh the auth tokens or credentials if they are loaded in storage already. You can force a refresh\n * with `{ forceRefresh: true }` input.\n *\n * @param options - Options configuring the fetch behavior.\n *\n * @returns Promise of current auth session {@link AuthSession}.\n */\n async fetchAuthSession(options = {}) {\n let credentialsAndIdentityId;\n let userSub;\n // Get tokens will throw if session cannot be refreshed (network or service error) or return null if not available\n const tokens = await this.getTokens(options);\n if (tokens) {\n userSub = tokens.accessToken?.payload?.sub;\n // getCredentialsAndIdentityId will throw if cannot get credentials (network or service error)\n credentialsAndIdentityId =\n await this.authOptions?.credentialsProvider?.getCredentialsAndIdentityId({\n authConfig: this.authConfig,\n tokens,\n authenticated: true,\n forceRefresh: options.forceRefresh,\n });\n }\n else {\n // getCredentialsAndIdentityId will throw if cannot get credentials (network or service error)\n credentialsAndIdentityId =\n await this.authOptions?.credentialsProvider?.getCredentialsAndIdentityId({\n authConfig: this.authConfig,\n authenticated: false,\n forceRefresh: options.forceRefresh,\n });\n }\n return {\n tokens,\n credentials: credentialsAndIdentityId?.credentials,\n identityId: credentialsAndIdentityId?.identityId,\n userSub,\n };\n }\n async clearCredentials() {\n await this.authOptions?.credentialsProvider?.clearCredentialsAndIdentityId();\n }\n async getTokens(options) {\n return ((await this.authOptions?.tokenProvider?.getTokens(options)) ?? undefined);\n }\n}\n"],"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AoB,aAAa,EAAE,KAAK;AACxC,oBAAoB,YAAY,EAAE,OAAO,CAAC,YAAY;AACtD,iBAAiB,CAAC,CAAC;AACnB,SAAS;AACT,QAAQ,OAAO;AACf,YAAY,MAAM;AAClB,YAAY,WAAW,EAAE,wBAAwB,EAAE,WAAW;AAC9D,YAAY,UAAU,EAAE,wBAAwB,EAAE,UAAU;AAC5D,YAAY,OAAO;AACnB,SAAS,CAAC;AACV,KAAK;AACL,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,MAAM,IAAI,CAAC,WAAW,EAAE,mBAAmB,EAAE,6BAA6B,EAAE,CAAC;AACrF,KAAK;AACL,IAAI,MAAM,SAAS,CAAC,OAAO,EAAE;AAC7B,QAAQ,QAAQ,CAAC,MAAM,IAAI,CAAC,WAAW,EAAE,aAAa,EAAE,SAAS,CAAC,OAAO,CAAC,KAAK,SAAS,EAAE;AAC1F,KAAK;AACL;;;;"}
@@ -9,48 +9,49 @@ interface JwtPayloadStandardFields {
9
9
  jti?: string;
10
10
  sub?: string;
11
11
  }
12
- /** JSON type */
13
- type Json = null | string | number | boolean | Json[] | JsonObject;
12
+ type JsonPrimitive = null | string | number | boolean;
13
+ /** JSON array type */
14
+ type JsonArray = JsonPrimitive[];
14
15
  /** JSON Object type */
15
- type JsonObject = {
16
- [name: string]: Json;
17
- };
16
+ interface JsonObject {
17
+ [x: string]: JsonPrimitive | JsonArray | JsonObject;
18
+ }
18
19
  export type JwtPayload = JwtPayloadStandardFields & JsonObject;
19
- export type JWT = {
20
+ export interface JWT {
20
21
  payload: JwtPayload;
21
- toString: () => string;
22
- };
22
+ toString(): string;
23
+ }
23
24
  export type JWTCreator = (stringJWT: string) => JWT;
24
- export type AuthSession = {
25
+ export interface AuthSession {
25
26
  tokens?: AuthTokens;
26
27
  credentials?: AWSCredentials;
27
28
  identityId?: string;
28
29
  userSub?: string;
29
- };
30
- export type LibraryAuthOptions = {
30
+ }
31
+ export interface LibraryAuthOptions {
31
32
  tokenProvider?: TokenProvider;
32
33
  credentialsProvider?: CredentialsAndIdentityIdProvider;
33
- };
34
- export type Identity = {
34
+ }
35
+ export interface Identity {
35
36
  id: string;
36
37
  type: 'guest' | 'primary';
37
- };
38
+ }
38
39
  export interface CredentialsAndIdentityIdProvider {
39
- getCredentialsAndIdentityId: (getCredentialsOptions: GetCredentialsOptions) => Promise<CredentialsAndIdentityId | undefined>;
40
- clearCredentialsAndIdentityId: () => void;
40
+ getCredentialsAndIdentityId(getCredentialsOptions: GetCredentialsOptions): Promise<CredentialsAndIdentityId | undefined>;
41
+ clearCredentialsAndIdentityId(): void;
41
42
  }
42
- export type TokenProvider = {
43
- getTokens: ({ forceRefresh, }?: {
43
+ export interface TokenProvider {
44
+ getTokens({ forceRefresh, }?: {
44
45
  forceRefresh?: boolean;
45
- }) => Promise<AuthTokens | null>;
46
- };
47
- export type FetchAuthSessionOptions = {
46
+ }): Promise<AuthTokens | null>;
47
+ }
48
+ export interface FetchAuthSessionOptions {
48
49
  forceRefresh?: boolean;
49
- };
50
- export type AuthTokens = {
50
+ }
51
+ export interface AuthTokens {
51
52
  idToken?: JWT;
52
53
  accessToken: JWT;
53
- };
54
+ }
54
55
  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;
55
56
  export type LegacyUserAttributeKey = Uppercase<AuthStandardAttributeKey>;
56
57
  export type AuthVerifiableAttributeKey = 'email' | 'phone_number';
@@ -62,7 +63,7 @@ export type CognitoProviderConfig = StrictUnion<AuthIdentityPoolConfig | AuthUse
62
63
  type UnionKeys<T> = T extends T ? keyof T : never;
63
64
  type StrictUnionHelper<T, TAll> = T extends any ? T & Partial<Record<Exclude<UnionKeys<TAll>, keyof T>, never>> : never;
64
65
  export type StrictUnion<T> = StrictUnionHelper<T, T>;
65
- export type AuthIdentityPoolConfig = {
66
+ export interface AuthIdentityPoolConfig {
66
67
  Cognito: CognitoIdentityPoolConfig & {
67
68
  userPoolClientId?: never;
68
69
  userPoolId?: never;
@@ -73,18 +74,18 @@ export type AuthIdentityPoolConfig = {
73
74
  mfa?: never;
74
75
  passwordFormat?: never;
75
76
  };
76
- };
77
- export type CognitoIdentityPoolConfig = {
77
+ }
78
+ export interface CognitoIdentityPoolConfig {
78
79
  identityPoolId: string;
79
80
  allowGuestAccess?: boolean;
80
- };
81
- export type AuthUserPoolConfig = {
81
+ }
82
+ export interface AuthUserPoolConfig {
82
83
  Cognito: CognitoUserPoolConfig & {
83
84
  identityPoolId?: never;
84
85
  allowGuestAccess?: never;
85
86
  };
86
- };
87
- export type CognitoUserPoolConfig = {
87
+ }
88
+ export interface CognitoUserPoolConfig {
88
89
  userPoolClientId: string;
89
90
  userPoolId: string;
90
91
  userPoolEndpoint?: string;
@@ -108,51 +109,51 @@ export type CognitoUserPoolConfig = {
108
109
  requireNumbers?: boolean;
109
110
  requireSpecialCharacters?: boolean;
110
111
  };
111
- };
112
- export type OAuthConfig = {
112
+ }
113
+ export interface OAuthConfig {
113
114
  domain: string;
114
- scopes: Array<OAuthScope>;
115
- redirectSignIn: Array<string>;
116
- redirectSignOut: Array<string>;
115
+ scopes: OAuthScope[];
116
+ redirectSignIn: string[];
117
+ redirectSignOut: string[];
117
118
  responseType: 'code' | 'token';
118
- providers?: Array<OAuthProvider | CustomProvider>;
119
- };
119
+ providers?: (OAuthProvider | CustomProvider)[];
120
+ }
120
121
  export type OAuthProvider = 'Google' | 'Facebook' | 'Amazon' | 'Apple';
121
- type CustomProvider = {
122
+ interface CustomProvider {
122
123
  custom: string;
123
- };
124
- type CustomScope = string & {};
125
- type OAuthScope = 'email' | 'openid' | 'phone' | 'email' | 'profile' | 'aws.cognito.signin.user.admin' | CustomScope;
124
+ }
125
+ type CustomScope = string & NonNullable<unknown>;
126
+ export type OAuthScope = 'email' | 'openid' | 'phone' | 'email' | 'profile' | 'aws.cognito.signin.user.admin' | CustomScope;
126
127
  export type CognitoUserPoolWithOAuthConfig = CognitoUserPoolConfig & {
127
128
  loginWith: {
128
129
  oauth: OAuthConfig;
129
130
  };
130
131
  };
131
- export type AuthUserPoolAndIdentityPoolConfig = {
132
+ export interface AuthUserPoolAndIdentityPoolConfig {
132
133
  Cognito: CognitoUserPoolAndIdentityPoolConfig;
133
- };
134
+ }
134
135
  export type CognitoUserPoolAndIdentityPoolConfig = CognitoUserPoolConfig & CognitoIdentityPoolConfig;
135
136
  export type GetCredentialsOptions = GetCredentialsAuthenticatedUser | GetCredentialsUnauthenticatedUser;
136
- type GetCredentialsAuthenticatedUser = {
137
+ interface GetCredentialsAuthenticatedUser {
137
138
  authenticated: true;
138
139
  forceRefresh?: boolean;
139
140
  authConfig: AuthConfig | undefined;
140
141
  tokens: AuthTokens;
141
- };
142
- type GetCredentialsUnauthenticatedUser = {
142
+ }
143
+ interface GetCredentialsUnauthenticatedUser {
143
144
  authenticated: false;
144
145
  forceRefresh?: boolean;
145
146
  authConfig: AuthConfig | undefined;
146
147
  tokens?: never;
147
- };
148
- export type CredentialsAndIdentityId = {
148
+ }
149
+ export interface CredentialsAndIdentityId {
149
150
  credentials: AWSCredentials;
150
151
  identityId?: string;
151
- };
152
- export type AWSCredentials = {
152
+ }
153
+ export interface AWSCredentials {
153
154
  accessKeyId: string;
154
155
  secretAccessKey: string;
155
156
  sessionToken?: string;
156
157
  expiration?: Date;
157
- };
158
+ }
158
159
  export {};
@@ -1,4 +1,4 @@
1
- import { AuthConfig, JWT, CognitoUserPoolConfig, CognitoUserPoolAndIdentityPoolConfig, CognitoIdentityPoolConfig, StrictUnion, OAuthConfig } from '../types';
1
+ import { AuthConfig, CognitoIdentityPoolConfig, CognitoUserPoolAndIdentityPoolConfig, CognitoUserPoolConfig, JWT, OAuthConfig, StrictUnion } from '../types';
2
2
  export declare function assertTokenProviderConfig(cognitoConfig?: StrictUnion<CognitoUserPoolConfig | CognitoUserPoolAndIdentityPoolConfig | CognitoIdentityPoolConfig>): asserts cognitoConfig is CognitoUserPoolAndIdentityPoolConfig | CognitoUserPoolConfig;
3
3
  export declare function assertOAuthConfig(cognitoConfig?: AuthConfig['Cognito']): asserts cognitoConfig is AuthConfig['Cognito'] & {
4
4
  loginWith: {
@@ -1,7 +1,7 @@
1
- import { assert, AuthConfigurationErrorCode } from './errorHelpers.mjs';
2
1
  import { base64Decoder } from '../../../utils/convert/base64/base64Decoder.mjs';
3
2
  import '../../../types/errors.mjs';
4
3
  import '../../../errors/errorHelpers.mjs';
4
+ import { assert, AuthConfigurationErrorCode } from './errorHelpers.mjs';
5
5
 
6
6
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
7
7
  // SPDX-License-Identifier: Apache-2.0
@@ -14,18 +14,18 @@ function assertTokenProviderConfig(cognitoConfig) {
14
14
  assertionValid =
15
15
  !!cognitoConfig.userPoolId && !!cognitoConfig.userPoolClientId;
16
16
  }
17
- return assert(assertionValid, AuthConfigurationErrorCode.AuthUserPoolException);
17
+ assert(assertionValid, AuthConfigurationErrorCode.AuthUserPoolException);
18
18
  }
19
19
  function assertOAuthConfig(cognitoConfig) {
20
20
  const validOAuthConfig = !!cognitoConfig?.loginWith?.oauth?.domain &&
21
21
  !!cognitoConfig?.loginWith?.oauth?.redirectSignOut &&
22
22
  !!cognitoConfig?.loginWith?.oauth?.redirectSignIn &&
23
23
  !!cognitoConfig?.loginWith?.oauth?.responseType;
24
- return assert(validOAuthConfig, AuthConfigurationErrorCode.OAuthNotConfigureException);
24
+ assert(validOAuthConfig, AuthConfigurationErrorCode.OAuthNotConfigureException);
25
25
  }
26
26
  function assertIdentityPoolIdConfig(cognitoConfig) {
27
27
  const validConfig = !!cognitoConfig?.identityPoolId;
28
- return assert(validConfig, AuthConfigurationErrorCode.InvalidIdentityPoolIdException);
28
+ assert(validConfig, AuthConfigurationErrorCode.InvalidIdentityPoolIdException);
29
29
  }
30
30
  function decodeJWT(token) {
31
31
  const tokenParts = token.split('.');
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../../../../src/singleton/Auth/utils/index.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AuthConfigurationErrorCode, assert } from './errorHelpers';\nimport { base64Decoder } from '../../../utils/convert';\nexport function assertTokenProviderConfig(cognitoConfig) {\n let assertionValid = true; // assume valid until otherwise proveed\n if (!cognitoConfig) {\n assertionValid = false;\n }\n else {\n assertionValid =\n !!cognitoConfig.userPoolId && !!cognitoConfig.userPoolClientId;\n }\n return assert(assertionValid, AuthConfigurationErrorCode.AuthUserPoolException);\n}\nexport function assertOAuthConfig(cognitoConfig) {\n const validOAuthConfig = !!cognitoConfig?.loginWith?.oauth?.domain &&\n !!cognitoConfig?.loginWith?.oauth?.redirectSignOut &&\n !!cognitoConfig?.loginWith?.oauth?.redirectSignIn &&\n !!cognitoConfig?.loginWith?.oauth?.responseType;\n return assert(validOAuthConfig, AuthConfigurationErrorCode.OAuthNotConfigureException);\n}\nexport function assertIdentityPoolIdConfig(cognitoConfig) {\n const validConfig = !!cognitoConfig?.identityPoolId;\n return assert(validConfig, AuthConfigurationErrorCode.InvalidIdentityPoolIdException);\n}\nfunction assertUserPoolAndIdentityPoolConfig(authConfig) {\n const validConfig = !!authConfig?.Cognito.identityPoolId && !!authConfig?.Cognito.userPoolId;\n return assert(validConfig, AuthConfigurationErrorCode.AuthUserPoolAndIdentityPoolException);\n}\nexport function decodeJWT(token) {\n const tokenParts = token.split('.');\n if (tokenParts.length !== 3) {\n throw new Error('Invalid token');\n }\n try {\n const base64WithUrlSafe = tokenParts[1];\n const base64 = base64WithUrlSafe.replace(/-/g, '+').replace(/_/g, '/');\n const jsonStr = decodeURIComponent(base64Decoder\n .convert(base64)\n .split('')\n .map(char => `%${`00${char.charCodeAt(0).toString(16)}`.slice(-2)}`)\n .join(''));\n const payload = JS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IAAI,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;AACjC,QAAQ,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;AACzC,KAAK;AACL,IAAI,IAAI;AACR,QAAQ,MAAM,iBAAiB,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;AAChD,QAAQ,MAAM,MAAM,GAAG,iBAAiB,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAC/E,QAAQ,MAAM,OAAO,GAAG,kBAAkB,CAAC,aAAa;AACxD,aAAa,OAAO,CAAC,MAAM,CAAC;AAC5B,aAAa,KAAK,CAAC,EAAE,CAAC;AACtB,aAAa,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChF,aAAa,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AACvB,QAAQ,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAC5C,QAAQ,OAAO;AACf,YAAY,QAAQ,EAAE,MAAM,KAAK;AACjC,YAAY,OAAO;AACnB,SAAS,CAAC;AACV,KAAK;AACL,IAAI,OAAO,GAAG,EAAE;AAChB,QAAQ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;AACjD,KAAK;AACL;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../../../../src/singleton/Auth/utils/index.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { base64Decoder } from '../../../utils/convert';\nimport { AuthConfigurationErrorCode, assert } from './errorHelpers';\nexport function assertTokenProviderConfig(cognitoConfig) {\n let assertionValid = true; // assume valid until otherwise proveed\n if (!cognitoConfig) {\n assertionValid = false;\n }\n else {\n assertionValid =\n !!cognitoConfig.userPoolId && !!cognitoConfig.userPoolClientId;\n }\n assert(assertionValid, AuthConfigurationErrorCode.AuthUserPoolException);\n}\nexport function assertOAuthConfig(cognitoConfig) {\n const validOAuthConfig = !!cognitoConfig?.loginWith?.oauth?.domain &&\n !!cognitoConfig?.loginWith?.oauth?.redirectSignOut &&\n !!cognitoConfig?.loginWith?.oauth?.redirectSignIn &&\n !!cognitoConfig?.loginWith?.oauth?.responseType;\n assert(validOAuthConfig, AuthConfigurationErrorCode.OAuthNotConfigureException);\n}\nexport function assertIdentityPoolIdConfig(cognitoConfig) {\n const validConfig = !!cognitoConfig?.identityPoolId;\n assert(validConfig, AuthConfigurationErrorCode.InvalidIdentityPoolIdException);\n}\nexport function decodeJWT(token) {\n const tokenParts = token.split('.');\n if (tokenParts.length !== 3) {\n throw new Error('Invalid token');\n }\n try {\n const base64WithUrlSafe = tokenParts[1];\n const base64 = base64WithUrlSafe.replace(/-/g, '+').replace(/_/g, '/');\n const jsonStr = decodeURIComponent(base64Decoder\n .convert(base64)\n .split('')\n .map(char => `%${`00${char.charCodeAt(0).toString(16)}`.slice(-2)}`)\n .join(''));\n const payload = JSON.parse(jsonStr);\n return {\n toString: () => token,\n payload,\n };\n }\n catch (err) {\n throw new Error('Invalid token payload');\n }\n}\n"],"names":[],"mappings":";;;;;AAAA;AACA;AAGO,SAAS,yBAAyB,CAAC,aAAa,EAAE;AACzD,IAAI,IAAI,cAAc,GAAG,IAAI,CAAC;AAC9B,IAAI,IAAI,CAAC,aAAa,EAAE;AACxB,QAAQ,cAAc,GAAG,KAAK,CAAC;AAC/B,KAAK;AACL,SAAS;AACT,QAAQ,cAAc;AACtB,YAAY,CAAC,CAAC,aAAa,CAAC,UAAU,IAAI,CAAC,CAAC,aAAa,CAAC,gBAAgB,CAAC;AAC3E,KAAK;AACL,IAAI,MAAM,CAAC,cAAc,EAAE,0B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G,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChF,aAAa,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AACvB,QAAQ,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAC5C,QAAQ,OAAO;AACf,YAAY,QAAQ,EAAE,MAAM,KAAK;AACjC,YAAY,OAAO;AACnB,SAAS,CAAC;AACV,KAAK;AACL,IAAI,OAAO,GAAG,EAAE;AAChB,QAAQ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;AACjD,KAAK;AACL;;;;"}
@@ -1,9 +1,9 @@
1
1
  import { AtLeastOne } from '../types';
2
- export type LocationServiceConfig = {
2
+ export interface LocationServiceConfig {
3
3
  LocationService: {
4
4
  region: string;
5
5
  maps?: {
6
- items: {};
6
+ items: Record<string, unknown>;
7
7
  default: string;
8
8
  };
9
9
  searchIndices?: {
@@ -15,5 +15,5 @@ export type LocationServiceConfig = {
15
15
  default: string;
16
16
  };
17
17
  };
18
- };
18
+ }
19
19
  export type GeoConfig = AtLeastOne<LocationServiceConfig>;
@@ -9,11 +9,11 @@ interface LexV2BotConfig {
9
9
  localeId: string;
10
10
  region: string;
11
11
  }
12
- type InteractionsLexV1Config = {
12
+ interface InteractionsLexV1Config {
13
13
  LexV1: Record<string, LexV1BotConfig>;
14
- };
15
- type InteractionsLexV2Config = {
14
+ }
15
+ interface InteractionsLexV2Config {
16
16
  LexV2: Record<string, LexV2BotConfig>;
17
- };
17
+ }
18
18
  export type InteractionsConfig = AtLeastOne<InteractionsLexV1Config & InteractionsLexV2Config>;
19
19
  export {};
@@ -1,10 +1,10 @@
1
+ import { AtLeastOne } from '../types';
1
2
  import { InAppMessagingConfig } from './InAppMessaging/types';
2
3
  import { PushNotificationConfig } from './PushNotification/types';
3
- import { AtLeastOne } from '../types';
4
- export type InAppMessagingProviderConfig = {
4
+ export interface InAppMessagingProviderConfig {
5
5
  InAppMessaging: InAppMessagingConfig;
6
- };
7
- export type PushNotificationProviderConfig = {
6
+ }
7
+ export interface PushNotificationProviderConfig {
8
8
  PushNotification: PushNotificationConfig;
9
- };
9
+ }
10
10
  export type NotificationsConfig = AtLeastOne<InAppMessagingProviderConfig & PushNotificationProviderConfig>;
@@ -1,55 +1,55 @@
1
1
  import { AtLeastOne } from '../types';
2
- type SpeechGeneratorDefaults = {
2
+ interface SpeechGeneratorDefaults {
3
3
  voiceId?: string;
4
- };
5
- type TranscriptionDefaults = {
4
+ }
5
+ interface TranscriptionDefaults {
6
6
  language?: string;
7
- };
8
- type TranslateTextDefaults = {
7
+ }
8
+ interface TranslateTextDefaults {
9
9
  sourceLanguage?: string;
10
10
  targetLanguage?: string;
11
- };
12
- type IdentifyEntitiesDefaults = {
11
+ }
12
+ interface IdentifyEntitiesDefaults {
13
13
  collectionId?: string;
14
14
  maxEntities?: number;
15
- };
16
- type IdentityLabelsDefaults = {
15
+ }
16
+ interface IdentityLabelsDefaults {
17
17
  type?: string;
18
- };
19
- type IdentifyTextDefaults = {
18
+ }
19
+ interface IdentifyTextDefaults {
20
20
  format?: string;
21
- };
22
- type InterpretTextDefaults = {
21
+ }
22
+ interface InterpretTextDefaults {
23
23
  type?: string;
24
- };
25
- type ConvertConfig = {
24
+ }
25
+ interface ConvertConfig {
26
26
  speechGenerator?: PredictionsProviderConfig<SpeechGeneratorDefaults>;
27
27
  transcription?: PredictionsProviderConfig<TranscriptionDefaults>;
28
28
  translateText?: PredictionsProviderConfig<TranslateTextDefaults>;
29
- };
30
- type IdentifyConfig = {
29
+ }
30
+ interface IdentifyConfig {
31
31
  identifyEntities?: PredictionsProviderConfig<IdentifyEntitiesDefaults> & {
32
32
  celebrityDetectionEnabled?: boolean;
33
33
  };
34
34
  identifyLabels?: PredictionsProviderConfig<IdentityLabelsDefaults>;
35
35
  identifyText?: PredictionsProviderConfig<IdentifyTextDefaults>;
36
- };
37
- type InterpretConfig = {
36
+ }
37
+ interface InterpretConfig {
38
38
  interpretText?: PredictionsProviderConfig<InterpretTextDefaults>;
39
- };
40
- export type PredictionsProviderConfig<T> = {
39
+ }
40
+ export interface PredictionsProviderConfig<T> {
41
41
  region?: string;
42
42
  proxy?: boolean;
43
43
  defaults?: T;
44
- };
45
- export type PredictionsConvertConfig = {
44
+ }
45
+ export interface PredictionsConvertConfig {
46
46
  convert: ConvertConfig;
47
- };
48
- export type PredictionsIdentifyConfig = {
47
+ }
48
+ export interface PredictionsIdentifyConfig {
49
49
  identify: IdentifyConfig;
50
- };
51
- export type PredictionsInterpretConfig = {
50
+ }
51
+ export interface PredictionsInterpretConfig {
52
52
  interpret: InterpretConfig;
53
- };
53
+ }
54
54
  export type PredictionsConfig = AtLeastOne<PredictionsConvertConfig & PredictionsIdentifyConfig & PredictionsInterpretConfig>;
55
55
  export {};
@@ -1,6 +1,6 @@
1
1
  import { AtLeastOne } from '../types';
2
2
  export type StorageAccessLevel = 'guest' | 'protected' | 'private';
3
- export type S3ProviderConfig = {
3
+ export interface S3ProviderConfig {
4
4
  S3: {
5
5
  bucket?: string;
6
6
  region?: string;
@@ -11,7 +11,7 @@ export type S3ProviderConfig = {
11
11
  */
12
12
  dangerouslyConnectToHttpEndpointForTesting?: string;
13
13
  };
14
- };
14
+ }
15
15
  export type StorageConfig = AtLeastOne<S3ProviderConfig>;
16
16
  type StoragePrefixResolver = (params: {
17
17
  accessLevel: StorageAccessLevel;
@@ -1,5 +1,5 @@
1
- import { fetchAuthSession as fetchAuthSession$1 } from './internal/fetchAuthSession.mjs';
2
1
  import { Amplify } from '../Amplify.mjs';
2
+ import { fetchAuthSession as fetchAuthSession$1 } from './internal/fetchAuthSession.mjs';
3
3
 
4
4
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
5
  // SPDX-License-Identifier: Apache-2.0
@@ -1 +1 @@
1
- {"version":3,"file":"fetchAuthSession.mjs","sources":["../../../../src/singleton/apis/fetchAuthSession.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { fetchAuthSession as fetchAuthSessionInternal } from './internal/fetchAuthSession';\nimport { Amplify } from '../Amplify';\nexport const fetchAuthSession = (options) => {\n return fetchAuthSessionInternal(Amplify, options);\n};\n"],"names":["fetchAuthSessionInternal"],"mappings":";;;AAAA;AACA;AAGY,MAAC,gBAAgB,GAAG,CAAC,OAAO,KAAK;AAC7C,IAAI,OAAOA,kBAAwB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AACtD;;;;"}
1
+ {"version":3,"file":"fetchAuthSession.mjs","sources":["../../../../src/singleton/apis/fetchAuthSession.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Amplify } from '../Amplify';\nimport { fetchAuthSession as fetchAuthSessionInternal } from './internal/fetchAuthSession';\nexport const fetchAuthSession = (options) => {\n return fetchAuthSessionInternal(Amplify, options);\n};\n"],"names":["fetchAuthSessionInternal"],"mappings":";;;AAAA;AACA;AAGY,MAAC,gBAAgB,GAAG,CAAC,OAAO,KAAK;AAC7C,IAAI,OAAOA,kBAAwB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AACtD;;;;"}
@@ -1,21 +1,21 @@
1
- import { APIConfig, LibraryAPIOptions, GraphQLProviderConfig } from './API/types';
1
+ import { APIConfig, GraphQLProviderConfig, LibraryAPIOptions } from './API/types';
2
2
  import { AnalyticsConfig } from './Analytics/types';
3
- import { AuthConfig, LibraryAuthOptions, AuthUserPoolConfig, AuthIdentityPoolConfig, AuthUserPoolAndIdentityPoolConfig, GetCredentialsOptions, CognitoIdentityPoolConfig } from './Auth/types';
3
+ import { AuthConfig, AuthIdentityPoolConfig, AuthUserPoolAndIdentityPoolConfig, AuthUserPoolConfig, CognitoIdentityPoolConfig, GetCredentialsOptions, LibraryAuthOptions } from './Auth/types';
4
4
  import { GeoConfig } from './Geo/types';
5
5
  import { PredictionsConfig } from './Predictions/types';
6
6
  import { LibraryStorageOptions, StorageAccessLevel, StorageConfig } from './Storage/types';
7
7
  import { NotificationsConfig } from './Notifications/types';
8
8
  import { InteractionsConfig } from './Interactions/types';
9
- export type LegacyConfig = {
9
+ export interface LegacyConfig {
10
10
  /**
11
11
  * @deprecated The field should not be used.
12
12
  */
13
13
  aws_project_region?: string;
14
- };
14
+ }
15
15
  export type AtLeastOne<T, U = {
16
16
  [K in keyof T]: Pick<T, K>;
17
17
  }> = Partial<T> & U[keyof U];
18
- export type ResourcesConfig = {
18
+ export interface ResourcesConfig {
19
19
  API?: APIConfig;
20
20
  Analytics?: AnalyticsConfig;
21
21
  Auth?: AuthConfig;
@@ -24,11 +24,11 @@ export type ResourcesConfig = {
24
24
  Predictions?: PredictionsConfig;
25
25
  Storage?: StorageConfig;
26
26
  Geo?: GeoConfig;
27
- };
28
- export type LibraryOptions = {
27
+ }
28
+ export interface LibraryOptions {
29
29
  API?: LibraryAPIOptions;
30
30
  Auth?: LibraryAuthOptions;
31
31
  Storage?: LibraryStorageOptions;
32
32
  ssr?: boolean;
33
- };
33
+ }
34
34
  export { APIConfig, AuthConfig, AuthUserPoolConfig, AuthIdentityPoolConfig, AuthUserPoolAndIdentityPoolConfig, GetCredentialsOptions, GraphQLProviderConfig, InteractionsConfig, PredictionsConfig, StorageAccessLevel, StorageConfig, AnalyticsConfig, CognitoIdentityPoolConfig, GeoConfig, };
@@ -6,10 +6,14 @@ class CookieStorage {
6
6
  constructor(data = {}) {
7
7
  const { path, domain, expires, sameSite, secure } = data;
8
8
  this.domain = domain;
9
- this.path = path ? path : '/';
10
- this.expires = data.hasOwnProperty('expires') ? expires : 365;
11
- this.secure = data.hasOwnProperty('secure') ? secure : true;
12
- if (data.hasOwnProperty('sameSite')) {
9
+ this.path = path || '/';
10
+ this.expires = Object.prototype.hasOwnProperty.call(data, 'expires')
11
+ ? expires
12
+ : 365;
13
+ this.secure = Object.prototype.hasOwnProperty.call(data, 'secure')
14
+ ? secure
15
+ : true;
16
+ if (Object.prototype.hasOwnProperty.call(data, 'sameSite')) {
13
17
  if (!sameSite || !['strict', 'lax', 'none'].includes(sameSite)) {
14
18
  throw new Error('The sameSite value of cookieStorage must be "lax", "strict" or "none".');
15
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CookieStorage.mjs","sources":["../../../src/storage/CookieStorage.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport JsCookie from 'js-cookie';\nexport class CookieStorage {\n constructor(data = {}) {\n const { path, domain, expires, sameSite, secure } = data;\n this.domain = domain;\n this.path = path ? path : '/';\n this.expires = data.hasOwnProperty('expires') ? expires : 365;\n this.secure = data.hasOwnProperty('secure') ? secure : true;\n if (data.hasOwnProperty('sameSite')) {\n if (!sameSite || !['strict', 'lax', 'none'].includes(sameSite)) {\n throw new Error('The sameSite value of cookieStorage must be \"lax\", \"strict\" or \"none\".');\n }\n if (sameSite === 'none' && !this.secure) {\n throw new Error('sameSite = None requires the Secure attribute in latest browser versions.');\n }\n this.sameSite = sameSite;\n }\n }\n async setItem(key, value) {\n JsCookie.set(key, value, this.getData());\n }\n async getItem(key) {\n const item = JsCookie.get(key);\n return item ?? null;\n }\n async removeItem(key) {\n JsCookie.remove(key, this.getData());\n }\n async clear() {\n const cookie = JsCookie.get();\n const promises = Object.keys(cookie).map(key => this.removeItem(key));\n await Promise.all(promises);\n }\n getData() {\n return {\n path: this.path,\n expires: this.expires,\n domain: this.domain,\n secure: this.secure,\n ...(this.sameSite && { sameSite: this.sameSite }),\n };\n }\n}\n"],"names":[],"mappings":";;AAAA;AACA;AAEO,MAAM,aAAa,CAAC;AAC3B,IAAI,WAAW,CAAC,IAAI,GAAG,EAAE,EAAE;A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CAAC;AAC5B,KAAK;AACL,IAAI,MAAM,UAAU,CAAC,GAAG,EAAE;AAC1B,QAAQ,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;AAC7C,KAAK;AACL,IAAI,MAAM,KAAK,GAAG;AAClB,QAAQ,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC;AACtC,QAAQ,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;AAC9E,QAAQ,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AACpC,KAAK;AACL,IAAI,OAAO,GAAG;AACd,QAAQ,OAAO;AACf,YAAY,IAAI,EAAE,IAAI,CAAC,IAAI;AAC3B,YAAY,OAAO,EAAE,IAAI,CAAC,OAAO;AACjC,YAAY,MAAM,EAAE,IAAI,CAAC,MAAM;AAC/B,YAAY,MAAM,EAAE,IAAI,CAAC,MAAM;AAC/B,YAAY,IAAI,IAAI,CAAC,QAAQ,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE;AAC5D,SAAS,CAAC;AACV,KAAK;AACL;;;;"}
1
+ {"version":3,"file":"CookieStorage.mjs","sources":["../../../src/storage/CookieStorage.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport JsCookie from 'js-cookie';\nexport class CookieStorage {\n constructor(data = {}) {\n const { path, domain, expires, sameSite, secure } = data;\n this.domain = domain;\n this.path = path || '/';\n this.expires = Object.prototype.hasOwnProperty.call(data, 'expires')\n ? expires\n : 365;\n this.secure = Object.prototype.hasOwnProperty.call(data, 'secure')\n ? secure\n : true;\n if (Object.prototype.hasOwnProperty.call(data, 'sameSite')) {\n if (!sameSite || !['strict', 'lax', 'none'].includes(sameSite)) {\n throw new Error('The sameSite value of cookieStorage must be \"lax\", \"strict\" or \"none\".');\n }\n if (sameSite === 'none' && !this.secure) {\n throw new Error('sameSite = None requires the Secure attribute in latest browser versions.');\n }\n this.sameSite = sameSite;\n }\n }\n async setItem(key, value) {\n JsCookie.set(key, value, this.getData());\n }\n async getItem(key) {\n const item = JsCookie.get(key);\n return item ?? null;\n }\n async removeItem(key) {\n JsCookie.remove(key, this.getData());\n }\n async clear() {\n const cookie = JsCookie.get();\n const promises = Object.keys(cookie).map(key => this.removeItem(key));\n await Promise.all(promises);\n }\n getData() {\n return {\n path: this.path,\n expires: this.expires,\n domain: this.domain,\n secure: this.secure,\n ...(this.sameSite && { sameSite: this.sameSite }),\n };\n }\n}\n"],"names":[],"mappings":";;AAAA;AACA;AAEO,MAAM,aAAa,CAAC;AAC3B,IAAI,WAAW,CAAC,IAAI,GAAG,EAAE,EAAE;AAC3B,QAAQ,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;AACjE,QAAQ,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AAC7B,QAAQ,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,GAAG,CAAC;AAChC,QAAQ,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC;AAC5E,cAAc,OAAO;AACrB,cAAc,GAAG,CAAC;AAClB,QAAQ,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC;AAC1E,cAAc,MAAM;AACpB,cAAc,IAAI,CAAC;AACnB,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,EAAE;AACpE,YAAY,IAAI,CAAC,QAAQ,IAAI,CAAC,CAAC,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C,IAAI;AAC3B,YAAY,OAAO,EAAE,IAAI,CAAC,OAAO;AACjC,YAAY,MAAM,EAAE,IAAI,CAAC,MAAM;AAC/B,YAAY,MAAM,EAAE,IAAI,CAAC,MAAM;AAC/B,YAAY,IAAI,IAAI,CAAC,QAAQ,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE;AAC5D,SAAS,CAAC;AACV,KAAK;AACL;;;;"}
@@ -3,5 +3,4 @@ import { KeyValueStorage } from './KeyValueStorage';
3
3
  * @internal
4
4
  */
5
5
  export declare class CookieStorage extends KeyValueStorage {
6
- constructor();
7
6
  }
@@ -6,9 +6,6 @@ import { KeyValueStorage } from './KeyValueStorage.mjs';
6
6
  * @internal
7
7
  */
8
8
  class CookieStorage extends KeyValueStorage {
9
- constructor() {
10
- super();
11
- }
12
9
  }
13
10
 
14
11
  export { CookieStorage };
@@ -1 +1 @@
1
- {"version":3,"file":"CookieStorage.native.mjs","sources":["../../../src/storage/CookieStorage.native.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { KeyValueStorage } from './KeyValueStorage';\n/**\n * @internal\n */\nexport class CookieStorage extends KeyValueStorage {\n constructor() {\n super();\n }\n}\n"],"names":[],"mappings":";;AAAA;AACA;AAEA;AACA;AACA;AACO,MAAM,aAAa,SAAS,eAAe,CAAC;AACnD,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,EAAE,CAAC;AAChB,KAAK;AACL;;;;"}
1
+ {"version":3,"file":"CookieStorage.native.mjs","sources":["../../../src/storage/CookieStorage.native.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { KeyValueStorage } from './KeyValueStorage';\n/**\n * @internal\n */\nexport class CookieStorage extends KeyValueStorage {\n}\n"],"names":[],"mappings":";;AAAA;AACA;AAEA;AACA;AACA;AACO,MAAM,aAAa,SAAS,eAAe,CAAC;AACnD;;;;"}
@@ -11,7 +11,7 @@ export interface AmplifyConfig {
11
11
  };
12
12
  ssr?: boolean;
13
13
  }
14
- export type UserProfile = {
14
+ export interface UserProfile {
15
15
  customProperties?: Record<string, string[]>;
16
16
  demographic?: {
17
17
  appVersion?: string;
@@ -35,7 +35,7 @@ export type UserProfile = {
35
35
  metrics?: Record<string, number>;
36
36
  name?: string;
37
37
  plan?: string;
38
- };
38
+ }
39
39
  /**
40
40
  * @internal
41
41
  */