@composable-os/sdk 0.0.0-stage → 0.1.0-beta.11
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/LICENSE +109 -0
- package/dist/allowance.d.ts +198 -0
- package/dist/allowance.js +374 -0
- package/dist/automation-check.d.ts +38 -0
- package/dist/automation-check.js +454 -0
- package/dist/automation.d.ts +767 -0
- package/dist/automation.js +303 -0
- package/dist/behaviour.d.ts +3 -0
- package/dist/behaviour.js +153 -0
- package/dist/capacity.d.ts +146 -0
- package/dist/capacity.js +189 -0
- package/dist/contract.d.ts +851 -0
- package/dist/contract.js +42 -0
- package/dist/document.d.ts +211 -0
- package/dist/document.js +726 -0
- package/dist/field-types.d.ts +11 -0
- package/dist/field-types.js +98 -0
- package/dist/formula/ast.d.ts +67 -0
- package/dist/formula/ast.js +22 -0
- package/dist/formula/compile.d.ts +37 -0
- package/dist/formula/compile.js +379 -0
- package/dist/formula/index.d.ts +3 -0
- package/dist/formula/index.js +4 -0
- package/dist/formula/parser.d.ts +13 -0
- package/dist/formula/parser.js +365 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +24 -0
- package/dist/manifest.d.ts +1708 -0
- package/dist/manifest.js +1494 -0
- package/dist/media.d.ts +41 -0
- package/dist/media.js +90 -0
- package/dist/permissions.d.ts +17 -0
- package/dist/permissions.js +44 -0
- package/dist/recurring.d.ts +114 -0
- package/dist/recurring.js +173 -0
- package/dist/renamed.d.ts +16 -0
- package/dist/renamed.js +59 -0
- package/dist/rich-text-fixture.d.ts +121 -0
- package/dist/rich-text-fixture.js +67 -0
- package/dist/rich-text.d.ts +48 -0
- package/dist/rich-text.js +184 -0
- package/dist/runtime.d.ts +95 -0
- package/dist/runtime.js +312 -0
- package/dist/sellable.d.ts +331 -0
- package/dist/sellable.js +746 -0
- package/dist/slug.d.ts +11 -0
- package/dist/slug.js +23 -0
- package/dist/states.d.ts +292 -0
- package/dist/states.js +383 -0
- package/dist/testing.d.ts +151 -0
- package/dist/testing.js +679 -0
- package/dist/unique.d.ts +20 -0
- package/dist/unique.js +58 -0
- package/package.json +34 -4
- package/src/allowance.ts +522 -0
- package/src/automation-check.ts +534 -0
- package/src/automation.ts +743 -0
- package/src/behaviour.ts +215 -0
- package/src/capacity.ts +303 -0
- package/src/contract.ts +909 -0
- package/src/document.ts +935 -0
- package/src/field-types.ts +111 -0
- package/src/formula/ast.ts +72 -0
- package/src/formula/compile.ts +454 -0
- package/src/formula/index.ts +4 -0
- package/src/formula/parser.ts +417 -0
- package/src/index.ts +36 -0
- package/src/manifest.ts +1785 -0
- package/src/media.ts +108 -0
- package/src/permissions.ts +60 -0
- package/src/recurring.ts +321 -0
- package/src/renamed.ts +63 -0
- package/src/rich-text-fixture.ts +68 -0
- package/src/rich-text.ts +221 -0
- package/src/runtime.ts +410 -0
- package/src/sellable.ts +1138 -0
- package/src/slug.ts +25 -0
- package/src/states.ts +598 -0
- package/src/testing.ts +847 -0
- package/src/unique.ts +81 -0
- package/README.md +0 -3
package/dist/slug.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** What a slug may be. */
|
|
2
|
+
export declare const SLUG_RE: RegExp;
|
|
3
|
+
/** The longest a slug may be. */
|
|
4
|
+
export declare const SLUG_MAX = 120;
|
|
5
|
+
/** The longest slug made from a title, leaving room for a `-<n>` that tells two apart. */
|
|
6
|
+
export declare const SLUG_FROM_TITLE_MAX = 80;
|
|
7
|
+
/**
|
|
8
|
+
* A slug made from a title: accents dropped, every run of anything that is not a letter or digit
|
|
9
|
+
* a hyphen, at most SLUG_FROM_TITLE_MAX characters. Empty when nothing is left.
|
|
10
|
+
*/
|
|
11
|
+
export declare function slugify(title: string): string;
|
package/dist/slug.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// The `slug` field type (stage 28, ADR 0442): a record's address in its object, such as
|
|
2
|
+
// `summer-launch` in `/blog/summer-launch`. Lowercase letters and digits in words joined by single
|
|
3
|
+
// hyphens. The host keeps it unique among the object's live records and makes one from the title
|
|
4
|
+
// when a record is created without one.
|
|
5
|
+
/** What a slug may be. */
|
|
6
|
+
export const SLUG_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
7
|
+
/** The longest a slug may be. */
|
|
8
|
+
export const SLUG_MAX = 120;
|
|
9
|
+
/** The longest slug made from a title, leaving room for a `-<n>` that tells two apart. */
|
|
10
|
+
export const SLUG_FROM_TITLE_MAX = 80;
|
|
11
|
+
/**
|
|
12
|
+
* A slug made from a title: accents dropped, every run of anything that is not a letter or digit
|
|
13
|
+
* a hyphen, at most SLUG_FROM_TITLE_MAX characters. Empty when nothing is left.
|
|
14
|
+
*/
|
|
15
|
+
export function slugify(title) {
|
|
16
|
+
const plain = title
|
|
17
|
+
.normalize("NFKD")
|
|
18
|
+
.replace(/[̀-ͯ]/g, "")
|
|
19
|
+
.toLowerCase()
|
|
20
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
21
|
+
.replace(/^-+|-+$/g, "");
|
|
22
|
+
return plain.slice(0, SLUG_FROM_TITLE_MAX).replace(/-+$/g, "");
|
|
23
|
+
}
|
package/dist/states.d.ts
ADDED
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { ExtensionManifest, FieldManifest, ObjectManifest } from "./manifest.ts";
|
|
3
|
+
/**
|
|
4
|
+
* Who may make a move. `staff`: anyone working for the organisation (people, their assistants,
|
|
5
|
+
* MCP clients, automations and extensions acting for them). `customer`: a signed-in customer, on
|
|
6
|
+
* their own record. `host`: platform code only (a payment confirmation, an expiry); no caller of
|
|
7
|
+
* an operation can make it.
|
|
8
|
+
*/
|
|
9
|
+
export declare const MOVERS: readonly ["staff", "customer", "host"];
|
|
10
|
+
export type Mover = (typeof MOVERS)[number];
|
|
11
|
+
/** One allowed move of a state machine. */
|
|
12
|
+
export interface StateMove {
|
|
13
|
+
/** The state, or states, the record moves from. */
|
|
14
|
+
from: string | readonly string[];
|
|
15
|
+
/** The state it moves to. */
|
|
16
|
+
to: string;
|
|
17
|
+
/** Who may make it. */
|
|
18
|
+
by: readonly Mover[];
|
|
19
|
+
/** Fields that must have a value to make the move, and cannot be emptied while in `to`. */
|
|
20
|
+
requires?: readonly string[];
|
|
21
|
+
/** The move ends the lifecycle: nothing moves out of `to`. */
|
|
22
|
+
final?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* When a customer may make it (stage 31, ADR 0503): from `from` (inclusive) until `until`
|
|
25
|
+
* (exclusive), by the host's clock in the write. Staff and the host are not bound.
|
|
26
|
+
*/
|
|
27
|
+
window?: MoveWindow;
|
|
28
|
+
/**
|
|
29
|
+
* A boolean field (named as a window's `at` is), or several: while any is true, only staff and
|
|
30
|
+
* the host may make the move ("this class type is booked by the gym"). A boolean formula counts
|
|
31
|
+
* too (a class that is not scheduled).
|
|
32
|
+
*/
|
|
33
|
+
staffOnly?: string | readonly string[];
|
|
34
|
+
/**
|
|
35
|
+
* Tools of this extension that may also make the move for whoever called them (stage 32b,
|
|
36
|
+
* ADR 0513): a move by `["host"]` with `tools: ["voidPass"]` is made by the host and by that
|
|
37
|
+
* tool, and by no other staff write (not `record.update`, not the assistant, not an automation).
|
|
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.
|
|
41
|
+
*/
|
|
42
|
+
tools?: readonly string[];
|
|
43
|
+
/**
|
|
44
|
+
* Its window binds staff too (ADR 0507), every staff caller, a person included: a cancel that
|
|
45
|
+
* gives a use back is in time for everyone. The host is not bound. A person who must make the
|
|
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.
|
|
49
|
+
*/
|
|
50
|
+
bindsStaff?: boolean;
|
|
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
|
+
/**
|
|
73
|
+
* A number a window is worked out from (ADR 0505): a number; a number field named as a window's
|
|
74
|
+
* `at` is; or `{ field?, setting? }`, the field's value and, when it is empty, this extension's
|
|
75
|
+
* setting of that name (its value, or the setting's default). "A class type's own late-cancel
|
|
76
|
+
* time, else the organisation's": `{ field: "class.classType.lateMinutes", setting:
|
|
77
|
+
* "lateMinutes" }`.
|
|
78
|
+
*/
|
|
79
|
+
export type WindowNumber = number | string | {
|
|
80
|
+
field?: string;
|
|
81
|
+
setting?: string;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* One end of a window (ADR 0503): the moment in the datetime field `at` (a field of the record,
|
|
85
|
+
* or `<relation>.<field>` on the record a relation of one record points to, or two relations
|
|
86
|
+
* away, `<relation>.<relation>.<field>`: ADR 0505), less `daysBefore` whole days at the same
|
|
87
|
+
* local time in `zone` (a timezone field named the same way; the organisation's zone when left
|
|
88
|
+
* out) and then `minutesBefore` minutes. Each of the two is a `WindowNumber`. A string is short
|
|
89
|
+
* for `{ at }`. When any of them has no value the window cannot be worked out, and a customer's
|
|
90
|
+
* move is refused. Every field a path passes through is this extension's own: a field of its
|
|
91
|
+
* objects, or one it adds to another extension's object (`fields: { "programs.classtype": … }`).
|
|
92
|
+
*/
|
|
93
|
+
export interface WindowBound {
|
|
94
|
+
at: string;
|
|
95
|
+
daysBefore?: WindowNumber;
|
|
96
|
+
minutesBefore?: WindowNumber;
|
|
97
|
+
zone?: string;
|
|
98
|
+
}
|
|
99
|
+
/** A window on a move or a create (ADR 0503). */
|
|
100
|
+
export interface MoveWindow {
|
|
101
|
+
from?: string | WindowBound;
|
|
102
|
+
until?: string | WindowBound;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* A state machine (ADR 0425). The host enforces it in the record operations and the record CSV
|
|
106
|
+
* import, for every actor, and in the approval queue's dry run:
|
|
107
|
+
*
|
|
108
|
+
* - A record is created in `initial`. Creating it in another state is judged as the move from
|
|
109
|
+
* `initial` to that state.
|
|
110
|
+
* - A move that is not declared is refused, with details naming the rule, the state and the
|
|
111
|
+
* field to fix. So is a declared move made by someone its `by` does not list, and a move while
|
|
112
|
+
* one of its `requires` fields is empty.
|
|
113
|
+
* - Every move is recorded in state history (entered and left times, who) in the same batch as
|
|
114
|
+
* the write and, when the state field is tracked, posted on the timeline as "Moved to <state>".
|
|
115
|
+
*/
|
|
116
|
+
export interface StatesSpec {
|
|
117
|
+
/** This object's select field holding the state. Its options are the states. */
|
|
118
|
+
field: string;
|
|
119
|
+
/** The state a new record starts in. */
|
|
120
|
+
initial: string;
|
|
121
|
+
moves: readonly StateMove[];
|
|
122
|
+
/**
|
|
123
|
+
* Rules on every create, whatever state the record is created in (ADR 0503): `in`, the states
|
|
124
|
+
* a record may be created in besides `initial`, each with who may create it there (it is then
|
|
125
|
+
* not judged as a move from `initial`: a booking is created booked or waiting by a customer,
|
|
126
|
+
* pending only by the host); the `window` in which a customer
|
|
127
|
+
* may create one; and `staffOnly`, a boolean field while true only staff and the host create.
|
|
128
|
+
* Named as a move's are.
|
|
129
|
+
*/
|
|
130
|
+
create?: {
|
|
131
|
+
in?: Readonly<Record<string, readonly Mover[]>>;
|
|
132
|
+
window?: MoveWindow;
|
|
133
|
+
staffOnly?: string | readonly string[];
|
|
134
|
+
/**
|
|
135
|
+
* Booleans named as `staffOnly` is (ADR 0507): while any is true, nobody but the host creates
|
|
136
|
+
* one, staff included (no booking into a class that was cancelled or is over).
|
|
137
|
+
*/
|
|
138
|
+
closed?: string | readonly string[];
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Moves a caller asks for by name, resolved by the host (ADR 0503): writing the name (`cancel`)
|
|
142
|
+
* into the state field moves the record to the first of the listed states whose move from where
|
|
143
|
+
* it is the caller may make now, windows included (`["cancelled", "late_cancelled"]`). A name
|
|
144
|
+
* is not a state. A person on the staff is not bound; every other caller (a customer, the
|
|
145
|
+
* assistant, an MCP client, an automation, extension code) is resolved by the clock (ADR 0507).
|
|
146
|
+
*/
|
|
147
|
+
requests?: Readonly<Record<string, readonly string[]>>;
|
|
148
|
+
/**
|
|
149
|
+
* A cascade from the record a relation points to (ADR 0507): when that record moves into a
|
|
150
|
+
* state named in `when`, the host moves every live record of this object pointing at it, and in
|
|
151
|
+
* one of `from`, to the state `when` gives, in the same batch, as the host (a class cancelled
|
|
152
|
+
* moves its bookings to `cancelled_by_us`: their places released, their uses given back). Each
|
|
153
|
+
* target needs a `host` move from each of `from`.
|
|
154
|
+
*/
|
|
155
|
+
follows?: {
|
|
156
|
+
relation: string;
|
|
157
|
+
when: Readonly<Record<string, string>>;
|
|
158
|
+
from: readonly string[];
|
|
159
|
+
};
|
|
160
|
+
/** Moves the host makes once a moment has passed (ADR 0550), at most four. */
|
|
161
|
+
after?: readonly TimedMove[];
|
|
162
|
+
}
|
|
163
|
+
export declare const windowBoundSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
164
|
+
at: z.ZodString;
|
|
165
|
+
daysBefore: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodObject<{
|
|
166
|
+
field: z.ZodOptional<z.ZodString>;
|
|
167
|
+
setting: z.ZodOptional<z.ZodString>;
|
|
168
|
+
}, z.core.$strict>]>>;
|
|
169
|
+
minutesBefore: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodObject<{
|
|
170
|
+
field: z.ZodOptional<z.ZodString>;
|
|
171
|
+
setting: z.ZodOptional<z.ZodString>;
|
|
172
|
+
}, z.core.$strict>]>>;
|
|
173
|
+
zone: z.ZodOptional<z.ZodString>;
|
|
174
|
+
}, z.core.$strict>]>;
|
|
175
|
+
export declare const statesManifestSchema: z.ZodObject<{
|
|
176
|
+
field: z.ZodString;
|
|
177
|
+
initial: z.ZodString;
|
|
178
|
+
moves: z.ZodArray<z.ZodObject<{
|
|
179
|
+
from: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
180
|
+
to: z.ZodString;
|
|
181
|
+
by: z.ZodArray<z.ZodEnum<{
|
|
182
|
+
staff: "staff";
|
|
183
|
+
customer: "customer";
|
|
184
|
+
host: "host";
|
|
185
|
+
}>>;
|
|
186
|
+
requires: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
187
|
+
final: z.ZodOptional<z.ZodBoolean>;
|
|
188
|
+
window: z.ZodOptional<z.ZodObject<{
|
|
189
|
+
from: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
190
|
+
at: z.ZodString;
|
|
191
|
+
daysBefore: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodObject<{
|
|
192
|
+
field: z.ZodOptional<z.ZodString>;
|
|
193
|
+
setting: z.ZodOptional<z.ZodString>;
|
|
194
|
+
}, z.core.$strict>]>>;
|
|
195
|
+
minutesBefore: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodObject<{
|
|
196
|
+
field: z.ZodOptional<z.ZodString>;
|
|
197
|
+
setting: z.ZodOptional<z.ZodString>;
|
|
198
|
+
}, z.core.$strict>]>>;
|
|
199
|
+
zone: z.ZodOptional<z.ZodString>;
|
|
200
|
+
}, z.core.$strict>]>>;
|
|
201
|
+
until: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
202
|
+
at: z.ZodString;
|
|
203
|
+
daysBefore: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodObject<{
|
|
204
|
+
field: z.ZodOptional<z.ZodString>;
|
|
205
|
+
setting: z.ZodOptional<z.ZodString>;
|
|
206
|
+
}, z.core.$strict>]>>;
|
|
207
|
+
minutesBefore: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodObject<{
|
|
208
|
+
field: z.ZodOptional<z.ZodString>;
|
|
209
|
+
setting: z.ZodOptional<z.ZodString>;
|
|
210
|
+
}, z.core.$strict>]>>;
|
|
211
|
+
zone: z.ZodOptional<z.ZodString>;
|
|
212
|
+
}, z.core.$strict>]>>;
|
|
213
|
+
}, z.core.$strict>>;
|
|
214
|
+
staffOnly: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
215
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
216
|
+
bindsStaff: z.ZodOptional<z.ZodBoolean>;
|
|
217
|
+
}, z.core.$strip>>;
|
|
218
|
+
create: z.ZodOptional<z.ZodObject<{
|
|
219
|
+
in: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodEnum<{
|
|
220
|
+
staff: "staff";
|
|
221
|
+
customer: "customer";
|
|
222
|
+
host: "host";
|
|
223
|
+
}>>>>;
|
|
224
|
+
window: z.ZodOptional<z.ZodObject<{
|
|
225
|
+
from: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
226
|
+
at: z.ZodString;
|
|
227
|
+
daysBefore: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodObject<{
|
|
228
|
+
field: z.ZodOptional<z.ZodString>;
|
|
229
|
+
setting: z.ZodOptional<z.ZodString>;
|
|
230
|
+
}, z.core.$strict>]>>;
|
|
231
|
+
minutesBefore: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodObject<{
|
|
232
|
+
field: z.ZodOptional<z.ZodString>;
|
|
233
|
+
setting: z.ZodOptional<z.ZodString>;
|
|
234
|
+
}, z.core.$strict>]>>;
|
|
235
|
+
zone: z.ZodOptional<z.ZodString>;
|
|
236
|
+
}, z.core.$strict>]>>;
|
|
237
|
+
until: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
238
|
+
at: z.ZodString;
|
|
239
|
+
daysBefore: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodObject<{
|
|
240
|
+
field: z.ZodOptional<z.ZodString>;
|
|
241
|
+
setting: z.ZodOptional<z.ZodString>;
|
|
242
|
+
}, z.core.$strict>]>>;
|
|
243
|
+
minutesBefore: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodObject<{
|
|
244
|
+
field: z.ZodOptional<z.ZodString>;
|
|
245
|
+
setting: z.ZodOptional<z.ZodString>;
|
|
246
|
+
}, z.core.$strict>]>>;
|
|
247
|
+
zone: z.ZodOptional<z.ZodString>;
|
|
248
|
+
}, z.core.$strict>]>>;
|
|
249
|
+
}, z.core.$strict>>;
|
|
250
|
+
staffOnly: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
251
|
+
closed: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
252
|
+
}, z.core.$strict>>;
|
|
253
|
+
requests: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
254
|
+
follows: z.ZodOptional<z.ZodObject<{
|
|
255
|
+
relation: z.ZodString;
|
|
256
|
+
when: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
257
|
+
from: z.ZodArray<z.ZodString>;
|
|
258
|
+
}, z.core.$strict>>;
|
|
259
|
+
after: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
260
|
+
from: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
261
|
+
to: z.ZodString;
|
|
262
|
+
at: z.ZodString;
|
|
263
|
+
minutesAfter: z.ZodOptional<z.ZodNumber>;
|
|
264
|
+
ifAnyIn: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
265
|
+
}, z.core.$strict>>>;
|
|
266
|
+
}, z.core.$strip>;
|
|
267
|
+
export type StatesManifest = z.infer<typeof statesManifestSchema>;
|
|
268
|
+
/** A staff-only rule's paths, as a list (ADR 0505). */
|
|
269
|
+
export declare function staffOnlyPathsOf(value: string | readonly string[] | undefined): readonly string[];
|
|
270
|
+
/** The states a move leaves, as a list. */
|
|
271
|
+
export declare function moveOrigins(move: {
|
|
272
|
+
from: string | readonly string[];
|
|
273
|
+
}): readonly string[];
|
|
274
|
+
/** Reports problems with `objects.<name>.states` through `contract`. */
|
|
275
|
+
export declare function checkObjectStates(m: ExtensionManifest, name: string, object: ObjectManifest, contract: (path: string, message: string) => void): void;
|
|
276
|
+
/**
|
|
277
|
+
* The checks of window paths and numbers (ADRs 0503 and 0505): for a `states` declaration, and
|
|
278
|
+
* for any other declaration that names a moment the same way (a waitlist's cut-off, ADR 0520).
|
|
279
|
+
*/
|
|
280
|
+
export declare function windowChecks(m: ExtensionManifest, object: ObjectManifest, name: string, contract: (path: string, message: string) => void): {
|
|
281
|
+
checkPath: (at: string, path: string, type: string) => void;
|
|
282
|
+
checkNumber: (value: WindowNumber | undefined, path: string) => void;
|
|
283
|
+
checkBound: (bound: string | WindowBound, path: string) => void;
|
|
284
|
+
checkWindow: (window: MoveWindow | undefined, path: string) => void;
|
|
285
|
+
};
|
|
286
|
+
/**
|
|
287
|
+
* The field a path names (ADR 0503; two relations from ADR 0505): `field` on the object, or
|
|
288
|
+
* `relation.field` / `relation.relation.field` through relations of one record. Every field on
|
|
289
|
+
* the way is this extension's: a field of one of its objects, or one it adds to another object
|
|
290
|
+
* (`fields: { "programs.classtype": { … } }`). Undefined when the path names no such field.
|
|
291
|
+
*/
|
|
292
|
+
export declare function resolveFieldPath(m: ExtensionManifest, object: ObjectManifest, path: string): FieldManifest | undefined;
|