@aws-sdk/credential-provider-node 3.48.0 → 3.52.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,41 @@
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.52.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.51.0...v3.52.0) (2022-02-18)
7
+
8
+
9
+ ### Features
10
+
11
+ * **credential-provider-node:** refactor into modular components ([#3294](https://github.com/aws/aws-sdk-js-v3/issues/3294)) ([5f351cd](https://github.com/aws/aws-sdk-js-v3/commit/5f351cdca347e073810419613123a6204f04a4c9))
12
+
13
+
14
+
15
+
16
+
17
+ # [3.51.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.50.0...v3.51.0) (2022-02-12)
18
+
19
+ **Note:** Version bump only for package @aws-sdk/credential-provider-node
20
+
21
+
22
+
23
+
24
+
25
+ # [3.50.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.49.0...v3.50.0) (2022-02-08)
26
+
27
+ **Note:** Version bump only for package @aws-sdk/credential-provider-node
28
+
29
+
30
+
31
+
32
+
33
+ # [3.49.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.48.0...v3.49.0) (2022-01-29)
34
+
35
+ **Note:** Version bump only for package @aws-sdk/credential-provider-node
36
+
37
+
38
+
39
+
40
+
6
41
  # [3.48.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.47.2...v3.48.0) (2022-01-22)
7
42
 
8
43
  **Note:** Version bump only for package @aws-sdk/credential-provider-node
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defaultProvider = void 0;
4
+ const credential_provider_env_1 = require("@aws-sdk/credential-provider-env");
5
+ const credential_provider_ini_1 = require("@aws-sdk/credential-provider-ini");
6
+ const credential_provider_process_1 = require("@aws-sdk/credential-provider-process");
7
+ const credential_provider_sso_1 = require("@aws-sdk/credential-provider-sso");
8
+ const credential_provider_web_identity_1 = require("@aws-sdk/credential-provider-web-identity");
9
+ const property_provider_1 = require("@aws-sdk/property-provider");
10
+ const shared_ini_file_loader_1 = require("@aws-sdk/shared-ini-file-loader");
11
+ const util_credentials_1 = require("@aws-sdk/util-credentials");
12
+ const remoteProvider_1 = require("./remoteProvider");
13
+ const defaultProvider = (init = {}) => {
14
+ const options = {
15
+ profile: process.env[util_credentials_1.ENV_PROFILE],
16
+ ...init,
17
+ ...(!init.loadedConfig && { loadedConfig: shared_ini_file_loader_1.loadSharedConfigFiles(init) }),
18
+ };
19
+ const providerChain = property_provider_1.chain(...(options.profile ? [] : [credential_provider_env_1.fromEnv()]), credential_provider_sso_1.fromSSO(options), credential_provider_ini_1.fromIni(options), credential_provider_process_1.fromProcess(options), credential_provider_web_identity_1.fromTokenFile(options), remoteProvider_1.remoteProvider(options), async () => {
20
+ throw new property_provider_1.CredentialsProviderError("Could not load credentials from any providers", false);
21
+ });
22
+ return property_provider_1.memoize(providerChain, (credentials) => credentials.expiration !== undefined && credentials.expiration.getTime() - Date.now() < 300000, (credentials) => credentials.expiration !== undefined);
23
+ };
24
+ exports.defaultProvider = defaultProvider;
package/dist-cjs/index.js CHANGED
@@ -1,42 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.defaultProvider = exports.ENV_IMDS_DISABLED = void 0;
4
- const credential_provider_env_1 = require("@aws-sdk/credential-provider-env");
5
- const credential_provider_imds_1 = require("@aws-sdk/credential-provider-imds");
6
- const credential_provider_ini_1 = require("@aws-sdk/credential-provider-ini");
7
- const credential_provider_process_1 = require("@aws-sdk/credential-provider-process");
8
- const credential_provider_sso_1 = require("@aws-sdk/credential-provider-sso");
9
- const credential_provider_web_identity_1 = require("@aws-sdk/credential-provider-web-identity");
10
- const property_provider_1 = require("@aws-sdk/property-provider");
11
- const shared_ini_file_loader_1 = require("@aws-sdk/shared-ini-file-loader");
12
- const util_credentials_1 = require("@aws-sdk/util-credentials");
13
- exports.ENV_IMDS_DISABLED = "AWS_EC2_METADATA_DISABLED";
14
- const defaultProvider = (init = {}) => {
15
- const options = { profile: process.env[util_credentials_1.ENV_PROFILE], ...init };
16
- if (!options.loadedConfig)
17
- options.loadedConfig = shared_ini_file_loader_1.loadSharedConfigFiles(init);
18
- const providers = [
19
- credential_provider_sso_1.fromSSO(options),
20
- credential_provider_ini_1.fromIni(options),
21
- credential_provider_process_1.fromProcess(options),
22
- credential_provider_web_identity_1.fromTokenFile(options),
23
- remoteProvider(options),
24
- async () => {
25
- throw new property_provider_1.CredentialsProviderError("Could not load credentials from any providers", false);
26
- },
27
- ];
28
- if (!options.profile)
29
- providers.unshift(credential_provider_env_1.fromEnv());
30
- const providerChain = property_provider_1.chain(...providers);
31
- return property_provider_1.memoize(providerChain, (credentials) => credentials.expiration !== undefined && credentials.expiration.getTime() - Date.now() < 300000, (credentials) => credentials.expiration !== undefined);
32
- };
33
- exports.defaultProvider = defaultProvider;
34
- const remoteProvider = (init) => {
35
- if (process.env[credential_provider_imds_1.ENV_CMDS_RELATIVE_URI] || process.env[credential_provider_imds_1.ENV_CMDS_FULL_URI]) {
36
- return credential_provider_imds_1.fromContainerMetadata(init);
37
- }
38
- if (process.env[exports.ENV_IMDS_DISABLED]) {
39
- return () => Promise.reject(new property_provider_1.CredentialsProviderError("EC2 Instance Metadata Service access disabled"));
40
- }
41
- return credential_provider_imds_1.fromInstanceMetadata(init);
42
- };
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./defaultProvider"), exports);
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.remoteProvider = exports.ENV_IMDS_DISABLED = void 0;
4
+ const credential_provider_imds_1 = require("@aws-sdk/credential-provider-imds");
5
+ const property_provider_1 = require("@aws-sdk/property-provider");
6
+ exports.ENV_IMDS_DISABLED = "AWS_EC2_METADATA_DISABLED";
7
+ const remoteProvider = (init) => {
8
+ if (process.env[credential_provider_imds_1.ENV_CMDS_RELATIVE_URI] || process.env[credential_provider_imds_1.ENV_CMDS_FULL_URI]) {
9
+ return credential_provider_imds_1.fromContainerMetadata(init);
10
+ }
11
+ if (process.env[exports.ENV_IMDS_DISABLED]) {
12
+ return async () => {
13
+ throw new property_provider_1.CredentialsProviderError("EC2 Instance Metadata Service access disabled");
14
+ };
15
+ }
16
+ return credential_provider_imds_1.fromInstanceMetadata(init);
17
+ };
18
+ exports.remoteProvider = remoteProvider;
@@ -0,0 +1,25 @@
1
+ import { __assign, __awaiter, __generator, __read, __spreadArray } from "tslib";
2
+ import { fromEnv } from "@aws-sdk/credential-provider-env";
3
+ import { fromIni } from "@aws-sdk/credential-provider-ini";
4
+ import { fromProcess } from "@aws-sdk/credential-provider-process";
5
+ import { fromSSO } from "@aws-sdk/credential-provider-sso";
6
+ import { fromTokenFile } from "@aws-sdk/credential-provider-web-identity";
7
+ import { chain, CredentialsProviderError, memoize } from "@aws-sdk/property-provider";
8
+ import { loadSharedConfigFiles } from "@aws-sdk/shared-ini-file-loader";
9
+ import { ENV_PROFILE } from "@aws-sdk/util-credentials";
10
+ import { remoteProvider } from "./remoteProvider";
11
+ export var defaultProvider = function (init) {
12
+ if (init === void 0) { init = {}; }
13
+ var options = __assign(__assign({ profile: process.env[ENV_PROFILE] }, init), (!init.loadedConfig && { loadedConfig: loadSharedConfigFiles(init) }));
14
+ var providerChain = chain.apply(void 0, __spreadArray(__spreadArray([], __read((options.profile ? [] : [fromEnv()]))), [fromSSO(options),
15
+ fromIni(options),
16
+ fromProcess(options),
17
+ fromTokenFile(options),
18
+ remoteProvider(options),
19
+ function () { return __awaiter(void 0, void 0, void 0, function () {
20
+ return __generator(this, function (_a) {
21
+ throw new CredentialsProviderError("Could not load credentials from any providers", false);
22
+ });
23
+ }); }]));
24
+ return memoize(providerChain, function (credentials) { return credentials.expiration !== undefined && credentials.expiration.getTime() - Date.now() < 300000; }, function (credentials) { return credentials.expiration !== undefined; });
25
+ };
package/dist-es/index.js CHANGED
@@ -1,42 +1 @@
1
- import { __assign, __awaiter, __generator, __read, __spreadArray } from "tslib";
2
- import { fromEnv } from "@aws-sdk/credential-provider-env";
3
- import { ENV_CMDS_FULL_URI, ENV_CMDS_RELATIVE_URI, fromContainerMetadata, fromInstanceMetadata, } from "@aws-sdk/credential-provider-imds";
4
- import { fromIni } from "@aws-sdk/credential-provider-ini";
5
- import { fromProcess } from "@aws-sdk/credential-provider-process";
6
- import { fromSSO } from "@aws-sdk/credential-provider-sso";
7
- import { fromTokenFile } from "@aws-sdk/credential-provider-web-identity";
8
- import { chain, CredentialsProviderError, memoize } from "@aws-sdk/property-provider";
9
- import { loadSharedConfigFiles } from "@aws-sdk/shared-ini-file-loader";
10
- import { ENV_PROFILE } from "@aws-sdk/util-credentials";
11
- export var ENV_IMDS_DISABLED = "AWS_EC2_METADATA_DISABLED";
12
- export var defaultProvider = function (init) {
13
- if (init === void 0) { init = {}; }
14
- var options = __assign({ profile: process.env[ENV_PROFILE] }, init);
15
- if (!options.loadedConfig)
16
- options.loadedConfig = loadSharedConfigFiles(init);
17
- var providers = [
18
- fromSSO(options),
19
- fromIni(options),
20
- fromProcess(options),
21
- fromTokenFile(options),
22
- remoteProvider(options),
23
- function () { return __awaiter(void 0, void 0, void 0, function () {
24
- return __generator(this, function (_a) {
25
- throw new CredentialsProviderError("Could not load credentials from any providers", false);
26
- });
27
- }); },
28
- ];
29
- if (!options.profile)
30
- providers.unshift(fromEnv());
31
- var providerChain = chain.apply(void 0, __spreadArray([], __read(providers)));
32
- return memoize(providerChain, function (credentials) { return credentials.expiration !== undefined && credentials.expiration.getTime() - Date.now() < 300000; }, function (credentials) { return credentials.expiration !== undefined; });
33
- };
34
- var remoteProvider = function (init) {
35
- if (process.env[ENV_CMDS_RELATIVE_URI] || process.env[ENV_CMDS_FULL_URI]) {
36
- return fromContainerMetadata(init);
37
- }
38
- if (process.env[ENV_IMDS_DISABLED]) {
39
- return function () { return Promise.reject(new CredentialsProviderError("EC2 Instance Metadata Service access disabled")); };
40
- }
41
- return fromInstanceMetadata(init);
42
- };
1
+ export * from "./defaultProvider";
@@ -0,0 +1,17 @@
1
+ import { __awaiter, __generator } from "tslib";
2
+ import { ENV_CMDS_FULL_URI, ENV_CMDS_RELATIVE_URI, fromContainerMetadata, fromInstanceMetadata, } from "@aws-sdk/credential-provider-imds";
3
+ import { CredentialsProviderError } from "@aws-sdk/property-provider";
4
+ export var ENV_IMDS_DISABLED = "AWS_EC2_METADATA_DISABLED";
5
+ export var remoteProvider = function (init) {
6
+ if (process.env[ENV_CMDS_RELATIVE_URI] || process.env[ENV_CMDS_FULL_URI]) {
7
+ return fromContainerMetadata(init);
8
+ }
9
+ if (process.env[ENV_IMDS_DISABLED]) {
10
+ return function () { return __awaiter(void 0, void 0, void 0, function () {
11
+ return __generator(this, function (_a) {
12
+ throw new CredentialsProviderError("EC2 Instance Metadata Service access disabled");
13
+ });
14
+ }); };
15
+ }
16
+ return fromInstanceMetadata(init);
17
+ };
@@ -0,0 +1,41 @@
1
+ import { RemoteProviderInit } from "@aws-sdk/credential-provider-imds";
2
+ import { FromIniInit } from "@aws-sdk/credential-provider-ini";
3
+ import { FromProcessInit } from "@aws-sdk/credential-provider-process";
4
+ import { FromSSOInit } from "@aws-sdk/credential-provider-sso";
5
+ import { FromTokenFileInit } from "@aws-sdk/credential-provider-web-identity";
6
+ import { CredentialProvider } from "@aws-sdk/types";
7
+ /**
8
+ * Creates a credential provider that will attempt to find credentials from the
9
+ * following sources (listed in order of precedence):
10
+ * * Environment variables exposed via `process.env`
11
+ * * SSO credentials from token cache
12
+ * * Web identity token credentials
13
+ * * Shared credentials and config ini files
14
+ * * The EC2/ECS Instance Metadata Service
15
+ *
16
+ * The default credential provider will invoke one provider at a time and only
17
+ * continue to the next if no credentials have been located. For example, if
18
+ * the process finds values defined via the `AWS_ACCESS_KEY_ID` and
19
+ * `AWS_SECRET_ACCESS_KEY` environment variables, the files at
20
+ * `~/.aws/credentials` and `~/.aws/config` will not be read, nor will any
21
+ * messages be sent to the Instance Metadata Service.
22
+ *
23
+ * @param init Configuration that is passed to each individual
24
+ * provider
25
+ *
26
+ * @see fromEnv The function used to source credentials from
27
+ * environment variables
28
+ * @see fromSSO The function used to source credentials from
29
+ * resolved SSO token cache
30
+ * @see fromTokenFile The function used to source credentials from
31
+ * token file
32
+ * @see fromIni The function used to source credentials from INI
33
+ * files
34
+ * @see fromProcess The function used to sources credentials from
35
+ * credential_process in INI files
36
+ * @see fromInstanceMetadata The function used to source credentials from the
37
+ * EC2 Instance Metadata Service
38
+ * @see fromContainerMetadata The function used to source credentials from the
39
+ * ECS Container Metadata Service
40
+ */
41
+ export declare const defaultProvider: (init?: FromIniInit & RemoteProviderInit & FromProcessInit & FromSSOInit & FromTokenFileInit) => CredentialProvider;
@@ -1,42 +1 @@
1
- import { RemoteProviderInit } from "@aws-sdk/credential-provider-imds";
2
- import { FromIniInit } from "@aws-sdk/credential-provider-ini";
3
- import { FromProcessInit } from "@aws-sdk/credential-provider-process";
4
- import { FromSSOInit } from "@aws-sdk/credential-provider-sso";
5
- import { FromTokenFileInit } from "@aws-sdk/credential-provider-web-identity";
6
- import { CredentialProvider } from "@aws-sdk/types";
7
- export declare const ENV_IMDS_DISABLED = "AWS_EC2_METADATA_DISABLED";
8
- /**
9
- * Creates a credential provider that will attempt to find credentials from the
10
- * following sources (listed in order of precedence):
11
- * * Environment variables exposed via `process.env`
12
- * * SSO credentials from token cache
13
- * * Web identity token credentials
14
- * * Shared credentials and config ini files
15
- * * The EC2/ECS Instance Metadata Service
16
- *
17
- * The default credential provider will invoke one provider at a time and only
18
- * continue to the next if no credentials have been located. For example, if
19
- * the process finds values defined via the `AWS_ACCESS_KEY_ID` and
20
- * `AWS_SECRET_ACCESS_KEY` environment variables, the files at
21
- * `~/.aws/credentials` and `~/.aws/config` will not be read, nor will any
22
- * messages be sent to the Instance Metadata Service.
23
- *
24
- * @param init Configuration that is passed to each individual
25
- * provider
26
- *
27
- * @see fromEnv The function used to source credentials from
28
- * environment variables
29
- * @see fromSSO The function used to source credentials from
30
- * resolved SSO token cache
31
- * @see fromTokenFile The function used to source credentials from
32
- * token file
33
- * @see fromIni The function used to source credentials from INI
34
- * files
35
- * @see fromProcess The function used to sources credentials from
36
- * credential_process in INI files
37
- * @see fromInstanceMetadata The function used to source credentials from the
38
- * EC2 Instance Metadata Service
39
- * @see fromContainerMetadata The function used to source credentials from the
40
- * ECS Container Metadata Service
41
- */
42
- export declare const defaultProvider: (init?: FromIniInit & RemoteProviderInit & FromProcessInit & FromSSOInit & FromTokenFileInit) => CredentialProvider;
1
+ export * from "./defaultProvider";
@@ -0,0 +1,4 @@
1
+ import { RemoteProviderInit } from "@aws-sdk/credential-provider-imds";
2
+ import { CredentialProvider } from "@aws-sdk/types";
3
+ export declare const ENV_IMDS_DISABLED = "AWS_EC2_METADATA_DISABLED";
4
+ export declare const remoteProvider: (init: RemoteProviderInit) => CredentialProvider;
@@ -0,0 +1,8 @@
1
+ import { RemoteProviderInit } from "@aws-sdk/credential-provider-imds";
2
+ import { FromIniInit } from "@aws-sdk/credential-provider-ini";
3
+ import { FromProcessInit } from "@aws-sdk/credential-provider-process";
4
+ import { FromSSOInit } from "@aws-sdk/credential-provider-sso";
5
+ import { FromTokenFileInit } from "@aws-sdk/credential-provider-web-identity";
6
+ import { CredentialProvider } from "@aws-sdk/types";
7
+
8
+ export declare const defaultProvider: (init?: FromIniInit & RemoteProviderInit & FromProcessInit & FromSSOInit & FromTokenFileInit) => CredentialProvider;
@@ -1,9 +1 @@
1
- import { RemoteProviderInit } from "@aws-sdk/credential-provider-imds";
2
- import { FromIniInit } from "@aws-sdk/credential-provider-ini";
3
- import { FromProcessInit } from "@aws-sdk/credential-provider-process";
4
- import { FromSSOInit } from "@aws-sdk/credential-provider-sso";
5
- import { FromTokenFileInit } from "@aws-sdk/credential-provider-web-identity";
6
- import { CredentialProvider } from "@aws-sdk/types";
7
- export declare const ENV_IMDS_DISABLED = "AWS_EC2_METADATA_DISABLED";
8
-
9
- export declare const defaultProvider: (init?: FromIniInit & RemoteProviderInit & FromProcessInit & FromSSOInit & FromTokenFileInit) => CredentialProvider;
1
+ export * from "./defaultProvider";
@@ -0,0 +1,4 @@
1
+ import { RemoteProviderInit } from "@aws-sdk/credential-provider-imds";
2
+ import { CredentialProvider } from "@aws-sdk/types";
3
+ export declare const ENV_IMDS_DISABLED = "AWS_EC2_METADATA_DISABLED";
4
+ export declare const remoteProvider: (init: RemoteProviderInit) => CredentialProvider;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/credential-provider-node",
3
- "version": "3.48.0",
3
+ "version": "3.52.0",
4
4
  "description": "AWS credential provider that sources credentials from a Node.JS environment. ",
5
5
  "engines": {
6
6
  "node": ">=12.0.0"
@@ -13,7 +13,7 @@
13
13
  "build:es": "tsc -p tsconfig.es.json",
14
14
  "build:types": "tsc -p tsconfig.types.json",
15
15
  "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
16
- "clean": "rimraf ./dist-*",
16
+ "clean": "rimraf ./dist-* && rimraf *.tsbuildinfo",
17
17
  "test": "jest"
18
18
  },
19
19
  "keywords": [
@@ -26,20 +26,26 @@
26
26
  },
27
27
  "license": "Apache-2.0",
28
28
  "dependencies": {
29
- "@aws-sdk/credential-provider-env": "3.47.2",
30
- "@aws-sdk/credential-provider-imds": "3.47.2",
31
- "@aws-sdk/credential-provider-ini": "3.48.0",
32
- "@aws-sdk/credential-provider-process": "3.47.2",
33
- "@aws-sdk/credential-provider-sso": "3.48.0",
34
- "@aws-sdk/credential-provider-web-identity": "3.47.2",
35
- "@aws-sdk/property-provider": "3.47.2",
36
- "@aws-sdk/shared-ini-file-loader": "3.47.1",
37
- "@aws-sdk/types": "3.47.1",
38
- "@aws-sdk/util-credentials": "3.47.2",
29
+ "@aws-sdk/credential-provider-env": "3.52.0",
30
+ "@aws-sdk/credential-provider-imds": "3.52.0",
31
+ "@aws-sdk/credential-provider-ini": "3.52.0",
32
+ "@aws-sdk/credential-provider-process": "3.52.0",
33
+ "@aws-sdk/credential-provider-sso": "3.52.0",
34
+ "@aws-sdk/credential-provider-web-identity": "3.52.0",
35
+ "@aws-sdk/property-provider": "3.52.0",
36
+ "@aws-sdk/shared-ini-file-loader": "3.52.0",
37
+ "@aws-sdk/types": "3.52.0",
38
+ "@aws-sdk/util-credentials": "3.52.0",
39
39
  "tslib": "^2.3.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@types/node": "^10.0.0"
42
+ "@tsconfig/recommended": "1.0.1",
43
+ "@types/node": "^10.0.0",
44
+ "concurrently": "7.0.0",
45
+ "downlevel-dts": "0.7.0",
46
+ "rimraf": "3.0.2",
47
+ "typedoc": "0.19.2",
48
+ "typescript": "~4.3.5"
43
49
  },
44
50
  "types": "./dist-types/index.d.ts",
45
51
  "typesVersions": {