@aws-amplify/core 6.0.1-api-v6-models.9351bcf.0 → 6.0.1-api-v6-models.58f2536.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.
- package/lib/BackgroundProcessManager/BackgroundManagerNotOpenError.js +4 -21
- package/lib/BackgroundProcessManager/BackgroundProcessManager.js +126 -245
- package/lib/Cache/StorageCache.js +32 -92
- package/lib/Cache/StorageCache.native.js +38 -140
- package/lib/Cache/StorageCacheCommon.js +271 -600
- package/lib/Cache/index.js +1 -1
- package/lib/Cache/utils/CacheList.js +42 -66
- package/lib/Cache/utils/cacheHelpers.js +6 -8
- package/lib/Cache/utils/errorHelpers.js +6 -7
- package/lib/Hub/index.js +34 -74
- package/lib/I18n/I18n.js +24 -39
- package/lib/I18n/errorHelpers.js +4 -5
- package/lib/I18n/index.js +24 -27
- package/lib/I18n/types.js +3 -4
- package/lib/Logger/ConsoleLogger.js +53 -129
- package/lib/Mutex/Mutex.js +15 -19
- package/lib/Platform/customUserAgent.js +13 -26
- package/lib/Platform/detectFramework.js +12 -13
- package/lib/Platform/detection/Angular.js +4 -5
- package/lib/Platform/detection/Expo.js +1 -1
- package/lib/Platform/detection/Next.js +1 -1
- package/lib/Platform/detection/Nuxt.js +1 -1
- package/lib/Platform/detection/React.js +5 -5
- package/lib/Platform/detection/Svelte.js +2 -2
- package/lib/Platform/detection/Vue.js +1 -1
- package/lib/Platform/detection/Web.js +1 -1
- package/lib/Platform/detection/helpers.js +7 -7
- package/lib/Platform/detection/index.js +13 -13
- package/lib/Platform/index.js +26 -55
- package/lib/Platform/types.d.ts +1 -1
- package/lib/Platform/types.js +1 -1
- package/lib/Platform/version.d.ts +1 -1
- package/lib/Platform/version.js +1 -1
- package/lib/Reachability/Reachability.js +20 -48
- package/lib/Reachability/Reachability.native.js +12 -16
- package/lib/ServiceWorker/ServiceWorker.js +80 -136
- package/lib/ServiceWorker/errorHelpers.js +6 -7
- package/lib/Signer/DateUtils.d.ts +9 -0
- package/lib/Signer/DateUtils.js +19 -28
- package/lib/Signer/Signer.d.ts +9 -0
- package/lib/Signer/Signer.js +58 -54
- package/lib/adapterCore/error/AmplifyServerContextError.js +9 -27
- package/lib/adapterCore/serverContext/serverContext.js +8 -8
- package/lib/adapterCore/serverContext/serverContextRegistry.js +6 -6
- package/lib/awsClients/cognitoIdentity/base.js +25 -73
- package/lib/awsClients/cognitoIdentity/getCredentialsForIdentity.js +24 -68
- package/lib/awsClients/cognitoIdentity/getId.js +19 -62
- package/lib/awsClients/pinpoint/base.js +12 -15
- package/lib/awsClients/pinpoint/errorHelpers.js +4 -5
- package/lib/awsClients/pinpoint/getInAppMessages.js +24 -68
- package/lib/awsClients/pinpoint/putEvents.js +26 -70
- package/lib/awsClients/pinpoint/updateEndpoint.js +28 -72
- package/lib/clients/endpoints/getDnsSuffix.js +7 -29
- package/lib/clients/handlers/authenticated.js +5 -5
- package/lib/clients/handlers/fetch.js +41 -98
- package/lib/clients/handlers/unauthenticated.js +4 -4
- package/lib/clients/internal/composeServiceApi.js +17 -67
- package/lib/clients/internal/composeTransferHandler.js +9 -11
- package/lib/clients/middleware/retry/defaultRetryDecider.js +18 -75
- package/lib/clients/middleware/retry/isClockSkewError.js +2 -4
- package/lib/clients/middleware/retry/jitteredBackoff.js +5 -5
- package/lib/clients/middleware/retry/middleware.js +61 -125
- package/lib/clients/middleware/signing/middleware.js +24 -86
- package/lib/clients/middleware/signing/signer/signatureV4/index.js +0 -1
- package/lib/clients/middleware/signing/signer/signatureV4/presignUrl.js +21 -56
- package/lib/clients/middleware/signing/signer/signatureV4/signRequest.js +14 -25
- package/lib/clients/middleware/signing/signer/signatureV4/utils/dataHashHelpers.js +7 -7
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getCanonicalHeaders.js +8 -30
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getCanonicalQueryString.js +11 -38
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getCanonicalRequest.js +13 -17
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getCanonicalUri.js +5 -8
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getCredentialScope.js +2 -2
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getFormattedDates.js +3 -3
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getHashedPayload.js +7 -11
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getSignature.js +9 -10
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getSignedHeaders.js +4 -6
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getSigningKey.js +8 -8
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getSigningValues.js +15 -16
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getStringToSign.js +2 -4
- package/lib/clients/middleware/signing/utils/extendedEncodeURIComponent.js +3 -5
- package/lib/clients/middleware/signing/utils/getSkewCorrectedDate.js +1 -3
- package/lib/clients/middleware/signing/utils/getUpdatedSystemClockOffset.js +2 -2
- package/lib/clients/middleware/signing/utils/isClockSkewed.js +4 -6
- package/lib/clients/middleware/userAgent/middleware.js +14 -63
- package/lib/clients/serde/json.js +30 -96
- package/lib/clients/serde/responseInfo.js +12 -18
- package/lib/clients/utils/memoization.js +3 -3
- package/lib/constants.js +1 -1
- package/lib/errors/AmplifyError.js +9 -28
- package/lib/errors/PlatformNotSupportedError.js +7 -24
- package/lib/errors/createAssertionFunction.js +12 -15
- package/lib/errors/errorHelpers.js +7 -8
- package/lib/index.d.ts +1 -1
- package/lib/libraryUtils.d.ts +4 -0
- package/lib/libraryUtils.js +13 -3
- package/lib/parseAWSExports.js +109 -100
- package/lib/providers/kinesis/types/kinesis.d.ts +1 -1
- package/lib/providers/kinesis-firehose/types/kinesis-firehose.d.ts +1 -1
- package/lib/providers/personalize/types/personalize.d.ts +1 -1
- package/lib/providers/pinpoint/apis/flushEvents.js +8 -8
- package/lib/providers/pinpoint/apis/record.js +58 -93
- package/lib/providers/pinpoint/apis/updateEndpoint.js +65 -112
- package/lib/providers/pinpoint/types/pinpoint.d.ts +3 -1
- package/lib/providers/pinpoint/utils/PinpointEventBuffer.js +105 -196
- package/lib/providers/pinpoint/utils/cacheEndpointId.js +12 -49
- package/lib/providers/pinpoint/utils/getCacheKey.js +2 -2
- package/lib/providers/pinpoint/utils/getEndpointId.js +7 -51
- package/lib/providers/pinpoint/utils/getEventBuffer.js +19 -21
- package/lib/providers/pinpoint/utils/isAppInForeground.js +1 -1
- package/lib/providers/pinpoint/utils/isAppInForeground.native.js +2 -2
- package/lib/providers/pinpoint/utils/resolveEndpointId.js +20 -71
- package/lib/singleton/Amplify.d.ts +4 -0
- package/lib/singleton/Amplify.js +21 -103
- package/lib/singleton/Analytics/types.d.ts +5 -1
- package/lib/singleton/Auth/index.js +48 -115
- package/lib/singleton/Auth/types.d.ts +2 -2
- package/lib/singleton/Auth/utils/errorHelpers.js +7 -8
- package/lib/singleton/Auth/utils/index.js +18 -19
- package/lib/singleton/Predictions/types.d.ts +49 -0
- package/lib/singleton/Predictions/types.js +4 -0
- package/lib/singleton/apis/clearCredentials.js +1 -1
- package/lib/singleton/apis/fetchAuthSession.js +3 -3
- package/lib/singleton/apis/internal/fetchAuthSession.js +1 -1
- package/lib/singleton/apis/server/fetchAuthSession.js +3 -3
- package/lib/singleton/types.d.ts +3 -1
- package/lib/storage/CookieStorage.js +29 -99
- package/lib/storage/CookieStorage.native.js +5 -22
- package/lib/storage/DefaultStorage.js +6 -23
- package/lib/storage/DefaultStorage.native.js +18 -64
- package/lib/storage/InMemoryStorage.js +17 -23
- package/lib/storage/KeyValueStorage.js +24 -80
- package/lib/storage/SessionStorage.js +6 -23
- package/lib/storage/index.js +4 -4
- package/lib/storage/utils.js +7 -11
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/WordArray.d.ts +7 -0
- package/lib/utils/WordArray.js +49 -0
- package/lib/utils/amplifyUrl/index.js +2 -2
- package/lib/utils/amplifyUrl/polyfill.native.js +1 -1
- package/lib/utils/amplifyUuid/index.d.ts +1 -1
- package/lib/utils/amplifyUuid/index.js +2 -2
- package/lib/utils/amplifyUuid/polyfill.native.js +1 -1
- package/lib/utils/convert/base64/base64Decoder.js +2 -2
- package/lib/utils/convert/base64/base64Encoder.js +5 -6
- package/lib/utils/convert/base64/bytesToString.js +1 -1
- package/lib/utils/cryptoSecureRandomInt.d.ts +1 -0
- package/lib/utils/cryptoSecureRandomInt.js +16 -0
- package/lib/utils/deepFreeze.js +6 -28
- package/lib/utils/generateRandomString.js +4 -4
- package/lib/utils/getClientInfo/getClientInfo.android.js +7 -7
- package/lib/utils/getClientInfo/getClientInfo.ios.js +12 -12
- package/lib/utils/getClientInfo/getClientInfo.js +16 -16
- package/lib/utils/globalHelpers/index.js +4 -4
- package/lib/utils/globalHelpers/index.native.js +6 -6
- package/lib/utils/isBrowser.js +1 -3
- package/lib/utils/isWebWorker.js +2 -2
- package/lib/utils/retry/NonRetryableError.js +5 -23
- package/lib/utils/retry/isNonRetryableError.js +2 -2
- package/lib/utils/retry/jitteredBackoff.js +6 -7
- package/lib/utils/retry/jitteredExponentialRetry.js +4 -7
- package/lib/utils/retry/retry.js +50 -140
- package/lib/utils/sessionListener/SessionListener.js +17 -19
- package/lib/utils/sessionListener/SessionListener.native.js +18 -22
- package/lib/utils/sessionListener/constants.d.ts +2 -0
- package/lib/utils/sessionListener/constants.js +8 -0
- package/lib/utils/sessionListener/index.d.ts +1 -0
- package/lib/utils/sessionListener/index.js +5 -2
- package/lib/utils/urlSafeDecode.js +2 -2
- package/lib/utils/urlSafeEncode.js +1 -1
- package/lib-esm/BackgroundProcessManager/BackgroundManagerNotOpenError.js +4 -22
- package/lib-esm/BackgroundProcessManager/BackgroundProcessManager.js +124 -244
- package/lib-esm/Cache/StorageCache.js +26 -87
- package/lib-esm/Cache/StorageCache.native.js +33 -136
- package/lib-esm/Cache/StorageCacheCommon.js +267 -597
- package/lib-esm/Cache/constants.js +2 -2
- package/lib-esm/Cache/index.js +1 -1
- package/lib-esm/Cache/utils/CacheList.js +41 -66
- package/lib-esm/Cache/utils/cacheHelpers.js +5 -7
- package/lib-esm/Cache/utils/errorHelpers.js +6 -7
- package/lib-esm/Hub/index.js +34 -75
- package/lib-esm/I18n/I18n.js +23 -39
- package/lib-esm/I18n/errorHelpers.js +4 -5
- package/lib-esm/I18n/index.js +21 -25
- package/lib-esm/I18n/types.js +3 -5
- package/lib-esm/Logger/ConsoleLogger.js +52 -128
- package/lib-esm/Mutex/Mutex.js +15 -20
- package/lib-esm/Platform/customUserAgent.js +13 -26
- package/lib-esm/Platform/detectFramework.js +11 -12
- package/lib-esm/Platform/detection/Angular.js +3 -4
- package/lib-esm/Platform/detection/React.js +4 -4
- package/lib-esm/Platform/detection/Svelte.js +1 -1
- package/lib-esm/Platform/detection/helpers.js +7 -7
- package/lib-esm/Platform/detection/index.js +3 -3
- package/lib-esm/Platform/index.js +23 -52
- package/lib-esm/Platform/types.d.ts +1 -1
- package/lib-esm/Platform/types.js +1 -1
- package/lib-esm/Platform/version.d.ts +1 -1
- package/lib-esm/Platform/version.js +1 -1
- package/lib-esm/Reachability/Reachability.js +18 -46
- package/lib-esm/Reachability/Reachability.native.js +10 -15
- package/lib-esm/ServiceWorker/ServiceWorker.js +74 -131
- package/lib-esm/ServiceWorker/errorHelpers.js +6 -7
- package/lib-esm/Signer/DateUtils.d.ts +9 -0
- package/lib-esm/Signer/DateUtils.js +20 -29
- package/lib-esm/Signer/Signer.d.ts +9 -0
- package/lib-esm/Signer/Signer.js +54 -51
- package/lib-esm/adapterCore/error/AmplifyServerContextError.js +8 -27
- package/lib-esm/adapterCore/serverContext/serverContext.js +6 -6
- package/lib-esm/adapterCore/serverContext/serverContextRegistry.js +7 -7
- package/lib-esm/awsClients/cognitoIdentity/base.js +21 -69
- package/lib-esm/awsClients/cognitoIdentity/getCredentialsForIdentity.js +22 -66
- package/lib-esm/awsClients/cognitoIdentity/getId.js +17 -60
- package/lib-esm/awsClients/pinpoint/base.js +8 -11
- package/lib-esm/awsClients/pinpoint/errorHelpers.js +4 -5
- package/lib-esm/awsClients/pinpoint/getInAppMessages.js +19 -63
- package/lib-esm/awsClients/pinpoint/putEvents.js +20 -64
- package/lib-esm/awsClients/pinpoint/updateEndpoint.js +23 -67
- package/lib-esm/clients/endpoints/getDnsSuffix.js +6 -28
- package/lib-esm/clients/endpoints/partitions.js +2 -2
- package/lib-esm/clients/handlers/authenticated.js +1 -1
- package/lib-esm/clients/handlers/fetch.js +40 -97
- package/lib-esm/clients/handlers/unauthenticated.js +1 -1
- package/lib-esm/clients/internal/composeServiceApi.js +17 -67
- package/lib-esm/clients/internal/composeTransferHandler.js +9 -11
- package/lib-esm/clients/middleware/retry/defaultRetryDecider.js +17 -74
- package/lib-esm/clients/middleware/retry/isClockSkewError.js +2 -4
- package/lib-esm/clients/middleware/retry/jitteredBackoff.js +4 -4
- package/lib-esm/clients/middleware/retry/middleware.js +61 -125
- package/lib-esm/clients/middleware/signing/middleware.js +21 -83
- package/lib-esm/clients/middleware/signing/signer/signatureV4/constants.js +17 -17
- package/lib-esm/clients/middleware/signing/signer/signatureV4/index.js +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/presignUrl.js +17 -52
- package/lib-esm/clients/middleware/signing/signer/signatureV4/signRequest.js +10 -21
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/dataHashHelpers.js +5 -5
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getCanonicalHeaders.js +8 -30
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getCanonicalQueryString.js +11 -38
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getCanonicalRequest.js +8 -12
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getCanonicalUri.js +5 -8
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getCredentialScope.js +1 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getFormattedDates.js +3 -3
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getHashedPayload.js +5 -9
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getSignature.js +5 -6
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getSignedHeaders.js +4 -6
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getSigningKey.js +6 -6
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getSigningValues.js +13 -14
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getStringToSign.js +1 -3
- package/lib-esm/clients/middleware/signing/utils/extendedEncodeURIComponent.js +3 -5
- package/lib-esm/clients/middleware/signing/utils/getSkewCorrectedDate.js +1 -3
- package/lib-esm/clients/middleware/signing/utils/getUpdatedSystemClockOffset.js +1 -1
- package/lib-esm/clients/middleware/signing/utils/isClockSkewed.js +3 -5
- package/lib-esm/clients/middleware/userAgent/middleware.js +14 -63
- package/lib-esm/clients/serde/json.js +29 -95
- package/lib-esm/clients/serde/responseInfo.js +11 -17
- package/lib-esm/clients/utils/memoization.js +3 -3
- package/lib-esm/constants.js +5 -5
- package/lib-esm/errors/AmplifyError.js +9 -29
- package/lib-esm/errors/PlatformNotSupportedError.js +5 -23
- package/lib-esm/errors/createAssertionFunction.js +11 -14
- package/lib-esm/errors/errorHelpers.js +6 -7
- package/lib-esm/index.d.ts +1 -1
- package/lib-esm/libraryUtils.d.ts +4 -0
- package/lib-esm/libraryUtils.js +4 -0
- package/lib-esm/parseAWSExports.js +108 -99
- package/lib-esm/providers/kinesis/types/kinesis.d.ts +1 -1
- package/lib-esm/providers/kinesis-firehose/types/kinesis-firehose.d.ts +1 -1
- package/lib-esm/providers/personalize/types/personalize.d.ts +1 -1
- package/lib-esm/providers/pinpoint/apis/flushEvents.js +6 -6
- package/lib-esm/providers/pinpoint/apis/record.js +54 -89
- package/lib-esm/providers/pinpoint/apis/updateEndpoint.js +61 -108
- package/lib-esm/providers/pinpoint/types/pinpoint.d.ts +3 -1
- package/lib-esm/providers/pinpoint/utils/PinpointEventBuffer.js +102 -194
- package/lib-esm/providers/pinpoint/utils/cacheEndpointId.js +10 -47
- package/lib-esm/providers/pinpoint/utils/constants.js +4 -4
- package/lib-esm/providers/pinpoint/utils/getCacheKey.js +2 -2
- package/lib-esm/providers/pinpoint/utils/getEndpointId.js +5 -49
- package/lib-esm/providers/pinpoint/utils/getEventBuffer.js +17 -19
- package/lib-esm/providers/pinpoint/utils/isAppInForeground.js +1 -1
- package/lib-esm/providers/pinpoint/utils/isAppInForeground.native.js +1 -1
- package/lib-esm/providers/pinpoint/utils/resolveEndpointId.js +16 -67
- package/lib-esm/singleton/Amplify.d.ts +4 -0
- package/lib-esm/singleton/Amplify.js +18 -101
- package/lib-esm/singleton/Analytics/types.d.ts +5 -1
- package/lib-esm/singleton/Auth/index.js +48 -116
- package/lib-esm/singleton/Auth/types.d.ts +2 -2
- package/lib-esm/singleton/Auth/utils/errorHelpers.js +7 -8
- package/lib-esm/singleton/Auth/utils/index.js +16 -17
- package/lib-esm/singleton/Predictions/types.d.ts +49 -0
- package/lib-esm/singleton/Predictions/types.js +3 -0
- package/lib-esm/singleton/apis/fetchAuthSession.js +1 -1
- package/lib-esm/singleton/apis/internal/fetchAuthSession.js +1 -1
- package/lib-esm/singleton/apis/server/fetchAuthSession.js +1 -1
- package/lib-esm/singleton/types.d.ts +3 -1
- package/lib-esm/storage/CookieStorage.js +28 -99
- package/lib-esm/storage/CookieStorage.native.js +4 -22
- package/lib-esm/storage/DefaultStorage.js +4 -22
- package/lib-esm/storage/DefaultStorage.native.js +17 -64
- package/lib-esm/storage/InMemoryStorage.js +17 -24
- package/lib-esm/storage/KeyValueStorage.js +23 -80
- package/lib-esm/storage/SessionStorage.js +4 -22
- package/lib-esm/storage/index.js +3 -3
- package/lib-esm/storage/utils.js +6 -10
- package/lib-esm/tsconfig.tsbuildinfo +1 -1
- package/lib-esm/utils/WordArray.d.ts +7 -0
- package/lib-esm/utils/WordArray.js +46 -0
- package/lib-esm/utils/amplifyUrl/index.js +2 -2
- package/lib-esm/utils/amplifyUuid/index.d.ts +1 -1
- package/lib-esm/utils/amplifyUuid/index.js +1 -1
- package/lib-esm/utils/convert/base64/base64Decoder.js +2 -2
- package/lib-esm/utils/convert/base64/base64Encoder.js +4 -5
- package/lib-esm/utils/convert/base64/bytesToString.js +1 -1
- package/lib-esm/utils/cryptoSecureRandomInt.d.ts +1 -0
- package/lib-esm/utils/cryptoSecureRandomInt.js +12 -0
- package/lib-esm/utils/deepFreeze.js +6 -28
- package/lib-esm/utils/generateRandomString.js +4 -4
- package/lib-esm/utils/getClientInfo/getClientInfo.android.js +5 -5
- package/lib-esm/utils/getClientInfo/getClientInfo.ios.js +10 -10
- package/lib-esm/utils/getClientInfo/getClientInfo.js +15 -15
- package/lib-esm/utils/globalHelpers/index.js +3 -3
- package/lib-esm/utils/globalHelpers/index.native.js +4 -4
- package/lib-esm/utils/isBrowser.js +1 -3
- package/lib-esm/utils/isWebWorker.js +2 -2
- package/lib-esm/utils/retry/NonRetryableError.js +5 -24
- package/lib-esm/utils/retry/constants.js +1 -1
- package/lib-esm/utils/retry/isNonRetryableError.js +2 -2
- package/lib-esm/utils/retry/jitteredBackoff.js +5 -6
- package/lib-esm/utils/retry/jitteredExponentialRetry.js +1 -4
- package/lib-esm/utils/retry/retry.js +48 -138
- package/lib-esm/utils/sessionListener/SessionListener.js +16 -19
- package/lib-esm/utils/sessionListener/SessionListener.native.js +17 -22
- package/lib-esm/utils/sessionListener/constants.d.ts +2 -0
- package/lib-esm/utils/sessionListener/constants.js +5 -0
- package/lib-esm/utils/sessionListener/index.d.ts +1 -0
- package/lib-esm/utils/sessionListener/index.js +2 -1
- package/lib-esm/utils/urlSafeDecode.js +2 -2
- package/lib-esm/utils/urlSafeEncode.js +1 -1
- package/package.json +11 -24
- package/src/Cache/types/index.ts +4 -4
- package/src/Platform/types.ts +1 -1
- package/src/Platform/version.ts +1 -1
- package/src/Signer/DateUtils.ts +10 -2
- package/src/Signer/Signer.ts +9 -2
- package/src/clients/middleware/signing/signer/signatureV4/index.ts +0 -1
- package/src/index.ts +1 -0
- package/src/libraryUtils.ts +7 -1
- package/src/parseAWSExports.ts +45 -6
- package/src/providers/kinesis/types/kinesis.ts +1 -1
- package/src/providers/kinesis-firehose/types/kinesis-firehose.ts +1 -1
- package/src/providers/personalize/types/personalize.ts +1 -1
- package/src/providers/pinpoint/apis/record.ts +22 -5
- package/src/providers/pinpoint/types/pinpoint.ts +3 -1
- package/src/singleton/Amplify.ts +9 -52
- package/src/singleton/Analytics/types.ts +9 -4
- package/src/singleton/Auth/types.ts +2 -2
- package/src/singleton/Predictions/types.ts +61 -0
- package/src/singleton/types.ts +3 -1
- package/src/utils/WordArray.ts +57 -0
- package/src/utils/amplifyUuid/index.ts +1 -1
- package/src/utils/cryptoSecureRandomInt.ts +14 -0
- package/src/utils/sessionListener/constants.ts +6 -0
- package/src/utils/sessionListener/index.ts +1 -0
package/src/parseAWSExports.ts
CHANGED
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
import { ConsoleLogger as Logger } from './Logger';
|
|
4
4
|
import {
|
|
5
5
|
OAuthConfig,
|
|
6
|
-
AuthStandardAttributeKey,
|
|
7
6
|
AuthConfigUserAttributes,
|
|
7
|
+
OAuthProvider,
|
|
8
8
|
} from './singleton/Auth/types';
|
|
9
|
-
|
|
10
9
|
import { ResourcesConfig } from './singleton/types';
|
|
11
10
|
|
|
12
11
|
const logger = new Logger('parseAWSExports');
|
|
@@ -46,6 +45,7 @@ export const parseAWSExports = (
|
|
|
46
45
|
aws_cognito_password_protection_settings,
|
|
47
46
|
aws_cognito_verification_mechanisms,
|
|
48
47
|
aws_cognito_signup_attributes,
|
|
48
|
+
aws_cognito_social_providers,
|
|
49
49
|
aws_cognito_username_attributes,
|
|
50
50
|
aws_mandatory_sign_in,
|
|
51
51
|
aws_mobile_analytics_app_id,
|
|
@@ -57,6 +57,7 @@ export const parseAWSExports = (
|
|
|
57
57
|
aws_user_pools_web_client_id,
|
|
58
58
|
geo,
|
|
59
59
|
oauth,
|
|
60
|
+
predictions,
|
|
60
61
|
aws_cloud_logic_custom,
|
|
61
62
|
Notifications,
|
|
62
63
|
modelIntrospection,
|
|
@@ -188,15 +189,27 @@ export const parseAWSExports = (
|
|
|
188
189
|
loginWithEmailEnabled || loginWithPhoneEnabled ? false : true,
|
|
189
190
|
email: loginWithEmailEnabled,
|
|
190
191
|
phone: loginWithPhoneEnabled,
|
|
191
|
-
...(oauth &&
|
|
192
|
-
Object.keys(oauth).length > 0 && {
|
|
193
|
-
oauth: getOAuthConfig(oauth),
|
|
194
|
-
}),
|
|
195
192
|
},
|
|
196
193
|
},
|
|
197
194
|
};
|
|
198
195
|
}
|
|
199
196
|
|
|
197
|
+
const hasOAuthConfig = oauth ? Object.keys(oauth).length > 0 : false;
|
|
198
|
+
const hasSocialProviderConfig = aws_cognito_social_providers
|
|
199
|
+
? aws_cognito_social_providers.length > 0
|
|
200
|
+
: false;
|
|
201
|
+
if (amplifyConfig.Auth && hasOAuthConfig) {
|
|
202
|
+
amplifyConfig.Auth.Cognito.loginWith = {
|
|
203
|
+
...amplifyConfig.Auth.Cognito.loginWith,
|
|
204
|
+
oauth: {
|
|
205
|
+
...getOAuthConfig(oauth),
|
|
206
|
+
...(hasSocialProviderConfig && {
|
|
207
|
+
providers: parseSocialProviders(aws_cognito_social_providers),
|
|
208
|
+
}),
|
|
209
|
+
},
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
|
|
200
213
|
// Storage
|
|
201
214
|
if (aws_user_files_s3_bucket) {
|
|
202
215
|
amplifyConfig.Storage = {
|
|
@@ -244,6 +257,25 @@ export const parseAWSExports = (
|
|
|
244
257
|
};
|
|
245
258
|
}
|
|
246
259
|
|
|
260
|
+
// Predictions
|
|
261
|
+
if (predictions) {
|
|
262
|
+
// map VoiceId from speechGenerator defaults to voiceId
|
|
263
|
+
const { VoiceId: voiceId } =
|
|
264
|
+
predictions?.convert?.speechGenerator?.defaults ?? {};
|
|
265
|
+
amplifyConfig.Predictions = voiceId
|
|
266
|
+
? {
|
|
267
|
+
...predictions,
|
|
268
|
+
convert: {
|
|
269
|
+
...predictions.convert,
|
|
270
|
+
speechGenerator: {
|
|
271
|
+
...predictions.convert.speechGenerator,
|
|
272
|
+
defaults: { voiceId },
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
}
|
|
276
|
+
: predictions;
|
|
277
|
+
}
|
|
278
|
+
|
|
247
279
|
return amplifyConfig;
|
|
248
280
|
};
|
|
249
281
|
|
|
@@ -263,3 +295,10 @@ const getOAuthConfig = ({
|
|
|
263
295
|
redirectSignOut: getRedirectUrl(redirectSignOut),
|
|
264
296
|
responseType,
|
|
265
297
|
});
|
|
298
|
+
|
|
299
|
+
const parseSocialProviders = (aws_cognito_social_providers: string[]) => {
|
|
300
|
+
return aws_cognito_social_providers.map((provider: string) => {
|
|
301
|
+
const updatedProvider = provider.toLowerCase();
|
|
302
|
+
return updatedProvider.charAt(0).toUpperCase() + updatedProvider.slice(1);
|
|
303
|
+
}) as OAuthProvider[];
|
|
304
|
+
};
|
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
import { amplifyUuid } from '../../../utils/amplifyUuid';
|
|
5
5
|
import { PinpointRecordInput, PinpointSession } from '../types';
|
|
6
6
|
import { resolveEndpointId } from '../utils';
|
|
7
|
+
import {
|
|
8
|
+
SESSION_START_EVENT,
|
|
9
|
+
SESSION_STOP_EVENT,
|
|
10
|
+
} from '../../../utils/sessionListener';
|
|
7
11
|
import {
|
|
8
12
|
BUFFER_SIZE,
|
|
9
13
|
FLUSH_INTERVAL,
|
|
@@ -12,8 +16,7 @@ import {
|
|
|
12
16
|
} from '../utils/constants';
|
|
13
17
|
import { getEventBuffer } from '../utils/getEventBuffer';
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
let session: PinpointSession;
|
|
19
|
+
let session: PinpointSession | undefined;
|
|
17
20
|
|
|
18
21
|
/**
|
|
19
22
|
* @internal
|
|
@@ -28,7 +31,9 @@ export const record = async ({
|
|
|
28
31
|
region,
|
|
29
32
|
userAgentValue,
|
|
30
33
|
}: PinpointRecordInput): Promise<void> => {
|
|
31
|
-
|
|
34
|
+
let eventSession = session;
|
|
35
|
+
const currentTime = new Date();
|
|
36
|
+
const timestampISOString = currentTime.toISOString();
|
|
32
37
|
const eventId = amplifyUuid();
|
|
33
38
|
|
|
34
39
|
// Prepare event buffer if required
|
|
@@ -55,13 +60,25 @@ export const record = async ({
|
|
|
55
60
|
});
|
|
56
61
|
|
|
57
62
|
// Generate session if required
|
|
58
|
-
if (!
|
|
63
|
+
if (!eventSession || event.name === SESSION_START_EVENT) {
|
|
59
64
|
const sessionId = amplifyUuid();
|
|
60
65
|
|
|
61
66
|
session = {
|
|
62
67
|
Id: sessionId,
|
|
63
68
|
StartTimestamp: timestampISOString,
|
|
64
69
|
};
|
|
70
|
+
eventSession = session;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Terminate session when required
|
|
74
|
+
if (session && event.name === SESSION_STOP_EVENT) {
|
|
75
|
+
eventSession = {
|
|
76
|
+
...session,
|
|
77
|
+
StopTimestamp: timestampISOString,
|
|
78
|
+
Duration:
|
|
79
|
+
currentTime.getTime() - new Date(session.StartTimestamp).getTime(),
|
|
80
|
+
};
|
|
81
|
+
session = undefined;
|
|
65
82
|
}
|
|
66
83
|
|
|
67
84
|
// Push event to buffer
|
|
@@ -69,7 +86,7 @@ export const record = async ({
|
|
|
69
86
|
eventId,
|
|
70
87
|
endpointId,
|
|
71
88
|
event,
|
|
72
|
-
session
|
|
89
|
+
session: eventSession!,
|
|
73
90
|
timestamp: timestampISOString,
|
|
74
91
|
resendLimit: RESEND_LIMIT,
|
|
75
92
|
});
|
|
@@ -13,7 +13,7 @@ export type SupportedCategory =
|
|
|
13
13
|
type SupportedChannelType = 'APNS' | 'APNS_SANDBOX' | 'GCM' | 'IN_APP';
|
|
14
14
|
|
|
15
15
|
export type PinpointProviderConfig = {
|
|
16
|
-
Pinpoint
|
|
16
|
+
Pinpoint: {
|
|
17
17
|
appId: string;
|
|
18
18
|
region: string;
|
|
19
19
|
};
|
|
@@ -27,7 +27,9 @@ export type PinpointServiceOptions = {
|
|
|
27
27
|
|
|
28
28
|
export type PinpointSession = {
|
|
29
29
|
Id: string;
|
|
30
|
+
Duration?: number;
|
|
30
31
|
StartTimestamp: string;
|
|
32
|
+
StopTimestamp?: string;
|
|
31
33
|
};
|
|
32
34
|
|
|
33
35
|
export type PinpointAnalyticsEvent = {
|
package/src/singleton/Amplify.ts
CHANGED
|
@@ -27,6 +27,10 @@ export class AmplifyClass {
|
|
|
27
27
|
* Configures Amplify for use with your back-end resources.
|
|
28
28
|
*
|
|
29
29
|
* @remarks
|
|
30
|
+
* This API does not perform any merging of either `resourcesConfig` or `libraryOptions`. The most recently
|
|
31
|
+
* provided values will be used after configuration.
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
30
34
|
* `configure` can be used to specify additional library options where available for supported categories.
|
|
31
35
|
*
|
|
32
36
|
* @param resourceConfig - Back-end resource configuration. Typically provided via the `aws-exports.js` file.
|
|
@@ -34,7 +38,7 @@ export class AmplifyClass {
|
|
|
34
38
|
*/
|
|
35
39
|
configure(
|
|
36
40
|
resourcesConfig: ResourcesConfig | LegacyConfig,
|
|
37
|
-
libraryOptions
|
|
41
|
+
libraryOptions?: LibraryOptions
|
|
38
42
|
): void {
|
|
39
43
|
let resolvedResourceConfig: ResourcesConfig;
|
|
40
44
|
|
|
@@ -44,15 +48,11 @@ export class AmplifyClass {
|
|
|
44
48
|
resolvedResourceConfig = resourcesConfig as ResourcesConfig;
|
|
45
49
|
}
|
|
46
50
|
|
|
47
|
-
this.resourcesConfig =
|
|
48
|
-
this.resourcesConfig,
|
|
49
|
-
resolvedResourceConfig
|
|
50
|
-
);
|
|
51
|
+
this.resourcesConfig = resolvedResourceConfig;
|
|
51
52
|
|
|
52
|
-
|
|
53
|
-
this.libraryOptions
|
|
54
|
-
|
|
55
|
-
);
|
|
53
|
+
if (libraryOptions) {
|
|
54
|
+
this.libraryOptions = libraryOptions;
|
|
55
|
+
}
|
|
56
56
|
|
|
57
57
|
// Make resource config immutable
|
|
58
58
|
this.resourcesConfig = deepFreeze(this.resourcesConfig);
|
|
@@ -87,46 +87,3 @@ export class AmplifyClass {
|
|
|
87
87
|
* `Amplify` is responsible for orchestrating cross-category communication within the library.
|
|
88
88
|
*/
|
|
89
89
|
export const Amplify = new AmplifyClass();
|
|
90
|
-
|
|
91
|
-
// TODO(v6): validate until which level this will nested, during Amplify.configure API review.
|
|
92
|
-
function mergeResourceConfig(
|
|
93
|
-
existingConfig: ResourcesConfig,
|
|
94
|
-
newConfig: ResourcesConfig
|
|
95
|
-
): ResourcesConfig {
|
|
96
|
-
const resultConfig: Record<string, any> = {};
|
|
97
|
-
|
|
98
|
-
for (const category of Object.keys(existingConfig)) {
|
|
99
|
-
resultConfig[category] = existingConfig[category as keyof ResourcesConfig];
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
for (const key of Object.keys(newConfig)) {
|
|
103
|
-
resultConfig[key] = {
|
|
104
|
-
...resultConfig[key],
|
|
105
|
-
...newConfig[key as keyof ResourcesConfig],
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
return resultConfig;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function mergeLibraryOptions(
|
|
113
|
-
existingConfig: LibraryOptions,
|
|
114
|
-
newConfig: LibraryOptions
|
|
115
|
-
): LibraryOptions {
|
|
116
|
-
const resultConfig: Record<string, any> = {};
|
|
117
|
-
|
|
118
|
-
for (const category of Object.keys(existingConfig)) {
|
|
119
|
-
resultConfig[category] = existingConfig[category as keyof LibraryOptions];
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
for (const key of Object.keys(newConfig).filter(key => key !== 'ssr')) {
|
|
123
|
-
resultConfig[key] = {
|
|
124
|
-
...resultConfig[key],
|
|
125
|
-
...newConfig[key as Exclude<keyof LibraryOptions, 'ssr'>],
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
resultConfig.ssr = newConfig.ssr;
|
|
130
|
-
|
|
131
|
-
return resultConfig;
|
|
132
|
-
}
|
|
@@ -6,7 +6,12 @@ import { KinesisProviderConfig } from '../../providers/kinesis/types';
|
|
|
6
6
|
import { KinesisFirehoseProviderConfig } from '../../providers/kinesis-firehose/types';
|
|
7
7
|
import { PersonalizeProviderConfig } from '../../providers/personalize/types';
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
type AtLeastOne<T, U = { [K in keyof T]: Pick<T, K> }> = Partial<T> &
|
|
10
|
+
U[keyof U];
|
|
11
|
+
|
|
12
|
+
export type AnalyticsConfig = AtLeastOne<
|
|
13
|
+
PinpointProviderConfig &
|
|
14
|
+
KinesisProviderConfig &
|
|
15
|
+
KinesisFirehoseProviderConfig &
|
|
16
|
+
PersonalizeProviderConfig
|
|
17
|
+
>;
|
|
@@ -166,10 +166,10 @@ export type OAuthConfig = {
|
|
|
166
166
|
redirectSignIn: Array<string>;
|
|
167
167
|
redirectSignOut: Array<string>;
|
|
168
168
|
responseType: 'code' | 'token';
|
|
169
|
-
providers?: Array<
|
|
169
|
+
providers?: Array<OAuthProvider | CustomProvider>;
|
|
170
170
|
};
|
|
171
171
|
|
|
172
|
-
type
|
|
172
|
+
export type OAuthProvider = 'Google' | 'Facebook' | 'Amazon' | 'Apple';
|
|
173
173
|
type CustomProvider = { custom: string };
|
|
174
174
|
|
|
175
175
|
type CustomScope = string & {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
// Defaults for ConvertConfig
|
|
5
|
+
type SpeechGeneratorDefaults = {
|
|
6
|
+
voiceId?: string;
|
|
7
|
+
};
|
|
8
|
+
type TranscriptionDefaults = {
|
|
9
|
+
language?: string;
|
|
10
|
+
};
|
|
11
|
+
type TranslateTextDefaults = {
|
|
12
|
+
sourceLanguage?: string;
|
|
13
|
+
targetLanguage?: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// Defaults for IdentifyConfig
|
|
17
|
+
type IdentifyEntitiesDefaults = {
|
|
18
|
+
collectionId?: string;
|
|
19
|
+
maxEntities?: number;
|
|
20
|
+
};
|
|
21
|
+
type IdentityLabelsDefaults = {
|
|
22
|
+
type?: string;
|
|
23
|
+
};
|
|
24
|
+
type IdentifyTextDefaults = {
|
|
25
|
+
format?: string;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// Defaults for InterpretConfig
|
|
29
|
+
type InterpretTextDefaults = {
|
|
30
|
+
type?: string;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
type ConvertConfig = {
|
|
34
|
+
speechGenerator?: PredictionsProviderConfig<SpeechGeneratorDefaults>;
|
|
35
|
+
transcription?: PredictionsProviderConfig<TranscriptionDefaults>;
|
|
36
|
+
translateText?: PredictionsProviderConfig<TranslateTextDefaults>;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
type IdentifyConfig = {
|
|
40
|
+
identifyEntities?: PredictionsProviderConfig<IdentifyEntitiesDefaults> & {
|
|
41
|
+
celebrityDetectionEnabled?: boolean;
|
|
42
|
+
};
|
|
43
|
+
identifyLabels?: PredictionsProviderConfig<IdentityLabelsDefaults>;
|
|
44
|
+
identifyText?: PredictionsProviderConfig<IdentifyTextDefaults>;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
type InterpretConfig = {
|
|
48
|
+
interpretText?: PredictionsProviderConfig<InterpretTextDefaults>;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export type PredictionsProviderConfig<T> = {
|
|
52
|
+
region?: string;
|
|
53
|
+
proxy?: boolean;
|
|
54
|
+
defaults?: T;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export type PredictionsConfig = {
|
|
58
|
+
convert?: ConvertConfig;
|
|
59
|
+
identify?: IdentifyConfig;
|
|
60
|
+
interpret?: InterpretConfig;
|
|
61
|
+
};
|
package/src/singleton/types.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
CognitoIdentityPoolConfig,
|
|
14
14
|
} from './Auth/types';
|
|
15
15
|
import { GeoConfig } from './Geo/types';
|
|
16
|
+
import { PredictionsConfig } from './Predictions/types';
|
|
16
17
|
import {
|
|
17
18
|
LibraryStorageOptions,
|
|
18
19
|
StorageAccessLevel,
|
|
@@ -34,7 +35,7 @@ export type ResourcesConfig = {
|
|
|
34
35
|
Auth?: AuthConfig;
|
|
35
36
|
Interactions?: InteractionsConfig;
|
|
36
37
|
Notifications?: NotificationsConfig;
|
|
37
|
-
|
|
38
|
+
Predictions?: PredictionsConfig;
|
|
38
39
|
Storage?: StorageConfig;
|
|
39
40
|
Geo?: GeoConfig;
|
|
40
41
|
};
|
|
@@ -54,6 +55,7 @@ export {
|
|
|
54
55
|
AuthUserPoolAndIdentityPoolConfig,
|
|
55
56
|
GetCredentialsOptions,
|
|
56
57
|
InteractionsConfig,
|
|
58
|
+
PredictionsConfig,
|
|
57
59
|
StorageAccessLevel,
|
|
58
60
|
StorageConfig,
|
|
59
61
|
AnalyticsConfig,
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { cryptoSecureRandomInt } from './cryptoSecureRandomInt';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Hex encoding strategy.
|
|
8
|
+
* Converts a word array to a hex string.
|
|
9
|
+
* @param {WordArray} wordArray The word array.
|
|
10
|
+
* @return {string} The hex string.
|
|
11
|
+
* @static
|
|
12
|
+
*/
|
|
13
|
+
function hexStringify(wordArray: WordArray): string {
|
|
14
|
+
// Shortcuts
|
|
15
|
+
const words = wordArray.words;
|
|
16
|
+
const sigBytes = wordArray.sigBytes;
|
|
17
|
+
|
|
18
|
+
// Convert
|
|
19
|
+
const hexChars: string[] = [];
|
|
20
|
+
for (let i = 0; i < sigBytes; i++) {
|
|
21
|
+
const bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
|
|
22
|
+
hexChars.push((bite >>> 4).toString(16));
|
|
23
|
+
hexChars.push((bite & 0x0f).toString(16));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return hexChars.join('');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default class WordArray {
|
|
30
|
+
words: number[] = [];
|
|
31
|
+
sigBytes: number;
|
|
32
|
+
|
|
33
|
+
constructor(words?: number[], sigBytes?: number) {
|
|
34
|
+
let Words = words;
|
|
35
|
+
Words = this.words = Words || [];
|
|
36
|
+
|
|
37
|
+
if (sigBytes !== undefined) {
|
|
38
|
+
this.sigBytes = sigBytes;
|
|
39
|
+
} else {
|
|
40
|
+
this.sigBytes = Words.length * 4;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
random(nBytes: number): WordArray {
|
|
45
|
+
const words: number[] = [];
|
|
46
|
+
|
|
47
|
+
for (let i = 0; i < nBytes; i += 4) {
|
|
48
|
+
words.push(cryptoSecureRandomInt());
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return new WordArray(words, nBytes);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
toString(): string {
|
|
55
|
+
return hexStringify(this);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { getCrypto } from './globalHelpers';
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* Cryptographically secure pseudorandom number generator
|
|
8
|
+
* As Math.random() is cryptographically not safe to use
|
|
9
|
+
*/
|
|
10
|
+
export function cryptoSecureRandomInt() {
|
|
11
|
+
const crypto = getCrypto();
|
|
12
|
+
const randomResult = crypto.getRandomValues(new Uint32Array(1))[0];
|
|
13
|
+
return randomResult;
|
|
14
|
+
}
|