@skillswaveca/nova-shared-libraries 3.6.1 → 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/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/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
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
export const packageInfo = [
|
|
2
2
|
{
|
|
3
3
|
"name": "@skillswaveca/nova-utils",
|
|
4
|
-
"version": "3.6.
|
|
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.6.
|
|
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.6.
|
|
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.6.
|
|
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",
|
|
@@ -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",
|