@openfn/ws-worker 0.2.3 → 0.2.5

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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # ws-worker
2
2
 
3
+ ## 0.2.5
4
+
5
+ ### Patch Changes
6
+
7
+ - 36337d7: When calculating exit reasons, exclude non-executed downstream nodes in leaf calculation. (i.e., look at the final executed node in each branch when determining the attempt exit reason.)
8
+
9
+ ## 0.2.4
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [419f276]
14
+ - Updated dependencies [0e66f5a]
15
+ - @openfn/runtime@0.1.2
16
+ - @openfn/engine-multi@0.1.9
17
+
3
18
  ## 0.2.3
4
19
 
5
20
  ### Patch Changes
package/dist/index.js CHANGED
@@ -230,9 +230,16 @@ var calculateJobExitReason = (jobId, state = { data: {} }, error) => {
230
230
  }
231
231
  return { reason, error_type, error_message };
232
232
  };
233
+ var isLeafNode = (state, job) => {
234
+ if (!job.next || Object.keys(job.next).length == 0) {
235
+ return true;
236
+ }
237
+ const hasDownstream = Object.keys(job.next).find((id) => state.reasons[id]);
238
+ return !hasDownstream;
239
+ };
233
240
  var calculateAttemptExitReason = (state) => {
234
241
  if (state.plan && state.reasons) {
235
- const leafJobReasons = state.plan.jobs.filter(({ next }) => !next || Object.keys(next).length == 0).map(({ id }) => state.reasons[id]);
242
+ const leafJobReasons = state.plan.jobs.filter((job) => isLeafNode(state, job)).map(({ id }) => state.reasons[id]);
236
243
  const fail = leafJobReasons.find((r) => r && r.reason === "fail");
237
244
  if (fail) {
238
245
  return fail;
package/dist/start.js CHANGED
@@ -5212,9 +5212,16 @@ var calculateJobExitReason = (jobId, state = { data: {} }, error) => {
5212
5212
  }
5213
5213
  return { reason, error_type, error_message };
5214
5214
  };
5215
+ var isLeafNode = (state, job) => {
5216
+ if (!job.next || Object.keys(job.next).length == 0) {
5217
+ return true;
5218
+ }
5219
+ const hasDownstream = Object.keys(job.next).find((id) => state.reasons[id]);
5220
+ return !hasDownstream;
5221
+ };
5215
5222
  var calculateAttemptExitReason = (state) => {
5216
5223
  if (state.plan && state.reasons) {
5217
- const leafJobReasons = state.plan.jobs.filter(({ next }) => !next || Object.keys(next).length == 0).map(({ id }) => state.reasons[id]);
5224
+ const leafJobReasons = state.plan.jobs.filter((job) => isLeafNode(state, job)).map(({ id }) => state.reasons[id]);
5218
5225
  const fail = leafJobReasons.find((r) => r && r.reason === "fail");
5219
5226
  if (fail) {
5220
5227
  return fail;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfn/ws-worker",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "A Websocket Worker to connect Lightning to a Runtime Engine",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -21,8 +21,8 @@
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.8",
25
- "@openfn/runtime": "0.1.1",
24
+ "@openfn/engine-multi": "0.1.9",
25
+ "@openfn/runtime": "0.1.2",
26
26
  "@openfn/logger": "0.0.19"
27
27
  },
28
28
  "devDependencies": {
@@ -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.9"
43
+ "@openfn/lightning-mock": "1.0.10"
44
44
  },
45
45
  "files": [
46
46
  "dist",