@aws-sdk/credential-provider-cognito-identity 3.507.0 → 3.511.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
|
@@ -69,7 +69,7 @@ __name(resolveLogins, "resolveLogins");
|
|
|
69
69
|
// src/fromCognitoIdentity.ts
|
|
70
70
|
function fromCognitoIdentity(parameters) {
|
|
71
71
|
return async () => {
|
|
72
|
-
var _a;
|
|
72
|
+
var _a, _b, _c;
|
|
73
73
|
(_a = parameters.logger) == null ? void 0 : _a.debug("@aws-sdk/credential-provider-cognito-identity", "fromCognitoIdentity");
|
|
74
74
|
const { GetCredentialsForIdentityCommand: GetCredentialsForIdentityCommand2, CognitoIdentityClient: CognitoIdentityClient2 } = await Promise.resolve().then(() => (init_loadCognitoIdentity(), loadCognitoIdentity_exports));
|
|
75
75
|
const {
|
|
@@ -79,7 +79,11 @@ function fromCognitoIdentity(parameters) {
|
|
|
79
79
|
SecretKey = throwOnMissingSecretKey(),
|
|
80
80
|
SessionToken
|
|
81
81
|
} = throwOnMissingCredentials()
|
|
82
|
-
} = await (parameters.client ?? new CognitoIdentityClient2(
|
|
82
|
+
} = await (parameters.client ?? new CognitoIdentityClient2(
|
|
83
|
+
Object.assign({}, parameters.clientConfig ?? {}, {
|
|
84
|
+
region: ((_b = parameters.clientConfig) == null ? void 0 : _b.region) ?? ((_c = parameters.parentClientConfig) == null ? void 0 : _c.region)
|
|
85
|
+
})
|
|
86
|
+
)).send(
|
|
83
87
|
new GetCredentialsForIdentityCommand2({
|
|
84
88
|
CustomRoleArn: parameters.customRoleArn,
|
|
85
89
|
IdentityId: parameters.identityId,
|
|
@@ -227,13 +231,16 @@ function fromCognitoIdentityPool({
|
|
|
227
231
|
identityPoolId,
|
|
228
232
|
logins,
|
|
229
233
|
userIdentifier = !logins || Object.keys(logins).length === 0 ? "ANONYMOUS" : void 0,
|
|
230
|
-
logger
|
|
234
|
+
logger,
|
|
235
|
+
parentClientConfig
|
|
231
236
|
}) {
|
|
232
237
|
logger == null ? void 0 : logger.debug("@aws-sdk/credential-provider-cognito-identity", "fromCognitoIdentity");
|
|
233
238
|
const cacheKey = userIdentifier ? `aws:cognito-identity-credentials:${identityPoolId}:${userIdentifier}` : void 0;
|
|
234
239
|
let provider = /* @__PURE__ */ __name(async () => {
|
|
235
240
|
const { GetIdCommand: GetIdCommand2, CognitoIdentityClient: CognitoIdentityClient2 } = await Promise.resolve().then(() => (init_loadCognitoIdentity(), loadCognitoIdentity_exports));
|
|
236
|
-
const _client = client ?? new CognitoIdentityClient2(
|
|
241
|
+
const _client = client ?? new CognitoIdentityClient2(
|
|
242
|
+
Object.assign({}, clientConfig ?? {}, { region: (clientConfig == null ? void 0 : clientConfig.region) ?? (parentClientConfig == null ? void 0 : parentClientConfig.region) })
|
|
243
|
+
);
|
|
237
244
|
let identityId = cacheKey && await cache.getItem(cacheKey);
|
|
238
245
|
if (!identityId) {
|
|
239
246
|
const { IdentityId = throwOnMissingId() } = await _client.send(
|
|
@@ -4,7 +4,10 @@ export function fromCognitoIdentity(parameters) {
|
|
|
4
4
|
return async () => {
|
|
5
5
|
parameters.logger?.debug("@aws-sdk/credential-provider-cognito-identity", "fromCognitoIdentity");
|
|
6
6
|
const { GetCredentialsForIdentityCommand, CognitoIdentityClient } = await import("./loadCognitoIdentity");
|
|
7
|
-
const { Credentials: { AccessKeyId = throwOnMissingAccessKeyId(), Expiration, SecretKey = throwOnMissingSecretKey(), SessionToken, } = throwOnMissingCredentials(), } = await (parameters.client ??
|
|
7
|
+
const { Credentials: { AccessKeyId = throwOnMissingAccessKeyId(), Expiration, SecretKey = throwOnMissingSecretKey(), SessionToken, } = throwOnMissingCredentials(), } = await (parameters.client ??
|
|
8
|
+
new CognitoIdentityClient(Object.assign({}, parameters.clientConfig ?? {}, {
|
|
9
|
+
region: parameters.clientConfig?.region ?? parameters.parentClientConfig?.region,
|
|
10
|
+
}))).send(new GetCredentialsForIdentityCommand({
|
|
8
11
|
CustomRoleArn: parameters.customRoleArn,
|
|
9
12
|
IdentityId: parameters.identityId,
|
|
10
13
|
Logins: parameters.logins ? await resolveLogins(parameters.logins) : undefined,
|
|
@@ -2,14 +2,15 @@ import { CredentialsProviderError } from "@smithy/property-provider";
|
|
|
2
2
|
import { fromCognitoIdentity } from "./fromCognitoIdentity";
|
|
3
3
|
import { localStorage } from "./localStorage";
|
|
4
4
|
import { resolveLogins } from "./resolveLogins";
|
|
5
|
-
export function fromCognitoIdentityPool({ accountId, cache = localStorage(), client, clientConfig, customRoleArn, identityPoolId, logins, userIdentifier = !logins || Object.keys(logins).length === 0 ? "ANONYMOUS" : undefined, logger, }) {
|
|
5
|
+
export function fromCognitoIdentityPool({ accountId, cache = localStorage(), client, clientConfig, customRoleArn, identityPoolId, logins, userIdentifier = !logins || Object.keys(logins).length === 0 ? "ANONYMOUS" : undefined, logger, parentClientConfig, }) {
|
|
6
6
|
logger?.debug("@aws-sdk/credential-provider-cognito-identity", "fromCognitoIdentity");
|
|
7
7
|
const cacheKey = userIdentifier
|
|
8
8
|
? `aws:cognito-identity-credentials:${identityPoolId}:${userIdentifier}`
|
|
9
9
|
: undefined;
|
|
10
10
|
let provider = async () => {
|
|
11
11
|
const { GetIdCommand, CognitoIdentityClient } = await import("./loadCognitoIdentity");
|
|
12
|
-
const _client = client ??
|
|
12
|
+
const _client = client ??
|
|
13
|
+
new CognitoIdentityClient(Object.assign({}, clientConfig ?? {}, { region: clientConfig?.region ?? parentClientConfig?.region }));
|
|
13
14
|
let identityId = (cacheKey && (await cache.getItem(cacheKey)));
|
|
14
15
|
if (!identityId) {
|
|
15
16
|
const { IdentityId = throwOnMissingId() } = await _client.send(new GetIdCommand({
|
|
@@ -12,7 +12,7 @@ import { Storage } from "./Storage";
|
|
|
12
12
|
* Results from `GetId` are cached internally, but results from
|
|
13
13
|
* `GetCredentialsForIdentity` are not.
|
|
14
14
|
*/
|
|
15
|
-
export declare function fromCognitoIdentityPool({ accountId, cache, client, clientConfig, customRoleArn, identityPoolId, logins, userIdentifier, logger, }: FromCognitoIdentityPoolParameters): CognitoIdentityCredentialProvider;
|
|
15
|
+
export declare function fromCognitoIdentityPool({ accountId, cache, client, clientConfig, customRoleArn, identityPoolId, logins, userIdentifier, logger, parentClientConfig, }: FromCognitoIdentityPoolParameters): CognitoIdentityCredentialProvider;
|
|
16
16
|
/**
|
|
17
17
|
* @internal
|
|
18
18
|
*/
|
|
@@ -12,6 +12,7 @@ export declare function fromCognitoIdentityPool({
|
|
|
12
12
|
logins,
|
|
13
13
|
userIdentifier,
|
|
14
14
|
logger,
|
|
15
|
+
parentClientConfig,
|
|
15
16
|
}: FromCognitoIdentityPoolParameters): CognitoIdentityCredentialProvider;
|
|
16
17
|
export interface FromCognitoIdentityPoolParameters
|
|
17
18
|
extends CognitoProviderParameters,
|
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.511.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",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
},
|
|
22
22
|
"license": "Apache-2.0",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@aws-sdk/client-cognito-identity": "3.
|
|
25
|
-
"@aws-sdk/types": "3.
|
|
24
|
+
"@aws-sdk/client-cognito-identity": "3.511.0",
|
|
25
|
+
"@aws-sdk/types": "3.511.0",
|
|
26
26
|
"@smithy/property-provider": "^2.1.1",
|
|
27
27
|
"@smithy/types": "^2.9.1",
|
|
28
28
|
"tslib": "^2.5.0"
|