@aws-amplify/core 6.0.1-api-v6-models.9351bcf.0 → 6.0.1-api-v6-models.891fe0d.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 (360) hide show
  1. package/lib/BackgroundProcessManager/BackgroundManagerNotOpenError.js +4 -21
  2. package/lib/BackgroundProcessManager/BackgroundProcessManager.js +126 -245
  3. package/lib/Cache/StorageCache.js +32 -92
  4. package/lib/Cache/StorageCache.native.js +38 -140
  5. package/lib/Cache/StorageCacheCommon.js +271 -600
  6. package/lib/Cache/index.js +1 -1
  7. package/lib/Cache/utils/CacheList.js +42 -66
  8. package/lib/Cache/utils/cacheHelpers.js +6 -8
  9. package/lib/Cache/utils/errorHelpers.js +6 -7
  10. package/lib/Hub/index.js +34 -74
  11. package/lib/I18n/I18n.js +24 -39
  12. package/lib/I18n/errorHelpers.js +4 -5
  13. package/lib/I18n/index.js +24 -27
  14. package/lib/I18n/types.js +3 -4
  15. package/lib/Logger/ConsoleLogger.js +53 -129
  16. package/lib/Mutex/Mutex.js +15 -19
  17. package/lib/Platform/customUserAgent.js +13 -26
  18. package/lib/Platform/detectFramework.js +12 -13
  19. package/lib/Platform/detection/Angular.js +4 -5
  20. package/lib/Platform/detection/Expo.js +1 -1
  21. package/lib/Platform/detection/Next.js +1 -1
  22. package/lib/Platform/detection/Nuxt.js +1 -1
  23. package/lib/Platform/detection/React.js +5 -5
  24. package/lib/Platform/detection/Svelte.js +2 -2
  25. package/lib/Platform/detection/Vue.js +1 -1
  26. package/lib/Platform/detection/Web.js +1 -1
  27. package/lib/Platform/detection/helpers.js +7 -7
  28. package/lib/Platform/detection/index.js +13 -13
  29. package/lib/Platform/index.js +26 -55
  30. package/lib/Platform/types.d.ts +1 -1
  31. package/lib/Platform/types.js +1 -1
  32. package/lib/Platform/version.d.ts +1 -1
  33. package/lib/Platform/version.js +1 -1
  34. package/lib/Reachability/Reachability.js +20 -48
  35. package/lib/Reachability/Reachability.native.js +12 -16
  36. package/lib/ServiceWorker/ServiceWorker.js +80 -136
  37. package/lib/ServiceWorker/errorHelpers.js +6 -7
  38. package/lib/Signer/DateUtils.d.ts +9 -0
  39. package/lib/Signer/DateUtils.js +19 -28
  40. package/lib/Signer/Signer.d.ts +9 -0
  41. package/lib/Signer/Signer.js +58 -54
  42. package/lib/adapterCore/error/AmplifyServerContextError.js +9 -27
  43. package/lib/adapterCore/serverContext/serverContext.js +8 -8
  44. package/lib/adapterCore/serverContext/serverContextRegistry.js +6 -6
  45. package/lib/awsClients/cognitoIdentity/base.js +25 -73
  46. package/lib/awsClients/cognitoIdentity/getCredentialsForIdentity.js +24 -68
  47. package/lib/awsClients/cognitoIdentity/getId.js +19 -62
  48. package/lib/awsClients/pinpoint/base.js +12 -15
  49. package/lib/awsClients/pinpoint/errorHelpers.js +4 -5
  50. package/lib/awsClients/pinpoint/getInAppMessages.js +24 -68
  51. package/lib/awsClients/pinpoint/putEvents.js +26 -70
  52. package/lib/awsClients/pinpoint/updateEndpoint.js +28 -72
  53. package/lib/clients/endpoints/getDnsSuffix.js +7 -29
  54. package/lib/clients/handlers/authenticated.js +5 -5
  55. package/lib/clients/handlers/fetch.js +41 -98
  56. package/lib/clients/handlers/unauthenticated.js +4 -4
  57. package/lib/clients/internal/composeServiceApi.js +17 -67
  58. package/lib/clients/internal/composeTransferHandler.js +9 -11
  59. package/lib/clients/middleware/retry/defaultRetryDecider.js +18 -75
  60. package/lib/clients/middleware/retry/isClockSkewError.js +2 -4
  61. package/lib/clients/middleware/retry/jitteredBackoff.js +5 -5
  62. package/lib/clients/middleware/retry/middleware.js +61 -125
  63. package/lib/clients/middleware/signing/middleware.js +24 -86
  64. package/lib/clients/middleware/signing/signer/signatureV4/index.js +0 -1
  65. package/lib/clients/middleware/signing/signer/signatureV4/presignUrl.js +21 -56
  66. package/lib/clients/middleware/signing/signer/signatureV4/signRequest.js +14 -25
  67. package/lib/clients/middleware/signing/signer/signatureV4/utils/dataHashHelpers.js +7 -7
  68. package/lib/clients/middleware/signing/signer/signatureV4/utils/getCanonicalHeaders.js +8 -30
  69. package/lib/clients/middleware/signing/signer/signatureV4/utils/getCanonicalQueryString.js +11 -38
  70. package/lib/clients/middleware/signing/signer/signatureV4/utils/getCanonicalRequest.js +13 -17
  71. package/lib/clients/middleware/signing/signer/signatureV4/utils/getCanonicalUri.js +5 -8
  72. package/lib/clients/middleware/signing/signer/signatureV4/utils/getCredentialScope.js +2 -2
  73. package/lib/clients/middleware/signing/signer/signatureV4/utils/getFormattedDates.js +3 -3
  74. package/lib/clients/middleware/signing/signer/signatureV4/utils/getHashedPayload.js +7 -11
  75. package/lib/clients/middleware/signing/signer/signatureV4/utils/getSignature.js +9 -10
  76. package/lib/clients/middleware/signing/signer/signatureV4/utils/getSignedHeaders.js +4 -6
  77. package/lib/clients/middleware/signing/signer/signatureV4/utils/getSigningKey.js +8 -8
  78. package/lib/clients/middleware/signing/signer/signatureV4/utils/getSigningValues.js +15 -16
  79. package/lib/clients/middleware/signing/signer/signatureV4/utils/getStringToSign.js +2 -4
  80. package/lib/clients/middleware/signing/utils/extendedEncodeURIComponent.js +3 -5
  81. package/lib/clients/middleware/signing/utils/getSkewCorrectedDate.js +1 -3
  82. package/lib/clients/middleware/signing/utils/getUpdatedSystemClockOffset.js +2 -2
  83. package/lib/clients/middleware/signing/utils/isClockSkewed.js +4 -6
  84. package/lib/clients/middleware/userAgent/middleware.js +14 -63
  85. package/lib/clients/serde/json.js +30 -96
  86. package/lib/clients/serde/responseInfo.js +12 -18
  87. package/lib/clients/utils/memoization.js +3 -3
  88. package/lib/constants.js +1 -1
  89. package/lib/errors/AmplifyError.js +9 -28
  90. package/lib/errors/PlatformNotSupportedError.js +7 -24
  91. package/lib/errors/createAssertionFunction.js +12 -15
  92. package/lib/errors/errorHelpers.js +7 -8
  93. package/lib/index.d.ts +1 -1
  94. package/lib/libraryUtils.d.ts +4 -0
  95. package/lib/libraryUtils.js +13 -3
  96. package/lib/parseAWSExports.js +109 -100
  97. package/lib/providers/kinesis/types/kinesis.d.ts +1 -1
  98. package/lib/providers/kinesis-firehose/types/kinesis-firehose.d.ts +1 -1
  99. package/lib/providers/personalize/types/personalize.d.ts +1 -1
  100. package/lib/providers/pinpoint/apis/flushEvents.js +8 -8
  101. package/lib/providers/pinpoint/apis/record.js +58 -93
  102. package/lib/providers/pinpoint/apis/updateEndpoint.js +65 -112
  103. package/lib/providers/pinpoint/types/pinpoint.d.ts +3 -1
  104. package/lib/providers/pinpoint/utils/PinpointEventBuffer.js +105 -196
  105. package/lib/providers/pinpoint/utils/cacheEndpointId.js +12 -49
  106. package/lib/providers/pinpoint/utils/getCacheKey.js +2 -2
  107. package/lib/providers/pinpoint/utils/getEndpointId.js +7 -51
  108. package/lib/providers/pinpoint/utils/getEventBuffer.js +19 -21
  109. package/lib/providers/pinpoint/utils/isAppInForeground.js +1 -1
  110. package/lib/providers/pinpoint/utils/isAppInForeground.native.js +2 -2
  111. package/lib/providers/pinpoint/utils/resolveEndpointId.js +20 -71
  112. package/lib/singleton/Amplify.d.ts +4 -0
  113. package/lib/singleton/Amplify.js +21 -103
  114. package/lib/singleton/Analytics/types.d.ts +5 -1
  115. package/lib/singleton/Auth/index.js +48 -115
  116. package/lib/singleton/Auth/types.d.ts +2 -2
  117. package/lib/singleton/Auth/utils/errorHelpers.js +7 -8
  118. package/lib/singleton/Auth/utils/index.js +18 -19
  119. package/lib/singleton/Predictions/types.d.ts +49 -0
  120. package/lib/singleton/Predictions/types.js +4 -0
  121. package/lib/singleton/apis/clearCredentials.js +1 -1
  122. package/lib/singleton/apis/fetchAuthSession.js +3 -3
  123. package/lib/singleton/apis/internal/fetchAuthSession.js +1 -1
  124. package/lib/singleton/apis/server/fetchAuthSession.js +3 -3
  125. package/lib/singleton/types.d.ts +3 -1
  126. package/lib/storage/CookieStorage.js +29 -99
  127. package/lib/storage/CookieStorage.native.js +5 -22
  128. package/lib/storage/DefaultStorage.js +6 -23
  129. package/lib/storage/DefaultStorage.native.js +18 -64
  130. package/lib/storage/InMemoryStorage.js +17 -23
  131. package/lib/storage/KeyValueStorage.js +24 -80
  132. package/lib/storage/SessionStorage.js +6 -23
  133. package/lib/storage/index.js +4 -4
  134. package/lib/storage/utils.js +7 -11
  135. package/lib/tsconfig.tsbuildinfo +1 -1
  136. package/lib/utils/WordArray.d.ts +7 -0
  137. package/lib/utils/WordArray.js +49 -0
  138. package/lib/utils/amplifyUrl/index.js +2 -2
  139. package/lib/utils/amplifyUrl/polyfill.native.js +1 -1
  140. package/lib/utils/amplifyUuid/index.d.ts +1 -1
  141. package/lib/utils/amplifyUuid/index.js +2 -2
  142. package/lib/utils/amplifyUuid/polyfill.native.js +1 -1
  143. package/lib/utils/convert/base64/base64Decoder.js +2 -2
  144. package/lib/utils/convert/base64/base64Encoder.js +5 -6
  145. package/lib/utils/convert/base64/bytesToString.js +1 -1
  146. package/lib/utils/cryptoSecureRandomInt.d.ts +1 -0
  147. package/lib/utils/cryptoSecureRandomInt.js +16 -0
  148. package/lib/utils/deepFreeze.js +6 -28
  149. package/lib/utils/generateRandomString.js +4 -4
  150. package/lib/utils/getClientInfo/getClientInfo.android.js +7 -7
  151. package/lib/utils/getClientInfo/getClientInfo.ios.js +12 -12
  152. package/lib/utils/getClientInfo/getClientInfo.js +16 -16
  153. package/lib/utils/globalHelpers/index.js +4 -4
  154. package/lib/utils/globalHelpers/index.native.js +6 -6
  155. package/lib/utils/isBrowser.js +1 -3
  156. package/lib/utils/isWebWorker.js +2 -2
  157. package/lib/utils/retry/NonRetryableError.js +5 -23
  158. package/lib/utils/retry/isNonRetryableError.js +2 -2
  159. package/lib/utils/retry/jitteredBackoff.js +6 -7
  160. package/lib/utils/retry/jitteredExponentialRetry.js +4 -7
  161. package/lib/utils/retry/retry.js +50 -140
  162. package/lib/utils/sessionListener/SessionListener.js +17 -19
  163. package/lib/utils/sessionListener/SessionListener.native.js +18 -22
  164. package/lib/utils/sessionListener/constants.d.ts +2 -0
  165. package/lib/utils/sessionListener/constants.js +8 -0
  166. package/lib/utils/sessionListener/index.d.ts +1 -0
  167. package/lib/utils/sessionListener/index.js +5 -2
  168. package/lib/utils/urlSafeDecode.js +2 -2
  169. package/lib/utils/urlSafeEncode.js +1 -1
  170. package/lib-esm/BackgroundProcessManager/BackgroundManagerNotOpenError.js +4 -22
  171. package/lib-esm/BackgroundProcessManager/BackgroundProcessManager.js +124 -244
  172. package/lib-esm/Cache/StorageCache.js +26 -87
  173. package/lib-esm/Cache/StorageCache.native.js +33 -136
  174. package/lib-esm/Cache/StorageCacheCommon.js +267 -597
  175. package/lib-esm/Cache/constants.js +2 -2
  176. package/lib-esm/Cache/index.js +1 -1
  177. package/lib-esm/Cache/utils/CacheList.js +41 -66
  178. package/lib-esm/Cache/utils/cacheHelpers.js +5 -7
  179. package/lib-esm/Cache/utils/errorHelpers.js +6 -7
  180. package/lib-esm/Hub/index.js +34 -75
  181. package/lib-esm/I18n/I18n.js +23 -39
  182. package/lib-esm/I18n/errorHelpers.js +4 -5
  183. package/lib-esm/I18n/index.js +21 -25
  184. package/lib-esm/I18n/types.js +3 -5
  185. package/lib-esm/Logger/ConsoleLogger.js +52 -128
  186. package/lib-esm/Mutex/Mutex.js +15 -20
  187. package/lib-esm/Platform/customUserAgent.js +13 -26
  188. package/lib-esm/Platform/detectFramework.js +11 -12
  189. package/lib-esm/Platform/detection/Angular.js +3 -4
  190. package/lib-esm/Platform/detection/React.js +4 -4
  191. package/lib-esm/Platform/detection/Svelte.js +1 -1
  192. package/lib-esm/Platform/detection/helpers.js +7 -7
  193. package/lib-esm/Platform/detection/index.js +3 -3
  194. package/lib-esm/Platform/index.js +23 -52
  195. package/lib-esm/Platform/types.d.ts +1 -1
  196. package/lib-esm/Platform/types.js +1 -1
  197. package/lib-esm/Platform/version.d.ts +1 -1
  198. package/lib-esm/Platform/version.js +1 -1
  199. package/lib-esm/Reachability/Reachability.js +18 -46
  200. package/lib-esm/Reachability/Reachability.native.js +10 -15
  201. package/lib-esm/ServiceWorker/ServiceWorker.js +74 -131
  202. package/lib-esm/ServiceWorker/errorHelpers.js +6 -7
  203. package/lib-esm/Signer/DateUtils.d.ts +9 -0
  204. package/lib-esm/Signer/DateUtils.js +20 -29
  205. package/lib-esm/Signer/Signer.d.ts +9 -0
  206. package/lib-esm/Signer/Signer.js +54 -51
  207. package/lib-esm/adapterCore/error/AmplifyServerContextError.js +8 -27
  208. package/lib-esm/adapterCore/serverContext/serverContext.js +6 -6
  209. package/lib-esm/adapterCore/serverContext/serverContextRegistry.js +7 -7
  210. package/lib-esm/awsClients/cognitoIdentity/base.js +21 -69
  211. package/lib-esm/awsClients/cognitoIdentity/getCredentialsForIdentity.js +22 -66
  212. package/lib-esm/awsClients/cognitoIdentity/getId.js +17 -60
  213. package/lib-esm/awsClients/pinpoint/base.js +8 -11
  214. package/lib-esm/awsClients/pinpoint/errorHelpers.js +4 -5
  215. package/lib-esm/awsClients/pinpoint/getInAppMessages.js +19 -63
  216. package/lib-esm/awsClients/pinpoint/putEvents.js +20 -64
  217. package/lib-esm/awsClients/pinpoint/updateEndpoint.js +23 -67
  218. package/lib-esm/clients/endpoints/getDnsSuffix.js +6 -28
  219. package/lib-esm/clients/endpoints/partitions.js +2 -2
  220. package/lib-esm/clients/handlers/authenticated.js +1 -1
  221. package/lib-esm/clients/handlers/fetch.js +40 -97
  222. package/lib-esm/clients/handlers/unauthenticated.js +1 -1
  223. package/lib-esm/clients/internal/composeServiceApi.js +17 -67
  224. package/lib-esm/clients/internal/composeTransferHandler.js +9 -11
  225. package/lib-esm/clients/middleware/retry/defaultRetryDecider.js +17 -74
  226. package/lib-esm/clients/middleware/retry/isClockSkewError.js +2 -4
  227. package/lib-esm/clients/middleware/retry/jitteredBackoff.js +4 -4
  228. package/lib-esm/clients/middleware/retry/middleware.js +61 -125
  229. package/lib-esm/clients/middleware/signing/middleware.js +21 -83
  230. package/lib-esm/clients/middleware/signing/signer/signatureV4/constants.js +17 -17
  231. package/lib-esm/clients/middleware/signing/signer/signatureV4/index.js +0 -1
  232. package/lib-esm/clients/middleware/signing/signer/signatureV4/presignUrl.js +17 -52
  233. package/lib-esm/clients/middleware/signing/signer/signatureV4/signRequest.js +10 -21
  234. package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/dataHashHelpers.js +5 -5
  235. package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getCanonicalHeaders.js +8 -30
  236. package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getCanonicalQueryString.js +11 -38
  237. package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getCanonicalRequest.js +8 -12
  238. package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getCanonicalUri.js +5 -8
  239. package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getCredentialScope.js +1 -1
  240. package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getFormattedDates.js +3 -3
  241. package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getHashedPayload.js +5 -9
  242. package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getSignature.js +5 -6
  243. package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getSignedHeaders.js +4 -6
  244. package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getSigningKey.js +6 -6
  245. package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getSigningValues.js +13 -14
  246. package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getStringToSign.js +1 -3
  247. package/lib-esm/clients/middleware/signing/utils/extendedEncodeURIComponent.js +3 -5
  248. package/lib-esm/clients/middleware/signing/utils/getSkewCorrectedDate.js +1 -3
  249. package/lib-esm/clients/middleware/signing/utils/getUpdatedSystemClockOffset.js +1 -1
  250. package/lib-esm/clients/middleware/signing/utils/isClockSkewed.js +3 -5
  251. package/lib-esm/clients/middleware/userAgent/middleware.js +14 -63
  252. package/lib-esm/clients/serde/json.js +29 -95
  253. package/lib-esm/clients/serde/responseInfo.js +11 -17
  254. package/lib-esm/clients/utils/memoization.js +3 -3
  255. package/lib-esm/constants.js +5 -5
  256. package/lib-esm/errors/AmplifyError.js +9 -29
  257. package/lib-esm/errors/PlatformNotSupportedError.js +5 -23
  258. package/lib-esm/errors/createAssertionFunction.js +11 -14
  259. package/lib-esm/errors/errorHelpers.js +6 -7
  260. package/lib-esm/index.d.ts +1 -1
  261. package/lib-esm/libraryUtils.d.ts +4 -0
  262. package/lib-esm/libraryUtils.js +4 -0
  263. package/lib-esm/parseAWSExports.js +108 -99
  264. package/lib-esm/providers/kinesis/types/kinesis.d.ts +1 -1
  265. package/lib-esm/providers/kinesis-firehose/types/kinesis-firehose.d.ts +1 -1
  266. package/lib-esm/providers/personalize/types/personalize.d.ts +1 -1
  267. package/lib-esm/providers/pinpoint/apis/flushEvents.js +6 -6
  268. package/lib-esm/providers/pinpoint/apis/record.js +54 -89
  269. package/lib-esm/providers/pinpoint/apis/updateEndpoint.js +61 -108
  270. package/lib-esm/providers/pinpoint/types/pinpoint.d.ts +3 -1
  271. package/lib-esm/providers/pinpoint/utils/PinpointEventBuffer.js +102 -194
  272. package/lib-esm/providers/pinpoint/utils/cacheEndpointId.js +10 -47
  273. package/lib-esm/providers/pinpoint/utils/constants.js +4 -4
  274. package/lib-esm/providers/pinpoint/utils/getCacheKey.js +2 -2
  275. package/lib-esm/providers/pinpoint/utils/getEndpointId.js +5 -49
  276. package/lib-esm/providers/pinpoint/utils/getEventBuffer.js +17 -19
  277. package/lib-esm/providers/pinpoint/utils/isAppInForeground.js +1 -1
  278. package/lib-esm/providers/pinpoint/utils/isAppInForeground.native.js +1 -1
  279. package/lib-esm/providers/pinpoint/utils/resolveEndpointId.js +16 -67
  280. package/lib-esm/singleton/Amplify.d.ts +4 -0
  281. package/lib-esm/singleton/Amplify.js +18 -101
  282. package/lib-esm/singleton/Analytics/types.d.ts +5 -1
  283. package/lib-esm/singleton/Auth/index.js +48 -116
  284. package/lib-esm/singleton/Auth/types.d.ts +2 -2
  285. package/lib-esm/singleton/Auth/utils/errorHelpers.js +7 -8
  286. package/lib-esm/singleton/Auth/utils/index.js +16 -17
  287. package/lib-esm/singleton/Predictions/types.d.ts +49 -0
  288. package/lib-esm/singleton/Predictions/types.js +3 -0
  289. package/lib-esm/singleton/apis/fetchAuthSession.js +1 -1
  290. package/lib-esm/singleton/apis/internal/fetchAuthSession.js +1 -1
  291. package/lib-esm/singleton/apis/server/fetchAuthSession.js +1 -1
  292. package/lib-esm/singleton/types.d.ts +3 -1
  293. package/lib-esm/storage/CookieStorage.js +28 -99
  294. package/lib-esm/storage/CookieStorage.native.js +4 -22
  295. package/lib-esm/storage/DefaultStorage.js +4 -22
  296. package/lib-esm/storage/DefaultStorage.native.js +17 -64
  297. package/lib-esm/storage/InMemoryStorage.js +17 -24
  298. package/lib-esm/storage/KeyValueStorage.js +23 -80
  299. package/lib-esm/storage/SessionStorage.js +4 -22
  300. package/lib-esm/storage/index.js +3 -3
  301. package/lib-esm/storage/utils.js +6 -10
  302. package/lib-esm/tsconfig.tsbuildinfo +1 -1
  303. package/lib-esm/utils/WordArray.d.ts +7 -0
  304. package/lib-esm/utils/WordArray.js +46 -0
  305. package/lib-esm/utils/amplifyUrl/index.js +2 -2
  306. package/lib-esm/utils/amplifyUuid/index.d.ts +1 -1
  307. package/lib-esm/utils/amplifyUuid/index.js +1 -1
  308. package/lib-esm/utils/convert/base64/base64Decoder.js +2 -2
  309. package/lib-esm/utils/convert/base64/base64Encoder.js +4 -5
  310. package/lib-esm/utils/convert/base64/bytesToString.js +1 -1
  311. package/lib-esm/utils/cryptoSecureRandomInt.d.ts +1 -0
  312. package/lib-esm/utils/cryptoSecureRandomInt.js +12 -0
  313. package/lib-esm/utils/deepFreeze.js +6 -28
  314. package/lib-esm/utils/generateRandomString.js +4 -4
  315. package/lib-esm/utils/getClientInfo/getClientInfo.android.js +5 -5
  316. package/lib-esm/utils/getClientInfo/getClientInfo.ios.js +10 -10
  317. package/lib-esm/utils/getClientInfo/getClientInfo.js +15 -15
  318. package/lib-esm/utils/globalHelpers/index.js +3 -3
  319. package/lib-esm/utils/globalHelpers/index.native.js +4 -4
  320. package/lib-esm/utils/isBrowser.js +1 -3
  321. package/lib-esm/utils/isWebWorker.js +2 -2
  322. package/lib-esm/utils/retry/NonRetryableError.js +5 -24
  323. package/lib-esm/utils/retry/constants.js +1 -1
  324. package/lib-esm/utils/retry/isNonRetryableError.js +2 -2
  325. package/lib-esm/utils/retry/jitteredBackoff.js +5 -6
  326. package/lib-esm/utils/retry/jitteredExponentialRetry.js +1 -4
  327. package/lib-esm/utils/retry/retry.js +48 -138
  328. package/lib-esm/utils/sessionListener/SessionListener.js +16 -19
  329. package/lib-esm/utils/sessionListener/SessionListener.native.js +17 -22
  330. package/lib-esm/utils/sessionListener/constants.d.ts +2 -0
  331. package/lib-esm/utils/sessionListener/constants.js +5 -0
  332. package/lib-esm/utils/sessionListener/index.d.ts +1 -0
  333. package/lib-esm/utils/sessionListener/index.js +2 -1
  334. package/lib-esm/utils/urlSafeDecode.js +2 -2
  335. package/lib-esm/utils/urlSafeEncode.js +1 -1
  336. package/package.json +11 -24
  337. package/src/Cache/types/index.ts +4 -4
  338. package/src/Platform/types.ts +1 -1
  339. package/src/Platform/version.ts +1 -1
  340. package/src/Signer/DateUtils.ts +10 -2
  341. package/src/Signer/Signer.ts +9 -2
  342. package/src/clients/middleware/signing/signer/signatureV4/index.ts +0 -1
  343. package/src/index.ts +1 -0
  344. package/src/libraryUtils.ts +7 -1
  345. package/src/parseAWSExports.ts +45 -6
  346. package/src/providers/kinesis/types/kinesis.ts +1 -1
  347. package/src/providers/kinesis-firehose/types/kinesis-firehose.ts +1 -1
  348. package/src/providers/personalize/types/personalize.ts +1 -1
  349. package/src/providers/pinpoint/apis/record.ts +22 -5
  350. package/src/providers/pinpoint/types/pinpoint.ts +3 -1
  351. package/src/singleton/Amplify.ts +9 -52
  352. package/src/singleton/Analytics/types.ts +9 -4
  353. package/src/singleton/Auth/types.ts +2 -2
  354. package/src/singleton/Predictions/types.ts +61 -0
  355. package/src/singleton/types.ts +3 -1
  356. package/src/utils/WordArray.ts +57 -0
  357. package/src/utils/amplifyUuid/index.ts +1 -1
  358. package/src/utils/cryptoSecureRandomInt.ts +14 -0
  359. package/src/utils/sessionListener/constants.ts +6 -0
  360. package/src/utils/sessionListener/index.ts +1 -0
@@ -1,28 +1,11 @@
1
1
  "use strict";
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
- var __extends = (this && this.__extends) || (function () {
5
- var extendStatics = function (d, b) {
6
- extendStatics = Object.setPrototypeOf ||
7
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
8
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
9
- return extendStatics(d, b);
10
- };
11
- return function (d, b) {
12
- if (typeof b !== "function" && b !== null)
13
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
14
- extendStatics(d, b);
15
- function __() { this.constructor = d; }
16
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
17
- };
18
- })();
19
4
  Object.defineProperty(exports, "__esModule", { value: true });
20
5
  exports.BackgroundManagerNotOpenError = void 0;
21
- var BackgroundManagerNotOpenError = /** @class */ (function (_super) {
22
- __extends(BackgroundManagerNotOpenError, _super);
23
- function BackgroundManagerNotOpenError(message) {
24
- return _super.call(this, "BackgroundManagerNotOpenError: ".concat(message)) || this;
6
+ class BackgroundManagerNotOpenError extends Error {
7
+ constructor(message) {
8
+ super(`BackgroundManagerNotOpenError: ${message}`);
25
9
  }
26
- return BackgroundManagerNotOpenError;
27
- }(Error));
10
+ }
28
11
  exports.BackgroundManagerNotOpenError = BackgroundManagerNotOpenError;
@@ -1,57 +1,10 @@
1
1
  "use strict";
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
5
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
6
- return new (P || (P = Promise))(function (resolve, reject) {
7
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
8
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
9
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
10
- step((generator = generator.apply(thisArg, _arguments || [])).next());
11
- });
12
- };
13
- var __generator = (this && this.__generator) || function (thisArg, body) {
14
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
15
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
16
- function verb(n) { return function (v) { return step([n, v]); }; }
17
- function step(op) {
18
- if (f) throw new TypeError("Generator is already executing.");
19
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
20
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
21
- if (y = 0, t) op = [op[0] & 2, t.value];
22
- switch (op[0]) {
23
- case 0: case 1: t = op; break;
24
- case 4: _.label++; return { value: op[1], done: false };
25
- case 5: _.label++; y = op[1]; op = [0]; continue;
26
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
27
- default:
28
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
29
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
30
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
31
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
32
- if (t[2]) _.ops.pop();
33
- _.trys.pop(); continue;
34
- }
35
- op = body.call(thisArg, _);
36
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
37
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
38
- }
39
- };
40
- var __values = (this && this.__values) || function(o) {
41
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
42
- if (m) return m.call(o);
43
- if (o && typeof o.length === "number") return {
44
- next: function () {
45
- if (o && i >= o.length) o = void 0;
46
- return { value: o && o[i++], done: !o };
47
- }
48
- };
49
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
50
- };
51
4
  Object.defineProperty(exports, "__esModule", { value: true });
52
5
  exports.BackgroundProcessManager = void 0;
53
- var BackgroundManagerNotOpenError_1 = require("./BackgroundManagerNotOpenError");
54
- var types_1 = require("./types");
6
+ const BackgroundManagerNotOpenError_1 = require("./BackgroundManagerNotOpenError");
7
+ const types_1 = require("./types");
55
8
  /**
56
9
  * @private For internal Amplify use.
57
10
  *
@@ -62,13 +15,13 @@ var types_1 = require("./types");
62
15
  * As work completes on its own prior to close, the manager removes them
63
16
  * from the registry to avoid holding references to completed jobs.
64
17
  */
65
- var BackgroundProcessManager = /** @class */ (function () {
18
+ class BackgroundProcessManager {
66
19
  /**
67
20
  * Creates a new manager for promises, observables, and other types
68
21
  * of work that may be running in the background. This manager provides
69
22
  * a centralized mechanism to request termination and await completion.
70
23
  */
71
- function BackgroundProcessManager() {
24
+ constructor() {
72
25
  /**
73
26
  * A string indicating whether the manager is accepting new work ("Open"),
74
27
  * waiting for work to complete ("Closing"), or fully done with all
@@ -80,9 +33,9 @@ var BackgroundProcessManager = /** @class */ (function () {
80
33
  */
81
34
  this.jobs = new Set();
82
35
  }
83
- BackgroundProcessManager.prototype.add = function (jobOrDescription, optionalDescription) {
84
- var job;
85
- var description;
36
+ add(jobOrDescription, optionalDescription) {
37
+ let job;
38
+ let description;
86
39
  if (typeof jobOrDescription === 'string') {
87
40
  job = undefined;
88
41
  description = jobOrDescription;
@@ -91,7 +44,7 @@ var BackgroundProcessManager = /** @class */ (function () {
91
44
  job = jobOrDescription;
92
45
  description = optionalDescription;
93
46
  }
94
- var error = this.closedFailure(description);
47
+ const error = this.closedFailure(description);
95
48
  if (error)
96
49
  return error;
97
50
  if (job === undefined) {
@@ -106,7 +59,7 @@ var BackgroundProcessManager = /** @class */ (function () {
106
59
  else {
107
60
  throw new Error('If `job` is provided, it must be an Observable, Function, or BackgroundProcessManager.');
108
61
  }
109
- };
62
+ }
110
63
  /**
111
64
  * Adds a **cleaner** function that doesn't immediately get executed.
112
65
  * Instead, the caller gets a **terminate** function back. The *cleaner* is
@@ -117,51 +70,37 @@ var BackgroundProcessManager = /** @class */ (function () {
117
70
  * @param description Optional description to help identify pending jobs.
118
71
  * @returns A terminate function.
119
72
  */
120
- BackgroundProcessManager.prototype.addCleaner = function (clean, description) {
121
- var _this = this;
122
- var _a = this.addHook(description), resolve = _a.resolve, onTerminate = _a.onTerminate;
123
- var proxy = function () { return __awaiter(_this, void 0, void 0, function () {
124
- return __generator(this, function (_a) {
125
- switch (_a.label) {
126
- case 0: return [4 /*yield*/, clean()];
127
- case 1:
128
- _a.sent();
129
- resolve();
130
- return [2 /*return*/];
131
- }
132
- });
133
- }); };
73
+ addCleaner(clean, description) {
74
+ const { resolve, onTerminate } = this.addHook(description);
75
+ const proxy = async () => {
76
+ await clean();
77
+ resolve();
78
+ };
134
79
  onTerminate.then(proxy);
135
80
  return proxy;
136
- };
137
- BackgroundProcessManager.prototype.addFunction = function (job, description) {
81
+ }
82
+ addFunction(job, description) {
138
83
  // the function we call when we want to try to terminate this job.
139
- var terminate;
84
+ let terminate;
140
85
  // the promise the job can opt into listening to for termination.
141
- var onTerminate = new Promise(function (resolve) {
86
+ const onTerminate = new Promise(resolve => {
142
87
  terminate = resolve;
143
88
  });
144
89
  // finally! start the job.
145
- var jobResult = job(onTerminate);
90
+ const jobResult = job(onTerminate);
146
91
  // depending on what the job gives back, register the result
147
92
  // so we can monitor for completion.
148
- if (typeof (jobResult === null || jobResult === void 0 ? void 0 : jobResult.then) === 'function') {
93
+ if (typeof jobResult?.then === 'function') {
149
94
  this.registerPromise(jobResult, terminate, description);
150
95
  }
151
96
  // At the end of the day, or you know, method call, it doesn't matter
152
97
  // what the return value is at all; we just pass it through to the
153
98
  // caller.
154
99
  return jobResult;
155
- };
156
- BackgroundProcessManager.prototype.addManager = function (manager, description) {
157
- var _this = this;
158
- this.addCleaner(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
159
- switch (_a.label) {
160
- case 0: return [4 /*yield*/, manager.close()];
161
- case 1: return [2 /*return*/, _a.sent()];
162
- }
163
- }); }); }, description);
164
- };
100
+ }
101
+ addManager(manager, description) {
102
+ this.addCleaner(async () => await manager.close(), description);
103
+ }
165
104
  /**
166
105
  * Creates and registers a fabricated job for processes that need to operate
167
106
  * with callbacks/hooks. The returned `resolve` and `reject`
@@ -172,30 +111,30 @@ var BackgroundProcessManager = /** @class */ (function () {
172
111
  * @param description Optional description to help identify pending jobs.
173
112
  * @returns `{ resolve, reject, onTerminate }`
174
113
  */
175
- BackgroundProcessManager.prototype.addHook = function (description) {
114
+ addHook(description) {
176
115
  // the resolve/reject functions we'll provide to the caller to signal
177
116
  // the state of the job.
178
- var resolve;
179
- var reject;
117
+ let resolve;
118
+ let reject;
180
119
  // the underlying promise we'll use to manage it, pretty much like
181
120
  // any other promise.
182
- var promise = new Promise(function (res, rej) {
121
+ const promise = new Promise((res, rej) => {
183
122
  resolve = res;
184
123
  reject = rej;
185
124
  });
186
125
  // the function we call when we want to try to terminate this job.
187
- var terminate;
126
+ let terminate;
188
127
  // the promise the job can opt into listening to for termination.
189
- var onTerminate = new Promise(function (resolveTerminate) {
128
+ const onTerminate = new Promise(resolveTerminate => {
190
129
  terminate = resolveTerminate;
191
130
  });
192
131
  this.registerPromise(promise, terminate, description);
193
132
  return {
194
- resolve: resolve,
195
- reject: reject,
196
- onTerminate: onTerminate,
133
+ resolve,
134
+ reject,
135
+ onTerminate,
197
136
  };
198
- };
137
+ }
199
138
  /**
200
139
  * Adds a Promise based job to the list of jobs for monitoring and listens
201
140
  * for either a success or failure, upon which the job is considered "done"
@@ -207,9 +146,8 @@ var BackgroundProcessManager = /** @class */ (function () {
207
146
  * invoked to request the job stop.
208
147
  * @param description Optional description to help identify pending jobs.
209
148
  */
210
- BackgroundProcessManager.prototype.registerPromise = function (promise, terminate, description) {
211
- var _this = this;
212
- var jobEntry = { promise: promise, terminate: terminate, description: description };
149
+ registerPromise(promise, terminate, description) {
150
+ const jobEntry = { promise, terminate, description };
213
151
  this.jobs.add(jobEntry);
214
152
  // in all of my testing, it is safe to multi-subscribe to a promise.
215
153
  // so, rather than create another layer of promising, we're just going
@@ -222,97 +160,73 @@ var BackgroundProcessManager = /** @class */ (function () {
222
160
  // `.finally` is invoked in a different order in the sequence, and this
223
161
  // breaks assumptions throughout and causes failures.
224
162
  promise
225
- .then(function () {
226
- _this.jobs.delete(jobEntry);
163
+ .then(() => {
164
+ this.jobs.delete(jobEntry);
227
165
  })
228
- .catch(function () {
229
- _this.jobs.delete(jobEntry);
166
+ .catch(() => {
167
+ this.jobs.delete(jobEntry);
230
168
  });
231
- };
232
- Object.defineProperty(BackgroundProcessManager.prototype, "length", {
233
- /**
234
- * The number of jobs being waited on.
235
- *
236
- * We don't use this for anything. It's just informational for the caller,
237
- * and can be used in logging and testing.
238
- *
239
- * @returns the number of jobs.
240
- */
241
- get: function () {
242
- return this.jobs.size;
243
- },
244
- enumerable: false,
245
- configurable: true
246
- });
247
- Object.defineProperty(BackgroundProcessManager.prototype, "state", {
248
- /**
249
- * The execution state of the manager. One of:
250
- *
251
- * 1. "Open" -> Accepting new jobs
252
- * 1. "Closing" -> Not accepting new work. Waiting for jobs to complete.
253
- * 1. "Closed" -> Not accepting new work. All submitted jobs are complete.
254
- */
255
- get: function () {
256
- return this._state;
257
- },
258
- enumerable: false,
259
- configurable: true
260
- });
261
- Object.defineProperty(BackgroundProcessManager.prototype, "pending", {
262
- /**
263
- * The registered `description` of all still-pending jobs.
264
- *
265
- * @returns descriptions as an array.
266
- */
267
- get: function () {
268
- return Array.from(this.jobs).map(function (job) { return job.description; });
269
- },
270
- enumerable: false,
271
- configurable: true
272
- });
273
- Object.defineProperty(BackgroundProcessManager.prototype, "isOpen", {
274
- /**
275
- * Whether the manager is accepting new jobs.
276
- */
277
- get: function () {
278
- return this._state === types_1.BackgroundProcessManagerState.Open;
279
- },
280
- enumerable: false,
281
- configurable: true
282
- });
283
- Object.defineProperty(BackgroundProcessManager.prototype, "isClosing", {
284
- /**
285
- * Whether the manager is rejecting new work, but still waiting for
286
- * submitted work to complete.
287
- */
288
- get: function () {
289
- return this._state === types_1.BackgroundProcessManagerState.Closing;
290
- },
291
- enumerable: false,
292
- configurable: true
293
- });
294
- Object.defineProperty(BackgroundProcessManager.prototype, "isClosed", {
295
- /**
296
- * Whether the manager is rejecting work and done waiting for submitted
297
- * work to complete.
298
- */
299
- get: function () {
300
- return this._state === types_1.BackgroundProcessManagerState.Closed;
301
- },
302
- enumerable: false,
303
- configurable: true
304
- });
305
- BackgroundProcessManager.prototype.closedFailure = function (description) {
169
+ }
170
+ /**
171
+ * The number of jobs being waited on.
172
+ *
173
+ * We don't use this for anything. It's just informational for the caller,
174
+ * and can be used in logging and testing.
175
+ *
176
+ * @returns the number of jobs.
177
+ */
178
+ get length() {
179
+ return this.jobs.size;
180
+ }
181
+ /**
182
+ * The execution state of the manager. One of:
183
+ *
184
+ * 1. "Open" -> Accepting new jobs
185
+ * 1. "Closing" -> Not accepting new work. Waiting for jobs to complete.
186
+ * 1. "Closed" -> Not accepting new work. All submitted jobs are complete.
187
+ */
188
+ get state() {
189
+ return this._state;
190
+ }
191
+ /**
192
+ * The registered `description` of all still-pending jobs.
193
+ *
194
+ * @returns descriptions as an array.
195
+ */
196
+ get pending() {
197
+ return Array.from(this.jobs).map(job => job.description);
198
+ }
199
+ /**
200
+ * Whether the manager is accepting new jobs.
201
+ */
202
+ get isOpen() {
203
+ return this._state === types_1.BackgroundProcessManagerState.Open;
204
+ }
205
+ /**
206
+ * Whether the manager is rejecting new work, but still waiting for
207
+ * submitted work to complete.
208
+ */
209
+ get isClosing() {
210
+ return this._state === types_1.BackgroundProcessManagerState.Closing;
211
+ }
212
+ /**
213
+ * Whether the manager is rejecting work and done waiting for submitted
214
+ * work to complete.
215
+ */
216
+ get isClosed() {
217
+ return this._state === types_1.BackgroundProcessManagerState.Closed;
218
+ }
219
+ closedFailure(description) {
306
220
  if (!this.isOpen) {
307
221
  return Promise.reject(new BackgroundManagerNotOpenError_1.BackgroundManagerNotOpenError([
308
- "The manager is ".concat(this.state, "."),
309
- "You tried to add \"".concat(description, "\"."),
310
- "Pending jobs: [\n".concat(this.pending
311
- .map(function (t) { return ' ' + t; })
312
- .join(',\n'), "\n]"),
222
+ `The manager is ${this.state}.`,
223
+ `You tried to add "${description}".`,
224
+ `Pending jobs: [\n${this.pending
225
+ .map(t => ' ' + t)
226
+ .join(',\n')}\n]`,
313
227
  ].join('\n')));
314
228
  }
315
- };
229
+ }
316
230
  /**
317
231
  * Signals jobs to stop (for those that accept interruptions) and waits
318
232
  * for confirmation that jobs have stopped.
@@ -330,49 +244,28 @@ var BackgroundProcessManager = /** @class */ (function () {
330
244
  * manager is already closed, this will contain the results as of when the
331
245
  * manager's `close()` was called in an `Open` state.
332
246
  */
333
- BackgroundProcessManager.prototype.close = function () {
334
- return __awaiter(this, void 0, void 0, function () {
335
- var _a, _b, job;
336
- var e_1, _c;
337
- return __generator(this, function (_d) {
338
- switch (_d.label) {
339
- case 0:
340
- if (!this.isOpen) return [3 /*break*/, 2];
341
- this._state = types_1.BackgroundProcessManagerState.Closing;
342
- try {
343
- for (_a = __values(Array.from(this.jobs)), _b = _a.next(); !_b.done; _b = _a.next()) {
344
- job = _b.value;
345
- try {
346
- job.terminate();
347
- }
348
- catch (error) {
349
- // Due to potential races with a job's natural completion, it's
350
- // reasonable to expect the termination call to fail. Hence,
351
- // not logging as an error.
352
- console.warn("Failed to send termination signal to job. Error: ".concat(error.message), job);
353
- }
354
- }
355
- }
356
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
357
- finally {
358
- try {
359
- if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
360
- }
361
- finally { if (e_1) throw e_1.error; }
362
- }
363
- // Use `allSettled()` because we want to wait for all to finish. We do
364
- // not want to stop waiting if there is a failure.
365
- this._closingPromise = Promise.allSettled(Array.from(this.jobs).map(function (j) { return j.promise; }));
366
- return [4 /*yield*/, this._closingPromise];
367
- case 1:
368
- _d.sent();
369
- this._state = types_1.BackgroundProcessManagerState.Closed;
370
- _d.label = 2;
371
- case 2: return [2 /*return*/, this._closingPromise];
247
+ async close() {
248
+ if (this.isOpen) {
249
+ this._state = types_1.BackgroundProcessManagerState.Closing;
250
+ for (const job of Array.from(this.jobs)) {
251
+ try {
252
+ job.terminate();
372
253
  }
373
- });
374
- });
375
- };
254
+ catch (error) {
255
+ // Due to potential races with a job's natural completion, it's
256
+ // reasonable to expect the termination call to fail. Hence,
257
+ // not logging as an error.
258
+ console.warn(`Failed to send termination signal to job. Error: ${error.message}`, job);
259
+ }
260
+ }
261
+ // Use `allSettled()` because we want to wait for all to finish. We do
262
+ // not want to stop waiting if there is a failure.
263
+ this._closingPromise = Promise.allSettled(Array.from(this.jobs).map(j => j.promise));
264
+ await this._closingPromise;
265
+ this._state = types_1.BackgroundProcessManagerState.Closed;
266
+ }
267
+ return this._closingPromise;
268
+ }
376
269
  /**
377
270
  * Signals the manager to start accepting work (again) and returns once
378
271
  * the manager is ready to do so.
@@ -384,23 +277,11 @@ var BackgroundProcessManager = /** @class */ (function () {
384
277
  * If the state is `Closing`, this call waits for completion before it
385
278
  * updates the state and returns.
386
279
  */
387
- BackgroundProcessManager.prototype.open = function () {
388
- return __awaiter(this, void 0, void 0, function () {
389
- return __generator(this, function (_a) {
390
- switch (_a.label) {
391
- case 0:
392
- if (!this.isClosing) return [3 /*break*/, 2];
393
- return [4 /*yield*/, this.close()];
394
- case 1:
395
- _a.sent();
396
- _a.label = 2;
397
- case 2:
398
- this._state = types_1.BackgroundProcessManagerState.Open;
399
- return [2 /*return*/];
400
- }
401
- });
402
- });
403
- };
404
- return BackgroundProcessManager;
405
- }());
280
+ async open() {
281
+ if (this.isClosing) {
282
+ await this.close();
283
+ }
284
+ this._state = types_1.BackgroundProcessManagerState.Open;
285
+ }
286
+ }
406
287
  exports.BackgroundProcessManager = BackgroundProcessManager;