@jarenjs/flow 0.72.0 → 0.72.3

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/README.md CHANGED
@@ -139,7 +139,7 @@ const dag = compileDag({
139
139
  nodes: {
140
140
  rows: { kind: 'input' },
141
141
  adults: { kind: 'query',
142
- query: { $for: { r: '$[*]' }, $where: { $ge: ['$r.age', 18] }, $return: '$r' } },
142
+ query: [{ $for: { r: '$[*]' }, $where: { $ge: ['$r.age', 18] }, $return: '$r' }] },
143
143
  view: { kind: 'jslt',
144
144
  stylesheet: [{ match: '$', body: ['ul', {},
145
145
  [{ $for: { p: '$[*]' }, $return: ['li', {}, '$p.name'] }]] }] },
@@ -155,6 +155,10 @@ const dag = compileDag({
155
155
  await dag.run(people); // ['ul', {}, [['li', {}, 'ada'], …]] — a vnode, as JSON
156
156
  ```
157
157
 
158
+ The query's outer array keeps `adults` an array for zero, one or many
159
+ rows. Without it, the engine's one-result sequence becomes that row;
160
+ the next node's `$[*]` would iterate its members instead of rows.
161
+
158
162
  Cycles, port rules and the exactly-one-output rule are **compile-time**
159
163
  rejections (JF0xxx with `docPath`); a `task` node's handler is resolved
160
164
  at compile too, and called as `handler({ with, input }, signal)` with
@@ -261,7 +261,7 @@ extending it is a format revision, not an option.
261
261
  "nodes": {
262
262
  "rows": { "kind": "input" },
263
263
  "adults": { "kind": "query",
264
- "query": { "$for": { "r": "$[*]" }, "$where": { "$ge": ["$r.age", 18] }, "$return": "$r" } },
264
+ "query": [{ "$for": { "r": "$[*]" }, "$where": { "$ge": ["$r.age", 18] }, "$return": "$r" }] },
265
265
  "names": { "kind": "jslt",
266
266
  "stylesheet": [{ "match": "$", "body": ["ul", {},
267
267
  [{ "$for": { "p": "$[*]" }, "$return": ["li", {}, "$p.name"] }]] }] },
@@ -312,7 +312,15 @@ A node's `$` is decided by its inbound edges:
312
312
 
313
313
  A delivery whose `select` yields the empty sequence delivers `null`; a
314
314
  `query`/`jslt` node whose own result is empty likewise yields `null` —
315
- `undefined` is not a JSON value and never flows through a graph.
315
+ `undefined` is not a JSON value and never flows through a graph. The
316
+ query engine's singleton rule also applies: one result is that value,
317
+ while two or more results become an array. To deliver an array for every
318
+ cardinality, wrap the query in an array constructor, as `adults.query`
319
+ does above. Its downstream `$[*]` therefore always iterates rows. The
320
+ stylesheet also collects its `li` children in an explicit array: zero,
321
+ one and two adults yield respectively `["ul", {}, []]`,
322
+ `["ul", {}, [["li", {}, "ada"]]]`, and
323
+ `["ul", {}, [["li", {}, "ada"], ["li", {}, "lin"]]]` for those names.
316
324
  Values pass **by reference**: nodes and hosts MUST NOT mutate what
317
325
  they receive.
318
326
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jarenjs/flow",
3
3
  "private": false,
4
- "version": "0.72.0",
4
+ "version": "0.72.3",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
7
7
  "types": "./dist/types/index.d.ts",
@@ -49,7 +49,7 @@
49
49
  "prepack": "npm run build:types"
50
50
  },
51
51
  "dependencies": {
52
- "@jarenjs/core": "^0.72.0",
53
- "@jarenjs/json": "^0.72.0"
52
+ "@jarenjs/core": "^0.72.3",
53
+ "@jarenjs/json": "^0.72.3"
54
54
  }
55
55
  }
package/src/dag.js CHANGED
@@ -466,6 +466,8 @@ export function compileDag(doc, options) {
466
466
  loaded = await checkpoint.load(runId);
467
467
  }
468
468
  catch (err) {
469
+ if (signal !== undefined && onAbort !== null)
470
+ signal.removeEventListener('abort', onAbort);
469
471
  const cause = asError(err);
470
472
  throw new FlowRuntimeError('JF2009',
471
473
  `the checkpoint store failed to load run '${runId}': ${cause.message}`,