@substrat-run/contracts 0.83.0 → 0.85.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/dist/index.d.ts CHANGED
@@ -37,4 +37,5 @@ export * from './money.js';
37
37
  export * from './attachments.js';
38
38
  export * from './model.js';
39
39
  export * from './operations.js';
40
+ export * from './lifecycle.js';
40
41
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC"}
package/dist/index.js CHANGED
@@ -37,4 +37,5 @@ export * from './money.js';
37
37
  export * from './attachments.js';
38
38
  export * from './model.js';
39
39
  export * from './operations.js';
40
+ export * from './lifecycle.js';
40
41
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,235 @@
1
+ /**
2
+ * Entity lifecycles — the state machines, declared (#844).
3
+ *
4
+ * #697 declared the entities, #707 the operations over them. Both left the
5
+ * *edges* undeclared: six entities across four engines and two demos carry a
6
+ * `status` enum, and every one of them describes its transitions a second time,
7
+ * as hand-written guards in operation bodies.
8
+ *
9
+ * ```ts
10
+ * function requireStatus(row: OrderRow, ...allowed: OrderRow['status'][]): void {
11
+ * if (!allowed.includes(row.status)) throw conflict('invalid_transition', …);
12
+ * }
13
+ * ```
14
+ *
15
+ * That function is the whole state machine, spread across six call sites, held
16
+ * to the enum by nothing. Booking does not even hold the state *set* in one
17
+ * place — the same seven values are written twice, as two independent `z.enum`
18
+ * literals in its `entities.ts` and its `index.ts`.
19
+ *
20
+ * ## What this is not
21
+ *
22
+ * It is not a workflow language, and the omissions are the design.
23
+ *
24
+ * There are no actions, no effects, no `context`, no parallel regions and no
25
+ * expression language. An edge names the operation that performs it and nothing
26
+ * more; the operation keeps its body. The moment an edge can carry a condition,
27
+ * this is BPMN in TypeScript — the tarpit the master plan named in the same
28
+ * breath as adopting durable execution, and the reason that row says
29
+ * "conventions" rather than "build".
30
+ *
31
+ * Durable execution is a separate concern with a separate answer (the outbox →
32
+ * `_substrat_deliveries` → sweeper substrate). A lifecycle says which states an
33
+ * entity may be in and which operation moves it between them. It never says
34
+ * when, and it never runs anything.
35
+ *
36
+ * ## Guards are NOT declared here
37
+ *
38
+ * The obvious next field is `guard` on an edge, and it would be a second
39
+ * description of something already shipped. K-38 ratified manifest-declared
40
+ * guards: a module contributes a named predicate, a manifest wires it with
41
+ * `guards: [{ before, predicate, config }]`, and the kernel evaluates it inside
42
+ * the guarded operation's own transaction. `before` names an operation — and
43
+ * every edge here names its operation too, so a guard on an operation already
44
+ * *is* a guard on that operation's edges.
45
+ *
46
+ * The join key exists, so the views that want guards on edges (the XState
47
+ * config, the docs diagram) derive them. Declaring them twice is how they come
48
+ * to disagree.
49
+ */
50
+ import { z } from 'zod';
51
+ import type { EntityDef } from './model.js';
52
+ /**
53
+ * The values the state field may hold, read off the entity's OWN `fields`
54
+ * schema.
55
+ *
56
+ * This is what makes the declaration bite. The states are not restated here —
57
+ * they are `z.enum(['planned', 'in_progress', 'completed', 'closed'])` in
58
+ * `workorderEntities`, and naming a fifth one is a compile error rather than an
59
+ * edge that silently never resolves. It also runs the other way: `states` is a
60
+ * TOTAL record over this union, so adding a value to the enum and forgetting
61
+ * the machine fails to compile.
62
+ */
63
+ export type StateValues<E, F extends string> = E extends {
64
+ fields: infer S;
65
+ } ? S extends z.ZodObject<z.ZodRawShape> ? F extends keyof z.infer<S> ? z.infer<S>[F] & string : never : never : never;
66
+ /** The field names of one entity, for the `field` position. */
67
+ type FieldNames<E> = E extends {
68
+ fields: infer S;
69
+ } ? S extends z.ZodObject<z.ZodRawShape> ? keyof z.infer<S> & string : never : never;
70
+ /**
71
+ * One state.
72
+ *
73
+ * `on` and `allow` are separate because most state checks in the repo are not
74
+ * transitions. Nine of booking's `requireState` call sites gate operations, and
75
+ * several of them — `requireState(row, 'held', 'confirmed')` before attaching a
76
+ * note — change no state at all. A format with only edges would have described
77
+ * the majority of them as transitions, which is worse than not describing them:
78
+ * the emitted diagram would show edges that do not exist.
79
+ */
80
+ export interface StateDef<States extends string = string, Ops extends string = string> {
81
+ /** Operations that move the entity OUT of this state, to the named target. */
82
+ readonly on?: Readonly<Partial<Record<Ops, States>>>;
83
+ /** Operations legal in this state that change no state. A precondition, not an edge. */
84
+ readonly allow?: readonly Ops[];
85
+ /**
86
+ * This state admits vertical substates (K-17 `extensibleStates`).
87
+ *
88
+ * kernel-design §7.5 specifies substates as *"the engine's state-machine
89
+ * declaration marks which states admit substates"*. This is that mark. An
90
+ * invariant-bearing state — one holding something signed, exported or
91
+ * otherwise frozen — declares nothing, and the absence reads as intent.
92
+ */
93
+ readonly extensible?: boolean;
94
+ /**
95
+ * No edges out, ever.
96
+ *
97
+ * Distinguished from "no edges yet" deliberately: an empty `on` is ambiguous
98
+ * between a finished state and an unfinished declaration, and only one of
99
+ * those should emit `type: 'final'`.
100
+ */
101
+ readonly terminal?: boolean;
102
+ }
103
+ /** One entity's machine. */
104
+ export interface LifecycleDef<States extends string = string, Ops extends string = string> {
105
+ /** The column holding the state. Must be a field of the entity. */
106
+ readonly field: string;
107
+ /** Where a freshly created row starts. Must be a declared state. */
108
+ readonly initial: States;
109
+ /** Every state the field may hold — total over the field's enum, by construction. */
110
+ readonly states: Readonly<Record<States, StateDef<States, Ops>>>;
111
+ }
112
+ /**
113
+ * The shape one entry must have, resolved against the entity it names and the
114
+ * operations bag it draws from.
115
+ *
116
+ * Self-referential through `Self['field']`: the `states` keys depend on which
117
+ * field was named in the same object literal. Written the obvious way — `field:
118
+ * string` — every state name compiles and the check enforces nothing, which is
119
+ * the failure `defineEntities` documents at length and `test/lifecycle.test.ts`
120
+ * exists to prove has not returned.
121
+ */
122
+ type LifecycleShape<Ent, Ops, Self> = Self extends {
123
+ readonly field: infer F extends string;
124
+ } ? {
125
+ readonly field: F & FieldNames<Ent>;
126
+ readonly initial: StateValues<Ent, F>;
127
+ readonly states: {
128
+ readonly [S in StateValues<Ent, F>]: StateDef<StateValues<Ent, F>, keyof Ops & string>;
129
+ };
130
+ } : never;
131
+ /**
132
+ * Declare an entity's lifecycle.
133
+ *
134
+ * Curried for the same reason `defineOperations` is: the entity registry and
135
+ * the operation bag are both needed to check the declaration, and neither
136
+ * should have to be re-stated at every call site.
137
+ *
138
+ * ```ts
139
+ * export const workorderLifecycles = defineLifecycles(workorderEntities, workorderOperations)({
140
+ * workorder: {
141
+ * field: 'status',
142
+ * initial: 'planned',
143
+ * states: {
144
+ * planned: { on: { 'workorder/start': 'in_progress' }, allow: ['workorder/assign'] },
145
+ * in_progress: { on: { 'workorder/complete': 'completed' }, extensible: true },
146
+ * completed: { on: { 'workorder/close': 'closed' } },
147
+ * closed: { terminal: true },
148
+ * },
149
+ * },
150
+ * });
151
+ * ```
152
+ */
153
+ export declare function defineLifecycles<const E extends Record<string, EntityDef>, const O extends Record<string, unknown>>(_entities: E, _operations: O): <const L extends { readonly [K in keyof L]: K extends keyof E ? LifecycleShape<E[K], O, L[K]> : never; }>(lifecycles: L) => L;
154
+ /**
155
+ * The checks the type system cannot make, made loudly at module load.
156
+ *
157
+ * Exported so the emitters can run it over a registry they were handed rather
158
+ * than one they built — the same posture as `primaryKeyOf`, which throws rather
159
+ * than returning nothing because a table with no identity is not a shape the
160
+ * model may express.
161
+ *
162
+ * **`allowed` is checked here rather than in the types**, and that placement is
163
+ * measured rather than chosen: TypeScript applies no excess-property check when
164
+ * a value satisfies a generic constraint, so a `states` object carrying a fifth
165
+ * key the enum does not have compiles clean. The same caveat `defineEntities`
166
+ * records for `renamedFrom`. A check that reads like it works and does not is
167
+ * worse than an absent one, so this one is where it can bite.
168
+ */
169
+ export declare function assertCoherent(entity: string, lc: LifecycleDef, allowed?: readonly string[]): void;
170
+ /**
171
+ * What an operation does to an entity in a given state.
172
+ *
173
+ * `allowed` is not a degenerate transition — the caller uses the distinction.
174
+ * An engine writing `status = ?` after a `transition` outcome is correct; doing
175
+ * it after an `allowed` one would move an entity the declaration says stays put.
176
+ */
177
+ export type Outcome = {
178
+ readonly kind: 'transition';
179
+ readonly to: string;
180
+ } | {
181
+ readonly kind: 'allowed';
182
+ };
183
+ /**
184
+ * What `operation` does from `from`, or `null` if it is not legal there.
185
+ *
186
+ * Total and side-effect free, which is what lets `xstate`'s own
187
+ * `machine.transition()` stand beside it in tests as an independent oracle
188
+ * without either one shipping to production.
189
+ */
190
+ export declare function transitionFor(lc: LifecycleDef, from: string, operation: string): Outcome | null;
191
+ /**
192
+ * The reason an illegal transition is refused with.
193
+ *
194
+ * Exported so an engine's own conflict vocabulary can REFERENCE it rather than
195
+ * spell it again — the reason is raised here now, and an engine whose exported
196
+ * `*_CONFLICT_REASONS` list said something subtly different would be publishing
197
+ * a slug no consumer would ever match.
198
+ */
199
+ export declare const INVALID_TRANSITION = "invalid_transition";
200
+ /**
201
+ * The replacement for every hand-written `requireStatus` / `requireState`.
202
+ *
203
+ * Throws the platform's own `conflict` with `reason: 'invalid_transition'` —
204
+ * the reason four engines already narrow to, and the one two demos were
205
+ * silently not using. `demos/shop` threw a bare `new Error(...)`, so a caller
206
+ * branching on the refusal got a 500 where every engine gives a 409.
207
+ *
208
+ * The message names what WAS legal, because the failure a user hits is almost
209
+ * never "this operation does not exist" — it is "someone else already moved it."
210
+ */
211
+ export declare function assertTransition(lc: LifecycleDef, entity: string, from: string, operation: string): Outcome;
212
+ /** Every operation the declaration mentions, sorted. The join key for guards and docs. */
213
+ export declare function operationsOf(lc: LifecycleDef): readonly string[];
214
+ /** One state, serialised. Absent optionals stay absent — a diff should show facts, not defaults. */
215
+ export interface EmittedState {
216
+ readonly on?: Record<string, string>;
217
+ readonly allow?: readonly string[];
218
+ readonly extensible?: true;
219
+ readonly terminal?: true;
220
+ }
221
+ export interface EmittedLifecycle {
222
+ readonly field: string;
223
+ readonly initial: string;
224
+ readonly states: Record<string, EmittedState>;
225
+ }
226
+ /**
227
+ * Render lifecycles to plain JSON for `model.json`.
228
+ *
229
+ * Deterministic in the same way `emitModel` is: entities, states and edges are
230
+ * emitted in sorted order, so a reordered declaration is not a spurious diff
231
+ * and the checked-in artifact stays reviewable.
232
+ */
233
+ export declare function emitLifecycles(lifecycles: Record<string, LifecycleDef>): Record<string, EmittedLifecycle>;
234
+ export {};
235
+ //# sourceMappingURL=lifecycle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../src/lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAM5C;;;;;;;;;;GAUG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS;IAAE,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GACxE,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,GAClC,CAAC,SAAS,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GACxB,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,GACtB,KAAK,GACP,KAAK,GACP,KAAK,CAAC;AAEV,+DAA+D;AAC/D,KAAK,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS;IAAE,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAC9C,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,GAClC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,GACzB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wBAAgB,gBAAgB,CAAC,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAa3G;AAED,0FAA0F;AAC1F,wBAAgB,YAAY,CAAC,EAAE,EAAE,YAAY,GAAG,SAAS,MAAM,EAAE,CAOhE;AAMD,oGAAoG;AACpG,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;CAC/C;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAwBzG"}
@@ -0,0 +1,245 @@
1
+ /**
2
+ * Entity lifecycles — the state machines, declared (#844).
3
+ *
4
+ * #697 declared the entities, #707 the operations over them. Both left the
5
+ * *edges* undeclared: six entities across four engines and two demos carry a
6
+ * `status` enum, and every one of them describes its transitions a second time,
7
+ * as hand-written guards in operation bodies.
8
+ *
9
+ * ```ts
10
+ * function requireStatus(row: OrderRow, ...allowed: OrderRow['status'][]): void {
11
+ * if (!allowed.includes(row.status)) throw conflict('invalid_transition', …);
12
+ * }
13
+ * ```
14
+ *
15
+ * That function is the whole state machine, spread across six call sites, held
16
+ * to the enum by nothing. Booking does not even hold the state *set* in one
17
+ * place — the same seven values are written twice, as two independent `z.enum`
18
+ * literals in its `entities.ts` and its `index.ts`.
19
+ *
20
+ * ## What this is not
21
+ *
22
+ * It is not a workflow language, and the omissions are the design.
23
+ *
24
+ * There are no actions, no effects, no `context`, no parallel regions and no
25
+ * expression language. An edge names the operation that performs it and nothing
26
+ * more; the operation keeps its body. The moment an edge can carry a condition,
27
+ * this is BPMN in TypeScript — the tarpit the master plan named in the same
28
+ * breath as adopting durable execution, and the reason that row says
29
+ * "conventions" rather than "build".
30
+ *
31
+ * Durable execution is a separate concern with a separate answer (the outbox →
32
+ * `_substrat_deliveries` → sweeper substrate). A lifecycle says which states an
33
+ * entity may be in and which operation moves it between them. It never says
34
+ * when, and it never runs anything.
35
+ *
36
+ * ## Guards are NOT declared here
37
+ *
38
+ * The obvious next field is `guard` on an edge, and it would be a second
39
+ * description of something already shipped. K-38 ratified manifest-declared
40
+ * guards: a module contributes a named predicate, a manifest wires it with
41
+ * `guards: [{ before, predicate, config }]`, and the kernel evaluates it inside
42
+ * the guarded operation's own transaction. `before` names an operation — and
43
+ * every edge here names its operation too, so a guard on an operation already
44
+ * *is* a guard on that operation's edges.
45
+ *
46
+ * The join key exists, so the views that want guards on edges (the XState
47
+ * config, the docs diagram) derive them. Declaring them twice is how they come
48
+ * to disagree.
49
+ */
50
+ import { z } from 'zod';
51
+ import { substratError } from './errors.js';
52
+ /**
53
+ * Declare an entity's lifecycle.
54
+ *
55
+ * Curried for the same reason `defineOperations` is: the entity registry and
56
+ * the operation bag are both needed to check the declaration, and neither
57
+ * should have to be re-stated at every call site.
58
+ *
59
+ * ```ts
60
+ * export const workorderLifecycles = defineLifecycles(workorderEntities, workorderOperations)({
61
+ * workorder: {
62
+ * field: 'status',
63
+ * initial: 'planned',
64
+ * states: {
65
+ * planned: { on: { 'workorder/start': 'in_progress' }, allow: ['workorder/assign'] },
66
+ * in_progress: { on: { 'workorder/complete': 'completed' }, extensible: true },
67
+ * completed: { on: { 'workorder/close': 'closed' } },
68
+ * closed: { terminal: true },
69
+ * },
70
+ * },
71
+ * });
72
+ * ```
73
+ */
74
+ export function defineLifecycles(_entities, _operations) {
75
+ return function declare(lifecycles) {
76
+ for (const [entity, lc] of Object.entries(lifecycles)) {
77
+ assertCoherent(entity, lc, declaredValues(_entities[entity], lc.field));
78
+ }
79
+ return lifecycles;
80
+ };
81
+ }
82
+ /**
83
+ * The values the state column may actually hold, if it says so.
84
+ *
85
+ * `z.enum([...])` is the common case and the one worth checking. A state field
86
+ * typed `z.string()` — manyfold holds its six statuses in a `const` array — is
87
+ * not an error and simply cannot be checked here; returning `undefined` says
88
+ * "unknown", which is different from "empty".
89
+ */
90
+ function declaredValues(entity, field) {
91
+ const schema = entity?.fields.shape?.[field];
92
+ const options = schema?.options;
93
+ return Array.isArray(options) && options.every((o) => typeof o === 'string') ? options : undefined;
94
+ }
95
+ /**
96
+ * The checks the type system cannot make, made loudly at module load.
97
+ *
98
+ * Exported so the emitters can run it over a registry they were handed rather
99
+ * than one they built — the same posture as `primaryKeyOf`, which throws rather
100
+ * than returning nothing because a table with no identity is not a shape the
101
+ * model may express.
102
+ *
103
+ * **`allowed` is checked here rather than in the types**, and that placement is
104
+ * measured rather than chosen: TypeScript applies no excess-property check when
105
+ * a value satisfies a generic constraint, so a `states` object carrying a fifth
106
+ * key the enum does not have compiles clean. The same caveat `defineEntities`
107
+ * records for `renamedFrom`. A check that reads like it works and does not is
108
+ * worse than an absent one, so this one is where it can bite.
109
+ */
110
+ export function assertCoherent(entity, lc, allowed) {
111
+ const states = Object.keys(lc.states);
112
+ if (allowed) {
113
+ for (const name of states) {
114
+ if (!allowed.includes(name)) {
115
+ throw new Error(`lifecycle: ${entity}.states declares '${name}', which '${lc.field}' cannot hold — ` +
116
+ `it is ${allowed.map((v) => `'${v}'`).join(' | ')}`);
117
+ }
118
+ }
119
+ for (const value of allowed) {
120
+ if (!states.includes(value)) {
121
+ throw new Error(`lifecycle: '${lc.field}' can hold '${value}' but ${entity}.states does not declare it — ` +
122
+ 'a state the column can reach and the machine has never heard of is where an entity goes to get stuck');
123
+ }
124
+ }
125
+ }
126
+ if (!states.includes(lc.initial)) {
127
+ throw new Error(`lifecycle: ${entity}.initial is '${lc.initial}', which is not a declared state`);
128
+ }
129
+ for (const [name, state] of Object.entries(lc.states)) {
130
+ const edges = Object.entries(state.on ?? {});
131
+ if (state.terminal && edges.length > 0) {
132
+ throw new Error(`lifecycle: ${entity}.${name} is terminal but declares ${edges.length} transition(s) — ` +
133
+ 'a terminal state has no edges out. Drop `terminal` or drop the edges');
134
+ }
135
+ for (const [op, target] of edges) {
136
+ if (!states.includes(target)) {
137
+ throw new Error(`lifecycle: ${entity}.${name}.on['${op}'] targets '${target}', which is not a declared state`);
138
+ }
139
+ }
140
+ // An operation that both moves the entity and is declared inert in the same
141
+ // state is two answers to one question, and the evaluator would have to
142
+ // pick one silently.
143
+ for (const op of state.allow ?? []) {
144
+ if (op in (state.on ?? {})) {
145
+ throw new Error(`lifecycle: ${entity}.${name} declares '${op}' in both \`on\` and \`allow\` — ` +
146
+ 'it either moves the entity or it does not');
147
+ }
148
+ }
149
+ }
150
+ }
151
+ /**
152
+ * What `operation` does from `from`, or `null` if it is not legal there.
153
+ *
154
+ * Total and side-effect free, which is what lets `xstate`'s own
155
+ * `machine.transition()` stand beside it in tests as an independent oracle
156
+ * without either one shipping to production.
157
+ */
158
+ export function transitionFor(lc, from, operation) {
159
+ const state = lc.states[from];
160
+ if (!state)
161
+ return null;
162
+ const to = state.on?.[operation];
163
+ if (to !== undefined)
164
+ return { kind: 'transition', to };
165
+ if (state.allow?.includes(operation))
166
+ return { kind: 'allowed' };
167
+ return null;
168
+ }
169
+ /**
170
+ * The reason an illegal transition is refused with.
171
+ *
172
+ * Exported so an engine's own conflict vocabulary can REFERENCE it rather than
173
+ * spell it again — the reason is raised here now, and an engine whose exported
174
+ * `*_CONFLICT_REASONS` list said something subtly different would be publishing
175
+ * a slug no consumer would ever match.
176
+ */
177
+ export const INVALID_TRANSITION = 'invalid_transition';
178
+ /**
179
+ * The replacement for every hand-written `requireStatus` / `requireState`.
180
+ *
181
+ * Throws the platform's own `conflict` with `reason: 'invalid_transition'` —
182
+ * the reason four engines already narrow to, and the one two demos were
183
+ * silently not using. `demos/shop` threw a bare `new Error(...)`, so a caller
184
+ * branching on the refusal got a 500 where every engine gives a 409.
185
+ *
186
+ * The message names what WAS legal, because the failure a user hits is almost
187
+ * never "this operation does not exist" — it is "someone else already moved it."
188
+ */
189
+ export function assertTransition(lc, entity, from, operation) {
190
+ const outcome = transitionFor(lc, from, operation);
191
+ if (outcome)
192
+ return outcome;
193
+ const legal = Object.keys(lc.states)
194
+ .filter((s) => transitionFor(lc, s, operation) !== null)
195
+ .sort();
196
+ throw substratError('conflict', legal.length > 0
197
+ ? `invalid transition: ${entity} is '${from}', but '${operation}' requires ${legal.join(' | ')}`
198
+ : `invalid transition: '${operation}' is not legal in any state of ${entity}`, { reason: INVALID_TRANSITION });
199
+ }
200
+ /** Every operation the declaration mentions, sorted. The join key for guards and docs. */
201
+ export function operationsOf(lc) {
202
+ const ops = new Set();
203
+ for (const state of Object.values(lc.states)) {
204
+ for (const op of Object.keys(state.on ?? {}))
205
+ ops.add(op);
206
+ for (const op of state.allow ?? [])
207
+ ops.add(op);
208
+ }
209
+ return [...ops].sort();
210
+ }
211
+ /**
212
+ * Render lifecycles to plain JSON for `model.json`.
213
+ *
214
+ * Deterministic in the same way `emitModel` is: entities, states and edges are
215
+ * emitted in sorted order, so a reordered declaration is not a spurious diff
216
+ * and the checked-in artifact stays reviewable.
217
+ */
218
+ export function emitLifecycles(lifecycles) {
219
+ const out = {};
220
+ for (const entity of Object.keys(lifecycles).sort()) {
221
+ const lc = lifecycles[entity];
222
+ if (!lc)
223
+ continue;
224
+ assertCoherent(entity, lc);
225
+ const states = {};
226
+ for (const name of Object.keys(lc.states).sort()) {
227
+ const s = lc.states[name];
228
+ const edges = {};
229
+ for (const op of Object.keys(s.on ?? {}).sort()) {
230
+ const target = s.on[op];
231
+ if (target !== undefined)
232
+ edges[op] = target;
233
+ }
234
+ states[name] = {
235
+ ...(Object.keys(edges).length ? { on: edges } : {}),
236
+ ...(s.allow?.length ? { allow: [...s.allow].sort() } : {}),
237
+ ...(s.extensible ? { extensible: true } : {}),
238
+ ...(s.terminal ? { terminal: true } : {}),
239
+ };
240
+ }
241
+ out[entity] = { field: lc.field, initial: lc.initial, states };
242
+ }
243
+ return out;
244
+ }
245
+ //# sourceMappingURL=lifecycle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lifecycle.js","sourceRoot":"","sources":["../src/lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAiG5C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,gBAAgB,CAC9B,SAAY,EACZ,WAAc;IAEd,OAAO,SAAS,OAAO,CAIrB,UAAa;QACb,KAAK,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAA0C,CAAC,EAAE,CAAC;YACtF,cAAc,CAAC,MAAM,EAAE,EAAE,EAAE,cAAc,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;QAC1E,CAAC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,cAAc,CAAC,MAA6B,EAAE,KAAa;IAClE,MAAM,MAAM,GAAI,MAAM,EAAE,MAAM,CAAC,KAA6C,EAAE,CAAC,KAAK,CAAC,CAAC;IACtF,MAAM,OAAO,GAAI,MAA4C,EAAE,OAAO,CAAC;IACvE,OAAO,KAAK,CAAC,OAAO,CAAC,OAAO,CAA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AAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACnD,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC1D,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,IAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACtD,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACnD,CAAC;QACJ,CAAC;QACD,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IACjE,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -156,6 +156,13 @@ export declare const moduleManifest: z.ZodObject<{
156
156
  substring: "substring";
157
157
  }>>;
158
158
  }, z.core.$strip>>>;
159
+ lists: z.ZodOptional<z.ZodArray<z.ZodObject<{
160
+ entityType: z.ZodString;
161
+ sortable: z.ZodArray<z.ZodString>;
162
+ filterable: z.ZodOptional<z.ZodArray<z.ZodString>>;
163
+ table: z.ZodOptional<z.ZodString>;
164
+ idColumn: z.ZodOptional<z.ZodString>;
165
+ }, z.core.$strip>>>;
159
166
  ui: z.ZodOptional<z.ZodObject<{
160
167
  routes: z.ZodOptional<z.ZodArray<z.ZodObject<{
161
168
  path: z.ZodString;
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,E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G,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD,wEAAwE;AACxE,MAAM,WAAW,WAAW;IAC1B,6EAA6E;IAC7E,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IAC3C,qFAAqF;IACrF,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,WAAW,CAU5F;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,UAAU,EAAE,EAClB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAC5C,WAAW,CASb;AAED,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsKzB,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC"}
package/dist/manifest.js CHANGED
@@ -224,6 +224,24 @@ export const moduleManifest = z.object({
224
224
  tokenizer: z.enum(['prefix', 'substring']).optional(),
225
225
  }))
226
226
  .optional(),
227
+ // #811: what the kernel derives a per-scope list index from, and validates a
228
+ // `?sort=`/filter against. Same authoring rule as `searchables` — `table` and
229
+ // `idColumn` come from the entity registry via `manifestLists()`, never by hand
230
+ // — and the same refusal: the kernel will not provision an index it has to
231
+ // guess a table name for.
232
+ //
233
+ // Derived from the operations, not written beside them: `listsDeclaredBy()`
234
+ // reads every `paged.over` the way `eventsEmittedBy()` reads every `emits`, so
235
+ // a paged read and its index cannot describe different columns.
236
+ lists: z
237
+ .array(z.object({
238
+ entityType: z.string().min(1),
239
+ sortable: z.array(z.string().min(1)).min(1),
240
+ filterable: z.array(z.string().min(1)).optional(),
241
+ table: z.string().min(1).optional(),
242
+ idColumn: z.string().min(1).optional(),
243
+ }))
244
+ .optional(),
227
245
  // UI contributions, composed into the vertical's app at BUILD time by the
228
246
  // shell (design doc §7.4, K-15). Component values are module-relative import
229
247
  // paths. All contributions are permission-keyed; the shell renders them
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,0EAA0E;AAC1E,wEAAwE;AAExE,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC;KAC3B,MAAM,EAAE;KACR,KAAK,CAAC,sDAAsD,CAAC,CAAC;AAEjE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,GAAG,EAAE,aAAa;IAClB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,qDAAqD;CACtF,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,IAAI,EAAE,SAAS;IACf,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;CAC3C,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,gDAAgD;IAC3E,SAAS,EAAE,CAAC,CAAC,MAAM,EA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C,CAAC"}
package/dist/model.d.ts CHANGED
@@ -22,6 +22,7 @@
22
22
  * from is #680/#685's question; the registry is a prerequisite either way.
23
23
  */
24
24
  import { z } from 'zod';
25
+ import { type EmittedLifecycle, type LifecycleDef } from './lifecycle.js';
25
26
  /**
26
27
  * One entity: the table it lives in, its field schema, and its place in the
27
28
  * permission graph.
@@ -200,13 +201,21 @@ export interface EmittedEntity {
200
201
  }
201
202
  export interface EmittedModel {
202
203
  readonly entities: Record<string, EmittedEntity>;
204
+ /**
205
+ * The declared state machines (#844), keyed by entity. Absent when a module
206
+ * declares none — an empty object would claim "this module has no lifecycles"
207
+ * where absence honestly says "it has not declared any."
208
+ */
209
+ readonly lifecycles?: Record<string, EmittedLifecycle>;
203
210
  }
204
211
  /**
205
212
  * Render the registry to plain JSON. Deterministic: entities and their fields
206
213
  * are emitted in sorted order, so the checked-in artifact diffs cleanly and a
207
214
  * reordered declaration is not a spurious change.
208
215
  */
209
- export declare function emitModel<T extends Record<string, EntityDef>>(entities: T): EmittedModel;
216
+ export declare function emitModel<T extends Record<string, EntityDef>>(entities: T, options?: {
217
+ readonly lifecycles?: Record<string, LifecycleDef>;
218
+ }): EmittedModel;
210
219
  /**
211
220
  * `entityRelations` derived from the `parent` declarations, rather than written
212
221
  * a second time by hand.