ldn-inbox-server 1.5.0 → 1.5.2
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const { dynamic_handler , parseConfig } = require('../../lib/util.js');
|
|
1
|
+
const { dynamic_handler , parseConfig , parseAsJSON } = require('../../lib/util.js');
|
|
2
2
|
const logger = require('../../lib/util.js').getLogger();
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -15,6 +15,8 @@ async function handle({path,options}) {
|
|
|
15
15
|
return { path, options, success: false };
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
const notification = parseAsJSON(path);
|
|
19
|
+
|
|
18
20
|
const handlers = config['notification_handler']?.['multi']?.['handlers'];
|
|
19
21
|
|
|
20
22
|
if (! handlers) {
|
|
@@ -55,7 +57,7 @@ async function handle({path,options}) {
|
|
|
55
57
|
throw new Error(`failed to load ${step}`);
|
|
56
58
|
}
|
|
57
59
|
|
|
58
|
-
const result = await handler({path,options,config});
|
|
60
|
+
const result = await handler({path,options,config,notification});
|
|
59
61
|
|
|
60
62
|
if (result['success']) {
|
|
61
63
|
logger.info(`workflow[${i}] : finished ${step}`);
|
package/lib/util.js
CHANGED
|
@@ -6,6 +6,7 @@ const { backOff } = require('exponential-backoff');
|
|
|
6
6
|
const { v4: uuidv4 } = require('uuid');
|
|
7
7
|
const fetch = require('node-fetch');
|
|
8
8
|
const YAML = require('yaml');
|
|
9
|
+
const JSON5 = require('json5');
|
|
9
10
|
require('dotenv').config();
|
|
10
11
|
|
|
11
12
|
const logger = getLogger();
|
|
@@ -32,6 +33,9 @@ function parseConfig(path) {
|
|
|
32
33
|
if (path.endsWith('.json') || path.endsWith('.jsonld')) {
|
|
33
34
|
return JSON.parse(fs.readFileSync(path, {encoding: 'utf-8'}));
|
|
34
35
|
}
|
|
36
|
+
else if (path.endsWith('.json5')) {
|
|
37
|
+
return JSON5.parse(fs.readFileSync(path, {encoding: 'utf-8'}));
|
|
38
|
+
}
|
|
35
39
|
else if (path.endsWith('.yaml') || path.endsWith('.yml')) {
|
|
36
40
|
return YAML.parse(fs.readFileSync(path, {encoding: 'utf-8'}));
|
|
37
41
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ldn-inbox-server",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "A demonstration Event Notifications Inbox server",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"author": "Patrick Hochstenbach <Patrick.Hochstenbach@UGent.be>",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"commander": "^12.0.0",
|
|
26
26
|
"dotenv": "^16.4.5",
|
|
27
27
|
"exponential-backoff": "^3.1.1",
|
|
28
|
+
"json5": "^2.2.3",
|
|
28
29
|
"jsonpath": "^1.1.1",
|
|
29
30
|
"jsonschema": "^1.4.1",
|
|
30
31
|
"md5": "^2.3.0",
|