configurapi 1.8.0 → 1.9.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/package.json +5 -7
- package/src/event.js +2 -2
- package/src/service.js +12 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "configurapi",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.1",
|
|
4
4
|
"description": "A configurable API framework",
|
|
5
5
|
"main": "src/configurapi.js",
|
|
6
6
|
"types": "src/configurapi.d.ts",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"src/*"
|
|
9
9
|
],
|
|
10
10
|
"scripts": {
|
|
11
|
-
"test": "cd test &&
|
|
11
|
+
"test": "cd test && node --test *.js",
|
|
12
12
|
"start": "cd src && node main.js"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
@@ -18,13 +18,11 @@
|
|
|
18
18
|
"inflection": "^1.12.0",
|
|
19
19
|
"js-yaml": "^3.13.1",
|
|
20
20
|
"nested-error-stacks": "^2.1.0",
|
|
21
|
-
"one-liner": "^1.3.0"
|
|
22
|
-
"uuid": "^3.3.2"
|
|
21
|
+
"one-liner": "^1.3.0"
|
|
23
22
|
},
|
|
24
23
|
"devDependencies": {
|
|
25
|
-
"chai": "
|
|
26
|
-
"deep-equal": "^1.0.1"
|
|
27
|
-
"mocha": "6.1.x"
|
|
24
|
+
"chai": "^5.2.3",
|
|
25
|
+
"deep-equal": "^1.0.1"
|
|
28
26
|
},
|
|
29
27
|
"repository": {
|
|
30
28
|
"type": "git",
|
package/src/event.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
let Response = require("./response");
|
|
2
|
-
|
|
2
|
+
const crypto = require("crypto");
|
|
3
3
|
|
|
4
4
|
let inflectors = require("inflection");
|
|
5
5
|
|
|
@@ -24,7 +24,7 @@ module.exports = class Event
|
|
|
24
24
|
{
|
|
25
25
|
constructor(request)
|
|
26
26
|
{
|
|
27
|
-
this.id =
|
|
27
|
+
this.id = crypto.randomUUID();
|
|
28
28
|
|
|
29
29
|
if('query' in request && 'correlationid' in request.query)
|
|
30
30
|
{
|
package/src/service.js
CHANGED
|
@@ -82,17 +82,27 @@ module.exports = class Service extends events.EventEmitter
|
|
|
82
82
|
|
|
83
83
|
this.emit(LogLevel.Trace, `configurapi - - Registerd ${route.name} route.`);
|
|
84
84
|
});
|
|
85
|
+
}
|
|
85
86
|
|
|
86
|
-
|
|
87
|
+
initDone;
|
|
88
|
+
async init()
|
|
89
|
+
{
|
|
90
|
+
this.onStartPromise ??= this._handleEvent('on_start');
|
|
91
|
+
await this.onStartPromise;
|
|
92
|
+
this.initDone = true;
|
|
87
93
|
}
|
|
88
94
|
|
|
89
95
|
async process(event)
|
|
90
96
|
{
|
|
97
|
+
if (!this.initDone)
|
|
98
|
+
{
|
|
99
|
+
await this.init();
|
|
100
|
+
}
|
|
101
|
+
|
|
91
102
|
if (!this.isReady)
|
|
92
103
|
{
|
|
93
104
|
try
|
|
94
105
|
{
|
|
95
|
-
await this.onStartPromise
|
|
96
106
|
await this._handleEvent('on_first_request', event);
|
|
97
107
|
}
|
|
98
108
|
catch(error)
|