@openfn/ws-worker 0.1.0 → 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 +18 -0
- package/README.md +1 -1
- package/dist/index.js +16 -3
- package/dist/start.d.ts +1 -0
- package/dist/start.js +5582 -0
- package/package.json +9 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
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
|
+
|
|
12
|
+
## 0.1.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Added docker image and bin stub
|
|
17
|
+
- Destroy workers on close
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
- @openfn/engine-multi@0.1.1
|
|
20
|
+
|
|
3
21
|
## 0.1.0
|
|
4
22
|
|
|
5
23
|
First release of the websocket worker, which handles comm between Lightning and the multi-threaded engine.
|
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@ You may want to add `--log debug` or disable the work loop, see below.
|
|
|
36
36
|
|
|
37
37
|
The default settings will try and connect to lightning at `localhost:4000`.
|
|
38
38
|
|
|
39
|
-
Pass a custom lightining url with `-l ws://localhost:1234`.
|
|
39
|
+
Pass a custom lightining url with `-l ws://localhost:1234/worker`. (Note that you need to include the websocket endpoint, which at the time of writing is `/worker`.)
|
|
40
40
|
|
|
41
41
|
Use `-l mock` to connect to a lightning mock server (on the default port).
|
|
42
42
|
|
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,9 +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();
|
|
516
|
+
await engine.destroy();
|
|
504
517
|
app.killWorkloop?.();
|
|
505
518
|
logger.success("Server closed");
|
|
506
519
|
};
|
package/dist/start.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|