@adminiumjs/manifest 0.3.5 → 0.3.7

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 (66) hide show
  1. package/dist/capacity.d.ts +786 -0
  2. package/dist/capacity.d.ts.map +1 -0
  3. package/dist/capacity.js +717 -0
  4. package/dist/capacity.js.map +1 -0
  5. package/dist/documents.d.ts +91 -5
  6. package/dist/documents.d.ts.map +1 -1
  7. package/dist/documents.js +129 -32
  8. package/dist/documents.js.map +1 -1
  9. package/dist/formula.d.ts +114 -2
  10. package/dist/formula.d.ts.map +1 -1
  11. package/dist/formula.js +291 -5
  12. package/dist/formula.js.map +1 -1
  13. package/dist/index.d.ts +12 -6
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +12 -6
  16. package/dist/index.js.map +1 -1
  17. package/dist/marketplace-wire.d.ts +230 -0
  18. package/dist/marketplace-wire.d.ts.map +1 -0
  19. package/dist/marketplace-wire.js +138 -0
  20. package/dist/marketplace-wire.js.map +1 -0
  21. package/dist/outbox.d.ts +242 -27
  22. package/dist/outbox.d.ts.map +1 -1
  23. package/dist/outbox.js +553 -27
  24. package/dist/outbox.js.map +1 -1
  25. package/dist/plan-context.d.ts +28 -3
  26. package/dist/plan-context.d.ts.map +1 -1
  27. package/dist/plan-context.js +291 -14
  28. package/dist/plan-context.js.map +1 -1
  29. package/dist/plan-model.d.ts +58 -3
  30. package/dist/plan-model.d.ts.map +1 -1
  31. package/dist/public-access.d.ts +637 -0
  32. package/dist/public-access.d.ts.map +1 -1
  33. package/dist/public-access.js +1593 -12
  34. package/dist/public-access.js.map +1 -1
  35. package/dist/refs.d.ts +86 -0
  36. package/dist/refs.d.ts.map +1 -1
  37. package/dist/refs.js +186 -0
  38. package/dist/refs.js.map +1 -1
  39. package/dist/roles.d.ts +10 -2
  40. package/dist/roles.d.ts.map +1 -1
  41. package/dist/roles.js +27 -5
  42. package/dist/roles.js.map +1 -1
  43. package/dist/sample.d.ts +218 -2
  44. package/dist/sample.d.ts.map +1 -1
  45. package/dist/sample.js +145 -7
  46. package/dist/sample.js.map +1 -1
  47. package/dist/schema.d.ts +2860 -360
  48. package/dist/schema.d.ts.map +1 -1
  49. package/dist/schema.js +1002 -54
  50. package/dist/schema.js.map +1 -1
  51. package/dist/shapes.d.ts +5 -1
  52. package/dist/shapes.d.ts.map +1 -1
  53. package/dist/shapes.js +13 -3
  54. package/dist/shapes.js.map +1 -1
  55. package/dist/states.d.ts +342 -2
  56. package/dist/states.d.ts.map +1 -1
  57. package/dist/states.js +566 -7
  58. package/dist/states.js.map +1 -1
  59. package/dist/table-shapes.d.ts +47 -0
  60. package/dist/table-shapes.d.ts.map +1 -0
  61. package/dist/table-shapes.js +159 -0
  62. package/dist/table-shapes.js.map +1 -0
  63. package/dist/validate.d.ts.map +1 -1
  64. package/dist/validate.js +80 -2
  65. package/dist/validate.js.map +1 -1
  66. package/package.json +2 -2
package/dist/states.d.ts CHANGED
@@ -30,7 +30,9 @@
30
30
  * stamps) keep being written by Adminium.
31
31
  * - `children`: child tables tied to this row's state. `lock` refuses their
32
32
  * writes while the row is locked; `parentIn` allows them only while the row
33
- * is in those states (payments on a sent invoice); `clearOnCreate` empties
33
+ * is in those states (payments on a sent invoice) — or, apart, `createIn`
34
+ * for a new child and `changeIn` for a change or a delete of one (a payment
35
+ * taken only on a live stay, and voided on a cancelled one too); `clearOnCreate` empties
34
36
  * columns of this row when one of them is created (a recorded payment
35
37
  * clears the client's "I've sent it"). `release` opens a locked child a
36
38
  * little while its parent is in some of the lock's states: a change that
@@ -46,12 +48,28 @@
46
48
  * - `noDelete`: rows in these states, or any row with a number
47
49
  * (`"numbered"`), are never deleted — voided instead.
48
50
  * - `onlyLater`: date columns that may move later and never earlier.
51
+ * - A move may also wait for the row one of its links points at
52
+ * (`requires.linked`), for a window on the clock (`requires.time`, read from
53
+ * moments — see `refs.ts`) and for a value of the settings row
54
+ * (`requires.setting`).
55
+ * - `strict`: a write naming the state the row already holds is refused
56
+ * (a ticket let in once), repeating up to four columns of the row.
57
+ * - `late`: a move made inside some time before a moment sets a flag, or is
58
+ * refused.
59
+ * - `timed`: listed moves Adminium makes by itself once a moment of the row
60
+ * has passed (a held order expiring).
61
+ * - `effects`: a move that moves the row one of its links points at too, by a
62
+ * move that table lists (a guest checked out turns the room to cleaning).
63
+ * - `create`: what a new row must meet to be created — the conditions a move
64
+ * waits for, judged when the row is written (a check-in only for a paid
65
+ * ticket, on its day).
66
+ * - A timed move may also write fixed values to other columns (`set`).
49
67
  *
50
68
  * Adding sample data and importing past records are history: they write any
51
69
  * state their rows were in.
52
70
  */
53
71
  import { z } from 'zod';
54
- import { type ColumnShape, type ReferenceIssue, type TableIndex } from './refs.js';
72
+ import { type ColumnShape, type Moment, type MomentOffset, type ReferenceIssue, type TableIndex } from './refs.js';
55
73
  /** A condition on the row itself, checked in the same statement that changes it. */
56
74
  export declare const stateConditionSchema: z.ZodObject<{
57
75
  column: z.ZodString;
@@ -64,6 +82,34 @@ export declare const stateConditionSchema: z.ZodObject<{
64
82
  lte: z.ZodOptional<z.ZodNumber>;
65
83
  }, z.core.$strict>;
66
84
  export type StateCondition = z.infer<typeof stateConditionSchema>;
85
+ /** Conditions on the row one of this row's links points at (the order a ticket belongs to is paid). */
86
+ export declare const linkedConditionSchema: z.ZodObject<{
87
+ via: z.ZodString;
88
+ where: z.ZodArray<z.ZodObject<{
89
+ column: z.ZodString;
90
+ eq: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
91
+ in: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
92
+ isNull: z.ZodOptional<z.ZodBoolean>;
93
+ gt: z.ZodOptional<z.ZodNumber>;
94
+ gte: z.ZodOptional<z.ZodNumber>;
95
+ lt: z.ZodOptional<z.ZodNumber>;
96
+ lte: z.ZodOptional<z.ZodNumber>;
97
+ }, z.core.$strict>>;
98
+ }, z.core.$strict>;
99
+ export type LinkedCondition = z.infer<typeof linkedConditionSchema>;
100
+ /** A move allowed only after one moment, before another, or between the two. */
101
+ export declare const timeConditionSchema: z.ZodObject<{
102
+ after: z.ZodOptional<z.ZodType<Moment, unknown, z.core.$ZodTypeInternals<Moment, unknown>>>;
103
+ before: z.ZodOptional<z.ZodType<Moment, unknown, z.core.$ZodTypeInternals<Moment, unknown>>>;
104
+ }, z.core.$strict>;
105
+ export type TimeCondition = z.infer<typeof timeConditionSchema>;
106
+ /** A value of the app's one-row settings table a move waits for (door sales switched on). */
107
+ export declare const settingConditionSchema: z.ZodObject<{
108
+ table: z.ZodString;
109
+ column: z.ZodString;
110
+ eq: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
111
+ }, z.core.$strict>;
112
+ export type SettingCondition = z.infer<typeof settingConditionSchema>;
67
113
  export declare const stateMoveSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
68
114
  to: z.ZodString;
69
115
  requires: z.ZodOptional<z.ZodObject<{
@@ -78,14 +124,40 @@ export declare const stateMoveSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObj
78
124
  lt: z.ZodOptional<z.ZodNumber>;
79
125
  lte: z.ZodOptional<z.ZodNumber>;
80
126
  }, z.core.$strict>>>;
127
+ linked: z.ZodOptional<z.ZodArray<z.ZodObject<{
128
+ via: z.ZodString;
129
+ where: z.ZodArray<z.ZodObject<{
130
+ column: z.ZodString;
131
+ eq: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
132
+ in: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
133
+ isNull: z.ZodOptional<z.ZodBoolean>;
134
+ gt: z.ZodOptional<z.ZodNumber>;
135
+ gte: z.ZodOptional<z.ZodNumber>;
136
+ lt: z.ZodOptional<z.ZodNumber>;
137
+ lte: z.ZodOptional<z.ZodNumber>;
138
+ }, z.core.$strict>>;
139
+ }, z.core.$strict>>>;
140
+ time: z.ZodOptional<z.ZodObject<{
141
+ after: z.ZodOptional<z.ZodType<Moment, unknown, z.core.$ZodTypeInternals<Moment, unknown>>>;
142
+ before: z.ZodOptional<z.ZodType<Moment, unknown, z.core.$ZodTypeInternals<Moment, unknown>>>;
143
+ }, z.core.$strict>>;
144
+ setting: z.ZodOptional<z.ZodArray<z.ZodObject<{
145
+ table: z.ZodString;
146
+ column: z.ZodString;
147
+ eq: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
148
+ }, z.core.$strict>>>;
81
149
  }, z.core.$strict>>;
82
150
  roles: z.ZodOptional<z.ZodArray<z.ZodString>>;
151
+ undo: z.ZodOptional<z.ZodLiteral<true>>;
152
+ clears: z.ZodOptional<z.ZodArray<z.ZodString>>;
83
153
  }, z.core.$strict>]>;
84
154
  export type StateMove = z.infer<typeof stateMoveSchema>;
85
155
  export declare const stateChildSchema: z.ZodObject<{
86
156
  via: z.ZodString;
87
157
  lock: z.ZodOptional<z.ZodLiteral<true>>;
88
158
  parentIn: z.ZodOptional<z.ZodArray<z.ZodString>>;
159
+ createIn: z.ZodOptional<z.ZodArray<z.ZodString>>;
160
+ changeIn: z.ZodOptional<z.ZodArray<z.ZodString>>;
89
161
  clearOnCreate: z.ZodOptional<z.ZodArray<z.ZodString>>;
90
162
  release: z.ZodOptional<z.ZodObject<{
91
163
  when: z.ZodArray<z.ZodString>;
@@ -94,6 +166,138 @@ export declare const stateChildSchema: z.ZodObject<{
94
166
  lockLinked: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
95
167
  }, z.core.$strict>;
96
168
  export type StateChild = z.infer<typeof stateChildSchema>;
169
+ /**
170
+ * `strict`: a write that names the state the row already holds is refused
171
+ * instead of passing silently (a ticket scanned twice). `show` names up to
172
+ * four columns of the row the refusal repeats (the door it came in by);
173
+ * never a personal or secret column.
174
+ */
175
+ export declare const strictStatesSchema: z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodObject<{
176
+ show: z.ZodArray<z.ZodString>;
177
+ }, z.core.$strict>]>;
178
+ /**
179
+ * A move to `to` (from one of `from`, or from anywhere) made inside `within`
180
+ * before `moment`: `flag` lets it through and sets the bool column `flag`;
181
+ * `refuse` turns it away — for public writers, or with `refuse: 'everyone'`
182
+ * for every writer.
183
+ */
184
+ export declare const lateMoveSchema: z.ZodObject<{
185
+ to: z.ZodString;
186
+ from: z.ZodOptional<z.ZodArray<z.ZodString>>;
187
+ moment: z.ZodType<Moment, unknown, z.core.$ZodTypeInternals<Moment, unknown>>;
188
+ within: z.ZodType<MomentOffset, unknown, z.core.$ZodTypeInternals<MomentOffset, unknown>>;
189
+ mode: z.ZodEnum<{
190
+ refuse: "refuse";
191
+ flag: "flag";
192
+ }>;
193
+ flag: z.ZodOptional<z.ZodString>;
194
+ refuse: z.ZodOptional<z.ZodEnum<{
195
+ public: "public";
196
+ everyone: "everyone";
197
+ }>>;
198
+ }, z.core.$strict>;
199
+ export type LateMove = z.infer<typeof lateMoveSchema>;
200
+ /**
201
+ * A listed move Adminium makes by itself once `at` has passed, for a row still
202
+ * in `from`. `set` writes fixed values to other columns of the row in the same
203
+ * move (why an order still open at closing was cancelled).
204
+ */
205
+ export declare const timedMoveSchema: z.ZodObject<{
206
+ from: z.ZodString;
207
+ to: z.ZodString;
208
+ at: z.ZodType<Moment, unknown, z.core.$ZodTypeInternals<Moment, unknown>>;
209
+ set: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodNull]>>>;
210
+ }, z.core.$strict>;
211
+ export type TimedMove = z.infer<typeof timedMoveSchema>;
212
+ /**
213
+ * What a row must meet to be created at all: a value of its own
214
+ * (`where`), of the row one of its links points at (`linked`), of the
215
+ * settings row (`setting`), and a window on the clock (`time`) — the same
216
+ * shapes a move waits for. A check-in recorded only for a paid ticket, on
217
+ * its day, from half an hour before the doors.
218
+ */
219
+ export declare const createRequiresSchema: z.ZodObject<{
220
+ requires: z.ZodObject<{
221
+ where: z.ZodOptional<z.ZodArray<z.ZodObject<{
222
+ column: z.ZodString;
223
+ eq: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
224
+ in: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
225
+ isNull: z.ZodOptional<z.ZodBoolean>;
226
+ gt: z.ZodOptional<z.ZodNumber>;
227
+ gte: z.ZodOptional<z.ZodNumber>;
228
+ lt: z.ZodOptional<z.ZodNumber>;
229
+ lte: z.ZodOptional<z.ZodNumber>;
230
+ }, z.core.$strict>>>;
231
+ linked: z.ZodOptional<z.ZodArray<z.ZodObject<{
232
+ via: z.ZodString;
233
+ where: z.ZodArray<z.ZodObject<{
234
+ column: z.ZodString;
235
+ eq: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
236
+ in: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
237
+ isNull: z.ZodOptional<z.ZodBoolean>;
238
+ gt: z.ZodOptional<z.ZodNumber>;
239
+ gte: z.ZodOptional<z.ZodNumber>;
240
+ lt: z.ZodOptional<z.ZodNumber>;
241
+ lte: z.ZodOptional<z.ZodNumber>;
242
+ }, z.core.$strict>>;
243
+ }, z.core.$strict>>>;
244
+ time: z.ZodOptional<z.ZodObject<{
245
+ after: z.ZodOptional<z.ZodType<Moment, unknown, z.core.$ZodTypeInternals<Moment, unknown>>>;
246
+ before: z.ZodOptional<z.ZodType<Moment, unknown, z.core.$ZodTypeInternals<Moment, unknown>>>;
247
+ }, z.core.$strict>>;
248
+ setting: z.ZodOptional<z.ZodArray<z.ZodObject<{
249
+ table: z.ZodString;
250
+ column: z.ZodString;
251
+ eq: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
252
+ }, z.core.$strict>>>;
253
+ }, z.core.$strict>;
254
+ }, z.core.$strict>;
255
+ export type CreateRequires = z.infer<typeof createRequiresSchema>;
256
+ /**
257
+ * When this row moves to `on.to`, the row its link `via` points at moves too,
258
+ * in the same write: `set` names that table's state column and the state it
259
+ * moves to, one of the moves that table lists (a guest checked out turns the
260
+ * room to cleaning). One link, never a chain.
261
+ */
262
+ export declare const moveEffectSchema: z.ZodObject<{
263
+ on: z.ZodObject<{
264
+ to: z.ZodString;
265
+ }, z.core.$strict>;
266
+ via: z.ZodString;
267
+ set: z.ZodRecord<z.ZodString, z.ZodString>;
268
+ }, z.core.$strict>;
269
+ export type MoveEffect = z.infer<typeof moveEffectSchema>;
270
+ /**
271
+ * When the link `on.change` really changes — while this row is in one of
272
+ * `on.in` before and after the write — the row it pointed at moves by `old`
273
+ * and the row it now points at by `new`, in the same write (a guest moved to
274
+ * another room: the old room to cleaning, the new one to occupied, which only
275
+ * a ready room may be). Each is that table's declared move; a new row already
276
+ * in `new`'s state refuses the write. Either side may be left out, and a link
277
+ * emptied or first set moves only the side there is.
278
+ */
279
+ export declare const changeEffectSchema: z.ZodObject<{
280
+ on: z.ZodObject<{
281
+ change: z.ZodString;
282
+ in: z.ZodOptional<z.ZodArray<z.ZodString>>;
283
+ }, z.core.$strict>;
284
+ old: z.ZodOptional<z.ZodObject<{
285
+ set: z.ZodRecord<z.ZodString, z.ZodString>;
286
+ }, z.core.$strict>>;
287
+ new: z.ZodOptional<z.ZodObject<{
288
+ set: z.ZodRecord<z.ZodString, z.ZodString>;
289
+ }, z.core.$strict>>;
290
+ }, z.core.$strict>;
291
+ export type ChangeEffect = z.infer<typeof changeEffectSchema>;
292
+ export type StateEffect = MoveEffect | ChangeEffect;
293
+ /** Whether an effect is set off by a changed link rather than by a move. */
294
+ export declare function isChangeEffect(effect: StateEffect): effect is ChangeEffect;
295
+ /**
296
+ * An effect, parsed by the schema of the form written (a move's, or a changed
297
+ * link's), so a mistake is named where it is: a union of the two would only
298
+ * say the input is invalid.
299
+ */
300
+ export declare const stateEffectSchema: z.ZodCustom<StateEffect, StateEffect>;
97
301
  export declare const statesSchema: z.ZodObject<{
98
302
  column: z.ZodString;
99
303
  initial: z.ZodString;
@@ -111,8 +315,32 @@ export declare const statesSchema: z.ZodObject<{
111
315
  lt: z.ZodOptional<z.ZodNumber>;
112
316
  lte: z.ZodOptional<z.ZodNumber>;
113
317
  }, z.core.$strict>>>;
318
+ linked: z.ZodOptional<z.ZodArray<z.ZodObject<{
319
+ via: z.ZodString;
320
+ where: z.ZodArray<z.ZodObject<{
321
+ column: z.ZodString;
322
+ eq: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
323
+ in: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
324
+ isNull: z.ZodOptional<z.ZodBoolean>;
325
+ gt: z.ZodOptional<z.ZodNumber>;
326
+ gte: z.ZodOptional<z.ZodNumber>;
327
+ lt: z.ZodOptional<z.ZodNumber>;
328
+ lte: z.ZodOptional<z.ZodNumber>;
329
+ }, z.core.$strict>>;
330
+ }, z.core.$strict>>>;
331
+ time: z.ZodOptional<z.ZodObject<{
332
+ after: z.ZodOptional<z.ZodType<Moment, unknown, z.core.$ZodTypeInternals<Moment, unknown>>>;
333
+ before: z.ZodOptional<z.ZodType<Moment, unknown, z.core.$ZodTypeInternals<Moment, unknown>>>;
334
+ }, z.core.$strict>>;
335
+ setting: z.ZodOptional<z.ZodArray<z.ZodObject<{
336
+ table: z.ZodString;
337
+ column: z.ZodString;
338
+ eq: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
339
+ }, z.core.$strict>>>;
114
340
  }, z.core.$strict>>;
115
341
  roles: z.ZodOptional<z.ZodArray<z.ZodString>>;
342
+ undo: z.ZodOptional<z.ZodLiteral<true>>;
343
+ clears: z.ZodOptional<z.ZodArray<z.ZodString>>;
116
344
  }, z.core.$strict>]>>>;
117
345
  lock: z.ZodOptional<z.ZodObject<{
118
346
  when: z.ZodArray<z.ZodString>;
@@ -122,6 +350,8 @@ export declare const statesSchema: z.ZodObject<{
122
350
  via: z.ZodString;
123
351
  lock: z.ZodOptional<z.ZodLiteral<true>>;
124
352
  parentIn: z.ZodOptional<z.ZodArray<z.ZodString>>;
353
+ createIn: z.ZodOptional<z.ZodArray<z.ZodString>>;
354
+ changeIn: z.ZodOptional<z.ZodArray<z.ZodString>>;
125
355
  clearOnCreate: z.ZodOptional<z.ZodArray<z.ZodString>>;
126
356
  release: z.ZodOptional<z.ZodObject<{
127
357
  when: z.ZodArray<z.ZodString>;
@@ -138,9 +368,78 @@ export declare const statesSchema: z.ZodObject<{
138
368
  when: z.ZodUnion<readonly [z.ZodLiteral<"numbered">, z.ZodArray<z.ZodString>]>;
139
369
  }, z.core.$strict>>;
140
370
  onlyLater: z.ZodOptional<z.ZodArray<z.ZodString>>;
371
+ strict: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodObject<{
372
+ show: z.ZodArray<z.ZodString>;
373
+ }, z.core.$strict>]>>;
374
+ late: z.ZodOptional<z.ZodArray<z.ZodObject<{
375
+ to: z.ZodString;
376
+ from: z.ZodOptional<z.ZodArray<z.ZodString>>;
377
+ moment: z.ZodType<Moment, unknown, z.core.$ZodTypeInternals<Moment, unknown>>;
378
+ within: z.ZodType<MomentOffset, unknown, z.core.$ZodTypeInternals<MomentOffset, unknown>>;
379
+ mode: z.ZodEnum<{
380
+ refuse: "refuse";
381
+ flag: "flag";
382
+ }>;
383
+ flag: z.ZodOptional<z.ZodString>;
384
+ refuse: z.ZodOptional<z.ZodEnum<{
385
+ public: "public";
386
+ everyone: "everyone";
387
+ }>>;
388
+ }, z.core.$strict>>>;
389
+ timed: z.ZodOptional<z.ZodArray<z.ZodObject<{
390
+ from: z.ZodString;
391
+ to: z.ZodString;
392
+ at: z.ZodType<Moment, unknown, z.core.$ZodTypeInternals<Moment, unknown>>;
393
+ set: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodNull]>>>;
394
+ }, z.core.$strict>>>;
395
+ effects: z.ZodOptional<z.ZodArray<z.ZodCustom<StateEffect, StateEffect>>>;
396
+ create: z.ZodOptional<z.ZodObject<{
397
+ requires: z.ZodObject<{
398
+ where: z.ZodOptional<z.ZodArray<z.ZodObject<{
399
+ column: z.ZodString;
400
+ eq: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
401
+ in: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
402
+ isNull: z.ZodOptional<z.ZodBoolean>;
403
+ gt: z.ZodOptional<z.ZodNumber>;
404
+ gte: z.ZodOptional<z.ZodNumber>;
405
+ lt: z.ZodOptional<z.ZodNumber>;
406
+ lte: z.ZodOptional<z.ZodNumber>;
407
+ }, z.core.$strict>>>;
408
+ linked: z.ZodOptional<z.ZodArray<z.ZodObject<{
409
+ via: z.ZodString;
410
+ where: z.ZodArray<z.ZodObject<{
411
+ column: z.ZodString;
412
+ eq: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
413
+ in: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
414
+ isNull: z.ZodOptional<z.ZodBoolean>;
415
+ gt: z.ZodOptional<z.ZodNumber>;
416
+ gte: z.ZodOptional<z.ZodNumber>;
417
+ lt: z.ZodOptional<z.ZodNumber>;
418
+ lte: z.ZodOptional<z.ZodNumber>;
419
+ }, z.core.$strict>>;
420
+ }, z.core.$strict>>>;
421
+ time: z.ZodOptional<z.ZodObject<{
422
+ after: z.ZodOptional<z.ZodType<Moment, unknown, z.core.$ZodTypeInternals<Moment, unknown>>>;
423
+ before: z.ZodOptional<z.ZodType<Moment, unknown, z.core.$ZodTypeInternals<Moment, unknown>>>;
424
+ }, z.core.$strict>>;
425
+ setting: z.ZodOptional<z.ZodArray<z.ZodObject<{
426
+ table: z.ZodString;
427
+ column: z.ZodString;
428
+ eq: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
429
+ }, z.core.$strict>>>;
430
+ }, z.core.$strict>;
431
+ }, z.core.$strict>>;
141
432
  }, z.core.$strict>;
142
433
  export type States = z.infer<typeof statesSchema>;
143
434
  /** A move written as a bare state is a move with nothing asked first. */
435
+ /**
436
+ * Whether a state is reached only by moves marked `undo`: made only by a
437
+ * person naming the state they saw — never by a door that names none (a
438
+ * timed move, an effect, an email's `onSent`, a guest's writable value).
439
+ */
440
+ export declare function reachedOnlyByUndo(states: {
441
+ moves: Readonly<Record<string, readonly StateMove[]>>;
442
+ } | undefined, state: unknown): boolean;
144
443
  export declare function moveTarget(move: StateMove): string;
145
444
  interface StatesContext<C extends ColumnShape> {
146
445
  index: TableIndex<C>;
@@ -148,8 +447,49 @@ interface StatesContext<C extends ColumnShape> {
148
447
  roles?: readonly string[] | undefined;
149
448
  /** A column of this table decides "numbered": a gapless running number. */
150
449
  numbered: boolean;
450
+ /** Why a column of this table is kept from readers (a secret, personal data, a shared link's code), or null. */
451
+ keptFromReaders?: ((column: string) => string | null) | undefined;
452
+ /** Whether another rule already writes a column of this table. */
453
+ decided?: ((column: string) => boolean) | undefined;
454
+ /** This table's booking cancellation, which keeps a late flag of its own. */
455
+ bookingCancel?: {
456
+ column: string;
457
+ to: string;
458
+ } | undefined;
459
+ /** Another table's states, which an effect moves. */
460
+ statesOf?: ((table: string) => States | undefined) | undefined;
461
+ /** Whether another table keeps a booking guard (`table.booking`), whose lock an effect's write cannot take. */
462
+ bookedOf?: ((table: string) => boolean) | undefined;
463
+ /** The table whose states another table's rows are tied to as its lines (`states.children`), or undefined. */
464
+ lineOf?: ((table: string) => string | undefined) | undefined;
465
+ /** The app's outbox table, whose rows move only by the outbox's own moves. */
466
+ outboxTable?: string | undefined;
467
+ }
468
+ /** A column of the table as the judge of an undo's `clears` needs it. */
469
+ export interface UndoColumn {
470
+ /** The table's key. */
471
+ key: boolean;
472
+ nullable: boolean;
151
473
  }
474
+ /**
475
+ * Everything wrong with what a table's undo moves empty (`clears`), and with a
476
+ * move that another move to the same state comes before — the judge takes the
477
+ * first, so a later one marked `undo` or naming `clears` would never be made.
478
+ * Paths are relative to the states. The one judge for an app's manifest and a
479
+ * states rule saved in Studio (the server's `statesRuleIssue`).
480
+ */
481
+ export declare function undoMoveIssues(states: {
482
+ column: string;
483
+ moves: Readonly<Record<string, readonly StateMove[]>>;
484
+ }, table: string, lookup: {
485
+ column: (ref: string) => UndoColumn | undefined;
486
+ decided: (ref: string) => boolean;
487
+ }): {
488
+ path: (string | number)[];
489
+ message: string;
490
+ }[];
152
491
  /** Everything wrong with one table's `states` against the manifest's tables. */
153
492
  export declare function statesIssues<C extends ColumnShape>(table: string, states: States, ctx: StatesContext<C>, at: (...rest: (string | number)[]) => (string | number)[]): ReferenceIssue[];
493
+ export declare function conditionIssues<C extends ColumnShape>(table: string, condition: StateCondition, index: TableIndex<C>, path: (string | number)[]): ReferenceIssue[];
154
494
  export {};
155
495
  //# sourceMappingURL=states.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"states.d.ts","sourceRoot":"","sources":["../src/states.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAsC,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAKvH,oFAAoF;AACpF,eAAO,MAAM,oBAAoB;;;;;;;;;kBAc7B,CAAC;AACL,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC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