@skillswaveca/nova-shared-libraries 3.6.0 → 3.7.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/labeler.yml +25 -0
- package/.github/workflows/labels.yml +33 -0
- package/README.md +2 -2
- package/docs-base/package-info.js +4 -4
- package/index.js +1 -0
- package/package.json +1 -1
- package/packages/drivers/package.json +1 -1
- package/packages/drivers/src/http.js +2 -2
- package/packages/nova-middleware/package.json +1 -1
- package/packages/nova-model/index.js +1 -0
- package/packages/nova-model/package.json +1 -1
- package/packages/nova-model/src/stream/nova-stream-task-router.js +39 -0
- package/packages/nova-utils/package.json +1 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
area/github-actions:
|
|
2
|
+
- changed-files:
|
|
3
|
+
- any-glob-to-any-file:
|
|
4
|
+
- '.github/workflows/**'
|
|
5
|
+
area/docs:
|
|
6
|
+
- changed-files:
|
|
7
|
+
- any-glob-to-any-file:
|
|
8
|
+
- 'docs/**'
|
|
9
|
+
area/docs-base:
|
|
10
|
+
- changed-files:
|
|
11
|
+
- any-glob-to-any-file:
|
|
12
|
+
- 'docs-base/**'
|
|
13
|
+
area/packages:
|
|
14
|
+
- changed-files:
|
|
15
|
+
- any-glob-to-any-file:
|
|
16
|
+
- 'packages/**'
|
|
17
|
+
area/scripts:
|
|
18
|
+
- changed-files:
|
|
19
|
+
- any-glob-to-any-file:
|
|
20
|
+
- 'scripts/**'
|
|
21
|
+
area/package-list:
|
|
22
|
+
- changed-files:
|
|
23
|
+
- any-glob-to-any-file:
|
|
24
|
+
- '**/package-lock.json'
|
|
25
|
+
- '**/package.json'
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: "Apply labels to PRs"
|
|
2
|
+
on:
|
|
3
|
+
- pull_request
|
|
4
|
+
permissions:
|
|
5
|
+
pull-requests: write
|
|
6
|
+
actions: write
|
|
7
|
+
checks: write
|
|
8
|
+
contents: write
|
|
9
|
+
deployments: write
|
|
10
|
+
discussions: write
|
|
11
|
+
issues: write
|
|
12
|
+
packages: write
|
|
13
|
+
pages: write
|
|
14
|
+
repository-projects: write
|
|
15
|
+
security-events: write
|
|
16
|
+
statuses: write
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
label:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
timeout-minutes: 2
|
|
22
|
+
steps:
|
|
23
|
+
- uses: Brightspace/third-party-actions@actions/labeler
|
|
24
|
+
with:
|
|
25
|
+
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
|
26
|
+
- uses: Brightspace/third-party-actions@codelytv/pr-size-labeler
|
|
27
|
+
with:
|
|
28
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
29
|
+
xs_max_size: '15'
|
|
30
|
+
s_max_size: '75'
|
|
31
|
+
m_max_size: '250'
|
|
32
|
+
l_max_size: '750'
|
|
33
|
+
fail_if_xl: 'false'
|
package/README.md
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
This repository contains a collection of shared libraries used across the Nova ecosystem. These libraries are designed to be used across multiple projects and are intended to simplify the development process.
|
|
7
7
|
|
|
8
8
|
## Usage
|
|
9
|
-
This package is published to
|
|
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": "^3.6.1",
|
|
12
12
|
```
|
|
13
13
|
to your projects `package.json` or by running `npm install @skillswaveca/nova-shared-libraries`
|
|
14
14
|
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
export const packageInfo = [
|
|
2
2
|
{
|
|
3
3
|
"name": "@skillswaveca/nova-utils",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.6.1",
|
|
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-model",
|
|
10
|
-
"version": "3.
|
|
10
|
+
"version": "3.6.1",
|
|
11
11
|
"description": "Nova model stuff",
|
|
12
12
|
"docsPath": "./nova-model/index.html"
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
"name": "@skillswaveca/nova-middleware",
|
|
16
|
-
"version": "3.
|
|
16
|
+
"version": "3.6.1",
|
|
17
17
|
"description": "A collection of middleware used by nova projects",
|
|
18
18
|
"docsPath": "./nova-middleware/index.html"
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
"name": "@skillswaveca/nova-drivers",
|
|
22
|
-
"version": "3.
|
|
22
|
+
"version": "3.6.1",
|
|
23
23
|
"description": "Some helper drivers for AWS services",
|
|
24
24
|
"docsPath": "./drivers/index.html"
|
|
25
25
|
}
|
package/index.js
CHANGED
|
@@ -9,6 +9,7 @@ export * from './packages/drivers/src/nova-driver.js';
|
|
|
9
9
|
export * from './packages/drivers/src/kraken-driver.js';
|
|
10
10
|
export * from './packages/drivers/src/http.js';
|
|
11
11
|
export * from './packages/drivers/src/config.js';
|
|
12
|
+
export * from './packages/nova-model/src/stream/nova-stream-task-router.js';
|
|
12
13
|
export * from './packages/nova-model/src/repo/nova-model-repo.js';
|
|
13
14
|
export * from './packages/nova-model/src/repo/api-token.js';
|
|
14
15
|
export * from './packages/nova-model/src/model/nova-schema.js';
|
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": "3.
|
|
6
|
+
"version": "3.7.0",
|
|
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": "3.
|
|
6
|
+
"version": "3.7.0",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"pre-release": "pnpm run create-index",
|
|
@@ -112,7 +112,7 @@ export class HttpDriver extends NovaDriver {
|
|
|
112
112
|
error = await response.text();
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
return { success, body, error };
|
|
115
|
+
return { success, body, error, statusCode: response.status };
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
/**
|
|
@@ -152,7 +152,7 @@ export class HttpDriver extends NovaDriver {
|
|
|
152
152
|
return await this._handleResponse(url, options, response);
|
|
153
153
|
} catch (error) {
|
|
154
154
|
this.log.error({ url: url, method: method, error, message: error.message }, 'HTTP request failed');
|
|
155
|
-
return { success: false, error: error.message };
|
|
155
|
+
return { success: false, error: error.message, statusCode: error.status };
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
|
|
@@ -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": "3.
|
|
6
|
+
"version": "3.7.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-model",
|
|
4
4
|
"description": "Nova model stuff",
|
|
5
5
|
"repository": "https://github.com/SkillsWave/nova-shared-libraries",
|
|
6
|
-
"version": "3.
|
|
6
|
+
"version": "3.7.0",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"pre-release": "pnpm run create-index",
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { log } from '../../../nova-utils/index.js';
|
|
2
|
+
|
|
3
|
+
export const NO_OP = () => { };
|
|
4
|
+
export const RECORD_HANDLER_NO_OP = {
|
|
5
|
+
create: NO_OP,
|
|
6
|
+
update: NO_OP,
|
|
7
|
+
delete: NO_OP,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export class NovaStreamTaskRouter {
|
|
11
|
+
constructor(recordHandlers) {
|
|
12
|
+
this._recordHandlers = recordHandlers;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
getRecordStatus(oldRecord, newRecord) {
|
|
16
|
+
const recordType = newRecord?.__type || oldRecord?.__type;
|
|
17
|
+
let operation = 'update';
|
|
18
|
+
if (!oldRecord || Object.keys(oldRecord).length === 0) {
|
|
19
|
+
operation = 'create';
|
|
20
|
+
} else if (!newRecord || Object.keys(newRecord).length === 0) {
|
|
21
|
+
operation = 'delete';
|
|
22
|
+
}
|
|
23
|
+
return { recordType, operation };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
handle(newRecord, oldRecord) {
|
|
27
|
+
const { recordType, operation } = this.getRecordStatus(oldRecord, newRecord);
|
|
28
|
+
if (!recordType) {
|
|
29
|
+
log.warn({ recordType, operation }, 'No record type found');
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
const handler = this._recordHandlers[recordType]?.[operation];
|
|
33
|
+
if (!handler) {
|
|
34
|
+
log.warn({ recordType, operation }, 'No handler found for record');
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
return handler(newRecord, oldRecord);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -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": "3.
|
|
6
|
+
"version": "3.7.0",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"pre-release": "pnpm run create-index",
|