@aws-amplify/core 6.11.4 → 6.11.5-local-stack.00864ae.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/dist/cjs/BackgroundProcessManager/types.js +5 -1
- package/dist/cjs/BackgroundProcessManager/types.js.map +1 -1
- package/dist/cjs/Cache/constants.js +3 -3
- package/dist/cjs/Cache/constants.js.map +1 -1
- package/dist/cjs/Cache/utils/cacheHelpers.js +4 -4
- package/dist/cjs/Cache/utils/cacheHelpers.js.map +1 -1
- package/dist/cjs/Cache/utils/errorHelpers.js +1 -1
- package/dist/cjs/Cache/utils/errorHelpers.js.map +1 -1
- package/dist/cjs/I18n/errorHelpers.js +1 -1
- package/dist/cjs/I18n/errorHelpers.js.map +1 -1
- package/dist/cjs/Logger/types.js +2 -1
- package/dist/cjs/Logger/types.js.map +1 -1
- package/dist/cjs/Platform/detectFramework.js +2 -2
- package/dist/cjs/Platform/detectFramework.js.map +1 -1
- package/dist/cjs/Platform/detection/Angular.js +2 -3
- package/dist/cjs/Platform/detection/Angular.js.map +1 -1
- package/dist/cjs/Platform/detection/Expo.js +1 -2
- package/dist/cjs/Platform/detection/Expo.js.map +1 -1
- package/dist/cjs/Platform/detection/Next.js +2 -3
- package/dist/cjs/Platform/detection/Next.js.map +1 -1
- package/dist/cjs/Platform/detection/Nuxt.js +2 -3
- package/dist/cjs/Platform/detection/Nuxt.js.map +1 -1
- package/dist/cjs/Platform/detection/React.js +2 -3
- package/dist/cjs/Platform/detection/React.js.map +1 -1
- package/dist/cjs/Platform/detection/ReactNative.js +1 -2
- package/dist/cjs/Platform/detection/ReactNative.js.map +1 -1
- package/dist/cjs/Platform/detection/Svelte.js +2 -3
- package/dist/cjs/Platform/detection/Svelte.js.map +1 -1
- package/dist/cjs/Platform/detection/Vue.js +2 -3
- package/dist/cjs/Platform/detection/Vue.js.map +1 -1
- package/dist/cjs/Platform/detection/Web.js +1 -2
- package/dist/cjs/Platform/detection/Web.js.map +1 -1
- package/dist/cjs/Platform/detection/index.js +1 -2
- package/dist/cjs/Platform/detection/index.js.map +1 -1
- package/dist/cjs/Platform/types.js +28 -14
- package/dist/cjs/Platform/types.js.map +1 -1
- package/dist/cjs/Platform/version.js +1 -1
- package/dist/cjs/Platform/version.js.map +1 -1
- package/dist/cjs/ServiceWorker/errorHelpers.js +1 -1
- package/dist/cjs/ServiceWorker/errorHelpers.js.map +1 -1
- package/dist/cjs/awsClients/pinpoint/errorHelpers.js +1 -1
- package/dist/cjs/awsClients/pinpoint/errorHelpers.js.map +1 -1
- package/dist/cjs/foundation/factories/middleware/createDisableCacheMiddleware.js +15 -0
- package/dist/cjs/foundation/factories/middleware/createDisableCacheMiddleware.js.map +1 -0
- package/dist/cjs/foundation/factories/middleware/index.js +9 -0
- package/dist/cjs/foundation/factories/middleware/index.js.map +1 -0
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/cognitoIdentityPoolEndpointResolver.js +14 -0
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/cognitoIdentityPoolEndpointResolver.js.map +1 -0
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/constants.js +18 -0
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/constants.js.map +1 -0
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/createGetCredentialsForIdentityClient.js +37 -0
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/createGetCredentialsForIdentityClient.js.map +1 -0
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/createGetIdClient.js +32 -0
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/createGetIdClient.js.map +1 -0
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/handler/cognitoIdentityTransferHandler.js +17 -0
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/handler/cognitoIdentityTransferHandler.js.map +1 -0
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/handler/index.js +9 -0
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/handler/index.js.map +1 -0
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/index.js +13 -0
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/index.js.map +1 -0
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/serde/createClientSerializer.js +24 -0
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/serde/createClientSerializer.js.map +1 -0
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/serde/index.js +9 -0
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/serde/index.js.map +1 -0
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/types/index.js +9 -0
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/types/index.js.map +1 -0
- package/dist/cjs/{awsClients/cognitoIdentity/types.js → foundation/factories/serviceClients/cognitoIdentity/types/sdk.js} +1 -1
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/types/sdk.js.map +1 -0
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/types/serviceClient.js +6 -0
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/types/serviceClient.js.map +1 -0
- package/dist/cjs/index.js +6 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/parseAmplifyOutputs.js +3 -4
- package/dist/cjs/parseAmplifyOutputs.js.map +1 -1
- package/dist/cjs/providers/pinpoint/types/errors.js +2 -1
- package/dist/cjs/providers/pinpoint/types/errors.js.map +1 -1
- package/dist/cjs/singleton/API/types.js +5 -1
- package/dist/cjs/singleton/API/types.js.map +1 -1
- package/dist/cjs/singleton/Auth/index.js +12 -0
- package/dist/cjs/singleton/Auth/index.js.map +1 -1
- package/dist/cjs/singleton/Auth/utils/errorHelpers.js +1 -1
- package/dist/cjs/singleton/Auth/utils/errorHelpers.js.map +1 -1
- package/dist/cjs/singleton/Auth/utils/index.js +4 -5
- package/dist/cjs/singleton/Auth/utils/index.js.map +1 -1
- package/dist/cjs/singleton/apis/clearCredentials.js +1 -2
- package/dist/cjs/singleton/apis/clearCredentials.js.map +1 -1
- package/dist/cjs/types/errors.js +2 -1
- package/dist/cjs/types/errors.js.map +1 -1
- package/dist/cjs/utils/convert/base64/bytesToString.js +1 -2
- package/dist/cjs/utils/convert/base64/bytesToString.js.map +1 -1
- package/dist/cjs/utils/cryptoSecureRandomInt.js +1 -2
- package/dist/cjs/utils/cryptoSecureRandomInt.js.map +1 -1
- package/dist/cjs/utils/getClientInfo/getClientInfo.js +1 -2
- package/dist/cjs/utils/getClientInfo/getClientInfo.js.map +1 -1
- package/dist/cjs/utils/isTokenExpired.js +1 -2
- package/dist/cjs/utils/isTokenExpired.js.map +1 -1
- package/dist/cjs/utils/retry/jitteredBackoff.js +1 -2
- package/dist/cjs/utils/retry/jitteredBackoff.js.map +1 -1
- package/dist/cjs/utils/retry/retry.js +1 -2
- package/dist/cjs/utils/retry/retry.js.map +1 -1
- package/dist/cjs/utils/urlSafeDecode.js +1 -2
- package/dist/cjs/utils/urlSafeDecode.js.map +1 -1
- package/dist/cjs/utils/urlSafeEncode.js +1 -2
- package/dist/cjs/utils/urlSafeEncode.js.map +1 -1
- package/dist/esm/Cache/constants.mjs +3 -3
- package/dist/esm/Cache/constants.mjs.map +1 -1
- package/dist/esm/Platform/version.d.ts +1 -1
- package/dist/esm/Platform/version.mjs +1 -1
- package/dist/esm/Platform/version.mjs.map +1 -1
- package/dist/esm/awsClients/pinpoint/base.d.ts +1 -1
- package/dist/esm/awsClients/pinpoint/getInAppMessages.d.ts +2 -2
- package/dist/esm/awsClients/pinpoint/putEvents.d.ts +2 -2
- package/dist/esm/awsClients/pinpoint/updateEndpoint.d.ts +2 -2
- package/dist/esm/clients/internal/composeServiceApi.d.ts +4 -1
- package/dist/esm/clients/internal/composeTransferHandler.d.ts +1 -1
- package/dist/esm/clients/middleware/signing/signer/signatureV4/utils/getCanonicalHeaders.d.ts +1 -1
- package/dist/esm/clients/middleware/signing/signer/signatureV4/utils/getHashedPayload.d.ts +1 -1
- package/dist/esm/clients/middleware/signing/signer/signatureV4/utils/getSignedHeaders.d.ts +1 -1
- package/dist/esm/foundation/factories/middleware/createDisableCacheMiddleware.d.ts +5 -0
- package/dist/esm/foundation/factories/middleware/createDisableCacheMiddleware.mjs +12 -0
- package/dist/esm/foundation/factories/middleware/createDisableCacheMiddleware.mjs.map +1 -0
- package/dist/esm/foundation/factories/middleware/index.d.ts +1 -0
- package/dist/esm/foundation/factories/middleware/index.mjs +2 -0
- package/dist/esm/{awsClients/cognitoIdentity → foundation/factories/middleware}/index.mjs.map +1 -1
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/cognitoIdentityPoolEndpointResolver.d.ts +4 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/cognitoIdentityPoolEndpointResolver.mjs +27 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/cognitoIdentityPoolEndpointResolver.mjs.map +1 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/constants.d.ts +10 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/constants.mjs +34 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/constants.mjs.map +1 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/createGetCredentialsForIdentityClient.d.ts +14 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/createGetCredentialsForIdentityClient.mjs +50 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/createGetCredentialsForIdentityClient.mjs.map +1 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/createGetIdClient.d.ts +14 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/createGetIdClient.mjs +45 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/createGetIdClient.mjs.map +1 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/handler/cognitoIdentityTransferHandler.d.ts +8 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/handler/cognitoIdentityTransferHandler.mjs +31 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/handler/cognitoIdentityTransferHandler.mjs.map +1 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/handler/index.d.ts +1 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/handler/index.mjs +2 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/handler/index.mjs.map +1 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/index.d.ts +4 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/index.mjs +4 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/index.mjs.map +1 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/serde/createClientSerializer.d.ts +3 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/serde/createClientSerializer.mjs +20 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/serde/createClientSerializer.mjs.map +1 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/serde/index.d.ts +1 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/serde/index.mjs +2 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/serde/index.mjs.map +1 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/types/index.d.ts +3 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/types/index.mjs +2 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/types/index.mjs.map +1 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/types/sdk.mjs +2 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/types/sdk.mjs.map +1 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/types/serviceClient.d.ts +6 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/types/serviceClient.mjs +2 -0
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/types/serviceClient.mjs.map +1 -0
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.mjs +3 -2
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/singleton/Auth/index.mjs +13 -0
- package/dist/esm/singleton/Auth/index.mjs.map +1 -1
- package/dist/esm/singleton/Auth/types.d.ts +8 -0
- package/dist/esm/utils/amplifyUrl/index.d.ts +4 -3
- package/dist/esm/utils/amplifyUrl/index.native.d.ts +4 -3
- package/dist/esm/utils/queuedStorage/createQueuedStorage.native.d.ts +1 -1
- package/internals/aws-clients/cognitoIdentity/package.json +4 -4
- package/package.json +9 -10
- package/src/Platform/version.ts +1 -1
- package/src/foundation/factories/middleware/createDisableCacheMiddleware.ts +18 -0
- package/src/foundation/factories/middleware/index.ts +4 -0
- package/src/foundation/factories/serviceClients/cognitoIdentity/cognitoIdentityPoolEndpointResolver.ts +15 -0
- package/src/foundation/factories/serviceClients/cognitoIdentity/constants.ts +20 -0
- package/src/foundation/factories/serviceClients/cognitoIdentity/createGetCredentialsForIdentityClient.ts +62 -0
- package/src/foundation/factories/serviceClients/cognitoIdentity/createGetIdClient.ts +48 -0
- package/src/foundation/factories/serviceClients/cognitoIdentity/handler/cognitoIdentityTransferHandler.ts +23 -0
- package/src/foundation/factories/serviceClients/cognitoIdentity/handler/index.ts +4 -0
- package/src/foundation/factories/serviceClients/cognitoIdentity/index.ts +12 -0
- package/src/foundation/factories/serviceClients/cognitoIdentity/serde/createClientSerializer.ts +29 -0
- package/src/foundation/factories/serviceClients/cognitoIdentity/serde/index.ts +4 -0
- package/src/foundation/factories/serviceClients/cognitoIdentity/types/index.ts +9 -0
- package/src/{awsClients/cognitoIdentity/types.ts → foundation/factories/serviceClients/cognitoIdentity/types/sdk.ts} +0 -2
- package/src/foundation/factories/serviceClients/cognitoIdentity/types/serviceClient.ts +8 -0
- package/src/index.ts +5 -4
- package/src/singleton/Auth/index.ts +19 -0
- package/src/singleton/Auth/types.ts +8 -0
- package/dist/cjs/awsClients/cognitoIdentity/base.js +0 -69
- package/dist/cjs/awsClients/cognitoIdentity/base.js.map +0 -1
- package/dist/cjs/awsClients/cognitoIdentity/getCredentialsForIdentity.js +0 -41
- package/dist/cjs/awsClients/cognitoIdentity/getCredentialsForIdentity.js.map +0 -1
- package/dist/cjs/awsClients/cognitoIdentity/getId.js +0 -32
- package/dist/cjs/awsClients/cognitoIdentity/getId.js.map +0 -1
- package/dist/cjs/awsClients/cognitoIdentity/index.js +0 -11
- package/dist/cjs/awsClients/cognitoIdentity/index.js.map +0 -1
- package/dist/cjs/awsClients/cognitoIdentity/types.js.map +0 -1
- package/dist/esm/awsClients/cognitoIdentity/base.d.ts +0 -29
- package/dist/esm/awsClients/cognitoIdentity/base.mjs +0 -83
- package/dist/esm/awsClients/cognitoIdentity/base.mjs.map +0 -1
- package/dist/esm/awsClients/cognitoIdentity/getCredentialsForIdentity.d.ts +0 -18
- package/dist/esm/awsClients/cognitoIdentity/getCredentialsForIdentity.mjs +0 -56
- package/dist/esm/awsClients/cognitoIdentity/getCredentialsForIdentity.mjs.map +0 -1
- package/dist/esm/awsClients/cognitoIdentity/getId.d.ts +0 -18
- package/dist/esm/awsClients/cognitoIdentity/getId.mjs +0 -47
- package/dist/esm/awsClients/cognitoIdentity/getId.mjs.map +0 -1
- package/dist/esm/awsClients/cognitoIdentity/index.d.ts +0 -2
- package/dist/esm/awsClients/cognitoIdentity/index.mjs +0 -3
- package/dist/esm/awsClients/cognitoIdentity/types.mjs +0 -2
- package/dist/esm/awsClients/cognitoIdentity/types.mjs.map +0 -1
- package/src/awsClients/cognitoIdentity/base.ts +0 -101
- package/src/awsClients/cognitoIdentity/getCredentialsForIdentity.ts +0 -77
- package/src/awsClients/cognitoIdentity/getId.ts +0 -61
- package/src/awsClients/cognitoIdentity/index.ts +0 -9
- /package/dist/esm/{awsClients/cognitoIdentity/types.d.ts → foundation/factories/serviceClients/cognitoIdentity/types/sdk.d.ts} +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
const createClientSerializer = (operation) => (input, endpoint) => {
|
|
4
|
+
const headers = getSharedHeaders(operation);
|
|
5
|
+
const body = JSON.stringify(input);
|
|
6
|
+
return buildHttpRpcRequest(endpoint, headers, body);
|
|
7
|
+
};
|
|
8
|
+
const getSharedHeaders = (operation) => ({
|
|
9
|
+
'content-type': 'application/x-amz-json-1.1',
|
|
10
|
+
'x-amz-target': `AWSCognitoIdentityService.${operation}`,
|
|
11
|
+
});
|
|
12
|
+
const buildHttpRpcRequest = ({ url }, headers, body) => ({
|
|
13
|
+
headers,
|
|
14
|
+
url,
|
|
15
|
+
body,
|
|
16
|
+
method: 'POST',
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export { buildHttpRpcRequest, createClientSerializer };
|
|
20
|
+
//# sourceMappingURL=createClientSerializer.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createClientSerializer.mjs","sources":["../../../../../../../src/foundation/factories/serviceClients/cognitoIdentity/serde/createClientSerializer.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport const createClientSerializer = (operation) => (input, endpoint) => {\n const headers = getSharedHeaders(operation);\n const body = JSON.stringify(input);\n return buildHttpRpcRequest(endpoint, headers, body);\n};\nconst getSharedHeaders = (operation) => ({\n 'content-type': 'application/x-amz-json-1.1',\n 'x-amz-target': `AWSCognitoIdentityService.${operation}`,\n});\nexport const buildHttpRpcRequest = ({ url }, headers, body) => ({\n headers,\n url,\n body,\n method: 'POST',\n});\n"],"names":[],"mappings":"AAAA;AACA;AACY,MAAC,sBAAsB,GAAG,CAAC,SAAS,KAAK,CAAC,KAAK,EAAE,QAAQ,KAAK;AAC1E,IAAI,MAAM,OAAO,GAAG,gBAAgB,CAAC,SAAS,CAAC;AAC/C,IAAI,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;AACtC,IAAI,OAAO,mBAAmB,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC;AACvD;AACA,MAAM,gBAAgB,GAAG,CAAC,SAAS,MAAM;AACzC,IAAI,cAAc,EAAE,4BAA4B;AAChD,IAAI,cAAc,EAAE,CAAC,0BAA0B,EAAE,SAAS,CAAC,CAAC;AAC5D,CAAC,CAAC;AACU,MAAC,mBAAmB,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,IAAI,MAAM;AAChE,IAAI,OAAO;AACX,IAAI,GAAG;AACP,IAAI,IAAI;AACR,IAAI,MAAM,EAAE,MAAM;AAClB,CAAC;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createClientSerializer } from './createClientSerializer';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/types/serviceClient.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serviceClient.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { TokenProvider, AuthTokens, FetchAuthSessionOptions, AuthSession, Creden
|
|
|
4
4
|
export { decodeJWT } from './singleton/Auth/utils';
|
|
5
5
|
export { AuthConfig, AuthUserPoolConfig, AuthUserPoolAndIdentityPoolConfig, APIConfig, PredictionsConfig, StorageAccessLevel, StorageConfig, GetCredentialsOptions, ResourcesConfig, LibraryOptions, AnalyticsConfig, GeoConfig, } from './singleton/types';
|
|
6
6
|
export { Amplify, fetchAuthSession, AmplifyClass as AmplifyClassV6, clearCredentials, } from './singleton';
|
|
7
|
-
export {
|
|
7
|
+
export { createGetCredentialsForIdentityClient, createGetIdClient, cognitoIdentityPoolEndpointResolver, GetCredentialsForIdentityInput, GetCredentialsForIdentityOutput, } from './foundation/factories/serviceClients/cognitoIdentity';
|
|
8
8
|
export { UserProfile } from './types';
|
|
9
9
|
export { CookieStorage, defaultStorage, sessionStorage, syncSessionStorage, sharedInMemoryStorage, } from './storage';
|
|
10
10
|
export { KeyValueStorageInterface } from './types';
|
package/dist/esm/index.mjs
CHANGED
|
@@ -3,8 +3,9 @@ export { decodeJWT } from './singleton/Auth/utils/index.mjs';
|
|
|
3
3
|
export { Amplify, AmplifyClass as AmplifyClassV6 } from './singleton/Amplify.mjs';
|
|
4
4
|
export { fetchAuthSession } from './singleton/apis/fetchAuthSession.mjs';
|
|
5
5
|
export { clearCredentials } from './singleton/apis/clearCredentials.mjs';
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
6
|
+
export { createGetCredentialsForIdentityClient } from './foundation/factories/serviceClients/cognitoIdentity/createGetCredentialsForIdentityClient.mjs';
|
|
7
|
+
export { createGetIdClient } from './foundation/factories/serviceClients/cognitoIdentity/createGetIdClient.mjs';
|
|
8
|
+
export { cognitoIdentityPoolEndpointResolver } from './foundation/factories/serviceClients/cognitoIdentity/cognitoIdentityPoolEndpointResolver.mjs';
|
|
8
9
|
export { defaultStorage, sessionStorage, sharedInMemoryStorage, syncSessionStorage } from './storage/index.mjs';
|
|
9
10
|
export { Cache } from './Cache/index.mjs';
|
|
10
11
|
export { I18n } from './I18n/index.mjs';
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { ConsoleLogger } from '../../Logger/ConsoleLogger.mjs';
|
|
2
|
+
|
|
3
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
const logger = new ConsoleLogger('Auth');
|
|
1
6
|
class AuthClass {
|
|
2
7
|
/**
|
|
3
8
|
* Configure Auth category
|
|
@@ -12,6 +17,13 @@ class AuthClass {
|
|
|
12
17
|
configure(authResourcesConfig, authOptions) {
|
|
13
18
|
this.authConfig = authResourcesConfig;
|
|
14
19
|
this.authOptions = authOptions;
|
|
20
|
+
if (authResourcesConfig && authResourcesConfig.Cognito?.userPoolEndpoint) {
|
|
21
|
+
logger.warn(getCustomEndpointWarningMessage('Amazon Cognito User Pool'));
|
|
22
|
+
}
|
|
23
|
+
if (authResourcesConfig &&
|
|
24
|
+
authResourcesConfig.Cognito?.identityPoolEndpoint) {
|
|
25
|
+
logger.warn(getCustomEndpointWarningMessage('Amazon Cognito Identity Pool'));
|
|
26
|
+
}
|
|
15
27
|
}
|
|
16
28
|
/**
|
|
17
29
|
* Fetch the auth tokens, and the temporary AWS credentials and identity if they are configured. By default it
|
|
@@ -61,6 +73,7 @@ class AuthClass {
|
|
|
61
73
|
return ((await this.authOptions?.tokenProvider?.getTokens(options)) ?? undefined);
|
|
62
74
|
}
|
|
63
75
|
}
|
|
76
|
+
const getCustomEndpointWarningMessage = (target) => `You are using a custom Amazon ${target} endpoint, ensure the endpoint is correct.`;
|
|
64
77
|
|
|
65
78
|
export { AuthClass };
|
|
66
79
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../../src/singleton/Auth/index.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../src/singleton/Auth/index.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ConsoleLogger } from '../../Logger';\nconst logger = new ConsoleLogger('Auth');\nexport class AuthClass {\n /**\n * Configure Auth category\n *\n * @internal\n *\n * @param authResourcesConfig - Resources configurations required by Auth providers.\n * @param authOptions - Client options used by library\n *\n * @returns void\n */\n configure(authResourcesConfig, authOptions) {\n this.authConfig = authResourcesConfig;\n this.authOptions = authOptions;\n if (authResourcesConfig && authResourcesConfig.Cognito?.userPoolEndpoint) {\n logger.warn(getCustomEndpointWarningMessage('Amazon Cognito User Pool'));\n }\n if (authResourcesConfig &&\n authResourcesConfig.Cognito?.identityPoolEndpoint) {\n logger.warn(getCustomEndpointWarningMessage('Amazon Cognito Identity Pool'));\n }\n }\n /**\n * Fetch the auth tokens, and the temporary AWS credentials and identity if they are configured. By default it\n * does not refresh the auth tokens or credentials if they are loaded in storage already. You can force a refresh\n * with `{ forceRefresh: true }` input.\n *\n * @param options - Options configuring the fetch behavior.\n *\n * @returns Promise of current auth session {@link AuthSession}.\n */\n async fetchAuthSession(options = {}) {\n let credentialsAndIdentityId;\n let userSub;\n // Get tokens will throw if session cannot be refreshed (network or service error) or return null if not available\n const tokens = await this.getTokens(options);\n if (tokens) {\n userSub = tokens.accessToken?.payload?.sub;\n // getCredentialsAndIdentityId will throw if cannot get credentials (network or service error)\n credentialsAndIdentityId =\n await this.authOptions?.credentialsProvider?.getCredentialsAndIdentityId({\n authConfig: this.authConfig,\n tokens,\n authenticated: true,\n forceRefresh: options.forceRefresh,\n });\n }\n else {\n // getCredentialsAndIdentityId will throw if cannot get credentials (network or service error)\n credentialsAndIdentityId =\n await this.authOptions?.credentialsProvider?.getCredentialsAndIdentityId({\n authConfig: this.authConfig,\n authenticated: false,\n forceRefresh: options.forceRefresh,\n });\n }\n return {\n tokens,\n credentials: credentialsAndIdentityId?.credentials,\n identityId: credentialsAndIdentityId?.identityId,\n userSub,\n };\n }\n async clearCredentials() {\n await this.authOptions?.credentialsProvider?.clearCredentialsAndIdentityId();\n }\n async getTokens(options) {\n return ((await this.authOptions?.tokenProvider?.getTokens(options)) ?? undefined);\n }\n}\nconst getCustomEndpointWarningMessage = (target) => `You are using a custom Amazon ${target} endpoint, ensure the endpoint is correct.`;\n"],"names":[],"mappings":";;AAAA;AACA;AAEA,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC;AACjC,MAAM,SAAS,CAAC;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,mBAAmB,EAAE,WAAW,EAAE;AAChD,QAAQ,IAAI,CAAC,UAAU,GAAG,mBAAmB;AAC7C,QAAQ,IAAI,CAAC,WAAW,GAAG,WAAW;AACtC,QAAQ,IAAI,mBAAmB,IAAI,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,EAAE;AAClF,YAAY,MAAM,CAAC,IAAI,CAAC,+BAA+B,CAAC,0BAA0B,CAAC,CAAC;AACpF;AACA,QAAQ,IAAI,mBAAmB;AAC/B,YAAY,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,EAAE;AAC/D,YAAY,MAAM,CAAC,IAAI,CAAC,+BAA+B,CAAC,8BAA8B,CAAC,CAAC;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,MAAM,gBAAgB,CAAC,OAAO,GAAG,EAAE,EAAE;AACzC,QAAQ,IAAI,wBAAwB;AACpC,QAAQ,IAAI,OAAO;AACnB;AACA,QAAQ,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;AACpD,QAAQ,IAAI,MAAM,EAAE;AACpB,YAAY,OAAO,GAAG,MAAM,CAAC,WAAW,EAAE,OAAO,EAAE,GAAG;AACtD;AACA,YAAY,wBAAwB;AACpC,gBAAgB,MAAM,IAAI,CAAC,WAAW,EAAE,mBAAmB,EAAE,2BAA2B,CAAC;AACzF,oBAAoB,UAAU,EAAE,IAAI,CAAC,UAAU;AAC/C,oBAAoB,MAAM;AAC1B,oBAAoB,aAAa,EAAE,IAAI;AACvC,oBAAoB,YAAY,EAAE,OAAO,CAAC,YAAY;AACtD,iBAAiB,CAAC;AAClB;AACA,aAAa;AACb;AACA,YAAY,wBAAwB;AACpC,gBAAgB,MAAM,IAAI,CAAC,WAAW,EAAE,mBAAmB,EAAE,2BAA2B,CAAC;AACzF,oBAAoB,UAAU,EAAE,IAAI,CAAC,UAAU;AAC/C,oBAAoB,aAAa,EAAE,KAAK;AACxC,oBAAoB,YAAY,EAAE,OAAO,CAAC,YAAY;AACtD,iBAAiB,CAAC;AAClB;AACA,QAAQ,OAAO;AACf,YAAY,MAAM;AAClB,YAAY,WAAW,EAAE,wBAAwB,EAAE,WAAW;AAC9D,YAAY,UAAU,EAAE,wBAAwB,EAAE,UAAU;AAC5D,YAAY,OAAO;AACnB,SAAS;AACT;AACA,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,MAAM,IAAI,CAAC,WAAW,EAAE,mBAAmB,EAAE,6BAA6B,EAAE;AACpF;AACA,IAAI,MAAM,SAAS,CAAC,OAAO,EAAE;AAC7B,QAAQ,QAAQ,CAAC,MAAM,IAAI,CAAC,WAAW,EAAE,aAAa,EAAE,SAAS,CAAC,OAAO,CAAC,KAAK,SAAS;AACxF;AACA;AACA,MAAM,+BAA+B,GAAG,CAAC,MAAM,KAAK,CAAC,8BAA8B,EAAE,MAAM,CAAC,0CAA0C,CAAC;;;;"}
|
|
@@ -83,11 +83,16 @@ export interface AuthIdentityPoolConfig {
|
|
|
83
83
|
}
|
|
84
84
|
export interface CognitoIdentityPoolConfig {
|
|
85
85
|
identityPoolId: string;
|
|
86
|
+
/**
|
|
87
|
+
* Use this field to specify a custom endpoint for the Amazon Cognito identity pool. Ensure this endpoint is correct and valid.
|
|
88
|
+
*/
|
|
89
|
+
identityPoolEndpoint?: string;
|
|
86
90
|
allowGuestAccess?: boolean;
|
|
87
91
|
}
|
|
88
92
|
export interface AuthUserPoolConfig {
|
|
89
93
|
Cognito: CognitoUserPoolConfig & {
|
|
90
94
|
identityPoolId?: never;
|
|
95
|
+
identityPoolEndpoint?: never;
|
|
91
96
|
allowGuestAccess?: never;
|
|
92
97
|
};
|
|
93
98
|
}
|
|
@@ -95,6 +100,9 @@ export type CognitoUserPoolConfigMfaStatus = 'on' | 'off' | 'optional';
|
|
|
95
100
|
export interface CognitoUserPoolConfig {
|
|
96
101
|
userPoolClientId: string;
|
|
97
102
|
userPoolId: string;
|
|
103
|
+
/**
|
|
104
|
+
* Use this field to specify a custom endpoint for the Amazon Cognito user pool. Ensure this endpoint is correct and valid.
|
|
105
|
+
*/
|
|
98
106
|
userPoolEndpoint?: string;
|
|
99
107
|
signUpVerificationMethod?: 'code' | 'link';
|
|
100
108
|
loginWith?: {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
declare const AmplifyUrl: {
|
|
2
|
-
new (url: string | URL, base?: string | URL
|
|
2
|
+
new (url: string | URL, base?: string | URL): URL;
|
|
3
3
|
prototype: URL;
|
|
4
|
+
canParse(url: string | URL, base?: string | URL): boolean;
|
|
4
5
|
createObjectURL(obj: Blob | MediaSource): string;
|
|
6
|
+
parse(url: string | URL, base?: string | URL): URL | null;
|
|
5
7
|
revokeObjectURL(url: string): void;
|
|
6
8
|
};
|
|
7
9
|
declare const AmplifyUrlSearchParams: {
|
|
8
|
-
new (init?: string | Record<string, string> |
|
|
10
|
+
new (init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
|
|
9
11
|
prototype: URLSearchParams;
|
|
10
|
-
toString(): string;
|
|
11
12
|
};
|
|
12
13
|
export { AmplifyUrl, AmplifyUrlSearchParams };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
declare const AmplifyUrl: {
|
|
2
|
-
new (url: string | URL, base?: string | URL
|
|
2
|
+
new (url: string | URL, base?: string | URL): URL;
|
|
3
3
|
prototype: URL;
|
|
4
|
+
canParse(url: string | URL, base?: string | URL): boolean;
|
|
4
5
|
createObjectURL(obj: Blob | MediaSource): string;
|
|
6
|
+
parse(url: string | URL, base?: string | URL): URL | null;
|
|
5
7
|
revokeObjectURL(url: string): void;
|
|
6
8
|
};
|
|
7
9
|
declare const AmplifyUrlSearchParams: {
|
|
8
|
-
new (init?: string | Record<string, string> |
|
|
10
|
+
new (init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
|
|
9
11
|
prototype: URLSearchParams;
|
|
10
|
-
toString(): string;
|
|
11
12
|
};
|
|
12
13
|
export { AmplifyUrl, AmplifyUrlSearchParams };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/core/internals/aws-clients/cognitoIdentity",
|
|
3
|
-
"types": "../../../dist/esm/
|
|
4
|
-
"main": "../../../dist/cjs/
|
|
5
|
-
"module": "../../../dist/esm/
|
|
6
|
-
"react-native": "../../../dist/cjs/
|
|
3
|
+
"types": "../../../dist/esm/foundation/factories/serviceClients/cognitoIdentity/index.d.ts",
|
|
4
|
+
"main": "../../../dist/cjs/foundation/factories/serviceClients/cognitoIdentity/index.js",
|
|
5
|
+
"module": "../../../dist/esm/foundation/factories/serviceClients/cognitoIdentity/index.mjs",
|
|
6
|
+
"react-native": "../../../dist/cjs/foundation/factories/serviceClients/cognitoIdentity/index.js",
|
|
7
7
|
"sideEffects": false
|
|
8
8
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/core",
|
|
3
|
-
"version": "6.11.
|
|
3
|
+
"version": "6.11.5-local-stack.00864ae.0+00864ae",
|
|
4
4
|
"description": "Core category of aws-amplify",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.mjs",
|
|
@@ -60,10 +60,9 @@
|
|
|
60
60
|
"uuid": "^9.0.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@aws-amplify/react-native": "1.1.
|
|
63
|
+
"@aws-amplify/react-native": "1.1.10-local-stack.00864ae.0+00864ae",
|
|
64
64
|
"@types/js-cookie": "3.0.2",
|
|
65
|
-
"genversion": "^2.2.0"
|
|
66
|
-
"typescript": "5.0.2"
|
|
65
|
+
"genversion": "^2.2.0"
|
|
67
66
|
},
|
|
68
67
|
"size-limit": [
|
|
69
68
|
{
|
|
@@ -139,10 +138,10 @@
|
|
|
139
138
|
"require": "./dist/cjs/clients/internal/index.js"
|
|
140
139
|
},
|
|
141
140
|
"./internals/aws-clients/cognitoIdentity": {
|
|
142
|
-
"react-native": "./dist/cjs/
|
|
143
|
-
"types": "./dist/esm/
|
|
144
|
-
"import": "./dist/esm/
|
|
145
|
-
"require": "./dist/cjs/
|
|
141
|
+
"react-native": "./dist/cjs/foundation/factories/serviceClients/cognitoIdentity/index.js",
|
|
142
|
+
"types": "./dist/esm/foundation/factories/serviceClients/cognitoIdentity/index.d.ts",
|
|
143
|
+
"import": "./dist/esm/foundation/factories/serviceClients/cognitoIdentity/index.mjs",
|
|
144
|
+
"require": "./dist/cjs/foundation/factories/serviceClients/cognitoIdentity/index.js"
|
|
146
145
|
},
|
|
147
146
|
"./internals/aws-clients/pinpoint": {
|
|
148
147
|
"react-native": "./dist/cjs/awsClients/pinpoint/index.js",
|
|
@@ -179,7 +178,7 @@
|
|
|
179
178
|
"./dist/esm/clients/internal/index.d.ts"
|
|
180
179
|
],
|
|
181
180
|
"internals/aws-clients/cognitoIdentity": [
|
|
182
|
-
"./dist/esm/
|
|
181
|
+
"./dist/esm/foundation/factories/serviceClients/cognitoIdentity/index.d.ts"
|
|
183
182
|
],
|
|
184
183
|
"internals/aws-clients/pinpoint": [
|
|
185
184
|
"./dist/esm/awsClients/pinpoint/index.d.ts"
|
|
@@ -192,5 +191,5 @@
|
|
|
192
191
|
]
|
|
193
192
|
}
|
|
194
193
|
},
|
|
195
|
-
"gitHead": "
|
|
194
|
+
"gitHead": "00864aec571d0509655eea0673e896d69d434972"
|
|
196
195
|
}
|
package/src/Platform/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// generated by genversion
|
|
2
|
-
export const version = '6.14.
|
|
2
|
+
export const version = '6.14.5-local-stack.00864ae.0+00864ae';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { HttpRequest, HttpResponse, Middleware } from '../../../clients';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A Cognito Identity-specific middleware that disables caching for all requests.
|
|
8
|
+
*/
|
|
9
|
+
export const createDisableCacheMiddleware: Middleware<
|
|
10
|
+
HttpRequest,
|
|
11
|
+
HttpResponse,
|
|
12
|
+
Record<string, unknown>
|
|
13
|
+
> = () => next =>
|
|
14
|
+
async function disableCacheMiddleware(request) {
|
|
15
|
+
request.headers['cache-control'] = 'no-store';
|
|
16
|
+
|
|
17
|
+
return next(request);
|
|
18
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { EndpointResolverOptions, getDnsSuffix } from '../../../../clients';
|
|
5
|
+
import { AmplifyUrl } from '../../../../libraryUtils';
|
|
6
|
+
|
|
7
|
+
import { COGNITO_IDENTITY_SERVICE_NAME } from './constants';
|
|
8
|
+
|
|
9
|
+
export const cognitoIdentityPoolEndpointResolver = ({
|
|
10
|
+
region,
|
|
11
|
+
}: EndpointResolverOptions) => ({
|
|
12
|
+
url: new AmplifyUrl(
|
|
13
|
+
`https://${COGNITO_IDENTITY_SERVICE_NAME}.${region}.${getDnsSuffix(region)}`,
|
|
14
|
+
),
|
|
15
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
getRetryDecider,
|
|
6
|
+
jitteredBackoff,
|
|
7
|
+
parseJsonError,
|
|
8
|
+
} from '../../../../clients';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The service name used to sign requests if the API requires authentication.
|
|
12
|
+
*/
|
|
13
|
+
export const COGNITO_IDENTITY_SERVICE_NAME = 'cognito-identity';
|
|
14
|
+
|
|
15
|
+
export const DEFAULT_SERVICE_CLIENT_API_CONFIG = {
|
|
16
|
+
service: COGNITO_IDENTITY_SERVICE_NAME,
|
|
17
|
+
retryDecider: getRetryDecider(parseJsonError),
|
|
18
|
+
computeDelay: jitteredBackoff,
|
|
19
|
+
cache: 'no-store',
|
|
20
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
HttpResponse,
|
|
6
|
+
parseJsonBody,
|
|
7
|
+
parseJsonError,
|
|
8
|
+
parseMetadata,
|
|
9
|
+
} from '../../../../clients';
|
|
10
|
+
import { composeServiceApi } from '../../../../clients/internal';
|
|
11
|
+
import { getAmplifyUserAgent } from '../../../../Platform';
|
|
12
|
+
|
|
13
|
+
import { DEFAULT_SERVICE_CLIENT_API_CONFIG } from './constants';
|
|
14
|
+
import { cognitoIdentityTransferHandler } from './handler';
|
|
15
|
+
import { createClientSerializer } from './serde';
|
|
16
|
+
import {
|
|
17
|
+
Credentials,
|
|
18
|
+
GetCredentialsForIdentityCommandOutput,
|
|
19
|
+
GetCredentialsForIdentityInput,
|
|
20
|
+
ServiceClientFactoryInput,
|
|
21
|
+
} from './types';
|
|
22
|
+
|
|
23
|
+
export const createGetCredentialsForIdentityClient = (
|
|
24
|
+
config: ServiceClientFactoryInput,
|
|
25
|
+
) =>
|
|
26
|
+
composeServiceApi(
|
|
27
|
+
cognitoIdentityTransferHandler,
|
|
28
|
+
createClientSerializer<GetCredentialsForIdentityInput>(
|
|
29
|
+
'GetCredentialsForIdentity',
|
|
30
|
+
),
|
|
31
|
+
getCredentialsForIdentityDeserializer,
|
|
32
|
+
{
|
|
33
|
+
...DEFAULT_SERVICE_CLIENT_API_CONFIG,
|
|
34
|
+
...config,
|
|
35
|
+
userAgentValue: getAmplifyUserAgent(),
|
|
36
|
+
},
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
const getCredentialsForIdentityDeserializer = async (
|
|
40
|
+
response: HttpResponse,
|
|
41
|
+
): Promise<GetCredentialsForIdentityCommandOutput> => {
|
|
42
|
+
if (response.statusCode >= 300) {
|
|
43
|
+
const error = await parseJsonError(response);
|
|
44
|
+
throw error;
|
|
45
|
+
} else {
|
|
46
|
+
const body = await parseJsonBody(response);
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
IdentityId: body.IdentityId,
|
|
50
|
+
Credentials: deserializeCredentials(body.Credentials),
|
|
51
|
+
$metadata: parseMetadata(response),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const deserializeCredentials = ({
|
|
57
|
+
Expiration,
|
|
58
|
+
...rest
|
|
59
|
+
}: Credentials = {}): Credentials => ({
|
|
60
|
+
...rest,
|
|
61
|
+
Expiration: Expiration && new Date((Expiration as any) * 1000),
|
|
62
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
HttpResponse,
|
|
6
|
+
parseJsonBody,
|
|
7
|
+
parseJsonError,
|
|
8
|
+
parseMetadata,
|
|
9
|
+
} from '../../../../clients';
|
|
10
|
+
import { composeServiceApi } from '../../../../clients/internal';
|
|
11
|
+
import { getAmplifyUserAgent } from '../../../../Platform';
|
|
12
|
+
|
|
13
|
+
import { DEFAULT_SERVICE_CLIENT_API_CONFIG } from './constants';
|
|
14
|
+
import { cognitoIdentityTransferHandler } from './handler';
|
|
15
|
+
import { createClientSerializer } from './serde';
|
|
16
|
+
import {
|
|
17
|
+
GetIdCommandInput,
|
|
18
|
+
GetIdCommandOutput,
|
|
19
|
+
ServiceClientFactoryInput,
|
|
20
|
+
} from './types';
|
|
21
|
+
|
|
22
|
+
export const createGetIdClient = (config: ServiceClientFactoryInput) =>
|
|
23
|
+
composeServiceApi(
|
|
24
|
+
cognitoIdentityTransferHandler,
|
|
25
|
+
createClientSerializer<GetIdCommandInput>('GetId'),
|
|
26
|
+
getIdDeserializer,
|
|
27
|
+
{
|
|
28
|
+
...DEFAULT_SERVICE_CLIENT_API_CONFIG,
|
|
29
|
+
...config,
|
|
30
|
+
userAgentValue: getAmplifyUserAgent(),
|
|
31
|
+
},
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
const getIdDeserializer = async (
|
|
35
|
+
response: HttpResponse,
|
|
36
|
+
): Promise<GetIdCommandOutput> => {
|
|
37
|
+
if (response.statusCode >= 300) {
|
|
38
|
+
const error = await parseJsonError(response);
|
|
39
|
+
throw error;
|
|
40
|
+
} else {
|
|
41
|
+
const body = await parseJsonBody(response);
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
IdentityId: body.IdentityId,
|
|
45
|
+
$metadata: parseMetadata(response),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
HttpRequest,
|
|
6
|
+
HttpResponse,
|
|
7
|
+
unauthenticatedHandler,
|
|
8
|
+
} from '../../../../../clients';
|
|
9
|
+
import { composeTransferHandler } from '../../../../../clients/internal';
|
|
10
|
+
import { createDisableCacheMiddleware } from '../../../middleware';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A Cognito Identity-specific transfer handler that does NOT sign requests, and
|
|
14
|
+
* disables caching.
|
|
15
|
+
*
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export const cognitoIdentityTransferHandler = composeTransferHandler<
|
|
19
|
+
[Parameters<typeof createDisableCacheMiddleware>[0]],
|
|
20
|
+
HttpRequest,
|
|
21
|
+
HttpResponse,
|
|
22
|
+
typeof unauthenticatedHandler
|
|
23
|
+
>(unauthenticatedHandler, [createDisableCacheMiddleware]);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
export { createGetCredentialsForIdentityClient } from './createGetCredentialsForIdentityClient';
|
|
5
|
+
export { createGetIdClient } from './createGetIdClient';
|
|
6
|
+
export { cognitoIdentityPoolEndpointResolver } from './cognitoIdentityPoolEndpointResolver';
|
|
7
|
+
export {
|
|
8
|
+
GetIdInput,
|
|
9
|
+
GetIdOutput,
|
|
10
|
+
GetCredentialsForIdentityInput,
|
|
11
|
+
GetCredentialsForIdentityOutput,
|
|
12
|
+
} from './types';
|
package/src/foundation/factories/serviceClients/cognitoIdentity/serde/createClientSerializer.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { Endpoint, Headers, HttpRequest } from '../../../../../clients';
|
|
5
|
+
|
|
6
|
+
export const createClientSerializer =
|
|
7
|
+
<Input>(operation: string) =>
|
|
8
|
+
(input: Input, endpoint: Endpoint): HttpRequest => {
|
|
9
|
+
const headers = getSharedHeaders(operation);
|
|
10
|
+
const body = JSON.stringify(input);
|
|
11
|
+
|
|
12
|
+
return buildHttpRpcRequest(endpoint, headers, body);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const getSharedHeaders = (operation: string): Headers => ({
|
|
16
|
+
'content-type': 'application/x-amz-json-1.1',
|
|
17
|
+
'x-amz-target': `AWSCognitoIdentityService.${operation}`,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export const buildHttpRpcRequest = (
|
|
21
|
+
{ url }: Endpoint,
|
|
22
|
+
headers: Headers,
|
|
23
|
+
body: any,
|
|
24
|
+
): HttpRequest => ({
|
|
25
|
+
headers,
|
|
26
|
+
url,
|
|
27
|
+
body,
|
|
28
|
+
method: 'POST',
|
|
29
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
export * from './sdk';
|
|
5
|
+
export {
|
|
6
|
+
GetCredentialsForIdentityCommandOutput as GetCredentialsForIdentityOutput,
|
|
7
|
+
GetIdCommandOutput as GetIdOutput,
|
|
8
|
+
} from './sdk';
|
|
9
|
+
export * from './serviceClient';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { EndpointResolverOptions } from '../../../../../clients';
|
|
5
|
+
|
|
6
|
+
export interface ServiceClientFactoryInput {
|
|
7
|
+
endpointResolver(options: EndpointResolverOptions): { url: URL };
|
|
8
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -43,13 +43,14 @@ export {
|
|
|
43
43
|
clearCredentials,
|
|
44
44
|
} from './singleton';
|
|
45
45
|
|
|
46
|
-
//
|
|
46
|
+
// Cognito Identity service client factories
|
|
47
47
|
export {
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
createGetCredentialsForIdentityClient,
|
|
49
|
+
createGetIdClient,
|
|
50
|
+
cognitoIdentityPoolEndpointResolver,
|
|
50
51
|
GetCredentialsForIdentityInput,
|
|
51
52
|
GetCredentialsForIdentityOutput,
|
|
52
|
-
} from './
|
|
53
|
+
} from './foundation/factories/serviceClients/cognitoIdentity';
|
|
53
54
|
|
|
54
55
|
// Amplify-wide constructs
|
|
55
56
|
export { UserProfile } from './types';
|