@openfn/ws-worker 0.3.2 → 0.5.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/CHANGELOG.md +21 -0
- package/README.md +4 -2
- package/dist/index.js +8 -2
- package/dist/start.js +20 -4
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# ws-worker
|
|
2
2
|
|
|
3
|
+
## 0.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Add state-props-to-remove option
|
|
8
|
+
- Updated dependencies [56b6e44]
|
|
9
|
+
- @openfn/engine-multi@0.2.6
|
|
10
|
+
- @openfn/runtime@0.2.4
|
|
11
|
+
|
|
12
|
+
## 0.4.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- f228fd5: Add support for initial edge conditions in worker
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [f228fd5]
|
|
21
|
+
- @openfn/runtime@0.2.3
|
|
22
|
+
- @openfn/engine-multi@0.2.5
|
|
23
|
+
|
|
3
24
|
## 0.3.2
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -24,8 +24,6 @@ The worker will use the WORKER_SECRET env var (which you should have set for Lig
|
|
|
24
24
|
mix lightning.gen_worker_keys
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
### WS Server
|
|
28
|
-
|
|
29
27
|
To start a `ws-worker` server, run:
|
|
30
28
|
|
|
31
29
|
```
|
|
@@ -40,6 +38,10 @@ Pass a custom lightining url with `-l ws://localhost:1234/worker`. (Note that yo
|
|
|
40
38
|
|
|
41
39
|
Use `-l mock` to connect to a lightning mock server (on the default port).
|
|
42
40
|
|
|
41
|
+
## Options
|
|
42
|
+
|
|
43
|
+
For a list of supported worker and engine options, see src/start.ts
|
|
44
|
+
|
|
43
45
|
## Watched Server
|
|
44
46
|
|
|
45
47
|
You can start a dev server (which rebuilds on save) by running:
|
package/dist/index.js
CHANGED
|
@@ -180,6 +180,12 @@ var mapEdgeCondition = (edge) => {
|
|
|
180
180
|
}
|
|
181
181
|
return condition;
|
|
182
182
|
};
|
|
183
|
+
var mapTriggerEdgeCondition = (edge) => {
|
|
184
|
+
const { condition } = edge;
|
|
185
|
+
if (condition === void 0 || condition === "always")
|
|
186
|
+
return true;
|
|
187
|
+
return condition;
|
|
188
|
+
};
|
|
183
189
|
var convert_attempt_default = (attempt) => {
|
|
184
190
|
const options = attempt.options || {};
|
|
185
191
|
const plan = {
|
|
@@ -203,7 +209,7 @@ var convert_attempt_default = (attempt) => {
|
|
|
203
209
|
if (connectedEdges.length) {
|
|
204
210
|
nodes[id].next = connectedEdges.reduce((obj, edge) => {
|
|
205
211
|
if (edge.enabled !== false) {
|
|
206
|
-
obj[edge.target_job_id] =
|
|
212
|
+
obj[edge.target_job_id] = mapTriggerEdgeCondition(edge);
|
|
207
213
|
}
|
|
208
214
|
return obj;
|
|
209
215
|
}, {});
|
|
@@ -370,7 +376,7 @@ import { timestamp } from "@openfn/logger";
|
|
|
370
376
|
// package.json
|
|
371
377
|
var package_default = {
|
|
372
378
|
name: "@openfn/ws-worker",
|
|
373
|
-
version: "0.
|
|
379
|
+
version: "0.5.0",
|
|
374
380
|
description: "A Websocket Worker to connect Lightning to a Runtime Engine",
|
|
375
381
|
main: "dist/index.js",
|
|
376
382
|
type: "module",
|
package/dist/start.js
CHANGED
|
@@ -5166,6 +5166,12 @@ var mapEdgeCondition = (edge) => {
|
|
|
5166
5166
|
}
|
|
5167
5167
|
return condition;
|
|
5168
5168
|
};
|
|
5169
|
+
var mapTriggerEdgeCondition = (edge) => {
|
|
5170
|
+
const { condition } = edge;
|
|
5171
|
+
if (condition === void 0 || condition === "always")
|
|
5172
|
+
return true;
|
|
5173
|
+
return condition;
|
|
5174
|
+
};
|
|
5169
5175
|
var convert_attempt_default = (attempt) => {
|
|
5170
5176
|
const options = attempt.options || {};
|
|
5171
5177
|
const plan = {
|
|
@@ -5189,7 +5195,7 @@ var convert_attempt_default = (attempt) => {
|
|
|
5189
5195
|
if (connectedEdges.length) {
|
|
5190
5196
|
nodes[id].next = connectedEdges.reduce((obj, edge) => {
|
|
5191
5197
|
if (edge.enabled !== false) {
|
|
5192
|
-
obj[edge.target_job_id] =
|
|
5198
|
+
obj[edge.target_job_id] = mapTriggerEdgeCondition(edge);
|
|
5193
5199
|
}
|
|
5194
5200
|
return obj;
|
|
5195
5201
|
}, {});
|
|
@@ -5356,7 +5362,7 @@ import { timestamp } from "@openfn/logger";
|
|
|
5356
5362
|
// package.json
|
|
5357
5363
|
var package_default = {
|
|
5358
5364
|
name: "@openfn/ws-worker",
|
|
5359
|
-
version: "0.
|
|
5365
|
+
version: "0.5.0",
|
|
5360
5366
|
description: "A Websocket Worker to connect Lightning to a Runtime Engine",
|
|
5361
5367
|
main: "dist/index.js",
|
|
5362
5368
|
type: "module",
|
|
@@ -5872,7 +5878,12 @@ function createServer(engine, options = {}) {
|
|
|
5872
5878
|
var server_default = createServer;
|
|
5873
5879
|
|
|
5874
5880
|
// src/start.ts
|
|
5875
|
-
var {
|
|
5881
|
+
var {
|
|
5882
|
+
WORKER_REPO_DIR,
|
|
5883
|
+
WORKER_SECRET,
|
|
5884
|
+
MAX_RUN_MEMORY,
|
|
5885
|
+
STATE_PROPS_TO_REMOVE
|
|
5886
|
+
} = process.env;
|
|
5876
5887
|
var args = yargs_default(hideBin(process.argv)).command("server", "Start a ws-worker server").option("port", {
|
|
5877
5888
|
alias: "p",
|
|
5878
5889
|
description: "Port to run the server on",
|
|
@@ -5908,6 +5919,10 @@ var args = yargs_default(hideBin(process.argv)).command("server", "Start a ws-wo
|
|
|
5908
5919
|
description: "max concurrent workers",
|
|
5909
5920
|
default: 5,
|
|
5910
5921
|
type: "number"
|
|
5922
|
+
}).option("state-props-to-remove", {
|
|
5923
|
+
description: "A list of properties to remove from the final state returned by a job",
|
|
5924
|
+
default: STATE_PROPS_TO_REMOVE ?? ["configuration", "response"],
|
|
5925
|
+
type: "array"
|
|
5911
5926
|
}).option("run-memory", {
|
|
5912
5927
|
description: "Maximum memory allocated to a single run, in mb",
|
|
5913
5928
|
type: "number",
|
|
@@ -5950,7 +5965,8 @@ if (args.mock) {
|
|
|
5950
5965
|
createRTE({
|
|
5951
5966
|
repoDir: args.repoDir,
|
|
5952
5967
|
memoryLimitMb: args.runMemory,
|
|
5953
|
-
maxWorkers: args.capacity
|
|
5968
|
+
maxWorkers: args.capacity,
|
|
5969
|
+
statePropsToRemove: args.statePropsToRemove
|
|
5954
5970
|
}).then((engine) => {
|
|
5955
5971
|
logger.debug("engine created");
|
|
5956
5972
|
engineReady(engine);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfn/ws-worker",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "A Websocket Worker to connect Lightning to a Runtime Engine",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"koa-logger": "^3.2.1",
|
|
23
23
|
"phoenix": "^1.7.7",
|
|
24
24
|
"ws": "^8.14.1",
|
|
25
|
-
"@openfn/
|
|
26
|
-
"@openfn/
|
|
25
|
+
"@openfn/engine-multi": "0.2.6",
|
|
26
|
+
"@openfn/runtime": "0.2.4",
|
|
27
27
|
"@openfn/logger": "0.0.19"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"tsup": "^6.2.3",
|
|
42
42
|
"typescript": "^4.6.4",
|
|
43
43
|
"yargs": "^17.6.2",
|
|
44
|
-
"@openfn/lightning-mock": "1.1.
|
|
44
|
+
"@openfn/lightning-mock": "1.1.8"
|
|
45
45
|
},
|
|
46
46
|
"files": [
|
|
47
47
|
"dist",
|