@skillswaveca/nova-shared-libraries 4.29.2 → 5.1.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/.github/workflows/pull-request.yml +1 -1
- package/.github/workflows/release.yml +12 -7
- package/README.md +88 -1
- package/docs-base/package-info.js +5 -5
- package/eslint.config.js +59 -0
- package/package.json +63 -46
- package/packages/drivers/package.json +15 -15
- package/packages/nova-middleware/package.json +2 -2
- package/packages/nova-model/package.json +1 -1
- package/packages/nova-router/package.json +1 -1
- package/packages/nova-utils/package.json +2 -2
- package/packages/nova-utils/src/config.js +27 -5
- package/.eslintignore +0 -1
- package/packages/drivers/README.md +0 -5
- package/packages/nova-middleware/README.md +0 -5
- package/packages/nova-model/README.md +0 -5
- package/packages/nova-router/README.md +0 -5
- package/packages/nova-utils/README.md +0 -5
- package/scripts/create-library-template/README.md +0 -5
|
@@ -8,6 +8,9 @@ on:
|
|
|
8
8
|
jobs:
|
|
9
9
|
release:
|
|
10
10
|
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
contents: write
|
|
13
|
+
id-token: write
|
|
11
14
|
|
|
12
15
|
steps:
|
|
13
16
|
- uses: pnpm/action-setup@v4
|
|
@@ -21,11 +24,14 @@ jobs:
|
|
|
21
24
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
22
25
|
|
|
23
26
|
- name: Set up Node.js
|
|
24
|
-
uses: actions/setup-node@
|
|
27
|
+
uses: actions/setup-node@v5
|
|
25
28
|
with:
|
|
26
|
-
node-version:
|
|
27
|
-
cache:
|
|
28
|
-
registry-url:
|
|
29
|
+
node-version: 22
|
|
30
|
+
cache: "pnpm"
|
|
31
|
+
registry-url: "https://registry.npmjs.org/"
|
|
32
|
+
|
|
33
|
+
- name: Update npm for OIDC support
|
|
34
|
+
run: npm install -g npm@latest
|
|
29
35
|
|
|
30
36
|
- name: Install dependencies
|
|
31
37
|
run: pnpm install --frozen-lockfile
|
|
@@ -48,6 +54,7 @@ jobs:
|
|
|
48
54
|
git add .
|
|
49
55
|
if ! git diff-index --quiet HEAD --; then
|
|
50
56
|
git commit -m "chore: update changelog, docs, and index"
|
|
57
|
+
git pull --rebase origin main
|
|
51
58
|
git push --follow-tags origin main
|
|
52
59
|
else
|
|
53
60
|
echo "No changes to commit"
|
|
@@ -88,6 +95,4 @@ jobs:
|
|
|
88
95
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
89
96
|
|
|
90
97
|
- name: Publish to npm
|
|
91
|
-
|
|
92
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
93
|
-
run: pnpm -r publish --access public
|
|
98
|
+
run: npm publish --access public
|
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ This repository contains a collection of shared libraries used across the Nova e
|
|
|
8
8
|
## Usage
|
|
9
9
|
This package is published to npm. You can include it in your project by adding
|
|
10
10
|
```json
|
|
11
|
-
"@skillswaveca/nova-shared-libraries": "^
|
|
11
|
+
"@skillswaveca/nova-shared-libraries": "^5.0.0",
|
|
12
12
|
```
|
|
13
13
|
to your projects `package.json` or by running `npm install @skillswaveca/nova-shared-libraries`
|
|
14
14
|
|
|
@@ -34,6 +34,14 @@ While it is not necessary to generate docs yourself as the CI will do it for you
|
|
|
34
34
|
pnpm run aggregate-docs
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
+
To view the generated documentation locally, run:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pnpm run docs
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
This will build the docs and start a local server (using sirv) at `http://localhost:8080` (or next available port).
|
|
44
|
+
|
|
37
45
|
## Testing
|
|
38
46
|
You can run all tests by running
|
|
39
47
|
```bash
|
|
@@ -56,10 +64,13 @@ The basic steps are:
|
|
|
56
64
|
|
|
57
65
|
## Adding a library to the repository
|
|
58
66
|
This repository contains a helper script for creating new libraries. You can run the following command to create a new library:
|
|
67
|
+
|
|
59
68
|
```bash
|
|
60
69
|
pnpm run create-library
|
|
61
70
|
```
|
|
71
|
+
|
|
62
72
|
After running the create-library script, you will be prompted to enter the name of the library you want to create and the description. The script will then create a new directory with the name you provided and will initialize a new package inside it.
|
|
73
|
+
|
|
63
74
|
```bash
|
|
64
75
|
> nova-shared-libraries@1.0.0 create-library
|
|
65
76
|
> node ./scripts/create-library.js
|
|
@@ -67,3 +78,79 @@ After running the create-library script, you will be prompted to enter the name
|
|
|
67
78
|
Enter the package name: nova-model
|
|
68
79
|
Enter the package description: A library for defining models in the nova ecosystem
|
|
69
80
|
```
|
|
81
|
+
|
|
82
|
+
## Release Process
|
|
83
|
+
|
|
84
|
+
This repository uses [semantic-release](https://github.com/semantic-release/semantic-release) to automate versioning and releases. When you merge to `main`, the release workflow automatically:
|
|
85
|
+
|
|
86
|
+
- Analyzes commit messages to determine the version bump
|
|
87
|
+
- Generates CHANGELOG.md
|
|
88
|
+
- Creates a GitHub release
|
|
89
|
+
- Publishes to npm
|
|
90
|
+
|
|
91
|
+
### Commit Message Format
|
|
92
|
+
|
|
93
|
+
Use [Conventional Commits](https://www.conventionalcommits.org/) format to trigger the correct version bump:
|
|
94
|
+
|
|
95
|
+
#### Patch Release (x.x.X) - Bug Fixes
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
git commit -m "fix: correct logging output format"
|
|
99
|
+
git commit -m "fix(drivers): handle null response from API"
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
#### Minor Release (x.X.0) - New Features
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
git commit -m "feat: add new authentication method"
|
|
106
|
+
git commit -m "feat(router): support custom middleware validation"
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
#### Major Release (X.0.0) - Breaking Changes
|
|
110
|
+
|
|
111
|
+
Use `BREAKING CHANGE:` in the commit body or footer:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
git commit -m "feat!: update to ESLint 9
|
|
115
|
+
|
|
116
|
+
BREAKING CHANGE: Migrated to ESLint 9 flat config format.
|
|
117
|
+
Projects using this library will need to update their ESLint configuration."
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Or use the `!` suffix on the type:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
git commit -m "feat!: remove deprecated API methods"
|
|
124
|
+
git commit -m "refactor!: change logger interface"
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
#### Other Commit Types (No Release)
|
|
128
|
+
|
|
129
|
+
These don't trigger a release:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
git commit -m "chore: update dependencies"
|
|
133
|
+
git commit -m "docs: fix typo in README"
|
|
134
|
+
git commit -m "style: format code"
|
|
135
|
+
git commit -m "test: add unit tests for driver"
|
|
136
|
+
git commit -m "refactor: simplify config logic"
|
|
137
|
+
git commit -m "ci: update GitHub Actions workflow"
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Skipping CI/Release
|
|
141
|
+
|
|
142
|
+
To skip the release workflow entirely:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
git commit -m "chore: update dev dependencies [skip ci]"
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Manual Release
|
|
149
|
+
|
|
150
|
+
If you need to create a release manually:
|
|
151
|
+
|
|
152
|
+
1. Update version in all `package.json` files
|
|
153
|
+
2. Update CHANGELOG.md
|
|
154
|
+
3. Commit with `[skip ci]`
|
|
155
|
+
4. Create [GitHub release](https://github.com/SkillsWave/nova-shared-libraries/releases/new)
|
|
156
|
+
5. Publish to npm: `pnpm -r publish --access public`
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
export const packageInfo = [
|
|
2
2
|
{
|
|
3
3
|
"name": "@skillswaveca/nova-utils",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "5.1.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
9
|
"name": "@skillswaveca/nova-router",
|
|
10
|
-
"version": "
|
|
10
|
+
"version": "5.1.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": "5.1.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": "5.1.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": "5.1.0",
|
|
29
29
|
"description": "Some helper drivers for AWS services",
|
|
30
30
|
"docsPath": "./drivers/index.html"
|
|
31
31
|
}
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { nodeConfig } from 'eslint-config-brightspace';
|
|
2
|
+
import importPlugin from 'eslint-plugin-import';
|
|
3
|
+
import globals from 'globals';
|
|
4
|
+
|
|
5
|
+
export default [
|
|
6
|
+
// Ignore patterns (replaces .eslintignore)
|
|
7
|
+
{
|
|
8
|
+
ignores: ['docs/**', 'node_modules/**', 'coverage/**'],
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
// Extend brightspace node config
|
|
12
|
+
...nodeConfig,
|
|
13
|
+
|
|
14
|
+
// Custom rules and overrides
|
|
15
|
+
{
|
|
16
|
+
files: ['**/*.js'],
|
|
17
|
+
plugins: {
|
|
18
|
+
import: importPlugin,
|
|
19
|
+
},
|
|
20
|
+
languageOptions: {
|
|
21
|
+
ecmaVersion: 2020,
|
|
22
|
+
sourceType: 'module',
|
|
23
|
+
globals: {
|
|
24
|
+
...globals.node,
|
|
25
|
+
...globals.es2020,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
rules: {
|
|
29
|
+
'no-await-in-loop': 'error',
|
|
30
|
+
// Override brightspace's tab-based indentation with spaces
|
|
31
|
+
'indent': ['error', 2, { SwitchCase: 1 }],
|
|
32
|
+
'@stylistic/indent': ['error', 2, { SwitchCase: 1 }],
|
|
33
|
+
'comma-dangle': [
|
|
34
|
+
'error',
|
|
35
|
+
{
|
|
36
|
+
arrays: 'always-multiline',
|
|
37
|
+
exports: 'never',
|
|
38
|
+
functions: 'never',
|
|
39
|
+
imports: 'never',
|
|
40
|
+
objects: 'always-multiline',
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
'import/extensions': ['error', 'ignorePackages'],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
// Test files specific overrides
|
|
48
|
+
{
|
|
49
|
+
files: ['**/*.test.js'],
|
|
50
|
+
languageOptions: {
|
|
51
|
+
globals: {
|
|
52
|
+
...globals.mocha,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
rules: {
|
|
56
|
+
'import/no-extraneous-dependencies': 'off',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
];
|
package/package.json
CHANGED
|
@@ -3,67 +3,84 @@
|
|
|
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": "
|
|
6
|
+
"version": "5.1.0",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"license": "MIT",
|
|
9
|
+
"workspaces": [
|
|
10
|
+
"packages/*"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"release": "pnpm run bump-version && pnpm run create-index",
|
|
14
|
+
"docs": "pnpm run aggregate-docs && npx sirv docs/drivers --dev --single",
|
|
15
|
+
"bump-version": "node scripts/bump-version.js",
|
|
16
|
+
"create-index": "node scripts/create-index.js",
|
|
17
|
+
"create-library": "node ./scripts/create-library.js",
|
|
18
|
+
"generate-docs": "echo \"Building docs\"",
|
|
19
|
+
"aggregate-docs": "pnpm recursive run generate-docs && node ./scripts/aggregate-docs.js && rollup -c",
|
|
20
|
+
"test": "echo \"Tests\""
|
|
21
|
+
},
|
|
9
22
|
"keywords": [],
|
|
10
23
|
"author": "SkillsWave",
|
|
11
24
|
"dependencies": {
|
|
12
|
-
"@aws-sdk/client-
|
|
13
|
-
"@aws-sdk/client-
|
|
14
|
-
"@aws-sdk/client-secrets-manager": "^3.
|
|
15
|
-
"@aws-sdk/client-sqs": "^3.
|
|
16
|
-
"@aws-sdk/client-ssm": "^3.
|
|
17
|
-
"@aws-sdk/lib-dynamodb": "^3.
|
|
18
|
-
"@hubspot/api-client": "^13.
|
|
19
|
-
"@koa/router": "^
|
|
20
|
-
"aws-xray-sdk-core": "^3.
|
|
25
|
+
"@aws-sdk/client-dynamodb": "^3.930.0",
|
|
26
|
+
"@aws-sdk/client-lambda": "^3.930.0",
|
|
27
|
+
"@aws-sdk/client-secrets-manager": "^3.930.0",
|
|
28
|
+
"@aws-sdk/client-sqs": "^3.930.0",
|
|
29
|
+
"@aws-sdk/client-ssm": "^3.930.0",
|
|
30
|
+
"@aws-sdk/lib-dynamodb": "^3.930.0",
|
|
31
|
+
"@hubspot/api-client": "^13.4.0",
|
|
32
|
+
"@koa/router": "^14.0.0",
|
|
33
|
+
"aws-xray-sdk-core": "^3.11.0",
|
|
21
34
|
"jsonwebtoken": "^9.0.2",
|
|
22
|
-
"jwk-to-pem": "^2.0.
|
|
23
|
-
"lit": "^3.1
|
|
35
|
+
"jwk-to-pem": "^2.0.7",
|
|
36
|
+
"lit": "^3.3.1",
|
|
24
37
|
"lodash.chunk": "^4.2.0",
|
|
25
38
|
"node-fetch": "^3.3.2",
|
|
26
|
-
"pino": "^
|
|
27
|
-
"simple-oauth2": "^5.
|
|
28
|
-
"uuid": "^
|
|
29
|
-
"yn": "^5.
|
|
30
|
-
"yup": "^1.
|
|
39
|
+
"pino": "^10.1.0",
|
|
40
|
+
"simple-oauth2": "^5.1.0",
|
|
41
|
+
"uuid": "^13.0.0",
|
|
42
|
+
"yn": "^5.1.0",
|
|
43
|
+
"yup": "^1.7.1"
|
|
31
44
|
},
|
|
32
45
|
"devDependencies": {
|
|
33
46
|
"@alpha-lambda/eslint-config": "^2.0.0",
|
|
34
|
-
"@babel/eslint-parser": "^7.
|
|
35
|
-
"@brightspace-ui/core": "^
|
|
47
|
+
"@babel/eslint-parser": "^7.28.5",
|
|
48
|
+
"@brightspace-ui/core": "^3.176.6",
|
|
36
49
|
"@open-wc/rollup-plugin-html": "^1.2.5",
|
|
37
|
-
"@rollup/plugin-node-resolve": "^
|
|
50
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
38
51
|
"@semantic-release/changelog": "^6.0.3",
|
|
39
|
-
"@semantic-release/commit-analyzer": "^
|
|
52
|
+
"@semantic-release/commit-analyzer": "^13.0.1",
|
|
40
53
|
"@semantic-release/git": "^10.0.1",
|
|
41
|
-
"@semantic-release/npm": "^
|
|
42
|
-
"@semantic-release/release-notes-generator": "^
|
|
43
|
-
"@typescript-eslint/parser": "^
|
|
44
|
-
"chai": "^
|
|
54
|
+
"@semantic-release/npm": "^13.1.1",
|
|
55
|
+
"@semantic-release/release-notes-generator": "^14.1.0",
|
|
56
|
+
"@typescript-eslint/parser": "^8.46.4",
|
|
57
|
+
"chai": "^5.2.0",
|
|
45
58
|
"documentation": "^14.0.3",
|
|
46
|
-
"eslint": "^
|
|
47
|
-
"eslint-config-brightspace": "^
|
|
48
|
-
"eslint-plugin-jsdoc": "^
|
|
49
|
-
"eslint-plugin-mocha": "^
|
|
50
|
-
"glob": "^
|
|
51
|
-
"
|
|
52
|
-
"mocha": "^
|
|
53
|
-
"rollup": "^4.
|
|
54
|
-
"semantic-release": "^
|
|
55
|
-
"sinon": "^
|
|
56
|
-
"sinon-chai": "^
|
|
57
|
-
"
|
|
59
|
+
"eslint": "^9.39.1",
|
|
60
|
+
"eslint-config-brightspace": "^2.11.0",
|
|
61
|
+
"eslint-plugin-jsdoc": "^61.2.0",
|
|
62
|
+
"eslint-plugin-mocha": "^11.2.0",
|
|
63
|
+
"glob": "^11.0.3",
|
|
64
|
+
"globals": "^16.5.0",
|
|
65
|
+
"mocha": "^11.7.5",
|
|
66
|
+
"rollup": "^4.53.2",
|
|
67
|
+
"semantic-release": "^25.0.2",
|
|
68
|
+
"sinon": "^21.0.0",
|
|
69
|
+
"sinon-chai": "^4.0.1",
|
|
70
|
+
"sirv-cli": "^3.0.1",
|
|
71
|
+
"stylelint": "^16.25.0"
|
|
58
72
|
},
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
73
|
+
"pnpm": {
|
|
74
|
+
"overrides": {
|
|
75
|
+
"braces@<3.0.3": ">=3.0.3",
|
|
76
|
+
"cross-spawn@<7.0.5": ">=7.0.5",
|
|
77
|
+
"micromatch@<4.0.8": ">=4.0.8",
|
|
78
|
+
"brace-expansion@<1.1.11": "^1.1.11",
|
|
79
|
+
"brace-expansion@>=2.0.0 <2.0.2": "^2.0.2",
|
|
80
|
+
"vue-template-compiler@<2.7.16": ">=2.7.16",
|
|
81
|
+
"prismjs@<1.30.0": ">=1.30.0",
|
|
82
|
+
"nanoid@<3.3.8": ">=3.3.8",
|
|
83
|
+
"@babel/helpers@<7.26.10": ">=7.26.10"
|
|
84
|
+
}
|
|
68
85
|
}
|
|
69
86
|
}
|
|
@@ -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": "
|
|
6
|
+
"version": "5.1.0",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"pre-release": "pnpm run create-index",
|
|
@@ -14,23 +14,23 @@
|
|
|
14
14
|
"author": "SkillsWave",
|
|
15
15
|
"license": "UNLICENSED",
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"chai": "^
|
|
18
|
-
"eslint": "^9.
|
|
19
|
-
"mocha": "^
|
|
17
|
+
"chai": "^4.4.1",
|
|
18
|
+
"eslint": "^9.39.1",
|
|
19
|
+
"mocha": "^11.7.5",
|
|
20
20
|
"sinon": "^21.0.0",
|
|
21
|
-
"sinon-chai": "^4.0.
|
|
21
|
+
"sinon-chai": "^4.0.1"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@aws-sdk/client-lambda": "3.
|
|
25
|
-
"@aws-sdk/client-dynamodb": "^3.
|
|
26
|
-
"@aws-sdk/client-secrets-manager": "^3.
|
|
27
|
-
"@aws-sdk/client-sqs": "^3.
|
|
28
|
-
"@aws-sdk/lib-dynamodb": "^3.
|
|
29
|
-
"@hubspot/api-client": "^13.
|
|
30
|
-
"aws-xray-sdk-core": "^3.
|
|
24
|
+
"@aws-sdk/client-lambda": "^3.930.0",
|
|
25
|
+
"@aws-sdk/client-dynamodb": "^3.930.0",
|
|
26
|
+
"@aws-sdk/client-secrets-manager": "^3.930.0",
|
|
27
|
+
"@aws-sdk/client-sqs": "^3.930.0",
|
|
28
|
+
"@aws-sdk/lib-dynamodb": "^3.930.0",
|
|
29
|
+
"@hubspot/api-client": "^13.4.0",
|
|
30
|
+
"aws-xray-sdk-core": "^3.11.0",
|
|
31
31
|
"lodash.chunk": "^4.2.0",
|
|
32
|
-
"node-fetch": "^3.
|
|
33
|
-
"pino": "^
|
|
34
|
-
"simple-oauth2": "^5.
|
|
32
|
+
"node-fetch": "^3.3.2",
|
|
33
|
+
"pino": "^10.1.0",
|
|
34
|
+
"simple-oauth2": "^5.1.0"
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -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": "
|
|
6
|
+
"version": "5.1.0",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"pre-release": "pnpm run create-index",
|
|
@@ -16,6 +16,6 @@
|
|
|
16
16
|
"devDependencies": {},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"jsonwebtoken": "^9.0.2",
|
|
19
|
-
"jwk-to-pem": "^2.0.
|
|
19
|
+
"jwk-to-pem": "^2.0.7"
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -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": "
|
|
6
|
+
"version": "5.1.0",
|
|
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-router",
|
|
4
4
|
"description": "An extended Koa router that enables better validation",
|
|
5
5
|
"repository": "https://github.com/SkillsWave/nova-shared-libraries",
|
|
6
|
-
"version": "
|
|
6
|
+
"version": "5.1.0",
|
|
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": "
|
|
6
|
+
"version": "5.1.0",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"pre-release": "pnpm run create-index",
|
|
@@ -15,6 +15,6 @@
|
|
|
15
15
|
"license": "UNLICENSED",
|
|
16
16
|
"devDependencies": {},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"yup": "^1.
|
|
18
|
+
"yup": "^1.7.1"
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -28,7 +28,7 @@ export const deepMerge = (obj1, obj2) => {
|
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* Flattens a nested object into a single-level object with underscore-separated keys.
|
|
31
|
-
*
|
|
31
|
+
* Arrays are flattened using numeric indices (e.g., items_0, items_1).
|
|
32
32
|
*
|
|
33
33
|
* @param {Object} data - The nested object to flatten.
|
|
34
34
|
* @param {string} prefix - The prefix to prepend to each key in the flattened object.
|
|
@@ -37,7 +37,17 @@ export const deepMerge = (obj1, obj2) => {
|
|
|
37
37
|
export const flattenConfig = (data, prefix = '') => {
|
|
38
38
|
return Object.keys(data).reduce((acc, key) => {
|
|
39
39
|
const fullPath = prefix.length ? `${prefix}_${key}` : key;
|
|
40
|
-
if (
|
|
40
|
+
if (Array.isArray(data[key])) {
|
|
41
|
+
// Flatten array elements with numeric indices
|
|
42
|
+
data[key].forEach((item, index) => {
|
|
43
|
+
const arrayPath = `${fullPath}_${index}`;
|
|
44
|
+
if (typeof item === 'object' && item !== null) {
|
|
45
|
+
Object.assign(acc, flattenConfig(item, arrayPath));
|
|
46
|
+
} else {
|
|
47
|
+
acc[arrayPath] = `${item}`;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
} else if (typeof data[key] === 'object' && data[key] !== null) {
|
|
41
51
|
Object.assign(acc, flattenConfig(data[key], fullPath));
|
|
42
52
|
} else {
|
|
43
53
|
acc[fullPath] = `${data[key]}`;
|
|
@@ -66,9 +76,16 @@ const convertToType = value => {
|
|
|
66
76
|
return value;
|
|
67
77
|
};
|
|
68
78
|
|
|
79
|
+
/**
|
|
80
|
+
* Checks if a string represents a numeric array index.
|
|
81
|
+
* @param {string} str - The string to check.
|
|
82
|
+
* @returns {boolean} - True if the string is a valid numeric index.
|
|
83
|
+
*/
|
|
84
|
+
const isNumericIndex = str => /^\d+$/.test(str);
|
|
85
|
+
|
|
69
86
|
/**
|
|
70
87
|
* Unflattens a configuration object whose keys are paths (using underscores as separators),
|
|
71
|
-
* ignoring specific top-level attributes.
|
|
88
|
+
* ignoring specific top-level attributes. Properly reconstructs arrays when numeric indices are detected.
|
|
72
89
|
* @param {Object} flatConfig - The flat configuration object, defaulting to process.env.
|
|
73
90
|
* @param {Array} ignoreList - List of top-level attribute keys to ignore.
|
|
74
91
|
* @returns {Object} - The reconstructed nested configuration object.
|
|
@@ -91,8 +108,13 @@ export const unflattenConfig = (flatConfig = process.env, ignoreList = ['LAMBDA'
|
|
|
91
108
|
// If it's the last part, set the value
|
|
92
109
|
current[part] = convertToType(value);
|
|
93
110
|
} else {
|
|
94
|
-
//
|
|
95
|
-
|
|
111
|
+
// Look ahead to see if the next part is a numeric index
|
|
112
|
+
const nextPart = parts[i + 1];
|
|
113
|
+
const shouldBeArray = isNumericIndex(nextPart);
|
|
114
|
+
// Initialize as array or object based on the next part
|
|
115
|
+
if (current[part] === undefined) {
|
|
116
|
+
current[part] = shouldBeArray ? [] : {};
|
|
117
|
+
}
|
|
96
118
|
current = current[part];
|
|
97
119
|
}
|
|
98
120
|
});
|
package/.eslintignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
docs/
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
# Nova Drivers
|
|
2
|
-
|
|
3
|
-
## Description
|
|
4
|
-
Nova Drivers is a collection of helper drivers developed to make integration with third party systems simpler. This project is part of the larger Nova Shared Libraries monorepo. The drivers provided in this project aim to simplify and streamline the interaction with various third party services.
|
|
5
|
-
|