@beehexa/hexasync-template-worker-flow 2610.12.1 → 2610.12.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/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/render.d.ts +14 -9
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +93 -88
- package/dist/render.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,6 @@ export { WORKER_STAGES, stagesPresent, stageEdges, pullerKindOf, type StagePhase
|
|
|
19
19
|
export { routeEdges, quotedKeys, looksLikeExpression, type RoutableStep, type RouteEdge, } from './routes.js';
|
|
20
20
|
export { workerFlow, type WorkerFlow, type WorkerFlowInput, type FlowNode, type FlowEdgeAddressed, type NodeLocation, type LocateRequest, } from './flow.js';
|
|
21
21
|
export { routeGraph, junctionAddress, type RouteGraph, type Junction, type JunctionKind, type GraphEdge, type EdgeEnd, } from './routeGraph.js';
|
|
22
|
-
export { renderMermaid, renderMermaidWithOccurrences, renderMarkdown } from './render.js';
|
|
22
|
+
export { compactWorkerFlow, renderMermaid, renderMermaidWithOccurrences, renderMarkdown } from './render.js';
|
|
23
23
|
export { compileWorkerWorkflowGraph, type CompileWorkerWorkflowGraphInput, } from './canonicalGraph.js';
|
|
24
24
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EACL,aAAa,EACb,aAAa,EACb,UAAU,EACV,YAAY,EACZ,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,SAAS,GACf,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,UAAU,EACV,UAAU,EACV,mBAAmB,EACnB,KAAK,YAAY,EACjB,KAAK,SAAS,GACf,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,UAAU,EACV,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,QAAQ,EACb,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,aAAa,GACnB,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,UAAU,EACV,eAAe,EACf,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,OAAO,GACb,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,aAAa,EAAE,4BAA4B,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EACL,aAAa,EACb,aAAa,EACb,UAAU,EACV,YAAY,EACZ,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,SAAS,GACf,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,UAAU,EACV,UAAU,EACV,mBAAmB,EACnB,KAAK,YAAY,EACjB,KAAK,SAAS,GACf,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,UAAU,EACV,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,QAAQ,EACb,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,aAAa,GACnB,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,UAAU,EACV,eAAe,EACf,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,OAAO,GACb,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,4BAA4B,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7G,OAAO,EACL,0BAA0B,EAC1B,KAAK,+BAA+B,GACrC,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -19,6 +19,6 @@ export { WORKER_STAGES, stagesPresent, stageEdges, pullerKindOf, } from './stage
|
|
|
19
19
|
export { routeEdges, quotedKeys, looksLikeExpression, } from './routes.js';
|
|
20
20
|
export { workerFlow, } from './flow.js';
|
|
21
21
|
export { routeGraph, junctionAddress, } from './routeGraph.js';
|
|
22
|
-
export { renderMermaid, renderMermaidWithOccurrences, renderMarkdown } from './render.js';
|
|
22
|
+
export { compactWorkerFlow, renderMermaid, renderMermaidWithOccurrences, renderMarkdown } from './render.js';
|
|
23
23
|
export { compileWorkerWorkflowGraph, } from './canonicalGraph.js';
|
|
24
24
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EACL,aAAa,EACb,aAAa,EACb,UAAU,EACV,YAAY,GAMb,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,UAAU,EACV,UAAU,EACV,mBAAmB,GAGpB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,UAAU,GAOX,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,UAAU,EACV,eAAe,GAMhB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,aAAa,EAAE,4BAA4B,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EACL,aAAa,EACb,aAAa,EACb,UAAU,EACV,YAAY,GAMb,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,UAAU,EACV,UAAU,EACV,mBAAmB,GAGpB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,UAAU,GAOX,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,UAAU,EACV,eAAe,GAMhB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,4BAA4B,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7G,OAAO,EACL,0BAA0B,GAE3B,MAAM,qBAAqB,CAAC"}
|
package/dist/render.d.ts
CHANGED
|
@@ -3,10 +3,20 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Thin by design. The emission rules live in `hexasync-template-model`'s `flowRender`, because AD-21 forbids the two
|
|
5
5
|
* flow packages importing each other and the shared half has to live somewhere neither owns. This file's whole job is
|
|
6
|
-
* to say what a WORKER node
|
|
6
|
+
* to say what a WORKER node is — its name, key, type and icon family — and how stages become subgraphs.
|
|
7
|
+
*
|
|
8
|
+
* A synthesised node never carries the text that produced it: an `if` condition, a routing expression or an
|
|
9
|
+
* unresolvable route are step PAYLOAD, and the drawing names the junction by what it is instead.
|
|
7
10
|
*/
|
|
8
|
-
import { type RenderedFlow, type RenderOptions } from '@beehexa/hexasync-template-model';
|
|
11
|
+
import { type CompactFlow, type RenderedFlow, type RenderOptions } from '@beehexa/hexasync-template-model';
|
|
9
12
|
import type { WorkerFlow } from './flow.js';
|
|
13
|
+
/**
|
|
14
|
+
* The compact graph for one worker component — what a host embeds, hashes and draws.
|
|
15
|
+
*
|
|
16
|
+
* The occurrence expansion (a run's repeated steps) happens inside `compactFlowGraph`, AFTER the stage edges are
|
|
17
|
+
* added, so a chain spliced in for a run carries the stage arrows to its first occurrence.
|
|
18
|
+
*/
|
|
19
|
+
export declare function compactWorkerFlow(flow: WorkerFlow, opts?: RenderOptions): CompactFlow;
|
|
10
20
|
export declare function renderMermaid(flow: WorkerFlow, opts?: RenderOptions): string;
|
|
11
21
|
/**
|
|
12
22
|
* The definition plus the collapsed-range addresses it drew.
|
|
@@ -18,13 +28,8 @@ export declare function renderMermaidWithOccurrences(flow: WorkerFlow, opts?: Re
|
|
|
18
28
|
/**
|
|
19
29
|
* Markdown for one component — `(flow, opts)`, matching the frontend twin and `PACKAGE-CONTRACT.md` §5.
|
|
20
30
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* slot and it reached `escapeLabel`: **`TypeError: value.replace is not a function`**. TypeScript caught it for TS
|
|
24
|
-
* consumers; JS consumers and the "one renderer set, callable uniformly" premise did not.
|
|
25
|
-
*
|
|
26
|
-
* The title now comes from the model, which has everything needed: the collection and the component's authored id. A
|
|
27
|
-
* caller wanting its own wording passes `title`.
|
|
31
|
+
* The title comes from the model (the collection and the component's authored id); a caller wanting its own wording
|
|
32
|
+
* passes `title`.
|
|
28
33
|
*/
|
|
29
34
|
export declare function renderMarkdown(flow: WorkerFlow, opts?: RenderOptions & {
|
|
30
35
|
readonly title?: string;
|
package/dist/render.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAOL,KAAK,WAAW,EAChB,KAAK,YAAY,EAGjB,KAAK,aAAa,EAEnB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AA4K5C;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,GAAE,aAAkB,GAAG,WAAW,CAGzF;AAeD,wBAAgB,aAAa,CAC3B,IAAI,EAAE,UAAU,EAChB,IAAI,GAAE,aAAkB,GACvB,MAAM,CAER;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,UAAU,EAChB,IAAI,GAAE,aAAkB,GACvB,YAAY,CAMd;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,UAAU,EAChB,IAAI,GAAE,aAAa,GAAG;IAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GACrD,MAAM,CAGR"}
|
package/dist/render.js
CHANGED
|
@@ -3,63 +3,50 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Thin by design. The emission rules live in `hexasync-template-model`'s `flowRender`, because AD-21 forbids the two
|
|
5
5
|
* flow packages importing each other and the shared half has to live somewhere neither owns. This file's whole job is
|
|
6
|
-
* to say what a WORKER node
|
|
7
|
-
*/
|
|
8
|
-
import { expandOccurrences, renderFlowMermaid, composeNodeLabelModel, classifyNodeTreatment, familyOfStepType, renderFlowMarkdown, UNMAPPED_STEP_ICON, } from '@beehexa/hexasync-template-model';
|
|
9
|
-
/**
|
|
10
|
-
* A node's label.
|
|
11
|
-
*
|
|
12
|
-
* A synthesised node reads as its own `label` — the condition, the expression, the unresolved target — which is why
|
|
13
|
-
* `FlowNode` carries one at all (Story 4.1 review, HIGH-3).
|
|
6
|
+
* to say what a WORKER node is — its name, key, type and icon family — and how stages become subgraphs.
|
|
14
7
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* the CLI report `["Get Sales Return Detail"]`, the extension `{"GET_…<br/>Get Sales Return Detail"}`.
|
|
18
|
-
*
|
|
19
|
-
* The shared composer uses Mermaid's markdown-string syntax for the approved wrapping card anatomy. Raw HTML remains
|
|
20
|
-
* forbidden: `flowRender` escapes authored text while preserving only the composer-owned bold heading and semantic
|
|
21
|
-
* row boundary.
|
|
8
|
+
* A synthesised node never carries the text that produced it: an `if` condition, a routing expression or an
|
|
9
|
+
* unresolvable route are step PAYLOAD, and the drawing names the junction by what it is instead.
|
|
22
10
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
11
|
+
import { compactFlowGraph, compactFlowMermaid, classifyNodeTreatment, familyOfStepType, renderFlowMarkdown, UNMAPPED_STEP_ICON, } from '@beehexa/hexasync-template-model';
|
|
12
|
+
/** A route target that is a plain step-key-like token, and therefore safe to name; anything else is payload. */
|
|
13
|
+
const KEY_LIKE = /^[A-Za-z0-9_.:!*-]{1,80}$/;
|
|
14
|
+
/** What a junction is called on the drawing — by its kind, never by the condition or expression it holds. */
|
|
15
|
+
function junctionName(node) {
|
|
16
|
+
switch (node.junction) {
|
|
17
|
+
case 'if':
|
|
18
|
+
// `routeGraph` names a SWITCH's junction with this constant; an IF's label is its (payload) condition.
|
|
19
|
+
return node.label === 'SWITCH' ? 'Switch' : 'If';
|
|
20
|
+
case 'expression':
|
|
21
|
+
return 'Route';
|
|
22
|
+
default: {
|
|
23
|
+
const target = node.label ?? '';
|
|
24
|
+
if (target.startsWith('cycle:'))
|
|
25
|
+
return 'Cycle';
|
|
26
|
+
return KEY_LIKE.test(target) ? target : 'Unresolved route';
|
|
27
|
+
}
|
|
35
28
|
}
|
|
36
|
-
return composeNodeLabelModel(node, fidelity, 'worker', iconFamily);
|
|
37
29
|
}
|
|
38
30
|
function renderNodeOf(node) {
|
|
39
31
|
const terminal = node.junction === 'unknown';
|
|
40
|
-
const treatment = classifyNodeTreatment({
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const strictLabel = labelOf(node, 'strict', iconFamily);
|
|
49
|
-
const looseLabel = labelOf(node, 'loose', iconFamily);
|
|
32
|
+
const treatment = classifyNodeTreatment({ type: node.type, decides: node.decides, terminal });
|
|
33
|
+
const iconFamily = node.junction === 'if'
|
|
34
|
+
? node.label === 'SWITCH' ? 'control.switch' : 'control.if'
|
|
35
|
+
: node.junction === 'expression'
|
|
36
|
+
? 'control.if'
|
|
37
|
+
: treatment === 'unimplemented' || node.junction !== undefined
|
|
38
|
+
? UNMAPPED_STEP_ICON.family
|
|
39
|
+
: familyOfStepType(node.type);
|
|
50
40
|
return {
|
|
51
41
|
address: node.address,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
looseLabelAnatomy: looseLabel.anatomy,
|
|
56
|
-
type: node.type,
|
|
42
|
+
name: node.junction === undefined ? (node.name ?? node.stepKey ?? '') : junctionName(node),
|
|
43
|
+
...(node.stepKey === undefined ? {} : { key: node.stepKey }),
|
|
44
|
+
...(node.type === undefined ? {} : { type: node.type }),
|
|
57
45
|
iconFamily,
|
|
58
46
|
decides: node.decides,
|
|
59
47
|
terminal,
|
|
60
48
|
};
|
|
61
49
|
}
|
|
62
|
-
/** Stages become subgraphs, in the order the model reports them. */
|
|
63
50
|
/**
|
|
64
51
|
* Stages become subgraphs — and a stage that drew NOTHING is omitted entirely (Story 4.3 review, HIGH-1).
|
|
65
52
|
*
|
|
@@ -68,17 +55,49 @@ function renderNodeOf(node) {
|
|
|
68
55
|
* / end`, and — because `firstOf` never got an entry — **every stage arrow touching it disappeared**, so the chart
|
|
69
56
|
* asserted the surviving stages were unrelated. Both authorities remove empty stages so their chain collapses instead.
|
|
70
57
|
*/
|
|
71
|
-
function groupsOf(flow) {
|
|
58
|
+
function groupsOf(flow, folded) {
|
|
72
59
|
return flow.stages
|
|
73
60
|
.map((stage) => ({
|
|
74
61
|
key: `${flow.address}:${stage.key}`,
|
|
75
62
|
title: stage.label,
|
|
76
63
|
nodes: flow.nodes
|
|
77
|
-
.filter((node) => node.stage === stage.key)
|
|
64
|
+
.filter((node) => node.stage === stage.key && !folded.has(node.address))
|
|
78
65
|
.map(renderNodeOf),
|
|
79
66
|
}))
|
|
80
67
|
.filter((group) => group.nodes.length > 0);
|
|
81
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* An IF/SWITCH step and the decision node synthesised for its own branch are ONE decision.
|
|
71
|
+
*
|
|
72
|
+
* The step is already drawn as a branch, so a junction whose owner is a branch step and is that step's only
|
|
73
|
+
* non-error route is folded into the step: its arms leave the step itself. Junction address → owner address. A nested
|
|
74
|
+
* `else: { if … }` keeps its own node — it is a second decision, entered from the first.
|
|
75
|
+
*/
|
|
76
|
+
function foldedJunctions(flow) {
|
|
77
|
+
const routesFrom = new Map();
|
|
78
|
+
for (const edge of flow.edges) {
|
|
79
|
+
if (edge.label !== undefined && Object.hasOwn(ERROR_LABELS, edge.label))
|
|
80
|
+
continue;
|
|
81
|
+
const targets = routesFrom.get(edge.from);
|
|
82
|
+
if (targets === undefined)
|
|
83
|
+
routesFrom.set(edge.from, [edge.to]);
|
|
84
|
+
else
|
|
85
|
+
targets.push(edge.to);
|
|
86
|
+
}
|
|
87
|
+
const byAddress = new Map(flow.nodes.map((node) => [node.address, node]));
|
|
88
|
+
const folded = new Map();
|
|
89
|
+
for (const node of flow.nodes) {
|
|
90
|
+
if (node.junction !== 'if' || node.owner === undefined)
|
|
91
|
+
continue;
|
|
92
|
+
const owner = byAddress.get(node.owner);
|
|
93
|
+
if (owner === undefined || classifyNodeTreatment({ type: owner.type, decides: owner.decides }) !== 'branch')
|
|
94
|
+
continue;
|
|
95
|
+
const routes = routesFrom.get(owner.address);
|
|
96
|
+
if (routes?.length === 1 && routes[0] === node.address)
|
|
97
|
+
folded.set(node.address, owner.address);
|
|
98
|
+
}
|
|
99
|
+
return folded;
|
|
100
|
+
}
|
|
82
101
|
/**
|
|
83
102
|
* Stage-to-stage arrows: **every terminal of the source stage → every ENTRY of the target**, which is the CLI's
|
|
84
103
|
* geometry and therefore the one the composition report must reproduce (Story 4.6).
|
|
@@ -147,41 +166,33 @@ function stageEdgesOf(flow) {
|
|
|
147
166
|
from: from.address,
|
|
148
167
|
to: entry.address,
|
|
149
168
|
...(edge.label !== undefined ? { label: edge.label } : {}),
|
|
169
|
+
kind: 'stage',
|
|
150
170
|
})));
|
|
151
171
|
});
|
|
152
172
|
}
|
|
173
|
+
/** Route labels that mean "on failure" — data on the edge, never a styling instruction. */
|
|
174
|
+
const ERROR_LABELS = { onError: true, Exception: true };
|
|
153
175
|
/**
|
|
154
|
-
* The
|
|
176
|
+
* The compact graph for one worker component — what a host embeds, hashes and draws.
|
|
155
177
|
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
* graph through it and neither has a run (FR40). It also has to be at this level and not deeper, because the graph a
|
|
159
|
-
* run expands is the one that includes this file's STAGE edges — a chain spliced in before those exist would leave the
|
|
160
|
-
* stage arrows pointing at the authored address instead of the first occurrence.
|
|
161
|
-
*
|
|
162
|
-
* With no plan this is the identity: the same arrays, the same options object, and therefore the same bytes.
|
|
178
|
+
* The occurrence expansion (a run's repeated steps) happens inside `compactFlowGraph`, AFTER the stage edges are
|
|
179
|
+
* added, so a chain spliced in for a run carries the stage arrows to its first occurrence.
|
|
163
180
|
*/
|
|
164
|
-
function
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
return {
|
|
180
|
-
groups: expansion.groups,
|
|
181
|
-
edges: expansion.edges,
|
|
182
|
-
opts: { ...rest, occurrenceOverlay: expansion.nodes },
|
|
183
|
-
collapsedRanges: expansion.collapsedRanges,
|
|
184
|
-
};
|
|
181
|
+
export function compactWorkerFlow(flow, opts = {}) {
|
|
182
|
+
const folded = foldedJunctions(flow);
|
|
183
|
+
return compactFlowGraph(groupsOf(flow, folded), edgesOf(flow, folded), opts);
|
|
184
|
+
}
|
|
185
|
+
/** Route edges tagged with their kind (arms of a folded junction leave its owner), then the stage arrows. */
|
|
186
|
+
function edgesOf(flow, folded) {
|
|
187
|
+
const routes = flow.edges
|
|
188
|
+
.filter((edge) => !folded.has(edge.to))
|
|
189
|
+
.map((edge) => ({
|
|
190
|
+
from: folded.get(edge.from) ?? edge.from,
|
|
191
|
+
to: edge.to,
|
|
192
|
+
...(edge.label === undefined ? {} : { label: edge.label }),
|
|
193
|
+
...(edge.label !== undefined && Object.hasOwn(ERROR_LABELS, edge.label) ? { kind: 'error' } : {}),
|
|
194
|
+
}));
|
|
195
|
+
return [...routes, ...stageEdgesOf(flow)];
|
|
185
196
|
}
|
|
186
197
|
export function renderMermaid(flow, opts = {}) {
|
|
187
198
|
return renderMermaidWithOccurrences(flow, opts).definition;
|
|
@@ -193,27 +204,21 @@ export function renderMermaid(flow, opts = {}) {
|
|
|
193
204
|
* `clickableNodeIds`, and that set is not recoverable from the definition string without re-deriving the drawing.
|
|
194
205
|
*/
|
|
195
206
|
export function renderMermaidWithOccurrences(flow, opts = {}) {
|
|
196
|
-
const
|
|
207
|
+
const compact = compactWorkerFlow(flow, opts);
|
|
197
208
|
return {
|
|
198
|
-
definition:
|
|
199
|
-
collapsedRanges:
|
|
209
|
+
definition: compactFlowMermaid(compact.graph, opts.direction),
|
|
210
|
+
collapsedRanges: compact.collapsedRanges,
|
|
200
211
|
};
|
|
201
212
|
}
|
|
202
213
|
/**
|
|
203
214
|
* Markdown for one component — `(flow, opts)`, matching the frontend twin and `PACKAGE-CONTRACT.md` §5.
|
|
204
215
|
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
* slot and it reached `escapeLabel`: **`TypeError: value.replace is not a function`**. TypeScript caught it for TS
|
|
208
|
-
* consumers; JS consumers and the "one renderer set, callable uniformly" premise did not.
|
|
209
|
-
*
|
|
210
|
-
* The title now comes from the model, which has everything needed: the collection and the component's authored id. A
|
|
211
|
-
* caller wanting its own wording passes `title`.
|
|
216
|
+
* The title comes from the model (the collection and the component's authored id); a caller wanting its own wording
|
|
217
|
+
* passes `title`.
|
|
212
218
|
*/
|
|
213
219
|
export function renderMarkdown(flow, opts = {}) {
|
|
214
|
-
const
|
|
215
|
-
|
|
216
|
-
return renderFlowMarkdown(title, expanded.groups, expanded.edges, expanded.opts);
|
|
220
|
+
const folded = foldedJunctions(flow);
|
|
221
|
+
return renderFlowMarkdown(opts.title ?? titleOf(flow), groupsOf(flow, folded), edgesOf(flow, folded), opts);
|
|
217
222
|
}
|
|
218
223
|
/**
|
|
219
224
|
* A default title from the model.
|
package/dist/render.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,GAOnB,MAAM,kCAAkC,CAAC;AAG1C,gHAAgH;AAChH,MAAM,QAAQ,GAAG,2BAA2B,CAAC;AAE7C,6GAA6G;AAC7G,SAAS,YAAY,CAAC,IAAiC;IACrD,QAAQ,IAAI,CAAC,QAAQ,EAAE,CAAC;QACtB,KAAK,IAAI;YACP,uGAAuG;YACvG,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;QACnD,KAAK,YAAY;YACf,OAAO,OAAO,CAAC;QACjB,SAAS,CAAC;YACR,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;YAChC,IAAI,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC;gBAAE,OAAO,OAAO,CAAC;YAChD,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,kBAAkB,CAAC;QAC7D,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CAAC,IAAiC;IACrD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,KAAK,SAAS,CAAC;IAC7C,MAAM,SAAS,GAAG,qBAAqB,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,EA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|
|
3
|
-
"version": "2610.12.
|
|
3
|
+
"version": "2610.12.3",
|
|
4
4
|
"description": "The flow model for a worker component — pullers and pushers, computed once for every consumer.",
|
|
5
5
|
"license": "SEE LICENSE IN ../../LICENSE",
|
|
6
6
|
"type": "module",
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
"dist"
|
|
17
17
|
],
|
|
18
18
|
"scripts": {
|
|
19
|
-
"typecheck": "tsc --noEmit",
|
|
20
|
-
"build": "tsc -p tsconfig.build.json"
|
|
19
|
+
"typecheck": "yarn run -T tsc --noEmit",
|
|
20
|
+
"build": "yarn run -T tsc -p tsconfig.build.json"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@beehexa/hexasync-template-model": "2610.12.
|
|
23
|
+
"@beehexa/hexasync-template-model": "2610.12.3"
|
|
24
24
|
},
|
|
25
25
|
"publishConfig": {
|
|
26
26
|
"access": "public"
|