@rotorsoft/act-diagram 1.2.2 → 1.2.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/.tsbuildinfo +1 -1
- package/dist/@types/cli/contract-index.d.ts +6 -1
- package/dist/@types/cli/contract-index.d.ts.map +1 -1
- package/dist/@types/cli/format.d.ts.map +1 -1
- package/dist/@types/cli/markdown.d.ts.map +1 -1
- package/dist/cli/act.js +10 -22
- package/dist/cli/act.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -3
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* in CLAUDE.md and ACT-403: an event `Foo` is deprecated when any
|
|
10
10
|
* `Foo_v<n>` with a higher version exists.
|
|
11
11
|
*/
|
|
12
|
-
import type { DomainModel } from "../client/types/index.js";
|
|
12
|
+
import type { ActionNode, DomainModel } from "../client/types/index.js";
|
|
13
13
|
export type Kind = "event" | "action" | "slice" | "projection" | "state" | "reaction";
|
|
14
14
|
export type IndexEntry = {
|
|
15
15
|
kind: Kind;
|
|
@@ -69,6 +69,11 @@ export declare function build_contract_index(model: DomainModel): ContractIndex;
|
|
|
69
69
|
*/
|
|
70
70
|
export declare const CATEGORY_KEYWORDS: Record<string, Kind>;
|
|
71
71
|
/** Return every entry of a given kind, sorted by name. */
|
|
72
|
+
/** The action named `name`, on the state named `qualifier` when given. */
|
|
73
|
+
export declare function find_action(model: DomainModel, name: string, qualifier?: string): {
|
|
74
|
+
action?: ActionNode;
|
|
75
|
+
state_file?: string;
|
|
76
|
+
};
|
|
72
77
|
export declare function list_by_kind(idx: ContractIndex, kind: Kind): IndexEntry[];
|
|
73
78
|
/**
|
|
74
79
|
* Fuzzy substring search across the index. Case-insensitive. Ranks
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract-index.d.ts","sourceRoot":"","sources":["../../../src/cli/contract-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;G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H,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,GAC1B,WAAW,CAeb;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,WAAW,GAAG,aAAa,CA8EtE;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAalD,CAAC;AAEF,0DAA0D;AAC1D,0EAA0E;AAC1E,wBAAgB,WAAW,CACzB,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,MAAM,EACZ,SAAS,CAAC,EAAE,MAAM,GACjB;IAAE,MAAM,CAAC,EAAE,UAAU,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAO9C;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,GAAG,UAAU,EAAE,CAIzE;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CACpB,GAAG,EAAE,aAAa,EAClB,KAAK,EAAE,MAAM,EACb,KAAK,SAAK,GACT,UAAU,EAAE,CAoBd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../src/cli/format.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAgBH,OAAO,EACL,KAAK,aAAa,
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../src/cli/format.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAgBH,OAAO,EACL,KAAK,aAAa,EAIlB,KAAK,UAAU,EAChB,MAAM,qBAAqB,CAAC;AAiB7B,8DAA8D;AAC9D,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,MAAM,CAY3E;AAmFD,sEAAsE;AACtE,wBAAgB,YAAY,CAAC,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,CAoE1E;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,CA4B3E;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,CA8C1E;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":"markdown.d.ts","sourceRoot":"","sources":["../../../src/cli/markdown.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,KAAK,aAAa,
|
|
1
|
+
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../../src/cli/markdown.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,KAAK,aAAa,EAKnB,MAAM,qBAAqB,CAAC;AAoG7B,wBAAgB,eAAe,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CA+M1D"}
|
package/dist/cli/act.js
CHANGED
|
@@ -1480,6 +1480,14 @@ var CATEGORY_KEYWORDS = {
|
|
|
1480
1480
|
reaction: "reaction",
|
|
1481
1481
|
reactions: "reaction"
|
|
1482
1482
|
};
|
|
1483
|
+
function find_action(model, name, qualifier) {
|
|
1484
|
+
for (const st of model.states) {
|
|
1485
|
+
if (qualifier && st.name !== qualifier) continue;
|
|
1486
|
+
const action = st.actions.find((x) => x.name === name);
|
|
1487
|
+
if (action) return { action, state_file: st.file };
|
|
1488
|
+
}
|
|
1489
|
+
return {};
|
|
1490
|
+
}
|
|
1483
1491
|
function list_by_kind(idx, kind) {
|
|
1484
1492
|
return idx.entries.filter((e) => e.kind === kind).sort((a2, b) => a2.name.localeCompare(b.name));
|
|
1485
1493
|
}
|
|
@@ -1663,17 +1671,7 @@ function format_event(idx, entry) {
|
|
|
1663
1671
|
function format_action(idx, entry) {
|
|
1664
1672
|
const model = idx.model;
|
|
1665
1673
|
const owner_name = entry.qualifier;
|
|
1666
|
-
|
|
1667
|
-
let state_file;
|
|
1668
|
-
for (const st of model.states) {
|
|
1669
|
-
if (owner_name && st.name !== owner_name) continue;
|
|
1670
|
-
const a2 = st.actions.find((x) => x.name === entry.name);
|
|
1671
|
-
if (a2) {
|
|
1672
|
-
action = a2;
|
|
1673
|
-
state_file = st.file;
|
|
1674
|
-
break;
|
|
1675
|
-
}
|
|
1676
|
-
}
|
|
1674
|
+
const { action, state_file } = find_action(model, entry.name, owner_name);
|
|
1677
1675
|
const lines = [];
|
|
1678
1676
|
lines.push(bold(pink(entry.name)));
|
|
1679
1677
|
if (owner_name) lines.push(` on: ${amber(owner_name)}`);
|
|
@@ -2130,17 +2128,7 @@ function format_markdown(idx) {
|
|
|
2130
2128
|
const actions = list_by_kind(idx, "action");
|
|
2131
2129
|
if (actions.length === 0) lines.push("_(none)_\n");
|
|
2132
2130
|
for (const a2 of actions) {
|
|
2133
|
-
|
|
2134
|
-
let state_file;
|
|
2135
|
-
for (const st of m.states) {
|
|
2136
|
-
if (a2.qualifier && st.name !== a2.qualifier) continue;
|
|
2137
|
-
const found = st.actions.find((x) => x.name === a2.name);
|
|
2138
|
-
if (found) {
|
|
2139
|
-
action = found;
|
|
2140
|
-
state_file = st.file;
|
|
2141
|
-
break;
|
|
2142
|
-
}
|
|
2143
|
-
}
|
|
2131
|
+
const { action, state_file } = find_action(m, a2.name, a2.qualifier);
|
|
2144
2132
|
lines.push(`### \`${a2.name}\``);
|
|
2145
2133
|
if (a2.qualifier) lines.push(`- **on state:** \`${a2.qualifier}\``);
|
|
2146
2134
|
if (state_file)
|