@aws-sdk/credential-providers 3.181.0 → 3.185.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/CHANGELOG.md CHANGED
@@ -3,6 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.185.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.184.0...v3.185.0) (2022-10-05)
7
+
8
+ **Note:** Version bump only for package @aws-sdk/credential-providers
9
+
10
+
11
+
12
+
13
+
14
+ # [3.183.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.182.0...v3.183.0) (2022-10-03)
15
+
16
+ **Note:** Version bump only for package @aws-sdk/credential-providers
17
+
18
+
19
+
20
+
21
+
6
22
  # [3.181.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.180.0...v3.181.0) (2022-09-29)
7
23
 
8
24
  **Note:** Version bump only for package @aws-sdk/credential-providers
@@ -1,7 +1,6 @@
1
- import { __assign } from "tslib";
2
1
  import { CognitoIdentityClient } from "@aws-sdk/client-cognito-identity";
3
2
  import { fromCognitoIdentity as _fromCognitoIdentity, } from "@aws-sdk/credential-provider-cognito-identity";
4
- export var fromCognitoIdentity = function (options) {
5
- var _a;
6
- return _fromCognitoIdentity(__assign(__assign({}, options), { client: new CognitoIdentityClient((_a = options.clientConfig) !== null && _a !== void 0 ? _a : {}) }));
7
- };
3
+ export const fromCognitoIdentity = (options) => _fromCognitoIdentity({
4
+ ...options,
5
+ client: new CognitoIdentityClient(options.clientConfig ?? {}),
6
+ });
@@ -1,7 +1,6 @@
1
- import { __assign } from "tslib";
2
1
  import { CognitoIdentityClient } from "@aws-sdk/client-cognito-identity";
3
2
  import { fromCognitoIdentityPool as _fromCognitoIdentityPool, } from "@aws-sdk/credential-provider-cognito-identity";
4
- export var fromCognitoIdentityPool = function (options) {
5
- var _a;
6
- return _fromCognitoIdentityPool(__assign(__assign({}, options), { client: new CognitoIdentityClient((_a = options.clientConfig) !== null && _a !== void 0 ? _a : {}) }));
7
- };
3
+ export const fromCognitoIdentityPool = (options) => _fromCognitoIdentityPool({
4
+ ...options,
5
+ client: new CognitoIdentityClient(options.clientConfig ?? {}),
6
+ });
@@ -1,2 +1,2 @@
1
1
  import { fromContainerMetadata as _fromContainerMetadata, } from "@aws-sdk/credential-provider-imds";
2
- export var fromContainerMetadata = function (init) { return _fromContainerMetadata(init); };
2
+ export const fromContainerMetadata = (init) => _fromContainerMetadata(init);
@@ -1,2 +1,2 @@
1
1
  import { fromEnv as _fromEnv } from "@aws-sdk/credential-provider-env";
2
- export var fromEnv = function () { return _fromEnv(); };
2
+ export const fromEnv = () => _fromEnv();
@@ -1,8 +1,7 @@
1
- import { __assign } from "tslib";
2
1
  import { getDefaultRoleAssumer, getDefaultRoleAssumerWithWebIdentity } from "@aws-sdk/client-sts";
3
2
  import { fromIni as _fromIni } from "@aws-sdk/credential-provider-ini";
4
- export var fromIni = function (init) {
5
- var _a, _b;
6
- if (init === void 0) { init = {}; }
7
- return _fromIni(__assign(__assign({}, init), { roleAssumer: (_a = init.roleAssumer) !== null && _a !== void 0 ? _a : getDefaultRoleAssumer(init.clientConfig, init.clientPlugins), roleAssumerWithWebIdentity: (_b = init.roleAssumerWithWebIdentity) !== null && _b !== void 0 ? _b : getDefaultRoleAssumerWithWebIdentity(init.clientConfig, init.clientPlugins) }));
8
- };
3
+ export const fromIni = (init = {}) => _fromIni({
4
+ ...init,
5
+ roleAssumer: init.roleAssumer ?? getDefaultRoleAssumer(init.clientConfig, init.clientPlugins),
6
+ roleAssumerWithWebIdentity: init.roleAssumerWithWebIdentity ?? getDefaultRoleAssumerWithWebIdentity(init.clientConfig, init.clientPlugins),
7
+ });
@@ -1,2 +1,2 @@
1
1
  import { fromInstanceMetadata as _fromInstanceMetadata, } from "@aws-sdk/credential-provider-imds";
2
- export var fromInstanceMetadata = function (init) { return _fromInstanceMetadata(init); };
2
+ export const fromInstanceMetadata = (init) => _fromInstanceMetadata(init);
@@ -1,8 +1,7 @@
1
- import { __assign } from "tslib";
2
1
  import { getDefaultRoleAssumer, getDefaultRoleAssumerWithWebIdentity } from "@aws-sdk/client-sts";
3
2
  import { defaultProvider } from "@aws-sdk/credential-provider-node";
4
- export var fromNodeProviderChain = function (init) {
5
- var _a, _b;
6
- if (init === void 0) { init = {}; }
7
- return defaultProvider(__assign(__assign({}, init), { roleAssumer: (_a = init.roleAssumer) !== null && _a !== void 0 ? _a : getDefaultRoleAssumer(init.clientConfig, init.clientPlugins), roleAssumerWithWebIdentity: (_b = init.roleAssumerWithWebIdentity) !== null && _b !== void 0 ? _b : getDefaultRoleAssumerWithWebIdentity(init.clientConfig, init.clientPlugins) }));
8
- };
3
+ export const fromNodeProviderChain = (init = {}) => defaultProvider({
4
+ ...init,
5
+ roleAssumer: init.roleAssumer ?? getDefaultRoleAssumer(init.clientConfig, init.clientPlugins),
6
+ roleAssumerWithWebIdentity: init.roleAssumerWithWebIdentity ?? getDefaultRoleAssumerWithWebIdentity(init.clientConfig, init.clientPlugins),
7
+ });
@@ -1,2 +1,2 @@
1
1
  import { fromProcess as _fromProcess } from "@aws-sdk/credential-provider-process";
2
- export var fromProcess = function (init) { return _fromProcess(init); };
2
+ export const fromProcess = (init) => _fromProcess(init);
@@ -1,7 +1,3 @@
1
- import { __assign } from "tslib";
2
1
  import { SSOClient } from "@aws-sdk/client-sso";
3
2
  import { fromSSO as _fromSSO } from "@aws-sdk/credential-provider-sso";
4
- export var fromSSO = function (init) {
5
- if (init === void 0) { init = {}; }
6
- return _fromSSO(__assign({ ssoClient: init.clientConfig ? new SSOClient(init.clientConfig) : undefined }, init));
7
- };
3
+ export const fromSSO = (init = {}) => _fromSSO({ ...{ ssoClient: init.clientConfig ? new SSOClient(init.clientConfig) : undefined }, ...init });
@@ -1,56 +1,31 @@
1
- import { __assign, __awaiter, __generator, __values } from "tslib";
2
1
  import { AssumeRoleCommand, STSClient } from "@aws-sdk/client-sts";
3
2
  import { CredentialsProviderError } from "@aws-sdk/property-provider";
4
- export var fromTemporaryCredentials = function (options) {
5
- var stsClient;
6
- return function () { return __awaiter(void 0, void 0, void 0, function () {
7
- var params, _a, _b, _c, plugin, Credentials;
8
- var e_1, _d;
9
- var _e;
10
- return __generator(this, function (_f) {
11
- switch (_f.label) {
12
- case 0:
13
- params = __assign(__assign({}, options.params), { RoleSessionName: (_e = options.params.RoleSessionName) !== null && _e !== void 0 ? _e : "aws-sdk-js-" + Date.now() });
14
- if (!(params === null || params === void 0 ? void 0 : params.SerialNumber)) return [3, 2];
15
- if (!options.mfaCodeProvider) {
16
- throw new CredentialsProviderError("Temporary credential requires multi-factor authentication," + " but no MFA code callback was provided.", false);
17
- }
18
- _a = params;
19
- return [4, options.mfaCodeProvider(params === null || params === void 0 ? void 0 : params.SerialNumber)];
20
- case 1:
21
- _a.TokenCode = _f.sent();
22
- _f.label = 2;
23
- case 2:
24
- if (!stsClient)
25
- stsClient = new STSClient(__assign(__assign({}, options.clientConfig), { credentials: options.masterCredentials }));
26
- if (options.clientPlugins) {
27
- try {
28
- for (_b = __values(options.clientPlugins), _c = _b.next(); !_c.done; _c = _b.next()) {
29
- plugin = _c.value;
30
- stsClient.middlewareStack.use(plugin);
31
- }
32
- }
33
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
34
- finally {
35
- try {
36
- if (_c && !_c.done && (_d = _b.return)) _d.call(_b);
37
- }
38
- finally { if (e_1) throw e_1.error; }
39
- }
40
- }
41
- return [4, stsClient.send(new AssumeRoleCommand(params))];
42
- case 3:
43
- Credentials = (_f.sent()).Credentials;
44
- if (!Credentials || !Credentials.AccessKeyId || !Credentials.SecretAccessKey) {
45
- throw new CredentialsProviderError("Invalid response from STS.assumeRole call with role ".concat(params.RoleArn));
46
- }
47
- return [2, {
48
- accessKeyId: Credentials.AccessKeyId,
49
- secretAccessKey: Credentials.SecretAccessKey,
50
- sessionToken: Credentials.SessionToken,
51
- expiration: Credentials.Expiration,
52
- }];
3
+ export const fromTemporaryCredentials = (options) => {
4
+ let stsClient;
5
+ return async () => {
6
+ const params = { ...options.params, RoleSessionName: options.params.RoleSessionName ?? "aws-sdk-js-" + Date.now() };
7
+ if (params?.SerialNumber) {
8
+ if (!options.mfaCodeProvider) {
9
+ throw new CredentialsProviderError(`Temporary credential requires multi-factor authentication,` + ` but no MFA code callback was provided.`, false);
53
10
  }
54
- });
55
- }); };
11
+ params.TokenCode = await options.mfaCodeProvider(params?.SerialNumber);
12
+ }
13
+ if (!stsClient)
14
+ stsClient = new STSClient({ ...options.clientConfig, credentials: options.masterCredentials });
15
+ if (options.clientPlugins) {
16
+ for (const plugin of options.clientPlugins) {
17
+ stsClient.middlewareStack.use(plugin);
18
+ }
19
+ }
20
+ const { Credentials } = await stsClient.send(new AssumeRoleCommand(params));
21
+ if (!Credentials || !Credentials.AccessKeyId || !Credentials.SecretAccessKey) {
22
+ throw new CredentialsProviderError(`Invalid response from STS.assumeRole call with role ${params.RoleArn}`);
23
+ }
24
+ return {
25
+ accessKeyId: Credentials.AccessKeyId,
26
+ secretAccessKey: Credentials.SecretAccessKey,
27
+ sessionToken: Credentials.SessionToken,
28
+ expiration: Credentials.Expiration,
29
+ };
30
+ };
56
31
  };
@@ -1,8 +1,6 @@
1
- import { __assign } from "tslib";
2
1
  import { getDefaultRoleAssumerWithWebIdentity } from "@aws-sdk/client-sts";
3
2
  import { fromTokenFile as _fromTokenFile, } from "@aws-sdk/credential-provider-web-identity";
4
- export var fromTokenFile = function (init) {
5
- var _a;
6
- if (init === void 0) { init = {}; }
7
- return _fromTokenFile(__assign(__assign({}, init), { roleAssumerWithWebIdentity: (_a = init.roleAssumerWithWebIdentity) !== null && _a !== void 0 ? _a : getDefaultRoleAssumerWithWebIdentity(init.clientConfig, init.clientPlugins) }));
8
- };
3
+ export const fromTokenFile = (init = {}) => _fromTokenFile({
4
+ ...init,
5
+ roleAssumerWithWebIdentity: init.roleAssumerWithWebIdentity ?? getDefaultRoleAssumerWithWebIdentity(init.clientConfig, init.clientPlugins),
6
+ });
@@ -1,7 +1,6 @@
1
- import { __assign } from "tslib";
2
1
  import { getDefaultRoleAssumerWithWebIdentity } from "@aws-sdk/client-sts";
3
2
  import { fromWebToken as _fromWebToken, } from "@aws-sdk/credential-provider-web-identity";
4
- export var fromWebToken = function (init) {
5
- var _a;
6
- return _fromWebToken(__assign(__assign({}, init), { roleAssumerWithWebIdentity: (_a = init.roleAssumerWithWebIdentity) !== null && _a !== void 0 ? _a : getDefaultRoleAssumerWithWebIdentity(init.clientConfig, init.clientPlugins) }));
7
- };
3
+ export const fromWebToken = (init) => _fromWebToken({
4
+ ...init,
5
+ roleAssumerWithWebIdentity: init.roleAssumerWithWebIdentity ?? getDefaultRoleAssumerWithWebIdentity(init.clientConfig, init.clientPlugins),
6
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/credential-providers",
3
- "version": "3.181.0",
3
+ "version": "3.185.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",
@@ -27,20 +27,20 @@
27
27
  },
28
28
  "license": "Apache-2.0",
29
29
  "dependencies": {
30
- "@aws-sdk/client-cognito-identity": "3.181.0",
31
- "@aws-sdk/client-sso": "3.181.0",
32
- "@aws-sdk/client-sts": "3.181.0",
33
- "@aws-sdk/credential-provider-cognito-identity": "3.181.0",
34
- "@aws-sdk/credential-provider-env": "3.178.0",
35
- "@aws-sdk/credential-provider-imds": "3.178.0",
36
- "@aws-sdk/credential-provider-ini": "3.181.0",
37
- "@aws-sdk/credential-provider-node": "3.181.0",
38
- "@aws-sdk/credential-provider-process": "3.178.0",
39
- "@aws-sdk/credential-provider-sso": "3.181.0",
40
- "@aws-sdk/credential-provider-web-identity": "3.178.0",
41
- "@aws-sdk/property-provider": "3.178.0",
42
- "@aws-sdk/shared-ini-file-loader": "3.178.0",
43
- "@aws-sdk/types": "3.178.0",
30
+ "@aws-sdk/client-cognito-identity": "3.185.0",
31
+ "@aws-sdk/client-sso": "3.185.0",
32
+ "@aws-sdk/client-sts": "3.185.0",
33
+ "@aws-sdk/credential-provider-cognito-identity": "3.185.0",
34
+ "@aws-sdk/credential-provider-env": "3.183.0",
35
+ "@aws-sdk/credential-provider-imds": "3.183.0",
36
+ "@aws-sdk/credential-provider-ini": "3.185.0",
37
+ "@aws-sdk/credential-provider-node": "3.185.0",
38
+ "@aws-sdk/credential-provider-process": "3.183.0",
39
+ "@aws-sdk/credential-provider-sso": "3.185.0",
40
+ "@aws-sdk/credential-provider-web-identity": "3.183.0",
41
+ "@aws-sdk/property-provider": "3.183.0",
42
+ "@aws-sdk/shared-ini-file-loader": "3.183.0",
43
+ "@aws-sdk/types": "3.183.0",
44
44
  "tslib": "^2.3.1"
45
45
  },
46
46
  "devDependencies": {