@cloud-idaas/akless-aws-adapter 0.1.0-beta.1 → 0.1.0-beta.3

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
@@ -1,6 +1,15 @@
1
1
  # Changelog
2
2
 
3
- ## 0.1.0-beta.1 (Unreleased)
3
+ ## 0.1.0-beta.3
4
+
5
+ - Include this adapter repository name and build version in PAM STS User-Agent headers.
6
+ - Use Core SDK and PAM SDK 0.1.0-beta.3.
7
+
8
+ ## 0.1.0-beta.2
9
+
10
+ - Publish a maintenance prerelease with no API changes.
11
+
12
+ ## 0.1.0-beta.1
4
13
 
5
14
  - Provide renewable credentials for AWS SDK for JavaScript v3.
6
15
  - Improve credential expiry checks, refresh behavior, and resource cleanup.
package/dist/index.js CHANGED
@@ -4,6 +4,7 @@ exports.IDaaSPamAklessCredentialFactory = exports.IDaaSPamAwsCredentialsProvider
4
4
  exports.createAwsCredentialsProvider = createAwsCredentialsProvider;
5
5
  const core_sdk_1 = require("@cloud-idaas/core-sdk");
6
6
  const pam_client_sdk_1 = require("@cloud-idaas/pam-client-sdk");
7
+ const sdk_version_1 = require("./sdk-version");
7
8
  /**
8
9
  * IDaaS PAM dynamic credential adapter for AWS SDK v3 on Node.js 20/22/24.
9
10
  * @remarks The signing integration was verified with @aws-sdk/client-sts 3.1152.0. Inherited getCredentials
@@ -31,7 +32,7 @@ class IDaaSPamAwsCredentialsProvider extends pam_client_sdk_1.CachedCloudCredent
31
32
  sessionToken: (0, pam_client_sdk_1.credentialString)(token.sessionToken, 'sessionToken'),
32
33
  expiration: new Date((0, pam_client_sdk_1.credentialExpiration)(response, token.expiration)).toISOString(),
33
34
  };
34
- });
35
+ }, `idaas-typescript-akless-aws-adapter/${sdk_version_1.SDK_VERSION}`);
35
36
  }
36
37
  /**
37
38
  * Wraps this provider as an AWS SDK v3 credentials function without creating another cache or fetching credentials.
package/dist/index.js.map CHANGED
@@ -1 +1 @@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C,EAAE,CAAC;QAC9D,CAAC,CAAC;QACF,OAAO,CAAC,KAAK,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QACnC,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAxCD,wEAwCC;AACD;;;;;;;;GAQG;AACH,SAAgB,4BAA4B,CAC1C,aAA6C,EAC7C,UAAyD,EAAE;IAE3D,OAAO,IAAI,8BAA8B,CACvC,OAAO,aAAa,KAAK,QAAQ;QAC/B,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE;QAC/C,CAAC,CAAC,aAAa,CAClB,CAAC,wBAAwB,EAAE,CAAC;AAC/B,CAAC;AACD,yEAAyE;AACzE,MAAa,+BAA+B;;AAA5C,0EAGC;AAFC,kHAAkH;AAC3G,4DAA4B,GAAG,4BAA4B,CAAC","sourcesContent":["import { CredentialException } from '@cloud-idaas/core-sdk';\nimport {\n type AklessProviderOptions,\n AklessProviderBuilder,\n CachedCloudCredentialProvider,\n type ExpiringCredential,\n credentialExpiration,\n credentialString,\n} from '@cloud-idaas/pam-client-sdk';\n\n/** AWS STS snapshot mapped from PAM, with expiration as an ISO 8601 timestamp. */\nexport interface AwsSessionCredentials extends ExpiringCredential {\n accessKeyId: string;\n secretAccessKey: string;\n sessionToken: string;\n}\n/** Structural AWS SDK v3 identity; every returned Date is an independent object. */\nexport interface AwsCredentialIdentity {\n accessKeyId: string;\n secretAccessKey: string;\n sessionToken: string;\n expiration: Date;\n}\n/**\n * Asynchronous AWS SDK v3 credential function with explicit resource cleanup.\n * @remarks Fetches STS credentials on first use; refresh failures after expiration reject instead of returning expired credentials.\n */\nexport interface AwsCredentialsProvider {\n /** @returns An independent credential snapshot for request signing; rejects with IDaaSException on failure. */\n (): Promise<AwsCredentialIdentity>;\n /** Closes owned PAM/HTTP resources, leaving the caller's AWS client and injected resources open. */\n close(): void;\n}\n/**\n * IDaaS PAM dynamic credential adapter for AWS SDK v3 on Node.js 20/22/24.\n * @remarks The signing integration was verified with @aws-sdk/client-sts 3.1152.0. Inherited getCredentials\n * returns an ISO expiration snapshot; toAwsCredentialsProvider converts it to Date at the adapter boundary.\n * Callers must call close; injected PAM, HTTP, and machine credential sources remain caller-owned.\n */\nexport class IDaaSPamAwsCredentialsProvider extends CachedCloudCredentialProvider<AwsSessionCredentials> {\n /** @returns A role configuration builder without I/O; build preserves constructor validation and resource ownership. */\n static builder(): AklessProviderBuilder<IDaaSPamAwsCredentialsProvider> {\n return new AklessProviderBuilder((options) => new IDaaSPamAwsCredentialsProvider(options));\n }\n /**\n * Creates a provider without fetching STS credentials.\n * @param options - Required role and optional PAM, HTTP, machine credential source, and cache configuration.\n * @throws ConfigException - The configuration is invalid or the required default factory is not initialized.\n */\n constructor(options: AklessProviderOptions) {\n super(options, (response) => {\n const token = response.awsStsToken;\n if (!token)\n throw new CredentialException(\n 'Response is missing awsStsToken',\n 'InvalidCredentialResponse',\n );\n return {\n accessKeyId: credentialString(token.accessKeyId, 'accessKeyId'),\n secretAccessKey: credentialString(token.secretAccessKey, 'secretAccessKey'),\n sessionToken: credentialString(token.sessionToken, 'sessionToken'),\n expiration: new Date(credentialExpiration(response, token.expiration)).toISOString(),\n };\n });\n }\n /**\n * Wraps this provider as an AWS SDK v3 credentials function without creating another cache or fetching credentials.\n * @returns A function sharing this provider; calling its close also closes this provider.\n * @remarks Every call returns an independent Date; asynchronous retrieval failures reject with IDaaSException.\n */\n toAwsCredentialsProvider(): AwsCredentialsProvider {\n const resolve = async (): Promise<AwsCredentialIdentity> => {\n const value = await this.getCredentials();\n this.assertAvailable(value);\n return { ...value, expiration: new Date(value.expiration) };\n };\n resolve.close = () => this.close();\n return resolve;\n }\n}\n/**\n * Creates a function accepted directly by the AWS SDK v3 credentials option.\n * @param roleOrOptions - Role external ID or complete configuration including the role.\n * @param options - Additional configuration when the first argument is a string; injected sources take precedence.\n * @returns An independent dynamic provider with close; fetches STS on first use and must be closed by the caller.\n * @throws ConfigException - The configuration is invalid or the required default factory is not initialized.\n * @remarks Request and expiration failures reject with IDaaSException; close leaves the AWS client\n * and caller-injected shared resources open.\n */\nexport function createAwsCredentialsProvider(\n roleOrOptions: string | AklessProviderOptions,\n options: Omit<AklessProviderOptions, 'roleExternalId'> = {},\n): AwsCredentialsProvider {\n return new IDaaSPamAwsCredentialsProvider(\n typeof roleOrOptions === 'string'\n ? { ...options, roleExternalId: roleOrOptions }\n : roleOrOptions,\n ).toAwsCredentialsProvider();\n}\n/** AWS beta convenience factories; do not create AWS service clients. */\nexport class IDaaSPamAklessCredentialFactory {\n /** Creates a dynamic credentials function with the same arguments, errors, and lifecycle as the named factory. */\n static createAwsCredentialsProvider = createAwsCredentialsProvider;\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AA8FA,oEASC;AAvGD,oDAA4D;AAC5D,gEAOqC;AACrC,+CAA4C;AAyB5C;;;;;GAKG;AACH,MAAa,8BAA+B,SAAQ,8CAAoD;IACtG,wHAAwH;IACxH,MAAM,CAAC,OAAO;QACZ,OAAO,IAAI,sCAAqB,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,8BAA8B,CAAC,OAAO,CAAC,CAAC,CAAC;IAC7F,CAAC;IACD;;;;OAIG;IACH,YAAY,OAA8B;QACxC,KAAK,CACH,OAAO,EACP,CAAC,QAAQ,EAAE,EAAE;YACX,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,CAAC;YACnC,IAAI,CAAC,KAAK;gBACR,MAAM,IAAI,8BAAmB,CAC3B,iCAAiC,EACjC,2BAA2B,CAC5B,CAAC;YACJ,OAAO;gBACL,WAAW,EAAE,IAAA,iCAAgB,EAAC,KAAK,CAAC,WAAW,EAAE,aAAa,CAAC;gBAC/D,eAAe,EAAE,IAAA,iCAAgB,EAAC,KAAK,CAAC,eAAe,EAAE,iBAAiB,CAAC;gBAC3E,YAAY,EAAE,IAAA,iCAAgB,EAAC,KAAK,CAAC,YAAY,EAAE,cAAc,CAAC;gBAClE,UAAU,EAAE,IAAI,IAAI,CAAC,IAAA,qCAAoB,EAAC,QAAQ,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,EAAE;aACrF,CAAC;QACJ,CAAC,EACD,uCAAuC,yBAAW,EAAE,CACrD,CAAC;IACJ,CAAC;IACD;;;;OAIG;IACH,wBAAwB;QACtB,MAAM,OAAO,GAAG,KAAK,IAAoC,EAAE;YACzD,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;YAC1C,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;YAC5B,OAAO,EAAE,GAAG,KAAK,EAAE,UAAU,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;QAC9D,CAAC,CAAC;QACF,OAAO,CAAC,KAAK,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QACnC,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AA5CD,wEA4CC;AACD;;;;;;;;GAQG;AACH,SAAgB,4BAA4B,CAC1C,aAA6C,EAC7C,UAAyD,EAAE;IAE3D,OAAO,IAAI,8BAA8B,CACvC,OAAO,aAAa,KAAK,QAAQ;QAC/B,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE;QAC/C,CAAC,CAAC,aAAa,CAClB,CAAC,wBAAwB,EAAE,CAAC;AAC/B,CAAC;AACD,yEAAyE;AACzE,MAAa,+BAA+B;;AAA5C,0EAGC;AAFC,kHAAkH;AAC3G,4DAA4B,GAAG,4BAA4B,CAAC","sourcesContent":["import { CredentialException } from '@cloud-idaas/core-sdk';\nimport {\n type AklessProviderOptions,\n AklessProviderBuilder,\n CachedCloudCredentialProvider,\n type ExpiringCredential,\n credentialExpiration,\n credentialString,\n} from '@cloud-idaas/pam-client-sdk';\nimport { SDK_VERSION } from './sdk-version';\n\n/** AWS STS snapshot mapped from PAM, with expiration as an ISO 8601 timestamp. */\nexport interface AwsSessionCredentials extends ExpiringCredential {\n accessKeyId: string;\n secretAccessKey: string;\n sessionToken: string;\n}\n/** Structural AWS SDK v3 identity; every returned Date is an independent object. */\nexport interface AwsCredentialIdentity {\n accessKeyId: string;\n secretAccessKey: string;\n sessionToken: string;\n expiration: Date;\n}\n/**\n * Asynchronous AWS SDK v3 credential function with explicit resource cleanup.\n * @remarks Fetches STS credentials on first use; refresh failures after expiration reject instead of returning expired credentials.\n */\nexport interface AwsCredentialsProvider {\n /** @returns An independent credential snapshot for request signing; rejects with IDaaSException on failure. */\n (): Promise<AwsCredentialIdentity>;\n /** Closes owned PAM/HTTP resources, leaving the caller's AWS client and injected resources open. */\n close(): void;\n}\n/**\n * IDaaS PAM dynamic credential adapter for AWS SDK v3 on Node.js 20/22/24.\n * @remarks The signing integration was verified with @aws-sdk/client-sts 3.1152.0. Inherited getCredentials\n * returns an ISO expiration snapshot; toAwsCredentialsProvider converts it to Date at the adapter boundary.\n * Callers must call close; injected PAM, HTTP, and machine credential sources remain caller-owned.\n */\nexport class IDaaSPamAwsCredentialsProvider extends CachedCloudCredentialProvider<AwsSessionCredentials> {\n /** @returns A role configuration builder without I/O; build preserves constructor validation and resource ownership. */\n static builder(): AklessProviderBuilder<IDaaSPamAwsCredentialsProvider> {\n return new AklessProviderBuilder((options) => new IDaaSPamAwsCredentialsProvider(options));\n }\n /**\n * Creates a provider without fetching STS credentials.\n * @param options - Required role and optional PAM, HTTP, machine credential source, and cache configuration.\n * @throws ConfigException - The configuration is invalid or the required default factory is not initialized.\n */\n constructor(options: AklessProviderOptions) {\n super(\n options,\n (response) => {\n const token = response.awsStsToken;\n if (!token)\n throw new CredentialException(\n 'Response is missing awsStsToken',\n 'InvalidCredentialResponse',\n );\n return {\n accessKeyId: credentialString(token.accessKeyId, 'accessKeyId'),\n secretAccessKey: credentialString(token.secretAccessKey, 'secretAccessKey'),\n sessionToken: credentialString(token.sessionToken, 'sessionToken'),\n expiration: new Date(credentialExpiration(response, token.expiration)).toISOString(),\n };\n },\n `idaas-typescript-akless-aws-adapter/${SDK_VERSION}`,\n );\n }\n /**\n * Wraps this provider as an AWS SDK v3 credentials function without creating another cache or fetching credentials.\n * @returns A function sharing this provider; calling its close also closes this provider.\n * @remarks Every call returns an independent Date; asynchronous retrieval failures reject with IDaaSException.\n */\n toAwsCredentialsProvider(): AwsCredentialsProvider {\n const resolve = async (): Promise<AwsCredentialIdentity> => {\n const value = await this.getCredentials();\n this.assertAvailable(value);\n return { ...value, expiration: new Date(value.expiration) };\n };\n resolve.close = () => this.close();\n return resolve;\n }\n}\n/**\n * Creates a function accepted directly by the AWS SDK v3 credentials option.\n * @param roleOrOptions - Role external ID or complete configuration including the role.\n * @param options - Additional configuration when the first argument is a string; injected sources take precedence.\n * @returns An independent dynamic provider with close; fetches STS on first use and must be closed by the caller.\n * @throws ConfigException - The configuration is invalid or the required default factory is not initialized.\n * @remarks Request and expiration failures reject with IDaaSException; close leaves the AWS client\n * and caller-injected shared resources open.\n */\nexport function createAwsCredentialsProvider(\n roleOrOptions: string | AklessProviderOptions,\n options: Omit<AklessProviderOptions, 'roleExternalId'> = {},\n): AwsCredentialsProvider {\n return new IDaaSPamAwsCredentialsProvider(\n typeof roleOrOptions === 'string'\n ? { ...options, roleExternalId: roleOrOptions }\n : roleOrOptions,\n ).toAwsCredentialsProvider();\n}\n/** AWS beta convenience factories; do not create AWS service clients. */\nexport class IDaaSPamAklessCredentialFactory {\n /** Creates a dynamic credentials function with the same arguments, errors, and lifecycle as the named factory. */\n static createAwsCredentialsProvider = createAwsCredentialsProvider;\n}\n"]}
@@ -0,0 +1 @@
1
+ export declare const SDK_VERSION: string;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SDK_VERSION = void 0;
4
+ // Generated from package.json by scripts/build-version.cjs. Do not edit.
5
+ exports.SDK_VERSION = '0.1.0-beta.3';
6
+ //# sourceMappingURL=sdk-version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk-version.js","sourceRoot":"","sources":["../src/sdk-version.ts"],"names":[],"mappings":";;;AAAA,yEAAyE;AAC5D,QAAA,WAAW,GAAW,cAAc,CAAC","sourcesContent":["// Generated from package.json by scripts/build-version.cjs. Do not edit.\nexport const SDK_VERSION: string = '0.1.0-beta.3';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud-idaas/akless-aws-adapter",
3
- "version": "0.1.0-beta.1",
3
+ "version": "0.1.0-beta.3",
4
4
  "description": "IDaaS akless-aws-adapter for TypeScript and JavaScript (Node.js)",
5
5
  "license": "Apache-2.0",
6
6
  "type": "commonjs",
@@ -30,8 +30,8 @@
30
30
  "node": ">=20.0.0"
31
31
  },
32
32
  "scripts": {
33
- "build": "tsc -p tsconfig.json && node scripts/build-esm.cjs",
34
- "typecheck": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p test/tsconfig.json",
33
+ "build": "node scripts/build-version.cjs && tsc -p tsconfig.json && node scripts/build-esm.cjs",
34
+ "typecheck": "node scripts/build-version.cjs && tsc --noEmit -p tsconfig.json && tsc --noEmit -p test/tsconfig.json",
35
35
  "test": "npm run build && nyc mocha --require ./test/register.cjs \"test/**/*.test.{ts,cjs}\"",
36
36
  "prepack": "npm run build",
37
37
  "lint": "eslint src test",
@@ -60,8 +60,8 @@
60
60
  "@aws-sdk/client-sts": "3.1152.0"
61
61
  },
62
62
  "dependencies": {
63
- "@cloud-idaas/core-sdk": "0.1.0-beta.1",
64
- "@cloud-idaas/pam-client-sdk": "0.1.0-beta.1"
63
+ "@cloud-idaas/core-sdk": "0.1.0-beta.3",
64
+ "@cloud-idaas/pam-client-sdk": "0.1.0-beta.3"
65
65
  },
66
66
  "publishConfig": {
67
67
  "access": "public",