@opsydyn/foldkit-zloz-mermaid 0.0.0-stage → 0.3.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 ADDED
@@ -0,0 +1,30 @@
1
+ # Changelog
2
+
3
+ ## [0.3.0](https://github.com/opsydyn/fold-kit-experiments/compare/foldkit-zloz-mermaid-v0.2.0...foldkit-zloz-mermaid-v0.3.0) (2026-11-10)
4
+
5
+ ### Features
6
+
7
+ - **zloz:** add architecture modelling, edition review and portable packets ([2e66a84](https://github.com/opsydyn/fold-kit-experiments/commit/2e66a8480cce21cca285ba97a8092f5971eeadbb))
8
+ - **zloz:** add event-storming notes and composable process presets ([5d10abe](https://github.com/opsydyn/fold-kit-experiments/commit/5d10abe24e92bc4ef420edc15d009d844dc56f55))
9
+ - **zloz:** export portable architecture review packets ([1653ea5](https://github.com/opsydyn/fold-kit-experiments/commit/1653ea5c4ccb8be2d9ea7cccf28eec18fecbf52c))
10
+ - **zloz:** type event-storming causal relationships ([6eabc9a](https://github.com/opsydyn/fold-kit-experiments/commit/6eabc9a4c54e8fc2b0468bbdc21aa863f9fb3e4e))
11
+
12
+ ## [0.2.0](https://github.com/opsydyn/fold-kit-experiments/compare/foldkit-zloz-mermaid-v0.1.1...foldkit-zloz-mermaid-v0.2.0) (2026-11-09)
13
+
14
+ ### Miscellaneous Chores
15
+
16
+ - **foldkit-zloz-mermaid:** Synchronize foldkit-zloz versions
17
+
18
+ ## [0.1.1](https://github.com/opsydyn/fold-kit-experiments/compare/foldkit-zloz-mermaid-v0.1.0...foldkit-zloz-mermaid-v0.1.1) (2026-11-09)
19
+
20
+ ### Miscellaneous Chores
21
+
22
+ - **foldkit-zloz-mermaid:** Synchronize foldkit-zloz versions
23
+
24
+ ## 0.1.0
25
+
26
+ Added nested subgraph export and additive group/membership identity metadata.
27
+ Empty groups remain rejected explicitly.
28
+
29
+ Initial local release candidate: pure, opt-in Mermaid flowchart export with
30
+ versioned loss diagnostics and explicit identity metadata. Publication pending.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Alan P Currie
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,149 @@
1
- # Temporary Holding Version
1
+ # Foldkit Zloz Mermaid
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Optional, pure Mermaid flowchart export. No Mermaid parser, renderer, browser,
4
+ FoldKit or Effect dependency is installed. Requires the matching Zloz core peer.
5
+ Version 0.2.0 is a local release candidate; npm publication has not been performed.
6
+
7
+ After publication:
8
+
9
+ ```sh
10
+ npm install @opsydyn/foldkit-zloz @opsydyn/foldkit-zloz-mermaid
11
+ ```
12
+
13
+ In this checkout, use workspace links or the tarballs produced by `pack:check`.
14
+
15
+ ```ts
16
+ import { exportMermaid } from '@opsydyn/foldkit-zloz-mermaid';
17
+
18
+ const result = exportMermaid(graph); // default: reject any conversion loss
19
+ if (result.status === 'rejected') {
20
+ // Present result.diagnostics before requesting explicit loss consent.
21
+ }
22
+ const projection = exportMermaid(graph, { direction: 'LR', lossPolicy: 'report' });
23
+ if (projection.status === 'converted') {
24
+ const bundle = projection.value;
25
+ // Host owns persistence/download. Keep the complete bundle with its source.
26
+ console.log(bundle.source, bundle.identity, bundle.diagnostics);
27
+ }
28
+ ```
29
+
30
+ `exportMermaid` is synchronous, performs no I/O and does not mutate input. Invalid
31
+ graphs/options return structured rejection. A rejection never contains a partial
32
+ bundle. `report` permits losses, never errors. Every result and bundle carries
33
+ `protocol: 'foldkit-flow-mermaid/v1'`. Source is bounded at 32768 UTF-16 code units;
34
+ `mermaidSourceLimit` exposes that bound.
35
+
36
+ ## Type contract
37
+
38
+ - `MermaidExportOptions`: optional direction (`LR | RL | TB | BT`) and loss policy
39
+ (`reject | report`). Defaults: LR and reject.
40
+ - `MermaidExportResult`: discriminated `converted` with `value: MermaidBundle`,
41
+ or `rejected` with diagnostics and no value. Both carry protocol and diagnostics.
42
+ - `MermaidBundle`: protocol, source, direction, identity and diagnostics. It is a
43
+ JSON-compatible projection, not canonical Zloz JSON.
44
+ - `MermaidIdentity`: version 1 node aliases/original IDs/port IDs and kinds, plus
45
+ named edge aliases/original IDs/endpoints. Optional `kind: 'group'` and `parentId`
46
+ preserve group role and original Zloz parent IDs; flat v1 entries are unchanged.
47
+ Contains no hidden full graph.
48
+ - `MermaidDiagnostic`: typed code, severity (`loss | error`), dimension
49
+ (`syntax | semantics | identity | layout`), message and nullable subject ID.
50
+ - `MermaidDiagnosticCode`: invalid-graph, invalid-options, unsupported-subgraph,
51
+ unsupported-label-encoding, source-limit, node-fields-omitted,
52
+ edge-fields-omitted, port-details-omitted, group-presentation-omitted,
53
+ layout-omitted, identity-map-required.
54
+
55
+ Keep the complete bundle: source uses deterministic aliases and explicit named
56
+ edges, so source alone cannot preserve arbitrary Zloz/port identities. Identity
57
+ metadata is versioned for future interoperability; this package does not yet
58
+ provide an importer, bundle decoder or a restore operation.
59
+
60
+ ## Fidelity
61
+
62
+ Literal text/Unicode, rectangle/rounded-rectangle/cylinder outlines, directed
63
+ named edges, parallel edges, cycles and self-loops are supported. Labels are
64
+ quoted and special characters encoded as decimal entities. Icon-like `fa:` text,
65
+ empty labels, unsupported control characters and malformed Unicode labels reject. Non-empty groups export as nested named subgraphs. Empty groups reject rather
66
+ than disappearing or becoming invented nodes. Group outline presentation is a
67
+ reported loss; cross-boundary edges retain their ordinary child endpoints. Mermaid 12.3.0 is the independently qualified syntax target.
68
+
69
+ Layout/dimensions, port geometry/labels/order, architecture semantics, host data,
70
+ edge presentation and other authored fields are reported as omitted. Port IDs
71
+ and kinds remain in bundle metadata, not in Mermaid syntax. C4/DDD semantic
72
+ roles are not converted into equivalent Mermaid architecture notation. Treat
73
+ Zloz JSON as authoritative. The workbench exposes source preview, loss consent
74
+ scoped to the current revision and complete-bundle download.
75
+
76
+ ## Verify locally
77
+
78
+ ```sh
79
+ bun run --filter @opsydyn/foldkit-zloz-mermaid test
80
+ bun run --filter @opsydyn/foldkit-zloz-mermaid typecheck
81
+ bun run --filter @opsydyn/foldkit-zloz-mermaid pack:check
82
+ ```
83
+
84
+ The packed-consumer test installs only the core and exporter into a temporary
85
+ npm project and checks TypeScript Bundler/NodeNext plus Node/Bun execution.
86
+ See [ADR 0008](https://github.com/opsydyn/fold-kit-experiments/blob/main/docs/adr/0008-export-mermaid-through-an-optional-package.md).
87
+
88
+ ## Portable review packets
89
+
90
+ `createReviewPacket` composes the core edition audit and both Mermaid projections
91
+ without I/O, clocks, generated IDs or editor state:
92
+
93
+ ```ts
94
+ import { createReviewPacket } from '@opsydyn/foldkit-zloz-mermaid';
95
+
96
+ const result = createReviewPacket(
97
+ document,
98
+ { baselineId: 'before', selectedId: 'after' }, // Omit selectedId for current graph.
99
+ { direction: 'LR', lossPolicy: 'report', rules: conventions },
100
+ );
101
+ if (result.status === 'created') {
102
+ const packet = result.value;
103
+ // Host owns download/storage. Keep the complete JSON, not only the Mermaid source.
104
+ console.log(JSON.stringify(packet));
105
+ } else {
106
+ console.log(result.reason, result.diagnostics);
107
+ }
108
+ ```
109
+
110
+ A packet has `format: 'foldkit-zloz-review'`, `version: 1` and
111
+ `scope: 'selected-snapshots'`. Its public `ZlozReviewPacket` contract contains:
112
+
113
+ - `model`: model ID and name.
114
+ - `baseline` and `selected`: explicit source references and complete detached
115
+ canonical snapshots, including authored graph data and any camera.
116
+ - `conventions`: builtin/custom provenance, the complete rule catalogue and
117
+ `roleInterpretation: 'zloz-event-storming/v1'`. It contains no file paths or
118
+ executable callbacks; exported rules reproduce the audit independently of
119
+ future default catalogues. Rules replace defaults when supplied.
120
+ - `comparison`: both audits, introduced/resolved/persisting findings and counts.
121
+ - `projectionOptions`, `projections.baseline` and `projections.selected`: chosen
122
+ direction/loss policy and full Mermaid bundles with original-ID metadata.
123
+ - `diagnostics`: conversion losses/errors scoped to `baseline`, `selected` or
124
+ `packet`. Semantic findings remain in `comparison`.
125
+
126
+ Only the chosen snapshots travel. Unrelated editions, origin/lineage, working
127
+ editor/Undo and host file paths are outside the packet. This export preserves
128
+ chosen authored data; it is not a backup of the entire model or a packet import
129
+ API. Save the full JSON to retain semantic metadata omitted from Mermaid.
130
+
131
+ Projection losses **reject by default**, even when canonical data is retained
132
+ elsewhere in the packet. `report` explicitly consents to Mermaid omissions on
133
+ both sides; it never permits errors. Camera omission is reported per side. Either
134
+ side failing rejects the whole export with no partial packet. The existing label,
135
+ source-size, nested-subgraph, alias and identity contracts apply unchanged.
136
+
137
+ A created packet can contain newly introduced audit findings: successful artifact
138
+ creation does not mean a compatible model. Selector/options failures return
139
+ `{ status: 'rejected', reason: 'input', diagnostics }`; conversion failures use
140
+ `reason: 'projection'`. Malformed canonical models or semantically invalid rule
141
+ catalogues throw the existing core validation error. Core remains the authority
142
+ for rules and model validation. Unknown option/rule fields and callback-based
143
+ interpretation reject; use core directly for nonportable `roleOf` customization.
144
+
145
+ The package additionally exports `ZlozReviewPacketOptions`,
146
+ `ZlozReviewPacketDiagnostic`, `ZlozReviewSnapshot` and `ZlozReviewPacketResult`.
147
+ Packet JSON round-trip tests reproduce its audit using only the chosen snapshots
148
+ and exported rules. The optional adapter still installs no Effect, Foldkit,
149
+ Mermaid parser, browser or layout engine. See [ADR 0035](../../docs/adr/0035-export-portable-review-packets.md).
@@ -0,0 +1,6 @@
1
+ # Third-party notices
2
+
3
+ This package uses the public `@opsydyn/foldkit-zloz` peer, distributed separately
4
+ under its MIT licence. No Mermaid/parser code is copied or bundled. This
5
+ exporter's source is MIT licensed. The independent qualification harness uses
6
+ Mermaid under its own licence; it is not part of this npm artifact.
@@ -0,0 +1,126 @@
1
+ import { ZlozEventStormingRelationshipRule, ZlozGraph, ZlozModelDocument, ZlozRelationshipAuditComparison, ZlozRelationshipAuditSelection, ZlozRelationshipAuditSource, ZlozSnapshot } from "@opsydyn/foldkit-zloz";
2
+
3
+ //#region src/export-mermaid.d.ts
4
+ declare const mermaidProtocol = "foldkit-flow-mermaid/v1";
5
+ /** Maximum generated source size, in UTF-16 code units. */
6
+ declare const mermaidSourceLimit = 32768;
7
+ type MermaidDirection = 'LR' | 'RL' | 'TB' | 'BT';
8
+ type MermaidLossPolicy = 'reject' | 'report';
9
+ type MermaidDiagnosticCode = 'invalid-graph' | 'invalid-options' | 'unsupported-subgraph' | 'group-presentation-omitted' | 'unsupported-label-encoding' | 'source-limit' | 'node-fields-omitted' | 'edge-fields-omitted' | 'port-details-omitted' | 'layout-omitted' | 'identity-map-required';
10
+ type MermaidDiagnostic = Readonly<{
11
+ code: MermaidDiagnosticCode;
12
+ severity: 'loss' | 'error';
13
+ dimension: 'syntax' | 'semantics' | 'identity' | 'layout';
14
+ message: string;
15
+ subject: string | null;
16
+ }>;
17
+ type MermaidIdentity = Readonly<{
18
+ version: 1;
19
+ nodes: readonly Readonly<{
20
+ mermaidId: string;
21
+ flowId: string; /** Present for group entries; flat v1 entries are unchanged. */
22
+ kind?: 'group'; /** Original Zloz parent group ID, never a Mermaid alias. */
23
+ parentId?: string;
24
+ ports: readonly Readonly<{
25
+ id: string;
26
+ kind: 'input' | 'output';
27
+ }>[];
28
+ }>[];
29
+ edges: readonly Readonly<{
30
+ mermaidId: string;
31
+ flowId: string;
32
+ sourceNode: string;
33
+ sourcePort: string;
34
+ targetNode: string;
35
+ targetPort: string;
36
+ }>[];
37
+ }>;
38
+ /** A projection, not a substitute for canonical Zloz JSON. No full graph is hidden in identity. */
39
+ type MermaidBundle = Readonly<{
40
+ protocol: typeof mermaidProtocol;
41
+ source: string;
42
+ direction: MermaidDirection;
43
+ identity: MermaidIdentity;
44
+ diagnostics: readonly MermaidDiagnostic[];
45
+ }>;
46
+ type MermaidExportOptions = Readonly<{
47
+ direction?: MermaidDirection;
48
+ lossPolicy?: MermaidLossPolicy;
49
+ }>;
50
+ type MermaidExportResult = Readonly<{
51
+ protocol: typeof mermaidProtocol;
52
+ status: 'converted';
53
+ value: MermaidBundle;
54
+ diagnostics: readonly MermaidDiagnostic[];
55
+ }> | Readonly<{
56
+ protocol: typeof mermaidProtocol;
57
+ status: 'rejected';
58
+ diagnostics: readonly MermaidDiagnostic[];
59
+ }>;
60
+ /**
61
+ * Export the qualified flowchart subset without changing the graph or performing I/O.
62
+ * Losses reject by default. `report` consents to omitted fields, never to errors.
63
+ * Keep the bundle's identity metadata with source; source alone contains safe aliases.
64
+ */
65
+ declare function exportMermaid(graph: ZlozGraph, options?: MermaidExportOptions): MermaidExportResult;
66
+ //#endregion
67
+ //#region src/review-packet.d.ts
68
+ type ZlozReviewPacketOptions = MermaidExportOptions & Readonly<{
69
+ /** Complete replacement catalogue. Packet interpretation is deliberately data-only. */rules?: readonly ZlozEventStormingRelationshipRule[];
70
+ }>;
71
+ type ZlozReviewPacketDiagnostic = Readonly<{
72
+ side: 'packet' | 'baseline' | 'selected';
73
+ code: MermaidDiagnostic['code'] | 'invalid-options' | 'unknown-baseline' | 'unknown-edition' | 'viewport-omitted';
74
+ severity: 'error' | 'loss';
75
+ dimension: MermaidDiagnostic['dimension'];
76
+ message: string;
77
+ subject: string | null;
78
+ }>;
79
+ type ZlozReviewSnapshot = Readonly<{
80
+ source: ZlozRelationshipAuditSource;
81
+ snapshot: ZlozSnapshot;
82
+ }>;
83
+ type ZlozReviewPacket = Readonly<{
84
+ format: 'foldkit-zloz-review';
85
+ version: 1;
86
+ scope: 'selected-snapshots';
87
+ model: Readonly<{
88
+ id: string;
89
+ name: string;
90
+ }>;
91
+ baseline: Readonly<{
92
+ source: Extract<ZlozRelationshipAuditSource, {
93
+ kind: 'edition';
94
+ }>;
95
+ snapshot: ZlozSnapshot;
96
+ }>;
97
+ selected: ZlozReviewSnapshot;
98
+ conventions: Readonly<{
99
+ source: 'builtin' | 'custom';
100
+ roleInterpretation: 'zloz-event-storming/v1';
101
+ rules: readonly ZlozEventStormingRelationshipRule[];
102
+ }>;
103
+ comparison: ZlozRelationshipAuditComparison;
104
+ projectionOptions: Readonly<Required<MermaidExportOptions>>;
105
+ projections: Readonly<{
106
+ baseline: MermaidBundle;
107
+ selected: MermaidBundle;
108
+ }>;
109
+ diagnostics: readonly ZlozReviewPacketDiagnostic[];
110
+ }>;
111
+ type ZlozReviewPacketResult = Readonly<{
112
+ status: 'created';
113
+ value: ZlozReviewPacket;
114
+ diagnostics: readonly ZlozReviewPacketDiagnostic[];
115
+ }> | Readonly<{
116
+ status: 'rejected';
117
+ reason: 'input' | 'projection';
118
+ diagnostics: readonly ZlozReviewPacketDiagnostic[];
119
+ }>;
120
+ /** ADR-0035: Data-only composition in the optional adapter; no I/O, clocks, imports or graph writes.
121
+ * Invalid model/rule data throws at the existing core validation boundary. Selector/options and
122
+ * projection failures return rejected results. Created packets may contain introduced audit findings. */
123
+ declare function createReviewPacket(document: ZlozModelDocument, selection: ZlozRelationshipAuditSelection, options?: ZlozReviewPacketOptions): ZlozReviewPacketResult;
124
+ //#endregion
125
+ export { MermaidBundle, MermaidDiagnostic, MermaidDiagnosticCode, MermaidDirection, MermaidExportOptions, MermaidExportResult, MermaidIdentity, MermaidLossPolicy, type ZlozReviewPacket, type ZlozReviewPacketDiagnostic, type ZlozReviewPacketOptions, type ZlozReviewPacketResult, type ZlozReviewSnapshot, createReviewPacket, exportMermaid, mermaidProtocol, mermaidSourceLimit };
126
+ //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs ADDED
@@ -0,0 +1,322 @@
1
+ import { auditEventStormingRelationships, captureModelDocument, compareModelEventStormingRelationships, eventStormingRelationshipRules, isEdgeArchitecture, validateGraph } from "@opsydyn/foldkit-zloz";
2
+ //#region src/export-mermaid.ts
3
+ /**
4
+ * Pure Mermaid projections with identity metadata and explicit conversion losses.
5
+ * @module Mermaid
6
+ */
7
+ const mermaidProtocol = "foldkit-flow-mermaid/v1";
8
+ /** Maximum generated source size, in UTF-16 code units. */
9
+ const mermaidSourceLimit = 32768;
10
+ function diagnostic(code, severity, dimension, message, subject = null) {
11
+ return {
12
+ code,
13
+ severity,
14
+ dimension,
15
+ message,
16
+ subject
17
+ };
18
+ }
19
+ function rejected(diagnostics) {
20
+ return {
21
+ protocol: mermaidProtocol,
22
+ status: "rejected",
23
+ diagnostics
24
+ };
25
+ }
26
+ /** Injective alias over Unicode code points; IDs never become Mermaid keywords or markup. */
27
+ function alias(prefix, id) {
28
+ return `${prefix}_${[...id].map((char) => char.codePointAt(0).toString(16)).join("_")}`;
29
+ }
30
+ function unsupportedLabel(text) {
31
+ return text.length === 0 || text.includes("fa:") || [...text].some((char) => {
32
+ const point = char.codePointAt(0);
33
+ return point < 32 && point !== 9 && point !== 10 && point !== 13 || point === 127 || point >= 55296 && point <= 57343;
34
+ });
35
+ }
36
+ function label(text) {
37
+ return "\"" + [...text].map((char) => "\"&#<>|\\`\n\r".includes(char) ? `#${char.codePointAt(0)};` : char).join("") + "\"";
38
+ }
39
+ function isOptions(value) {
40
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
41
+ return (!("direction" in value) || value.direction === void 0 || typeof value.direction === "string" && [
42
+ "LR",
43
+ "RL",
44
+ "TB",
45
+ "BT"
46
+ ].includes(value.direction)) && (!("lossPolicy" in value) || value.lossPolicy === void 0 || value.lossPolicy === "reject" || value.lossPolicy === "report");
47
+ }
48
+ /**
49
+ * Export the qualified flowchart subset without changing the graph or performing I/O.
50
+ * Losses reject by default. `report` consents to omitted fields, never to errors.
51
+ * Keep the bundle's identity metadata with source; source alone contains safe aliases.
52
+ */
53
+ function exportMermaid(graph, options = {}) {
54
+ try {
55
+ validateGraph(graph);
56
+ } catch (error) {
57
+ return rejected([diagnostic("invalid-graph", "error", "semantics", error instanceof Error ? error.message : "Invalid Zloz graph.")]);
58
+ }
59
+ if (!isOptions(options)) return rejected([diagnostic("invalid-options", "error", "syntax", "Unknown direction or loss policy.")]);
60
+ const direction = options.direction ?? "LR";
61
+ const policy = options.lossPolicy ?? "reject";
62
+ const children = /* @__PURE__ */ new Map();
63
+ for (const node of graph.nodes) {
64
+ const siblings = children.get(node.parentId) ?? [];
65
+ siblings.push(node);
66
+ children.set(node.parentId, siblings);
67
+ }
68
+ if (graph.nodes.some((node) => node.kind === "group" && !children.has(node.id))) return rejected([diagnostic("unsupported-subgraph", "error", "semantics", "Empty groups have no reliable visible Mermaid boundary; export does not invent placeholder nodes.")]);
69
+ const diagnostics = [];
70
+ const identity = {
71
+ version: 1,
72
+ nodes: graph.nodes.map((node) => {
73
+ const entry = {
74
+ mermaidId: alias("n", node.id),
75
+ flowId: node.id,
76
+ ports: node.ports.map(({ id, kind }) => ({
77
+ id,
78
+ kind
79
+ }))
80
+ };
81
+ const nested = node.parentId === void 0 ? entry : {
82
+ ...entry,
83
+ parentId: node.parentId
84
+ };
85
+ return node.kind === "group" ? {
86
+ ...nested,
87
+ kind: "group"
88
+ } : nested;
89
+ }),
90
+ edges: graph.edges.map((edge) => ({
91
+ mermaidId: alias("e", edge.id),
92
+ flowId: edge.id,
93
+ sourceNode: alias("n", edge.source.node),
94
+ sourcePort: edge.source.port,
95
+ targetNode: alias("n", edge.target.node),
96
+ targetPort: edge.target.port
97
+ }))
98
+ };
99
+ const declarations = /* @__PURE__ */ new Map();
100
+ const nodeFields = new Set([
101
+ "id",
102
+ "label",
103
+ "position",
104
+ "size",
105
+ "ports",
106
+ "appearance",
107
+ "kind",
108
+ "parentId"
109
+ ]);
110
+ const edgeFields = new Set([
111
+ "id",
112
+ "source",
113
+ "target",
114
+ "label"
115
+ ]);
116
+ for (const node of graph.nodes) {
117
+ const omitted = Object.keys(node).filter((key) => !nodeFields.has(key));
118
+ if (omitted.length) diagnostics.push(diagnostic("node-fields-omitted", "loss", "semantics", `Not represented: ${omitted.join(", ")}.`, node.id));
119
+ if (node.ports.length) diagnostics.push(diagnostic("port-details-omitted", "loss", "layout", "Port IDs/kinds remain in identity metadata. Port labels, ordering, offsets and anchors are omitted from source.", node.id));
120
+ if (unsupportedLabel(node.label)) diagnostics.push(diagnostic("unsupported-label-encoding", "error", "semantics", "Empty, icon-like, control or invalid Unicode labels are outside the qualified literal-text subset.", node.id));
121
+ const text = label(node.label), shape = node.appearance?.shape ?? "rectangle";
122
+ if (node.kind === "group") {
123
+ declarations.set(node.id, `subgraph ${alias("n", node.id)}[${text}]`);
124
+ if (node.appearance !== void 0) diagnostics.push(diagnostic("group-presentation-omitted", "loss", "layout", "Subgraph boundaries do not retain authored node outline choice.", node.id));
125
+ } else declarations.set(node.id, `${alias("n", node.id)}${shape === "cylinder" ? `[(${text})]` : shape === "rounded-rectangle" ? `(${text})` : `[${text}]`}`);
126
+ }
127
+ const lines = [`flowchart ${direction}`];
128
+ let length = lines[0].length + 1;
129
+ const stack = [...children.get(void 0) ?? []].reverse().map((node) => ({
130
+ node,
131
+ depth: 1
132
+ }));
133
+ while (stack.length) {
134
+ const entry = stack.pop();
135
+ const text = "node" in entry ? declarations.get(entry.node.id) : "end";
136
+ length += entry.depth * 2 + text.length + 1;
137
+ if (length > 32768) return rejected([...diagnostics, diagnostic("source-limit", "error", "syntax", "Generated source exceeds 32768 UTF-16 code units.")]);
138
+ lines.push(" ".repeat(entry.depth) + text);
139
+ if ("node" in entry && entry.node.kind === "group") {
140
+ stack.push({ depth: entry.depth });
141
+ for (const node of [...children.get(entry.node.id) ?? []].reverse()) stack.push({
142
+ node,
143
+ depth: entry.depth + 1
144
+ });
145
+ }
146
+ }
147
+ for (const edge of graph.edges) {
148
+ const omitted = Object.keys(edge).filter((key) => !edgeFields.has(key));
149
+ if (omitted.length) diagnostics.push(diagnostic("edge-fields-omitted", "loss", "semantics", `Not represented: ${omitted.join(", ")}.`, edge.id));
150
+ if (edge.label !== void 0 && unsupportedLabel(edge.label)) diagnostics.push(diagnostic("unsupported-label-encoding", "error", "semantics", "Empty, icon-like, control or invalid Unicode labels are outside the qualified literal-text subset.", edge.id));
151
+ lines.push(` ${alias("n", edge.source.node)} ${alias("e", edge.id)}@-->${edge.label === void 0 ? "" : `|${label(edge.label)}|`} ${alias("n", edge.target.node)}`);
152
+ }
153
+ if (graph.nodes.length) {
154
+ diagnostics.push(diagnostic("layout-omitted", "loss", "layout", "Authored positions and dimensions are not represented; Mermaid chooses layout."));
155
+ diagnostics.push(diagnostic("identity-map-required", "loss", "identity", "Source uses safe aliases. Keep the bundle identity metadata to retain original node, edge and port IDs."));
156
+ }
157
+ const source = lines.join("\n") + "\n";
158
+ if (source.length > 32768) diagnostics.push(diagnostic("source-limit", "error", "syntax", "Generated source exceeds 32768 UTF-16 code units."));
159
+ if (diagnostics.some((item) => item.severity === "error" || policy === "reject" && item.severity === "loss")) return rejected(diagnostics);
160
+ return {
161
+ protocol: mermaidProtocol,
162
+ status: "converted",
163
+ value: {
164
+ protocol: mermaidProtocol,
165
+ source,
166
+ direction,
167
+ identity,
168
+ diagnostics
169
+ },
170
+ diagnostics
171
+ };
172
+ }
173
+ //#endregion
174
+ //#region src/review-packet.ts
175
+ const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
176
+ const isString = (value) => typeof value === "string";
177
+ function isDataRule(value) {
178
+ return isRecord(value) && Object.keys(value).every((key) => [
179
+ "architecture",
180
+ "sources",
181
+ "targets",
182
+ "label"
183
+ ].includes(key)) && isEdgeArchitecture(value.architecture) && typeof value.label === "string" && Array.isArray(value.sources) && value.sources.every(isString) && Array.isArray(value.targets) && value.targets.every(isString);
184
+ }
185
+ function isReviewPacketOptions(value) {
186
+ return isRecord(value) && Object.keys(value).every((key) => [
187
+ "direction",
188
+ "lossPolicy",
189
+ "rules"
190
+ ].includes(key)) && (value.direction === void 0 || typeof value.direction === "string" && [
191
+ "LR",
192
+ "RL",
193
+ "TB",
194
+ "BT"
195
+ ].includes(value.direction)) && (value.lossPolicy === void 0 || value.lossPolicy === "reject" || value.lossPolicy === "report") && (value.rules === void 0 || Array.isArray(value.rules) && value.rules.every(isDataRule));
196
+ }
197
+ function projection(side, snapshot, options) {
198
+ const result = exportMermaid(snapshot.graph, options);
199
+ return {
200
+ result,
201
+ diagnostics: [...result.diagnostics.map((item) => ({
202
+ ...item,
203
+ side
204
+ })), ...snapshot.viewport ? [{
205
+ side,
206
+ code: "viewport-omitted",
207
+ severity: "loss",
208
+ dimension: "layout",
209
+ subject: null,
210
+ message: "The snapshot camera is retained in the packet but omitted from its Mermaid projection."
211
+ }] : []]
212
+ };
213
+ }
214
+ /** ADR-0035: Data-only composition in the optional adapter; no I/O, clocks, imports or graph writes.
215
+ * Invalid model/rule data throws at the existing core validation boundary. Selector/options and
216
+ * projection failures return rejected results. Created packets may contain introduced audit findings. */
217
+ function createReviewPacket(document, selection, options = {}) {
218
+ if (!isReviewPacketOptions(options)) return {
219
+ status: "rejected",
220
+ reason: "input",
221
+ diagnostics: [{
222
+ side: "packet",
223
+ code: "invalid-options",
224
+ severity: "error",
225
+ dimension: "semantics",
226
+ subject: null,
227
+ message: "Review packets accept only direction, lossPolicy and data-only relationship rules; callbacks and unknown fields are not portable."
228
+ }]
229
+ };
230
+ const model = captureModelDocument(document);
231
+ const rules = (options.rules ?? eventStormingRelationshipRules).map((item) => ({
232
+ architecture: { ...item.architecture },
233
+ sources: [...item.sources],
234
+ targets: [...item.targets],
235
+ label: item.label
236
+ }));
237
+ auditEventStormingRelationships({
238
+ nodes: [],
239
+ edges: []
240
+ }, { rules });
241
+ const result = compareModelEventStormingRelationships(model, selection, { rules });
242
+ if (result.type === "blocked") return {
243
+ status: "rejected",
244
+ reason: "input",
245
+ diagnostics: [{
246
+ side: "packet",
247
+ code: result.code,
248
+ severity: "error",
249
+ dimension: "identity",
250
+ subject: result.editionId,
251
+ message: result.reason
252
+ }]
253
+ };
254
+ const baseline = model.editions.find((edition) => edition.id === selection.baselineId);
255
+ const selected = selection.selectedId === void 0 ? null : model.editions.find((edition) => edition.id === selection.selectedId);
256
+ if (!baseline || selected === void 0) return {
257
+ status: "rejected",
258
+ reason: "input",
259
+ diagnostics: [{
260
+ side: "packet",
261
+ code: "unknown-edition",
262
+ severity: "error",
263
+ dimension: "identity",
264
+ subject: selection.selectedId ?? selection.baselineId,
265
+ message: "The chosen review snapshot is unavailable."
266
+ }]
267
+ };
268
+ const before = baseline.snapshot, after = selected?.snapshot ?? model.snapshot;
269
+ const projectionOptions = {
270
+ direction: options.direction ?? "LR",
271
+ lossPolicy: options.lossPolicy ?? "reject"
272
+ };
273
+ const beforeProjection = projection("baseline", before, projectionOptions);
274
+ const afterProjection = projection("selected", after, projectionOptions);
275
+ const diagnostics = [...beforeProjection.diagnostics, ...afterProjection.diagnostics];
276
+ if (beforeProjection.result.status === "rejected" || afterProjection.result.status === "rejected" || projectionOptions.lossPolicy === "reject" && diagnostics.some((item) => item.severity === "loss")) return {
277
+ status: "rejected",
278
+ reason: "projection",
279
+ diagnostics
280
+ };
281
+ return {
282
+ status: "created",
283
+ value: {
284
+ format: "foldkit-zloz-review",
285
+ version: 1,
286
+ scope: "selected-snapshots",
287
+ model: {
288
+ id: model.id,
289
+ name: model.name
290
+ },
291
+ baseline: {
292
+ source: {
293
+ kind: "edition",
294
+ id: baseline.id,
295
+ name: baseline.name
296
+ },
297
+ snapshot: before
298
+ },
299
+ selected: {
300
+ source: result.comparison.selected.source,
301
+ snapshot: after
302
+ },
303
+ conventions: {
304
+ source: options.rules === void 0 ? "builtin" : "custom",
305
+ roleInterpretation: "zloz-event-storming/v1",
306
+ rules
307
+ },
308
+ comparison: result.comparison,
309
+ projectionOptions,
310
+ projections: {
311
+ baseline: beforeProjection.result.value,
312
+ selected: afterProjection.result.value
313
+ },
314
+ diagnostics
315
+ },
316
+ diagnostics
317
+ };
318
+ }
319
+ //#endregion
320
+ export { createReviewPacket, exportMermaid, mermaidProtocol, mermaidSourceLimit };
321
+
322
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/export-mermaid.ts","../src/review-packet.ts"],"sourcesContent":["/* oxlint-disable anti-slop/no-shape-in-symbol-names -- Built-in geometric outlines are public domain concepts. */\n/**\n * Pure Mermaid projections with identity metadata and explicit conversion losses.\n * @module Mermaid\n */\n// ADR 0008: Optional pure export; the headless parser spike is not a production import API.\nimport { validateGraph, type ZlozGraph, type ZlozNode } from '@opsydyn/foldkit-zloz';\n\nexport const mermaidProtocol = 'foldkit-flow-mermaid/v1';\n/** Maximum generated source size, in UTF-16 code units. */\nexport const mermaidSourceLimit = 32768;\nexport type MermaidDirection = 'LR' | 'RL' | 'TB' | 'BT';\nexport type MermaidLossPolicy = 'reject' | 'report';\nexport type MermaidDiagnosticCode =\n | 'invalid-graph'\n | 'invalid-options'\n | 'unsupported-subgraph'\n | 'group-presentation-omitted'\n | 'unsupported-label-encoding'\n | 'source-limit'\n | 'node-fields-omitted'\n | 'edge-fields-omitted'\n | 'port-details-omitted'\n | 'layout-omitted'\n | 'identity-map-required';\nexport type MermaidDiagnostic = Readonly<{\n code: MermaidDiagnosticCode;\n severity: 'loss' | 'error';\n dimension: 'syntax' | 'semantics' | 'identity' | 'layout';\n message: string;\n subject: string | null;\n}>;\nexport type MermaidIdentity = Readonly<{\n version: 1;\n nodes: readonly Readonly<{\n mermaidId: string;\n flowId: string;\n /** Present for group entries; flat v1 entries are unchanged. */\n kind?: 'group';\n /** Original Zloz parent group ID, never a Mermaid alias. */\n parentId?: string;\n ports: readonly Readonly<{ id: string; kind: 'input' | 'output' }>[];\n }>[];\n edges: readonly Readonly<{\n mermaidId: string;\n flowId: string;\n sourceNode: string;\n sourcePort: string;\n targetNode: string;\n targetPort: string;\n }>[];\n}>;\n/** A projection, not a substitute for canonical Zloz JSON. No full graph is hidden in identity. */\nexport type MermaidBundle = Readonly<{\n protocol: typeof mermaidProtocol;\n source: string;\n direction: MermaidDirection;\n identity: MermaidIdentity;\n diagnostics: readonly MermaidDiagnostic[];\n}>;\nexport type MermaidExportOptions = Readonly<{\n direction?: MermaidDirection;\n lossPolicy?: MermaidLossPolicy;\n}>;\nexport type MermaidExportResult =\n | Readonly<{\n protocol: typeof mermaidProtocol;\n status: 'converted';\n value: MermaidBundle;\n diagnostics: readonly MermaidDiagnostic[];\n }>\n | Readonly<{\n protocol: typeof mermaidProtocol;\n status: 'rejected';\n diagnostics: readonly MermaidDiagnostic[];\n }>;\n\nfunction diagnostic(\n code: MermaidDiagnosticCode,\n severity: MermaidDiagnostic['severity'],\n dimension: MermaidDiagnostic['dimension'],\n message: string,\n subject: string | null = null,\n): MermaidDiagnostic {\n return { code, severity, dimension, message, subject };\n}\nfunction rejected(diagnostics: readonly MermaidDiagnostic[]): MermaidExportResult {\n return { protocol: mermaidProtocol, status: 'rejected', diagnostics };\n}\n/** Injective alias over Unicode code points; IDs never become Mermaid keywords or markup. */\nfunction alias(prefix: 'n' | 'e', id: string): string {\n return `${prefix}_${[...id].map((char) => char.codePointAt(0)!.toString(16)).join('_')}`;\n}\nfunction unsupportedLabel(text: string): boolean {\n return (\n text.length === 0 ||\n text.includes('fa:') ||\n [...text].some((char) => {\n const point = char.codePointAt(0)!;\n return (\n (point < 32 && point !== 9 && point !== 10 && point !== 13) ||\n point === 127 ||\n (point >= 0xd800 && point <= 0xdfff)\n );\n })\n );\n}\nfunction label(text: string): string {\n return (\n '\"' +\n [...text]\n .map((char) => ('\"&#<>|\\\\`\\n\\r'.includes(char) ? `#${char.codePointAt(0)!};` : char))\n .join('') +\n '\"'\n );\n}\n\nfunction isOptions(value: unknown): value is MermaidExportOptions {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) return false;\n return (\n (!('direction' in value) ||\n value.direction === undefined ||\n (typeof value.direction === 'string' &&\n ['LR', 'RL', 'TB', 'BT'].includes(value.direction))) &&\n (!('lossPolicy' in value) ||\n value.lossPolicy === undefined ||\n value.lossPolicy === 'reject' ||\n value.lossPolicy === 'report')\n );\n}\n\n/**\n * Export the qualified flowchart subset without changing the graph or performing I/O.\n * Losses reject by default. `report` consents to omitted fields, never to errors.\n * Keep the bundle's identity metadata with source; source alone contains safe aliases.\n */\nexport function exportMermaid(\n graph: ZlozGraph,\n options: MermaidExportOptions = {},\n): MermaidExportResult {\n // Core throws on invalid input. Normalize only at this public conversion boundary.\n // oxlint-disable-next-line linteffect/no-try-catch\n try {\n validateGraph(graph);\n } catch (error) {\n return rejected([\n diagnostic(\n 'invalid-graph',\n 'error',\n 'semantics',\n error instanceof Error ? error.message : 'Invalid Zloz graph.',\n ),\n ]);\n }\n if (!isOptions(options))\n return rejected([\n diagnostic('invalid-options', 'error', 'syntax', 'Unknown direction or loss policy.'),\n ]);\n const direction = options.direction ?? 'LR';\n const policy = options.lossPolicy ?? 'reject';\n const children = new Map<string | undefined, ZlozNode[]>();\n for (const node of graph.nodes) {\n const siblings = children.get(node.parentId) ?? [];\n siblings.push(node);\n children.set(node.parentId, siblings);\n }\n if (graph.nodes.some((node) => node.kind === 'group' && !children.has(node.id)))\n return rejected([\n diagnostic(\n 'unsupported-subgraph',\n 'error',\n 'semantics',\n 'Empty groups have no reliable visible Mermaid boundary; export does not invent placeholder nodes.',\n ),\n ]);\n const diagnostics: MermaidDiagnostic[] = [];\n const identity: MermaidIdentity = {\n version: 1,\n nodes: graph.nodes.map((node): MermaidIdentity['nodes'][number] => {\n const entry = {\n mermaidId: alias('n', node.id),\n flowId: node.id,\n ports: node.ports.map(({ id, kind }) => ({ id, kind })),\n };\n const nested = node.parentId === undefined ? entry : { ...entry, parentId: node.parentId };\n return node.kind === 'group' ? { ...nested, kind: 'group' } : nested;\n }),\n edges: graph.edges.map((edge) => ({\n mermaidId: alias('e', edge.id),\n flowId: edge.id,\n sourceNode: alias('n', edge.source.node),\n sourcePort: edge.source.port,\n targetNode: alias('n', edge.target.node),\n targetPort: edge.target.port,\n })),\n };\n const declarations = new Map<string, string>();\n const nodeFields = new Set([\n 'id',\n 'label',\n 'position',\n 'size',\n 'ports',\n 'appearance',\n 'kind',\n 'parentId',\n ]);\n const edgeFields = new Set(['id', 'source', 'target', 'label']);\n for (const node of graph.nodes) {\n const omitted = Object.keys(node).filter((key) => !nodeFields.has(key));\n if (omitted.length)\n diagnostics.push(\n diagnostic(\n 'node-fields-omitted',\n 'loss',\n 'semantics',\n `Not represented: ${omitted.join(', ')}.`,\n node.id,\n ),\n );\n if (node.ports.length)\n diagnostics.push(\n diagnostic(\n 'port-details-omitted',\n 'loss',\n 'layout',\n 'Port IDs/kinds remain in identity metadata. Port labels, ordering, offsets and anchors are omitted from source.',\n node.id,\n ),\n );\n if (unsupportedLabel(node.label))\n diagnostics.push(\n diagnostic(\n 'unsupported-label-encoding',\n 'error',\n 'semantics',\n 'Empty, icon-like, control or invalid Unicode labels are outside the qualified literal-text subset.',\n node.id,\n ),\n );\n const text = label(node.label),\n shape = node.appearance?.shape ?? 'rectangle';\n if (node.kind === 'group') {\n declarations.set(node.id, `subgraph ${alias('n', node.id)}[${text}]`);\n if (node.appearance !== undefined)\n diagnostics.push(\n diagnostic(\n 'group-presentation-omitted',\n 'loss',\n 'layout',\n 'Subgraph boundaries do not retain authored node outline choice.',\n node.id,\n ),\n );\n } else\n declarations.set(\n node.id,\n `${alias('n', node.id)}${shape === 'cylinder' ? `[(${text})]` : shape === 'rounded-rectangle' ? `(${text})` : `[${text}]`}`,\n );\n }\n const lines = [`flowchart ${direction}`];\n let length = lines[0]!.length + 1;\n const stack: Array<{ node: ZlozNode; depth: number } | { depth: number }> = [\n ...(children.get(undefined) ?? []),\n ]\n .reverse()\n .map((node) => ({ node, depth: 1 }));\n while (stack.length) {\n const entry = stack.pop()!;\n const text = 'node' in entry ? declarations.get(entry.node.id)! : 'end';\n length += entry.depth * 2 + text.length + 1;\n if (length > mermaidSourceLimit)\n return rejected([\n ...diagnostics,\n diagnostic(\n 'source-limit',\n 'error',\n 'syntax',\n 'Generated source exceeds 32768 UTF-16 code units.',\n ),\n ]);\n lines.push(' '.repeat(entry.depth) + text);\n if ('node' in entry && entry.node.kind === 'group') {\n stack.push({ depth: entry.depth });\n for (const node of [...(children.get(entry.node.id) ?? [])].reverse())\n stack.push({ node, depth: entry.depth + 1 });\n }\n }\n for (const edge of graph.edges) {\n const omitted = Object.keys(edge).filter((key) => !edgeFields.has(key));\n if (omitted.length)\n diagnostics.push(\n diagnostic(\n 'edge-fields-omitted',\n 'loss',\n 'semantics',\n `Not represented: ${omitted.join(', ')}.`,\n edge.id,\n ),\n );\n if (edge.label !== undefined && unsupportedLabel(edge.label))\n diagnostics.push(\n diagnostic(\n 'unsupported-label-encoding',\n 'error',\n 'semantics',\n 'Empty, icon-like, control or invalid Unicode labels are outside the qualified literal-text subset.',\n edge.id,\n ),\n );\n lines.push(\n ` ${alias('n', edge.source.node)} ${alias('e', edge.id)}@-->${edge.label === undefined ? '' : `|${label(edge.label)}|`} ${alias('n', edge.target.node)}`,\n );\n }\n if (graph.nodes.length) {\n diagnostics.push(\n diagnostic(\n 'layout-omitted',\n 'loss',\n 'layout',\n 'Authored positions and dimensions are not represented; Mermaid chooses layout.',\n ),\n );\n diagnostics.push(\n diagnostic(\n 'identity-map-required',\n 'loss',\n 'identity',\n 'Source uses safe aliases. Keep the bundle identity metadata to retain original node, edge and port IDs.',\n ),\n );\n }\n const source = lines.join('\\n') + '\\n';\n if (source.length > mermaidSourceLimit)\n diagnostics.push(\n diagnostic(\n 'source-limit',\n 'error',\n 'syntax',\n 'Generated source exceeds 32768 UTF-16 code units.',\n ),\n );\n if (\n diagnostics.some(\n (item) => item.severity === 'error' || (policy === 'reject' && item.severity === 'loss'),\n )\n )\n return rejected(diagnostics);\n const value: MermaidBundle = {\n protocol: mermaidProtocol,\n source,\n direction,\n identity,\n diagnostics,\n };\n return { protocol: mermaidProtocol, status: 'converted', value, diagnostics };\n}\n","import {\n captureModelDocument,\n compareModelEventStormingRelationships,\n auditEventStormingRelationships,\n eventStormingRelationshipRules,\n isEdgeArchitecture,\n type ZlozModelDocument,\n type ZlozSnapshot,\n type ZlozRelationshipAuditSelection,\n type ZlozRelationshipAuditSource,\n type ZlozRelationshipAuditComparison,\n type ZlozEventStormingRelationshipRule,\n type JsonValue,\n} from '@opsydyn/foldkit-zloz';\n\nimport {\n exportMermaid,\n type MermaidBundle,\n type MermaidExportOptions,\n type MermaidDiagnostic,\n} from './export-mermaid';\n\nexport type ZlozReviewPacketOptions = MermaidExportOptions &\n Readonly<{\n /** Complete replacement catalogue. Packet interpretation is deliberately data-only. */\n rules?: readonly ZlozEventStormingRelationshipRule[];\n }>;\nexport type ZlozReviewPacketDiagnostic = Readonly<{\n side: 'packet' | 'baseline' | 'selected';\n code:\n | MermaidDiagnostic['code']\n | 'invalid-options'\n | 'unknown-baseline'\n | 'unknown-edition'\n | 'viewport-omitted';\n severity: 'error' | 'loss';\n dimension: MermaidDiagnostic['dimension'];\n message: string;\n subject: string | null;\n}>;\nexport type ZlozReviewSnapshot = Readonly<{\n source: ZlozRelationshipAuditSource;\n snapshot: ZlozSnapshot;\n}>;\nexport type ZlozReviewPacket = Readonly<{\n format: 'foldkit-zloz-review';\n version: 1;\n scope: 'selected-snapshots';\n model: Readonly<{ id: string; name: string }>;\n baseline: Readonly<{\n source: Extract<ZlozRelationshipAuditSource, { kind: 'edition' }>;\n snapshot: ZlozSnapshot;\n }>;\n selected: ZlozReviewSnapshot;\n conventions: Readonly<{\n source: 'builtin' | 'custom';\n roleInterpretation: 'zloz-event-storming/v1';\n rules: readonly ZlozEventStormingRelationshipRule[];\n }>;\n comparison: ZlozRelationshipAuditComparison;\n projectionOptions: Readonly<Required<MermaidExportOptions>>;\n projections: Readonly<{ baseline: MermaidBundle; selected: MermaidBundle }>;\n diagnostics: readonly ZlozReviewPacketDiagnostic[];\n}>;\nexport type ZlozReviewPacketResult =\n | Readonly<{\n status: 'created';\n value: ZlozReviewPacket;\n diagnostics: readonly ZlozReviewPacketDiagnostic[];\n }>\n | Readonly<{\n status: 'rejected';\n reason: 'input' | 'projection';\n diagnostics: readonly ZlozReviewPacketDiagnostic[];\n }>;\nconst isRecord = (value: unknown): value is Record<string, JsonValue> =>\n typeof value === 'object' && value !== null && !Array.isArray(value);\nconst isString = (value: unknown): value is string => typeof value === 'string';\nfunction isDataRule(value: unknown): value is ZlozEventStormingRelationshipRule {\n return (\n isRecord(value) &&\n Object.keys(value).every((key) =>\n ['architecture', 'sources', 'targets', 'label'].includes(key),\n ) &&\n isEdgeArchitecture(value.architecture) &&\n typeof value.label === 'string' &&\n Array.isArray(value.sources) &&\n value.sources.every(isString) &&\n Array.isArray(value.targets) &&\n value.targets.every(isString)\n );\n}\nfunction isReviewPacketOptions(value: unknown): value is ZlozReviewPacketOptions {\n return (\n isRecord(value) &&\n Object.keys(value).every((key) => ['direction', 'lossPolicy', 'rules'].includes(key)) &&\n (value.direction === undefined ||\n (typeof value.direction === 'string' &&\n ['LR', 'RL', 'TB', 'BT'].includes(value.direction))) &&\n (value.lossPolicy === undefined ||\n value.lossPolicy === 'reject' ||\n value.lossPolicy === 'report') &&\n (value.rules === undefined || (Array.isArray(value.rules) && value.rules.every(isDataRule)))\n );\n}\nfunction projection(\n side: 'baseline' | 'selected',\n snapshot: ZlozSnapshot,\n options: MermaidExportOptions,\n) {\n const result = exportMermaid(snapshot.graph, options);\n const diagnostics: readonly ZlozReviewPacketDiagnostic[] = [\n ...result.diagnostics.map((item) => ({ ...item, side })),\n ...(snapshot.viewport\n ? [\n {\n side,\n code: 'viewport-omitted' as const,\n severity: 'loss' as const,\n dimension: 'layout' as const,\n subject: null,\n message:\n 'The snapshot camera is retained in the packet but omitted from its Mermaid projection.',\n },\n ]\n : []),\n ];\n return { result, diagnostics };\n}\n/** ADR-0035: Data-only composition in the optional adapter; no I/O, clocks, imports or graph writes.\n * Invalid model/rule data throws at the existing core validation boundary. Selector/options and\n * projection failures return rejected results. Created packets may contain introduced audit findings. */\nexport function createReviewPacket(\n document: ZlozModelDocument,\n selection: ZlozRelationshipAuditSelection,\n options: ZlozReviewPacketOptions = {},\n): ZlozReviewPacketResult {\n if (!isReviewPacketOptions(options))\n return {\n status: 'rejected',\n reason: 'input',\n diagnostics: [\n {\n side: 'packet',\n code: 'invalid-options',\n severity: 'error',\n dimension: 'semantics',\n subject: null,\n message:\n 'Review packets accept only direction, lossPolicy and data-only relationship rules; callbacks and unknown fields are not portable.',\n },\n ],\n };\n const model = captureModelDocument(document);\n const rules = (options.rules ?? eventStormingRelationshipRules).map((item) => ({\n architecture: { ...item.architecture },\n sources: [...item.sources],\n targets: [...item.targets],\n label: item.label,\n }));\n auditEventStormingRelationships({ nodes: [], edges: [] }, { rules });\n const result = compareModelEventStormingRelationships(model, selection, { rules });\n if (result.type === 'blocked')\n return {\n status: 'rejected',\n reason: 'input',\n diagnostics: [\n {\n side: 'packet',\n code: result.code,\n severity: 'error',\n dimension: 'identity',\n subject: result.editionId,\n message: result.reason,\n },\n ],\n };\n const baseline = model.editions.find((edition) => edition.id === selection.baselineId);\n const selected =\n selection.selectedId === undefined\n ? null\n : model.editions.find((edition) => edition.id === selection.selectedId);\n // Successful core comparison guarantees owned selectors; retain a total defensive branch.\n if (!baseline || selected === undefined)\n return {\n status: 'rejected',\n reason: 'input',\n diagnostics: [\n {\n side: 'packet',\n code: 'unknown-edition',\n severity: 'error',\n dimension: 'identity',\n subject: selection.selectedId ?? selection.baselineId,\n message: 'The chosen review snapshot is unavailable.',\n },\n ],\n };\n const before = baseline.snapshot,\n after = selected?.snapshot ?? model.snapshot;\n const projectionOptions = {\n direction: options.direction ?? 'LR',\n lossPolicy: options.lossPolicy ?? 'reject',\n };\n const beforeProjection = projection('baseline', before, projectionOptions);\n const afterProjection = projection('selected', after, projectionOptions);\n const diagnostics = [...beforeProjection.diagnostics, ...afterProjection.diagnostics];\n if (\n beforeProjection.result.status === 'rejected' ||\n afterProjection.result.status === 'rejected' ||\n (projectionOptions.lossPolicy === 'reject' &&\n diagnostics.some((item) => item.severity === 'loss'))\n )\n return { status: 'rejected', reason: 'projection', diagnostics };\n const value: ZlozReviewPacket = {\n format: 'foldkit-zloz-review',\n version: 1,\n scope: 'selected-snapshots',\n model: { id: model.id, name: model.name },\n baseline: {\n source: { kind: 'edition', id: baseline.id, name: baseline.name },\n snapshot: before,\n },\n selected: { source: result.comparison.selected.source, snapshot: after },\n conventions: {\n source: options.rules === undefined ? 'builtin' : 'custom',\n roleInterpretation: 'zloz-event-storming/v1',\n rules,\n },\n comparison: result.comparison,\n projectionOptions,\n projections: {\n baseline: beforeProjection.result.value,\n selected: afterProjection.result.value,\n },\n diagnostics,\n };\n return { status: 'created', value, diagnostics };\n}\n"],"mappings":";;;;;;AAQA,MAAa,kBAAkB;;AAE/B,MAAa,qBAAqB;AAmElC,SAAS,WACP,MACA,UACA,WACA,SACA,UAAyB,MACN;AACnB,QAAO;EAAE;EAAM;EAAU;EAAW;EAAS;EAAS;;AAExD,SAAS,SAAS,aAAgE;AAChF,QAAO;EAAE,UAAU;EAAiB,QAAQ;EAAY;EAAa;;;AAGvE,SAAS,MAAM,QAAmB,IAAoB;AACpD,QAAO,GAAG,OAAO,GAAG,CAAC,GAAG,GAAG,CAAC,KAAK,SAAS,KAAK,YAAY,EAAE,CAAE,SAAS,GAAG,CAAC,CAAC,KAAK,IAAI;;AAExF,SAAS,iBAAiB,MAAuB;AAC/C,QACE,KAAK,WAAW,KACh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,OAAO,WAAW,cACjC,kBAAkB,eAAe,YAChC,YAAY,MAAM,SAAS,KAAK,aAAa,OAAO,CAEtD,QAAO;EAAE,QAAQ;EAAY,QAAQ;EAAc;EAAa;AAwBlE,QAAO;EAAE,QAAQ;EAAW,OAAA;GAtB1B,QAAQ;GACR,SAAS;GACT,OAAO;GACP,OAAO;IAAE,IAAI,MAAM;IAAI,MAAM,MAAM;IAAM;GACzC,UAAU;IACR,QAAQ;KAAE,MAAM;KAAW,IAAI,SAAS;KAAI,MAAM,SAAS;KAAM;IACjE,UAAU;IACX;GACD,UAAU;IAAE,QAAQ,OAAO,WAAW,SAAS;IAAQ,UAAU;IAAO;GACxE,aAAa;IACX,QAAQ,QAAQ,UAAU,KAAA,IAAY,YAAY;IAClD,oBAAoB;IACpB;IACD;GACD,YAAY,OAAO;GACnB;GACA,aAAa;IACX,UAAU,iBAAiB,OAAO;IAClC,UAAU,gBAAgB,OAAO;IAClC;GACD;GAE+B;EAAE;EAAa"}
package/package.json CHANGED
@@ -1,6 +1,66 @@
1
1
  {
2
2
  "name": "@opsydyn/foldkit-zloz-mermaid",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.3.0",
4
+ "description": "Optional, loss-aware Mermaid export for Foldkit Zloz.",
5
+ "keywords": [
6
+ "diagram",
7
+ "flow",
8
+ "foldkit",
9
+ "graph",
10
+ "typescript"
11
+ ],
12
+ "homepage": "https://github.com/opsydyn/fold-kit-experiments/tree/main/packages/foldkit-zloz-mermaid#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/opsydyn/fold-kit-experiments/issues"
15
+ },
16
+ "license": "MIT",
17
+ "author": "Alan P Currie",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/opsydyn/fold-kit-experiments.git",
21
+ "directory": "packages/foldkit-zloz-mermaid"
22
+ },
23
+ "files": [
24
+ "dist",
25
+ "README.md",
26
+ "CHANGELOG.md",
27
+ "LICENSE",
28
+ "THIRD-PARTY-NOTICES.md",
29
+ "!dist/pack"
30
+ ],
31
+ "type": "module",
32
+ "sideEffects": false,
33
+ "main": "./dist/index.mjs",
34
+ "types": "./dist/index.d.mts",
35
+ "exports": {
36
+ ".": {
37
+ "types": "./dist/index.d.mts",
38
+ "import": "./dist/index.mjs"
39
+ },
40
+ "./package.json": "./package.json"
41
+ },
42
+ "publishConfig": {
43
+ "access": "public"
44
+ },
45
+ "scripts": {
46
+ "build": "bun run --filter @opsydyn/foldkit-zloz build && tsdown",
47
+ "typecheck": "bun run --filter @opsydyn/foldkit-zloz build && tsc --noEmit",
48
+ "test": "bun test ./test",
49
+ "pack:check": "bun run build && publint && bun ../../tools/pack-zloz.ts foldkit-zloz-mermaid"
50
+ },
51
+ "devDependencies": {
52
+ "@arethetypeswrong/cli": "0.18.5",
53
+ "@opsydyn/foldkit-zloz": "0.3.0",
54
+ "@types/node": "^22.0.0",
55
+ "bun-types": "^1.3.14",
56
+ "publint": "0.3.25",
57
+ "tsdown": "^0.21.8",
58
+ "typescript": "^6.0.3"
59
+ },
60
+ "peerDependencies": {
61
+ "@opsydyn/foldkit-zloz": "0.3.0"
62
+ },
63
+ "engines": {
64
+ "node": ">=22.0.0"
65
+ }
66
+ }