@fieldia/core 0.9.2 → 0.11.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.
Files changed (235) hide show
  1. package/README.md +199 -0
  2. package/package.json +1 -1
  3. package/schema/page.schema.json +1837 -94
  4. package/src/index.d.mts +1 -0
  5. package/src/index.d.ts +1 -0
  6. package/src/index.js +4 -1
  7. package/src/index.js.map +1 -1
  8. package/src/index.mjs +1 -0
  9. package/src/index.mjs.map +1 -1
  10. package/src/lib/expression/evaluator.d.mts +6 -5
  11. package/src/lib/expression/evaluator.d.ts +6 -5
  12. package/src/lib/expression/evaluator.js +37 -22
  13. package/src/lib/expression/evaluator.js.map +1 -1
  14. package/src/lib/expression/evaluator.mjs +32 -18
  15. package/src/lib/expression/evaluator.mjs.map +1 -1
  16. package/src/lib/expression/expression.d.mts +21 -0
  17. package/src/lib/expression/expression.d.ts +21 -0
  18. package/src/lib/expression/expression.js +29 -0
  19. package/src/lib/expression/expression.js.map +1 -0
  20. package/src/lib/expression/expression.mjs +26 -0
  21. package/src/lib/expression/expression.mjs.map +1 -0
  22. package/src/lib/expression/extractFieldNames.js +6 -1
  23. package/src/lib/expression/extractFieldNames.js.map +1 -1
  24. package/src/lib/expression/extractFieldNames.mjs +6 -1
  25. package/src/lib/expression/extractFieldNames.mjs.map +1 -1
  26. package/src/lib/expression/functions.d.mts +35 -0
  27. package/src/lib/expression/functions.d.ts +35 -0
  28. package/src/lib/expression/functions.js +129 -0
  29. package/src/lib/expression/functions.js.map +1 -0
  30. package/src/lib/expression/functions.mjs +124 -0
  31. package/src/lib/expression/functions.mjs.map +1 -0
  32. package/src/lib/expression/modifier.d.mts +3 -1
  33. package/src/lib/expression/modifier.d.ts +3 -1
  34. package/src/lib/expression/modifier.js +4 -27
  35. package/src/lib/expression/modifier.js.map +1 -1
  36. package/src/lib/expression/modifier.mjs +3 -26
  37. package/src/lib/expression/modifier.mjs.map +1 -1
  38. package/src/lib/expression/operations.d.mts +25 -0
  39. package/src/lib/expression/operations.d.ts +25 -0
  40. package/src/lib/expression/operations.js +81 -0
  41. package/src/lib/expression/operations.js.map +1 -0
  42. package/src/lib/expression/operations.mjs +72 -0
  43. package/src/lib/expression/operations.mjs.map +1 -0
  44. package/src/lib/expression/order.d.mts +11 -0
  45. package/src/lib/expression/order.d.ts +11 -0
  46. package/src/lib/expression/order.js +36 -0
  47. package/src/lib/expression/order.js.map +1 -0
  48. package/src/lib/expression/order.mjs +33 -0
  49. package/src/lib/expression/order.mjs.map +1 -0
  50. package/src/lib/expression/parser.d.mts +34 -4
  51. package/src/lib/expression/parser.d.ts +34 -4
  52. package/src/lib/expression/parser.js +72 -6
  53. package/src/lib/expression/parser.js.map +1 -1
  54. package/src/lib/expression/parser.mjs +72 -6
  55. package/src/lib/expression/parser.mjs.map +1 -1
  56. package/src/lib/expression/reads.d.mts +8 -0
  57. package/src/lib/expression/reads.d.ts +8 -0
  58. package/src/lib/expression/reads.js +48 -0
  59. package/src/lib/expression/reads.js.map +1 -0
  60. package/src/lib/expression/reads.mjs +44 -0
  61. package/src/lib/expression/reads.mjs.map +1 -0
  62. package/src/lib/expression/tokenizer.d.mts +7 -6
  63. package/src/lib/expression/tokenizer.d.ts +7 -6
  64. package/src/lib/expression/tokenizer.js +28 -18
  65. package/src/lib/expression/tokenizer.js.map +1 -1
  66. package/src/lib/expression/tokenizer.mjs +28 -18
  67. package/src/lib/expression/tokenizer.mjs.map +1 -1
  68. package/src/lib/format/actions.d.mts +692 -0
  69. package/src/lib/format/actions.d.ts +692 -0
  70. package/src/lib/format/actions.js +53 -0
  71. package/src/lib/format/actions.js.map +1 -0
  72. package/src/lib/format/actions.mjs +50 -0
  73. package/src/lib/format/actions.mjs.map +1 -0
  74. package/src/lib/format/field.d.mts +686 -5
  75. package/src/lib/format/field.d.ts +686 -5
  76. package/src/lib/format/field.js +117 -13
  77. package/src/lib/format/field.js.map +1 -1
  78. package/src/lib/format/field.mjs +116 -12
  79. package/src/lib/format/field.mjs.map +1 -1
  80. package/src/lib/format/layout.d.mts +1130 -22
  81. package/src/lib/format/layout.d.ts +1130 -22
  82. package/src/lib/format/layout.js +67 -5
  83. package/src/lib/format/layout.js.map +1 -1
  84. package/src/lib/format/layout.mjs +66 -4
  85. package/src/lib/format/layout.mjs.map +1 -1
  86. package/src/lib/format/layout.types.d.mts +2 -1
  87. package/src/lib/format/layout.types.d.ts +2 -1
  88. package/src/lib/format/names.d.mts +1 -1
  89. package/src/lib/format/names.d.ts +1 -1
  90. package/src/lib/format/names.js +1 -0
  91. package/src/lib/format/names.js.map +1 -1
  92. package/src/lib/format/names.mjs +1 -0
  93. package/src/lib/format/names.mjs.map +1 -1
  94. package/src/lib/format/page.d.mts +1007 -7
  95. package/src/lib/format/page.d.ts +1007 -7
  96. package/src/lib/format/page.js +28 -0
  97. package/src/lib/format/page.js.map +1 -1
  98. package/src/lib/format/page.mjs +28 -0
  99. package/src/lib/format/page.mjs.map +1 -1
  100. package/src/lib/format/part-look.d.mts +36 -0
  101. package/src/lib/format/part-look.d.ts +36 -0
  102. package/src/lib/format/part-look.js +23 -0
  103. package/src/lib/format/part-look.js.map +1 -0
  104. package/src/lib/format/part-look.mjs +20 -0
  105. package/src/lib/format/part-look.mjs.map +1 -0
  106. package/src/lib/format/references.d.mts +33 -1
  107. package/src/lib/format/references.d.ts +33 -1
  108. package/src/lib/format/references.js +227 -10
  109. package/src/lib/format/references.js.map +1 -1
  110. package/src/lib/format/references.mjs +227 -10
  111. package/src/lib/format/references.mjs.map +1 -1
  112. package/src/lib/format/translate.d.mts +20 -0
  113. package/src/lib/format/translate.d.ts +20 -0
  114. package/src/lib/format/translate.js +79 -21
  115. package/src/lib/format/translate.js.map +1 -1
  116. package/src/lib/format/translate.mjs +76 -21
  117. package/src/lib/format/translate.mjs.map +1 -1
  118. package/src/lib/record/check.d.mts +19 -1
  119. package/src/lib/record/check.d.ts +19 -1
  120. package/src/lib/record/check.js +84 -21
  121. package/src/lib/record/check.js.map +1 -1
  122. package/src/lib/record/check.mjs +82 -21
  123. package/src/lib/record/check.mjs.map +1 -1
  124. package/src/lib/record/compute.d.mts +24 -0
  125. package/src/lib/record/compute.d.ts +24 -0
  126. package/src/lib/record/compute.js +107 -0
  127. package/src/lib/record/compute.js.map +1 -0
  128. package/src/lib/record/compute.mjs +103 -0
  129. package/src/lib/record/compute.mjs.map +1 -0
  130. package/src/lib/record/data-source.d.mts +14 -2
  131. package/src/lib/record/data-source.d.ts +14 -2
  132. package/src/lib/record/data-source.js.map +1 -1
  133. package/src/lib/record/data-source.mjs.map +1 -1
  134. package/src/lib/record/env.d.mts +9 -0
  135. package/src/lib/record/env.d.ts +9 -0
  136. package/src/lib/record/env.js +28 -0
  137. package/src/lib/record/env.js.map +1 -0
  138. package/src/lib/record/env.mjs +25 -0
  139. package/src/lib/record/env.mjs.map +1 -0
  140. package/src/lib/record/form.d.mts +110 -18
  141. package/src/lib/record/form.d.ts +110 -18
  142. package/src/lib/record/form.js +497 -72
  143. package/src/lib/record/form.js.map +1 -1
  144. package/src/lib/record/form.mjs +497 -72
  145. package/src/lib/record/form.mjs.map +1 -1
  146. package/src/lib/record/inputs.d.mts +5 -0
  147. package/src/lib/record/inputs.d.ts +5 -0
  148. package/src/lib/record/inputs.js +47 -0
  149. package/src/lib/record/inputs.js.map +1 -0
  150. package/src/lib/record/inputs.mjs +44 -0
  151. package/src/lib/record/inputs.mjs.map +1 -0
  152. package/src/lib/record/limits.d.mts +13 -0
  153. package/src/lib/record/limits.d.ts +13 -0
  154. package/src/lib/record/limits.js +45 -0
  155. package/src/lib/record/limits.js.map +1 -0
  156. package/src/lib/record/limits.mjs +41 -0
  157. package/src/lib/record/limits.mjs.map +1 -0
  158. package/src/lib/record/locales/all.d.mts +7 -0
  159. package/src/lib/record/locales/all.d.ts +7 -0
  160. package/src/lib/record/locales/all.js +13 -0
  161. package/src/lib/record/locales/all.js.map +1 -0
  162. package/src/lib/record/locales/all.mjs +10 -0
  163. package/src/lib/record/locales/all.mjs.map +1 -0
  164. package/src/lib/record/locales/ar.d.mts +3 -0
  165. package/src/lib/record/locales/ar.d.ts +3 -0
  166. package/src/lib/record/locales/ar.js +55 -0
  167. package/src/lib/record/locales/ar.js.map +1 -0
  168. package/src/lib/record/locales/ar.mjs +52 -0
  169. package/src/lib/record/locales/ar.mjs.map +1 -0
  170. package/src/lib/record/locales/de.d.mts +3 -0
  171. package/src/lib/record/locales/de.d.ts +3 -0
  172. package/src/lib/record/locales/de.js +55 -0
  173. package/src/lib/record/locales/de.js.map +1 -0
  174. package/src/lib/record/locales/de.mjs +52 -0
  175. package/src/lib/record/locales/de.mjs.map +1 -0
  176. package/src/lib/record/locales/fr.d.mts +3 -0
  177. package/src/lib/record/locales/fr.d.ts +3 -0
  178. package/src/lib/record/locales/fr.js +55 -0
  179. package/src/lib/record/locales/fr.js.map +1 -0
  180. package/src/lib/record/locales/fr.mjs +52 -0
  181. package/src/lib/record/locales/fr.mjs.map +1 -0
  182. package/src/lib/record/memory-data-source.d.mts +3 -0
  183. package/src/lib/record/memory-data-source.d.ts +3 -0
  184. package/src/lib/record/memory-data-source.js +8 -0
  185. package/src/lib/record/memory-data-source.js.map +1 -1
  186. package/src/lib/record/memory-data-source.mjs +8 -0
  187. package/src/lib/record/memory-data-source.mjs.map +1 -1
  188. package/src/lib/record/messages.d.mts +46 -0
  189. package/src/lib/record/messages.d.ts +46 -0
  190. package/src/lib/record/messages.js +58 -101
  191. package/src/lib/record/messages.js.map +1 -1
  192. package/src/lib/record/messages.mjs +58 -101
  193. package/src/lib/record/messages.mjs.map +1 -1
  194. package/src/lib/record/rules.d.mts +33 -0
  195. package/src/lib/record/rules.d.ts +33 -0
  196. package/src/lib/record/rules.js +83 -0
  197. package/src/lib/record/rules.js.map +1 -0
  198. package/src/lib/record/rules.mjs +79 -0
  199. package/src/lib/record/rules.mjs.map +1 -0
  200. package/src/lib/record/run.d.mts +169 -0
  201. package/src/lib/record/run.d.ts +169 -0
  202. package/src/lib/record/run.js +350 -0
  203. package/src/lib/record/run.js.map +1 -0
  204. package/src/lib/record/run.mjs +345 -0
  205. package/src/lib/record/run.mjs.map +1 -0
  206. package/src/lib/record/score.d.mts +16 -0
  207. package/src/lib/record/score.d.ts +16 -0
  208. package/src/lib/record/score.js +35 -0
  209. package/src/lib/record/score.js.map +1 -0
  210. package/src/lib/record/score.mjs +32 -0
  211. package/src/lib/record/score.mjs.map +1 -0
  212. package/src/lib/record/set-when.d.mts +24 -0
  213. package/src/lib/record/set-when.d.ts +24 -0
  214. package/src/lib/record/set-when.js +68 -0
  215. package/src/lib/record/set-when.js.map +1 -0
  216. package/src/lib/record/set-when.mjs +65 -0
  217. package/src/lib/record/set-when.mjs.map +1 -0
  218. package/src/lib/record/structures.d.mts +14 -0
  219. package/src/lib/record/structures.d.ts +14 -0
  220. package/src/lib/record/structures.js +32 -0
  221. package/src/lib/record/structures.js.map +1 -0
  222. package/src/lib/record/structures.mjs +28 -0
  223. package/src/lib/record/structures.mjs.map +1 -0
  224. package/src/lib/record/values.d.mts +10 -5
  225. package/src/lib/record/values.d.ts +10 -5
  226. package/src/lib/record/values.js +20 -6
  227. package/src/lib/record/values.js.map +1 -1
  228. package/src/lib/record/values.mjs +19 -6
  229. package/src/lib/record/values.mjs.map +1 -1
  230. package/src/runtime.d.mts +13 -7
  231. package/src/runtime.d.ts +13 -7
  232. package/src/runtime.js +14 -1
  233. package/src/runtime.js.map +1 -1
  234. package/src/runtime.mjs +6 -2
  235. package/src/runtime.mjs.map +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rules.mjs","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/record/rules.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAyB,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,IAAI,EAAiB,MAAM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AI,KAAK,UAAU;QAAE,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;IAClF,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC5B,OAAO,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClD,CAAC"}
@@ -0,0 +1,169 @@
1
+ import type { ActionStep, OpenStep, PanelSide } from '../format/actions.mjs';
2
+ import type { Field } from '../format/field.mjs';
3
+ import type { JsonValue } from '../format/json.mjs';
4
+ import type { Tone } from '../format/layout.mjs';
5
+ import { type ExpressionEnv } from '../expression/expression.mjs';
6
+ import { type RecordId, type Values } from './values.mjs';
7
+ /**
8
+ * The engine that runs steps — a button's, a moment's, or the app's own —
9
+ * against a form. Steps run in order; one whose `when` does not hold is
10
+ * passed over; the first that fails or is refused stops the rest, and the
11
+ * run's result says which and why. What the core cannot draw — a page opened,
12
+ * words said, a question asked — it asks of the host the viewer gives.
13
+ */
14
+ /** A button pressed, or a `call` step run: what the app's `onAction` is handed. */
15
+ export interface ActionRequest {
16
+ /** The button or stat button pressed; for a moment, `on.open`, `on.change.<field>`, `on.beforeSave`, `on.afterSave` or `on.show.<id>`; for `form.run`, the id it was given. */
17
+ id: string;
18
+ action: string;
19
+ params?: {
20
+ [key: string]: JsonValue;
21
+ };
22
+ recordId: RecordId | null;
23
+ values: Values;
24
+ /** The records chosen in a list, when the button belongs to one. */
25
+ recordIds?: RecordId[];
26
+ }
27
+ /**
28
+ * What the app may answer a call with. Nothing at all means go on. `values`
29
+ * are set as a `set` step sets them (no person's change); `say` is said;
30
+ * `open` runs as an `open` step would; `stop` stops the steps after it — with
31
+ * words, said to the person as a warning.
32
+ */
33
+ export interface ActionResult {
34
+ values?: Values;
35
+ say?: string | {
36
+ message: string;
37
+ tone?: Tone;
38
+ };
39
+ open?: Omit<OpenStep, 'do' | 'when'>;
40
+ stop?: boolean | string;
41
+ }
42
+ /** What a button does that only the app can: handed over, and awaited. */
43
+ export type OnAction = (request: ActionRequest) => void | ActionResult | Promise<void | ActionResult>;
44
+ /** A page the host is asked to open: in a dialog over the form, a panel beside it, or in its place. */
45
+ export interface OpenRequest {
46
+ /** The page's id, as the app's `pages` finds it. */
47
+ page: string;
48
+ /** One published version; left out, the latest. */
49
+ version?: number;
50
+ as: 'dialog' | 'panel' | 'page';
51
+ /** Where a panel comes from, when its step names a side: the end of the line unless told. */
52
+ side?: PanelSide;
53
+ /** The words over it; left out, the page's own title. */
54
+ title?: string;
55
+ /** The record to open; null for a new one. */
56
+ recordId?: RecordId | null;
57
+ /** What a new one starts with. */
58
+ values?: Values;
59
+ }
60
+ /** How an opened page ended: saved (or sent), or closed without. */
61
+ export interface OpenResult {
62
+ saved: boolean;
63
+ /** The record it saved. */
64
+ recordId?: RecordId | null;
65
+ /** Its values, once saved. */
66
+ values?: Values;
67
+ /** The saved record's name, as its page's title field shows it: what a link set to it is labelled. */
68
+ label?: string;
69
+ }
70
+ /**
71
+ * The UI the core cannot draw, given by the viewer. Without one, a form says
72
+ * nothing, asks `FormOptions.confirm` (or goes on as though answered Yes), and
73
+ * cannot open, close or show a tab: those steps stop with reason `cannot`.
74
+ */
75
+ export interface ActionHost {
76
+ open(request: OpenRequest): Promise<OpenResult>;
77
+ say(message: string, tone: Tone): void;
78
+ ask(message: string): Promise<boolean>;
79
+ /** Close the dialog or panel this form was opened in. */
80
+ close?(): void;
81
+ /** Show a tab by its id. The viewer then calls `form.shown(id)`, as for a tab a person picks. */
82
+ show?(target: string): void;
83
+ }
84
+ /**
85
+ * Why a run stopped: a check found problems (`check`), a question was
86
+ * answered No (`no`), a save was refused (`save`), the app said stop or threw
87
+ * (`app`), an opened page was closed without saving (`closed`), or the step
88
+ * could not run here — no host to open with, a field the page lacks
89
+ * (`cannot`).
90
+ */
91
+ export type RunStop = 'check' | 'no' | 'save' | 'app' | 'closed' | 'cannot';
92
+ /** How a run of steps ended. */
93
+ export interface RunResult {
94
+ /** Every step ran, or was passed over by its `when`. */
95
+ done: boolean;
96
+ /**
97
+ * The place, among the steps run, of the one that stopped: for a step of
98
+ * an `open`'s `then`, the open step's place; for a button's `action`, one
99
+ * past its steps. Absent when a button's `confirm` was answered No.
100
+ */
101
+ stoppedAt?: number;
102
+ /** The step that stopped, wherever it was. */
103
+ step?: ActionStep;
104
+ reason?: RunStop;
105
+ /** Why, in words: the first problem found, the question, the save's or the app's words. */
106
+ message?: string;
107
+ /** What the app or the host threw, when that stopped it. */
108
+ error?: unknown;
109
+ }
110
+ /** What a run is for: the id calls carry, the records chosen in a list. */
111
+ export interface RunContext {
112
+ id?: string;
113
+ recordIds?: RecordId[];
114
+ }
115
+ /** A step stopped: why, and which (a step of an `open`'s `then`, the deepest). */
116
+ export interface Stopped {
117
+ reason: RunStop;
118
+ message?: string;
119
+ step?: ActionStep;
120
+ error?: unknown;
121
+ }
122
+ /** A run as it goes: its id, the records chosen, and the moments it was set off by — a moment one of them sets off again does not run. */
123
+ export interface RunScope {
124
+ id: string;
125
+ recordIds?: RecordId[];
126
+ chain: readonly string[];
127
+ }
128
+ /** What a run reaches its form by: the form gives these. */
129
+ export interface RunForm {
130
+ readonly fields: Readonly<Record<string, Field>>;
131
+ values(): Readonly<Values>;
132
+ recordId(): RecordId | null;
133
+ /** The values as expressions read them, and what else they read. */
134
+ reading(): {
135
+ context: Record<string, unknown>;
136
+ env: ExpressionEnv;
137
+ };
138
+ today(): string;
139
+ /** Write fields as a step does: worked out once, no person's change. Throws for a field the page lacks. */
140
+ write(values: Values): void;
141
+ addLine(field: string, values: Values): void;
142
+ check(fields: readonly string[] | undefined): Stopped | null;
143
+ save(chain: readonly string[]): Promise<Stopped | null>;
144
+ reset(): void;
145
+ /** Go to a wizard's step; `undefined` when the target is none of its steps (a tab). */
146
+ goTo(target: string, chain: readonly string[]): Stopped | null | undefined;
147
+ /** Run `show` of the host while `chain` is the run's, so a tab it shows knows who showed it. */
148
+ showing(chain: readonly string[], show: () => void): void;
149
+ host?: ActionHost;
150
+ confirm?: (message: string) => boolean | Promise<boolean>;
151
+ onAction?: OnAction;
152
+ /** The app answered a call. */
153
+ answered(request: ActionRequest, result: ActionResult | undefined): void;
154
+ }
155
+ export declare const DONE: RunResult;
156
+ /** Steps run against one form. Expressions are read once and kept. */
157
+ export declare function createRunner(form: RunForm): {
158
+ runSteps: (steps: readonly ActionStep[], scope: RunScope) => Promise<RunResult>;
159
+ ask: (message: string) => Promise<boolean>;
160
+ };
161
+ /**
162
+ * One run of each moment at a time. A moment set off by a step of its own
163
+ * run — or a run it set off — does not run. Set off while a run of it is
164
+ * going: `again` moments (open, change, show) run once more after it, with
165
+ * the values as they are then, however many times they were set off
166
+ * meanwhile; the others (beforeSave, afterSave) do not run — a save made
167
+ * meanwhile goes ahead without them, so nothing waits on itself.
168
+ */
169
+ export declare function createMoments(run: (key: string, steps: readonly ActionStep[], chain: readonly string[]) => Promise<RunResult>): (key: string, steps: readonly ActionStep[] | undefined, chain: readonly string[], again: boolean) => Promise<RunResult>;
@@ -0,0 +1,169 @@
1
+ import type { ActionStep, OpenStep, PanelSide } from '../format/actions';
2
+ import type { Field } from '../format/field';
3
+ import type { JsonValue } from '../format/json';
4
+ import type { Tone } from '../format/layout';
5
+ import { type ExpressionEnv } from '../expression/expression';
6
+ import { type RecordId, type Values } from './values';
7
+ /**
8
+ * The engine that runs steps — a button's, a moment's, or the app's own —
9
+ * against a form. Steps run in order; one whose `when` does not hold is
10
+ * passed over; the first that fails or is refused stops the rest, and the
11
+ * run's result says which and why. What the core cannot draw — a page opened,
12
+ * words said, a question asked — it asks of the host the viewer gives.
13
+ */
14
+ /** A button pressed, or a `call` step run: what the app's `onAction` is handed. */
15
+ export interface ActionRequest {
16
+ /** The button or stat button pressed; for a moment, `on.open`, `on.change.<field>`, `on.beforeSave`, `on.afterSave` or `on.show.<id>`; for `form.run`, the id it was given. */
17
+ id: string;
18
+ action: string;
19
+ params?: {
20
+ [key: string]: JsonValue;
21
+ };
22
+ recordId: RecordId | null;
23
+ values: Values;
24
+ /** The records chosen in a list, when the button belongs to one. */
25
+ recordIds?: RecordId[];
26
+ }
27
+ /**
28
+ * What the app may answer a call with. Nothing at all means go on. `values`
29
+ * are set as a `set` step sets them (no person's change); `say` is said;
30
+ * `open` runs as an `open` step would; `stop` stops the steps after it — with
31
+ * words, said to the person as a warning.
32
+ */
33
+ export interface ActionResult {
34
+ values?: Values;
35
+ say?: string | {
36
+ message: string;
37
+ tone?: Tone;
38
+ };
39
+ open?: Omit<OpenStep, 'do' | 'when'>;
40
+ stop?: boolean | string;
41
+ }
42
+ /** What a button does that only the app can: handed over, and awaited. */
43
+ export type OnAction = (request: ActionRequest) => void | ActionResult | Promise<void | ActionResult>;
44
+ /** A page the host is asked to open: in a dialog over the form, a panel beside it, or in its place. */
45
+ export interface OpenRequest {
46
+ /** The page's id, as the app's `pages` finds it. */
47
+ page: string;
48
+ /** One published version; left out, the latest. */
49
+ version?: number;
50
+ as: 'dialog' | 'panel' | 'page';
51
+ /** Where a panel comes from, when its step names a side: the end of the line unless told. */
52
+ side?: PanelSide;
53
+ /** The words over it; left out, the page's own title. */
54
+ title?: string;
55
+ /** The record to open; null for a new one. */
56
+ recordId?: RecordId | null;
57
+ /** What a new one starts with. */
58
+ values?: Values;
59
+ }
60
+ /** How an opened page ended: saved (or sent), or closed without. */
61
+ export interface OpenResult {
62
+ saved: boolean;
63
+ /** The record it saved. */
64
+ recordId?: RecordId | null;
65
+ /** Its values, once saved. */
66
+ values?: Values;
67
+ /** The saved record's name, as its page's title field shows it: what a link set to it is labelled. */
68
+ label?: string;
69
+ }
70
+ /**
71
+ * The UI the core cannot draw, given by the viewer. Without one, a form says
72
+ * nothing, asks `FormOptions.confirm` (or goes on as though answered Yes), and
73
+ * cannot open, close or show a tab: those steps stop with reason `cannot`.
74
+ */
75
+ export interface ActionHost {
76
+ open(request: OpenRequest): Promise<OpenResult>;
77
+ say(message: string, tone: Tone): void;
78
+ ask(message: string): Promise<boolean>;
79
+ /** Close the dialog or panel this form was opened in. */
80
+ close?(): void;
81
+ /** Show a tab by its id. The viewer then calls `form.shown(id)`, as for a tab a person picks. */
82
+ show?(target: string): void;
83
+ }
84
+ /**
85
+ * Why a run stopped: a check found problems (`check`), a question was
86
+ * answered No (`no`), a save was refused (`save`), the app said stop or threw
87
+ * (`app`), an opened page was closed without saving (`closed`), or the step
88
+ * could not run here — no host to open with, a field the page lacks
89
+ * (`cannot`).
90
+ */
91
+ export type RunStop = 'check' | 'no' | 'save' | 'app' | 'closed' | 'cannot';
92
+ /** How a run of steps ended. */
93
+ export interface RunResult {
94
+ /** Every step ran, or was passed over by its `when`. */
95
+ done: boolean;
96
+ /**
97
+ * The place, among the steps run, of the one that stopped: for a step of
98
+ * an `open`'s `then`, the open step's place; for a button's `action`, one
99
+ * past its steps. Absent when a button's `confirm` was answered No.
100
+ */
101
+ stoppedAt?: number;
102
+ /** The step that stopped, wherever it was. */
103
+ step?: ActionStep;
104
+ reason?: RunStop;
105
+ /** Why, in words: the first problem found, the question, the save's or the app's words. */
106
+ message?: string;
107
+ /** What the app or the host threw, when that stopped it. */
108
+ error?: unknown;
109
+ }
110
+ /** What a run is for: the id calls carry, the records chosen in a list. */
111
+ export interface RunContext {
112
+ id?: string;
113
+ recordIds?: RecordId[];
114
+ }
115
+ /** A step stopped: why, and which (a step of an `open`'s `then`, the deepest). */
116
+ export interface Stopped {
117
+ reason: RunStop;
118
+ message?: string;
119
+ step?: ActionStep;
120
+ error?: unknown;
121
+ }
122
+ /** A run as it goes: its id, the records chosen, and the moments it was set off by — a moment one of them sets off again does not run. */
123
+ export interface RunScope {
124
+ id: string;
125
+ recordIds?: RecordId[];
126
+ chain: readonly string[];
127
+ }
128
+ /** What a run reaches its form by: the form gives these. */
129
+ export interface RunForm {
130
+ readonly fields: Readonly<Record<string, Field>>;
131
+ values(): Readonly<Values>;
132
+ recordId(): RecordId | null;
133
+ /** The values as expressions read them, and what else they read. */
134
+ reading(): {
135
+ context: Record<string, unknown>;
136
+ env: ExpressionEnv;
137
+ };
138
+ today(): string;
139
+ /** Write fields as a step does: worked out once, no person's change. Throws for a field the page lacks. */
140
+ write(values: Values): void;
141
+ addLine(field: string, values: Values): void;
142
+ check(fields: readonly string[] | undefined): Stopped | null;
143
+ save(chain: readonly string[]): Promise<Stopped | null>;
144
+ reset(): void;
145
+ /** Go to a wizard's step; `undefined` when the target is none of its steps (a tab). */
146
+ goTo(target: string, chain: readonly string[]): Stopped | null | undefined;
147
+ /** Run `show` of the host while `chain` is the run's, so a tab it shows knows who showed it. */
148
+ showing(chain: readonly string[], show: () => void): void;
149
+ host?: ActionHost;
150
+ confirm?: (message: string) => boolean | Promise<boolean>;
151
+ onAction?: OnAction;
152
+ /** The app answered a call. */
153
+ answered(request: ActionRequest, result: ActionResult | undefined): void;
154
+ }
155
+ export declare const DONE: RunResult;
156
+ /** Steps run against one form. Expressions are read once and kept. */
157
+ export declare function createRunner(form: RunForm): {
158
+ runSteps: (steps: readonly ActionStep[], scope: RunScope) => Promise<RunResult>;
159
+ ask: (message: string) => Promise<boolean>;
160
+ };
161
+ /**
162
+ * One run of each moment at a time. A moment set off by a step of its own
163
+ * run — or a run it set off — does not run. Set off while a run of it is
164
+ * going: `again` moments (open, change, show) run once more after it, with
165
+ * the values as they are then, however many times they were set off
166
+ * meanwhile; the others (beforeSave, afterSave) do not run — a save made
167
+ * meanwhile goes ahead without them, so nothing waits on itself.
168
+ */
169
+ export declare function createMoments(run: (key: string, steps: readonly ActionStep[], chain: readonly string[]) => Promise<RunResult>): (key: string, steps: readonly ActionStep[] | undefined, chain: readonly string[], again: boolean) => Promise<RunResult>;