@aws-sdk/credential-provider-cognito-identity 3.712.0 → 3.713.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/index.js
CHANGED
|
@@ -70,8 +70,8 @@ __name(resolveLogins, "resolveLogins");
|
|
|
70
70
|
|
|
71
71
|
// src/fromCognitoIdentity.ts
|
|
72
72
|
function fromCognitoIdentity(parameters) {
|
|
73
|
-
return async () => {
|
|
74
|
-
var _a, _b, _c;
|
|
73
|
+
return async (awsIdentityProperties) => {
|
|
74
|
+
var _a, _b, _c, _d;
|
|
75
75
|
(_a = parameters.logger) == null ? void 0 : _a.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");
|
|
76
76
|
const { GetCredentialsForIdentityCommand: GetCredentialsForIdentityCommand2, CognitoIdentityClient: CognitoIdentityClient2 } = await Promise.resolve().then(() => (init_loadCognitoIdentity(), loadCognitoIdentity_exports));
|
|
77
77
|
const {
|
|
@@ -83,7 +83,7 @@ function fromCognitoIdentity(parameters) {
|
|
|
83
83
|
} = throwOnMissingCredentials(parameters.logger)
|
|
84
84
|
} = await (parameters.client ?? new CognitoIdentityClient2(
|
|
85
85
|
Object.assign({}, parameters.clientConfig ?? {}, {
|
|
86
|
-
region: ((_b = parameters.clientConfig) == null ? void 0 : _b.region) ?? ((_c = parameters.parentClientConfig) == null ? void 0 : _c.region)
|
|
86
|
+
region: ((_b = parameters.clientConfig) == null ? void 0 : _b.region) ?? ((_c = parameters.parentClientConfig) == null ? void 0 : _c.region) ?? ((_d = awsIdentityProperties == null ? void 0 : awsIdentityProperties.callerClientConfig) == null ? void 0 : _d.region)
|
|
87
87
|
})
|
|
88
88
|
)).send(
|
|
89
89
|
new GetCredentialsForIdentityCommand2({
|
|
@@ -238,10 +238,13 @@ function fromCognitoIdentityPool({
|
|
|
238
238
|
}) {
|
|
239
239
|
logger == null ? void 0 : logger.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");
|
|
240
240
|
const cacheKey = userIdentifier ? `aws:cognito-identity-credentials:${identityPoolId}:${userIdentifier}` : void 0;
|
|
241
|
-
let provider = /* @__PURE__ */ __name(async () => {
|
|
241
|
+
let provider = /* @__PURE__ */ __name(async (awsIdentityProperties) => {
|
|
242
|
+
var _a;
|
|
242
243
|
const { GetIdCommand: GetIdCommand2, CognitoIdentityClient: CognitoIdentityClient2 } = await Promise.resolve().then(() => (init_loadCognitoIdentity(), loadCognitoIdentity_exports));
|
|
243
244
|
const _client = client ?? new CognitoIdentityClient2(
|
|
244
|
-
Object.assign({}, clientConfig ?? {}, {
|
|
245
|
+
Object.assign({}, clientConfig ?? {}, {
|
|
246
|
+
region: (clientConfig == null ? void 0 : clientConfig.region) ?? (parentClientConfig == null ? void 0 : parentClientConfig.region) ?? ((_a = awsIdentityProperties == null ? void 0 : awsIdentityProperties.callerClientConfig) == null ? void 0 : _a.region)
|
|
247
|
+
})
|
|
245
248
|
);
|
|
246
249
|
let identityId = cacheKey && await cache.getItem(cacheKey);
|
|
247
250
|
if (!identityId) {
|
|
@@ -264,9 +267,9 @@ function fromCognitoIdentityPool({
|
|
|
264
267
|
logins,
|
|
265
268
|
identityId
|
|
266
269
|
});
|
|
267
|
-
return provider();
|
|
270
|
+
return provider(awsIdentityProperties);
|
|
268
271
|
}, "provider");
|
|
269
|
-
return () => provider().catch(async (err) => {
|
|
272
|
+
return (awsIdentityProperties) => provider(awsIdentityProperties).catch(async (err) => {
|
|
270
273
|
if (cacheKey) {
|
|
271
274
|
Promise.resolve(cache.removeItem(cacheKey)).catch(() => {
|
|
272
275
|
});
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { CredentialsProviderError } from "@smithy/property-provider";
|
|
2
2
|
import { resolveLogins } from "./resolveLogins";
|
|
3
3
|
export function fromCognitoIdentity(parameters) {
|
|
4
|
-
return async () => {
|
|
4
|
+
return async (awsIdentityProperties) => {
|
|
5
5
|
parameters.logger?.debug("@aws-sdk/credential-provider-cognito-identity - fromCognitoIdentity");
|
|
6
6
|
const { GetCredentialsForIdentityCommand, CognitoIdentityClient } = await import("./loadCognitoIdentity");
|
|
7
7
|
const { Credentials: { AccessKeyId = throwOnMissingAccessKeyId(parameters.logger), Expiration, SecretKey = throwOnMissingSecretKey(parameters.logger), SessionToken, } = throwOnMissingCredentials(parameters.logger), } = await (parameters.client ??
|
|
8
8
|
new CognitoIdentityClient(Object.assign({}, parameters.clientConfig ?? {}, {
|
|
9
|
-
region: parameters.clientConfig?.region ??
|
|
9
|
+
region: parameters.clientConfig?.region ??
|
|
10
|
+
parameters.parentClientConfig?.region ??
|
|
11
|
+
awsIdentityProperties?.callerClientConfig?.region,
|
|
10
12
|
}))).send(new GetCredentialsForIdentityCommand({
|
|
11
13
|
CustomRoleArn: parameters.customRoleArn,
|
|
12
14
|
IdentityId: parameters.identityId,
|
|
@@ -7,10 +7,12 @@ export function fromCognitoIdentityPool({ accountId, cache = localStorage(), cli
|
|
|
7
7
|
const cacheKey = userIdentifier
|
|
8
8
|
? `aws:cognito-identity-credentials:${identityPoolId}:${userIdentifier}`
|
|
9
9
|
: undefined;
|
|
10
|
-
let provider = async () => {
|
|
10
|
+
let provider = async (awsIdentityProperties) => {
|
|
11
11
|
const { GetIdCommand, CognitoIdentityClient } = await import("./loadCognitoIdentity");
|
|
12
12
|
const _client = client ??
|
|
13
|
-
new CognitoIdentityClient(Object.assign({}, clientConfig ?? {}, {
|
|
13
|
+
new CognitoIdentityClient(Object.assign({}, clientConfig ?? {}, {
|
|
14
|
+
region: clientConfig?.region ?? parentClientConfig?.region ?? awsIdentityProperties?.callerClientConfig?.region,
|
|
15
|
+
}));
|
|
14
16
|
let identityId = (cacheKey && (await cache.getItem(cacheKey)));
|
|
15
17
|
if (!identityId) {
|
|
16
18
|
const { IdentityId = throwOnMissingId(logger) } = await _client.send(new GetIdCommand({
|
|
@@ -29,9 +31,9 @@ export function fromCognitoIdentityPool({ accountId, cache = localStorage(), cli
|
|
|
29
31
|
logins,
|
|
30
32
|
identityId,
|
|
31
33
|
});
|
|
32
|
-
return provider();
|
|
34
|
+
return provider(awsIdentityProperties);
|
|
33
35
|
};
|
|
34
|
-
return () => provider().catch(async (err) => {
|
|
36
|
+
return (awsIdentityProperties) => provider(awsIdentityProperties).catch(async (err) => {
|
|
35
37
|
if (cacheKey) {
|
|
36
38
|
Promise.resolve(cache.removeItem(cacheKey)).catch(() => { });
|
|
37
39
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CredentialProviderOptions } from "@aws-sdk/types";
|
|
2
|
-
import { AwsCredentialIdentity
|
|
1
|
+
import type { CredentialProviderOptions, RuntimeConfigIdentityProvider } from "@aws-sdk/types";
|
|
2
|
+
import type { AwsCredentialIdentity } from "@smithy/types";
|
|
3
3
|
import { CognitoProviderParameters } from "./CognitoProviderParameters";
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
@@ -13,7 +13,7 @@ export interface CognitoIdentityCredentials extends AwsCredentialIdentity {
|
|
|
13
13
|
/**
|
|
14
14
|
* @internal
|
|
15
15
|
*/
|
|
16
|
-
export type CognitoIdentityCredentialProvider =
|
|
16
|
+
export type CognitoIdentityCredentialProvider = RuntimeConfigIdentityProvider<CognitoIdentityCredentials>;
|
|
17
17
|
/**
|
|
18
18
|
* @internal
|
|
19
19
|
*
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
CredentialProviderOptions,
|
|
3
|
+
RuntimeConfigIdentityProvider,
|
|
4
|
+
} from "@aws-sdk/types";
|
|
5
|
+
import { AwsCredentialIdentity } from "@smithy/types";
|
|
3
6
|
import { CognitoProviderParameters } from "./CognitoProviderParameters";
|
|
4
7
|
export interface CognitoIdentityCredentials extends AwsCredentialIdentity {
|
|
5
8
|
identityId: string;
|
|
6
9
|
}
|
|
7
10
|
export type CognitoIdentityCredentialProvider =
|
|
8
|
-
|
|
11
|
+
RuntimeConfigIdentityProvider<CognitoIdentityCredentials>;
|
|
9
12
|
export declare function fromCognitoIdentity(
|
|
10
13
|
parameters: FromCognitoIdentityParameters
|
|
11
14
|
): CognitoIdentityCredentialProvider;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/credential-provider-cognito-identity",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.713.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
6
6
|
"build:cjs": "node ../../scripts/compilation/inline credential-provider-cognito-identity",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
},
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@aws-sdk/client-cognito-identity": "3.
|
|
28
|
-
"@aws-sdk/types": "3.
|
|
27
|
+
"@aws-sdk/client-cognito-identity": "3.713.0",
|
|
28
|
+
"@aws-sdk/types": "3.713.0",
|
|
29
29
|
"@smithy/property-provider": "^3.1.11",
|
|
30
30
|
"@smithy/types": "^3.7.2",
|
|
31
31
|
"tslib": "^2.6.2"
|