@rotorsoft/act-diagram 1.4.2 → 2.0.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 +2 -2
- package/dist/.tsbuildinfo +1 -1
- package/dist/@types/cli/format.d.ts +2 -0
- package/dist/@types/cli/format.d.ts.map +1 -1
- package/dist/@types/cli/json-schema.d.ts.map +1 -1
- package/dist/@types/cli/markdown.d.ts +0 -9
- package/dist/@types/cli/markdown.d.ts.map +1 -1
- package/dist/@types/client/components/Diagram.d.ts.map +1 -1
- package/dist/@types/client/lib/build-model.d.ts.map +1 -1
- package/dist/@types/client/lib/layout.d.ts +20 -1
- package/dist/@types/client/lib/layout.d.ts.map +1 -1
- package/dist/@types/client/lib/loads.d.ts +17 -0
- package/dist/@types/client/lib/loads.d.ts.map +1 -0
- package/dist/@types/client/lib/mock-builders.d.ts.map +1 -1
- package/dist/@types/client/types/domain-model.d.ts +9 -3
- package/dist/@types/client/types/domain-model.d.ts.map +1 -1
- package/dist/@types/client/types/index.d.ts +1 -1
- package/dist/@types/client/types/index.d.ts.map +1 -1
- package/dist/cli/act.js +103 -35
- package/dist/cli/act.js.map +1 -1
- package/dist/index.cjs +209 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +209 -42
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -13,6 +13,8 @@ export declare function format_matches(query: string, matches: IndexEntry[]): st
|
|
|
13
13
|
export declare const find_actions_emitting: (model: DomainModel, event_name: string) => Array<{
|
|
14
14
|
state: string;
|
|
15
15
|
action: string;
|
|
16
|
+
/** The loaded state whose stream gets the event, when not the action's own. */
|
|
17
|
+
appends_to?: string;
|
|
16
18
|
file?: string;
|
|
17
19
|
line?: number;
|
|
18
20
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../src/cli/format.ts"],"names":[],"mappings":"AAAA;;;;;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EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,CA8C3E;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,CAqE1E;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,CAkC1E;AAED,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,aAAa,EAClB,KAAK,EAAE,UAAU,GAChB,MAAM,CAWR;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,CAwC7E;AAED,eAAO,MAAM,UAAU,EAAE,MAAM,CAC7B,MAAM,EACN,CAAC,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,KAAK,MAAM,CAQlD,CAAC;AAEF,wBAAgB,aAAa,CAAC,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,CAG3E;AAED,kDAAkD;AAClD,wBAAgB,cAAc,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAazD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-schema.d.ts","sourceRoot":"","sources":["../../../src/cli/json-schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"json-schema.d.ts","sourceRoot":"","sources":["../../../src/cli/json-schema.ts"],"names":[],"mappings":"AAkBA,OAAO,EACL,KAAK,aAAa,EAGnB,MAAM,qBAAqB,CAAC;AAsG7B;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,OAAO,GACX;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAc5D;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAqC7D"}
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Render the full contract index as a Markdown registry. One section
|
|
3
|
-
* per kind, one subsection per entity. Used by `act --markdown` for
|
|
4
|
-
* pipe-friendly output that diffs cleanly between branches.
|
|
5
|
-
*
|
|
6
|
-
* Output is plain ASCII (no ANSI escapes) regardless of `picocolors`
|
|
7
|
-
* settings — readers expect Markdown to be paste-able into a PR body
|
|
8
|
-
* or a static doc file.
|
|
9
|
-
*/
|
|
10
1
|
import { type ContractIndex } from "./contract-index.js";
|
|
11
2
|
export declare function format_markdown(idx: ContractIndex): string;
|
|
12
3
|
//# sourceMappingURL=markdown.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../../src/cli/markdown.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../../src/cli/markdown.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,KAAK,aAAa,EAKnB,MAAM,qBAAqB,CAAC;AAyB7B,wBAAgB,eAAe,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CA4N1D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Diagram.d.ts","sourceRoot":"","sources":["../../../../src/client/components/Diagram.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,WAAW,EAEX,iBAAiB,EAClB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"Diagram.d.ts","sourceRoot":"","sources":["../../../../src/client/components/Diagram.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,WAAW,EAEX,iBAAiB,EAClB,MAAM,mBAAmB,CAAC;AAsG3B,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,WAAW,CAAC;IACnB,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACtE,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAChC,CAAC;AAEF,wBAAgB,OAAO,CAAC,EACtB,KAAK,EACL,QAAQ,EACR,cAAc,EACd,WAAW,EACX,YAAY,GACb,EAAE,KAAK,+BAy0BP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-model.d.ts","sourceRoot":"","sources":["../../../../src/client/lib/build-model.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAGV,WAAW,EAEX,OAAO,EAGR,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"build-model.d.ts","sourceRoot":"","sources":["../../../../src/client/lib/build-model.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAGV,WAAW,EAEX,OAAO,EAGR,MAAM,mBAAmB,CAAC;AAoG3B,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,GAAG,EAAE,CAAC;IACd,MAAM,EAAE,GAAG,EAAE,CAAC;IACd,WAAW,EAAE,GAAG,EAAE,CAAC;IACnB,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC,CAAC;AAIF,wBAAgB,WAAW,CACzB,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,OAAO,EAAE,EAChB,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GACnC;IAAE,KAAK,EAAE,WAAW,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAgTxC"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* without React or DOM dependencies.
|
|
6
6
|
*/
|
|
7
7
|
import type { DomainModel } from "../types/index.js";
|
|
8
|
-
export declare const W = 100, H = 36, STATE_W = 80, STATE_H = 80, GAP = 12, PAD = 10, SLICE_PAD = 24, SLICE_INNER = 16, SLICE_GAP = 20, MARGIN = 30;
|
|
8
|
+
export declare const W = 100, H = 36, STATE_W = 80, STATE_H = 80, GAP = 12, PAD = 10, SLICE_PAD = 24, SLICE_INNER = 16, SLICE_GAP = 20, MARGIN = 30, COMMIT_PAD = 3, COMMIT_GUTTER = 11;
|
|
9
9
|
declare const COLORS: {
|
|
10
10
|
action: {
|
|
11
11
|
bg: string;
|
|
@@ -53,6 +53,16 @@ export type N = {
|
|
|
53
53
|
emits?: string[];
|
|
54
54
|
/** Events this projection handles — shown in projection-node tooltips. */
|
|
55
55
|
handles?: string[];
|
|
56
|
+
/** A small line on the box: an action's loads, or the loaded stream an event goes to. */
|
|
57
|
+
note?: string;
|
|
58
|
+
/** Each `.loads` of this action, as "Seats → SeatTaken" or "Seats (read)". */
|
|
59
|
+
loads?: string[];
|
|
60
|
+
/** The action's commit across streams, when it has one. */
|
|
61
|
+
commit?: string;
|
|
62
|
+
/** Actions outside this event's state that append it, through a load. */
|
|
63
|
+
outside?: string[];
|
|
64
|
+
/** Actions that load this state: "Enrollment.Enroll". */
|
|
65
|
+
loaded_by?: string[];
|
|
56
66
|
};
|
|
57
67
|
export type E = {
|
|
58
68
|
from: Pos;
|
|
@@ -60,6 +70,14 @@ export type E = {
|
|
|
60
70
|
color: string;
|
|
61
71
|
dash?: boolean;
|
|
62
72
|
};
|
|
73
|
+
/** The events of one commit across streams, drawn as one unit. */
|
|
74
|
+
export type CommitBox = {
|
|
75
|
+
label: string;
|
|
76
|
+
x: number;
|
|
77
|
+
y: number;
|
|
78
|
+
w: number;
|
|
79
|
+
h: number;
|
|
80
|
+
};
|
|
63
81
|
export type Box = {
|
|
64
82
|
label: string;
|
|
65
83
|
x: number;
|
|
@@ -72,6 +90,7 @@ export type Layout = {
|
|
|
72
90
|
ns: N[];
|
|
73
91
|
es: E[];
|
|
74
92
|
boxes: Box[];
|
|
93
|
+
commits: CommitBox[];
|
|
75
94
|
minX: number;
|
|
76
95
|
minY: number;
|
|
77
96
|
width: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../../src/client/lib/layout.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../../src/client/lib/layout.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAEV,WAAW,EAGZ,MAAM,mBAAmB,CAAC;AAe3B,eAAO,MAAM,CAAC,MAAM,EAClB,CAAC,KAAK,EACN,OAAO,KAAK,EACZ,OAAO,KAAK,EACZ,GAAG,KAAK,EACR,GAAG,KAAK,EACR,SAAS,KAAK,EACd,WAAW,KAAK,EAChB,SAAS,KAAK,EACd,MAAM,KAAK,EACX,UAAU,IAAI,EACd,aAAa,KAAK,CAAC;AAErB,QAAA,MAAM,MAAM;IACV,MAAM;QAAI,EAAE;QAAa,MAAM;QAAa,IAAI;;IAChD,KAAK;QAAI,EAAE;QAAa,MAAM;QAAa,IAAI;;IAC/C,KAAK;QAAI,EAAE;QAAa,MAAM;QAAa,IAAI;;IAC/C,QAAQ;QAAI,EAAE;QAAa,MAAM;QAAa,IAAI;;IAClD,UAAU;QAAI,EAAE;QAAa,MAAM;QAAa,IAAI;;CACrD,CAAC;AAGF,MAAM,MAAM,GAAG,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAC3C,MAAM,MAAM,CAAC,GAAG;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,GAAG,CAAC;IACT,IAAI,EAAE,MAAM,OAAO,MAAM,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAA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CAAC,EAAE,CAAC;IACR,EAAE,EAAE,CAAC,EAAE,CAAC;IACR,KAAK,EAAE,GAAG,EAAE,CAAC;IACb,OAAO,EAAE,SAAS,EAAE,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA2TF,wBAAgB,cAAc,CAAC,UAAU,EAAE,WAAW,GAAG,MAAM,CAmmB9D"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What an action's `.loads(...)` mean for its commit: a load that lists events
|
|
3
|
+
* appends to that stream in the action's one commit, guarded by its version at
|
|
4
|
+
* load; a load without events is a read and isn't guarded.
|
|
5
|
+
*/
|
|
6
|
+
import type { ActionNode, LoadNode } from "../types/index.js";
|
|
7
|
+
export declare const appending_loads: (action: ActionNode) => LoadNode[];
|
|
8
|
+
export declare const read_loads: (action: ActionNode) => LoadNode[];
|
|
9
|
+
/** The load that lists `event`, when the action appends it to a loaded stream. */
|
|
10
|
+
export declare const load_of: (action: ActionNode, event: string) => LoadNode | undefined;
|
|
11
|
+
/** A load by its state, with its name when that differs (one state loaded twice). */
|
|
12
|
+
export declare const load_label: (load: LoadNode) => string;
|
|
13
|
+
/** The streams of the action's one commit, its own first; just its own without appending loads. */
|
|
14
|
+
export declare const commit_streams: (action: ActionNode, owner: string) => string[];
|
|
15
|
+
/** "one commit across 2 streams (Enrollment, Seats)", or undefined for a single-stream action. */
|
|
16
|
+
export declare const commit_summary: (action: ActionNode, owner: string) => string | undefined;
|
|
17
|
+
//# sourceMappingURL=loads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loads.d.ts","sourceRoot":"","sources":["../../../../src/client/lib/loads.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE9D,eAAO,MAAM,eAAe,WAAY,UAAU,KAAG,QAAQ,EACJ,CAAC;AAE1D,eAAO,MAAM,UAAU,WAAY,UAAU,KAAG,QAAQ,EACG,CAAC;AAE5D,kFAAkF;AAClF,eAAO,MAAM,OAAO,WACV,UAAU,SACX,MAAM,KACZ,QAAQ,GAAG,SAAgE,CAAC;AAE/E,qFAAqF;AACrF,eAAO,MAAM,UAAU,SAAU,QAAQ,KAAG,MAC+B,CAAC;AAE5E,mGAAmG;AACnG,eAAO,MAAM,cAAc,WAAY,UAAU,SAAS,MAAM,KAAG,MAAM,EAGxE,CAAC;AAEF,kGAAkG;AAClG,eAAO,MAAM,cAAc,WACjB,UAAU,SACX,MAAM,KACZ,MAAM,GAAG,SAKX,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock-builders.d.ts","sourceRoot":"","sources":["../../../../src/client/lib/mock-builders.ts"],"names":[],"mappings":"AAQA,4FAA4F;AAC5F,wBAAgB,YAAY,SAAK;
|
|
1
|
+
{"version":3,"file":"mock-builders.d.ts","sourceRoot":"","sources":["../../../../src/client/lib/mock-builders.ts"],"names":[],"mappings":"AAQA,4FAA4F;AAC5F,wBAAgB,YAAY,SAAK;AAkEjC,wBAAgB,UAAU,CACxB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC1B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI;IAkE5B,IAAI,aAAa,GAAG;QAClB,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;;EAatC;AA4DD,wBAAgB,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,OAuDxD;AAED,wBAAgB,eAAe,CAC7B,MAAM,CAAC,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,OAkD/B;AAED,wBAAgB,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,OAmEtD;AAWD,+CAA+C;AAC/C,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAuB3D,CAAC;AAEF;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAmB9D"}
|
|
@@ -52,12 +52,18 @@ export type EventNode = {
|
|
|
52
52
|
*/
|
|
53
53
|
zod?: unknown;
|
|
54
54
|
};
|
|
55
|
+
/** One `.loads(...)` of an action: another state its decision needs. */
|
|
56
|
+
export type LoadNode = {
|
|
57
|
+
state: string;
|
|
58
|
+
name: string;
|
|
59
|
+
events: string[];
|
|
60
|
+
};
|
|
55
61
|
export type ActionNode = {
|
|
56
62
|
name: string;
|
|
57
63
|
emits: string[];
|
|
58
|
-
/**
|
|
59
|
-
|
|
60
|
-
/** Descriptions of the action's preconditions in the order they run
|
|
64
|
+
/** The action's `.loads(...)` in declaration order; absent when there are none. */
|
|
65
|
+
loads?: LoadNode[];
|
|
66
|
+
/** Descriptions of the action's `.requires([...])` preconditions in the order they run; absent when there are none. */
|
|
61
67
|
preconditions?: string[];
|
|
62
68
|
line?: number;
|
|
63
69
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain-model.d.ts","sourceRoot":"","sources":["../../../../src/client/types/domain-model.ts"],"names":[],"mappings":"AAAA,mDAAmD;AAEnD,MAAM,MAAM,OAAO,GAAG;IACpB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,WAAW,EAAE,cAAc,EAAE,CAAC;IAC9B,SAAS,EAAE,YAAY,EAAE,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,UAAU,EAAE,CAAC;IAEtB,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,WAAW,EAAE,cAAc,EAAE,CAAC;IAC9B,SAAS,EAAE,YAAY,EAAE,CAAC;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,OAAO,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,
|
|
1
|
+
{"version":3,"file":"domain-model.d.ts","sourceRoot":"","sources":["../../../../src/client/types/domain-model.ts"],"names":[],"mappings":"AAAA,mDAAmD;AAEnD,MAAM,MAAM,OAAO,GAAG;IACpB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,MAAM,EAAE,M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|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { ActionNode, ActNode, DomainModel, EntryPoint, EventNode, ProjectionNode, ReactionNode, SliceNode, StateNode, ValidationWarning, } from "./domain-model.js";
|
|
1
|
+
export type { ActionNode, ActNode, DomainModel, EntryPoint, EventNode, LoadNode, ProjectionNode, ReactionNode, SliceNode, StateNode, ValidationWarning, } from "./domain-model.js";
|
|
2
2
|
export { emptyModel } from "./domain-model.js";
|
|
3
3
|
export type { FileTab } from "./file-tab.js";
|
|
4
4
|
export type { DiagramMessage, HostMessage } from "./protocol.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/client/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,OAAO,EACP,WAAW,EACX,UAAU,EACV,SAAS,EACT,cAAc,EACd,YAAY,EACZ,SAAS,EACT,SAAS,EACT,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,YAAY,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/client/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,OAAO,EACP,WAAW,EACX,UAAU,EACV,SAAS,EACT,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,SAAS,EACT,SAAS,EACT,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,YAAY,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/cli/act.js
CHANGED
|
@@ -469,15 +469,12 @@ function build_state(model, st) {
|
|
|
469
469
|
if (action_name.startsWith("__emits_")) continue;
|
|
470
470
|
const emits = raw_actions[`__emits_${action_name}`] ?? [];
|
|
471
471
|
const describe = (rule) => rule.description ?? "";
|
|
472
|
-
const
|
|
473
|
-
const
|
|
474
|
-
...invariants,
|
|
475
|
-
...(st.requires?.[action_name] ?? []).map(describe)
|
|
476
|
-
];
|
|
472
|
+
const preconditions = (st.requires?.[action_name] ?? []).map(describe);
|
|
473
|
+
const loads = (st.loads?.[action_name] ?? []).filter((l2) => l2.state);
|
|
477
474
|
action_nodes.push({
|
|
478
475
|
name: action_name,
|
|
479
476
|
emits,
|
|
480
|
-
|
|
477
|
+
...loads.length ? { loads } : {},
|
|
481
478
|
...preconditions.length ? { preconditions } : {},
|
|
482
479
|
zod: raw_actions[action_name]
|
|
483
480
|
});
|
|
@@ -751,7 +748,8 @@ function attach_emit(info, action_name, handler) {
|
|
|
751
748
|
emits.push(handler);
|
|
752
749
|
} else if (typeof handler === "function") {
|
|
753
750
|
const src = String(handler);
|
|
754
|
-
|
|
751
|
+
const routed = (info.loads[action_name] ?? []).flatMap((l2) => l2.events);
|
|
752
|
+
for (const event_name of [...Object.keys(info.events), ...routed]) {
|
|
755
753
|
if (src.includes(`"${event_name}"`) || src.includes(`'${event_name}'`) || src.includes(`\`${event_name}\``)) {
|
|
756
754
|
emits.push(event_name);
|
|
757
755
|
}
|
|
@@ -778,7 +776,7 @@ function attach_emit(info, action_name, handler) {
|
|
|
778
776
|
}
|
|
779
777
|
}
|
|
780
778
|
);
|
|
781
|
-
const result = handler(dummy_arg, dummy_arg, dummy_arg);
|
|
779
|
+
const result = handler(dummy_arg, dummy_arg, dummy_arg, dummy_arg);
|
|
782
780
|
if (Array.isArray(result) && typeof result[0] === "string") {
|
|
783
781
|
emits.push(result[0]);
|
|
784
782
|
}
|
|
@@ -795,8 +793,10 @@ function mock_state(entry, on_build) {
|
|
|
795
793
|
schema: entry[name],
|
|
796
794
|
events: {},
|
|
797
795
|
actions: {},
|
|
798
|
-
given: {},
|
|
799
796
|
requires: {},
|
|
797
|
+
// Each action's `.loads(...)`: the loaded state's name, the load's
|
|
798
|
+
// name, and the events listed on it.
|
|
799
|
+
loads: {},
|
|
800
800
|
patches: /* @__PURE__ */ new Set(),
|
|
801
801
|
_tag: "State"
|
|
802
802
|
};
|
|
@@ -812,14 +812,16 @@ function mock_state(entry, on_build) {
|
|
|
812
812
|
if (rules) info.requires[action_name] = rules;
|
|
813
813
|
return { emit };
|
|
814
814
|
};
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
815
|
+
const loads = (state, _target, events = [], name2) => {
|
|
816
|
+
const state_name = state?.name ?? "";
|
|
817
|
+
(info.loads[action_name] ??= []).push({
|
|
818
|
+
state: state_name,
|
|
819
|
+
name: name2 ?? state_name,
|
|
820
|
+
events
|
|
821
|
+
});
|
|
822
|
+
return { loads, requires, emit };
|
|
822
823
|
};
|
|
824
|
+
return { loads, requires, emit };
|
|
823
825
|
},
|
|
824
826
|
snap: () => action_builder(_currentAction),
|
|
825
827
|
// Close-the-books policy methods. The diagram doesn't render the
|
|
@@ -1054,13 +1056,7 @@ function mock_act(on_build) {
|
|
|
1054
1056
|
};
|
|
1055
1057
|
return builder;
|
|
1056
1058
|
}
|
|
1057
|
-
var
|
|
1058
|
-
constructor(message) {
|
|
1059
|
-
super(message);
|
|
1060
|
-
this.name = "InvariantError";
|
|
1061
|
-
}
|
|
1062
|
-
};
|
|
1063
|
-
var PreconditionError = class extends InvariantError {
|
|
1059
|
+
var PreconditionError = class extends Error {
|
|
1064
1060
|
constructor(message) {
|
|
1065
1061
|
super(message);
|
|
1066
1062
|
this.name = "PreconditionError";
|
|
@@ -1082,7 +1078,9 @@ var MODULES = {
|
|
|
1082
1078
|
}),
|
|
1083
1079
|
dispose: () => () => Promise.resolve(),
|
|
1084
1080
|
ZodEmpty: z.record(z.string(), z.never()),
|
|
1085
|
-
|
|
1081
|
+
// Runs where an event schema is declared, so a file that can't call it
|
|
1082
|
+
// stops there and loses every state after it.
|
|
1083
|
+
sensitive: (schema) => schema,
|
|
1086
1084
|
PreconditionError
|
|
1087
1085
|
},
|
|
1088
1086
|
zod: { z, ...z },
|
|
@@ -1526,6 +1524,20 @@ function search(idx, query, limit = 20) {
|
|
|
1526
1524
|
return scored.slice(0, limit).map((s) => s.entry);
|
|
1527
1525
|
}
|
|
1528
1526
|
|
|
1527
|
+
// src/client/lib/loads.ts
|
|
1528
|
+
var appending_loads = (action) => (action.loads ?? []).filter((l2) => l2.events.length > 0);
|
|
1529
|
+
var read_loads = (action) => (action.loads ?? []).filter((l2) => l2.events.length === 0);
|
|
1530
|
+
var load_of = (action, event) => action.loads?.find((l2) => l2.events.includes(event));
|
|
1531
|
+
var load_label = (load) => load.name === load.state ? load.state : `${load.state} as "${load.name}"`;
|
|
1532
|
+
var commit_streams = (action, owner) => [
|
|
1533
|
+
owner,
|
|
1534
|
+
...appending_loads(action).map(load_label)
|
|
1535
|
+
];
|
|
1536
|
+
var commit_summary = (action, owner) => {
|
|
1537
|
+
const streams = commit_streams(action, owner);
|
|
1538
|
+
return streams.length > 1 ? `one commit across ${streams.length} streams (${streams.join(", ")})` : void 0;
|
|
1539
|
+
};
|
|
1540
|
+
|
|
1529
1541
|
// src/cli/colors.ts
|
|
1530
1542
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
1531
1543
|
var supported = import_picocolors.default.isColorSupported;
|
|
@@ -1584,9 +1596,11 @@ var find_actions_emitting = (model, event_name) => {
|
|
|
1584
1596
|
for (const st of model.states) {
|
|
1585
1597
|
for (const act of st.actions) {
|
|
1586
1598
|
if (act.emits.includes(event_name)) {
|
|
1599
|
+
const load = load_of(act, event_name);
|
|
1587
1600
|
out.push({
|
|
1588
1601
|
state: st.name,
|
|
1589
1602
|
action: act.name,
|
|
1603
|
+
...load ? { appends_to: load_label(load) } : {},
|
|
1590
1604
|
file: st.file,
|
|
1591
1605
|
line: act.line
|
|
1592
1606
|
});
|
|
@@ -1655,8 +1669,9 @@ function format_event(idx, entry) {
|
|
|
1655
1669
|
if (producers.length > 0) {
|
|
1656
1670
|
lines.push(" producers:");
|
|
1657
1671
|
for (const p of producers) {
|
|
1672
|
+
const stream = p.appends_to ? `, to the ${p.appends_to} stream` : "";
|
|
1658
1673
|
lines.push(
|
|
1659
|
-
` - ${pink(p.action)} ${dim(`(on ${p.state})`)}${file_note(p.file, p.line)}`
|
|
1674
|
+
` - ${pink(p.action)} ${dim(`(on ${p.state}${stream})`)}${file_note(p.file, p.line)}`
|
|
1660
1675
|
);
|
|
1661
1676
|
}
|
|
1662
1677
|
} else {
|
|
@@ -1693,17 +1708,37 @@ function format_action(idx, entry) {
|
|
|
1693
1708
|
` in: ${dim(loc(state_file, action?.line ?? entry.line))}`
|
|
1694
1709
|
);
|
|
1695
1710
|
if (action) {
|
|
1696
|
-
|
|
1711
|
+
if (action.loads?.length) {
|
|
1712
|
+
lines.push(" loads:");
|
|
1713
|
+
for (const l2 of appending_loads(action))
|
|
1714
|
+
lines.push(
|
|
1715
|
+
` - ${amber(load_label(l2))}: appends ${l2.events.map((e) => orange(e)).join(", ")}`
|
|
1716
|
+
);
|
|
1717
|
+
for (const l2 of read_loads(action))
|
|
1718
|
+
lines.push(
|
|
1719
|
+
` - ${amber(load_label(l2))}: ${dim("read, not guarded")}`
|
|
1720
|
+
);
|
|
1721
|
+
}
|
|
1722
|
+
const preconditions = action.preconditions ?? [];
|
|
1697
1723
|
if (preconditions.length) {
|
|
1698
1724
|
lines.push(" preconditions:");
|
|
1699
1725
|
for (const pre of preconditions) lines.push(` - ${pre}`);
|
|
1700
1726
|
}
|
|
1701
1727
|
if (action.emits.length > 0) {
|
|
1702
1728
|
lines.push(" emits:");
|
|
1703
|
-
for (const e of action.emits)
|
|
1729
|
+
for (const e of action.emits) {
|
|
1730
|
+
const load = load_of(action, e);
|
|
1731
|
+
const to = load ? ` ${dim(`to the ${load_label(load)} stream`)}` : "";
|
|
1732
|
+
lines.push(` - ${orange(e)}${to}`);
|
|
1733
|
+
}
|
|
1704
1734
|
} else {
|
|
1705
1735
|
lines.push(` emits: ${dim("(none)")}`);
|
|
1706
1736
|
}
|
|
1737
|
+
const commit = commit_summary(action, owner_name);
|
|
1738
|
+
if (commit)
|
|
1739
|
+
lines.push(
|
|
1740
|
+
` commit: ${commit}, ${dim("each guarded by its version at load: all land or none do")}`
|
|
1741
|
+
);
|
|
1707
1742
|
}
|
|
1708
1743
|
return lines.join("\n");
|
|
1709
1744
|
}
|
|
@@ -1729,7 +1764,8 @@ function format_state(idx, entry) {
|
|
|
1729
1764
|
for (const { node, file } of actions) {
|
|
1730
1765
|
const emits = node.emits.length > 0 ? ` \u2192 ${node.emits.join(", ")}` : "";
|
|
1731
1766
|
const where = show_file && file ? ` ${dim(loc(file, node.line))}` : "";
|
|
1732
|
-
|
|
1767
|
+
const loads = node.loads?.length ? ` ${dim(`loads ${node.loads.map(load_label).join(", ")}`)}` : "";
|
|
1768
|
+
lines.push(` - ${pink(node.name)}${emits}${loads}${where}`);
|
|
1733
1769
|
}
|
|
1734
1770
|
}
|
|
1735
1771
|
const events = partials.flatMap(
|
|
@@ -1741,6 +1777,23 @@ function format_state(idx, entry) {
|
|
|
1741
1777
|
const schema = node.schema ? ` ${dim(node.schema)}` : "";
|
|
1742
1778
|
const where = show_file && file ? ` ${dim(loc(file, node.line))}` : "";
|
|
1743
1779
|
lines.push(` - ${orange(node.name)}${schema}${where}`);
|
|
1780
|
+
for (const p of find_actions_emitting(idx.model, node.name))
|
|
1781
|
+
if (p.appends_to && p.state !== entry.name)
|
|
1782
|
+
lines.push(
|
|
1783
|
+
` ${dim(`also emitted by ${p.state}.${p.action}`)}`
|
|
1784
|
+
);
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1787
|
+
const loaded_by = idx.model.states.flatMap(
|
|
1788
|
+
(s) => s.actions.flatMap(
|
|
1789
|
+
(a2) => (a2.loads ?? []).filter((l2) => l2.state === entry.name).map((l2) => ({ state: s.name, action: a2.name, load: l2 }))
|
|
1790
|
+
)
|
|
1791
|
+
);
|
|
1792
|
+
if (loaded_by.length > 0) {
|
|
1793
|
+
lines.push(" loaded by:");
|
|
1794
|
+
for (const { state, action, load } of loaded_by) {
|
|
1795
|
+
const what = load.events.length ? `appends ${load.events.map((e) => orange(e)).join(", ")}` : dim("read, not guarded");
|
|
1796
|
+
lines.push(` - ${pink(action)} ${dim(`(on ${state})`)}: ${what}`);
|
|
1744
1797
|
}
|
|
1745
1798
|
}
|
|
1746
1799
|
return lines.join("\n");
|
|
@@ -1847,9 +1900,11 @@ var find_producers = (model, event_name) => {
|
|
|
1847
1900
|
for (const st of model.states) {
|
|
1848
1901
|
for (const act of st.actions) {
|
|
1849
1902
|
if (act.emits.includes(event_name)) {
|
|
1903
|
+
const load = load_of(act, event_name);
|
|
1850
1904
|
out.push({
|
|
1851
1905
|
action: act.name,
|
|
1852
1906
|
state: st.name,
|
|
1907
|
+
...load ? { appends_to: load_label(load) } : {},
|
|
1853
1908
|
file: st.file,
|
|
1854
1909
|
line: act.line
|
|
1855
1910
|
});
|
|
@@ -2098,17 +2153,30 @@ function format_markdown(idx) {
|
|
|
2098
2153
|
`- **defined in:** \`${loc(state_file, action?.line ?? a2.line)}\``
|
|
2099
2154
|
);
|
|
2100
2155
|
if (action) {
|
|
2101
|
-
|
|
2156
|
+
if (action.loads?.length) {
|
|
2157
|
+
lines.push("- **loads:**");
|
|
2158
|
+
for (const l2 of action.loads) {
|
|
2159
|
+
const what = l2.events.length ? `appends ${l2.events.map((e) => `\`${e}\``).join(", ")}` : "read, not guarded";
|
|
2160
|
+
lines.push(` - \`${load_label(l2)}\`: ${what}`);
|
|
2161
|
+
}
|
|
2162
|
+
}
|
|
2163
|
+
const preconditions = action.preconditions ?? [];
|
|
2102
2164
|
if (preconditions.length) {
|
|
2103
2165
|
lines.push("- **preconditions:**");
|
|
2104
2166
|
for (const pre of preconditions) lines.push(` - ${pre}`);
|
|
2105
2167
|
}
|
|
2106
2168
|
if (action.emits.length > 0) {
|
|
2107
2169
|
lines.push("- **emits:**");
|
|
2108
|
-
for (const ev of action.emits)
|
|
2170
|
+
for (const ev of action.emits) {
|
|
2171
|
+
const load = load_of(action, ev);
|
|
2172
|
+
const to = load ? ` to the \`${load_label(load)}\` stream` : "";
|
|
2173
|
+
lines.push(` - \`${ev}\`${to}`);
|
|
2174
|
+
}
|
|
2109
2175
|
} else {
|
|
2110
2176
|
lines.push("- **emits:** _(none)_");
|
|
2111
2177
|
}
|
|
2178
|
+
const commit = commit_summary(action, a2.qualifier);
|
|
2179
|
+
if (commit) lines.push(`- **commit:** ${commit}, all or none`);
|
|
2112
2180
|
}
|
|
2113
2181
|
lines.push("");
|
|
2114
2182
|
}
|
|
@@ -3255,12 +3323,12 @@ function build_patterns(esc, type) {
|
|
|
3255
3323
|
const guard_patterns = [
|
|
3256
3324
|
// Guard definition — prefer jumping to the declaration
|
|
3257
3325
|
new RegExp(
|
|
3258
|
-
`(?:const|let|var)\\s+(${esc})\\s*(?::\\s*
|
|
3326
|
+
`(?:const|let|var)\\s+(${esc})\\s*(?::\\s*Precondition\\b[^=]*)?\\s*=`
|
|
3259
3327
|
),
|
|
3260
3328
|
new RegExp(`rule\\(\\s*["'\`](${esc})["'\`]`),
|
|
3261
3329
|
new RegExp(`description:\\s*["'\`](${esc})["'\`]`),
|
|
3262
|
-
// .
|
|
3263
|
-
new RegExp(`\\.
|
|
3330
|
+
// .requires() usage in the state builder — last resort
|
|
3331
|
+
new RegExp(`\\.requires\\([\\s\\S]*?(${esc})`)
|
|
3264
3332
|
];
|
|
3265
3333
|
const slice_patterns = [
|
|
3266
3334
|
new RegExp(`(?:const|let|var)\\s+(${esc})\\s*=\\s*slice\\s*\\(`)
|
|
@@ -3352,7 +3420,7 @@ function navigate_to_code(files, name, type, target_file) {
|
|
|
3352
3420
|
const desc_match = desc_re.exec(c2);
|
|
3353
3421
|
if (desc_match) {
|
|
3354
3422
|
const before = c2.slice(0, desc_match.index);
|
|
3355
|
-
const decl_re = /(?:export\s+)?(?:const|let|var)\s+(\w+)\s*(?::\s*
|
|
3423
|
+
const decl_re = /(?:export\s+)?(?:const|let|var)\s+(\w+)\s*(?::\s*Precondition[^=]*)?\s*=/g;
|
|
3356
3424
|
let last_decl = null;
|
|
3357
3425
|
let m;
|
|
3358
3426
|
while ((m = decl_re.exec(before)) !== null) {
|
|
@@ -3401,7 +3469,7 @@ function navigate_to_code(files, name, type, target_file) {
|
|
|
3401
3469
|
const desc_match = desc_re.exec(c2);
|
|
3402
3470
|
if (desc_match) {
|
|
3403
3471
|
const before = c2.slice(0, desc_match.index);
|
|
3404
|
-
const decl_re = /(?:export\s+)?(?:const|let|var)\s+(\w+)\s*(?::\s*
|
|
3472
|
+
const decl_re = /(?:export\s+)?(?:const|let|var)\s+(\w+)\s*(?::\s*Precondition[^=]*)?\s*=/g;
|
|
3405
3473
|
let last_decl = null;
|
|
3406
3474
|
let m;
|
|
3407
3475
|
while ((m = decl_re.exec(before)) !== null) last_decl = m;
|