@skillswaveca/nova-shared-libraries 4.15.1 → 4.16.1
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/docs-base/package-info.js +6 -6
- package/package.json +1 -1
- package/packages/drivers/package.json +1 -1
- package/packages/drivers/src/aws/secrets-manager.js +7 -2
- package/packages/drivers/src/oauth.js +6 -1
- package/packages/nova-middleware/package.json +1 -1
- package/packages/nova-model/package.json +1 -1
- package/packages/nova-router/package.json +2 -2
- package/packages/nova-utils/package.json +1 -1
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
export const packageInfo = [
|
|
2
2
|
{
|
|
3
3
|
"name": "@skillswaveca/nova-utils",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "4.16.0",
|
|
5
5
|
"description": "A collection of random utils used in nova repos",
|
|
6
6
|
"docsPath": "./nova-utils/index.html"
|
|
7
7
|
},
|
|
8
8
|
{
|
|
9
|
-
"name": "nova-router",
|
|
10
|
-
"version": "
|
|
9
|
+
"name": "@skillswaveca/nova-router",
|
|
10
|
+
"version": "4.16.0",
|
|
11
11
|
"description": "An extended Koa router that enables better validation",
|
|
12
12
|
"docsPath": "./nova-router/index.html"
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
"name": "@skillswaveca/nova-model",
|
|
16
|
-
"version": "
|
|
16
|
+
"version": "4.16.0",
|
|
17
17
|
"description": "Nova model stuff",
|
|
18
18
|
"docsPath": "./nova-model/index.html"
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
"name": "@skillswaveca/nova-middleware",
|
|
22
|
-
"version": "
|
|
22
|
+
"version": "4.16.0",
|
|
23
23
|
"description": "A collection of middleware used by nova projects",
|
|
24
24
|
"docsPath": "./nova-middleware/index.html"
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
"name": "@skillswaveca/nova-drivers",
|
|
28
|
-
"version": "
|
|
28
|
+
"version": "4.16.0",
|
|
29
29
|
"description": "Some helper drivers for AWS services",
|
|
30
30
|
"docsPath": "./drivers/index.html"
|
|
31
31
|
}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "@skillswaveca/nova-shared-libraries",
|
|
4
4
|
"description": "A monorepo of shared libraries for Nova projects.",
|
|
5
5
|
"repository": "https://github.com/SkillsWave/nova-shared-libraries",
|
|
6
|
-
"version": "4.
|
|
6
|
+
"version": "4.16.1",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"keywords": [],
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "@skillswaveca/nova-drivers",
|
|
4
4
|
"description": "Some helper drivers for AWS services",
|
|
5
5
|
"repository": "https://github.com/SkillsWave/nova-shared-libraries",
|
|
6
|
-
"version": "4.
|
|
6
|
+
"version": "4.16.1",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"pre-release": "pnpm run create-index",
|
|
@@ -23,17 +23,22 @@ export class SecretsManager extends AwsBaseDriver {
|
|
|
23
23
|
*
|
|
24
24
|
* @param {*} secretName - The name of the secret stored in AWS Secret Manager.
|
|
25
25
|
* @param {string} [keyId] - An optional key to retrieve a specific value from an AWS secret object.
|
|
26
|
+
* @param {string} [region] - An optional region to fetch the secret from.
|
|
27
|
+
* @param {string} [rootEnvironmentAwsAccountId] - An optional AWS account ID to fetch the secret from.
|
|
26
28
|
* @returns - The secret value. If the secret was created via the web interface, this string
|
|
27
29
|
* is a JSON. Otherwise (e.g. via the API), this string is the secret itself.
|
|
28
30
|
*/
|
|
29
|
-
async getSecret(secretName, keyId) {
|
|
31
|
+
async getSecret(secretName, keyId, region, rootEnvironmentAwsAccountId) {
|
|
30
32
|
if (!secretName) {
|
|
31
33
|
this.log.error('Missing secret name to fetch secret');
|
|
32
34
|
return;
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
try {
|
|
36
|
-
const
|
|
38
|
+
const secretId = region && rootEnvironmentAwsAccountId ?
|
|
39
|
+
`arn:aws:secretsmanager:${region}:${rootEnvironmentAwsAccountId}:secret:${secretName}` :
|
|
40
|
+
secretName;
|
|
41
|
+
const data = await this.client.send(new GetSecretValueCommand({ SecretId: secretId }));
|
|
37
42
|
const DEFAULT_SECRET_KEY = 'secretValue';
|
|
38
43
|
const ALL_KEYS = 'allKeys';
|
|
39
44
|
const secretData = JSON.parse(data.SecretString);
|
|
@@ -35,6 +35,8 @@ export class OAuthDriver extends HttpDriver {
|
|
|
35
35
|
* @param {Object} configuration.oauth.auth - The authentication details.
|
|
36
36
|
* @param {string} configuration.oauth.auth.tokenHost - The host for the token.
|
|
37
37
|
* @param {string} configuration.oauth.auth.tokenPath - The path for the token.
|
|
38
|
+
* @param {string} configuration.region - The region for the secrets.
|
|
39
|
+
* @param {string} configuration.rootEnvironmentAwsAccountId - The account ID for the secrets.
|
|
38
40
|
*/
|
|
39
41
|
constructor(apiIdentifier, configuration = {}) {
|
|
40
42
|
const { baseUrl, oauth, tokenConfig } = configuration;
|
|
@@ -52,6 +54,9 @@ export class OAuthDriver extends HttpDriver {
|
|
|
52
54
|
this.tokenConfig = tokenConfig;
|
|
53
55
|
this.secretKey = oauth.client.secret;
|
|
54
56
|
this.secretKeyId = oauth.client.secretKeyId;
|
|
57
|
+
|
|
58
|
+
this.region = configuration.region;
|
|
59
|
+
this.rootEnvironmentAwsAccountId = configuration.rootEnvironmentAwsAccountId
|
|
55
60
|
}
|
|
56
61
|
|
|
57
62
|
/**
|
|
@@ -142,7 +147,7 @@ export class OAuthDriver extends HttpDriver {
|
|
|
142
147
|
if (this.clientCredentialsInstance) {
|
|
143
148
|
return this.clientCredentialsInstance;
|
|
144
149
|
}
|
|
145
|
-
if (this.secretKey) this.clientConfig.client.secret = await secretsManager.getSecret(this.secretKey, this.secretKeyId);
|
|
150
|
+
if (this.secretKey) this.clientConfig.client.secret = await secretsManager.getSecret(this.secretKey, this.secretKeyId, this.region, this.rootEnvironmentAwsAccountId);
|
|
146
151
|
delete this.clientConfig.client.secretKeyId;
|
|
147
152
|
this.clientCredentialsInstance = new ClientCredentials(this.clientConfig);
|
|
148
153
|
return this.clientCredentialsInstance;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "@skillswaveca/nova-middleware",
|
|
4
4
|
"description": "A collection of middleware used by nova projects",
|
|
5
5
|
"repository": "https://github.com/SkillsWave/nova-shared-libraries",
|
|
6
|
-
"version": "4.
|
|
6
|
+
"version": "4.16.1",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"pre-release": "pnpm run create-index",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "@skillswaveca/nova-model",
|
|
4
4
|
"description": "Nova model stuff",
|
|
5
5
|
"repository": "https://github.com/SkillsWave/nova-shared-libraries",
|
|
6
|
-
"version": "4.
|
|
6
|
+
"version": "4.16.1",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"pre-release": "pnpm run create-index",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
|
-
"name": "nova-router",
|
|
3
|
+
"name": "@skillswaveca/nova-router",
|
|
4
4
|
"description": "An extended Koa router that enables better validation",
|
|
5
5
|
"repository": "https://github.com/SkillsWave/nova-shared-libraries",
|
|
6
|
-
"version": "4.
|
|
6
|
+
"version": "4.16.1",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"pre-release": "pnpm run create-index",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "@skillswaveca/nova-utils",
|
|
4
4
|
"description": "A collection of random utils used in nova repos",
|
|
5
5
|
"repository": "https://github.com/SkillsWave/nova-shared-libraries",
|
|
6
|
-
"version": "4.
|
|
6
|
+
"version": "4.16.1",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"pre-release": "pnpm run create-index",
|