@openfn/ws-worker 0.1.1 → 0.1.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.
- package/CHANGELOG.md +10 -0
- package/dist/index.js +16 -4
- package/dist/start.js +16 -4
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
# ws-worker
|
|
2
2
|
|
|
3
|
+
## 0.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f241348: Make destroy async
|
|
8
|
+
- Updated dependencies [d255f32]
|
|
9
|
+
- Updated dependencies [f241348]
|
|
10
|
+
- @openfn/engine-multi@0.1.2
|
|
11
|
+
|
|
3
12
|
## 0.1.1
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
6
15
|
|
|
16
|
+
- Added docker image and bin stub
|
|
7
17
|
- Destroy workers on close
|
|
8
18
|
- Updated dependencies
|
|
9
19
|
- @openfn/engine-multi@0.1.1
|
package/dist/index.js
CHANGED
|
@@ -122,6 +122,17 @@ import crypto2 from "node:crypto";
|
|
|
122
122
|
|
|
123
123
|
// src/util/convert-attempt.ts
|
|
124
124
|
import crypto from "node:crypto";
|
|
125
|
+
var conditions = {
|
|
126
|
+
on_job_success: "!state.errors",
|
|
127
|
+
on_job_failure: "state.errors",
|
|
128
|
+
always: null
|
|
129
|
+
};
|
|
130
|
+
var mapEdgeCondition = (condition) => {
|
|
131
|
+
if (condition && condition in conditions) {
|
|
132
|
+
return conditions[condition];
|
|
133
|
+
}
|
|
134
|
+
return condition;
|
|
135
|
+
};
|
|
125
136
|
var convert_attempt_default = (attempt) => {
|
|
126
137
|
const options = attempt.options || {};
|
|
127
138
|
const plan = {
|
|
@@ -167,8 +178,9 @@ var convert_attempt_default = (attempt) => {
|
|
|
167
178
|
}
|
|
168
179
|
const next = edges.filter((e) => e.source_job_id === id).reduce((obj, edge) => {
|
|
169
180
|
const newEdge = {};
|
|
170
|
-
|
|
171
|
-
|
|
181
|
+
const condition = mapEdgeCondition(edge.condition);
|
|
182
|
+
if (condition) {
|
|
183
|
+
newEdge.condition = condition;
|
|
172
184
|
}
|
|
173
185
|
if (edge.enabled === false) {
|
|
174
186
|
newEdge.disabled = true;
|
|
@@ -498,10 +510,10 @@ function createServer(engine, options = {}) {
|
|
|
498
510
|
ctx.status = 204;
|
|
499
511
|
});
|
|
500
512
|
});
|
|
501
|
-
app.destroy = () => {
|
|
513
|
+
app.destroy = async () => {
|
|
502
514
|
logger.info("Closing server...");
|
|
503
515
|
server.close();
|
|
504
|
-
engine.destroy();
|
|
516
|
+
await engine.destroy();
|
|
505
517
|
app.killWorkloop?.();
|
|
506
518
|
logger.success("Server closed");
|
|
507
519
|
};
|
package/dist/start.js
CHANGED
|
@@ -5096,6 +5096,17 @@ import crypto3 from "node:crypto";
|
|
|
5096
5096
|
|
|
5097
5097
|
// src/util/convert-attempt.ts
|
|
5098
5098
|
import crypto2 from "node:crypto";
|
|
5099
|
+
var conditions = {
|
|
5100
|
+
on_job_success: "!state.errors",
|
|
5101
|
+
on_job_failure: "state.errors",
|
|
5102
|
+
always: null
|
|
5103
|
+
};
|
|
5104
|
+
var mapEdgeCondition = (condition) => {
|
|
5105
|
+
if (condition && condition in conditions) {
|
|
5106
|
+
return conditions[condition];
|
|
5107
|
+
}
|
|
5108
|
+
return condition;
|
|
5109
|
+
};
|
|
5099
5110
|
var convert_attempt_default = (attempt) => {
|
|
5100
5111
|
const options = attempt.options || {};
|
|
5101
5112
|
const plan = {
|
|
@@ -5141,8 +5152,9 @@ var convert_attempt_default = (attempt) => {
|
|
|
5141
5152
|
}
|
|
5142
5153
|
const next = edges.filter((e) => e.source_job_id === id).reduce((obj, edge) => {
|
|
5143
5154
|
const newEdge = {};
|
|
5144
|
-
|
|
5145
|
-
|
|
5155
|
+
const condition = mapEdgeCondition(edge.condition);
|
|
5156
|
+
if (condition) {
|
|
5157
|
+
newEdge.condition = condition;
|
|
5146
5158
|
}
|
|
5147
5159
|
if (edge.enabled === false) {
|
|
5148
5160
|
newEdge.disabled = true;
|
|
@@ -5472,10 +5484,10 @@ function createServer(engine, options = {}) {
|
|
|
5472
5484
|
ctx.status = 204;
|
|
5473
5485
|
});
|
|
5474
5486
|
});
|
|
5475
|
-
app.destroy = () => {
|
|
5487
|
+
app.destroy = async () => {
|
|
5476
5488
|
logger2.info("Closing server...");
|
|
5477
5489
|
server.close();
|
|
5478
|
-
engine.destroy();
|
|
5490
|
+
await engine.destroy();
|
|
5479
5491
|
app.killWorkloop?.();
|
|
5480
5492
|
logger2.success("Server closed");
|
|
5481
5493
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfn/ws-worker",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "A Websocket Worker to connect Lightning to a Runtime Engine",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"koa-logger": "^3.2.1",
|
|
22
22
|
"phoenix": "^1.7.7",
|
|
23
23
|
"ws": "^8.14.1",
|
|
24
|
-
"@openfn/engine-multi": "0.1.
|
|
25
|
-
"@openfn/
|
|
26
|
-
"@openfn/
|
|
24
|
+
"@openfn/engine-multi": "0.1.2",
|
|
25
|
+
"@openfn/logger": "0.0.18",
|
|
26
|
+
"@openfn/runtime": "0.0.32"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/koa": "^2.13.5",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"tsup": "^6.2.3",
|
|
41
41
|
"typescript": "^4.6.4",
|
|
42
42
|
"yargs": "^17.6.2",
|
|
43
|
-
"@openfn/lightning-mock": "1.0.
|
|
43
|
+
"@openfn/lightning-mock": "1.0.3"
|
|
44
44
|
},
|
|
45
45
|
"files": [
|
|
46
46
|
"dist",
|