@composable-os/sdk 0.1.0-beta.10 → 0.1.0-beta.13

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 (105) hide show
  1. package/dist/acknowledge.d.ts +38 -0
  2. package/dist/acknowledge.js +30 -0
  3. package/dist/agreements.d.ts +80 -0
  4. package/dist/agreements.js +109 -0
  5. package/dist/allowance.d.ts +47 -5
  6. package/dist/allowance.js +59 -4
  7. package/dist/automation-check.d.ts +6 -1
  8. package/dist/automation-check.js +93 -8
  9. package/dist/automation.d.ts +62 -4
  10. package/dist/automation.js +32 -9
  11. package/dist/behaviour.js +25 -6
  12. package/dist/calendar-entry.d.ts +97 -0
  13. package/dist/calendar-entry.js +180 -0
  14. package/dist/capacity.d.ts +69 -0
  15. package/dist/capacity.js +63 -2
  16. package/dist/checklists.d.ts +41 -0
  17. package/dist/checklists.js +75 -0
  18. package/dist/contract.d.ts +527 -26
  19. package/dist/contract.js +21 -3
  20. package/dist/discount.d.ts +135 -0
  21. package/dist/discount.js +281 -0
  22. package/dist/document.d.ts +2 -1
  23. package/dist/document.js +2 -1
  24. package/dist/field-types.d.ts +1 -1
  25. package/dist/field-types.js +5 -0
  26. package/dist/formula/compile.d.ts +15 -0
  27. package/dist/formula/compile.js +9 -0
  28. package/dist/index.d.ts +17 -0
  29. package/dist/index.js +17 -0
  30. package/dist/intake.d.ts +134 -0
  31. package/dist/intake.js +239 -0
  32. package/dist/journey-signals.d.ts +89 -0
  33. package/dist/journey-signals.js +151 -0
  34. package/dist/manifest.d.ts +1060 -60
  35. package/dist/manifest.js +1111 -61
  36. package/dist/mine.d.ts +45 -0
  37. package/dist/mine.js +119 -0
  38. package/dist/occupies.d.ts +64 -0
  39. package/dist/occupies.js +122 -0
  40. package/dist/questions.d.ts +179 -0
  41. package/dist/questions.js +514 -0
  42. package/dist/recurring.d.ts +33 -4
  43. package/dist/recurring.js +50 -3
  44. package/dist/restricted-fields.d.ts +15 -0
  45. package/dist/restricted-fields.js +97 -0
  46. package/dist/rich-text.d.ts +22 -0
  47. package/dist/rich-text.js +91 -0
  48. package/dist/routine-mail.d.ts +400 -0
  49. package/dist/routine-mail.js +955 -0
  50. package/dist/runtime.d.ts +5 -11
  51. package/dist/runtime.js +21 -11
  52. package/dist/screens.d.ts +3 -0
  53. package/dist/screens.js +74 -0
  54. package/dist/sellable.d.ts +231 -2
  55. package/dist/sellable.js +342 -1
  56. package/dist/slug.d.ts +2 -0
  57. package/dist/slug.js +6 -2
  58. package/dist/staffed.d.ts +178 -0
  59. package/dist/staffed.js +287 -0
  60. package/dist/states.d.ts +74 -4
  61. package/dist/states.js +154 -58
  62. package/dist/stock.d.ts +129 -0
  63. package/dist/stock.js +205 -0
  64. package/dist/team.d.ts +28 -0
  65. package/dist/team.js +52 -0
  66. package/dist/testing.d.ts +22 -1
  67. package/dist/testing.js +47 -5
  68. package/dist/worked-on.d.ts +42 -0
  69. package/dist/worked-on.js +79 -0
  70. package/package.json +9 -1
  71. package/src/acknowledge.ts +100 -0
  72. package/src/agreements.ts +185 -0
  73. package/src/allowance.ts +98 -8
  74. package/src/automation-check.ts +120 -9
  75. package/src/automation.ts +78 -10
  76. package/src/behaviour.ts +26 -6
  77. package/src/calendar-entry.ts +258 -0
  78. package/src/capacity.ts +103 -2
  79. package/src/checklists.ts +118 -0
  80. package/src/contract.ts +514 -27
  81. package/src/discount.ts +408 -0
  82. package/src/document.ts +4 -2
  83. package/src/field-types.ts +5 -0
  84. package/src/formula/compile.ts +10 -0
  85. package/src/index.ts +17 -0
  86. package/src/intake.ts +380 -0
  87. package/src/journey-signals.ts +215 -0
  88. package/src/manifest.ts +1313 -66
  89. package/src/mine.ts +161 -0
  90. package/src/occupies.ts +192 -0
  91. package/src/questions.ts +681 -0
  92. package/src/recurring.ts +90 -9
  93. package/src/restricted-fields.ts +129 -0
  94. package/src/rich-text.ts +112 -0
  95. package/src/routine-mail.ts +1272 -0
  96. package/src/runtime.ts +25 -12
  97. package/src/screens.ts +91 -0
  98. package/src/sellable.ts +595 -1
  99. package/src/slug.ts +7 -2
  100. package/src/staffed.ts +474 -0
  101. package/src/states.ts +220 -64
  102. package/src/stock.ts +332 -0
  103. package/src/team.ts +83 -0
  104. package/src/testing.ts +70 -6
  105. package/src/worked-on.ts +134 -0
@@ -0,0 +1,287 @@
1
+ // The `staffed` behaviour (stage 45 step 2, ADR 0621): a record that is a shift, a time someone
2
+ // works. Its declaration, its manifest schema and its contract checks live here; the host's side
3
+ // (the time claim, refused by the database, and the warnings) is packages/core/src/staffing/.
4
+ import { z } from "zod";
5
+ const fieldName = z.string().max(40);
6
+ const path = z.string().max(81);
7
+ export const staffedManifestSchema = z
8
+ .object({
9
+ who: z.object({ field: fieldName, account: fieldName.optional() }).strict(),
10
+ starts: fieldName,
11
+ ends: fieldName,
12
+ zone: fieldName.optional(),
13
+ kind: fieldName,
14
+ live: z.array(z.string().min(1).max(100)).min(1).max(20),
15
+ place: path.optional(),
16
+ pattern: z.object({ link: fieldName, who: fieldName }).strict().optional(),
17
+ payBefore: z.object({ field: path }).strict().optional(),
18
+ payAfter: z.object({ field: path }).strict().optional(),
19
+ claimBefore: z.object({ field: path }).strict().optional(),
20
+ claimAfter: z.object({ field: path }).strict().optional(),
21
+ account: z.literal("required").optional(),
22
+ private: z.boolean().optional(),
23
+ open: z
24
+ .object({
25
+ length: z.object({ field: path }).strict(),
26
+ step: z.object({ field: path }).strict().optional(),
27
+ rooms: z.object({ field: path }).strict().optional(),
28
+ client: fieldName.optional(),
29
+ closedBy: z
30
+ .object({ object: fieldName, from: fieldName, until: fieldName })
31
+ .strict()
32
+ .optional(),
33
+ customer: z.literal(true).optional(),
34
+ })
35
+ .strict()
36
+ .optional(),
37
+ evidence: z.object({ object: fieldName, link: fieldName, by: fieldName }).strict().optional(),
38
+ timesFrom: fieldName.optional(),
39
+ })
40
+ .strict();
41
+ /** Reports problems with `objects.<name>.staffed` through `contract`. */
42
+ export function checkObjectStaffed(m, name, object, contract) {
43
+ const staffed = object.staffed;
44
+ if (!staffed)
45
+ return;
46
+ const at = `objects.${name}.staffed`;
47
+ const own = (o, local) => Object.hasOwn(o.fields, local) ? o.fields[local] : undefined;
48
+ const single = (field, types) => field !== undefined && types.includes(field.type) && !field.many;
49
+ // The person.
50
+ const who = own(object, staffed.who.field);
51
+ if (staffed.who.account === undefined) {
52
+ if (!single(who, ["user"])) {
53
+ contract(`${at}.who.field`, `"${staffed.who.field}" must be a user field of ${name}`);
54
+ }
55
+ }
56
+ else {
57
+ const target = who?.type === "relation" && !who.many ? who.to : undefined;
58
+ const local = target?.startsWith(`${m.id}.`) ? target.slice(m.id.length + 1) : undefined;
59
+ const holder = local && Object.hasOwn(m.objects, local) ? m.objects[local] : undefined;
60
+ if (!holder || local === name) {
61
+ contract(`${at}.who.field`, `"${staffed.who.field}" must be a relation field (one record) to another of this extension's objects`);
62
+ }
63
+ else if (!single(own(holder, staffed.who.account), ["user"])) {
64
+ contract(`${at}.who.account`, `"${staffed.who.account}" must be a user field of ${target}`);
65
+ }
66
+ }
67
+ // The time and the zone.
68
+ for (const key of ["starts", "ends"]) {
69
+ if (!single(own(object, staffed[key]), ["datetime"])) {
70
+ contract(`${at}.${key}`, `"${staffed[key]}" must be a datetime field of ${name}`);
71
+ }
72
+ }
73
+ if (staffed.starts === staffed.ends) {
74
+ contract(`${at}.ends`, "A shift's start and end are two fields");
75
+ }
76
+ if (staffed.zone !== undefined && !single(own(object, staffed.zone), ["timezone"])) {
77
+ contract(`${at}.zone`, `"${staffed.zone}" must be a timezone field of ${name}`);
78
+ }
79
+ // The kind.
80
+ const kind = own(object, staffed.kind);
81
+ if (kind?.type !== "relation" || kind.many) {
82
+ contract(`${at}.kind`, `"${staffed.kind}" must be a relation field (one record) of ${name}`);
83
+ }
84
+ // The states in which it is a shift.
85
+ const states = object.states;
86
+ if (!states) {
87
+ contract(`${at}.live`, `${name} must declare states: a shift is live in some of them`);
88
+ }
89
+ else {
90
+ const field = own(object, states.field);
91
+ const values = new Set((field?.options ?? []).map((o) => o.value));
92
+ for (const state of staffed.live) {
93
+ if (!values.has(state))
94
+ contract(`${at}.live`, `"${state}" is not a state of ${name}`);
95
+ }
96
+ if (new Set(staffed.live).size !== staffed.live.length) {
97
+ contract(`${at}.live`, "List each state once");
98
+ }
99
+ }
100
+ // Where it is.
101
+ if (staffed.place !== undefined) {
102
+ const [first, second, ...rest] = staffed.place.split(".");
103
+ const field = first === undefined ? undefined : own(object, first);
104
+ if (!field || rest.length || (second !== undefined && field.type !== "relation")) {
105
+ contract(`${at}.place`, `"${staffed.place}" must be a field of ${name}, or a relation of it and a field of what it names`);
106
+ }
107
+ }
108
+ // The pattern: a series of this extension making these records, copying its person onto them.
109
+ if (staffed.pattern) {
110
+ const series = Object.entries(m.objects).find(([, o]) => o.recurring?.generates === name && o.recurring.link === staffed.pattern?.link);
111
+ if (!series) {
112
+ contract(`${at}.pattern.link`, `"${staffed.pattern.link}" must be the link of a series of this extension that makes ${name}`);
113
+ }
114
+ else if (series[1].recurring?.copy?.[staffed.who.field] !== staffed.pattern.who) {
115
+ contract(`${at}.pattern.who`, `${series[0]} must copy "${staffed.pattern.who}" onto "${staffed.who.field}"`);
116
+ }
117
+ }
118
+ // Minutes for pay only, read from the kind.
119
+ for (const key of ["payBefore", "payAfter"]) {
120
+ const declared = staffed[key];
121
+ if (!declared)
122
+ continue;
123
+ const [via, field, ...rest] = declared.field.split(".");
124
+ if (via !== staffed.kind || !field || rest.length) {
125
+ contract(`${at}.${key}.field`, `"${declared.field}" must be ${staffed.kind}.<a number field of what it names>`);
126
+ }
127
+ }
128
+ // Minutes kept free around the shift, in its claim (ADR 0760): a number field of its kind, which
129
+ // is another of this extension's objects (the host builds triggers on its table to follow it).
130
+ const kindTarget = kind?.type === "relation" && !kind.many ? kind.to : undefined;
131
+ const kindLocal = kindTarget?.startsWith(`${m.id}.`)
132
+ ? kindTarget.slice(m.id.length + 1)
133
+ : undefined;
134
+ const kindObject = kindLocal && kindLocal !== name && Object.hasOwn(m.objects, kindLocal)
135
+ ? m.objects[kindLocal]
136
+ : undefined;
137
+ for (const key of ["claimBefore", "claimAfter"]) {
138
+ const declared = staffed[key];
139
+ if (!declared)
140
+ continue;
141
+ const [via, field, ...rest] = declared.field.split(".");
142
+ if (via !== staffed.kind || !field || rest.length) {
143
+ contract(`${at}.${key}.field`, `"${declared.field}" must be ${staffed.kind}.<a number field of what it names>`);
144
+ }
145
+ else if (!kindObject) {
146
+ contract(`${at}.${key}.field`, `"${staffed.kind}" must name another of this extension's objects for minutes in the claim`);
147
+ }
148
+ else if (!single(own(kindObject, field), ["number"])) {
149
+ contract(`${at}.${key}.field`, `"${field}" must be a number field of ${kindTarget}`);
150
+ }
151
+ }
152
+ // An account required: only a profile can hold none.
153
+ if (staffed.account === "required" && staffed.who.account === undefined) {
154
+ contract(`${at}.account`, `"required" needs who.account: "${staffed.who.field}" is a user field, always an account`);
155
+ }
156
+ // Booked at free times (ADRs 0762 and 0763): the kind's length, step and rooms, the client, the
157
+ // closures.
158
+ if (staffed.open) {
159
+ const open = staffed.open;
160
+ // A field of the kind (null once a problem with the path is reported).
161
+ const kindField = (key) => {
162
+ const declared = open[key];
163
+ if (!declared)
164
+ return null;
165
+ const [via, field, ...rest] = declared.field.split(".");
166
+ if (via !== staffed.kind || !field || rest.length) {
167
+ contract(`${at}.open.${key}.field`, `"${declared.field}" must be ${staffed.kind}.<a field of what it names>`);
168
+ return null;
169
+ }
170
+ if (!kindObject) {
171
+ contract(`${at}.open.${key}.field`, `"${staffed.kind}" must name another of this extension's objects for free times`);
172
+ return null;
173
+ }
174
+ return own(kindObject, field);
175
+ };
176
+ for (const key of ["length", "step"]) {
177
+ const field = kindField(key);
178
+ if (field !== null && !single(field, ["number"])) {
179
+ contract(`${at}.open.${key}.field`, `"${open[key]?.field}" must be a number field of ${kindTarget}`);
180
+ }
181
+ }
182
+ const rooms = kindField("rooms");
183
+ if (rooms !== null) {
184
+ const thingField = object.occupies ? own(object, object.occupies.thing) : undefined;
185
+ if (!thingField) {
186
+ contract(`${at}.open.rooms`, `${name} must declare occupies for the rooms it is booked in`);
187
+ }
188
+ else if (rooms?.type !== "relation" || !rooms.many || rooms.to !== thingField.to) {
189
+ contract(`${at}.open.rooms.field`, `"${open.rooms?.field}" must be a relation field (many) of ${kindTarget} to ${thingField.to}`);
190
+ }
191
+ }
192
+ if (open.client !== undefined) {
193
+ const client = own(object, open.client);
194
+ if (client?.type !== "relation" || client.many || client.to !== "person") {
195
+ contract(`${at}.open.client`, `"${open.client}" must be a relation field (one record) of ${name} to person`);
196
+ }
197
+ }
198
+ if (open.closedBy) {
199
+ const c = open.closedBy;
200
+ const closure = c.object !== name && Object.hasOwn(m.objects, c.object) ? m.objects[c.object] : undefined;
201
+ if (!closure) {
202
+ contract(`${at}.open.closedBy.object`, `"${c.object}" must be another object of this extension`);
203
+ }
204
+ else {
205
+ for (const key of ["from", "until"]) {
206
+ if (!single(own(closure, c[key]), ["date"])) {
207
+ contract(`${at}.open.closedBy.${key}`, `"${c[key]}" must be a date field of ${c.object}`);
208
+ }
209
+ }
210
+ }
211
+ }
212
+ }
213
+ // The evidence a shift was worked: another object of this extension naming it, and who marked.
214
+ if (staffed.evidence) {
215
+ const { object: other, link, by } = staffed.evidence;
216
+ const evidence = other !== name && Object.hasOwn(m.objects, other) ? m.objects[other] : undefined;
217
+ const linkField = evidence ? own(evidence, link) : undefined;
218
+ if (!evidence) {
219
+ contract(`${at}.evidence.object`, `"${other}" must be another object of this extension`);
220
+ }
221
+ else if (linkField?.type !== "relation" ||
222
+ linkField.many ||
223
+ linkField.to !== `${m.id}.${name}`) {
224
+ contract(`${at}.evidence.link`, `"${link}" must be a relation field (one record) of ${other} to ${m.id}.${name}`);
225
+ }
226
+ else if (!single(own(evidence, by), ["user"])) {
227
+ contract(`${at}.evidence.by`, `"${by}" must be a user field of ${other}`);
228
+ }
229
+ }
230
+ // Times that follow another record (ADR 0751): copied by the host from what a relation names.
231
+ if (staffed.timesFrom !== undefined)
232
+ checkTimesFrom(m, name, object, staffed, contract);
233
+ }
234
+ /**
235
+ * `staffed.timesFrom` (ADR 0751): a required relation (one record) to another of this extension's
236
+ * objects that has the shift's time fields under the same names and types (its kind a relation to
237
+ * the same object); the shift's own copies are read-only, and no series makes the shift.
238
+ */
239
+ function checkTimesFrom(m, name, object, staffed, contract) {
240
+ const at = `objects.${name}.staffed.timesFrom`;
241
+ const local = staffed.timesFrom;
242
+ const own = (o, f) => Object.hasOwn(o.fields, f) ? o.fields[f] : undefined;
243
+ const link = own(object, local);
244
+ const target = link?.type === "relation" && !link.many ? link.to : undefined;
245
+ const parentName = target?.startsWith(`${m.id}.`) ? target.slice(m.id.length + 1) : undefined;
246
+ const parent = parentName && parentName !== name && Object.hasOwn(m.objects, parentName)
247
+ ? m.objects[parentName]
248
+ : undefined;
249
+ if (!parent) {
250
+ contract(at, `"${local}" must be a relation field (one record) of ${name} to another of this extension's objects`);
251
+ return;
252
+ }
253
+ if (!link?.required) {
254
+ contract(at, `"${local}" must be required: a shift whose times follow a record names one`);
255
+ }
256
+ if (local === staffed.who.field || local === staffed.kind) {
257
+ contract(at, `"${local}" is the shift's person or kind, not the record its times follow`);
258
+ }
259
+ const followed = [
260
+ [staffed.starts, "datetime"],
261
+ [staffed.ends, "datetime"],
262
+ ...(staffed.zone !== undefined ? [[staffed.zone, "timezone"]] : []),
263
+ [staffed.kind, "relation"],
264
+ ];
265
+ for (const [field, type] of followed) {
266
+ const mine = own(object, field);
267
+ const theirs = own(parent, field);
268
+ if (!theirs ||
269
+ theirs.type !== type ||
270
+ theirs.many ||
271
+ (type === "relation" && theirs.to !== mine?.to)) {
272
+ contract(at, `${target} must have "${field}" as ${name} has it (${type === "relation" ? `a relation to ${mine?.to ?? "the same object"}` : `a ${type} field`}): the host copies it from there`);
273
+ }
274
+ if (mine && !mine.readOnly) {
275
+ contract(`objects.${name}.fields.${field}.readOnly`, `"${field}" must be readOnly: the host copies it from ${local}, nobody edits it`);
276
+ }
277
+ }
278
+ // One step only (the review of PR #419): the host reads the shifts that follow a record before it
279
+ // moves, not theirs in turn, so a record whose own times follow another is not followed.
280
+ if (parent.staffed?.timesFrom !== undefined) {
281
+ contract(at, `${target}'s own times follow another record: a shift's times follow a record whose times are its own`);
282
+ }
283
+ const series = Object.values(m.objects).some((o) => o.recurring?.generates === name);
284
+ if (staffed.pattern || series) {
285
+ contract(at, `${name} is made by a series, which sets its times: its times cannot follow ${local}`);
286
+ }
287
+ }
package/dist/states.d.ts CHANGED
@@ -35,17 +35,45 @@ export interface StateMove {
35
35
  * Tools of this extension that may also make the move for whoever called them (stage 32b,
36
36
  * ADR 0513): a move by `["host"]` with `tools: ["voidPass"]` is made by the host and by that
37
37
  * tool, and by no other staff write (not `record.update`, not the assistant, not an automation).
38
- * Each tool must be `humanOnly` and declare a `permission`, so the move is a person's act with
39
- * that permission.
38
+ * Each tool must be `humanOnly`, or `personApproves` (ADR 0552: anyone else's call waits for a
39
+ * person's approval), and declare a `permission`, so the move is a person's act with that
40
+ * permission.
40
41
  */
41
42
  tools?: readonly string[];
42
43
  /**
43
44
  * Its window binds staff too (ADR 0507), every staff caller, a person included: a cancel that
44
45
  * gives a use back is in time for everyone. The host is not bound. A person who must make the
45
- * move outside it does so through another move only a person's tool makes (`tools`).
46
+ * move outside it does so through another move only a person's tool makes (`tools`). A move
47
+ * staff alone make may have a window with it (ADR 0551): a coach ticks a name from an hour
48
+ * before the class, not days ahead.
46
49
  */
47
50
  bindsStaff?: boolean;
48
51
  }
52
+ /**
53
+ * A move the host makes by itself once a moment has passed (ADR 0550): a booking still `booked`
54
+ * 30 minutes after its class ends becomes a `no_show`, if anyone on the class was ticked. The
55
+ * runner's minute cron finds the records due and moves each as the host, from where it was or not
56
+ * at all. Each needs a declared `host` move from each of `from` to `to`.
57
+ */
58
+ export interface TimedMove {
59
+ /** The state, or states, the record moves from. */
60
+ from: string | readonly string[];
61
+ to: string;
62
+ /** A datetime field of the record, or `<relation>.<field>` one relation away (`class.endsAt`). */
63
+ at: string;
64
+ /** Minutes after `at` the move is due (0 to 10,080). */
65
+ minutesAfter?: number;
66
+ /**
67
+ * Only while another live record of this object pointing at the same record (through `at`'s
68
+ * relation) is in one of these states: a class whose attendance was taken has someone ticked.
69
+ */
70
+ ifAnyIn?: readonly string[];
71
+ /**
72
+ * Only while each of these fields of the record has a value (stage 49, ADR 0764): an appointment
73
+ * whose coach left is never marked attended for a session nobody gave.
74
+ */
75
+ ifSet?: readonly string[];
76
+ }
49
77
  /**
50
78
  * A number a window is worked out from (ADR 0505): a number; a number field named as a window's
51
79
  * `at` is; or `{ field?, setting? }`, the field's value and, when it is empty, this extension's
@@ -113,6 +141,12 @@ export interface StatesSpec {
113
141
  * one, staff included (no booking into a class that was cancelled or is over).
114
142
  */
115
143
  closed?: string | readonly string[];
144
+ /**
145
+ * Fields every create must give a value (stage 49, ADR 0764), whoever makes it, the host
146
+ * included: an appointment is made for a client. Unlike `required`, the field may be emptied
147
+ * later (erasing the Person keeps the record for the business's books, ADR 0320).
148
+ */
149
+ requires?: readonly string[];
116
150
  };
117
151
  /**
118
152
  * Moves a caller asks for by name, resolved by the host (ADR 0503): writing the name (`cancel`)
@@ -127,14 +161,31 @@ export interface StatesSpec {
127
161
  * state named in `when`, the host moves every live record of this object pointing at it, and in
128
162
  * one of `from`, to the state `when` gives, in the same batch, as the host (a class cancelled
129
163
  * moves its bookings to `cancelled_by_us`: their places released, their uses given back). Each
130
- * target needs a `host` move from each of `from`.
164
+ * target needs a `host` move from each of `from`. The parent is another of this extension's
165
+ * objects, or one of an extension this one `requires`, named in full (`ticketing.event`); a
166
+ * parent others draw places from as a pool is followed only by an object that draws none
167
+ * (ADR 0841).
131
168
  */
132
169
  follows?: {
133
170
  relation: string;
134
171
  when: Readonly<Record<string, string>>;
135
172
  from: readonly string[];
136
173
  };
174
+ /** Moves the host makes once a moment has passed (ADR 0550), at most four. */
175
+ after?: readonly TimedMove[];
137
176
  }
177
+ export declare const windowBoundSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
178
+ at: z.ZodString;
179
+ daysBefore: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodObject<{
180
+ field: z.ZodOptional<z.ZodString>;
181
+ setting: z.ZodOptional<z.ZodString>;
182
+ }, z.core.$strict>]>>;
183
+ minutesBefore: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodObject<{
184
+ field: z.ZodOptional<z.ZodString>;
185
+ setting: z.ZodOptional<z.ZodString>;
186
+ }, z.core.$strict>]>>;
187
+ zone: z.ZodOptional<z.ZodString>;
188
+ }, z.core.$strict>]>;
138
189
  export declare const statesManifestSchema: z.ZodObject<{
139
190
  field: z.ZodString;
140
191
  initial: z.ZodString;
@@ -212,6 +263,7 @@ export declare const statesManifestSchema: z.ZodObject<{
212
263
  }, z.core.$strict>>;
213
264
  staffOnly: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
214
265
  closed: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
266
+ requires: z.ZodOptional<z.ZodArray<z.ZodString>>;
215
267
  }, z.core.$strict>>;
216
268
  requests: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
217
269
  follows: z.ZodOptional<z.ZodObject<{
@@ -219,6 +271,14 @@ export declare const statesManifestSchema: z.ZodObject<{
219
271
  when: z.ZodRecord<z.ZodString, z.ZodString>;
220
272
  from: z.ZodArray<z.ZodString>;
221
273
  }, z.core.$strict>>;
274
+ after: z.ZodOptional<z.ZodArray<z.ZodObject<{
275
+ from: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
276
+ to: z.ZodString;
277
+ at: z.ZodString;
278
+ minutesAfter: z.ZodOptional<z.ZodNumber>;
279
+ ifAnyIn: z.ZodOptional<z.ZodArray<z.ZodString>>;
280
+ ifSet: z.ZodOptional<z.ZodArray<z.ZodString>>;
281
+ }, z.core.$strict>>>;
222
282
  }, z.core.$strip>;
223
283
  export type StatesManifest = z.infer<typeof statesManifestSchema>;
224
284
  /** A staff-only rule's paths, as a list (ADR 0505). */
@@ -229,6 +289,16 @@ export declare function moveOrigins(move: {
229
289
  }): readonly string[];
230
290
  /** Reports problems with `objects.<name>.states` through `contract`. */
231
291
  export declare function checkObjectStates(m: ExtensionManifest, name: string, object: ObjectManifest, contract: (path: string, message: string) => void): void;
292
+ /**
293
+ * The checks of window paths and numbers (ADRs 0503 and 0505): for a `states` declaration, and
294
+ * for any other declaration that names a moment the same way (a waitlist's cut-off, ADR 0520).
295
+ */
296
+ export declare function windowChecks(m: ExtensionManifest, object: ObjectManifest, name: string, contract: (path: string, message: string) => void): {
297
+ checkPath: (at: string, path: string, type: string) => void;
298
+ checkNumber: (value: WindowNumber | undefined, path: string) => void;
299
+ checkBound: (bound: string | WindowBound, path: string) => void;
300
+ checkWindow: (window: MoveWindow | undefined, path: string) => void;
301
+ };
232
302
  /**
233
303
  * The field a path names (ADR 0503; two relations from ADR 0505): `field` on the object, or
234
304
  * `relation.field` / `relation.relation.field` through relations of one record. Every field on