@aws-amplify/core 5.3.2-unstable.ffe65ea.1 → 5.4.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/internals/aws-client-utils/package.json +8 -0
- package/internals/aws-clients/pinpoint/package.json +8 -0
- package/lib/Amplify.js +18 -3
- package/lib/AwsClients/CognitoIdentity/base.d.ts +28 -0
- package/lib/AwsClients/CognitoIdentity/base.js +109 -0
- package/lib/AwsClients/CognitoIdentity/getCredentialsForIdentity.d.ts +12 -0
- package/lib/AwsClients/CognitoIdentity/getCredentialsForIdentity.js +82 -0
- package/lib/AwsClients/CognitoIdentity/getId.d.ts +12 -0
- package/lib/AwsClients/CognitoIdentity/getId.js +72 -0
- package/lib/AwsClients/CognitoIdentity/index.d.ts +2 -0
- package/lib/AwsClients/CognitoIdentity/index.js +9 -0
- package/lib/AwsClients/CognitoIdentity/types.d.ts +153 -0
- package/lib/AwsClients/CognitoIdentity/types.js +4 -0
- package/lib/AwsClients/Pinpoint/base.d.ts +17 -0
- package/lib/AwsClients/Pinpoint/base.js +39 -0
- package/lib/AwsClients/Pinpoint/getInAppMessages.d.ts +13 -0
- package/lib/AwsClients/Pinpoint/getInAppMessages.js +77 -0
- package/lib/AwsClients/Pinpoint/index.d.ts +4 -0
- package/lib/AwsClients/Pinpoint/index.js +11 -0
- package/lib/AwsClients/Pinpoint/putEvents.d.ts +13 -0
- package/lib/AwsClients/Pinpoint/putEvents.js +78 -0
- package/lib/AwsClients/Pinpoint/types.d.ts +836 -0
- package/lib/AwsClients/Pinpoint/types.js +5 -0
- package/lib/AwsClients/Pinpoint/updateEndpoint.d.ts +13 -0
- package/lib/AwsClients/Pinpoint/updateEndpoint.js +81 -0
- package/lib/ClientDevice/android.js +3 -2
- package/lib/ClientDevice/browser.js +1 -1
- package/lib/ClientDevice/index.js +3 -3
- package/lib/ClientDevice/ios.js +3 -2
- package/lib/ClientDevice/reactnative.js +3 -3
- package/lib/Credentials.js +176 -113
- package/lib/Errors.js +1 -1
- package/lib/Hub.d.ts +4 -4
- package/lib/Hub.js +47 -12
- package/lib/I18n/I18n.js +13 -3
- package/lib/I18n/index.js +1 -1
- package/lib/I18n/types.js +1 -1
- package/lib/JS.js +29 -17
- package/lib/Logger/ConsoleLogger.js +51 -17
- package/lib/Logger/index.js +3 -3
- package/lib/Logger/logger-interface.js +0 -1
- package/lib/OAuthHelper/FacebookOAuth.js +41 -6
- package/lib/OAuthHelper/GoogleOAuth.js +41 -6
- package/lib/OAuthHelper/index.js +1 -1
- package/lib/Platform/index.js +8 -7
- package/lib/Platform/version.d.ts +1 -1
- package/lib/Platform/version.js +2 -2
- package/lib/Providers/AWSCloudWatchProvider.js +104 -44
- package/lib/Providers/index.js +2 -2
- package/lib/RNComponents/index.js +2 -2
- package/lib/RNComponents/reactnative.js +7 -5
- package/lib/ServiceWorker/ServiceWorker.js +11 -11
- package/lib/ServiceWorker/index.js +2 -2
- package/lib/Signer.js +17 -7
- package/lib/StorageHelper/index.js +1 -1
- package/lib/StorageHelper/reactnative.js +5 -3
- package/lib/UniversalStorage/index.d.ts +2 -2
- package/lib/UniversalStorage/index.js +24 -6
- package/lib/Util/BackgroundProcessManager.js +84 -23
- package/lib/Util/Constants.js +1 -1
- package/lib/Util/DateUtils.js +18 -3
- package/lib/Util/Mutex.js +0 -1
- package/lib/Util/Reachability.d.ts +1 -1
- package/lib/Util/Reachability.js +18 -6
- package/lib/Util/Reachability.native.d.ts +1 -1
- package/lib/Util/Reachability.native.js +4 -3
- package/lib/Util/Retry.js +103 -26
- package/lib/Util/StringUtils.js +1 -1
- package/lib/Util/index.js +24 -21
- package/lib/clients/endpoints/getDnsSuffix.d.ts +11 -0
- package/lib/clients/endpoints/getDnsSuffix.js +49 -0
- package/lib/clients/endpoints/index.d.ts +1 -0
- package/lib/clients/endpoints/index.js +7 -0
- package/lib/clients/endpoints/partitions.d.ts +33 -0
- package/lib/clients/endpoints/partitions.js +41 -0
- package/lib/clients/handlers/authenticated.d.ts +5 -0
- package/lib/clients/handlers/authenticated.js +15 -0
- package/lib/clients/handlers/fetch.d.ts +4 -0
- package/lib/clients/handlers/fetch.js +123 -0
- package/lib/clients/handlers/unauthenticated.d.ts +4 -0
- package/lib/clients/handlers/unauthenticated.js +10 -0
- package/lib/clients/index.d.ts +8 -0
- package/lib/clients/index.js +37 -0
- package/lib/clients/internal/composeServiceApi.d.ts +8 -0
- package/lib/clients/internal/composeServiceApi.js +75 -0
- package/lib/clients/internal/composeTransferHandler.d.ts +29 -0
- package/lib/clients/internal/composeTransferHandler.js +26 -0
- package/lib/clients/middleware/retry/defaultRetryDecider.d.ts +6 -0
- package/lib/clients/middleware/retry/defaultRetryDecider.js +101 -0
- package/lib/clients/middleware/retry/index.d.ts +3 -0
- package/lib/clients/middleware/retry/index.js +11 -0
- package/lib/clients/middleware/retry/jitteredBackoff.d.ts +2 -0
- package/lib/clients/middleware/retry/jitteredBackoff.js +16 -0
- package/lib/clients/middleware/retry/middleware.d.ts +40 -0
- package/lib/clients/middleware/retry/middleware.js +143 -0
- package/lib/clients/middleware/signing/index.d.ts +1 -0
- package/lib/clients/middleware/signing/index.js +7 -0
- package/lib/clients/middleware/signing/middleware.d.ts +13 -0
- package/lib/clients/middleware/signing/middleware.js +101 -0
- package/lib/clients/middleware/signing/signer/signatureV4/constants.js +1 -1
- package/lib/clients/middleware/signing/signer/signatureV4/index.js +4 -4
- package/lib/clients/middleware/signing/signer/signatureV4/index.native.js +4 -4
- package/lib/clients/middleware/signing/signer/signatureV4/presignUrl.js +46 -8
- package/lib/clients/middleware/signing/signer/signatureV4/signRequest.js +22 -11
- package/lib/clients/middleware/signing/signer/signatureV4/types/index.js +0 -1
- package/lib/clients/middleware/signing/signer/signatureV4/types/signer.js +0 -1
- package/lib/clients/middleware/signing/signer/signatureV4/utils/dataHashHelpers.d.ts +3 -2
- package/lib/clients/middleware/signing/signer/signatureV4/utils/dataHashHelpers.js +7 -5
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getCanonicalHeaders.d.ts +2 -1
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getCanonicalHeaders.js +23 -7
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getCanonicalQueryString.js +24 -8
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getCanonicalRequest.js +8 -7
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getCanonicalUri.js +3 -2
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getCredentialScope.js +3 -2
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getFormattedDates.js +3 -2
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getHashedPayload.d.ts +2 -1
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getHashedPayload.js +4 -3
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getSignature.js +7 -6
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getSignedHeaders.d.ts +2 -1
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getSignedHeaders.js +3 -2
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getSigningKey.js +8 -7
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getSigningValues.js +5 -4
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getStringToSign.js +3 -2
- package/lib/clients/middleware/signing/utils/extendedEncodeURIComponent.d.ts +10 -0
- package/lib/clients/middleware/signing/utils/extendedEncodeURIComponent.js +23 -0
- package/lib/clients/middleware/signing/utils/getSkewCorrectedDate.d.ts +10 -0
- package/lib/clients/middleware/signing/utils/getSkewCorrectedDate.js +18 -0
- package/lib/clients/middleware/signing/utils/getUpdatedSystemClockOffset.d.ts +9 -0
- package/lib/clients/middleware/signing/utils/getUpdatedSystemClockOffset.js +21 -0
- package/lib/clients/middleware/signing/utils/isClockSkewed.d.ts +11 -0
- package/lib/clients/middleware/signing/utils/isClockSkewed.js +23 -0
- package/lib/clients/middleware/userAgent/index.d.ts +1 -0
- package/lib/clients/middleware/userAgent/index.js +7 -0
- package/lib/clients/middleware/userAgent/middleware.d.ts +13 -0
- package/lib/clients/middleware/userAgent/middleware.js +77 -0
- package/lib/clients/serde/index.d.ts +2 -0
- package/lib/clients/serde/index.js +10 -0
- package/lib/clients/serde/json.d.ts +12 -0
- package/lib/clients/serde/json.js +115 -0
- package/lib/clients/serde/responseInfo.d.ts +3 -0
- package/lib/clients/serde/responseInfo.js +23 -0
- package/lib/clients/types/aws.d.ts +18 -1
- package/lib/clients/types/aws.js +0 -1
- package/lib/clients/types/core.d.ts +22 -0
- package/lib/clients/types/core.js +0 -1
- package/lib/clients/types/http.d.ts +8 -4
- package/lib/clients/types/http.js +0 -1
- package/lib/clients/types/index.d.ts +3 -2
- package/lib/clients/types/index.js +0 -1
- package/lib/clients/utils/isClockSkewError.d.ts +9 -0
- package/lib/clients/utils/isClockSkewError.js +27 -0
- package/lib/constants.js +1 -1
- package/lib/index.js +61 -60
- package/lib/parseAWSExports.js +15 -4
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/types/index.js +15 -1
- package/lib/types/types.d.ts +1 -1
- package/lib/types/types.js +0 -1
- package/lib-esm/Amplify.js +16 -2
- package/lib-esm/AwsClients/CognitoIdentity/base.d.ts +28 -0
- package/lib-esm/AwsClients/CognitoIdentity/base.js +104 -0
- package/lib-esm/AwsClients/CognitoIdentity/getCredentialsForIdentity.d.ts +12 -0
- package/lib-esm/AwsClients/CognitoIdentity/getCredentialsForIdentity.js +79 -0
- package/lib-esm/AwsClients/CognitoIdentity/getId.d.ts +12 -0
- package/lib-esm/AwsClients/CognitoIdentity/getId.js +69 -0
- package/lib-esm/AwsClients/CognitoIdentity/index.d.ts +2 -0
- package/lib-esm/AwsClients/CognitoIdentity/index.js +4 -0
- package/lib-esm/AwsClients/CognitoIdentity/types.d.ts +153 -0
- package/lib-esm/AwsClients/CognitoIdentity/types.js +3 -0
- package/lib-esm/AwsClients/Pinpoint/base.d.ts +17 -0
- package/lib-esm/AwsClients/Pinpoint/base.js +35 -0
- package/lib-esm/AwsClients/Pinpoint/getInAppMessages.d.ts +13 -0
- package/lib-esm/AwsClients/Pinpoint/getInAppMessages.js +74 -0
- package/lib-esm/AwsClients/Pinpoint/index.d.ts +4 -0
- package/lib-esm/AwsClients/Pinpoint/index.js +5 -0
- package/lib-esm/AwsClients/Pinpoint/putEvents.d.ts +13 -0
- package/lib-esm/AwsClients/Pinpoint/putEvents.js +75 -0
- package/lib-esm/AwsClients/Pinpoint/types.d.ts +836 -0
- package/lib-esm/AwsClients/Pinpoint/types.js +4 -0
- package/lib-esm/AwsClients/Pinpoint/updateEndpoint.d.ts +13 -0
- package/lib-esm/AwsClients/Pinpoint/updateEndpoint.js +78 -0
- package/lib-esm/ClientDevice/android.js +0 -1
- package/lib-esm/ClientDevice/browser.js +0 -1
- package/lib-esm/ClientDevice/index.js +0 -1
- package/lib-esm/ClientDevice/ios.js +0 -1
- package/lib-esm/ClientDevice/reactnative.js +0 -1
- package/lib-esm/Credentials.js +149 -87
- package/lib-esm/Errors.js +0 -1
- package/lib-esm/Hub.d.ts +4 -4
- package/lib-esm/Hub.js +43 -9
- package/lib-esm/I18n/I18n.js +11 -2
- package/lib-esm/I18n/index.js +0 -1
- package/lib-esm/I18n/types.js +0 -1
- package/lib-esm/JS.js +0 -1
- package/lib-esm/Logger/ConsoleLogger.js +49 -16
- package/lib-esm/Logger/index.js +0 -1
- package/lib-esm/Logger/logger-interface.js +1 -1
- package/lib-esm/OAuthHelper/FacebookOAuth.js +36 -2
- package/lib-esm/OAuthHelper/GoogleOAuth.js +36 -2
- package/lib-esm/OAuthHelper/index.js +0 -1
- package/lib-esm/Platform/index.js +5 -6
- package/lib-esm/Platform/version.d.ts +1 -1
- package/lib-esm/Platform/version.js +1 -2
- package/lib-esm/Providers/AWSCloudWatchProvider.js +75 -16
- package/lib-esm/Providers/index.js +0 -1
- package/lib-esm/RNComponents/index.js +0 -1
- package/lib-esm/RNComponents/reactnative.js +0 -1
- package/lib-esm/ServiceWorker/ServiceWorker.js +9 -10
- package/lib-esm/ServiceWorker/index.js +0 -1
- package/lib-esm/Signer.js +11 -2
- package/lib-esm/StorageHelper/index.js +0 -1
- package/lib-esm/StorageHelper/reactnative.js +0 -1
- package/lib-esm/UniversalStorage/index.d.ts +2 -2
- package/lib-esm/UniversalStorage/index.js +17 -3
- package/lib-esm/Util/BackgroundProcessManager.js +74 -14
- package/lib-esm/Util/Constants.js +0 -1
- package/lib-esm/Util/DateUtils.js +16 -2
- package/lib-esm/Util/Mutex.js +0 -1
- package/lib-esm/Util/Reachability.d.ts +1 -1
- package/lib-esm/Util/Reachability.js +11 -2
- package/lib-esm/Util/Reachability.native.d.ts +1 -1
- package/lib-esm/Util/Reachability.native.js +0 -1
- package/lib-esm/Util/Retry.js +92 -18
- package/lib-esm/Util/StringUtils.js +0 -1
- package/lib-esm/Util/index.js +0 -1
- package/lib-esm/clients/endpoints/getDnsSuffix.d.ts +11 -0
- package/lib-esm/clients/endpoints/getDnsSuffix.js +45 -0
- package/lib-esm/clients/endpoints/index.d.ts +1 -0
- package/lib-esm/clients/endpoints/index.js +3 -0
- package/lib-esm/clients/endpoints/partitions.d.ts +33 -0
- package/lib-esm/clients/endpoints/partitions.js +38 -0
- package/lib-esm/clients/handlers/authenticated.d.ts +5 -0
- package/lib-esm/clients/handlers/authenticated.js +12 -0
- package/lib-esm/clients/handlers/fetch.d.ts +4 -0
- package/lib-esm/clients/handlers/fetch.js +119 -0
- package/lib-esm/clients/handlers/unauthenticated.d.ts +4 -0
- package/lib-esm/clients/handlers/unauthenticated.js +7 -0
- package/lib-esm/clients/index.d.ts +8 -0
- package/lib-esm/clients/index.js +10 -0
- package/lib-esm/clients/internal/composeServiceApi.d.ts +8 -0
- package/lib-esm/clients/internal/composeServiceApi.js +71 -0
- package/lib-esm/clients/internal/composeTransferHandler.d.ts +29 -0
- package/lib-esm/clients/internal/composeTransferHandler.js +22 -0
- package/lib-esm/clients/middleware/retry/defaultRetryDecider.d.ts +6 -0
- package/lib-esm/clients/middleware/retry/defaultRetryDecider.js +97 -0
- package/lib-esm/clients/middleware/retry/index.d.ts +3 -0
- package/lib-esm/clients/middleware/retry/index.js +5 -0
- package/lib-esm/clients/middleware/retry/jitteredBackoff.d.ts +2 -0
- package/lib-esm/clients/middleware/retry/jitteredBackoff.js +12 -0
- package/lib-esm/clients/middleware/retry/middleware.d.ts +40 -0
- package/lib-esm/clients/middleware/retry/middleware.js +138 -0
- package/lib-esm/clients/middleware/signing/index.d.ts +1 -0
- package/lib-esm/clients/middleware/signing/index.js +3 -0
- package/lib-esm/clients/middleware/signing/middleware.d.ts +13 -0
- package/lib-esm/clients/middleware/signing/middleware.js +97 -0
- package/lib-esm/clients/middleware/signing/signer/signatureV4/constants.js +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/index.js +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/index.native.js +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/presignUrl.js +39 -3
- package/lib-esm/clients/middleware/signing/signer/signatureV4/signRequest.js +15 -6
- package/lib-esm/clients/middleware/signing/signer/signatureV4/types/index.js +1 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/types/signer.js +1 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/dataHashHelpers.d.ts +3 -2
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/dataHashHelpers.js +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getCanonicalHeaders.d.ts +2 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getCanonicalHeaders.js +20 -6
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getCanonicalQueryString.js +18 -4
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getCanonicalRequest.js +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getCanonicalUri.js +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getCredentialScope.js +1 -2
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getFormattedDates.js +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getHashedPayload.d.ts +2 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getHashedPayload.js +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getSignature.js +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getSignedHeaders.d.ts +2 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getSignedHeaders.js +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getSigningKey.js +1 -2
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getSigningValues.js +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getStringToSign.js +0 -1
- package/lib-esm/clients/middleware/signing/utils/extendedEncodeURIComponent.d.ts +10 -0
- package/lib-esm/clients/middleware/signing/utils/extendedEncodeURIComponent.js +19 -0
- package/lib-esm/clients/middleware/signing/utils/getSkewCorrectedDate.d.ts +10 -0
- package/lib-esm/clients/middleware/signing/utils/getSkewCorrectedDate.js +14 -0
- package/lib-esm/clients/middleware/signing/utils/getUpdatedSystemClockOffset.d.ts +9 -0
- package/lib-esm/clients/middleware/signing/utils/getUpdatedSystemClockOffset.js +17 -0
- package/lib-esm/clients/middleware/signing/utils/isClockSkewed.d.ts +11 -0
- package/lib-esm/clients/middleware/signing/utils/isClockSkewed.js +19 -0
- package/lib-esm/clients/middleware/userAgent/index.d.ts +1 -0
- package/lib-esm/clients/middleware/userAgent/index.js +3 -0
- package/lib-esm/clients/middleware/userAgent/middleware.d.ts +13 -0
- package/lib-esm/clients/middleware/userAgent/middleware.js +73 -0
- package/lib-esm/clients/serde/index.d.ts +2 -0
- package/lib-esm/clients/serde/index.js +4 -0
- package/lib-esm/clients/serde/json.d.ts +12 -0
- package/lib-esm/clients/serde/json.js +110 -0
- package/lib-esm/clients/serde/responseInfo.d.ts +3 -0
- package/lib-esm/clients/serde/responseInfo.js +19 -0
- package/lib-esm/clients/types/aws.d.ts +18 -1
- package/lib-esm/clients/types/aws.js +1 -1
- package/lib-esm/clients/types/core.d.ts +22 -0
- package/lib-esm/clients/types/core.js +1 -1
- package/lib-esm/clients/types/http.d.ts +8 -4
- package/lib-esm/clients/types/http.js +1 -1
- package/lib-esm/clients/types/index.d.ts +3 -2
- package/lib-esm/clients/types/index.js +1 -1
- package/lib-esm/clients/utils/isClockSkewError.d.ts +9 -0
- package/lib-esm/clients/utils/isClockSkewError.js +23 -0
- package/lib-esm/constants.js +0 -1
- package/lib-esm/index.js +0 -1
- package/lib-esm/parseAWSExports.js +11 -2
- package/lib-esm/tsconfig.tsbuildinfo +1 -0
- package/lib-esm/types/index.js +1 -1
- package/lib-esm/types/types.d.ts +1 -1
- package/lib-esm/types/types.js +1 -1
- package/package.json +56 -22
- package/src/AwsClients/CognitoIdentity/base.ts +88 -0
- package/src/AwsClients/CognitoIdentity/getCredentialsForIdentity.ts +67 -0
- package/src/AwsClients/CognitoIdentity/getId.ts +58 -0
- package/src/AwsClients/CognitoIdentity/index.ts +9 -0
- package/src/AwsClients/CognitoIdentity/types.ts +159 -0
- package/src/AwsClients/Pinpoint/base.ts +41 -0
- package/src/AwsClients/Pinpoint/getInAppMessages.ts +56 -0
- package/src/AwsClients/Pinpoint/index.ts +15 -0
- package/src/AwsClients/Pinpoint/putEvents.ts +55 -0
- package/src/AwsClients/Pinpoint/types.ts +844 -0
- package/src/AwsClients/Pinpoint/updateEndpoint.ts +60 -0
- package/src/Credentials.ts +75 -100
- package/src/OAuthHelper/FacebookOAuth.ts +1 -1
- package/src/OAuthHelper/GoogleOAuth.ts +1 -1
- package/src/Platform/version.ts +1 -1
- package/src/StorageHelper/reactnative.ts +1 -1
- package/src/clients/endpoints/getDnsSuffix.ts +25 -0
- package/src/clients/endpoints/index.ts +4 -0
- package/src/clients/endpoints/partitions.ts +40 -0
- package/src/clients/handlers/authenticated.ts +19 -0
- package/src/clients/handlers/fetch.ts +75 -0
- package/src/clients/handlers/unauthenticated.ts +14 -0
- package/src/clients/index.ts +15 -0
- package/src/clients/internal/composeServiceApi.ts +50 -0
- package/src/clients/internal/composeTransferHandler.ts +89 -0
- package/src/clients/middleware/retry/defaultRetryDecider.ts +54 -0
- package/src/clients/middleware/retry/index.ts +6 -0
- package/src/clients/middleware/retry/jitteredBackoff.ts +16 -0
- package/src/clients/middleware/retry/middleware.ts +133 -0
- package/src/clients/middleware/signing/index.ts +4 -0
- package/src/clients/middleware/signing/middleware.ts +65 -0
- package/src/clients/middleware/signing/utils/extendedEncodeURIComponent.ts +21 -0
- package/src/clients/middleware/signing/utils/getSkewCorrectedDate.ts +14 -0
- package/src/clients/middleware/signing/utils/getUpdatedSystemClockOffset.ts +22 -0
- package/src/clients/middleware/signing/utils/isClockSkewed.ts +26 -0
- package/src/clients/middleware/userAgent/index.ts +4 -0
- package/src/clients/middleware/userAgent/middleware.ts +41 -0
- package/src/clients/serde/index.ts +5 -0
- package/src/clients/serde/json.ts +51 -0
- package/src/clients/serde/responseInfo.ts +20 -0
- package/src/clients/types/aws.ts +21 -0
- package/src/clients/types/core.ts +40 -0
- package/src/clients/types/http.ts +12 -2
- package/src/clients/types/index.ts +22 -2
- package/src/clients/utils/isClockSkewError.ts +24 -0
- package/lib/.tsbuildinfo +0 -3
- package/lib/Amplify.js.map +0 -1
- package/lib/ClientDevice/android.js.map +0 -1
- package/lib/ClientDevice/browser.js.map +0 -1
- package/lib/ClientDevice/index.js.map +0 -1
- package/lib/ClientDevice/ios.js.map +0 -1
- package/lib/ClientDevice/reactnative.js.map +0 -1
- package/lib/Credentials.js.map +0 -1
- package/lib/Errors.js.map +0 -1
- package/lib/Hub.js.map +0 -1
- package/lib/I18n/I18n.js.map +0 -1
- package/lib/I18n/index.js.map +0 -1
- package/lib/I18n/types.js.map +0 -1
- package/lib/JS.js.map +0 -1
- package/lib/Logger/ConsoleLogger.js.map +0 -1
- package/lib/Logger/index.js.map +0 -1
- package/lib/Logger/logger-interface.js.map +0 -1
- package/lib/OAuthHelper/FacebookOAuth.js.map +0 -1
- package/lib/OAuthHelper/GoogleOAuth.js.map +0 -1
- package/lib/OAuthHelper/index.js.map +0 -1
- package/lib/Platform/index.js.map +0 -1
- package/lib/Platform/version.js.map +0 -1
- package/lib/Providers/AWSCloudWatchProvider.js.map +0 -1
- package/lib/Providers/index.js.map +0 -1
- package/lib/RNComponents/index.js.map +0 -1
- package/lib/RNComponents/reactnative.js.map +0 -1
- package/lib/ServiceWorker/ServiceWorker.js.map +0 -1
- package/lib/ServiceWorker/index.js.map +0 -1
- package/lib/Signer.js.map +0 -1
- package/lib/StorageHelper/index.js.map +0 -1
- package/lib/StorageHelper/reactnative.js.map +0 -1
- package/lib/UniversalStorage/index.js.map +0 -1
- package/lib/Util/BackgroundProcessManager.js.map +0 -1
- package/lib/Util/CognitoIdentityClient.d.ts +0 -14
- package/lib/Util/CognitoIdentityClient.js +0 -31
- package/lib/Util/CognitoIdentityClient.js.map +0 -1
- package/lib/Util/Constants.js.map +0 -1
- package/lib/Util/DateUtils.js.map +0 -1
- package/lib/Util/Mutex.js.map +0 -1
- package/lib/Util/Reachability.js.map +0 -1
- package/lib/Util/Reachability.native.js.map +0 -1
- package/lib/Util/Retry.js.map +0 -1
- package/lib/Util/StringUtils.js.map +0 -1
- package/lib/Util/index.js.map +0 -1
- package/lib/clients/middleware/signing/signer/signatureV4/constants.js.map +0 -1
- package/lib/clients/middleware/signing/signer/signatureV4/index.js.map +0 -1
- package/lib/clients/middleware/signing/signer/signatureV4/index.native.js.map +0 -1
- package/lib/clients/middleware/signing/signer/signatureV4/presignUrl.js.map +0 -1
- package/lib/clients/middleware/signing/signer/signatureV4/signRequest.js.map +0 -1
- package/lib/clients/middleware/signing/signer/signatureV4/types/index.js.map +0 -1
- package/lib/clients/middleware/signing/signer/signatureV4/types/signer.js.map +0 -1
- package/lib/clients/middleware/signing/signer/signatureV4/utils/dataHashHelpers.js.map +0 -1
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getCanonicalHeaders.js.map +0 -1
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getCanonicalQueryString.js.map +0 -1
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getCanonicalRequest.js.map +0 -1
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getCanonicalUri.js.map +0 -1
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getCredentialScope.js.map +0 -1
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getFormattedDates.js.map +0 -1
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getHashedPayload.js.map +0 -1
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getSignature.js.map +0 -1
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getSignedHeaders.js.map +0 -1
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getSigningKey.js.map +0 -1
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getSigningValues.js.map +0 -1
- package/lib/clients/middleware/signing/signer/signatureV4/utils/getStringToSign.js.map +0 -1
- package/lib/clients/types/aws.js.map +0 -1
- package/lib/clients/types/core.js.map +0 -1
- package/lib/clients/types/http.js.map +0 -1
- package/lib/clients/types/index.js.map +0 -1
- package/lib/constants.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/parseAWSExports.js.map +0 -1
- package/lib/types/index.js.map +0 -1
- package/lib/types/types.js.map +0 -1
- package/lib-esm/.tsbuildinfo +0 -3
- package/lib-esm/Amplify.js.map +0 -1
- package/lib-esm/ClientDevice/android.js.map +0 -1
- package/lib-esm/ClientDevice/browser.js.map +0 -1
- package/lib-esm/ClientDevice/index.js.map +0 -1
- package/lib-esm/ClientDevice/ios.js.map +0 -1
- package/lib-esm/ClientDevice/reactnative.js.map +0 -1
- package/lib-esm/Credentials.js.map +0 -1
- package/lib-esm/Errors.js.map +0 -1
- package/lib-esm/Hub.js.map +0 -1
- package/lib-esm/I18n/I18n.js.map +0 -1
- package/lib-esm/I18n/index.js.map +0 -1
- package/lib-esm/I18n/types.js.map +0 -1
- package/lib-esm/JS.js.map +0 -1
- package/lib-esm/Logger/ConsoleLogger.js.map +0 -1
- package/lib-esm/Logger/index.js.map +0 -1
- package/lib-esm/Logger/logger-interface.js.map +0 -1
- package/lib-esm/OAuthHelper/FacebookOAuth.js.map +0 -1
- package/lib-esm/OAuthHelper/GoogleOAuth.js.map +0 -1
- package/lib-esm/OAuthHelper/index.js.map +0 -1
- package/lib-esm/Platform/index.js.map +0 -1
- package/lib-esm/Platform/version.js.map +0 -1
- package/lib-esm/Providers/AWSCloudWatchProvider.js.map +0 -1
- package/lib-esm/Providers/index.js.map +0 -1
- package/lib-esm/RNComponents/index.js.map +0 -1
- package/lib-esm/RNComponents/reactnative.js.map +0 -1
- package/lib-esm/ServiceWorker/ServiceWorker.js.map +0 -1
- package/lib-esm/ServiceWorker/index.js.map +0 -1
- package/lib-esm/Signer.js.map +0 -1
- package/lib-esm/StorageHelper/index.js.map +0 -1
- package/lib-esm/StorageHelper/reactnative.js.map +0 -1
- package/lib-esm/UniversalStorage/index.js.map +0 -1
- package/lib-esm/Util/BackgroundProcessManager.js.map +0 -1
- package/lib-esm/Util/CognitoIdentityClient.d.ts +0 -14
- package/lib-esm/Util/CognitoIdentityClient.js +0 -27
- package/lib-esm/Util/CognitoIdentityClient.js.map +0 -1
- package/lib-esm/Util/Constants.js.map +0 -1
- package/lib-esm/Util/DateUtils.js.map +0 -1
- package/lib-esm/Util/Mutex.js.map +0 -1
- package/lib-esm/Util/Reachability.js.map +0 -1
- package/lib-esm/Util/Reachability.native.js.map +0 -1
- package/lib-esm/Util/Retry.js.map +0 -1
- package/lib-esm/Util/StringUtils.js.map +0 -1
- package/lib-esm/Util/index.js.map +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/constants.js.map +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/index.js.map +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/index.native.js.map +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/presignUrl.js.map +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/signRequest.js.map +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/types/index.js.map +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/types/signer.js.map +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/dataHashHelpers.js.map +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getCanonicalHeaders.js.map +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getCanonicalQueryString.js.map +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getCanonicalRequest.js.map +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getCanonicalUri.js.map +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getCredentialScope.js.map +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getFormattedDates.js.map +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getHashedPayload.js.map +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getSignature.js.map +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getSignedHeaders.js.map +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getSigningKey.js.map +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getSigningValues.js.map +0 -1
- package/lib-esm/clients/middleware/signing/signer/signatureV4/utils/getStringToSign.js.map +0 -1
- package/lib-esm/clients/types/aws.js.map +0 -1
- package/lib-esm/clients/types/core.js.map +0 -1
- package/lib-esm/clients/types/http.js.map +0 -1
- package/lib-esm/clients/types/index.js.map +0 -1
- package/lib-esm/constants.js.map +0 -1
- package/lib-esm/index.js.map +0 -1
- package/lib-esm/parseAWSExports.js.map +0 -1
- package/lib-esm/types/index.js.map +0 -1
- package/lib-esm/types/types.js.map +0 -1
- package/src/Util/CognitoIdentityClient.ts +0 -48
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Endpoint, HttpResponse } from '../../clients/types';
|
|
2
|
+
import type { UpdateEndpointCommandInput as UpdateEndpointInput, UpdateEndpointCommandOutput as UpdateEndpointOutput } from './types';
|
|
3
|
+
export type { UpdateEndpointInput, UpdateEndpointOutput };
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare const updateEndpoint: (config: Omit<import("../../clients/middleware/userAgent").UserAgentOptions & import("../../clients/middleware/retry").RetryOptions<HttpResponse> & import("../../clients/middleware/signing").SigningOptions & import("../../clients/types").ServiceClientOptions, "retryDecider" | "computeDelay" | "userAgentValue" | "service" | "endpointResolver"> & {
|
|
8
|
+
retryDecider?: (response?: HttpResponse, error?: unknown) => Promise<boolean>;
|
|
9
|
+
computeDelay?: (attempt: number) => number;
|
|
10
|
+
userAgentValue?: string;
|
|
11
|
+
service?: string;
|
|
12
|
+
endpointResolver?: (options: import("../../clients/types").EndpointResolverOptions) => Endpoint;
|
|
13
|
+
}, input: UpdateEndpointInput) => Promise<UpdateEndpointOutput>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
13
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
14
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
15
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
16
|
+
function step(op) {
|
|
17
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
18
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
19
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
20
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
21
|
+
switch (op[0]) {
|
|
22
|
+
case 0: case 1: t = op; break;
|
|
23
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
24
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
25
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
26
|
+
default:
|
|
27
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
28
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
29
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
30
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
31
|
+
if (t[2]) _.ops.pop();
|
|
32
|
+
_.trys.pop(); continue;
|
|
33
|
+
}
|
|
34
|
+
op = body.call(thisArg, _);
|
|
35
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
36
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
import { authenticatedHandler } from '../../clients/handlers/authenticated';
|
|
40
|
+
import { composeServiceApi } from '../../clients/internal/composeServiceApi';
|
|
41
|
+
import { extendedEncodeURIComponent } from '../../clients/middleware/signing/utils/extendedEncodeURIComponent';
|
|
42
|
+
import { parseJsonBody, parseJsonError, parseMetadata, } from '../../clients/serde';
|
|
43
|
+
import { defaultConfig, getSharedHeaders } from './base';
|
|
44
|
+
var updateEndpointSerializer = function (_a, endpoint) {
|
|
45
|
+
var ApplicationId = _a.ApplicationId, EndpointId = _a.EndpointId, EndpointRequest = _a.EndpointRequest;
|
|
46
|
+
var headers = getSharedHeaders();
|
|
47
|
+
var url = new URL(endpoint.url);
|
|
48
|
+
url.pathname = "v1/apps/".concat(extendedEncodeURIComponent(ApplicationId), "/endpoints/").concat(extendedEncodeURIComponent(EndpointId));
|
|
49
|
+
var body = JSON.stringify(EndpointRequest !== null && EndpointRequest !== void 0 ? EndpointRequest : {});
|
|
50
|
+
return { method: 'PUT', headers: headers, url: url, body: body };
|
|
51
|
+
};
|
|
52
|
+
var updateEndpointDeserializer = function (response) { return __awaiter(void 0, void 0, void 0, function () {
|
|
53
|
+
var error, _a, Message, RequestID;
|
|
54
|
+
return __generator(this, function (_b) {
|
|
55
|
+
switch (_b.label) {
|
|
56
|
+
case 0:
|
|
57
|
+
if (!(response.statusCode >= 300)) return [3 /*break*/, 2];
|
|
58
|
+
return [4 /*yield*/, parseJsonError(response)];
|
|
59
|
+
case 1:
|
|
60
|
+
error = _b.sent();
|
|
61
|
+
throw error;
|
|
62
|
+
case 2: return [4 /*yield*/, parseJsonBody(response)];
|
|
63
|
+
case 3:
|
|
64
|
+
_a = _b.sent(), Message = _a.Message, RequestID = _a.RequestID;
|
|
65
|
+
return [2 /*return*/, {
|
|
66
|
+
MessageBody: {
|
|
67
|
+
Message: Message,
|
|
68
|
+
RequestID: RequestID,
|
|
69
|
+
},
|
|
70
|
+
$metadata: parseMetadata(response),
|
|
71
|
+
}];
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}); };
|
|
75
|
+
/**
|
|
76
|
+
* @internal
|
|
77
|
+
*/
|
|
78
|
+
export var updateEndpoint = composeServiceApi(authenticatedHandler, updateEndpointSerializer, updateEndpointDeserializer, defaultConfig);
|
package/lib-esm/Credentials.js
CHANGED
|
@@ -1,15 +1,59 @@
|
|
|
1
|
-
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
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;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
2
48
|
import { ConsoleLogger as Logger } from './Logger';
|
|
3
49
|
import { StorageHelper } from './StorageHelper';
|
|
4
50
|
import { makeQuerablePromise } from './JS';
|
|
5
51
|
import { FacebookOAuth, GoogleOAuth } from './OAuthHelper';
|
|
6
52
|
import { jitteredExponentialRetry } from './Util';
|
|
7
53
|
import { Amplify } from './Amplify';
|
|
8
|
-
import {
|
|
9
|
-
import { GetIdCommand, GetCredentialsForIdentityCommand, } from '@aws-sdk/client-cognito-identity';
|
|
54
|
+
import { getId, getCredentialsForIdentity } from './AwsClients/CognitoIdentity';
|
|
10
55
|
import { parseAWSExports } from './parseAWSExports';
|
|
11
56
|
import { Hub } from './Hub';
|
|
12
|
-
import { createCognitoIdentityClient } from './Util/CognitoIdentityClient';
|
|
13
57
|
var logger = new Logger('Credentials');
|
|
14
58
|
var CREDENTIALS_TTL = 50 * 60 * 1000; // 50 min, can be modified on config if required in the future
|
|
15
59
|
var COGNITO_IDENTITY_KEY_PREFIX = 'CognitoIdentityId-';
|
|
@@ -62,7 +106,7 @@ var CredentialsClass = /** @class */ (function () {
|
|
|
62
106
|
};
|
|
63
107
|
// currently we only store the guest identity in local storage
|
|
64
108
|
CredentialsClass.prototype._getCognitoIdentityIdStorageKey = function (identityPoolId) {
|
|
65
|
-
return ""
|
|
109
|
+
return "".concat(COGNITO_IDENTITY_KEY_PREFIX).concat(identityPoolId);
|
|
66
110
|
};
|
|
67
111
|
CredentialsClass.prototype._pickupCredentials = function () {
|
|
68
112
|
logger.debug('picking up credentials');
|
|
@@ -210,7 +254,7 @@ var CredentialsClass = /** @class */ (function () {
|
|
|
210
254
|
CredentialsClass.prototype._setCredentialsForGuest = function () {
|
|
211
255
|
var _a;
|
|
212
256
|
return __awaiter(this, void 0, void 0, function () {
|
|
213
|
-
var _b, identityPoolId, region, mandatorySignIn, identityPoolRegion, identityId, _c,
|
|
257
|
+
var _b, identityPoolId, region, mandatorySignIn, identityPoolRegion, identityId, _c, cognitoConfig, guestCredentialsProvider, credentials;
|
|
214
258
|
var _this = this;
|
|
215
259
|
return __generator(this, function (_d) {
|
|
216
260
|
switch (_d.label) {
|
|
@@ -237,79 +281,82 @@ var CredentialsClass = /** @class */ (function () {
|
|
|
237
281
|
return [4 /*yield*/, this._getGuestIdentityId()];
|
|
238
282
|
case 1:
|
|
239
283
|
identityId = (_c._identityId = _d.sent());
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
};
|
|
249
|
-
credentials = fromCognitoIdentity(cognitoIdentityParams)();
|
|
250
|
-
}
|
|
251
|
-
else {
|
|
252
|
-
credentialsProvider = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
253
|
-
var IdentityId, cognitoIdentityParams, credentialsFromCognitoIdentity;
|
|
254
|
-
return __generator(this, function (_a) {
|
|
255
|
-
switch (_a.label) {
|
|
256
|
-
case 0: return [4 /*yield*/, cognitoClient.send(new GetIdCommand({
|
|
284
|
+
cognitoConfig = { region: identityPoolRegion !== null && identityPoolRegion !== void 0 ? identityPoolRegion : region };
|
|
285
|
+
guestCredentialsProvider = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
286
|
+
var IdentityId, Credentials;
|
|
287
|
+
return __generator(this, function (_a) {
|
|
288
|
+
switch (_a.label) {
|
|
289
|
+
case 0:
|
|
290
|
+
if (!!identityId) return [3 /*break*/, 2];
|
|
291
|
+
return [4 /*yield*/, getId(cognitoConfig, {
|
|
257
292
|
IdentityPoolId: identityPoolId,
|
|
258
|
-
})
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
293
|
+
})];
|
|
294
|
+
case 1:
|
|
295
|
+
IdentityId = (_a.sent()).IdentityId;
|
|
296
|
+
this._identityId = IdentityId;
|
|
297
|
+
_a.label = 2;
|
|
298
|
+
case 2: return [4 /*yield*/, getCredentialsForIdentity(cognitoConfig, {
|
|
299
|
+
IdentityId: this._identityId,
|
|
300
|
+
})];
|
|
301
|
+
case 3:
|
|
302
|
+
Credentials = (_a.sent()).Credentials;
|
|
303
|
+
return [2 /*return*/, {
|
|
304
|
+
identityId: this._identityId,
|
|
305
|
+
accessKeyId: Credentials.AccessKeyId,
|
|
306
|
+
secretAccessKey: Credentials.SecretKey,
|
|
307
|
+
sessionToken: Credentials.SessionToken,
|
|
308
|
+
expiration: Credentials.Expiration,
|
|
309
|
+
}];
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
}); };
|
|
313
|
+
credentials = guestCredentialsProvider().catch(function (err) { return __awaiter(_this, void 0, void 0, function () {
|
|
314
|
+
return __generator(this, function (_a) {
|
|
315
|
+
throw err;
|
|
316
|
+
});
|
|
317
|
+
}); });
|
|
277
318
|
return [2 /*return*/, this._loadCredentials(credentials, 'guest', false, null)
|
|
278
319
|
.then(function (res) {
|
|
279
320
|
return res;
|
|
280
321
|
})
|
|
281
322
|
.catch(function (e) { return __awaiter(_this, void 0, void 0, function () {
|
|
282
|
-
var
|
|
323
|
+
var guestCredentialsProvider_1;
|
|
283
324
|
var _this = this;
|
|
284
325
|
return __generator(this, function (_a) {
|
|
285
326
|
switch (_a.label) {
|
|
286
327
|
case 0:
|
|
287
328
|
if (!(e.name === 'ResourceNotFoundException' &&
|
|
288
|
-
e.message === "Identity '"
|
|
329
|
+
e.message === "Identity '".concat(identityId, "' not found."))) return [3 /*break*/, 2];
|
|
289
330
|
logger.debug('Failed to load guest credentials');
|
|
290
331
|
return [4 /*yield*/, this._removeGuestIdentityId()];
|
|
291
332
|
case 1:
|
|
292
333
|
_a.sent();
|
|
293
|
-
|
|
294
|
-
var IdentityId,
|
|
334
|
+
guestCredentialsProvider_1 = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
335
|
+
var IdentityId, Credentials;
|
|
295
336
|
return __generator(this, function (_a) {
|
|
296
337
|
switch (_a.label) {
|
|
297
|
-
case 0: return [4 /*yield*/,
|
|
338
|
+
case 0: return [4 /*yield*/, getId(cognitoConfig, {
|
|
298
339
|
IdentityPoolId: identityPoolId,
|
|
299
|
-
})
|
|
340
|
+
})];
|
|
300
341
|
case 1:
|
|
301
342
|
IdentityId = (_a.sent()).IdentityId;
|
|
302
343
|
this._identityId = IdentityId;
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
return [2 /*return*/,
|
|
344
|
+
return [4 /*yield*/, getCredentialsForIdentity(cognitoConfig, {
|
|
345
|
+
IdentityId: IdentityId,
|
|
346
|
+
})];
|
|
347
|
+
case 2:
|
|
348
|
+
Credentials = (_a.sent()).Credentials;
|
|
349
|
+
return [2 /*return*/, {
|
|
350
|
+
identityId: IdentityId,
|
|
351
|
+
accessKeyId: Credentials.AccessKeyId,
|
|
352
|
+
secretAccessKey: Credentials.SecretKey,
|
|
353
|
+
sessionToken: Credentials.SessionToken,
|
|
354
|
+
expiration: Credentials.Expiration,
|
|
355
|
+
}];
|
|
309
356
|
}
|
|
310
357
|
});
|
|
311
358
|
}); };
|
|
312
|
-
credentials =
|
|
359
|
+
credentials = guestCredentialsProvider_1().catch(function (err) { return __awaiter(_this, void 0, void 0, function () {
|
|
313
360
|
return __generator(this, function (_a) {
|
|
314
361
|
throw err;
|
|
315
362
|
});
|
|
@@ -324,7 +371,9 @@ var CredentialsClass = /** @class */ (function () {
|
|
|
324
371
|
});
|
|
325
372
|
};
|
|
326
373
|
CredentialsClass.prototype._setCredentialsFromFederation = function (params) {
|
|
327
|
-
var
|
|
374
|
+
var _this = this;
|
|
375
|
+
var provider = params.provider, token = params.token;
|
|
376
|
+
var identity_id = params.identity_id;
|
|
328
377
|
var domains = {
|
|
329
378
|
google: 'accounts.google.com',
|
|
330
379
|
facebook: 'graph.facebook.com',
|
|
@@ -347,26 +396,42 @@ var CredentialsClass = /** @class */ (function () {
|
|
|
347
396
|
logger.debug('region is not configured for getting the credentials');
|
|
348
397
|
return Promise.reject('region is not configured for getting the credentials');
|
|
349
398
|
}
|
|
350
|
-
var
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
399
|
+
var cognitoConfig = { region: identityPoolRegion !== null && identityPoolRegion !== void 0 ? identityPoolRegion : region };
|
|
400
|
+
var authenticatedCredentialsProvider = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
401
|
+
var IdentityId, Credentials;
|
|
402
|
+
return __generator(this, function (_a) {
|
|
403
|
+
switch (_a.label) {
|
|
404
|
+
case 0:
|
|
405
|
+
if (!!identity_id) return [3 /*break*/, 2];
|
|
406
|
+
return [4 /*yield*/, getId(cognitoConfig, {
|
|
407
|
+
IdentityPoolId: identityPoolId,
|
|
408
|
+
Logins: logins,
|
|
409
|
+
})];
|
|
410
|
+
case 1:
|
|
411
|
+
IdentityId = (_a.sent()).IdentityId;
|
|
412
|
+
identity_id = IdentityId;
|
|
413
|
+
_a.label = 2;
|
|
414
|
+
case 2: return [4 /*yield*/, getCredentialsForIdentity(cognitoConfig, {
|
|
415
|
+
IdentityId: identity_id,
|
|
416
|
+
Logins: logins,
|
|
417
|
+
})];
|
|
418
|
+
case 3:
|
|
419
|
+
Credentials = (_a.sent()).Credentials;
|
|
420
|
+
return [2 /*return*/, {
|
|
421
|
+
identityId: identity_id,
|
|
422
|
+
accessKeyId: Credentials.AccessKeyId,
|
|
423
|
+
secretAccessKey: Credentials.SecretKey,
|
|
424
|
+
sessionToken: Credentials.SessionToken,
|
|
425
|
+
expiration: Credentials.Expiration,
|
|
426
|
+
}];
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
}); };
|
|
430
|
+
var credentials = authenticatedCredentialsProvider().catch(function (err) { return __awaiter(_this, void 0, void 0, function () {
|
|
431
|
+
return __generator(this, function (_a) {
|
|
432
|
+
throw err;
|
|
433
|
+
});
|
|
434
|
+
}); });
|
|
370
435
|
return this._loadCredentials(credentials, 'federated', true, params);
|
|
371
436
|
};
|
|
372
437
|
CredentialsClass.prototype._setCredentialsFromSession = function (session) {
|
|
@@ -385,9 +450,7 @@ var CredentialsClass = /** @class */ (function () {
|
|
|
385
450
|
var key = 'cognito-idp.' + region + '.amazonaws.com/' + userPoolId;
|
|
386
451
|
var logins = {};
|
|
387
452
|
logins[key] = idToken;
|
|
388
|
-
var
|
|
389
|
-
region: identityPoolRegion || region,
|
|
390
|
-
});
|
|
453
|
+
var cognitoConfig = { region: identityPoolRegion !== null && identityPoolRegion !== void 0 ? identityPoolRegion : region };
|
|
391
454
|
/*
|
|
392
455
|
Retreiving identityId with GetIdCommand to mimic the behavior in the following code in aws-sdk-v3:
|
|
393
456
|
https://git.io/JeDxU
|
|
@@ -402,27 +465,27 @@ var CredentialsClass = /** @class */ (function () {
|
|
|
402
465
|
case 1:
|
|
403
466
|
guestIdentityId = _c.sent();
|
|
404
467
|
if (!!guestIdentityId) return [3 /*break*/, 3];
|
|
405
|
-
return [4 /*yield*/,
|
|
468
|
+
return [4 /*yield*/, getId(cognitoConfig, {
|
|
406
469
|
IdentityPoolId: identityPoolId,
|
|
407
470
|
Logins: logins,
|
|
408
|
-
})
|
|
471
|
+
})];
|
|
409
472
|
case 2:
|
|
410
473
|
IdentityId = (_c.sent()).IdentityId;
|
|
411
474
|
generatedOrRetrievedIdentityId = IdentityId;
|
|
412
475
|
_c.label = 3;
|
|
413
|
-
case 3: return [4 /*yield*/,
|
|
476
|
+
case 3: return [4 /*yield*/, getCredentialsForIdentity(cognitoConfig, {
|
|
414
477
|
IdentityId: guestIdentityId || generatedOrRetrievedIdentityId,
|
|
415
478
|
Logins: logins,
|
|
416
|
-
})
|
|
479
|
+
})];
|
|
417
480
|
case 4:
|
|
418
481
|
_a = _c.sent(), _b = _a.Credentials, AccessKeyId = _b.AccessKeyId, Expiration = _b.Expiration, SecretKey = _b.SecretKey, SessionToken = _b.SessionToken, primaryIdentityId = _a.IdentityId;
|
|
419
482
|
this._identityId = primaryIdentityId;
|
|
420
483
|
if (!guestIdentityId) return [3 /*break*/, 6];
|
|
421
484
|
// if guestIdentity is found and used by GetCredentialsForIdentity
|
|
422
485
|
// it will be linked to the logins provided, and disqualified as an unauth identity
|
|
423
|
-
logger.debug("The guest identity "
|
|
486
|
+
logger.debug("The guest identity ".concat(guestIdentityId, " has been successfully linked to the logins"));
|
|
424
487
|
if (guestIdentityId === primaryIdentityId) {
|
|
425
|
-
logger.debug("The guest identity "
|
|
488
|
+
logger.debug("The guest identity ".concat(guestIdentityId, " has become the primary identity"));
|
|
426
489
|
}
|
|
427
490
|
// remove it from local storage to avoid being used as a guest Identity by _setCredentialsForGuest
|
|
428
491
|
return [4 /*yield*/, this._removeGuestIdentityId()];
|
|
@@ -583,7 +646,7 @@ var CredentialsClass = /** @class */ (function () {
|
|
|
583
646
|
var identityPoolId;
|
|
584
647
|
return __generator(this, function (_a) {
|
|
585
648
|
identityPoolId = this._config.identityPoolId;
|
|
586
|
-
logger.debug("removing "
|
|
649
|
+
logger.debug("removing ".concat(this._getCognitoIdentityIdStorageKey(identityPoolId), " from storage"));
|
|
587
650
|
this._storage.removeItem(this._getCognitoIdentityIdStorageKey(identityPoolId));
|
|
588
651
|
return [2 /*return*/];
|
|
589
652
|
});
|
|
@@ -608,4 +671,3 @@ var CredentialsClass = /** @class */ (function () {
|
|
|
608
671
|
export { CredentialsClass };
|
|
609
672
|
export var Credentials = new CredentialsClass(null);
|
|
610
673
|
Amplify.register(Credentials);
|
|
611
|
-
//# sourceMappingURL=Credentials.js.map
|
package/lib-esm/Errors.js
CHANGED
package/lib-esm/Hub.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type HubCapsule = {
|
|
2
2
|
channel: string;
|
|
3
3
|
payload: HubPayload;
|
|
4
4
|
source: string;
|
|
5
5
|
patternInfo?: string[];
|
|
6
6
|
};
|
|
7
|
-
export
|
|
7
|
+
export type HubPayload = {
|
|
8
8
|
event: string;
|
|
9
9
|
data?: any;
|
|
10
10
|
message?: string;
|
|
11
11
|
};
|
|
12
|
-
export
|
|
13
|
-
export
|
|
12
|
+
export type HubCallback = (capsule: HubCapsule) => void;
|
|
13
|
+
export type LegacyCallback = {
|
|
14
14
|
onHubCapsule: HubCallback;
|
|
15
15
|
};
|
|
16
16
|
export declare class HubClass {
|
package/lib-esm/Hub.js
CHANGED
|
@@ -1,6 +1,41 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
3
|
+
var __assign = (this && this.__assign) || function () {
|
|
4
|
+
__assign = Object.assign || function(t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8
|
+
t[p] = s[p];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
return __assign.apply(this, arguments);
|
|
13
|
+
};
|
|
14
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
15
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
16
|
+
if (!m) return o;
|
|
17
|
+
var i = m.call(o), r, ar = [], e;
|
|
18
|
+
try {
|
|
19
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
20
|
+
}
|
|
21
|
+
catch (error) { e = { error: error }; }
|
|
22
|
+
finally {
|
|
23
|
+
try {
|
|
24
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
25
|
+
}
|
|
26
|
+
finally { if (e) throw e.error; }
|
|
27
|
+
}
|
|
28
|
+
return ar;
|
|
29
|
+
};
|
|
30
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
31
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
32
|
+
if (ar || !(i in from)) {
|
|
33
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
34
|
+
ar[i] = from[i];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
38
|
+
};
|
|
4
39
|
import { ConsoleLogger as Logger } from './Logger';
|
|
5
40
|
var logger = new Logger('Hub');
|
|
6
41
|
var AMPLIFY_SYMBOL = (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function'
|
|
@@ -39,21 +74,21 @@ var HubClass = /** @class */ (function () {
|
|
|
39
74
|
return pattern.source === channel.source;
|
|
40
75
|
});
|
|
41
76
|
if (!pattern_1) {
|
|
42
|
-
logger.warn("No listeners for "
|
|
77
|
+
logger.warn("No listeners for ".concat(channel));
|
|
43
78
|
return;
|
|
44
79
|
}
|
|
45
|
-
this.patterns =
|
|
80
|
+
this.patterns = __spreadArray([], __read(this.patterns.filter(function (x) { return x !== pattern_1; })), false);
|
|
46
81
|
}
|
|
47
82
|
else {
|
|
48
83
|
var holder = this.listeners[channel];
|
|
49
84
|
if (!holder) {
|
|
50
|
-
logger.warn("No listeners for "
|
|
85
|
+
logger.warn("No listeners for ".concat(channel));
|
|
51
86
|
return;
|
|
52
87
|
}
|
|
53
|
-
this.listeners[channel] =
|
|
88
|
+
this.listeners[channel] = __spreadArray([], __read(holder.filter(function (_a) {
|
|
54
89
|
var callback = _a.callback;
|
|
55
90
|
return callback !== listener;
|
|
56
|
-
}));
|
|
91
|
+
})), false);
|
|
57
92
|
}
|
|
58
93
|
};
|
|
59
94
|
/**
|
|
@@ -76,7 +111,7 @@ var HubClass = /** @class */ (function () {
|
|
|
76
111
|
if (this.protectedChannels.indexOf(channel) > -1) {
|
|
77
112
|
var hasAccess = ampSymbol === AMPLIFY_SYMBOL;
|
|
78
113
|
if (!hasAccess) {
|
|
79
|
-
logger.warn("WARNING: "
|
|
114
|
+
logger.warn("WARNING: ".concat(channel, " is protected and dispatching on it can have unintended consequences"));
|
|
80
115
|
}
|
|
81
116
|
}
|
|
82
117
|
var capsule = {
|
|
@@ -142,7 +177,7 @@ var HubClass = /** @class */ (function () {
|
|
|
142
177
|
var holder = this.listeners[channel];
|
|
143
178
|
if (holder) {
|
|
144
179
|
holder.forEach(function (listener) {
|
|
145
|
-
logger.debug("Dispatching to "
|
|
180
|
+
logger.debug("Dispatching to ".concat(channel, " with "), payload);
|
|
146
181
|
try {
|
|
147
182
|
listener.callback(capsule);
|
|
148
183
|
}
|
|
@@ -179,4 +214,3 @@ export { HubClass };
|
|
|
179
214
|
pseudo Singleton for the main messaging bus, however you can still create
|
|
180
215
|
your own instance of HubClass() for a separate "private bus" of events.*/
|
|
181
216
|
export var Hub = new HubClass('__default__');
|
|
182
|
-
//# sourceMappingURL=Hub.js.map
|
package/lib-esm/I18n/I18n.js
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
3
|
+
var __assign = (this && this.__assign) || function () {
|
|
4
|
+
__assign = Object.assign || function(t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8
|
+
t[p] = s[p];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
return __assign.apply(this, arguments);
|
|
13
|
+
};
|
|
4
14
|
import { ConsoleLogger as Logger } from '../Logger';
|
|
5
15
|
var logger = new Logger('I18n');
|
|
6
16
|
/**
|
|
@@ -113,4 +123,3 @@ var I18n = /** @class */ (function () {
|
|
|
113
123
|
return I18n;
|
|
114
124
|
}());
|
|
115
125
|
export { I18n };
|
|
116
|
-
//# sourceMappingURL=I18n.js.map
|
package/lib-esm/I18n/index.js
CHANGED
package/lib-esm/I18n/types.js
CHANGED