@onivoro/server-aws-credential-providers 24.14.0 → 24.15.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/package.json +8 -2
- package/jest.config.ts +0 -11
- package/project.json +0 -33
- package/src/index.ts +0 -4
- package/src/lib/aws-credentials.class.ts +0 -4
- package/src/lib/resolve-aws-credential-providers-by-profile.function.ts +0 -43
- package/src/lib/server-aws-credential-providers-config.class.ts +0 -3
- package/src/lib/server-aws-credential-providers.module.ts +0 -21
- package/tsconfig.json +0 -16
- package/tsconfig.lib.json +0 -10
- package/tsconfig.spec.json +0 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onivoro/server-aws-credential-providers",
|
|
3
|
-
"version": "24.
|
|
3
|
+
"version": "24.15.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -14,5 +14,11 @@
|
|
|
14
14
|
"peerDependencies": {
|
|
15
15
|
"@aws-sdk/credential-providers": "~3.782.0",
|
|
16
16
|
"@nestjs/common": "~10.4.6"
|
|
17
|
-
}
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"**/*.js",
|
|
20
|
+
"**/*.d.ts",
|
|
21
|
+
"**/*.js.map",
|
|
22
|
+
"README.md"
|
|
23
|
+
]
|
|
18
24
|
}
|
package/jest.config.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
export default {
|
|
3
|
-
displayName: 'lib-server-aws-credential-providers',
|
|
4
|
-
preset: '../../../jest.preset.js',
|
|
5
|
-
testEnvironment: 'node',
|
|
6
|
-
transform: {
|
|
7
|
-
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
|
|
8
|
-
},
|
|
9
|
-
moduleFileExtensions: ['ts', 'js', 'html'],
|
|
10
|
-
coverageDirectory: '../../../coverage/libs/server/aws-credential-providers',
|
|
11
|
-
};
|
package/project.json
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "lib-server-aws-credential-providers",
|
|
3
|
-
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
-
"sourceRoot": "libs/server/aws-credential-providers/src",
|
|
5
|
-
"projectType": "library",
|
|
6
|
-
"targets": {
|
|
7
|
-
"build": {
|
|
8
|
-
"executor": "@nx/js:tsc",
|
|
9
|
-
"outputs": ["{options.outputPath}"],
|
|
10
|
-
"options": {
|
|
11
|
-
"outputPath": "dist/libs/server/aws-credential-providers",
|
|
12
|
-
"main": "libs/server/aws-credential-providers/src/index.ts",
|
|
13
|
-
"tsConfig": "libs/server/aws-credential-providers/tsconfig.lib.json",
|
|
14
|
-
"assets": [
|
|
15
|
-
"libs/server/aws-credential-providers/README.md",
|
|
16
|
-
"libs/server/aws-credential-providers/package.json"
|
|
17
|
-
],
|
|
18
|
-
"declaration": true,
|
|
19
|
-
"updateBuildableProjectPackageJsonDependencies": true,
|
|
20
|
-
"rootDir": "libs/server/aws-credential-providers/src"
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
"publish": {
|
|
24
|
-
"executor": "@nx/js:npm",
|
|
25
|
-
"outputs": [],
|
|
26
|
-
"dependsOn": ["build"],
|
|
27
|
-
"options": {
|
|
28
|
-
"packageRoot": "dist/libs/server/aws-credential-providers"
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
"tags": []
|
|
33
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { fromIni } from "@aws-sdk/credential-providers";
|
|
2
|
-
import { AwsCredentials } from "./aws-credentials.class";
|
|
3
|
-
|
|
4
|
-
const AWS_ACCESS_KEY_ID = 'AWS_ACCESS_KEY_ID';
|
|
5
|
-
const AWS_SECRET_ACCESS_KEY = 'AWS_SECRET_ACCESS_KEY';
|
|
6
|
-
|
|
7
|
-
export async function resolveAwsCredentialProvidersByProfile(profile?: string | undefined): Promise<AwsCredentials | undefined> {
|
|
8
|
-
if (profile) {
|
|
9
|
-
try {
|
|
10
|
-
console.warn(`attempting to use AWS profile "${profile}" for AWS authentication`);
|
|
11
|
-
|
|
12
|
-
const credentialResolver = fromIni({ profile });
|
|
13
|
-
|
|
14
|
-
return await credentialResolver();
|
|
15
|
-
} catch (error) {
|
|
16
|
-
console.warn(`failed to load AWS profile "${profile}"... ensure that ${[AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY].map(_ => `"${_.toLowerCase()}"`).join(' and ')} are lowercase in your ~/.aws/credentials file`);
|
|
17
|
-
|
|
18
|
-
if (
|
|
19
|
-
(process.env[AWS_ACCESS_KEY_ID] && process.env[AWS_SECRET_ACCESS_KEY])
|
|
20
|
-
) {
|
|
21
|
-
console.log(`using UPPERCASE AWS_* environment variables for AWS authentication`);
|
|
22
|
-
|
|
23
|
-
return {
|
|
24
|
-
accessKeyId: process.env[AWS_ACCESS_KEY_ID],
|
|
25
|
-
secretAccessKey: process.env[AWS_SECRET_ACCESS_KEY],
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (
|
|
30
|
-
(process.env[AWS_ACCESS_KEY_ID.toLowerCase()] && process.env[AWS_SECRET_ACCESS_KEY.toLowerCase()])
|
|
31
|
-
) {
|
|
32
|
-
console.log(`using lowercase aws_* environment variables for AWS authentication`);
|
|
33
|
-
|
|
34
|
-
return {
|
|
35
|
-
accessKeyId: process.env[AWS_ACCESS_KEY_ID.toLowerCase()]!,
|
|
36
|
-
secretAccessKey: process.env[AWS_SECRET_ACCESS_KEY.toLowerCase()]!,
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return undefined;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Module } from '@nestjs/common';
|
|
2
|
-
import { ServerAwsCredentialProvidersConfig } from './server-aws-credential-providers-config.class';
|
|
3
|
-
import { resolveAwsCredentialProvidersByProfile } from './resolve-aws-credential-providers-by-profile.function';
|
|
4
|
-
import { AwsCredentials } from './aws-credentials.class';
|
|
5
|
-
|
|
6
|
-
@Module({})
|
|
7
|
-
export class ServerAwsCredentialProvidersModule {
|
|
8
|
-
static configure(config: ServerAwsCredentialProvidersConfig) {
|
|
9
|
-
return {
|
|
10
|
-
module: ServerAwsCredentialProvidersModule,
|
|
11
|
-
providers: [
|
|
12
|
-
{ provide: ServerAwsCredentialProvidersConfig, useValue: config },
|
|
13
|
-
{
|
|
14
|
-
provide: AwsCredentials,
|
|
15
|
-
useFactory: async () => await resolveAwsCredentialProvidersByProfile(config.AWS_PROFILE),
|
|
16
|
-
},
|
|
17
|
-
],
|
|
18
|
-
exports: [AwsCredentials, ServerAwsCredentialProvidersConfig],
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../tsconfig.server.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "../../../dist/out-tsc"
|
|
5
|
-
},
|
|
6
|
-
"files": [],
|
|
7
|
-
"include": [],
|
|
8
|
-
"references": [
|
|
9
|
-
{
|
|
10
|
-
"path": "./tsconfig.lib.json"
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"path": "./tsconfig.spec.json"
|
|
14
|
-
}
|
|
15
|
-
]
|
|
16
|
-
}
|
package/tsconfig.lib.json
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"rootDir": "./src",
|
|
5
|
-
"outDir": "../../dist/libs/server/aws-credential-providers",
|
|
6
|
-
"declaration": true
|
|
7
|
-
},
|
|
8
|
-
"exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"],
|
|
9
|
-
"include": ["src/**/*.ts"]
|
|
10
|
-
}
|
package/tsconfig.spec.json
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"types": [
|
|
5
|
-
"jest",
|
|
6
|
-
"node"
|
|
7
|
-
]
|
|
8
|
-
},
|
|
9
|
-
"include": [
|
|
10
|
-
"jest.config.ts",
|
|
11
|
-
"**/*.test.ts",
|
|
12
|
-
"**/*.spec.ts",
|
|
13
|
-
"**/*.test.tsx",
|
|
14
|
-
"**/*.spec.tsx",
|
|
15
|
-
"**/*.test.js",
|
|
16
|
-
"**/*.spec.js",
|
|
17
|
-
"**/*.test.jsx",
|
|
18
|
-
"**/*.spec.jsx",
|
|
19
|
-
"**/*.d.ts"
|
|
20
|
-
]
|
|
21
|
-
}
|