@quad-education/sdk 0.1.3 → 0.1.4
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/README.md +1 -0
- package/dist/contract-tests/apps.d.ts +26 -0
- package/dist/contract-tests/apps.js +111 -0
- package/dist/contract-tests/index.d.ts +1 -1
- package/dist/contract-tests/index.js +1 -1
- package/dist/contract-tests/suite.js +331 -4
- package/dist/src/contract/types.d.ts +1 -1
- package/dist/src/contract/types.js +1 -1
- package/dist/src/engine/engine.d.ts +8 -6
- package/dist/src/engine/engine.js +23 -8
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -95,6 +95,7 @@ The types allow `orderBy` and ranges only on indexed fields, so most mistakes ar
|
|
|
95
95
|
|
|
96
96
|
## Versions
|
|
97
97
|
|
|
98
|
+
- **0.1.4** (19 Oct 2026). The same SDK calls. The canonical model grows to what V2s S4 builds, which is what an app's `sdk.school.<entity>` and its types come from, so **0.1.3 cannot use any of it**: the attendance register (`sessionAttendance`, which must be filtered by student or date; `studentAbsences`, `attendanceSummaries`), behaviour and achievements, learning support, medical events and notes, staff absences and admissions applicants, and the demographic fields on `students`. It also adds two sensitivity tiers, `sensitive` and `hr`, which are staff-only (a student or parent never receives them), audited, and need manifest version 1 and a reason. A version 1 manifest still needs 0.1.3 or newer.
|
|
98
99
|
- **0.1.3** (18 Oct 2026). The same SDK calls, plus what V2s needs to run: manifest version 1 (`data`, `reasons`, `roles` and `schoolRoles`), declared-field types and stripping for school data, the new school entities (`periods`, `rooms`, `subjects`, `lessons`, with `lessons` generated on demand) and the test toolkit that understands all of it. **A version 1 manifest needs 0.1.3 or newer**: the test toolkit in 0.1.2 only reads version 0 manifests and fails every test with `invalid manifest: manifestVersion: expected 0`. The starter templates ask for `^0.1.3`.
|
|
99
100
|
- **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.
|
|
100
101
|
- **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.
|
|
@@ -67,6 +67,32 @@ export declare const TEST_APP: {
|
|
|
67
67
|
manifest: Manifest;
|
|
68
68
|
schema: typeof TEST_SCHEMA;
|
|
69
69
|
};
|
|
70
|
+
/**
|
|
71
|
+
* A demographics app (S4.5): version 1, because a staff-only tier needs a reason. It asks for the seven sensitive
|
|
72
|
+
* fields of a student and nothing else that varies.
|
|
73
|
+
*/
|
|
74
|
+
export declare const DEMOGRAPHICS_APP: {
|
|
75
|
+
manifest: Manifest;
|
|
76
|
+
schema: typeof TEST_SCHEMA;
|
|
77
|
+
};
|
|
78
|
+
/** An awards app: achievements are academic, so it needs no pastoral scope and is not in the pastoral audit (S4.3). */
|
|
79
|
+
export declare const AWARDS_APP: {
|
|
80
|
+
manifest: Manifest;
|
|
81
|
+
schema: typeof TEST_SCHEMA;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* A staff leave app (S4.6): version 1, because a staff-only tier needs a reason. It asks for the staff reference and the
|
|
85
|
+
* `hr` fields of an absence.
|
|
86
|
+
*/
|
|
87
|
+
export declare const HR_APP: {
|
|
88
|
+
manifest: Manifest;
|
|
89
|
+
schema: typeof TEST_SCHEMA;
|
|
90
|
+
};
|
|
91
|
+
/** A first-aid and learning support app: it holds the medical tier too, so it receives diagnoses (S4.4). */
|
|
92
|
+
export declare const WELLBEING_APP: {
|
|
93
|
+
manifest: Manifest;
|
|
94
|
+
schema: typeof TEST_SCHEMA;
|
|
95
|
+
};
|
|
70
96
|
/** A test app with only `students.basic:read`. */
|
|
71
97
|
export declare const BASIC_APP: {
|
|
72
98
|
manifest: Manifest;
|
|
@@ -61,11 +61,122 @@ export const TEST_APP = {
|
|
|
61
61
|
'periods.basic:read',
|
|
62
62
|
'rooms.basic:read',
|
|
63
63
|
'subjects.basic:read',
|
|
64
|
+
'sessionAttendance.basic:read',
|
|
65
|
+
'sessionAttendance.academic:read',
|
|
66
|
+
'sessionAttendance.pastoral:read',
|
|
67
|
+
'studentAbsences.basic:read',
|
|
68
|
+
'studentAbsences.academic:read',
|
|
69
|
+
'attendanceSummaries.basic:read',
|
|
70
|
+
'attendanceSummaries.academic:read',
|
|
71
|
+
'behaviours.basic:read',
|
|
72
|
+
'behaviours.pastoral:read',
|
|
73
|
+
'achievements.basic:read',
|
|
74
|
+
'achievements.academic:read',
|
|
75
|
+
'learningSupportNeeds.basic:read',
|
|
76
|
+
'learningSupportNeeds.pastoral:read',
|
|
77
|
+
'applicants.basic:read',
|
|
78
|
+
'applicants.contact:read',
|
|
64
79
|
],
|
|
65
80
|
notifications: ['test.message', 'test.reminder'],
|
|
66
81
|
},
|
|
67
82
|
schema: TEST_SCHEMA,
|
|
68
83
|
};
|
|
84
|
+
/**
|
|
85
|
+
* A demographics app (S4.5): version 1, because a staff-only tier needs a reason. It asks for the seven sensitive
|
|
86
|
+
* fields of a student and nothing else that varies.
|
|
87
|
+
*/
|
|
88
|
+
export const DEMOGRAPHICS_APP = {
|
|
89
|
+
manifest: {
|
|
90
|
+
...TEST_APP.manifest,
|
|
91
|
+
manifestVersion: 1,
|
|
92
|
+
id: 'contract-demographics',
|
|
93
|
+
name: 'Demographics app',
|
|
94
|
+
scopes: ['parents.basic:read', 'students.basic:read', 'students.sensitive:read'],
|
|
95
|
+
data: {
|
|
96
|
+
parents: { required: [], optional: ['title'] },
|
|
97
|
+
students: {
|
|
98
|
+
required: [],
|
|
99
|
+
optional: [
|
|
100
|
+
'firstLanguage',
|
|
101
|
+
'englishAsAdditionalLanguage',
|
|
102
|
+
'ethnicity',
|
|
103
|
+
'nationality',
|
|
104
|
+
'religion',
|
|
105
|
+
'birthPlace',
|
|
106
|
+
'freeSchoolMeals',
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
reasons: {
|
|
111
|
+
'students.sensitive:read': 'To plan language support and cultural events with families’ agreement.',
|
|
112
|
+
},
|
|
113
|
+
notifications: ['test.message'],
|
|
114
|
+
},
|
|
115
|
+
schema: TEST_SCHEMA,
|
|
116
|
+
};
|
|
117
|
+
/** An awards app: achievements are academic, so it needs no pastoral scope and is not in the pastoral audit (S4.3). */
|
|
118
|
+
export const AWARDS_APP = {
|
|
119
|
+
manifest: {
|
|
120
|
+
...TEST_APP.manifest,
|
|
121
|
+
id: 'contract-awards',
|
|
122
|
+
name: 'Awards app',
|
|
123
|
+
scopes: ['achievements.basic:read', 'achievements.academic:read'],
|
|
124
|
+
notifications: ['test.message'],
|
|
125
|
+
},
|
|
126
|
+
schema: TEST_SCHEMA,
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* A staff leave app (S4.6): version 1, because a staff-only tier needs a reason. It asks for the staff reference and the
|
|
130
|
+
* `hr` fields of an absence.
|
|
131
|
+
*/
|
|
132
|
+
export const HR_APP = {
|
|
133
|
+
manifest: {
|
|
134
|
+
...TEST_APP.manifest,
|
|
135
|
+
manifestVersion: 1,
|
|
136
|
+
id: 'contract-hr',
|
|
137
|
+
name: 'Staff leave app',
|
|
138
|
+
scopes: ['employeeAbsences.basic:read', 'employeeAbsences.hr:read'],
|
|
139
|
+
data: {
|
|
140
|
+
employeeAbsences: {
|
|
141
|
+
required: [],
|
|
142
|
+
optional: [
|
|
143
|
+
'staffId',
|
|
144
|
+
'startAt',
|
|
145
|
+
'endAt',
|
|
146
|
+
'absenceType',
|
|
147
|
+
'illnessCategory',
|
|
148
|
+
'workingDays',
|
|
149
|
+
'hours',
|
|
150
|
+
'note',
|
|
151
|
+
],
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
reasons: {
|
|
155
|
+
'employeeAbsences.hr:read': 'To roster relief staff and report on leave taken across the year.',
|
|
156
|
+
},
|
|
157
|
+
notifications: ['test.message'],
|
|
158
|
+
},
|
|
159
|
+
schema: TEST_SCHEMA,
|
|
160
|
+
};
|
|
161
|
+
/** A first-aid and learning support app: it holds the medical tier too, so it receives diagnoses (S4.4). */
|
|
162
|
+
export const WELLBEING_APP = {
|
|
163
|
+
manifest: {
|
|
164
|
+
...TEST_APP.manifest,
|
|
165
|
+
id: 'contract-wellbeing',
|
|
166
|
+
name: 'Wellbeing app',
|
|
167
|
+
scopes: [
|
|
168
|
+
'learningSupportNeeds.basic:read',
|
|
169
|
+
'learningSupportNeeds.pastoral:read',
|
|
170
|
+
'learningSupportNeeds.medical:read',
|
|
171
|
+
'medicalEvents.basic:read',
|
|
172
|
+
'medicalEvents.medical:read',
|
|
173
|
+
'medicalNotes.basic:read',
|
|
174
|
+
'medicalNotes.medical:read',
|
|
175
|
+
],
|
|
176
|
+
notifications: ['test.message'],
|
|
177
|
+
},
|
|
178
|
+
schema: TEST_SCHEMA,
|
|
179
|
+
};
|
|
69
180
|
/** A test app with only `students.basic:read`. */
|
|
70
181
|
export const BASIC_APP = {
|
|
71
182
|
manifest: {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { defineContractSuite } from './suite.ts';
|
|
2
2
|
export type { ContractEnv, ContractFactory, TestApp } from './suite.ts';
|
|
3
|
-
export { ACCESS_APP, BASIC_APP, JOBS_APP, TEST_APP, slowGate } from './apps.ts';
|
|
3
|
+
export { ACCESS_APP, AWARDS_APP, BASIC_APP, DEMOGRAPHICS_APP, HR_APP, JOBS_APP, TEST_APP, WELLBEING_APP, slowGate, } from './apps.ts';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { defineContractSuite } from "./suite.js";
|
|
2
|
-
export { ACCESS_APP, BASIC_APP, JOBS_APP, TEST_APP, slowGate } from "./apps.js";
|
|
2
|
+
export { ACCESS_APP, AWARDS_APP, BASIC_APP, DEMOGRAPHICS_APP, HR_APP, JOBS_APP, TEST_APP, WELLBEING_APP, slowGate, } from "./apps.js";
|
|
@@ -4,7 +4,7 @@ import { eligibleParents } from '@quad-education/canonical';
|
|
|
4
4
|
import { personasFor, withDerived } from '@quad-education/fictional-school';
|
|
5
5
|
import stored from '@quad-education/fictional-school/dataset' with { type: 'json' };
|
|
6
6
|
import { isQuadError, parentsOf, staffOf, studentsOf } from "../src/index.js";
|
|
7
|
-
import { ACCESS_APP, BASIC_APP, DATA_APP, JOBS_APP, ROLES_APP, TEST_APP, slowGate } from "./apps.js";
|
|
7
|
+
import { ACCESS_APP, AWARDS_APP, BASIC_APP, DATA_APP, DEMOGRAPHICS_APP, HR_APP, JOBS_APP, ROLES_APP, TEST_APP, WELLBEING_APP, slowGate, } from "./apps.js";
|
|
8
8
|
// The fictional school is the oracle: tests compare what the SDK returns with what the
|
|
9
9
|
// dataset says should be visible. They never read an implementation's storage.
|
|
10
10
|
const ds = withDerived(stored);
|
|
@@ -73,7 +73,7 @@ export function defineContractSuite(name, factory) {
|
|
|
73
73
|
},
|
|
74
74
|
});
|
|
75
75
|
expect(sdk.appId).toBe(TEST_APP.manifest.id);
|
|
76
|
-
expect(sdk.version).toBe('0.1.
|
|
76
|
+
expect(sdk.version).toBe('0.1.4');
|
|
77
77
|
});
|
|
78
78
|
it('knows parents and students', async () => {
|
|
79
79
|
expect((await (await env.connect(STUDENT)).auth.me()).role).toBe('student');
|
|
@@ -149,6 +149,7 @@ export function defineContractSuite(name, factory) {
|
|
|
149
149
|
await expectError(sdk.school.parents.list(), 'SCOPE_NOT_GRANTED');
|
|
150
150
|
await expectError(sdk.school.medicalAlerts.get(ds.medicalAlerts[0].id), 'SCOPE_NOT_GRANTED');
|
|
151
151
|
await expectError(sdk.school.calendar.list({ from: '2026-01-01', to: '2027-01-01' }), 'SCOPE_NOT_GRANTED');
|
|
152
|
+
await expectError(sdk.school.sessionAttendance.list({ where: { date: '2026-03-03' } }), 'SCOPE_NOT_GRANTED');
|
|
152
153
|
});
|
|
153
154
|
it('still answers school.info', async () => {
|
|
154
155
|
const info = await (await env.connect(STUDENT)).school.info();
|
|
@@ -331,7 +332,7 @@ export function defineContractSuite(name, factory) {
|
|
|
331
332
|
expect(page.items.map((l) => l.id)).toEqual(expected);
|
|
332
333
|
expect(page.items[0]).toMatchObject({ cohortId: english.id });
|
|
333
334
|
}
|
|
334
|
-
});
|
|
335
|
+
}, 30_000);
|
|
335
336
|
it('pages through a day of lessons without gaps or repeats, and finds one by id', async () => {
|
|
336
337
|
const sdk = await env.connect(STUDENT);
|
|
337
338
|
const day = '2026-03-03';
|
|
@@ -352,7 +353,7 @@ export function defineContractSuite(name, factory) {
|
|
|
352
353
|
const one = await sdk.school.lessons.get(expected[0]);
|
|
353
354
|
expect(one.id).toBe(expected[0]);
|
|
354
355
|
await expectError(sdk.school.lessons.get('les-20260303-nope-p1'), 'NOT_FOUND');
|
|
355
|
-
});
|
|
356
|
+
}, 30_000);
|
|
356
357
|
it('lists the school day’s periods and rooms', async () => {
|
|
357
358
|
const sdk = await env.connect(STUDENT);
|
|
358
359
|
const periods = await listAll(sdk.school.periods, {});
|
|
@@ -360,6 +361,332 @@ export function defineContractSuite(name, factory) {
|
|
|
360
361
|
const rooms = await listAll(sdk.school.rooms, {});
|
|
361
362
|
expect(ids(rooms)).toEqual(ids(ds.rooms));
|
|
362
363
|
});
|
|
364
|
+
it('serves the register for the slice asked for, and says what to add otherwise (S4.2)', async () => {
|
|
365
|
+
const staff = await env.connect(STAFF);
|
|
366
|
+
const student = ds.students[10];
|
|
367
|
+
const week = { gte: '2026-03-02', lte: '2026-03-06' };
|
|
368
|
+
const page = await staff.school.sessionAttendance.list({
|
|
369
|
+
where: { studentId: student.id, date: week },
|
|
370
|
+
orderBy: { field: 'date' },
|
|
371
|
+
limit: 50,
|
|
372
|
+
});
|
|
373
|
+
expect(page.items).toHaveLength(10);
|
|
374
|
+
expect(page.items.every((m) => m.studentId === student.id && m.date >= week.gte && m.date <= week.lte)).toBe(true);
|
|
375
|
+
expect(page.items.map((m) => m.date)).toEqual([...page.items.map((m) => m.date)].sort());
|
|
376
|
+
expect(page.items[0]).toMatchObject({
|
|
377
|
+
source: 'simulated',
|
|
378
|
+
session: expect.stringMatching(/^(am|pm)$/),
|
|
379
|
+
code: expect.any(String),
|
|
380
|
+
});
|
|
381
|
+
const noFilter = await expectError(staff.school.sessionAttendance.list({ where: { code: 'late' } }), 'VALIDATION');
|
|
382
|
+
expect(noFilter.message).toMatch(/studentId/);
|
|
383
|
+
await expectError(staff.school.sessionAttendance.list(), 'VALIDATION');
|
|
384
|
+
const wide = await expectError(staff.school.sessionAttendance.list({
|
|
385
|
+
where: { date: { gte: '2026-02-02', lte: '2026-06-30' } },
|
|
386
|
+
}), 'VALIDATION');
|
|
387
|
+
expect(wide.message).toMatch(/narrow by/);
|
|
388
|
+
// A school day is fine, and other filters narrow it further.
|
|
389
|
+
const day = await listAll(staff.school.sessionAttendance, { where: { date: '2026-03-03' } });
|
|
390
|
+
expect(day).toHaveLength(ds.students.length * 2);
|
|
391
|
+
const late = await listAll(staff.school.sessionAttendance, {
|
|
392
|
+
where: { date: '2026-03-03', code: 'late' },
|
|
393
|
+
});
|
|
394
|
+
expect(late.length).toBeGreaterThan(0);
|
|
395
|
+
expect(late.every((m) => m.code === 'late' && typeof m.minutesLate === 'number')).toBe(true);
|
|
396
|
+
}, 30_000);
|
|
397
|
+
it('pages through a register without gaps or repeats, and finds one mark by id', async () => {
|
|
398
|
+
const staff = await env.connect(STAFF);
|
|
399
|
+
const where = {
|
|
400
|
+
studentId: ds.students[20].id,
|
|
401
|
+
date: { gte: '2026-02-02', lte: '2026-04-02' },
|
|
402
|
+
};
|
|
403
|
+
const seen = [];
|
|
404
|
+
let page = await staff.school.sessionAttendance.list({ where, limit: 37 });
|
|
405
|
+
seen.push(...page.items);
|
|
406
|
+
while (page.nextCursor) {
|
|
407
|
+
page = await staff.school.sessionAttendance.list({
|
|
408
|
+
where,
|
|
409
|
+
limit: 37,
|
|
410
|
+
cursor: page.nextCursor,
|
|
411
|
+
});
|
|
412
|
+
seen.push(...page.items);
|
|
413
|
+
}
|
|
414
|
+
expect(new Set(seen.map((m) => m.id)).size).toBe(seen.length);
|
|
415
|
+
expect(seen.length).toBeGreaterThan(80);
|
|
416
|
+
const one = await staff.school.sessionAttendance.get(seen[5].id);
|
|
417
|
+
expect(one).toEqual(seen[5]);
|
|
418
|
+
await expectError(staff.school.sessionAttendance.get('att-stu-nope-20260302-am'), 'NOT_FOUND');
|
|
419
|
+
});
|
|
420
|
+
it('shows a student or parent only their own children, however they ask (D4, D17)', async () => {
|
|
421
|
+
const day = { where: { date: '2026-03-04' } };
|
|
422
|
+
const student = await listAll((await env.connect(STUDENT)).school.sessionAttendance, day);
|
|
423
|
+
expect(new Set(student.map((m) => m.studentId))).toEqual(new Set([STUDENT.personId]));
|
|
424
|
+
expect(student).toHaveLength(2);
|
|
425
|
+
const other = ds.students.find((s) => s.id !== STUDENT.personId);
|
|
426
|
+
const asked = await listAll((await env.connect(STUDENT)).school.sessionAttendance, {
|
|
427
|
+
where: { studentId: other.id, date: '2026-03-04' },
|
|
428
|
+
});
|
|
429
|
+
expect(asked).toEqual([]);
|
|
430
|
+
await expectError((await env.connect(STUDENT)).school.sessionAttendance.get(`att-${other.id}-20260304-am`), 'NOT_FOUND');
|
|
431
|
+
const kids = childrenOf(SIBLINGS_PARENT.personId);
|
|
432
|
+
const parent = await listAll((await env.connect(SIBLINGS_PARENT)).school.sessionAttendance, day);
|
|
433
|
+
expect(new Set(parent.map((m) => m.studentId))).toEqual(new Set(kids));
|
|
434
|
+
expect(await listAll((await env.connect(RESTRICTED_PARENT)).school.sessionAttendance, day)).toEqual([]);
|
|
435
|
+
});
|
|
436
|
+
it('needs the academic scope for marks and the pastoral scope for comments, which are audited', async () => {
|
|
437
|
+
const staff = await env.connect(STAFF);
|
|
438
|
+
const withComments = await listAll(staff.school.sessionAttendance, {
|
|
439
|
+
where: { studentId: ds.students[3].id },
|
|
440
|
+
});
|
|
441
|
+
expect(withComments.some((m) => typeof m.comment === 'string')).toBe(true);
|
|
442
|
+
const log = await env.control.auditLog();
|
|
443
|
+
const reads = log.filter((e) => e.action === 'school.sensitive-read' && e.entity === 'sessionAttendance');
|
|
444
|
+
expect(reads.length).toBeGreaterThan(0);
|
|
445
|
+
expect(reads[0].data.tiers).toEqual(['pastoral']);
|
|
446
|
+
});
|
|
447
|
+
it('serves absences and term summaries, each student’s own', async () => {
|
|
448
|
+
const staff = await env.connect(STAFF);
|
|
449
|
+
const mine = await listAll((await env.connect(STUDENT)).school.attendanceSummaries);
|
|
450
|
+
expect(mine).toHaveLength(4);
|
|
451
|
+
expect(mine.every((s) => s.studentId === STUDENT.personId)).toBe(true);
|
|
452
|
+
expect(mine[0]).toMatchObject({
|
|
453
|
+
possibleMarks: expect.any(Number),
|
|
454
|
+
presentMarks: expect.any(Number),
|
|
455
|
+
});
|
|
456
|
+
const all = await listAll(staff.school.attendanceSummaries, {
|
|
457
|
+
where: { termName: 'Term 1' },
|
|
458
|
+
});
|
|
459
|
+
expect(all).toHaveLength(ds.students.length);
|
|
460
|
+
const absences = await listAll(staff.school.studentAbsences, {
|
|
461
|
+
where: { studentId: ds.students[0].id },
|
|
462
|
+
});
|
|
463
|
+
expect(absences.length).toBeGreaterThan(0);
|
|
464
|
+
// The reason is pastoral, and this app was not granted that tier.
|
|
465
|
+
expect(absences.every((a) => a.endAt > a.startAt && !('reason' in a) && !('comment' in a))).toBe(true);
|
|
466
|
+
const own = await listAll((await env.connect(SIBLINGS_PARENT)).school.studentAbsences);
|
|
467
|
+
expect(new Set(own.map((a) => a.studentId))).toEqual(new Set(childrenOf(SIBLINGS_PARENT.personId)));
|
|
468
|
+
}, 30_000);
|
|
469
|
+
it('serves behaviour incidents and achievements, each student’s own (S4.3)', async () => {
|
|
470
|
+
const staff = await env.connect(STAFF);
|
|
471
|
+
const mine = ds.behaviours.find((b) => b.studentId !== STUDENT.personId);
|
|
472
|
+
const incidents = await listAll(staff.school.behaviours, {
|
|
473
|
+
where: { studentId: mine.studentId },
|
|
474
|
+
});
|
|
475
|
+
expect(incidents.length).toBeGreaterThan(0);
|
|
476
|
+
expect(incidents.every((b) => b.studentId === mine.studentId && b.points < 0)).toBe(true);
|
|
477
|
+
expect(incidents[0]).toMatchObject({
|
|
478
|
+
incident: expect.any(String),
|
|
479
|
+
date: expect.any(String),
|
|
480
|
+
});
|
|
481
|
+
const own = await listAll((await env.connect(STUDENT)).school.behaviours);
|
|
482
|
+
expect(own.every((b) => b.studentId === STUDENT.personId)).toBe(true);
|
|
483
|
+
expect(own).toHaveLength(ds.behaviours.filter((b) => b.studentId === STUDENT.personId).length);
|
|
484
|
+
const kids = new Set(childrenOf(SIBLINGS_PARENT.personId));
|
|
485
|
+
const family = await listAll((await env.connect(SIBLINGS_PARENT)).school.behaviours);
|
|
486
|
+
expect(family.every((b) => kids.has(b.studentId))).toBe(true);
|
|
487
|
+
expect(family).toHaveLength(ds.behaviours.filter((b) => kids.has(b.studentId)).length);
|
|
488
|
+
expect(await listAll((await env.connect(RESTRICTED_PARENT)).school.behaviours)).toEqual([]);
|
|
489
|
+
await expectError((await env.connect(STUDENT)).school.behaviours.get(mine.id), 'NOT_FOUND');
|
|
490
|
+
const awards = await listAll((await env.connect(STUDENT)).school.achievements);
|
|
491
|
+
expect(awards).toHaveLength(ds.achievements.filter((a) => a.studentId === STUDENT.personId).length);
|
|
492
|
+
expect(awards.every((a) => a.points > 0 && typeof a.type === 'string')).toBe(true);
|
|
493
|
+
const all = await listAll(staff.school.achievements, { where: { type: 'Sport' } });
|
|
494
|
+
expect(all).toHaveLength(ds.achievements.filter((a) => a.type === 'Sport').length);
|
|
495
|
+
}, 30_000);
|
|
496
|
+
it('audits behaviour reads, which are pastoral, but not achievements, which are academic (S4.3, D19)', async () => {
|
|
497
|
+
const staff = await env.connect(STAFF);
|
|
498
|
+
await staff.school.behaviours.list({ limit: 4 });
|
|
499
|
+
await staff.school.achievements.list({ limit: 4 });
|
|
500
|
+
const reads = (await env.control.auditLog()).filter((e) => e.action === 'school.sensitive-read' &&
|
|
501
|
+
['behaviours', 'achievements'].includes(String(e.entity)));
|
|
502
|
+
expect(reads.map((e) => [e.entity, e.data.tiers])).toEqual([['behaviours', ['pastoral']]]);
|
|
503
|
+
});
|
|
504
|
+
describe('an awards app with no pastoral scope', () => {
|
|
505
|
+
useApp(AWARDS_APP);
|
|
506
|
+
it('reads achievements but not behaviour, and leaves no pastoral audit entry', async () => {
|
|
507
|
+
const sdk = await env.connect(STAFF);
|
|
508
|
+
const { items } = await sdk.school.achievements.list({ limit: 5 });
|
|
509
|
+
expect(items).toHaveLength(5);
|
|
510
|
+
await expectError(sdk.school.behaviours.list(), 'SCOPE_NOT_GRANTED');
|
|
511
|
+
const reads = (await env.control.auditLog()).filter((e) => e.action === 'school.sensitive-read');
|
|
512
|
+
expect(reads).toEqual([]);
|
|
513
|
+
});
|
|
514
|
+
});
|
|
515
|
+
it('leaves the diagnosis out of learning support when only the pastoral tier is granted (S4.4)', async () => {
|
|
516
|
+
const staff = await env.connect(STAFF);
|
|
517
|
+
const withNeed = ds.learningSupportNeeds[0];
|
|
518
|
+
const items = await listAll(staff.school.learningSupportNeeds, {
|
|
519
|
+
where: { studentId: withNeed.studentId },
|
|
520
|
+
});
|
|
521
|
+
expect(items.length).toBeGreaterThan(0);
|
|
522
|
+
expect(items[0]).toMatchObject({ category: expect.any(String), level: expect.any(String) });
|
|
523
|
+
expect(items.every((n) => !('need' in n))).toBe(true);
|
|
524
|
+
const reads = (await env.control.auditLog()).filter((e) => e.action === 'school.sensitive-read' && e.entity === 'learningSupportNeeds');
|
|
525
|
+
expect(reads.map((e) => e.data.tiers)).toEqual([['pastoral']]);
|
|
526
|
+
await expectError(staff.school.medicalEvents.list(), 'SCOPE_NOT_GRANTED');
|
|
527
|
+
await expectError(staff.school.medicalNotes.list(), 'SCOPE_NOT_GRANTED');
|
|
528
|
+
});
|
|
529
|
+
describe('a wellbeing app with the medical tier', () => {
|
|
530
|
+
useApp(WELLBEING_APP);
|
|
531
|
+
it('receives the diagnosis, and the audit records both tiers (S4.4)', async () => {
|
|
532
|
+
const staff = await env.connect(STAFF);
|
|
533
|
+
const withNeed = ds.learningSupportNeeds[0];
|
|
534
|
+
const items = await listAll(staff.school.learningSupportNeeds, {
|
|
535
|
+
where: { studentId: withNeed.studentId },
|
|
536
|
+
});
|
|
537
|
+
expect(items.some((n) => n.need === withNeed.need && n.category === withNeed.category)).toBe(true);
|
|
538
|
+
const reads = (await env.control.auditLog()).filter((e) => e.action === 'school.sensitive-read' && e.entity === 'learningSupportNeeds');
|
|
539
|
+
expect([...reads[0].data.tiers].sort()).toEqual(['medical', 'pastoral']);
|
|
540
|
+
});
|
|
541
|
+
it('serves medical events and the notes that link to them, each student’s own', async () => {
|
|
542
|
+
const staff = await env.connect(STAFF);
|
|
543
|
+
const event = ds.medicalEvents.find((e) => e.followUpDate);
|
|
544
|
+
const events = await listAll(staff.school.medicalEvents, {
|
|
545
|
+
where: { studentId: event.studentId },
|
|
546
|
+
});
|
|
547
|
+
expect(events.find((e) => e.id === event.id)).toMatchObject({
|
|
548
|
+
type: event.type,
|
|
549
|
+
followUpDate: event.followUpDate,
|
|
550
|
+
});
|
|
551
|
+
const notes = await listAll(staff.school.medicalNotes, {
|
|
552
|
+
where: { studentId: event.studentId },
|
|
553
|
+
});
|
|
554
|
+
expect(notes.some((n) => n.eventId === event.id)).toBe(true);
|
|
555
|
+
expect(notes.every((n) => (n.conditionId === undefined) !== (n.eventId === undefined))).toBe(true);
|
|
556
|
+
const student = await env.connect(STUDENT);
|
|
557
|
+
for (const [entity, all] of [
|
|
558
|
+
['learningSupportNeeds', ds.learningSupportNeeds],
|
|
559
|
+
['medicalEvents', ds.medicalEvents],
|
|
560
|
+
['medicalNotes', ds.medicalNotes],
|
|
561
|
+
]) {
|
|
562
|
+
const own = await listAll(student.school[entity]);
|
|
563
|
+
expect(own, entity).toHaveLength(all.filter((r) => r.studentId === STUDENT.personId).length);
|
|
564
|
+
expect(own.every((r) => r.studentId === STUDENT.personId)).toBe(true);
|
|
565
|
+
const kids = new Set(childrenOf(SIBLINGS_PARENT.personId));
|
|
566
|
+
const family = await listAll((await env.connect(SIBLINGS_PARENT)).school[entity]);
|
|
567
|
+
expect(family, entity).toHaveLength(all.filter((r) => kids.has(r.studentId)).length);
|
|
568
|
+
expect(await listAll((await env.connect(RESTRICTED_PARENT)).school[entity])).toEqual([]);
|
|
569
|
+
}
|
|
570
|
+
await expectError(student.school.medicalEvents.get(ds.medicalEvents.find((e) => e.studentId !== STUDENT.personId).id), 'NOT_FOUND');
|
|
571
|
+
});
|
|
572
|
+
});
|
|
573
|
+
describe('demographics: the sensitive tier is staff-only (S4.5, D88)', () => {
|
|
574
|
+
useApp(DEMOGRAPHICS_APP);
|
|
575
|
+
const SENSITIVE = [
|
|
576
|
+
'firstLanguage',
|
|
577
|
+
'englishAsAdditionalLanguage',
|
|
578
|
+
'ethnicity',
|
|
579
|
+
'nationality',
|
|
580
|
+
'religion',
|
|
581
|
+
'birthPlace',
|
|
582
|
+
'freeSchoolMeals',
|
|
583
|
+
];
|
|
584
|
+
const leaks = (value) => JSON.stringify(value) !== undefined &&
|
|
585
|
+
SENSITIVE.filter((k) => JSON.stringify(value).includes(`"${k}"`));
|
|
586
|
+
it('gives staff the fields the app asked for, lets them filter on one, and audits the read', async () => {
|
|
587
|
+
const staff = await env.connect(STAFF);
|
|
588
|
+
const some = ds.students.find((s) => s.religion && s.firstLanguage);
|
|
589
|
+
const one = await staff.school.students.get(some.id);
|
|
590
|
+
expect(one).toMatchObject({ religion: some.religion, firstLanguage: some.firstLanguage });
|
|
591
|
+
const catholic = await listAll(staff.school.students, { where: { religion: 'Catholic' } });
|
|
592
|
+
expect(catholic).toHaveLength(ds.students.filter((s) => s.religion === 'Catholic').length);
|
|
593
|
+
expect(catholic.length).toBeGreaterThan(20);
|
|
594
|
+
const eal = await listAll(staff.school.students, {
|
|
595
|
+
where: { englishAsAdditionalLanguage: true },
|
|
596
|
+
});
|
|
597
|
+
expect(eal.every((s) => s.englishAsAdditionalLanguage === true)).toBe(true);
|
|
598
|
+
const reads = (await env.control.auditLog()).filter((e) => e.action === 'school.sensitive-read' && e.entity === 'students');
|
|
599
|
+
expect(reads.length).toBeGreaterThan(0);
|
|
600
|
+
expect(reads.every((e) => e.data.tiers.includes('sensitive'))).toBe(true);
|
|
601
|
+
});
|
|
602
|
+
it('never gives a student or a parent the fields, and refuses a filter that would probe them', async () => {
|
|
603
|
+
for (const who of [STUDENT, SIBLINGS_PARENT, SEPARATED_PARENT]) {
|
|
604
|
+
const sdk = await env.connect(who);
|
|
605
|
+
const mine = await listAll(sdk.school.students);
|
|
606
|
+
expect(mine.length).toBeGreaterThan(0);
|
|
607
|
+
expect(leaks(mine), who.personId).toEqual([]);
|
|
608
|
+
expect(leaks(await sdk.school.students.get(mine[0].id))).toEqual([]);
|
|
609
|
+
await expectError(sdk.school.students.list({ where: { religion: 'Catholic' } }), 'VALIDATION');
|
|
610
|
+
await expectError(sdk.school.students.list({ orderBy: { field: 'ethnicity' } }), 'VALIDATION');
|
|
611
|
+
}
|
|
612
|
+
});
|
|
613
|
+
it('does not leak them through the helpers that return students or parents', async () => {
|
|
614
|
+
const kids = childrenOf(SIBLINGS_PARENT.personId);
|
|
615
|
+
const parent = await env.connect(SIBLINGS_PARENT);
|
|
616
|
+
expect(leaks(await parent.school.parents.children(SIBLINGS_PARENT.personId))).toEqual([]);
|
|
617
|
+
expect(leaks(await parent.school.students.parents(kids[0]))).toEqual([]);
|
|
618
|
+
const student = await env.connect(STUDENT);
|
|
619
|
+
expect(leaks(await student.school.students.parents(STUDENT.personId))).toEqual([]);
|
|
620
|
+
expect(leaks(await student.auth.me())).toEqual([]);
|
|
621
|
+
const staff = await env.connect(STAFF);
|
|
622
|
+
// Staff with the scope get them for a parent's children too: the tier is for staff.
|
|
623
|
+
const children = await staff.school.parents.children(SIBLINGS_PARENT.personId);
|
|
624
|
+
expect(children.some((c) => SENSITIVE.some((k) => k in c))).toBe(true);
|
|
625
|
+
});
|
|
626
|
+
});
|
|
627
|
+
it('never gives the fields to an app that was not granted the tier', async () => {
|
|
628
|
+
const staff = await env.connect(STAFF);
|
|
629
|
+
const students = await listAll(staff.school.students, { where: { yearLevel: 'Y9' } });
|
|
630
|
+
expect(students.length).toBeGreaterThan(0);
|
|
631
|
+
expect(JSON.stringify(students)).not.toMatch(/"(religion|ethnicity|nationality|firstLanguage|birthPlace)"/);
|
|
632
|
+
await expectError(staff.school.students.list({ where: { religion: 'Catholic' } }), 'VALIDATION');
|
|
633
|
+
});
|
|
634
|
+
describe('staff absences are in the hr tier (S4.6)', () => {
|
|
635
|
+
useApp(HR_APP);
|
|
636
|
+
it('are read by any staff member whose app holds the tier, and audited as hr', async () => {
|
|
637
|
+
for (const who of [STAFF, DEPUTY]) {
|
|
638
|
+
const sdk = await env.connect(who);
|
|
639
|
+
const all = await listAll(sdk.school.employeeAbsences);
|
|
640
|
+
expect(all).toHaveLength(ds.employeeAbsences.length);
|
|
641
|
+
expect(all[0]).toMatchObject({
|
|
642
|
+
staffId: expect.any(String),
|
|
643
|
+
absenceType: expect.any(String),
|
|
644
|
+
workingDays: expect.any(Number),
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
const sdk = await env.connect(STAFF);
|
|
648
|
+
const sick = await listAll(sdk.school.employeeAbsences, {
|
|
649
|
+
where: { absenceType: 'Sick leave' },
|
|
650
|
+
});
|
|
651
|
+
expect(sick).toHaveLength(ds.employeeAbsences.filter((a) => a.absenceType === 'Sick leave').length);
|
|
652
|
+
expect(sick.every((a) => typeof a.illnessCategory === 'string')).toBe(true);
|
|
653
|
+
const reads = (await env.control.auditLog()).filter((e) => e.action === 'school.sensitive-read' && e.entity === 'employeeAbsences');
|
|
654
|
+
expect(reads.length).toBeGreaterThan(0);
|
|
655
|
+
expect(reads.every((e) => e.data.tiers.includes('hr'))).toBe(true);
|
|
656
|
+
});
|
|
657
|
+
it('are never given to a student or a parent, however they ask', async () => {
|
|
658
|
+
const one = ds.employeeAbsences[0];
|
|
659
|
+
for (const who of [STUDENT, SIBLINGS_PARENT, SEPARATED_PARENT, RESTRICTED_PARENT]) {
|
|
660
|
+
const sdk = await env.connect(who);
|
|
661
|
+
expect(await listAll(sdk.school.employeeAbsences)).toEqual([]);
|
|
662
|
+
await expectError(sdk.school.employeeAbsences.get(one.id), 'NOT_FOUND');
|
|
663
|
+
await expectError(sdk.school.employeeAbsences.list({ where: { absenceType: 'Sick leave' } }), 'VALIDATION');
|
|
664
|
+
}
|
|
665
|
+
});
|
|
666
|
+
});
|
|
667
|
+
it('refuses staff absences to an app that was not granted the tier', async () => {
|
|
668
|
+
const staff = await env.connect(STAFF);
|
|
669
|
+
await expectError(staff.school.employeeAbsences.list(), 'SCOPE_NOT_GRANTED');
|
|
670
|
+
});
|
|
671
|
+
it('serves admissions applicants to staff only, in the contact tier (S4.6)', async () => {
|
|
672
|
+
const staff = await env.connect(STAFF);
|
|
673
|
+
const all = await listAll(staff.school.applicants);
|
|
674
|
+
expect(all).toHaveLength(ds.applicants.length);
|
|
675
|
+
expect(all[0]).toMatchObject({
|
|
676
|
+
givenName: expect.any(String),
|
|
677
|
+
email: expect.any(String),
|
|
678
|
+
status: expect.any(String),
|
|
679
|
+
});
|
|
680
|
+
const offered = await listAll(staff.school.applicants, { where: { status: 'offered' } });
|
|
681
|
+
expect(offered).toHaveLength(ds.applicants.filter((a) => a.status === 'offered').length);
|
|
682
|
+
const sibling = ds.applicants.find((a) => a.siblingId);
|
|
683
|
+
expect((await staff.school.applicants.get(sibling.id)).siblingId).toBe(sibling.siblingId);
|
|
684
|
+
for (const who of [STUDENT, SIBLINGS_PARENT, RESTRICTED_PARENT]) {
|
|
685
|
+
const sdk = await env.connect(who);
|
|
686
|
+
expect(await listAll(sdk.school.applicants)).toEqual([]);
|
|
687
|
+
await expectError(sdk.school.applicants.get(sibling.id), 'NOT_FOUND');
|
|
688
|
+
}
|
|
689
|
+
});
|
|
363
690
|
it('lists calendar events in a date range', async () => {
|
|
364
691
|
const sdk = await env.connect(STAFF);
|
|
365
692
|
const from = '2026-03-01T00:00:00Z';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CanonicalRecord, ContactPurpose, Entities, EntityName, RecordWithFields, RecordWithTiers, Role, TiersFor } from '@quad-education/canonical';
|
|
2
2
|
import type { AppEntityDef, AppInput, AppSchema, FieldValue, SystemFields } from '@quad-education/schema';
|
|
3
3
|
import type { Recipient } from './recipients.ts';
|
|
4
|
-
export declare const SDK_VERSION = "0.1.
|
|
4
|
+
export declare const SDK_VERSION = "0.1.4";
|
|
5
5
|
/**
|
|
6
6
|
* Describes the current app to the type system. `quad gen` augments it from
|
|
7
7
|
* app.manifest.json and schema/ (D23); without that, nothing is readable.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = '0.1.
|
|
1
|
+
export const SDK_VERSION = '0.1.4';
|
|
@@ -11,11 +11,6 @@ export type EngineOptions = {
|
|
|
11
11
|
/** IndexedDB database name; defaults to `quad-engine`. */
|
|
12
12
|
dbName?: string;
|
|
13
13
|
};
|
|
14
|
-
/**
|
|
15
|
-
* The in-browser implementation of the @quad-education/sdk contract (D15). It runs in the demo
|
|
16
|
-
* shell's origin, holds the fictional school, and enforces visibility, scopes and D17 on
|
|
17
|
-
* every call. Apps reach it only through a transport.
|
|
18
|
-
*/
|
|
19
14
|
export declare class Engine implements Kernel {
|
|
20
15
|
private readonly apps;
|
|
21
16
|
private clock;
|
|
@@ -106,6 +101,13 @@ export declare class Engine implements Kernel {
|
|
|
106
101
|
private tiers;
|
|
107
102
|
private allowedFields;
|
|
108
103
|
private visible;
|
|
104
|
+
/**
|
|
105
|
+
* The records a read may start from. A windowed entity (the register, V2s S4.2) is never built whole: the
|
|
106
|
+
* dataset makes only the slice the where clause names, for only the students the reader may see, and
|
|
107
|
+
* visibility, fields and the rest of the where clause apply to that slice as to any other. A dataset with no
|
|
108
|
+
* way to select (one wrapped with a custom registry) falls back to building everything.
|
|
109
|
+
*/
|
|
110
|
+
private visibleFor;
|
|
109
111
|
private shape;
|
|
110
112
|
private schoolGet;
|
|
111
113
|
private schoolList;
|
|
@@ -153,4 +155,4 @@ export declare class Engine implements Kernel {
|
|
|
153
155
|
/** D19: one CIO-visible entry per call that returns pastoral or medical fields. */
|
|
154
156
|
private auditSensitiveRead;
|
|
155
157
|
}
|
|
156
|
-
export declare const ENGINE_SDK_VERSION = "0.1.
|
|
158
|
+
export declare const ENGINE_SDK_VERSION = "0.1.4";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AUDITED_TIERS, isDerived, BASE_FIELDS, ENTITIES, eligibleParents, fieldVisible, filterFields, grantedTiers, principalTiers, visibleRecords, visibleStudentIds, } from '@quad-education/canonical';
|
|
1
|
+
import { AUDITED_TIERS, isDerived, isWindowed, BASE_FIELDS, ENTITIES, eligibleParents, fieldVisible, filterFields, grantedTiers, principalTiers, visibleRecords, visibleStudentIds, } from '@quad-education/canonical';
|
|
2
2
|
import { DEFAULT_ACCESS, parseManifest, schemaHash, servedRoles, } from '@quad-education/schema';
|
|
3
3
|
import { QuadError } from "../contract/errors.js";
|
|
4
4
|
import { SDK_VERSION } from "../contract/types.js";
|
|
@@ -29,11 +29,6 @@ class Grant extends Set {
|
|
|
29
29
|
this.declared = declared;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
/**
|
|
33
|
-
* The in-browser implementation of the @quad-education/sdk contract (D15). It runs in the demo
|
|
34
|
-
* shell's origin, holds the fictional school, and enforces visibility, scopes and D17 on
|
|
35
|
-
* every call. Apps reach it only through a transport.
|
|
36
|
-
*/
|
|
37
32
|
export class Engine {
|
|
38
33
|
apps = new Map();
|
|
39
34
|
clock = { kind: 'offset', offsetMs: 0 };
|
|
@@ -383,13 +378,33 @@ export class Engine {
|
|
|
383
378
|
visible(ctx, entity) {
|
|
384
379
|
return visibleRecords(ctx.principal, entity, this.dataset);
|
|
385
380
|
}
|
|
381
|
+
/**
|
|
382
|
+
* The records a read may start from. A windowed entity (the register, V2s S4.2) is never built whole: the
|
|
383
|
+
* dataset makes only the slice the where clause names, for only the students the reader may see, and
|
|
384
|
+
* visibility, fields and the rest of the where clause apply to that slice as to any other. A dataset with no
|
|
385
|
+
* way to select (one wrapped with a custom registry) falls back to building everything.
|
|
386
|
+
*/
|
|
387
|
+
visibleFor(ctx, entity, where) {
|
|
388
|
+
const select = isWindowed(entity)
|
|
389
|
+
? this.dataset.select
|
|
390
|
+
: undefined;
|
|
391
|
+
if (typeof select !== 'function')
|
|
392
|
+
return this.visible(ctx, entity);
|
|
393
|
+
ctx.students ??= visibleStudentIds(ctx.principal, this.dataset);
|
|
394
|
+
const made = select.call(this.dataset, entity, { where, students: ctx.students });
|
|
395
|
+
if (made === null)
|
|
396
|
+
return this.visible(ctx, entity);
|
|
397
|
+
if (!made.ok)
|
|
398
|
+
throw new QuadError('VALIDATION', made.message);
|
|
399
|
+
return visibleRecords(ctx.principal, entity, this.dataset, made.rows);
|
|
400
|
+
}
|
|
386
401
|
shape(entity, grant, records) {
|
|
387
402
|
return records.map((r) => filterFields(entity, r, grant, grant.declared));
|
|
388
403
|
}
|
|
389
404
|
async schoolGet(ctx, entityValue, id) {
|
|
390
405
|
const entity = this.entityName(entityValue);
|
|
391
406
|
const tiers = this.tiers(ctx, entity);
|
|
392
|
-
const record = this.
|
|
407
|
+
const record = this.visibleFor(ctx, entity, { id }).find((r) => r.id === id);
|
|
393
408
|
if (!record)
|
|
394
409
|
throw new QuadError('NOT_FOUND', `no ${entity} record ${String(id)}`);
|
|
395
410
|
await this.auditSensitiveRead(ctx, entity, tiers, 1, 'school.get');
|
|
@@ -398,7 +413,7 @@ export class Engine {
|
|
|
398
413
|
async schoolList(ctx, entityValue, options) {
|
|
399
414
|
const entity = this.entityName(entityValue);
|
|
400
415
|
const tiers = this.tiers(ctx, entity);
|
|
401
|
-
const page = runQuery(this.
|
|
416
|
+
const page = runQuery(this.visibleFor(ctx, entity, options?.where), (options ?? {}), this.allowedFields(entity, tiers));
|
|
402
417
|
await this.auditSensitiveRead(ctx, entity, tiers, page.items.length, 'school.list');
|
|
403
418
|
return { items: this.shape(entity, tiers, page.items), nextCursor: page.nextCursor };
|
|
404
419
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quad-education/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The @quad-education/sdk contract, its in-browser engine, transports and contract tests",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"fake-indexeddb": "^6.2.5",
|
|
50
|
-
"@quad-education/
|
|
51
|
-
"@quad-education/
|
|
52
|
-
"@quad-education/
|
|
50
|
+
"@quad-education/canonical": "^0.1.4",
|
|
51
|
+
"@quad-education/fictional-school": "^0.1.4",
|
|
52
|
+
"@quad-education/schema": "^0.1.4"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"vitest": "^5.0.3"
|