@elaraai/e3-ui 1.0.103 → 1.0.104

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.
Files changed (287) hide show
  1. package/dist/src/allocation/functions.d.ts +2 -1
  2. package/dist/src/allocation/functions.d.ts.map +1 -1
  3. package/dist/src/allocation/functions.js +3 -2
  4. package/dist/src/allocation/functions.js.map +1 -1
  5. package/dist/src/allocation/index.d.ts +120 -1
  6. package/dist/src/allocation/index.d.ts.map +1 -1
  7. package/dist/src/allocation/index.js +24 -4
  8. package/dist/src/allocation/index.js.map +1 -1
  9. package/dist/src/bind/data-indexed.d.ts +25 -4
  10. package/dist/src/bind/data-indexed.d.ts.map +1 -1
  11. package/dist/src/bind/data-indexed.js +58 -7
  12. package/dist/src/bind/data-indexed.js.map +1 -1
  13. package/dist/src/bind/data.d.ts +12 -14
  14. package/dist/src/bind/data.d.ts.map +1 -1
  15. package/dist/src/bind/data.js +11 -11
  16. package/dist/src/bind/data.js.map +1 -1
  17. package/dist/src/bind/func.d.ts +7 -2
  18. package/dist/src/bind/func.d.ts.map +1 -1
  19. package/dist/src/bind/func.js +10 -3
  20. package/dist/src/bind/func.js.map +1 -1
  21. package/dist/src/calendar/index.d.ts +148 -1
  22. package/dist/src/calendar/index.d.ts.map +1 -1
  23. package/dist/src/calendar/index.js +55 -5
  24. package/dist/src/calendar/index.js.map +1 -1
  25. package/dist/src/flowchart/canvas.d.ts +32 -14
  26. package/dist/src/flowchart/canvas.d.ts.map +1 -1
  27. package/dist/src/flowchart/canvas.js +21 -6
  28. package/dist/src/flowchart/canvas.js.map +1 -1
  29. package/dist/src/flowchart/details.d.ts +469 -0
  30. package/dist/src/flowchart/details.d.ts.map +1 -0
  31. package/dist/src/flowchart/details.js +1035 -0
  32. package/dist/src/flowchart/details.js.map +1 -0
  33. package/dist/src/flowchart/flowchart.d.ts +16 -72
  34. package/dist/src/flowchart/flowchart.d.ts.map +1 -1
  35. package/dist/src/flowchart/flowchart.js +10 -1
  36. package/dist/src/flowchart/flowchart.js.map +1 -1
  37. package/dist/src/flowchart/index.d.ts +282 -251
  38. package/dist/src/flowchart/index.d.ts.map +1 -1
  39. package/dist/src/flowchart/index.js +234 -220
  40. package/dist/src/flowchart/index.js.map +1 -1
  41. package/dist/src/flowchart/kinds.d.ts +438 -0
  42. package/dist/src/flowchart/kinds.d.ts.map +1 -0
  43. package/dist/src/flowchart/kinds.js +799 -0
  44. package/dist/src/flowchart/kinds.js.map +1 -0
  45. package/dist/src/flowchart/library.d.ts +154 -739
  46. package/dist/src/flowchart/library.d.ts.map +1 -1
  47. package/dist/src/flowchart/library.js +191 -673
  48. package/dist/src/flowchart/library.js.map +1 -1
  49. package/dist/src/flowchart/payload.d.ts +3652 -7843
  50. package/dist/src/flowchart/payload.d.ts.map +1 -1
  51. package/dist/src/flowchart/payload.js +331 -469
  52. package/dist/src/flowchart/payload.js.map +1 -1
  53. package/dist/src/flowchart/templates.d.ts +657 -0
  54. package/dist/src/flowchart/templates.d.ts.map +1 -0
  55. package/dist/src/flowchart/templates.js +658 -0
  56. package/dist/src/flowchart/templates.js.map +1 -0
  57. package/dist/src/flowchart/types.d.ts +2258 -214
  58. package/dist/src/flowchart/types.d.ts.map +1 -1
  59. package/dist/src/flowchart/types.js +374 -124
  60. package/dist/src/flowchart/types.js.map +1 -1
  61. package/dist/src/index.d.ts +13 -15
  62. package/dist/src/index.d.ts.map +1 -1
  63. package/dist/src/index.js +24 -29
  64. package/dist/src/index.js.map +1 -1
  65. package/dist/src/internal.d.ts +5 -7
  66. package/dist/src/internal.d.ts.map +1 -1
  67. package/dist/src/internal.js +12 -19
  68. package/dist/src/internal.js.map +1 -1
  69. package/dist/src/ontology/index.d.ts +44 -15
  70. package/dist/src/ontology/index.d.ts.map +1 -1
  71. package/dist/src/ontology/index.js +19 -11
  72. package/dist/src/ontology/index.js.map +1 -1
  73. package/dist/src/plan/event-rows.d.ts +2 -1
  74. package/dist/src/plan/event-rows.d.ts.map +1 -1
  75. package/dist/src/plan/event-rows.js +6 -4
  76. package/dist/src/plan/event-rows.js.map +1 -1
  77. package/dist/src/plan/ir.d.ts +1 -0
  78. package/dist/src/plan/ir.d.ts.map +1 -1
  79. package/dist/src/plan/plan.d.ts +145 -1
  80. package/dist/src/plan/plan.d.ts.map +1 -1
  81. package/dist/src/plan/plan.js +67 -3
  82. package/dist/src/plan/plan.js.map +1 -1
  83. package/dist/src/plan/types.d.ts +1 -0
  84. package/dist/src/plan/types.d.ts.map +1 -1
  85. package/dist/src/query/builder.d.ts +362 -315
  86. package/dist/src/query/builder.d.ts.map +1 -1
  87. package/dist/src/query/builder.js +12 -1
  88. package/dist/src/query/builder.js.map +1 -1
  89. package/dist/src/query/index.d.ts +5 -1
  90. package/dist/src/query/index.d.ts.map +1 -1
  91. package/dist/src/query/index.js +3 -1
  92. package/dist/src/query/index.js.map +1 -1
  93. package/dist/src/roster/fit.d.ts +5 -2
  94. package/dist/src/roster/fit.d.ts.map +1 -1
  95. package/dist/src/roster/fit.js +5 -3
  96. package/dist/src/roster/fit.js.map +1 -1
  97. package/dist/src/roster/index.d.ts +103 -2
  98. package/dist/src/roster/index.d.ts.map +1 -1
  99. package/dist/src/roster/index.js +45 -6
  100. package/dist/src/roster/index.js.map +1 -1
  101. package/dist/src/runtime/index.d.ts +1 -3
  102. package/dist/src/runtime/index.d.ts.map +1 -1
  103. package/dist/src/runtime/index.js +1 -3
  104. package/dist/src/runtime/index.js.map +1 -1
  105. package/dist/src/schedule/record-window.d.ts +1 -0
  106. package/dist/src/schedule/record-window.d.ts.map +1 -1
  107. package/dist/src/schematic/index.d.ts +1 -1
  108. package/dist/src/schematic/index.d.ts.map +1 -1
  109. package/dist/src/schematic/index.js +1 -1
  110. package/dist/src/schematic/index.js.map +1 -1
  111. package/dist/src/schematic/kinds.d.ts +4 -24
  112. package/dist/src/schematic/kinds.d.ts.map +1 -1
  113. package/dist/src/schematic/kinds.js +8 -212
  114. package/dist/src/schematic/kinds.js.map +1 -1
  115. package/dist/src/schematic/payload.d.ts +140 -1
  116. package/dist/src/schematic/payload.d.ts.map +1 -1
  117. package/dist/src/schematic/payload.js +38 -1
  118. package/dist/src/schematic/payload.js.map +1 -1
  119. package/dist/src/schematic/types.d.ts.map +1 -1
  120. package/dist/src/schematic/types.js +4 -36
  121. package/dist/src/schematic/types.js.map +1 -1
  122. package/dist/src/schematic/window.d.ts +9 -42
  123. package/dist/src/schematic/window.d.ts.map +1 -1
  124. package/dist/src/schematic/window.js +10 -115
  125. package/dist/src/schematic/window.js.map +1 -1
  126. package/dist/src/sheet/actions.d.ts +388 -0
  127. package/dist/src/sheet/actions.d.ts.map +1 -0
  128. package/dist/src/sheet/actions.js +594 -0
  129. package/dist/src/sheet/actions.js.map +1 -0
  130. package/dist/src/sheet/bridge.d.ts +12 -1
  131. package/dist/src/sheet/bridge.d.ts.map +1 -1
  132. package/dist/src/sheet/bridge.js +30 -6
  133. package/dist/src/sheet/bridge.js.map +1 -1
  134. package/dist/src/sheet/columns.d.ts +5 -2
  135. package/dist/src/sheet/columns.d.ts.map +1 -1
  136. package/dist/src/sheet/columns.js.map +1 -1
  137. package/dist/src/sheet/draft-bridge.d.ts +9 -4
  138. package/dist/src/sheet/draft-bridge.d.ts.map +1 -1
  139. package/dist/src/sheet/draft-bridge.js +22 -7
  140. package/dist/src/sheet/draft-bridge.js.map +1 -1
  141. package/dist/src/sheet/fields.d.ts +13 -0
  142. package/dist/src/sheet/fields.d.ts.map +1 -1
  143. package/dist/src/sheet/fields.js +3 -0
  144. package/dist/src/sheet/fields.js.map +1 -1
  145. package/dist/src/sheet/index.d.ts +32 -2
  146. package/dist/src/sheet/index.d.ts.map +1 -1
  147. package/dist/src/sheet/index.js +18 -3
  148. package/dist/src/sheet/index.js.map +1 -1
  149. package/dist/src/sheet/library.d.ts +8 -0
  150. package/dist/src/sheet/library.d.ts.map +1 -1
  151. package/dist/src/sheet/root.d.ts +23 -1
  152. package/dist/src/sheet/root.d.ts.map +1 -1
  153. package/dist/src/sheet/root.js +40 -5
  154. package/dist/src/sheet/root.js.map +1 -1
  155. package/dist/src/sheet/sheet.d.ts +7843 -4132
  156. package/dist/src/sheet/sheet.d.ts.map +1 -1
  157. package/dist/src/sheet/sheet.js +41 -2
  158. package/dist/src/sheet/sheet.js.map +1 -1
  159. package/dist/src/sheet/templates.d.ts +4 -0
  160. package/dist/src/sheet/templates.d.ts.map +1 -1
  161. package/dist/src/sheet/types.d.ts +12449 -5268
  162. package/dist/src/sheet/types.d.ts.map +1 -1
  163. package/dist/src/sheet/types.js +114 -2
  164. package/dist/src/sheet/types.js.map +1 -1
  165. package/dist/src/utils/derive.d.ts +1 -1
  166. package/dist/src/utils/derive.js +1 -1
  167. package/dist/src/utils/record-kind.d.ts +625 -0
  168. package/dist/src/utils/record-kind.d.ts.map +1 -0
  169. package/dist/src/utils/record-kind.js +450 -0
  170. package/dist/src/utils/record-kind.js.map +1 -0
  171. package/dist/src/utils/views.d.ts +55 -0
  172. package/dist/src/utils/views.d.ts.map +1 -0
  173. package/dist/src/utils/views.js +72 -0
  174. package/dist/src/utils/views.js.map +1 -0
  175. package/dist/src/utils/vocabulary.d.ts +48 -0
  176. package/dist/src/utils/vocabulary.d.ts.map +1 -0
  177. package/dist/src/utils/vocabulary.js +47 -0
  178. package/dist/src/utils/vocabulary.js.map +1 -0
  179. package/dist/test/allocation/allocation.examples.d.ts +2 -0
  180. package/dist/test/allocation/allocation.examples.d.ts.map +1 -1
  181. package/dist/test/allocation/allocation.examples.js +81 -2
  182. package/dist/test/allocation/allocation.examples.js.map +1 -1
  183. package/dist/test/bind/func/func.examples.d.ts +19 -1
  184. package/dist/test/bind/func/func.examples.d.ts.map +1 -1
  185. package/dist/test/bind/func/func.examples.js +36 -1
  186. package/dist/test/bind/func/func.examples.js.map +1 -1
  187. package/dist/test/calendar/calendar.examples.d.ts +2 -0
  188. package/dist/test/calendar/calendar.examples.d.ts.map +1 -1
  189. package/dist/test/calendar/calendar.examples.js +80 -2
  190. package/dist/test/calendar/calendar.examples.js.map +1 -1
  191. package/dist/test/decision/queue.examples.d.ts +1 -0
  192. package/dist/test/decision/queue.examples.d.ts.map +1 -1
  193. package/dist/test/decision/queue.examples.js +12 -0
  194. package/dist/test/decision/queue.examples.js.map +1 -1
  195. package/dist/test/examples-package.d.ts.map +1 -1
  196. package/dist/test/examples-package.js +5 -4
  197. package/dist/test/examples-package.js.map +1 -1
  198. package/dist/test/flowchart/flowchart.examples.d.ts +1250 -4605
  199. package/dist/test/flowchart/flowchart.examples.d.ts.map +1 -1
  200. package/dist/test/flowchart/flowchart.examples.js +861 -512
  201. package/dist/test/flowchart/flowchart.examples.js.map +1 -1
  202. package/dist/test/ontology/ontology.examples.d.ts +2 -3
  203. package/dist/test/ontology/ontology.examples.d.ts.map +1 -1
  204. package/dist/test/ontology/ontology.examples.js +32 -21
  205. package/dist/test/ontology/ontology.examples.js.map +1 -1
  206. package/dist/test/plan/plan-events.examples.d.ts +1 -0
  207. package/dist/test/plan/plan-events.examples.d.ts.map +1 -1
  208. package/dist/test/plan/plan-events.examples.js +44 -0
  209. package/dist/test/plan/plan-events.examples.js.map +1 -1
  210. package/dist/test/plan/plan-nested.examples.d.ts +2 -2
  211. package/dist/test/plan/plan-nested.examples.js +5 -5
  212. package/dist/test/plan/plan-nested.examples.js.map +1 -1
  213. package/dist/test/plan/plan-records.examples.d.ts.map +1 -1
  214. package/dist/test/plan/plan-records.examples.js +1 -1
  215. package/dist/test/plan/plan-records.examples.js.map +1 -1
  216. package/dist/test/query/query.examples.d.ts +2 -0
  217. package/dist/test/query/query.examples.d.ts.map +1 -1
  218. package/dist/test/query/query.examples.js +37 -1
  219. package/dist/test/query/query.examples.js.map +1 -1
  220. package/dist/test/roster/roster.examples.d.ts +2 -0
  221. package/dist/test/roster/roster.examples.d.ts.map +1 -1
  222. package/dist/test/roster/roster.examples.js +76 -15
  223. package/dist/test/roster/roster.examples.js.map +1 -1
  224. package/dist/test/schematic/schematic-records.examples.d.ts.map +1 -1
  225. package/dist/test/schematic/schematic-records.examples.js +6 -4
  226. package/dist/test/schematic/schematic-records.examples.js.map +1 -1
  227. package/dist/test/schematic/schematic.examples.d.ts +1 -0
  228. package/dist/test/schematic/schematic.examples.d.ts.map +1 -1
  229. package/dist/test/schematic/schematic.examples.js +144 -0
  230. package/dist/test/schematic/schematic.examples.js.map +1 -1
  231. package/dist/test/sheet/sheet-actions.examples.d.ts +1264 -0
  232. package/dist/test/sheet/sheet-actions.examples.d.ts.map +1 -0
  233. package/dist/test/sheet/sheet-actions.examples.js +394 -0
  234. package/dist/test/sheet/sheet-actions.examples.js.map +1 -0
  235. package/dist/test/sheet/sheet.examples.d.ts +1 -0
  236. package/dist/test/sheet/sheet.examples.d.ts.map +1 -1
  237. package/dist/test/sheet/sheet.examples.js +77 -0
  238. package/dist/test/sheet/sheet.examples.js.map +1 -1
  239. package/dist/test/studio/studio.examples.d.ts +1 -0
  240. package/dist/test/studio/studio.examples.d.ts.map +1 -1
  241. package/dist/test/studio/studio.examples.js +18 -8
  242. package/dist/test/studio/studio.examples.js.map +1 -1
  243. package/package.json +12 -12
  244. package/dist/src/diff/index.d.ts +0 -407
  245. package/dist/src/diff/index.d.ts.map +0 -1
  246. package/dist/src/diff/index.js +0 -203
  247. package/dist/src/diff/index.js.map +0 -1
  248. package/dist/src/experiment/index.d.ts +0 -1033
  249. package/dist/src/experiment/index.d.ts.map +0 -1
  250. package/dist/src/experiment/index.js +0 -197
  251. package/dist/src/experiment/index.js.map +0 -1
  252. package/dist/src/experiment/types.d.ts +0 -1093
  253. package/dist/src/experiment/types.d.ts.map +0 -1
  254. package/dist/src/experiment/types.js +0 -423
  255. package/dist/src/experiment/types.js.map +0 -1
  256. package/dist/src/flowchart/over.d.ts +0 -227
  257. package/dist/src/flowchart/over.d.ts.map +0 -1
  258. package/dist/src/flowchart/over.js +0 -213
  259. package/dist/src/flowchart/over.js.map +0 -1
  260. package/dist/src/flowchart/patch.d.ts +0 -64
  261. package/dist/src/flowchart/patch.d.ts.map +0 -1
  262. package/dist/src/flowchart/patch.js +0 -67
  263. package/dist/src/flowchart/patch.js.map +0 -1
  264. package/dist/src/flowchart/values.d.ts +0 -271
  265. package/dist/src/flowchart/values.d.ts.map +0 -1
  266. package/dist/src/flowchart/values.js +0 -220
  267. package/dist/src/flowchart/values.js.map +0 -1
  268. package/dist/src/flowchart/window.d.ts +0 -306
  269. package/dist/src/flowchart/window.d.ts.map +0 -1
  270. package/dist/src/flowchart/window.js +0 -63
  271. package/dist/src/flowchart/window.js.map +0 -1
  272. package/dist/src/runtime/diff.d.ts +0 -36
  273. package/dist/src/runtime/diff.d.ts.map +0 -1
  274. package/dist/src/runtime/diff.js +0 -34
  275. package/dist/src/runtime/diff.js.map +0 -1
  276. package/dist/src/runtime/experiment.d.ts +0 -48
  277. package/dist/src/runtime/experiment.d.ts.map +0 -1
  278. package/dist/src/runtime/experiment.js +0 -10
  279. package/dist/src/runtime/experiment.js.map +0 -1
  280. package/dist/test/diff/diff.examples.d.ts +0 -313
  281. package/dist/test/diff/diff.examples.d.ts.map +0 -1
  282. package/dist/test/diff/diff.examples.js +0 -452
  283. package/dist/test/diff/diff.examples.js.map +0 -1
  284. package/dist/test/experiment/experiment.examples.d.ts +0 -1512
  285. package/dist/test/experiment/experiment.examples.d.ts.map +0 -1
  286. package/dist/test/experiment/experiment.examples.js +0 -609
  287. package/dist/test/experiment/experiment.examples.js.map +0 -1
@@ -1,227 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Elara AI Pty Ltd
3
- * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
- */
5
- /**
6
- * `Flowchart.over(states, { … })` (#1244, `Flowchart Builder Spec.md` §3.4,
7
- * §4.3): one flow built from an app's own tables — its states, its
8
- * transitions, its lanes and its decisions — through the row mappers the
9
- * flowchart took its tables with before it held flows. A flow computed from
10
- * the app's data — transitions mined from scans — is shown this way, as
11
- * `<Flowchart data={Flowchart.over(…)}>`, as `Plan.over` lays rows out over a
12
- * dataset. The flowchart narrows no table of the host's (#1346): a task
13
- * narrows the rows it builds a flow from.
14
- *
15
- * @packageDocumentation
16
- */
17
- import { ArrayType, DateTimeType, IntegerType, OptionType, StringType, StructType, type ExprType, type FloatType, type SubtypeExprOrValue, type TypeOf } from "@elaraai/east";
18
- import { FlowchartFlowType, FlowchartLaneType, FlowchartLinkKindType, FlowchartLinkType, FlowchartStateType, FlowchartTriggerType } from "./types.js";
19
- import type { FlowchartLinkKindLiteral } from "./values.js";
20
- /**
21
- * The struct element type of a `SubtypeExprOrValue<ArrayType<StructType>>`.
22
- */
23
- export type RowElement<T extends SubtypeExprOrValue<ArrayType<StructType>>> = TypeOf<T> extends ArrayType<infer S> ? (S extends StructType ? S : never) : never;
24
- /**
25
- * Fields the `state` mapper returns — one state node, before defaults.
26
- */
27
- export interface FlowchartStateFields {
28
- /** Short mono code — the node identity ("IND"). */
29
- key: SubtypeExprOrValue<StringType>;
30
- /** Optional display label under the code. */
31
- label?: SubtypeExprOrValue<StringType>;
32
- /** The lane (ordered phase) this state belongs to. */
33
- lane: SubtypeExprOrValue<StringType>;
34
- /** Optional state-class member count → the ×N badge (an Option so per-row absence is expressible). */
35
- members?: SubtypeExprOrValue<OptionType<IntegerType>>;
36
- /** Optional free-text notes surfaced on hover / inspector. */
37
- notes?: SubtypeExprOrValue<StringType>;
38
- }
39
- /**
40
- * Evidence fields the `link` mapper may return — all optional, per-row
41
- * absence via each field's Option.
42
- */
43
- export interface FlowchartEvidenceFields {
44
- /** Total measured volume behind the arrow (drives stroke weight + badge). */
45
- volume?: SubtypeExprOrValue<OptionType<FloatType>>;
46
- /** Event count behind the arrow (e.g. cage moves). */
47
- count?: SubtypeExprOrValue<OptionType<IntegerType>>;
48
- /** When the evidence was measured. */
49
- measuredAt?: SubtypeExprOrValue<OptionType<DateTimeType>>;
50
- /** Volume unit suffix for badges ("parcels"). */
51
- unit?: SubtypeExprOrValue<StringType>;
52
- }
53
- /**
54
- * Fields the `link` mapper returns — one transition, before defaults.
55
- */
56
- export interface FlowchartLinkFields {
57
- /** Optional stable identity (selection / delete events); default derived from endpoints. */
58
- key?: SubtypeExprOrValue<StringType>;
59
- /** Source state key. */
60
- from: SubtypeExprOrValue<StringType>;
61
- /** Target state key. */
62
- to: SubtypeExprOrValue<StringType>;
63
- /** Optional kind — "planned" (default, solid) | "observed" (dashed). */
64
- kind?: SubtypeExprOrValue<FlowchartLinkKindType> | FlowchartLinkKindLiteral;
65
- /** Optional decision trigger key (0..1 per link) → the lettered diamond. */
66
- trigger?: SubtypeExprOrValue<OptionType<StringType>>;
67
- /** Optional imported evidence (weight, badges, provenance). */
68
- evidence?: FlowchartEvidenceFields;
69
- }
70
- /**
71
- * Fields the `lane` mapper returns — one ordered phase band.
72
- */
73
- export interface FlowchartLaneFields {
74
- /** Lane identity referenced by states. */
75
- key: SubtypeExprOrValue<StringType>;
76
- /** Optional band header label (defaults to the key, uppercased). */
77
- label?: SubtypeExprOrValue<StringType>;
78
- }
79
- /**
80
- * Fields the `trigger` mapper returns — one decision trigger.
81
- */
82
- export interface FlowchartTriggerFields {
83
- /** Trigger identity referenced by links. */
84
- key: SubtypeExprOrValue<StringType>;
85
- /** Decision name ("route"). */
86
- label: SubtypeExprOrValue<StringType>;
87
- /** Optional diamond letter (default: first letter of the label). */
88
- letter?: SubtypeExprOrValue<StringType>;
89
- /** Optional owning role / system ("sort-planner"). */
90
- owner?: SubtypeExprOrValue<StringType>;
91
- /** Optional state keys queued at the decision. */
92
- queue?: SubtypeExprOrValue<ArrayType<StringType>>;
93
- /** Optional outcome summary line ("CH* (×14 chutes)"). */
94
- outcomes?: SubtypeExprOrValue<StringType>;
95
- }
96
- /**
97
- * A literal lanes input — plain `{ key, label? }` entries in band order.
98
- */
99
- export type FlowchartLaneLiteral = {
100
- key: string;
101
- label?: string;
102
- };
103
- /**
104
- * The tables beside the states `Flowchart.over` builds a flow from, and the
105
- * row mappers that read them.
106
- *
107
- * @typeParam S - The states-table row struct
108
- * @typeParam L - The links-table row struct
109
- * @typeParam N - The lanes-table row struct
110
- * @typeParam T - The triggers-table row struct
111
- */
112
- export interface FlowchartTables<S extends StructType = StructType, L extends StructType = StructType, N extends StructType = StructType, T extends StructType = StructType> {
113
- /** Row mapper from a state row to node fields — omit when rows are already `Flowchart.Types.State`. */
114
- state?: (row: ExprType<S>) => FlowchartStateFields | ExprType<FlowchartStateType>;
115
- /** Row mapper from a link row to transition fields — omit when rows are already `Flowchart.Types.Link`. */
116
- link?: (row: ExprType<L>) => FlowchartLinkFields | ExprType<FlowchartLinkType>;
117
- /** Row mapper from a lane row to band fields — omit for literal `{ key, label? }` arrays or `Flowchart.Types.Lane` rows. */
118
- lane?: (row: ExprType<N>) => FlowchartLaneFields | ExprType<FlowchartLaneType>;
119
- /** Optional decision-trigger rows; links reference them by key. */
120
- triggers?: SubtypeExprOrValue<ArrayType<StructType>>;
121
- /** Row mapper from a trigger row — omit when rows are already `Flowchart.Types.Trigger`. */
122
- trigger?: (row: ExprType<T>) => FlowchartTriggerFields | ExprType<FlowchartTriggerType>;
123
- }
124
- /**
125
- * Builds one flow from an app's own tables — its states, its transitions, its
126
- * lanes and, optionally, its decisions — each read through its row mapper, or
127
- * taken as it is when its rows are already the flowchart's own type.
128
- *
129
- * @remarks
130
- * The flow has no `description`. Show it with
131
- * `<Flowchart data={Flowchart.over(…)}>`, read only, or with the host's
132
- * `onApply`. The flowchart never narrows it (#1346): its `slice` narrows only
133
- * the templates lists and the tabs that name a source, so a task narrows the
134
- * rows a flow is built from, before `Flowchart.over` reads them.
135
- *
136
- * @typeParam S - The states-table input
137
- * @typeParam L - The links-table input
138
- * @typeParam N - The lanes-table input
139
- * @typeParam T - The triggers-table input
140
- * @param states - The state rows
141
- * @param tables - The `links` and `lanes` tables (required), the `triggers`
142
- * table, and each table's row mapper: `state`, `link`, `lane`, `trigger`
143
- * ({@link FlowchartTables})
144
- * @returns An East expression of `Flowchart.Types.Flow`
145
- *
146
- * @example
147
- * ```tsx
148
- * // .tsx file with the `@jsxImportSource @elaraai/e3-ui` pragma
149
- * import { ArrayType, DateTimeType, East, FloatType, IntegerType, OptionType, StringType, StructType, none, some, variant } from "@elaraai/east";
150
- * import { Box, Reactive, UIComponentType } from "@elaraai/east-ui";
151
- * import { Data, Flowchart } from "@elaraai/e3-ui";
152
- * import e3 from "@elaraai/e3";
153
- *
154
- * export const DepotState = StructType({ code: StringType, name: StringType, phase: StringType, slots: OptionType(IntegerType) });
155
- * export const depotStates = e3.input("flowchart_depot_states", ArrayType(DepotState), variant("value", [
156
- * { code: "ARV", name: "Arrived", phase: "intake", slots: none },
157
- * { code: "SCN", name: "Scanned", phase: "intake", slots: none },
158
- * { code: "IND", name: "Inducting", phase: "induct", slots: none },
159
- * { code: "LBL", name: "Labelled", phase: "induct", slots: none },
160
- * { code: "CH*", name: "Sort chutes (class)", phase: "sort", slots: some(14n) },
161
- * { code: "SRD", name: "Sorted", phase: "sort", slots: none },
162
- * { code: "HLD", name: "Held", phase: "hold", slots: none },
163
- * { code: "CLR", name: "Cleared", phase: "hold", slots: none },
164
- * { code: "LDD", name: "Loaded", phase: "dispatch", slots: none },
165
- * { code: "DSP", name: "Dispatched", phase: "dispatch", slots: none },
166
- * ]));
167
- * export const ScanTransition = StructType({
168
- * id: StringType, src: StringType, dst: StringType, kind: Flowchart.Types.Kind,
169
- * trigger: OptionType(StringType), parcels: OptionType(FloatType), n: OptionType(IntegerType),
170
- * at: DateTimeType, service: StringType, units: ArrayType(StringType),
171
- * });
172
- * export const scanTransitions = e3.input("flowchart_depot_scans", ArrayType(ScanTransition), variant("value", [
173
- * { id: "l1", src: "ARV", dst: "SCN", kind: variant("planned", null), trigger: none, parcels: some(18460.0), n: some(412n), at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: ["C"] },
174
- * { id: "l2", src: "SCN", dst: "IND", kind: variant("planned", null), trigger: none, parcels: some(7720.0), n: some(171n), at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: ["C"] },
175
- * { id: "l3", src: "IND", dst: "IND", kind: variant("planned", null), trigger: none, parcels: none, n: some(2n), at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: ["C"] },
176
- * { id: "l4", src: "IND", dst: "CH*", kind: variant("planned", null), trigger: some("route"), parcels: some(17350.0), n: some(386n), at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: ["C", "T"] },
177
- * { id: "l5", src: "CH*", dst: "SRD", kind: variant("planned", null), trigger: none, parcels: some(17210.0), n: some(383n), at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: ["T"] },
178
- * { id: "l6", src: "SRD", dst: "HLD", kind: variant("observed", null), trigger: none, parcels: some(1080.0), n: some(24n), at: new Date("2026-06-30T00:00:00Z"), service: "express", units: ["T"] },
179
- * { id: "l7", src: "HLD", dst: "CLR", kind: variant("planned", null), trigger: some("customs"), parcels: some(8350.0), n: some(186n), at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: ["T"] },
180
- * { id: "l8", src: "CLR", dst: "LDD", kind: variant("planned", null), trigger: none, parcels: some(8240.0), n: some(183n), at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: ["T"] },
181
- * { id: "l9", src: "LDD", dst: "DSP", kind: variant("planned", null), trigger: none, parcels: some(8160.0), n: some(181n), at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: [] },
182
- * { id: "l10", src: "DSP", dst: "DLV", kind: variant("planned", null), trigger: none, parcels: none, n: none, at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: [] },
183
- * ]));
184
- * export const DepotDecision = StructType({ id: StringType, name: StringType, who: StringType });
185
- * export const depotDecisions = e3.input("flowchart_depot_decisions", ArrayType(DepotDecision), variant("value", [
186
- * { id: "route", name: "route", who: "sort-planner" },
187
- * { id: "customs", name: "customs", who: "customs-desk" },
188
- * ]));
189
- *
190
- * const flowchart = East.function([], UIComponentType, (_$) => (
191
- * <Reactive>{$ => {
192
- * const states = $.let(Data.bind(depotStates));
193
- * const scans = $.let(Data.bind(scanTransitions));
194
- * const decisions = $.let(Data.bind(depotDecisions));
195
- * return (
196
- * <Box height="600px">
197
- * <Flowchart
198
- * data={Flowchart.over(states.read(), {
199
- * state: s => ({ key: s.code, label: s.name, lane: s.phase, members: s.slots }),
200
- * links: scans.read(),
201
- * link: l => ({
202
- * key: l.id, from: l.src, to: l.dst, kind: l.kind, trigger: l.trigger,
203
- * evidence: { volume: l.parcels, count: l.n, measuredAt: some(l.at), unit: "parcels" },
204
- * }),
205
- * lanes: [
206
- * { key: "intake", label: "Intake" }, { key: "induct", label: "Induct" },
207
- * { key: "sort", label: "Sort" }, { key: "hold", label: "Hold" },
208
- * { key: "dispatch", label: "Dispatch" },
209
- * ],
210
- * triggers: decisions.read(),
211
- * trigger: t => ({ key: t.id, label: t.name, owner: t.who }),
212
- * })}
213
- * freshness={{ label: "evidence-2026.06", date: new Date("2026-06-30T00:00:00Z") }}
214
- * name="scans"
215
- * />
216
- * </Box>
217
- * );
218
- * }}</Reactive>
219
- * ));
220
- * ```
221
- */
222
- export declare function flowchartOver<S extends SubtypeExprOrValue<ArrayType<StructType>>, L extends SubtypeExprOrValue<ArrayType<StructType>>, N extends SubtypeExprOrValue<ArrayType<StructType>> = [], T extends SubtypeExprOrValue<ArrayType<StructType>> = []>(states: S, tables: FlowchartTables<RowElement<S>, RowElement<L>, RowElement<N>, RowElement<T>> & {
223
- links: L;
224
- lanes: N | readonly FlowchartLaneLiteral[];
225
- triggers?: T;
226
- }): ExprType<FlowchartFlowType>;
227
- //# sourceMappingURL=over.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"over.d.ts","sourceRoot":"","sources":["../../../src/flowchart/over.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,EACH,SAAS,EACT,YAAY,EAGZ,WAAW,EACX,UAAU,EACV,UAAU,EACV,UAAU,EAIV,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,kBAAkB,EACvB,KAAK,MAAM,EACd,MAAM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SAAS,kBAAkB,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,GAAG,EAAE,EAExD,MAAM,EAAE,CAAC,EACT,MAAM,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,GAC7E;IAAE,KAAK,EAAE,CAAC,CAAC;IAAC,KAAK,EAAE,CAAC,GAAG,SAAS,oBAAoB,EAAE,CAAC;IAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;CAAE,GAC7E,QAAQ,CAAC,iBAAiB,CAAC,CAwF7B"}
@@ -1,213 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Elara AI Pty Ltd
3
- * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
- */
5
- /**
6
- * `Flowchart.over(states, { … })` (#1244, `Flowchart Builder Spec.md` §3.4,
7
- * §4.3): one flow built from an app's own tables — its states, its
8
- * transitions, its lanes and its decisions — through the row mappers the
9
- * flowchart took its tables with before it held flows. A flow computed from
10
- * the app's data — transitions mined from scans — is shown this way, as
11
- * `<Flowchart data={Flowchart.over(…)}>`, as `Plan.over` lays rows out over a
12
- * dataset. The flowchart narrows no table of the host's (#1346): a task
13
- * narrows the rows it builds a flow from.
14
- *
15
- * @packageDocumentation
16
- */
17
- import { ArrayType, DateTimeType, East, Expr, IntegerType, OptionType, StringType, StructType, none, some, variant, } from "@elaraai/east";
18
- import { mapRows } from "@elaraai/east-ui/internal";
19
- import { FlowchartEvidenceType, FlowchartFlowType, FlowchartLaneType, FlowchartLinkKindType, FlowchartLinkType, FlowchartStateType, FlowchartTriggerType, } from "./types.js";
20
- // ============================================================================
21
- // Flowchart.over
22
- // ============================================================================
23
- /** Resolves a kind literal / value into the option envelope. */
24
- function kindOption(kind) {
25
- if (kind === undefined)
26
- return East.value(none, OptionType(FlowchartLinkKindType));
27
- if (typeof kind === "string")
28
- return East.value(some(variant(kind, null)), OptionType(FlowchartLinkKindType));
29
- return East.value(some(kind), OptionType(FlowchartLinkKindType));
30
- }
31
- /**
32
- * Builds one flow from an app's own tables — its states, its transitions, its
33
- * lanes and, optionally, its decisions — each read through its row mapper, or
34
- * taken as it is when its rows are already the flowchart's own type.
35
- *
36
- * @remarks
37
- * The flow has no `description`. Show it with
38
- * `<Flowchart data={Flowchart.over(…)}>`, read only, or with the host's
39
- * `onApply`. The flowchart never narrows it (#1346): its `slice` narrows only
40
- * the templates lists and the tabs that name a source, so a task narrows the
41
- * rows a flow is built from, before `Flowchart.over` reads them.
42
- *
43
- * @typeParam S - The states-table input
44
- * @typeParam L - The links-table input
45
- * @typeParam N - The lanes-table input
46
- * @typeParam T - The triggers-table input
47
- * @param states - The state rows
48
- * @param tables - The `links` and `lanes` tables (required), the `triggers`
49
- * table, and each table's row mapper: `state`, `link`, `lane`, `trigger`
50
- * ({@link FlowchartTables})
51
- * @returns An East expression of `Flowchart.Types.Flow`
52
- *
53
- * @example
54
- * ```tsx
55
- * // .tsx file with the `@jsxImportSource @elaraai/e3-ui` pragma
56
- * import { ArrayType, DateTimeType, East, FloatType, IntegerType, OptionType, StringType, StructType, none, some, variant } from "@elaraai/east";
57
- * import { Box, Reactive, UIComponentType } from "@elaraai/east-ui";
58
- * import { Data, Flowchart } from "@elaraai/e3-ui";
59
- * import e3 from "@elaraai/e3";
60
- *
61
- * export const DepotState = StructType({ code: StringType, name: StringType, phase: StringType, slots: OptionType(IntegerType) });
62
- * export const depotStates = e3.input("flowchart_depot_states", ArrayType(DepotState), variant("value", [
63
- * { code: "ARV", name: "Arrived", phase: "intake", slots: none },
64
- * { code: "SCN", name: "Scanned", phase: "intake", slots: none },
65
- * { code: "IND", name: "Inducting", phase: "induct", slots: none },
66
- * { code: "LBL", name: "Labelled", phase: "induct", slots: none },
67
- * { code: "CH*", name: "Sort chutes (class)", phase: "sort", slots: some(14n) },
68
- * { code: "SRD", name: "Sorted", phase: "sort", slots: none },
69
- * { code: "HLD", name: "Held", phase: "hold", slots: none },
70
- * { code: "CLR", name: "Cleared", phase: "hold", slots: none },
71
- * { code: "LDD", name: "Loaded", phase: "dispatch", slots: none },
72
- * { code: "DSP", name: "Dispatched", phase: "dispatch", slots: none },
73
- * ]));
74
- * export const ScanTransition = StructType({
75
- * id: StringType, src: StringType, dst: StringType, kind: Flowchart.Types.Kind,
76
- * trigger: OptionType(StringType), parcels: OptionType(FloatType), n: OptionType(IntegerType),
77
- * at: DateTimeType, service: StringType, units: ArrayType(StringType),
78
- * });
79
- * export const scanTransitions = e3.input("flowchart_depot_scans", ArrayType(ScanTransition), variant("value", [
80
- * { id: "l1", src: "ARV", dst: "SCN", kind: variant("planned", null), trigger: none, parcels: some(18460.0), n: some(412n), at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: ["C"] },
81
- * { id: "l2", src: "SCN", dst: "IND", kind: variant("planned", null), trigger: none, parcels: some(7720.0), n: some(171n), at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: ["C"] },
82
- * { id: "l3", src: "IND", dst: "IND", kind: variant("planned", null), trigger: none, parcels: none, n: some(2n), at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: ["C"] },
83
- * { id: "l4", src: "IND", dst: "CH*", kind: variant("planned", null), trigger: some("route"), parcels: some(17350.0), n: some(386n), at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: ["C", "T"] },
84
- * { id: "l5", src: "CH*", dst: "SRD", kind: variant("planned", null), trigger: none, parcels: some(17210.0), n: some(383n), at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: ["T"] },
85
- * { id: "l6", src: "SRD", dst: "HLD", kind: variant("observed", null), trigger: none, parcels: some(1080.0), n: some(24n), at: new Date("2026-06-30T00:00:00Z"), service: "express", units: ["T"] },
86
- * { id: "l7", src: "HLD", dst: "CLR", kind: variant("planned", null), trigger: some("customs"), parcels: some(8350.0), n: some(186n), at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: ["T"] },
87
- * { id: "l8", src: "CLR", dst: "LDD", kind: variant("planned", null), trigger: none, parcels: some(8240.0), n: some(183n), at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: ["T"] },
88
- * { id: "l9", src: "LDD", dst: "DSP", kind: variant("planned", null), trigger: none, parcels: some(8160.0), n: some(181n), at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: [] },
89
- * { id: "l10", src: "DSP", dst: "DLV", kind: variant("planned", null), trigger: none, parcels: none, n: none, at: new Date("2026-06-30T00:00:00Z"), service: "standard", units: [] },
90
- * ]));
91
- * export const DepotDecision = StructType({ id: StringType, name: StringType, who: StringType });
92
- * export const depotDecisions = e3.input("flowchart_depot_decisions", ArrayType(DepotDecision), variant("value", [
93
- * { id: "route", name: "route", who: "sort-planner" },
94
- * { id: "customs", name: "customs", who: "customs-desk" },
95
- * ]));
96
- *
97
- * const flowchart = East.function([], UIComponentType, (_$) => (
98
- * <Reactive>{$ => {
99
- * const states = $.let(Data.bind(depotStates));
100
- * const scans = $.let(Data.bind(scanTransitions));
101
- * const decisions = $.let(Data.bind(depotDecisions));
102
- * return (
103
- * <Box height="600px">
104
- * <Flowchart
105
- * data={Flowchart.over(states.read(), {
106
- * state: s => ({ key: s.code, label: s.name, lane: s.phase, members: s.slots }),
107
- * links: scans.read(),
108
- * link: l => ({
109
- * key: l.id, from: l.src, to: l.dst, kind: l.kind, trigger: l.trigger,
110
- * evidence: { volume: l.parcels, count: l.n, measuredAt: some(l.at), unit: "parcels" },
111
- * }),
112
- * lanes: [
113
- * { key: "intake", label: "Intake" }, { key: "induct", label: "Induct" },
114
- * { key: "sort", label: "Sort" }, { key: "hold", label: "Hold" },
115
- * { key: "dispatch", label: "Dispatch" },
116
- * ],
117
- * triggers: decisions.read(),
118
- * trigger: t => ({ key: t.id, label: t.name, owner: t.who }),
119
- * })}
120
- * freshness={{ label: "evidence-2026.06", date: new Date("2026-06-30T00:00:00Z") }}
121
- * name="scans"
122
- * />
123
- * </Box>
124
- * );
125
- * }}</Reactive>
126
- * ));
127
- * ```
128
- */
129
- export function flowchartOver(states, tables) {
130
- const config = tables;
131
- const stateMapper = config.state;
132
- const resolvedStates = stateMapper === undefined
133
- ? East.value(states, ArrayType(FlowchartStateType))
134
- : mapRows(East.value(states), FlowchartStateType, (row) => {
135
- const r = stateMapper(row);
136
- if (r instanceof Expr)
137
- return East.value(r, FlowchartStateType);
138
- return East.value({
139
- key: r.key,
140
- label: r.label !== undefined ? some(r.label) : none,
141
- lane: r.lane,
142
- members: r.members !== undefined ? r.members : none,
143
- notes: r.notes !== undefined ? some(r.notes) : none,
144
- }, FlowchartStateType);
145
- });
146
- const linkMapper = config.link;
147
- const resolvedLinks = linkMapper === undefined
148
- ? East.value(config.links, ArrayType(FlowchartLinkType))
149
- : mapRows(East.value(config.links), FlowchartLinkType, (row) => {
150
- const r = linkMapper(row);
151
- if (r instanceof Expr)
152
- return East.value(r, FlowchartLinkType);
153
- return East.value({
154
- key: r.key !== undefined ? some(r.key) : none,
155
- from: r.from,
156
- to: r.to,
157
- kind: kindOption(r.kind),
158
- trigger: r.trigger !== undefined ? r.trigger : none,
159
- evidence: r.evidence !== undefined
160
- ? some(East.value({
161
- volume: r.evidence.volume !== undefined ? r.evidence.volume : none,
162
- count: r.evidence.count !== undefined ? r.evidence.count : none,
163
- measuredAt: r.evidence.measuredAt !== undefined ? r.evidence.measuredAt : none,
164
- unit: r.evidence.unit !== undefined ? some(r.evidence.unit) : none,
165
- }, FlowchartEvidenceType))
166
- : none,
167
- }, FlowchartLinkType);
168
- });
169
- const laneMapper = config.lane;
170
- const lanes = config.lanes;
171
- const resolvedLanes = laneMapper !== undefined
172
- ? mapRows(East.value(lanes), FlowchartLaneType, (row) => {
173
- const r = laneMapper(row);
174
- if (r instanceof Expr)
175
- return East.value(r, FlowchartLaneType);
176
- return East.value({
177
- key: r.key,
178
- label: r.label !== undefined ? some(r.label) : none,
179
- }, FlowchartLaneType);
180
- })
181
- : Array.isArray(lanes)
182
- ? East.value(lanes.map(l => ({
183
- key: l.key,
184
- label: l.label !== undefined ? some(l.label) : none,
185
- })), ArrayType(FlowchartLaneType))
186
- : East.value(lanes, ArrayType(FlowchartLaneType));
187
- const triggerMapper = config.trigger;
188
- const resolvedTriggers = config.triggers === undefined
189
- ? East.value([], ArrayType(FlowchartTriggerType))
190
- : triggerMapper === undefined
191
- ? East.value(config.triggers, ArrayType(FlowchartTriggerType))
192
- : mapRows(East.value(config.triggers), FlowchartTriggerType, (row) => {
193
- const r = triggerMapper(row);
194
- if (r instanceof Expr)
195
- return East.value(r, FlowchartTriggerType);
196
- return East.value({
197
- key: r.key,
198
- label: r.label,
199
- letter: r.letter !== undefined ? some(r.letter) : none,
200
- owner: r.owner !== undefined ? some(r.owner) : none,
201
- queue: r.queue !== undefined ? some(East.value(r.queue, ArrayType(StringType))) : none,
202
- outcomes: r.outcomes !== undefined ? some(r.outcomes) : none,
203
- }, FlowchartTriggerType);
204
- });
205
- return East.value({
206
- description: none,
207
- lanes: resolvedLanes,
208
- states: resolvedStates,
209
- links: resolvedLinks,
210
- triggers: resolvedTriggers,
211
- }, FlowchartFlowType);
212
- }
213
- //# sourceMappingURL=over.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"over.js","sourceRoot":"","sources":["../../../src/flowchart/over.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,EACH,SAAS,EACT,YAAY,EACZ,IAAI,EACJ,IAAI,EACJ,WAAW,EACX,UAAU,EACV,UAAU,EACV,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,OAAO,GAKV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,EACH,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,GACvB,MAAM,YAAY,CAAC;AA0HpB,+EAA+E;AAC/E,iBAAiB;AACjB,+E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C,GAAG,CAAC,CAAC;gBAC7B,IAAI,CAAC,YAAY,IAAI;oBAAE,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,oBAAoB,CAAC,CAAC;gBAClE,OAAO,IAAI,CAAC,KAAK,CAAC;oBACd,GAAG,EAAE,CAAC,CAAC,GAAG;oBACV,KAAK,EAAE,CAAC,CAAC,KAAK;oBACd,MAAM,EAAE,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI;oBACtD,KAAK,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI;oBACnD,KAAK,EAAE,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI;oBACtF,QAAQ,EAAE,CAAC,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI;iBAC/D,EAAE,oBAAoB,CAAC,CAAC;YAC7B,CAAC,CAAC,CAAC;IAEX,OAAO,IAAI,CAAC,KAAK,CAAC;QACd,WAAW,EAAE,IAAI;QACjB,KAAK,EAAE,aAAa;QACpB,MAAM,EAAE,cAAc;QACtB,KAAK,EAAE,aAAa;QACpB,QAAQ,EAAE,gBAAgB;KAC7B,EAAE,iBAAiB,CAAC,CAAC;AAC1B,CAAC"}
@@ -1,64 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Elara AI Pty Ltd
3
- * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
- */
5
- /**
6
- * `Flowchart.patch(T, { … })` (#1244, `Flowchart Builder Spec.md` §4.3): a
7
- * patch over one of a flow's rows — a state, a transition, a lane or a
8
- * decision — every field an `Option`, the fields it leaves out `none`. It is
9
- * the row patch `Sheet.patch` and `Schedule.patch` build: a library card's
10
- * `drop` returns one, the fields a card sets where it lands, and the patch's
11
- * type names the row it lands on.
12
- *
13
- * @packageDocumentation
14
- */
15
- import { type ExprType } from "@elaraai/east";
16
- import { type SchedulePatchInput, type SchedulePatchOf } from "../schedule/patch.js";
17
- import { FlowchartLaneType, FlowchartLinkType, FlowchartStateType, FlowchartTriggerType } from "./types.js";
18
- /** A flow's row types: a state, a transition, a lane and a decision — what `Flowchart.patch` patches. */
19
- export type FlowchartRowType = FlowchartStateType | FlowchartLinkType | FlowchartLaneType | FlowchartTriggerType;
20
- /**
21
- * The TS type of `Flowchart.Types.Patch(R)`: every field of the row as an `Option`.
22
- *
23
- * @typeParam R - The row type
24
- */
25
- export type FlowchartPatchOf<R extends FlowchartRowType> = SchedulePatchOf<R>;
26
- /**
27
- * The literal-record input of `Flowchart.patch(R, …)`: every field of the row
28
- * optional, each a literal or an expression of the field's type; a field left
29
- * out is `none`.
30
- *
31
- * @typeParam R - The row type
32
- */
33
- export type FlowchartPatchInput<R extends FlowchartRowType> = SchedulePatchInput<R>;
34
- /**
35
- * `Flowchart.Types.Patch(R)`: a patch over one of a flow's rows — every field
36
- * of the row as an `Option`, `none` leaving the row's field as it is.
37
- *
38
- * @typeParam R - The row type
39
- * @param rowType - The row type: `Flowchart.Types.State`, `Link`, `Lane` or `Trigger`
40
- * @returns The patch type
41
- * @throws {Error} When the type is none of a flow's rows
42
- */
43
- export declare function FlowchartPatchTypeFor<R extends FlowchartRowType>(rowType: R): FlowchartPatchOf<R>;
44
- /**
45
- * Builds a patch over one of a flow's rows — `Flowchart.patch(R, { … })`: the
46
- * fields it sets, every other field `none`. A library card's `drop` returns
47
- * one: what a state template seeds the state it adds with, what a transition
48
- * template sets on the transition it lands on, and what an author's card sets
49
- * on the row its patch's type names.
50
- *
51
- * @remarks
52
- * It is the row patch `Sheet.patch` builds, over a flow's own rows. A field
53
- * that is an `Option` takes an `Option`: `label: some("Sorted")` sets a
54
- * state's label, `label: none` clears it, and leaving `label` out leaves it as
55
- * it is.
56
- *
57
- * @typeParam R - The row type
58
- * @param rowType - The row type: `Flowchart.Types.State`, `Link`, `Lane` or `Trigger`
59
- * @param record - The fields to set, each a literal or an expression of the field's type
60
- * @returns An expression of `Flowchart.Types.Patch(R)`
61
- * @throws {Error} When the type is none of a flow's rows
62
- */
63
- export declare function flowchartPatch<R extends FlowchartRowType>(rowType: R, record: FlowchartPatchInput<R>): ExprType<FlowchartPatchOf<R>>;
64
- //# sourceMappingURL=patch.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"patch.d.ts","sourceRoot":"","sources":["../../../src/flowchart/patch.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;GASG;AAEH,OAAO,EAAyC,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,EAAuC,KAAK,kBAAkB,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC1H,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAE5G,yGAAyG;AACzG,MAAM,MAAM,gBAAgB,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,iBAAiB,GAAG,oBAAoB,CAAC;AAEjH;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,gBAAgB,IAAI,eAAe,CAAC,CAAC,CAAC,CAAC;AAE9E;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,gBAAgB,IAAI,kBAAkB,CAAC,CAAC,CAAC,CAAC;AAiBpF;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,gBAAgB,EAAE,OAAO,EAAE,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAGjG;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,gBAAgB,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAGpI"}
@@ -1,67 +0,0 @@
1
- /**
2
- * Copyright (c) 2025 Elara AI Pty Ltd
3
- * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
- */
5
- /**
6
- * `Flowchart.patch(T, { … })` (#1244, `Flowchart Builder Spec.md` §4.3): a
7
- * patch over one of a flow's rows — a state, a transition, a lane or a
8
- * decision — every field an `Option`, the fields it leaves out `none`. It is
9
- * the row patch `Sheet.patch` and `Schedule.patch` build: a library card's
10
- * `drop` returns one, the fields a card sets where it lands, and the patch's
11
- * type names the row it lands on.
12
- *
13
- * @packageDocumentation
14
- */
15
- import { isTypeEqual, printType } from "@elaraai/east";
16
- import { SchedulePatchTypeFor, schedulePatch } from "../schedule/patch.js";
17
- import { FlowchartLaneType, FlowchartLinkType, FlowchartStateType, FlowchartTriggerType } from "./types.js";
18
- /** The row types a patch is over, each with the name a refusal gives it. */
19
- const ROWS = [
20
- [FlowchartStateType, "State"],
21
- [FlowchartLinkType, "Link"],
22
- [FlowchartLaneType, "Lane"],
23
- [FlowchartTriggerType, "Trigger"],
24
- ];
25
- /** Refuses a type that is none of a flow's rows, naming where it was given. */
26
- function checkRow(rowType, where) {
27
- if (!ROWS.some(([row]) => isTypeEqual(row, rowType))) {
28
- throw new Error(`${where}: patches one of a flow's rows — Flowchart.Types.${ROWS.map(([, name]) => name).join(", Flowchart.Types.")} — and this is ${printType(rowType)}`);
29
- }
30
- }
31
- /**
32
- * `Flowchart.Types.Patch(R)`: a patch over one of a flow's rows — every field
33
- * of the row as an `Option`, `none` leaving the row's field as it is.
34
- *
35
- * @typeParam R - The row type
36
- * @param rowType - The row type: `Flowchart.Types.State`, `Link`, `Lane` or `Trigger`
37
- * @returns The patch type
38
- * @throws {Error} When the type is none of a flow's rows
39
- */
40
- export function FlowchartPatchTypeFor(rowType) {
41
- checkRow(rowType, "Flowchart.Types.Patch");
42
- return SchedulePatchTypeFor(rowType);
43
- }
44
- /**
45
- * Builds a patch over one of a flow's rows — `Flowchart.patch(R, { … })`: the
46
- * fields it sets, every other field `none`. A library card's `drop` returns
47
- * one: what a state template seeds the state it adds with, what a transition
48
- * template sets on the transition it lands on, and what an author's card sets
49
- * on the row its patch's type names.
50
- *
51
- * @remarks
52
- * It is the row patch `Sheet.patch` builds, over a flow's own rows. A field
53
- * that is an `Option` takes an `Option`: `label: some("Sorted")` sets a
54
- * state's label, `label: none` clears it, and leaving `label` out leaves it as
55
- * it is.
56
- *
57
- * @typeParam R - The row type
58
- * @param rowType - The row type: `Flowchart.Types.State`, `Link`, `Lane` or `Trigger`
59
- * @param record - The fields to set, each a literal or an expression of the field's type
60
- * @returns An expression of `Flowchart.Types.Patch(R)`
61
- * @throws {Error} When the type is none of a flow's rows
62
- */
63
- export function flowchartPatch(rowType, record) {
64
- checkRow(rowType, "Flowchart.patch");
65
- return schedulePatch(rowType, record);
66
- }
67
- //# sourceMappingURL=patch.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"patch.js","sourceRoot":"","sources":["../../../src/flowchart/patch.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;GASG;AAEH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAgC,MAAM,eAAe,CAAC;AACrF,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAiD,MAAM,sBAAsB,CAAC;AAC1H,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAqB5G,4EAA4E;AAC5E,MAAM,IAAI,GAA6C;IACnD,CAAC,kBAAkB,EAAE,OAAO,CAAC;IAC7B,CAAC,iBAAiB,EAAE,MAAM,CAAC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