@quad-education/sdk 0.0.0-stage → 0.1.2
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.md +15 -0
- package/README.md +105 -2
- package/dist/contract-tests/apps.d.ts +332 -0
- package/dist/contract-tests/apps.js +261 -0
- package/dist/contract-tests/index.d.ts +3 -0
- package/dist/contract-tests/index.js +2 -0
- package/dist/contract-tests/suite.d.ts +57 -0
- package/dist/contract-tests/suite.js +1286 -0
- package/dist/src/client/connect.d.ts +10 -0
- package/dist/src/client/connect.js +12 -0
- package/dist/src/client/create-client.d.ts +14 -0
- package/dist/src/client/create-client.js +76 -0
- package/dist/src/client/handshake-client.d.ts +16 -0
- package/dist/src/client/handshake-client.js +37 -0
- package/dist/src/contract/errors.d.ts +8 -0
- package/dist/src/contract/errors.js +13 -0
- package/dist/src/contract/recipients.d.ts +28 -0
- package/dist/src/contract/recipients.js +12 -0
- package/dist/src/contract/types.d.ts +421 -0
- package/dist/src/contract/types.js +1 -0
- package/dist/src/engine/audit.d.ts +27 -0
- package/dist/src/engine/audit.js +105 -0
- package/dist/src/engine/cron.d.ts +17 -0
- package/dist/src/engine/cron.js +143 -0
- package/dist/src/engine/db-indexes.d.ts +11 -0
- package/dist/src/engine/db-indexes.js +82 -0
- package/dist/src/engine/engine.d.ts +153 -0
- package/dist/src/engine/engine.js +922 -0
- package/dist/src/engine/host.d.ts +39 -0
- package/dist/src/engine/host.js +70 -0
- package/dist/src/engine/in-process.d.ts +5 -0
- package/dist/src/engine/in-process.js +18 -0
- package/dist/src/engine/index.d.ts +10 -0
- package/dist/src/engine/index.js +8 -0
- package/dist/src/engine/query.d.ts +16 -0
- package/dist/src/engine/query.js +106 -0
- package/dist/src/engine/runner.d.ts +26 -0
- package/dist/src/engine/runner.js +260 -0
- package/dist/src/engine/state.d.ts +107 -0
- package/dist/src/engine/state.js +16 -0
- package/dist/src/engine/storage.d.ts +46 -0
- package/dist/src/engine/storage.js +86 -0
- package/dist/src/engine/tasks.d.ts +17 -0
- package/dist/src/engine/tasks.js +245 -0
- package/dist/src/engine/validate-input.d.ts +9 -0
- package/dist/src/engine/validate-input.js +76 -0
- package/dist/src/engine/values.d.ts +10 -0
- package/dist/src/engine/values.js +58 -0
- package/dist/src/handshake.d.ts +16 -0
- package/dist/src/handshake.js +9 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.js +4 -0
- package/dist/src/jobs/define.d.ts +41 -0
- package/dist/src/jobs/define.js +28 -0
- package/dist/src/jobs/host.d.ts +13 -0
- package/dist/src/jobs/host.js +22 -0
- package/dist/src/jobs/index.d.ts +1 -0
- package/dist/src/jobs/index.js +2 -0
- package/dist/src/jobs/worker.d.ts +17 -0
- package/dist/src/jobs/worker.js +25 -0
- package/dist/src/platform-types.d.ts +19 -0
- package/dist/src/platform-types.js +1 -0
- package/dist/src/port-rpc.d.ts +42 -0
- package/dist/src/port-rpc.js +85 -0
- package/dist/src/protocol.d.ts +41 -0
- package/dist/src/protocol.js +45 -0
- package/dist/src/testing/index.d.ts +78 -0
- package/dist/src/testing/index.js +118 -0
- package/package.json +71 -3
package/LICENSE.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Quad package licence
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Michael Vangelovski. All rights reserved.
|
|
4
|
+
|
|
5
|
+
This licence covers the `@quad-education/*` packages.
|
|
6
|
+
|
|
7
|
+
You may install and use these packages, unmodified, to build, test and run apps for the Quad platform, including running the demo shell locally.
|
|
8
|
+
|
|
9
|
+
You may not:
|
|
10
|
+
|
|
11
|
+
- modify, copy or redistribute the packages, except as dependencies of a Quad app;
|
|
12
|
+
- use them to build or operate a product or service other than a Quad app;
|
|
13
|
+
- remove this notice.
|
|
14
|
+
|
|
15
|
+
The packages are provided "as is", without warranty of any kind. In no event is the copyright holder liable for any claim, damages or other liability arising from their use.
|
package/README.md
CHANGED
|
@@ -1,3 +1,106 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @quad-education/sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The contract every Quad app is built against. It has no UI framework dependency (D24):
|
|
4
|
+
React helpers live in `@quad-education/sdk-react`. In V1 an in-browser engine implements it inside
|
|
5
|
+
the demo shell; the platform implements the same contract later, and both must pass the
|
|
6
|
+
contract suite in `contract-tests/`.
|
|
7
|
+
|
|
8
|
+
```ts
|
|
9
|
+
import { connect } from '@quad-education/sdk/client'
|
|
10
|
+
|
|
11
|
+
const sdk = await connect()
|
|
12
|
+
const { items } = await sdk.school.students.list({ where: { yearLevel: 'Y9' } })
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Modules: `auth`, `school` (canonical school data, filtered by your scopes and the user's
|
|
16
|
+
visibility), `db` (your app's own data), `notify`, `clock`. Slice B adds `tasks`,
|
|
17
|
+
`schedule`, `cron` and `audit`.
|
|
18
|
+
|
|
19
|
+
## Access control for app data (D25)
|
|
20
|
+
|
|
21
|
+
The engine enforces who can read and write each record. Declare it in the schema:
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
consent: entity({
|
|
25
|
+
fields: {
|
|
26
|
+
studentId: ref('school.students'),
|
|
27
|
+
status: enumOf(['pending', 'given', 'declined']),
|
|
28
|
+
staffNote: text({ optional: true, visibleTo: ['staff'] }),
|
|
29
|
+
},
|
|
30
|
+
subject: 'studentId',
|
|
31
|
+
access: {
|
|
32
|
+
staff: { read: 'all', create: 'all', update: 'all', delete: 'all' },
|
|
33
|
+
parent: { read: 'subject', update: 'subject' },
|
|
34
|
+
student: { read: 'subject' },
|
|
35
|
+
},
|
|
36
|
+
})
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
- `subject` names one `ref('school.students')` field: the student the record is about.
|
|
40
|
+
- Rules, per role and operation (`read`, `create`, `update`, `delete`):
|
|
41
|
+
- `subject`: the user can see the record's student (staff: everyone; parents: their own
|
|
42
|
+
children, never through a restricted link; students: themselves).
|
|
43
|
+
- `own`: the user created the record.
|
|
44
|
+
- `all`: every record. Staff only.
|
|
45
|
+
- An array means any of them. Anything not listed is denied, and an entity with no
|
|
46
|
+
`access` block is staff-only.
|
|
47
|
+
- `visibleTo` on a field: other roles never receive it, can't filter on it and can't
|
|
48
|
+
write it. Its type is optional unless every role your app serves may see it.
|
|
49
|
+
- What you get back:
|
|
50
|
+
- `get` on a record you can't read: `NOT_FOUND`, the same as a missing record.
|
|
51
|
+
- `list`, filters, pages and `include` only ever cover records you can read.
|
|
52
|
+
- A denied operation or write: `NOT_PERMITTED`. So is setting `subject` to a student
|
|
53
|
+
you can't see.
|
|
54
|
+
- Scheduled and cron jobs run as the app (system principal) with full access to its data.
|
|
55
|
+
|
|
56
|
+
### Pattern: shared record staff-only, per-student rows for parents
|
|
57
|
+
|
|
58
|
+
`subject` is a single student in v0. When something concerns many students (an excursion,
|
|
59
|
+
a class event), don't give the shared record a subject or parent access. Keep it
|
|
60
|
+
staff-only, and create one row per student for anything parents see or do:
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
excursion: entity({ fields: { title: text(), date: date() } }), // staff-only
|
|
64
|
+
attendee: entity({
|
|
65
|
+
fields: { excursionId: ref('excursion'), studentId: ref('school.students'), consent: enumOf([...]) },
|
|
66
|
+
subject: 'studentId',
|
|
67
|
+
access: { staff: { read: 'all', create: 'all', update: 'all', delete: 'all' },
|
|
68
|
+
parent: { read: 'subject', update: 'subject' } },
|
|
69
|
+
})
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Parents see and answer only their own child's rows. Copy the few excursion details they
|
|
73
|
+
need (title, date) onto the row, or show them from the notification or task that sends
|
|
74
|
+
them there. An `include` of the staff-only excursion returns `null` for parents.
|
|
75
|
+
|
|
76
|
+
## Querying app data: sorts and ranges need an index (D37)
|
|
77
|
+
|
|
78
|
+
On the platform, app data lives in DynamoDB, so `sdk.db` lists follow the same rule everywhere, including the in-browser engine:
|
|
79
|
+
|
|
80
|
+
- **Equality, `in` and `ne` filters** work on any field you can see. They only ever scan your app's own data.
|
|
81
|
+
- **`orderBy` and range filters** (`gt`, `gte`, `lt`, `lte`) need an index. Declare one in the schema with `indexes: [['status', 'dueDate']]`. Every entity is also indexed on `id` and `createdAt`.
|
|
82
|
+
- **An index covers a query** when:
|
|
83
|
+
- its leading fields have plain equality filters;
|
|
84
|
+
- the range filter is on the next field;
|
|
85
|
+
- the `orderBy` fields follow the index in order, all in one direction.
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
// indexes: [['status', 'dueDate']]
|
|
89
|
+
tasks.list({ where: { status: 'open' }, orderBy: { field: 'dueDate' } }) // covered
|
|
90
|
+
tasks.list({ where: { status: 'open', dueDate: { lt: today } } }) // covered
|
|
91
|
+
tasks.list({ orderBy: { field: 'dueDate' } }) // VALIDATION: needs an equality on status first
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The types allow `orderBy` and ranges only on indexed fields, so most mistakes are compile errors. The engine checks the rest at runtime and returns `VALIDATION` with the index to add. `sdk.school`, `tasks.list` and `audit.list` aren't affected.
|
|
95
|
+
|
|
96
|
+
## Versions
|
|
97
|
+
|
|
98
|
+
- **0.1.2** (9 Oct 2026). The same contract as 0.1.1, and the first version to stay on npm. All the `@quad-education/*` packages were published on 9 Oct 2026 (0.1.0, and 0.1.1 for this one), then unpublished the same day to move the npm org to a new owner, and npm never allows an unpublished version again; every package is now 0.1.2. `SDK_VERSION` (`sdk.version`) now matches the package version; it had stayed at 0.1.0 through 0.1.1.
|
|
99
|
+
- **0.1.1** (8 Oct 2026). Contract change: `sdk.db` list `orderBy` and range filters need a declared index (or `id`/`createdAt`), and both the types and the engine enforce it (D37). The schema DSL keeps `indexes` as literal types, and `DbListOptions` gains `DbWhere`, `DbOrderBy` and `IndexedField`. The packages also moved from `@quad/*` to `@quad-education/*`, because the `@quad` npm scope belongs to someone else (D41); only the import paths change, and the version stays 0.1.1 because nothing was published under the old name. Before the first publish, the engine also stopped treating names inherited from `Object.prototype` (`constructor`, `toString`) as entities or fields; they now fail with `VALIDATION`, as any unknown name does.
|
|
100
|
+
- **0.1.0** (renamed 7 Oct 2026). This was `@orca/sdk` 0.1.0, with the same contract and behaviour, renamed for Quad:
|
|
101
|
+
- the `@orca/*` packages became `@quad/*`;
|
|
102
|
+
- the `Orca*` exports became `Quad*` (`QuadError`, `QuadSdk`, `QuadApp` and the rest);
|
|
103
|
+
- `orca gen` and `orca-env.d.ts` became `quad gen` and `quad-env.d.ts`;
|
|
104
|
+
- the handshake and jobs messages became `quad:*`.
|
|
105
|
+
|
|
106
|
+
The version stays 0.1.0 because nothing was published under the old name. Version 0.2 is planned for V2c (see `docs/build-plan.md`).
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
import { type Manifest } from '@quad-education/schema';
|
|
2
|
+
import { type Job } from '../src/jobs/index.ts';
|
|
3
|
+
/** The schema the contract suite's test apps use. */
|
|
4
|
+
export declare const TEST_SCHEMA: {
|
|
5
|
+
readonly greeting: {
|
|
6
|
+
readonly fields: {
|
|
7
|
+
readonly message: {
|
|
8
|
+
readonly kind: "text";
|
|
9
|
+
readonly tier: import("@quad-education/canonical").Tier;
|
|
10
|
+
};
|
|
11
|
+
readonly studentId: {
|
|
12
|
+
readonly kind: "ref";
|
|
13
|
+
readonly tier: import("@quad-education/canonical").Tier;
|
|
14
|
+
} & {
|
|
15
|
+
to: "school.students";
|
|
16
|
+
};
|
|
17
|
+
readonly tone: {
|
|
18
|
+
readonly kind: "enum";
|
|
19
|
+
readonly tier: import("@quad-education/canonical").Tier;
|
|
20
|
+
} & {
|
|
21
|
+
values: readonly ["warm", "formal"];
|
|
22
|
+
};
|
|
23
|
+
readonly note: {
|
|
24
|
+
readonly kind: "text";
|
|
25
|
+
readonly tier: import("@quad-education/canonical").Tier;
|
|
26
|
+
} & {
|
|
27
|
+
readonly optional: true;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
readonly indexes: readonly [readonly ["studentId"], readonly ["message"], readonly ["tone", "message"]];
|
|
31
|
+
readonly subject?: "studentId";
|
|
32
|
+
readonly access?: {
|
|
33
|
+
readonly staff: {
|
|
34
|
+
readonly read: "all";
|
|
35
|
+
readonly create: "all";
|
|
36
|
+
readonly update: "all";
|
|
37
|
+
readonly delete: "all";
|
|
38
|
+
};
|
|
39
|
+
readonly parent: {
|
|
40
|
+
readonly read: "subject";
|
|
41
|
+
};
|
|
42
|
+
readonly student: {
|
|
43
|
+
readonly read: "subject";
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
readonly reply: {
|
|
48
|
+
readonly fields: {
|
|
49
|
+
readonly greetingId: {
|
|
50
|
+
readonly kind: "ref";
|
|
51
|
+
readonly tier: import("@quad-education/canonical").Tier;
|
|
52
|
+
} & {
|
|
53
|
+
to: "greeting";
|
|
54
|
+
};
|
|
55
|
+
readonly message: {
|
|
56
|
+
readonly kind: "text";
|
|
57
|
+
readonly tier: import("@quad-education/canonical").Tier;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
readonly indexes: readonly [];
|
|
61
|
+
readonly subject?: "message" | "greetingId";
|
|
62
|
+
readonly access?: import("@quad-education/schema").AccessPolicy;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
/** A test app with a broad set of scopes. */
|
|
66
|
+
export declare const TEST_APP: {
|
|
67
|
+
manifest: Manifest;
|
|
68
|
+
schema: typeof TEST_SCHEMA;
|
|
69
|
+
};
|
|
70
|
+
/** A test app with only `students.basic:read`. */
|
|
71
|
+
export declare const BASIC_APP: {
|
|
72
|
+
manifest: Manifest;
|
|
73
|
+
schema: typeof TEST_SCHEMA;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* D25 access control. The documented pattern: a shared record (`excursion`) is staff-only,
|
|
77
|
+
* and parents work with per-student rows (`consent`) whose subject is their child.
|
|
78
|
+
*/
|
|
79
|
+
export declare const ACCESS_SCHEMA: {
|
|
80
|
+
readonly excursion: {
|
|
81
|
+
readonly fields: {
|
|
82
|
+
readonly title: {
|
|
83
|
+
readonly kind: "text";
|
|
84
|
+
readonly tier: import("@quad-education/canonical").Tier;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
readonly indexes: readonly [];
|
|
88
|
+
readonly subject?: "title";
|
|
89
|
+
readonly access?: import("@quad-education/schema").AccessPolicy;
|
|
90
|
+
};
|
|
91
|
+
readonly consent: {
|
|
92
|
+
readonly fields: {
|
|
93
|
+
readonly studentId: {
|
|
94
|
+
readonly kind: "ref";
|
|
95
|
+
readonly tier: import("@quad-education/canonical").Tier;
|
|
96
|
+
} & {
|
|
97
|
+
to: "school.students";
|
|
98
|
+
};
|
|
99
|
+
readonly excursionId: {
|
|
100
|
+
readonly kind: "ref";
|
|
101
|
+
readonly tier: import("@quad-education/canonical").Tier;
|
|
102
|
+
} & {
|
|
103
|
+
to: "excursion";
|
|
104
|
+
};
|
|
105
|
+
readonly status: {
|
|
106
|
+
readonly kind: "enum";
|
|
107
|
+
readonly tier: import("@quad-education/canonical").Tier;
|
|
108
|
+
} & {
|
|
109
|
+
values: readonly ["pending", "given", "declined"];
|
|
110
|
+
};
|
|
111
|
+
readonly staffNote: {
|
|
112
|
+
readonly kind: "text";
|
|
113
|
+
readonly tier: import("@quad-education/canonical").Tier;
|
|
114
|
+
} & {
|
|
115
|
+
readonly optional: true;
|
|
116
|
+
} & {
|
|
117
|
+
readonly visibleTo: readonly ["staff"];
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
readonly indexes: readonly [];
|
|
121
|
+
readonly subject?: "studentId";
|
|
122
|
+
readonly access?: {
|
|
123
|
+
readonly staff: {
|
|
124
|
+
readonly read: "all";
|
|
125
|
+
readonly create: "all";
|
|
126
|
+
readonly update: "all";
|
|
127
|
+
readonly delete: "all";
|
|
128
|
+
};
|
|
129
|
+
readonly parent: {
|
|
130
|
+
readonly read: "subject";
|
|
131
|
+
readonly update: "subject";
|
|
132
|
+
};
|
|
133
|
+
readonly student: {
|
|
134
|
+
readonly read: "subject";
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
readonly message: {
|
|
139
|
+
readonly fields: {
|
|
140
|
+
readonly studentId: {
|
|
141
|
+
readonly kind: "ref";
|
|
142
|
+
readonly tier: import("@quad-education/canonical").Tier;
|
|
143
|
+
} & {
|
|
144
|
+
to: "school.students";
|
|
145
|
+
};
|
|
146
|
+
readonly consentId: {
|
|
147
|
+
readonly kind: "ref";
|
|
148
|
+
readonly tier: import("@quad-education/canonical").Tier;
|
|
149
|
+
} & {
|
|
150
|
+
to: "consent";
|
|
151
|
+
} & {
|
|
152
|
+
readonly optional: true;
|
|
153
|
+
};
|
|
154
|
+
readonly body: {
|
|
155
|
+
readonly kind: "text";
|
|
156
|
+
readonly tier: import("@quad-education/canonical").Tier;
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
readonly indexes: readonly [readonly ["body"]];
|
|
160
|
+
readonly subject?: "studentId";
|
|
161
|
+
readonly access?: {
|
|
162
|
+
readonly staff: {
|
|
163
|
+
readonly read: "all";
|
|
164
|
+
readonly create: "all";
|
|
165
|
+
readonly delete: "all";
|
|
166
|
+
};
|
|
167
|
+
readonly parent: {
|
|
168
|
+
readonly read: "subject";
|
|
169
|
+
readonly create: "subject";
|
|
170
|
+
readonly update: "own";
|
|
171
|
+
readonly delete: "own";
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
export declare const ACCESS_APP: {
|
|
177
|
+
manifest: Manifest;
|
|
178
|
+
schema: typeof ACCESS_SCHEMA;
|
|
179
|
+
};
|
|
180
|
+
/** A staff-only log that test jobs write to, so tests can see what ran and as whom. */
|
|
181
|
+
export declare const JOBS_SCHEMA: {
|
|
182
|
+
/** What a job could see and do, recorded by the job itself (D7 run-as tests). */
|
|
183
|
+
readonly probe: {
|
|
184
|
+
readonly fields: {
|
|
185
|
+
readonly runId: {
|
|
186
|
+
readonly kind: "text";
|
|
187
|
+
readonly tier: import("@quad-education/canonical").Tier;
|
|
188
|
+
};
|
|
189
|
+
readonly principal: {
|
|
190
|
+
readonly kind: "text";
|
|
191
|
+
readonly tier: import("@quad-education/canonical").Tier;
|
|
192
|
+
};
|
|
193
|
+
readonly studentsSeen: {
|
|
194
|
+
readonly kind: "number";
|
|
195
|
+
readonly tier: import("@quad-education/canonical").Tier;
|
|
196
|
+
};
|
|
197
|
+
readonly otherFamilyVisible: {
|
|
198
|
+
readonly kind: "boolean";
|
|
199
|
+
readonly tier: import("@quad-education/canonical").Tier;
|
|
200
|
+
};
|
|
201
|
+
readonly staffOnlyWriteAllowed: {
|
|
202
|
+
readonly kind: "boolean";
|
|
203
|
+
readonly tier: import("@quad-education/canonical").Tier;
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
readonly indexes: readonly [];
|
|
207
|
+
readonly subject?: "runId" | "principal" | "studentsSeen" | "otherFamilyVisible" | "staffOnlyWriteAllowed";
|
|
208
|
+
readonly access?: {
|
|
209
|
+
readonly staff: {
|
|
210
|
+
readonly read: "all";
|
|
211
|
+
readonly create: "all";
|
|
212
|
+
};
|
|
213
|
+
readonly parent: {
|
|
214
|
+
readonly read: "own";
|
|
215
|
+
readonly create: "own";
|
|
216
|
+
};
|
|
217
|
+
readonly student: {
|
|
218
|
+
readonly read: "own";
|
|
219
|
+
readonly create: "own";
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
readonly jobLog: {
|
|
224
|
+
readonly fields: {
|
|
225
|
+
readonly jobName: {
|
|
226
|
+
readonly kind: "text";
|
|
227
|
+
readonly tier: import("@quad-education/canonical").Tier;
|
|
228
|
+
};
|
|
229
|
+
readonly runId: {
|
|
230
|
+
readonly kind: "text";
|
|
231
|
+
readonly tier: import("@quad-education/canonical").Tier;
|
|
232
|
+
};
|
|
233
|
+
readonly scheduledFor: {
|
|
234
|
+
readonly kind: "text";
|
|
235
|
+
readonly tier: import("@quad-education/canonical").Tier;
|
|
236
|
+
};
|
|
237
|
+
readonly principal: {
|
|
238
|
+
readonly kind: "text";
|
|
239
|
+
readonly tier: import("@quad-education/canonical").Tier;
|
|
240
|
+
};
|
|
241
|
+
readonly note: {
|
|
242
|
+
readonly kind: "text";
|
|
243
|
+
readonly tier: import("@quad-education/canonical").Tier;
|
|
244
|
+
} & {
|
|
245
|
+
readonly optional: true;
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
readonly indexes: readonly [];
|
|
249
|
+
readonly subject?: "note" | "runId" | "jobName" | "scheduledFor" | "principal";
|
|
250
|
+
readonly access?: import("@quad-education/schema").AccessPolicy;
|
|
251
|
+
};
|
|
252
|
+
readonly greeting: {
|
|
253
|
+
readonly fields: {
|
|
254
|
+
readonly message: {
|
|
255
|
+
readonly kind: "text";
|
|
256
|
+
readonly tier: import("@quad-education/canonical").Tier;
|
|
257
|
+
};
|
|
258
|
+
readonly studentId: {
|
|
259
|
+
readonly kind: "ref";
|
|
260
|
+
readonly tier: import("@quad-education/canonical").Tier;
|
|
261
|
+
} & {
|
|
262
|
+
to: "school.students";
|
|
263
|
+
};
|
|
264
|
+
readonly tone: {
|
|
265
|
+
readonly kind: "enum";
|
|
266
|
+
readonly tier: import("@quad-education/canonical").Tier;
|
|
267
|
+
} & {
|
|
268
|
+
values: readonly ["warm", "formal"];
|
|
269
|
+
};
|
|
270
|
+
readonly note: {
|
|
271
|
+
readonly kind: "text";
|
|
272
|
+
readonly tier: import("@quad-education/canonical").Tier;
|
|
273
|
+
} & {
|
|
274
|
+
readonly optional: true;
|
|
275
|
+
};
|
|
276
|
+
};
|
|
277
|
+
readonly indexes: readonly [readonly ["studentId"], readonly ["message"], readonly ["tone", "message"]];
|
|
278
|
+
readonly subject?: "studentId";
|
|
279
|
+
readonly access?: {
|
|
280
|
+
readonly staff: {
|
|
281
|
+
readonly read: "all";
|
|
282
|
+
readonly create: "all";
|
|
283
|
+
readonly update: "all";
|
|
284
|
+
readonly delete: "all";
|
|
285
|
+
};
|
|
286
|
+
readonly parent: {
|
|
287
|
+
readonly read: "subject";
|
|
288
|
+
};
|
|
289
|
+
readonly student: {
|
|
290
|
+
readonly read: "subject";
|
|
291
|
+
};
|
|
292
|
+
};
|
|
293
|
+
};
|
|
294
|
+
readonly reply: {
|
|
295
|
+
readonly fields: {
|
|
296
|
+
readonly greetingId: {
|
|
297
|
+
readonly kind: "ref";
|
|
298
|
+
readonly tier: import("@quad-education/canonical").Tier;
|
|
299
|
+
} & {
|
|
300
|
+
to: "greeting";
|
|
301
|
+
};
|
|
302
|
+
readonly message: {
|
|
303
|
+
readonly kind: "text";
|
|
304
|
+
readonly tier: import("@quad-education/canonical").Tier;
|
|
305
|
+
};
|
|
306
|
+
};
|
|
307
|
+
readonly indexes: readonly [];
|
|
308
|
+
readonly subject?: "message" | "greetingId";
|
|
309
|
+
readonly access?: import("@quad-education/schema").AccessPolicy;
|
|
310
|
+
};
|
|
311
|
+
};
|
|
312
|
+
type JobsApp = {
|
|
313
|
+
roles: 'staff' | 'parent' | 'student';
|
|
314
|
+
scopes: 'students.basic:read' | 'cohorts.basic:read' | 'cohortMemberships.basic:read';
|
|
315
|
+
notifications: 'test.message';
|
|
316
|
+
tasks: 'test.approval' | 'test.consent';
|
|
317
|
+
scheduled: 'follow-up' | 'slow' | 'flaky' | 'probe' | 'chain';
|
|
318
|
+
schema: typeof JOBS_SCHEMA;
|
|
319
|
+
};
|
|
320
|
+
/** Lets a test hold the `slow` job mid-run, to prove runs of one job never overlap. */
|
|
321
|
+
export declare const slowGate: {
|
|
322
|
+
release: () => void;
|
|
323
|
+
wait: Promise<void>;
|
|
324
|
+
reset(): void;
|
|
325
|
+
};
|
|
326
|
+
export declare const TEST_JOBS: readonly Job<JobsApp>[];
|
|
327
|
+
export declare const JOBS_APP: {
|
|
328
|
+
manifest: Manifest;
|
|
329
|
+
schema: typeof JOBS_SCHEMA;
|
|
330
|
+
jobs: typeof TEST_JOBS;
|
|
331
|
+
};
|
|
332
|
+
export {};
|