@aws-amplify/core 6.4.7-local-stack.0aa9031.0 → 6.4.7-unstable.847fb51.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/Platform/version.js +1 -1
- package/dist/cjs/Platform/version.js.map +1 -1
- package/dist/cjs/awsClients/cognitoIdentity/base.js +69 -0
- package/dist/cjs/awsClients/cognitoIdentity/base.js.map +1 -0
- package/dist/cjs/awsClients/cognitoIdentity/getCredentialsForIdentity.js +41 -0
- package/dist/cjs/awsClients/cognitoIdentity/getCredentialsForIdentity.js.map +1 -0
- package/dist/cjs/awsClients/cognitoIdentity/getId.js +32 -0
- package/dist/cjs/awsClients/cognitoIdentity/getId.js.map +1 -0
- package/dist/cjs/awsClients/cognitoIdentity/index.js +11 -0
- package/dist/cjs/awsClients/cognitoIdentity/index.js.map +1 -0
- package/dist/cjs/{foundation/factories/serviceClients/cognitoIdentity/types/sdk.js → awsClients/cognitoIdentity/types.js} +1 -1
- package/dist/cjs/awsClients/cognitoIdentity/types.js.map +1 -0
- package/dist/cjs/index.js +5 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/parseAmplifyOutputs.js +21 -0
- package/dist/cjs/parseAmplifyOutputs.js.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/cognitoIdentity/base.d.ts +29 -0
- package/dist/esm/awsClients/cognitoIdentity/base.mjs +73 -0
- package/dist/esm/awsClients/cognitoIdentity/base.mjs.map +1 -0
- package/dist/esm/awsClients/cognitoIdentity/getCredentialsForIdentity.d.ts +18 -0
- package/dist/esm/awsClients/cognitoIdentity/getCredentialsForIdentity.mjs +47 -0
- package/dist/esm/awsClients/cognitoIdentity/getCredentialsForIdentity.mjs.map +1 -0
- package/dist/esm/awsClients/cognitoIdentity/getId.d.ts +18 -0
- package/dist/esm/awsClients/cognitoIdentity/getId.mjs +38 -0
- package/dist/esm/awsClients/cognitoIdentity/getId.mjs.map +1 -0
- package/dist/esm/awsClients/cognitoIdentity/index.d.ts +2 -0
- package/dist/esm/awsClients/cognitoIdentity/index.mjs +3 -0
- package/dist/esm/{foundation/factories/middleware → awsClients/cognitoIdentity}/index.mjs.map +1 -1
- package/dist/esm/awsClients/cognitoIdentity/types.mjs +2 -0
- package/dist/esm/awsClients/cognitoIdentity/types.mjs.map +1 -0
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.mjs +2 -3
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/parseAmplifyOutputs.mjs +21 -0
- package/dist/esm/parseAmplifyOutputs.mjs.map +1 -1
- package/dist/esm/singleton/API/types.d.ts +34 -1
- package/dist/esm/singleton/AmplifyOutputs/types.d.ts +10 -0
- package/dist/esm/singleton/Auth/types.d.ts +0 -2
- package/package.json +3 -3
- package/src/Platform/version.ts +1 -1
- package/src/awsClients/cognitoIdentity/base.ts +101 -0
- package/src/awsClients/cognitoIdentity/getCredentialsForIdentity.ts +77 -0
- package/src/awsClients/cognitoIdentity/getId.ts +61 -0
- package/src/awsClients/cognitoIdentity/index.ts +9 -0
- package/src/{foundation/factories/serviceClients/cognitoIdentity/types/sdk.ts → awsClients/cognitoIdentity/types.ts} +2 -0
- package/src/index.ts +6 -5
- package/src/parseAmplifyOutputs.ts +32 -1
- package/src/singleton/API/types.ts +38 -1
- package/src/singleton/AmplifyOutputs/types.ts +12 -0
- package/src/singleton/Auth/types.ts +0 -2
- package/dist/cjs/foundation/factories/middleware/createDisableCacheMiddleware.js +0 -15
- package/dist/cjs/foundation/factories/middleware/createDisableCacheMiddleware.js.map +0 -1
- package/dist/cjs/foundation/factories/middleware/index.js +0 -9
- package/dist/cjs/foundation/factories/middleware/index.js.map +0 -1
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/cognitoIdentityPoolEndpointResolver.js +0 -14
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/cognitoIdentityPoolEndpointResolver.js.map +0 -1
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/constants.js +0 -18
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/constants.js.map +0 -1
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/createGetCredentialsForIdentityClient.js +0 -37
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/createGetCredentialsForIdentityClient.js.map +0 -1
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/createGetIdClient.js +0 -32
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/createGetIdClient.js.map +0 -1
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/handler/cognitoIdentityTransferHandler.js +0 -17
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/handler/cognitoIdentityTransferHandler.js.map +0 -1
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/handler/index.js +0 -9
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/handler/index.js.map +0 -1
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/index.js +0 -13
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/index.js.map +0 -1
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/serde/createClientSerializer.js +0 -24
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/serde/createClientSerializer.js.map +0 -1
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/serde/index.js +0 -9
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/serde/index.js.map +0 -1
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/types/index.js +0 -9
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/types/index.js.map +0 -1
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/types/sdk.js.map +0 -1
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/types/serviceClient.js +0 -6
- package/dist/cjs/foundation/factories/serviceClients/cognitoIdentity/types/serviceClient.js.map +0 -1
- package/dist/esm/foundation/factories/middleware/createDisableCacheMiddleware.d.ts +0 -5
- package/dist/esm/foundation/factories/middleware/createDisableCacheMiddleware.mjs +0 -12
- package/dist/esm/foundation/factories/middleware/createDisableCacheMiddleware.mjs.map +0 -1
- package/dist/esm/foundation/factories/middleware/index.d.ts +0 -1
- package/dist/esm/foundation/factories/middleware/index.mjs +0 -2
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/cognitoIdentityPoolEndpointResolver.d.ts +0 -4
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/cognitoIdentityPoolEndpointResolver.mjs +0 -27
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/cognitoIdentityPoolEndpointResolver.mjs.map +0 -1
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/constants.d.ts +0 -10
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/constants.mjs +0 -23
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/constants.mjs.map +0 -1
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/createGetCredentialsForIdentityClient.d.ts +0 -14
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/createGetCredentialsForIdentityClient.mjs +0 -42
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/createGetCredentialsForIdentityClient.mjs.map +0 -1
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/createGetIdClient.d.ts +0 -14
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/createGetIdClient.mjs +0 -37
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/createGetIdClient.mjs.map +0 -1
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/handler/cognitoIdentityTransferHandler.d.ts +0 -8
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/handler/cognitoIdentityTransferHandler.mjs +0 -22
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/handler/cognitoIdentityTransferHandler.mjs.map +0 -1
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/handler/index.d.ts +0 -1
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/handler/index.mjs +0 -2
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/handler/index.mjs.map +0 -1
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/index.d.ts +0 -3
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/index.mjs +0 -4
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/index.mjs.map +0 -1
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/serde/createClientSerializer.d.ts +0 -3
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/serde/createClientSerializer.mjs +0 -20
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/serde/createClientSerializer.mjs.map +0 -1
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/serde/index.d.ts +0 -1
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/serde/index.mjs +0 -2
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/serde/index.mjs.map +0 -1
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/types/index.d.ts +0 -3
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/types/index.mjs +0 -2
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/types/index.mjs.map +0 -1
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/types/sdk.mjs +0 -2
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/types/sdk.mjs.map +0 -1
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/types/serviceClient.d.ts +0 -6
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/types/serviceClient.mjs +0 -2
- package/dist/esm/foundation/factories/serviceClients/cognitoIdentity/types/serviceClient.mjs.map +0 -1
- package/src/foundation/factories/middleware/createDisableCacheMiddleware.ts +0 -18
- package/src/foundation/factories/middleware/index.ts +0 -4
- package/src/foundation/factories/serviceClients/cognitoIdentity/cognitoIdentityPoolEndpointResolver.ts +0 -15
- package/src/foundation/factories/serviceClients/cognitoIdentity/constants.ts +0 -20
- package/src/foundation/factories/serviceClients/cognitoIdentity/createGetCredentialsForIdentityClient.ts +0 -62
- package/src/foundation/factories/serviceClients/cognitoIdentity/createGetIdClient.ts +0 -48
- package/src/foundation/factories/serviceClients/cognitoIdentity/handler/cognitoIdentityTransferHandler.ts +0 -23
- package/src/foundation/factories/serviceClients/cognitoIdentity/handler/index.ts +0 -4
- package/src/foundation/factories/serviceClients/cognitoIdentity/index.ts +0 -6
- package/src/foundation/factories/serviceClients/cognitoIdentity/serde/createClientSerializer.ts +0 -29
- package/src/foundation/factories/serviceClients/cognitoIdentity/serde/index.ts +0 -4
- package/src/foundation/factories/serviceClients/cognitoIdentity/types/index.ts +0 -9
- package/src/foundation/factories/serviceClients/cognitoIdentity/types/serviceClient.ts +0 -8
- /package/dist/esm/{foundation/factories/serviceClients/cognitoIdentity/types/sdk.d.ts → awsClients/cognitoIdentity/types.d.ts} +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Endpoint, HttpResponse } from '../../clients';
|
|
2
|
+
import { GetIdCommandInput as GetIdInput, GetIdCommandOutput as GetIdOutput } from './types';
|
|
3
|
+
export type { GetIdInput, GetIdOutput };
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare const getId: (config: {
|
|
8
|
+
service?: string | undefined;
|
|
9
|
+
endpointResolver?: (((options: import("../../clients").EndpointResolverOptions, input?: any) => Endpoint) & (({ region }: import("../../clients").EndpointResolverOptions) => {
|
|
10
|
+
url: URL;
|
|
11
|
+
})) | undefined;
|
|
12
|
+
retryDecider?: (((response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>) & ((response?: HttpResponse | undefined, error?: unknown) => Promise<boolean>)) | undefined;
|
|
13
|
+
computeDelay?: ((attempt: number) => number) | undefined;
|
|
14
|
+
userAgentValue?: string | undefined;
|
|
15
|
+
cache?: "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload" | undefined;
|
|
16
|
+
} & {
|
|
17
|
+
[x: string]: unknown;
|
|
18
|
+
}, input: import("./types").GetIdInput) => Promise<GetIdOutput>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import '../../types/errors.mjs';
|
|
2
|
+
import '../../errors/errorHelpers.mjs';
|
|
3
|
+
import '../../utils/getClientInfo/getClientInfo.mjs';
|
|
4
|
+
import '../../utils/retry/retry.mjs';
|
|
5
|
+
import '@aws-crypto/sha256-js';
|
|
6
|
+
import '@smithy/util-hex-encoding';
|
|
7
|
+
import { parseMetadata } from '../../clients/serde/responseInfo.mjs';
|
|
8
|
+
import { parseJsonError, parseJsonBody } from '../../clients/serde/json.mjs';
|
|
9
|
+
import { composeServiceApi } from '../../clients/internal/composeServiceApi.mjs';
|
|
10
|
+
import { defaultConfig, cognitoIdentityTransferHandler, buildHttpRpcRequest, getSharedHeaders } from './base.mjs';
|
|
11
|
+
|
|
12
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
13
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
14
|
+
const getIdSerializer = (input, endpoint) => {
|
|
15
|
+
const headers = getSharedHeaders('GetId');
|
|
16
|
+
const body = JSON.stringify(input);
|
|
17
|
+
return buildHttpRpcRequest(endpoint, headers, body);
|
|
18
|
+
};
|
|
19
|
+
const getIdDeserializer = async (response) => {
|
|
20
|
+
if (response.statusCode >= 300) {
|
|
21
|
+
const error = await parseJsonError(response);
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
const body = await parseJsonBody(response);
|
|
26
|
+
return {
|
|
27
|
+
IdentityId: body.IdentityId,
|
|
28
|
+
$metadata: parseMetadata(response),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
const getId = composeServiceApi(cognitoIdentityTransferHandler, getIdSerializer, getIdDeserializer, defaultConfig);
|
|
36
|
+
|
|
37
|
+
export { getId };
|
|
38
|
+
//# sourceMappingURL=getId.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getId.mjs","sources":["../../../../src/awsClients/cognitoIdentity/getId.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { parseJsonBody, parseJsonError, parseMetadata, } from '../../clients';\nimport { composeServiceApi } from '../../clients/internal';\nimport { buildHttpRpcRequest, cognitoIdentityTransferHandler, defaultConfig, getSharedHeaders, } from './base';\nconst getIdSerializer = (input, endpoint) => {\n const headers = getSharedHeaders('GetId');\n const body = JSON.stringify(input);\n return buildHttpRpcRequest(endpoint, headers, body);\n};\nconst getIdDeserializer = async (response) => {\n if (response.statusCode >= 300) {\n const error = await parseJsonError(response);\n throw error;\n }\n else {\n const body = await parseJsonBody(response);\n return {\n IdentityId: body.IdentityId,\n $metadata: parseMetadata(response),\n };\n }\n};\n/**\n * @internal\n */\nexport const getId = composeServiceApi(cognitoIdentityTransferHandler, getIdSerializer, getIdDeserializer, defaultConfig);\n"],"names":[],"mappings":";;;;;;;;;;;AAAA;AACA;AAIA,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,QAAQ,KAAK;AAC7C,IAAI,MAAM,OAAO,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAC9C,IAAI,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AACvC,IAAI,OAAO,mBAAmB,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;AACxD,CAAC,CAAC;AACF,MAAM,iBAAiB,GAAG,OAAO,QAAQ,KAAK;AAC9C,IAAI,IAAI,QAAQ,CAAC,UAAU,IAAI,GAAG,EAAE;AACpC,QAAQ,MAAM,KAAK,GAAG,MAAM,cAAc,CAAC,QAAQ,CAAC,CAAC;AACrD,QAAQ,MAAM,KAAK,CAAC;AACpB,KAAK;AACL,SAAS;AACT,QAAQ,MAAM,IAAI,GAAG,MAAM,aAAa,CAAC,QAAQ,CAAC,CAAC;AACnD,QAAQ,OAAO;AACf,YAAY,UAAU,EAAE,IAAI,CAAC,UAAU;AACvC,YAAY,SAAS,EAAE,aAAa,CAAC,QAAQ,CAAC;AAC9C,SAAS,CAAC;AACV,KAAK;AACL,CAAC,CAAC;AACF;AACA;AACA;AACY,MAAC,KAAK,GAAG,iBAAiB,CAAC,8BAA8B,EAAE,eAAe,EAAE,iBAAiB,EAAE,aAAa;;;;"}
|
package/dist/esm/{foundation/factories/middleware → awsClients/cognitoIdentity}/index.mjs.map
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.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 { getCredentialsForIdentity, getId, GetCredentialsForIdentityInput, GetCredentialsForIdentityOutput, } from './awsClients/cognitoIdentity';
|
|
8
8
|
export { UserProfile } from './types';
|
|
9
9
|
export { CookieStorage, defaultStorage, sessionStorage, sharedInMemoryStorage, } from './storage';
|
|
10
10
|
export { KeyValueStorageInterface } from './types';
|
package/dist/esm/index.mjs
CHANGED
|
@@ -3,9 +3,8 @@ 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 {
|
|
8
|
-
export { cognitoIdentityPoolEndpointResolver } from './foundation/factories/serviceClients/cognitoIdentity/cognitoIdentityPoolEndpointResolver.mjs';
|
|
6
|
+
export { getId } from './awsClients/cognitoIdentity/getId.mjs';
|
|
7
|
+
export { getCredentialsForIdentity } from './awsClients/cognitoIdentity/getCredentialsForIdentity.mjs';
|
|
9
8
|
export { defaultStorage, sessionStorage, sharedInMemoryStorage } from './storage/index.mjs';
|
|
10
9
|
export { Cache } from './Cache/index.mjs';
|
|
11
10
|
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":";;;;;;;;;;;;"}
|
|
@@ -125,6 +125,21 @@ function parseData(amplifyOutputsDataProperties) {
|
|
|
125
125
|
GraphQL,
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
|
+
function parseCustom(amplifyOutputsCustomProperties) {
|
|
129
|
+
if (!amplifyOutputsCustomProperties?.events) {
|
|
130
|
+
return undefined;
|
|
131
|
+
}
|
|
132
|
+
const { url, aws_region, api_key, default_authorization_type } = amplifyOutputsCustomProperties.events;
|
|
133
|
+
const Events = {
|
|
134
|
+
endpoint: url,
|
|
135
|
+
defaultAuthMode: getGraphQLAuthMode(default_authorization_type),
|
|
136
|
+
region: aws_region,
|
|
137
|
+
apiKey: api_key,
|
|
138
|
+
};
|
|
139
|
+
return {
|
|
140
|
+
Events,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
128
143
|
function parseNotifications(amplifyOutputsNotificationsProperties) {
|
|
129
144
|
if (!amplifyOutputsNotificationsProperties) {
|
|
130
145
|
return undefined;
|
|
@@ -172,6 +187,12 @@ function parseAmplifyOutputs(amplifyOutputs) {
|
|
|
172
187
|
if (amplifyOutputs.data) {
|
|
173
188
|
resourcesConfig.API = parseData(amplifyOutputs.data);
|
|
174
189
|
}
|
|
190
|
+
if (amplifyOutputs.custom) {
|
|
191
|
+
const customConfig = parseCustom(amplifyOutputs.custom);
|
|
192
|
+
if (customConfig && 'Events' in customConfig) {
|
|
193
|
+
resourcesConfig.API = { ...resourcesConfig.API, ...customConfig };
|
|
194
|
+
}
|
|
195
|
+
}
|
|
175
196
|
if (amplifyOutputs.notifications) {
|
|
176
197
|
resourcesConfig.Notifications = parseNotifications(amplifyOutputs.notifications);
|
|
177
198
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseAmplifyOutputs.mjs","sources":["../../src/parseAmplifyOutputs.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport function isAmplifyOutputs(config) {\n // version format initially will be '1' but is expected to be something like x.y where x is major and y minor version\n const { version } = config;\n if (!version) {\n return false;\n }\n return version.startsWith('1');\n}\nfunction parseStorage(amplifyOutputsStorageProperties) {\n if (!amplifyOutputsStorageProperties) {\n return undefined;\n }\n const { bucket_name, aws_region, buckets } = amplifyOutputsStorageProperties;\n return {\n S3: {\n bucket: bucket_name,\n region: aws_region,\n buckets: buckets && createBucketInfoMap(buckets),\n },\n };\n}\nfunction parseAuth(amplifyOutputsAuthProperties) {\n if (!amplifyOutputsAuthProperties) {\n return undefined;\n }\n const { user_pool_id, user_pool_client_id, identity_pool_id, password_policy, mfa_configuration, mfa_methods, unauthenticated_identities_enabled, oauth, username_attributes, standard_required_attributes, } = amplifyOutputsAuthProperties;\n const authConfig = {\n Cognito: {\n userPoolId: user_pool_id,\n userPoolClientId: user_pool_client_id,\n },\n };\n if (identity_pool_id) {\n authConfig.Cognito = {\n ...authConfig.Cognito,\n identityPoolId: identity_pool_id,\n };\n }\n if (password_policy) {\n authConfig.Cognito.passwordFormat = {\n requireLowercase: password_policy.require_lowercase,\n requireNumbers: password_policy.require_numbers,\n requireUppercase: password_policy.require_uppercase,\n requireSpecialCharacters: password_policy.require_symbols,\n minLength: password_policy.min_length ?? 6,\n };\n }\n if (mfa_configuration) {\n authConfig.Cognito.mfa = {\n status: getMfaStatus(mfa_configuration),\n smsEnabled: mfa_methods?.includes('SMS'),\n totpEnabled: mfa_methods?.includes('TOTP'),\n };\n }\n if (unauthenticated_identities_enabled) {\n authConfig.Cognito.allowGuestAccess = unauthenticated_identities_enabled;\n }\n if (oauth) {\n authConfig.Cognito.loginWith = {\n oauth: {\n domain: oauth.domain,\n redirectSignIn: oauth.redirect_sign_in_uri,\n redirectSignOut: oauth.redirect_sign_out_uri,\n responseType: oauth.response_type === 'token' ? 'token' : 'code',\n scopes: oauth.scopes,\n providers: getOAuthProviders(oauth.identity_providers),\n },\n };\n }\n if (username_attributes) {\n authConfig.Cognito.loginWith = {\n ...authConfig.Cognito.loginWith,\n email: username_attributes.includes('email'),\n phone: username_attributes.includes('phone_number'),\n // Signing in with a username is not currently supported in Gen2, this should always evaluate to false\n username: username_attributes.includes('username'),\n };\n }\n if (standard_required_attributes) {\n authConfig.Cognito.userAttributes = standard_required_attributes.reduce((acc, curr) => ({ ...acc, [curr]: { required: true } }), {});\n }\n return authConfig;\n}\nexport function parseAnalytics(amplifyOutputsAnalyticsProperties) {\n if (!amplifyOutputsAnalyticsProperties?.amazon_pinpoint) {\n return undefined;\n }\n const { amazon_pinpoint } = amplifyOutputsAnalyticsProperties;\n return {\n Pinpoint: {\n appId: amazon_pinpoint.app_id,\n region: amazon_pinpoint.aws_region,\n },\n };\n}\nfunction parseGeo(amplifyOutputsAnalyticsProperties) {\n if (!amplifyOutputsAnalyticsProperties) {\n return undefined;\n }\n const { aws_region, geofence_collections, maps, search_indices } = amplifyOutputsAnalyticsProperties;\n return {\n LocationService: {\n region: aws_region,\n searchIndices: search_indices,\n geofenceCollections: geofence_collections,\n maps,\n },\n };\n}\nfunction parseData(amplifyOutputsDataProperties) {\n if (!amplifyOutputsDataProperties) {\n return undefined;\n }\n const { aws_region, default_authorization_type, url, api_key, model_introspection, } = amplifyOutputsDataProperties;\n const GraphQL = {\n endpoint: url,\n defaultAuthMode: getGraphQLAuthMode(default_authorization_type),\n region: aws_region,\n apiKey: api_key,\n modelIntrospection: model_introspection,\n };\n return {\n GraphQL,\n };\n}\nfunction parseNotifications(amplifyOutputsNotificationsProperties) {\n if (!amplifyOutputsNotificationsProperties) {\n return undefined;\n }\n const { aws_region, channels, amazon_pinpoint_app_id } = amplifyOutputsNotificationsProperties;\n const hasInAppMessaging = channels.includes('IN_APP_MESSAGING');\n const hasPushNotification = channels.includes('APNS') || channels.includes('FCM');\n if (!(hasInAppMessaging || hasPushNotification)) {\n return undefined;\n }\n // At this point, we know the Amplify outputs contains at least one supported channel\n const notificationsConfig = {};\n if (hasInAppMessaging) {\n notificationsConfig.InAppMessaging = {\n Pinpoint: {\n appId: amazon_pinpoint_app_id,\n region: aws_region,\n },\n };\n }\n if (hasPushNotification) {\n notificationsConfig.PushNotification = {\n Pinpoint: {\n appId: amazon_pinpoint_app_id,\n region: aws_region,\n },\n };\n }\n return notificationsConfig;\n}\nexport function parseAmplifyOutputs(amplifyOutputs) {\n const resourcesConfig = {};\n if (amplifyOutputs.storage) {\n resourcesConfig.Storage = parseStorage(amplifyOutputs.storage);\n }\n if (amplifyOutputs.auth) {\n resourcesConfig.Auth = parseAuth(amplifyOutputs.auth);\n }\n if (amplifyOutputs.analytics) {\n resourcesConfig.Analytics = parseAnalytics(amplifyOutputs.analytics);\n }\n if (amplifyOutputs.geo) {\n resourcesConfig.Geo = parseGeo(amplifyOutputs.geo);\n }\n if (amplifyOutputs.data) {\n resourcesConfig.API = parseData(amplifyOutputs.data);\n }\n if (amplifyOutputs.notifications) {\n resourcesConfig.Notifications = parseNotifications(amplifyOutputs.notifications);\n }\n return resourcesConfig;\n}\nconst authModeNames = {\n AMAZON_COGNITO_USER_POOLS: 'userPool',\n API_KEY: 'apiKey',\n AWS_IAM: 'iam',\n AWS_LAMBDA: 'lambda',\n OPENID_CONNECT: 'oidc',\n};\nfunction getGraphQLAuthMode(authType) {\n return authModeNames[authType];\n}\nconst providerNames = {\n GOOGLE: 'Google',\n LOGIN_WITH_AMAZON: 'Amazon',\n FACEBOOK: 'Facebook',\n SIGN_IN_WITH_APPLE: 'Apple',\n};\nfunction getOAuthProviders(providers = []) {\n return providers.reduce((oAuthProviders, provider) => {\n if (providerNames[provider] !== undefined) {\n oAuthProviders.push(providerNames[provider]);\n }\n return oAuthProviders;\n }, []);\n}\nfunction getMfaStatus(mfaConfiguration) {\n if (mfaConfiguration === 'OPTIONAL')\n return 'optional';\n if (mfaConfiguration === 'REQUIRED')\n return 'on';\n return 'off';\n}\nfunction createBucketInfoMap(buckets) {\n const mappedBuckets = {};\n buckets.forEach(({ name, bucket_name: bucketName, aws_region: region }) => {\n if (name in mappedBuckets) {\n throw new Error(`Duplicate friendly name found: ${name}. Name must be unique.`);\n }\n mappedBuckets[name] = {\n bucketName,\n region,\n };\n });\n return mappedBuckets;\n}\n"],"names":[],"mappings":"AAAA;AACA;AACO,SAAS,gBAAgB,CAAC,MAAM,EAAE;AACzC;AACA,IAAI,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;AAC/B,IAAI,IAAI,CAAC,OAAO,EAAE;AAClB,QAAQ,OAAO,KAAK,CAAC;AACrB,KAAK;AACL,IAAI,OAAO,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AACnC,CAAC;AACD,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IAAI,IAAI,aAAa,EAAE;AACnC,YAAY,MAAM,IAAI,KAAK,CAAC,CAAC,+BAA+B,EAAE,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC;AAC5F,SAAS;AACT,QAAQ,aAAa,CAAC,IAAI,CAAC,GAAG;AAC9B,YAAY,UAAU;AACtB,YAAY,MAAM;AAClB,SAAS,CAAC;AACV,KAAK,CAAC,CAAC;AACP,IAAI,OAAO,aAAa,CAAC;AACzB;;;;"}
|
|
1
|
+
{"version":3,"file":"parseAmplifyOutputs.mjs","sources":["../../src/parseAmplifyOutputs.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nexport function isAmplifyOutputs(config) {\n // version format initially will be '1' but is expected to be something like x.y where x is major and y minor version\n const { version } = config;\n if (!version) {\n return false;\n }\n return version.startsWith('1');\n}\nfunction parseStorage(amplifyOutputsStorageProperties) {\n if (!amplifyOutputsStorageProperties) {\n return undefined;\n }\n const { bucket_name, aws_region, buckets } = amplifyOutputsStorageProperties;\n return {\n S3: {\n bucket: bucket_name,\n region: aws_region,\n buckets: buckets && createBucketInfoMap(buckets),\n },\n };\n}\nfunction parseAuth(amplifyOutputsAuthProperties) {\n if (!amplifyOutputsAuthProperties) {\n return undefined;\n }\n const { user_pool_id, user_pool_client_id, identity_pool_id, password_policy, mfa_configuration, mfa_methods, unauthenticated_identities_enabled, oauth, username_attributes, standard_required_attributes, } = amplifyOutputsAuthProperties;\n const authConfig = {\n Cognito: {\n userPoolId: user_pool_id,\n userPoolClientId: user_pool_client_id,\n },\n };\n if (identity_pool_id) {\n authConfig.Cognito = {\n ...authConfig.Cognito,\n identityPoolId: identity_pool_id,\n };\n }\n if (password_policy) {\n authConfig.Cognito.passwordFormat = {\n requireLowercase: password_policy.require_lowercase,\n requireNumbers: password_policy.require_numbers,\n requireUppercase: password_policy.require_uppercase,\n requireSpecialCharacters: password_policy.require_symbols,\n minLength: password_policy.min_length ?? 6,\n };\n }\n if (mfa_configuration) {\n authConfig.Cognito.mfa = {\n status: getMfaStatus(mfa_configuration),\n smsEnabled: mfa_methods?.includes('SMS'),\n totpEnabled: mfa_methods?.includes('TOTP'),\n };\n }\n if (unauthenticated_identities_enabled) {\n authConfig.Cognito.allowGuestAccess = unauthenticated_identities_enabled;\n }\n if (oauth) {\n authConfig.Cognito.loginWith = {\n oauth: {\n domain: oauth.domain,\n redirectSignIn: oauth.redirect_sign_in_uri,\n redirectSignOut: oauth.redirect_sign_out_uri,\n responseType: oauth.response_type === 'token' ? 'token' : 'code',\n scopes: oauth.scopes,\n providers: getOAuthProviders(oauth.identity_providers),\n },\n };\n }\n if (username_attributes) {\n authConfig.Cognito.loginWith = {\n ...authConfig.Cognito.loginWith,\n email: username_attributes.includes('email'),\n phone: username_attributes.includes('phone_number'),\n // Signing in with a username is not currently supported in Gen2, this should always evaluate to false\n username: username_attributes.includes('username'),\n };\n }\n if (standard_required_attributes) {\n authConfig.Cognito.userAttributes = standard_required_attributes.reduce((acc, curr) => ({ ...acc, [curr]: { required: true } }), {});\n }\n return authConfig;\n}\nexport function parseAnalytics(amplifyOutputsAnalyticsProperties) {\n if (!amplifyOutputsAnalyticsProperties?.amazon_pinpoint) {\n return undefined;\n }\n const { amazon_pinpoint } = amplifyOutputsAnalyticsProperties;\n return {\n Pinpoint: {\n appId: amazon_pinpoint.app_id,\n region: amazon_pinpoint.aws_region,\n },\n };\n}\nfunction parseGeo(amplifyOutputsAnalyticsProperties) {\n if (!amplifyOutputsAnalyticsProperties) {\n return undefined;\n }\n const { aws_region, geofence_collections, maps, search_indices } = amplifyOutputsAnalyticsProperties;\n return {\n LocationService: {\n region: aws_region,\n searchIndices: search_indices,\n geofenceCollections: geofence_collections,\n maps,\n },\n };\n}\nfunction parseData(amplifyOutputsDataProperties) {\n if (!amplifyOutputsDataProperties) {\n return undefined;\n }\n const { aws_region, default_authorization_type, url, api_key, model_introspection, } = amplifyOutputsDataProperties;\n const GraphQL = {\n endpoint: url,\n defaultAuthMode: getGraphQLAuthMode(default_authorization_type),\n region: aws_region,\n apiKey: api_key,\n modelIntrospection: model_introspection,\n };\n return {\n GraphQL,\n };\n}\nfunction parseCustom(amplifyOutputsCustomProperties) {\n if (!amplifyOutputsCustomProperties?.events) {\n return undefined;\n }\n const { url, aws_region, api_key, default_authorization_type } = amplifyOutputsCustomProperties.events;\n const Events = {\n endpoint: url,\n defaultAuthMode: getGraphQLAuthMode(default_authorization_type),\n region: aws_region,\n apiKey: api_key,\n };\n return {\n Events,\n };\n}\nfunction parseNotifications(amplifyOutputsNotificationsProperties) {\n if (!amplifyOutputsNotificationsProperties) {\n return undefined;\n }\n const { aws_region, channels, amazon_pinpoint_app_id } = amplifyOutputsNotificationsProperties;\n const hasInAppMessaging = channels.includes('IN_APP_MESSAGING');\n const hasPushNotification = channels.includes('APNS') || channels.includes('FCM');\n if (!(hasInAppMessaging || hasPushNotification)) {\n return undefined;\n }\n // At this point, we know the Amplify outputs contains at least one supported channel\n const notificationsConfig = {};\n if (hasInAppMessaging) {\n notificationsConfig.InAppMessaging = {\n Pinpoint: {\n appId: amazon_pinpoint_app_id,\n region: aws_region,\n },\n };\n }\n if (hasPushNotification) {\n notificationsConfig.PushNotification = {\n Pinpoint: {\n appId: amazon_pinpoint_app_id,\n region: aws_region,\n },\n };\n }\n return notificationsConfig;\n}\nexport function parseAmplifyOutputs(amplifyOutputs) {\n const resourcesConfig = {};\n if (amplifyOutputs.storage) {\n resourcesConfig.Storage = parseStorage(amplifyOutputs.storage);\n }\n if (amplifyOutputs.auth) {\n resourcesConfig.Auth = parseAuth(amplifyOutputs.auth);\n }\n if (amplifyOutputs.analytics) {\n resourcesConfig.Analytics = parseAnalytics(amplifyOutputs.analytics);\n }\n if (amplifyOutputs.geo) {\n resourcesConfig.Geo = parseGeo(amplifyOutputs.geo);\n }\n if (amplifyOutputs.data) {\n resourcesConfig.API = parseData(amplifyOutputs.data);\n }\n if (amplifyOutputs.custom) {\n const customConfig = parseCustom(amplifyOutputs.custom);\n if (customConfig && 'Events' in customConfig) {\n resourcesConfig.API = { ...resourcesConfig.API, ...customConfig };\n }\n }\n if (amplifyOutputs.notifications) {\n resourcesConfig.Notifications = parseNotifications(amplifyOutputs.notifications);\n }\n return resourcesConfig;\n}\nconst authModeNames = {\n AMAZON_COGNITO_USER_POOLS: 'userPool',\n API_KEY: 'apiKey',\n AWS_IAM: 'iam',\n AWS_LAMBDA: 'lambda',\n OPENID_CONNECT: 'oidc',\n};\nfunction getGraphQLAuthMode(authType) {\n return authModeNames[authType];\n}\nconst providerNames = {\n GOOGLE: 'Google',\n LOGIN_WITH_AMAZON: 'Amazon',\n FACEBOOK: 'Facebook',\n SIGN_IN_WITH_APPLE: 'Apple',\n};\nfunction getOAuthProviders(providers = []) {\n return providers.reduce((oAuthProviders, provider) => {\n if (providerNames[provider] !== undefined) {\n oAuthProviders.push(providerNames[provider]);\n }\n return oAuthProviders;\n }, []);\n}\nfunction getMfaStatus(mfaConfiguration) {\n if (mfaConfiguration === 'OPTIONAL')\n return 'optional';\n if (mfaConfiguration === 'REQUIRED')\n return 'on';\n return 'off';\n}\nfunction createBucketInfoMap(buckets) {\n const mappedBuckets = {};\n buckets.forEach(({ name, bucket_name: bucketName, aws_region: region }) => {\n if (name in mappedBuckets) {\n throw new Error(`Duplicate friendly name found: ${name}. Name must be unique.`);\n }\n mappedBuckets[name] = {\n bucketName,\n region,\n };\n });\n return mappedBuckets;\n}\n"],"names":[],"mappings":"AAAA;AACA;AACO,SAAS,gBAAgB,CAAC,MAAM,EAAE;AACzC;AACA,IAAI,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;AAC/B,IAAI,IAAI,CAAC,OAAO,EAAE;AAClB,QAAQ,OAAO,KAAK,CAAC;AACrB,KAAK;AACL,IAAI,OAAO,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AACnC,CAAC;AACD,SAAS,YAAY,CAAC,+BAA+B,EAAE;AACvD,IAAI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|
48
|
+
export interface APIEventsConfig {
|
|
49
|
+
/**
|
|
50
|
+
* Required GraphQL endpoint, must be a valid URL string.
|
|
51
|
+
*/
|
|
52
|
+
endpoint: string;
|
|
53
|
+
/**
|
|
54
|
+
* Optional region string used to sign the request. Required only if the auth mode is 'iam'.
|
|
55
|
+
*/
|
|
56
|
+
region?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Optional API key string. Required only if the auth mode is 'apiKey'.
|
|
59
|
+
*/
|
|
60
|
+
apiKey?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Custom domain endpoint for GraphQL API.
|
|
63
|
+
*/
|
|
64
|
+
customEndpoint?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Optional region string used to sign the request to `customEndpoint`. Effective only if `customEndpoint` is
|
|
67
|
+
* specified, and the auth mode is 'iam'.
|
|
68
|
+
*/
|
|
69
|
+
customEndpointRegion?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Default auth mode for all the API calls to given service.
|
|
72
|
+
*/
|
|
73
|
+
defaultAuthMode: GraphQLAuthMode;
|
|
74
|
+
}
|
|
45
75
|
export interface APIRestConfig {
|
|
46
76
|
/**
|
|
47
77
|
* Required REST endpoint, must be a valid URL string.
|
|
@@ -67,7 +97,10 @@ export interface RESTProviderConfig {
|
|
|
67
97
|
export interface GraphQLProviderConfig {
|
|
68
98
|
GraphQL: APIGraphQLConfig;
|
|
69
99
|
}
|
|
70
|
-
export
|
|
100
|
+
export interface EventsProviderConfig {
|
|
101
|
+
Events: APIEventsConfig;
|
|
102
|
+
}
|
|
103
|
+
export type APIConfig = AtLeastOne<RESTProviderConfig & GraphQLProviderConfig & EventsProviderConfig>;
|
|
71
104
|
export type GraphQLAuthMode = 'apiKey' | 'oidc' | 'userPool' | 'iam' | 'identityPool' | 'lambda' | 'none';
|
|
72
105
|
/**
|
|
73
106
|
* Type representing a plain JavaScript object that can be serialized to JSON.
|
|
@@ -76,6 +76,15 @@ export interface AmplifyOutputsDataProperties {
|
|
|
76
76
|
api_key?: string;
|
|
77
77
|
conflict_resolution_mode?: string;
|
|
78
78
|
}
|
|
79
|
+
export interface AmplifyOutputsCustomProperties {
|
|
80
|
+
events?: {
|
|
81
|
+
url: string;
|
|
82
|
+
aws_region: string;
|
|
83
|
+
default_authorization_type: string;
|
|
84
|
+
api_key?: string;
|
|
85
|
+
};
|
|
86
|
+
[key: string]: any;
|
|
87
|
+
}
|
|
79
88
|
export interface AmplifyOutputsNotificationsProperties {
|
|
80
89
|
aws_region: string;
|
|
81
90
|
amazon_pinpoint_app_id: string;
|
|
@@ -88,5 +97,6 @@ export interface AmplifyOutputs {
|
|
|
88
97
|
analytics?: AmplifyOutputsAnalyticsProperties;
|
|
89
98
|
geo?: AmplifyOutputsGeoProperties;
|
|
90
99
|
data?: AmplifyOutputsDataProperties;
|
|
100
|
+
custom?: AmplifyOutputsCustomProperties;
|
|
91
101
|
notifications?: AmplifyOutputsNotificationsProperties;
|
|
92
102
|
}
|
|
@@ -80,13 +80,11 @@ export interface AuthIdentityPoolConfig {
|
|
|
80
80
|
}
|
|
81
81
|
export interface CognitoIdentityPoolConfig {
|
|
82
82
|
identityPoolId: string;
|
|
83
|
-
identityPoolEndpoint?: string;
|
|
84
83
|
allowGuestAccess?: boolean;
|
|
85
84
|
}
|
|
86
85
|
export interface AuthUserPoolConfig {
|
|
87
86
|
Cognito: CognitoUserPoolConfig & {
|
|
88
87
|
identityPoolId?: never;
|
|
89
|
-
identityPoolEndpoint?: never;
|
|
90
88
|
allowGuestAccess?: never;
|
|
91
89
|
};
|
|
92
90
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/core",
|
|
3
|
-
"version": "6.4.7-
|
|
3
|
+
"version": "6.4.7-unstable.847fb51.0+847fb51",
|
|
4
4
|
"description": "Core category of aws-amplify",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.mjs",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"uuid": "^9.0.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@aws-amplify/react-native": "1.1.7-
|
|
63
|
+
"@aws-amplify/react-native": "1.1.7-unstable.847fb51.0+847fb51",
|
|
64
64
|
"@types/js-cookie": "3.0.2",
|
|
65
65
|
"genversion": "^2.2.0",
|
|
66
66
|
"typescript": "5.0.2"
|
|
@@ -192,5 +192,5 @@
|
|
|
192
192
|
]
|
|
193
193
|
}
|
|
194
194
|
},
|
|
195
|
-
"gitHead": "
|
|
195
|
+
"gitHead": "847fb51acee1ee8585503625a6f73d67265217d0"
|
|
196
196
|
}
|
package/src/Platform/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// generated by genversion
|
|
2
|
-
export const version = '6.6.7-
|
|
2
|
+
export const version = '6.6.7-unstable.847fb51.0+847fb51';
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
Endpoint,
|
|
6
|
+
EndpointResolverOptions,
|
|
7
|
+
Headers,
|
|
8
|
+
HttpRequest,
|
|
9
|
+
HttpResponse,
|
|
10
|
+
Middleware,
|
|
11
|
+
getDnsSuffix,
|
|
12
|
+
parseJsonError,
|
|
13
|
+
unauthenticatedHandler,
|
|
14
|
+
} from '../../clients';
|
|
15
|
+
import { composeTransferHandler } from '../../clients/internal/composeTransferHandler';
|
|
16
|
+
import {
|
|
17
|
+
getRetryDecider,
|
|
18
|
+
jitteredBackoff,
|
|
19
|
+
} from '../../clients/middleware/retry';
|
|
20
|
+
import { getAmplifyUserAgent } from '../../Platform';
|
|
21
|
+
import { observeFrameworkChanges } from '../../Platform/detectFramework';
|
|
22
|
+
import { AmplifyUrl } from '../../utils/amplifyUrl';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The service name used to sign requests if the API requires authentication.
|
|
26
|
+
*/
|
|
27
|
+
const SERVICE_NAME = 'cognito-identity';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The endpoint resolver function that returns the endpoint URL for a given region.
|
|
31
|
+
*/
|
|
32
|
+
const endpointResolver = ({ region }: EndpointResolverOptions) => ({
|
|
33
|
+
url: new AmplifyUrl(
|
|
34
|
+
`https://cognito-identity.${region}.${getDnsSuffix(region)}`,
|
|
35
|
+
),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A Cognito Identity-specific middleware that disables caching for all requests.
|
|
40
|
+
*/
|
|
41
|
+
const disableCacheMiddlewareFactory: Middleware<
|
|
42
|
+
HttpRequest,
|
|
43
|
+
HttpResponse,
|
|
44
|
+
Record<string, unknown>
|
|
45
|
+
> = () => next =>
|
|
46
|
+
async function disableCacheMiddleware(request) {
|
|
47
|
+
request.headers['cache-control'] = 'no-store';
|
|
48
|
+
|
|
49
|
+
return next(request);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* A Cognito Identity-specific transfer handler that does NOT sign requests, and
|
|
54
|
+
* disables caching.
|
|
55
|
+
*
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
58
|
+
export const cognitoIdentityTransferHandler = composeTransferHandler<
|
|
59
|
+
[Parameters<typeof disableCacheMiddlewareFactory>[0]],
|
|
60
|
+
HttpRequest,
|
|
61
|
+
HttpResponse,
|
|
62
|
+
typeof unauthenticatedHandler
|
|
63
|
+
>(unauthenticatedHandler, [disableCacheMiddlewareFactory]);
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @internal
|
|
67
|
+
*/
|
|
68
|
+
export const defaultConfig = {
|
|
69
|
+
service: SERVICE_NAME,
|
|
70
|
+
endpointResolver,
|
|
71
|
+
retryDecider: getRetryDecider(parseJsonError),
|
|
72
|
+
computeDelay: jitteredBackoff,
|
|
73
|
+
userAgentValue: getAmplifyUserAgent(),
|
|
74
|
+
cache: 'no-store',
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
observeFrameworkChanges(() => {
|
|
78
|
+
defaultConfig.userAgentValue = getAmplifyUserAgent();
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* @internal
|
|
83
|
+
*/
|
|
84
|
+
export const getSharedHeaders = (operation: string): Headers => ({
|
|
85
|
+
'content-type': 'application/x-amz-json-1.1',
|
|
86
|
+
'x-amz-target': `AWSCognitoIdentityService.${operation}`,
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @internal
|
|
91
|
+
*/
|
|
92
|
+
export const buildHttpRpcRequest = (
|
|
93
|
+
{ url }: Endpoint,
|
|
94
|
+
headers: Headers,
|
|
95
|
+
body: any,
|
|
96
|
+
): HttpRequest => ({
|
|
97
|
+
headers,
|
|
98
|
+
url,
|
|
99
|
+
body,
|
|
100
|
+
method: 'POST',
|
|
101
|
+
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
Endpoint,
|
|
6
|
+
HttpRequest,
|
|
7
|
+
HttpResponse,
|
|
8
|
+
parseJsonBody,
|
|
9
|
+
parseJsonError,
|
|
10
|
+
parseMetadata,
|
|
11
|
+
} from '../../clients';
|
|
12
|
+
import { composeServiceApi } from '../../clients/internal';
|
|
13
|
+
|
|
14
|
+
import {
|
|
15
|
+
buildHttpRpcRequest,
|
|
16
|
+
cognitoIdentityTransferHandler,
|
|
17
|
+
defaultConfig,
|
|
18
|
+
getSharedHeaders,
|
|
19
|
+
} from './base';
|
|
20
|
+
import type {
|
|
21
|
+
Credentials,
|
|
22
|
+
GetCredentialsForIdentityCommandInput as GetCredentialsForIdentityInput,
|
|
23
|
+
GetCredentialsForIdentityCommandOutput as GetCredentialsForIdentityOutput,
|
|
24
|
+
} from './types';
|
|
25
|
+
|
|
26
|
+
export type { GetCredentialsForIdentityInput, GetCredentialsForIdentityOutput };
|
|
27
|
+
|
|
28
|
+
const getCredentialsForIdentitySerializer = (
|
|
29
|
+
input: GetCredentialsForIdentityInput,
|
|
30
|
+
endpoint: Endpoint,
|
|
31
|
+
): HttpRequest => {
|
|
32
|
+
const headers = getSharedHeaders('GetCredentialsForIdentity');
|
|
33
|
+
const body = JSON.stringify(input);
|
|
34
|
+
|
|
35
|
+
return buildHttpRpcRequest(endpoint, headers, body);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const getCredentialsForIdentityDeserializer = async (
|
|
39
|
+
response: HttpResponse,
|
|
40
|
+
): Promise<GetCredentialsForIdentityOutput> => {
|
|
41
|
+
if (response.statusCode >= 300) {
|
|
42
|
+
const error = await parseJsonError(response);
|
|
43
|
+
throw error;
|
|
44
|
+
} else {
|
|
45
|
+
const body = await parseJsonBody(response);
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
IdentityId: body.IdentityId,
|
|
49
|
+
Credentials: deserializeCredentials(body.Credentials),
|
|
50
|
+
$metadata: parseMetadata(response),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const deserializeCredentials = ({
|
|
56
|
+
AccessKeyId,
|
|
57
|
+
SecretKey,
|
|
58
|
+
SessionToken,
|
|
59
|
+
Expiration,
|
|
60
|
+
}: Credentials = {}): Credentials => {
|
|
61
|
+
return {
|
|
62
|
+
AccessKeyId,
|
|
63
|
+
SecretKey,
|
|
64
|
+
SessionToken,
|
|
65
|
+
Expiration: Expiration && new Date((Expiration as any) * 1000),
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @internal
|
|
71
|
+
*/
|
|
72
|
+
export const getCredentialsForIdentity = composeServiceApi(
|
|
73
|
+
cognitoIdentityTransferHandler,
|
|
74
|
+
getCredentialsForIdentitySerializer,
|
|
75
|
+
getCredentialsForIdentityDeserializer,
|
|
76
|
+
defaultConfig,
|
|
77
|
+
);
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
Endpoint,
|
|
6
|
+
HttpRequest,
|
|
7
|
+
HttpResponse,
|
|
8
|
+
parseJsonBody,
|
|
9
|
+
parseJsonError,
|
|
10
|
+
parseMetadata,
|
|
11
|
+
} from '../../clients';
|
|
12
|
+
import { composeServiceApi } from '../../clients/internal';
|
|
13
|
+
|
|
14
|
+
import {
|
|
15
|
+
buildHttpRpcRequest,
|
|
16
|
+
cognitoIdentityTransferHandler,
|
|
17
|
+
defaultConfig,
|
|
18
|
+
getSharedHeaders,
|
|
19
|
+
} from './base';
|
|
20
|
+
import {
|
|
21
|
+
GetIdCommandInput as GetIdInput,
|
|
22
|
+
GetIdCommandOutput as GetIdOutput,
|
|
23
|
+
} from './types';
|
|
24
|
+
|
|
25
|
+
export type { GetIdInput, GetIdOutput };
|
|
26
|
+
|
|
27
|
+
const getIdSerializer = (
|
|
28
|
+
input: GetIdInput,
|
|
29
|
+
endpoint: Endpoint,
|
|
30
|
+
): HttpRequest => {
|
|
31
|
+
const headers = getSharedHeaders('GetId');
|
|
32
|
+
const body = JSON.stringify(input);
|
|
33
|
+
|
|
34
|
+
return buildHttpRpcRequest(endpoint, headers, body);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const getIdDeserializer = async (
|
|
38
|
+
response: HttpResponse,
|
|
39
|
+
): Promise<GetIdOutput> => {
|
|
40
|
+
if (response.statusCode >= 300) {
|
|
41
|
+
const error = await parseJsonError(response);
|
|
42
|
+
throw error;
|
|
43
|
+
} else {
|
|
44
|
+
const body = await parseJsonBody(response);
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
IdentityId: body.IdentityId,
|
|
48
|
+
$metadata: parseMetadata(response),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
export const getId = composeServiceApi(
|
|
57
|
+
cognitoIdentityTransferHandler,
|
|
58
|
+
getIdSerializer,
|
|
59
|
+
getIdDeserializer,
|
|
60
|
+
defaultConfig,
|
|
61
|
+
);
|
|
@@ -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 { getId, GetIdInput, GetIdOutput } from './getId';
|
|
5
|
+
export {
|
|
6
|
+
getCredentialsForIdentity,
|
|
7
|
+
GetCredentialsForIdentityInput,
|
|
8
|
+
GetCredentialsForIdentityOutput,
|
|
9
|
+
} from './getCredentialsForIdentity';
|
package/src/index.ts
CHANGED
|
@@ -43,12 +43,13 @@ export {
|
|
|
43
43
|
clearCredentials,
|
|
44
44
|
} from './singleton';
|
|
45
45
|
|
|
46
|
-
//
|
|
46
|
+
// AWSClients exports
|
|
47
47
|
export {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
getCredentialsForIdentity,
|
|
49
|
+
getId,
|
|
50
|
+
GetCredentialsForIdentityInput,
|
|
51
|
+
GetCredentialsForIdentityOutput,
|
|
52
|
+
} from './awsClients/cognitoIdentity';
|
|
52
53
|
|
|
53
54
|
// Amplify-wide constructs
|
|
54
55
|
export { UserProfile } from './types';
|