@aws-sdk/credential-providers 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/createCredentialChain.js +24 -3
- package/dist-es/createCredentialChain.js +23 -3
- package/dist-types/createCredentialChain.d.ts +6 -1
- package/dist-types/fromCognitoIdentity.d.ts +1 -1
- package/dist-types/fromIni.d.ts +2 -2
- package/dist-types/ts3.4/createCredentialChain.d.ts +9 -2
- package/dist-types/ts3.4/fromCognitoIdentity.d.ts +1 -1
- package/dist-types/ts3.4/fromIni.d.ts +2 -2
- package/package.json +14 -14
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createCredentialChain = void 0;
|
|
3
|
+
exports.propertyProviderChain = exports.createCredentialChain = void 0;
|
|
4
4
|
const property_provider_1 = require("@smithy/property-provider");
|
|
5
5
|
const createCredentialChain = (...credentialProviders) => {
|
|
6
6
|
let expireAfter = -1;
|
|
7
|
-
const baseFunction = async () => {
|
|
8
|
-
const credentials = await (0,
|
|
7
|
+
const baseFunction = async (awsIdentityProperties) => {
|
|
8
|
+
const credentials = await (0, exports.propertyProviderChain)(...credentialProviders)(awsIdentityProperties);
|
|
9
9
|
if (!credentials.expiration && expireAfter !== -1) {
|
|
10
10
|
credentials.expiration = new Date(Date.now() + expireAfter);
|
|
11
11
|
}
|
|
@@ -23,3 +23,24 @@ const createCredentialChain = (...credentialProviders) => {
|
|
|
23
23
|
return withOptions;
|
|
24
24
|
};
|
|
25
25
|
exports.createCredentialChain = createCredentialChain;
|
|
26
|
+
const propertyProviderChain = (...providers) => async (awsIdentityProperties) => {
|
|
27
|
+
if (providers.length === 0) {
|
|
28
|
+
throw new property_provider_1.ProviderError("No providers in chain");
|
|
29
|
+
}
|
|
30
|
+
let lastProviderError;
|
|
31
|
+
for (const provider of providers) {
|
|
32
|
+
try {
|
|
33
|
+
const credentials = await provider(awsIdentityProperties);
|
|
34
|
+
return credentials;
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
lastProviderError = err;
|
|
38
|
+
if (err?.tryNextLink) {
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
throw err;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
throw lastProviderError;
|
|
45
|
+
};
|
|
46
|
+
exports.propertyProviderChain = propertyProviderChain;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ProviderError } from "@smithy/property-provider";
|
|
2
2
|
export const createCredentialChain = (...credentialProviders) => {
|
|
3
3
|
let expireAfter = -1;
|
|
4
|
-
const baseFunction = async () => {
|
|
5
|
-
const credentials = await propertyProviderChain(...credentialProviders)();
|
|
4
|
+
const baseFunction = async (awsIdentityProperties) => {
|
|
5
|
+
const credentials = await propertyProviderChain(...credentialProviders)(awsIdentityProperties);
|
|
6
6
|
if (!credentials.expiration && expireAfter !== -1) {
|
|
7
7
|
credentials.expiration = new Date(Date.now() + expireAfter);
|
|
8
8
|
}
|
|
@@ -19,3 +19,23 @@ export const createCredentialChain = (...credentialProviders) => {
|
|
|
19
19
|
});
|
|
20
20
|
return withOptions;
|
|
21
21
|
};
|
|
22
|
+
export const propertyProviderChain = (...providers) => async (awsIdentityProperties) => {
|
|
23
|
+
if (providers.length === 0) {
|
|
24
|
+
throw new ProviderError("No providers in chain");
|
|
25
|
+
}
|
|
26
|
+
let lastProviderError;
|
|
27
|
+
for (const provider of providers) {
|
|
28
|
+
try {
|
|
29
|
+
const credentials = await provider(awsIdentityProperties);
|
|
30
|
+
return credentials;
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
lastProviderError = err;
|
|
34
|
+
if (err?.tryNextLink) {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
throw err;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
throw lastProviderError;
|
|
41
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RuntimeConfigAwsCredentialIdentityProvider, RuntimeConfigIdentityProvider } from "@aws-sdk/types";
|
|
1
2
|
import type { AwsCredentialIdentityProvider } from "@smithy/types";
|
|
2
3
|
export interface CustomCredentialChainOptions {
|
|
3
4
|
expireAfter(milliseconds: number): AwsCredentialIdentityProvider & CustomCredentialChainOptions;
|
|
@@ -41,4 +42,8 @@ export interface CustomCredentialChainOptions {
|
|
|
41
42
|
* @returns a single AwsCredentialIdentityProvider that calls the given
|
|
42
43
|
* providers in sequence until one succeeds or all fail.
|
|
43
44
|
*/
|
|
44
|
-
export declare const createCredentialChain: (...credentialProviders:
|
|
45
|
+
export declare const createCredentialChain: (...credentialProviders: RuntimeConfigAwsCredentialIdentityProvider[]) => RuntimeConfigAwsCredentialIdentityProvider & CustomCredentialChainOptions;
|
|
46
|
+
/**
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
export declare const propertyProviderChain: <T>(...providers: RuntimeConfigIdentityProvider<T>[]) => RuntimeConfigIdentityProvider<T>;
|
|
@@ -42,4 +42,4 @@ export type CognitoIdentityCredentialProvider = _CognitoIdentityCredentialProvid
|
|
|
42
42
|
* });
|
|
43
43
|
* ```
|
|
44
44
|
*/
|
|
45
|
-
export declare const fromCognitoIdentity: (options: FromCognitoIdentityParameters) =>
|
|
45
|
+
export declare const fromCognitoIdentity: (options: FromCognitoIdentityParameters) => CognitoIdentityCredentialProvider;
|
package/dist-types/fromIni.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FromIniInit } from "@aws-sdk/credential-provider-ini";
|
|
2
|
-
import {
|
|
2
|
+
import type { RuntimeConfigAwsCredentialIdentityProvider } from "@aws-sdk/types";
|
|
3
3
|
/**
|
|
4
4
|
* Creates a credential provider function that reads from a shared credentials file at `~/.aws/credentials` and a
|
|
5
5
|
* shared configuration file at `~/.aws/config`. Both files are expected to be INI formatted with section names
|
|
@@ -39,4 +39,4 @@ import { AwsCredentialIdentityProvider } from "@smithy/types";
|
|
|
39
39
|
* });
|
|
40
40
|
* ```
|
|
41
41
|
*/
|
|
42
|
-
export declare const fromIni: (init?: FromIniInit) =>
|
|
42
|
+
export declare const fromIni: (init?: FromIniInit) => RuntimeConfigAwsCredentialIdentityProvider;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RuntimeConfigAwsCredentialIdentityProvider,
|
|
3
|
+
RuntimeConfigIdentityProvider,
|
|
4
|
+
} from "@aws-sdk/types";
|
|
1
5
|
import { AwsCredentialIdentityProvider } from "@smithy/types";
|
|
2
6
|
export interface CustomCredentialChainOptions {
|
|
3
7
|
expireAfter(
|
|
@@ -5,5 +9,8 @@ export interface CustomCredentialChainOptions {
|
|
|
5
9
|
): AwsCredentialIdentityProvider & CustomCredentialChainOptions;
|
|
6
10
|
}
|
|
7
11
|
export declare const createCredentialChain: (
|
|
8
|
-
...credentialProviders:
|
|
9
|
-
) =>
|
|
12
|
+
...credentialProviders: RuntimeConfigAwsCredentialIdentityProvider[]
|
|
13
|
+
) => RuntimeConfigAwsCredentialIdentityProvider & CustomCredentialChainOptions;
|
|
14
|
+
export declare const propertyProviderChain: <T>(
|
|
15
|
+
...providers: RuntimeConfigIdentityProvider<T>[]
|
|
16
|
+
) => RuntimeConfigIdentityProvider<T>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FromIniInit } from "@aws-sdk/credential-provider-ini";
|
|
2
|
-
import {
|
|
2
|
+
import { RuntimeConfigAwsCredentialIdentityProvider } from "@aws-sdk/types";
|
|
3
3
|
export declare const fromIni: (
|
|
4
4
|
init?: FromIniInit
|
|
5
|
-
) =>
|
|
5
|
+
) => RuntimeConfigAwsCredentialIdentityProvider;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/credential-providers",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.713.0",
|
|
4
4
|
"description": "A collection of credential providers, without requiring service clients like STS, Cognito",
|
|
5
5
|
"main": "./dist-cjs/index.js",
|
|
6
6
|
"module": "./dist-es/index.js",
|
|
@@ -30,19 +30,19 @@
|
|
|
30
30
|
},
|
|
31
31
|
"license": "Apache-2.0",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@aws-sdk/client-cognito-identity": "3.
|
|
34
|
-
"@aws-sdk/client-sso": "3.
|
|
35
|
-
"@aws-sdk/client-sts": "3.
|
|
36
|
-
"@aws-sdk/core": "3.
|
|
37
|
-
"@aws-sdk/credential-provider-cognito-identity": "3.
|
|
38
|
-
"@aws-sdk/credential-provider-env": "3.
|
|
39
|
-
"@aws-sdk/credential-provider-http": "3.
|
|
40
|
-
"@aws-sdk/credential-provider-ini": "3.
|
|
41
|
-
"@aws-sdk/credential-provider-node": "3.
|
|
42
|
-
"@aws-sdk/credential-provider-process": "3.
|
|
43
|
-
"@aws-sdk/credential-provider-sso": "3.
|
|
44
|
-
"@aws-sdk/credential-provider-web-identity": "3.
|
|
45
|
-
"@aws-sdk/types": "3.
|
|
33
|
+
"@aws-sdk/client-cognito-identity": "3.713.0",
|
|
34
|
+
"@aws-sdk/client-sso": "3.713.0",
|
|
35
|
+
"@aws-sdk/client-sts": "3.713.0",
|
|
36
|
+
"@aws-sdk/core": "3.713.0",
|
|
37
|
+
"@aws-sdk/credential-provider-cognito-identity": "3.713.0",
|
|
38
|
+
"@aws-sdk/credential-provider-env": "3.713.0",
|
|
39
|
+
"@aws-sdk/credential-provider-http": "3.713.0",
|
|
40
|
+
"@aws-sdk/credential-provider-ini": "3.713.0",
|
|
41
|
+
"@aws-sdk/credential-provider-node": "3.713.0",
|
|
42
|
+
"@aws-sdk/credential-provider-process": "3.713.0",
|
|
43
|
+
"@aws-sdk/credential-provider-sso": "3.713.0",
|
|
44
|
+
"@aws-sdk/credential-provider-web-identity": "3.713.0",
|
|
45
|
+
"@aws-sdk/types": "3.713.0",
|
|
46
46
|
"@smithy/credential-provider-imds": "^3.2.8",
|
|
47
47
|
"@smithy/property-provider": "^3.1.11",
|
|
48
48
|
"@smithy/types": "^3.7.2",
|