@jarenjs/flow 0.46.5 → 0.56.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/README.md CHANGED
@@ -190,7 +190,7 @@ built with `@jarenjs/flow` and XState v5 and asserted to agree before
190
190
  timing:
191
191
 
192
192
  - **Transitions** — the pure `step` runs several times faster than an
193
- XState actor's `send` (≈<!--bm:flow.fsmBand-->5.6–8.1<!--/bm-->× across 5/50/500-state machines); the
193
+ XState actor's `send` (≈<!--fact:flow.fsmBand-->5.6–8.1<!--/fact-->× across 5/50/500-state machines); the
194
194
  `createFsmSession` wrapper is on the page too.
195
195
  - **Compile** — `compileFsm` beats `createMachine` + `createActor`
196
196
  ≈1.5–2.6×. Not like-for-like: XState builds a scheduling actor, so the
@@ -227,6 +227,40 @@ section shows the `composeChecks(schema, compileGate)` recipe, and
227
227
  runs a model as an ordinary dag `task`. Neither package imports the
228
228
  other — the composition is data.
229
229
 
230
+ ## Authoring by code
231
+
232
+ The same documents have a by-code twin. `@jarenjs/linq/flow` is the
233
+ suite's pen for both formats: state ids, event names and node ids are
234
+ literal types, so a transition into an undeclared state or an edge from
235
+ an undeclared node is a compile error, and guards, effect props, node
236
+ queries and edge selectors are callbacks captured over the scope the
237
+ engine evaluates them in — never a path typed as a string.
238
+
239
+ ```javascript
240
+ import { defineFsm, on, state, effect } from '@jarenjs/linq/flow';
241
+
242
+ const doc = defineFsm({
243
+ initial: 'idle',
244
+ states: [
245
+ 'idle',
246
+ state('loading', { entry: [effect('fetch', (s) => ({ url: s.context.url }))] }),
247
+ state('done', { final: true }),
248
+ ],
249
+ transitions: [
250
+ on('idle', 'start').to('loading'),
251
+ on('loading', 'ok').when((s) => s.payload.fresh).to('done'),
252
+ on('loading', 'fail').to('idle'),
253
+ ],
254
+ }); // the document at the top of this README, byte for byte
255
+
256
+ compileFsm(doc).step('idle', 'start', { context: { url: '/rows' } });
257
+ ```
258
+
259
+ A model-authored document and a pen-written one go through the SAME
260
+ gate — `compileFsm`/`compileDag`. The mapping table, and where the pen's
261
+ refusals end and the compiler's begin, are
262
+ [FLOW-PEN.md](../linq/docs/FLOW-PEN.md).
263
+
230
264
  ## Development
231
265
 
232
266
  Unit tests live in `test/flow/` at the repository root
@@ -67,6 +67,15 @@ honestly-stated divergences, is specified in
67
67
  [APP-INTEGRATION.md](APP-INTEGRATION.md); nothing there changes the
68
68
  format defined here.
69
69
 
70
+ Documents in both formats are authored by hand, projected from a
71
+ diagram, decoded by a model under the published grammar, or written by
72
+ code: `@jarenjs/linq/flow` is the suite's by-code producer
73
+ (`defineFsm`, `defineDag`), and it emits exactly the documents this
74
+ section defines — its guards, effect props, node queries and edge
75
+ selectors are callbacks captured over the scopes §3 and §6.1 fix. It
76
+ imports nothing of this package; the compilers here remain the only
77
+ judge of what a document means.
78
+
70
79
  ## §2 The jaren-fsm document
71
80
 
72
81
  ```json
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jarenjs/flow",
3
3
  "private": false,
4
- "version": "0.46.5",
4
+ "version": "0.56.0",
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.46.5",
53
- "@jarenjs/json": "^0.46.5"
52
+ "@jarenjs/core": "^0.56.0",
53
+ "@jarenjs/json": "^0.56.0"
54
54
  }
55
55
  }