@quad-education/sdk 0.7.0 → 0.9.0
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 +5 -2
- package/dist/contract-tests/apps.d.ts +617 -0
- package/dist/contract-tests/apps.js +215 -1
- package/dist/contract-tests/harness.d.ts +1 -1
- package/dist/contract-tests/harness.js +7 -0
- package/dist/contract-tests/lists-and-files.d.ts +19 -0
- package/dist/contract-tests/lists-and-files.js +279 -0
- package/dist/contract-tests/live.d.ts +3 -0
- package/dist/contract-tests/live.js +156 -0
- package/dist/contract-tests/notifications.d.ts +3 -0
- package/dist/contract-tests/notifications.js +218 -0
- package/dist/contract-tests/search-and-totals.d.ts +13 -0
- package/dist/contract-tests/search-and-totals.js +226 -0
- package/dist/contract-tests/suite.d.ts +7 -0
- package/dist/contract-tests/suite.js +180 -2
- package/dist/contract-tests/writes.d.ts +3 -0
- package/dist/contract-tests/writes.js +265 -0
- package/dist/src/base64.d.ts +3 -0
- package/dist/src/base64.js +52 -0
- package/dist/src/client/connect.d.ts +1 -0
- package/dist/src/client/connect.js +1 -0
- package/dist/src/client/create-client.js +39 -5
- package/dist/src/client/save-file.d.ts +16 -0
- package/dist/src/client/save-file.js +28 -0
- package/dist/src/client/watch.d.ts +20 -0
- package/dist/src/client/watch.js +175 -0
- package/dist/src/contract/errors.d.ts +1 -1
- package/dist/src/contract/types.d.ts +220 -10
- package/dist/src/contract/types.js +4 -1
- package/dist/src/engine/engine.d.ts +91 -2
- package/dist/src/engine/engine.js +604 -67
- package/dist/src/engine/files.d.ts +25 -0
- package/dist/src/engine/files.js +88 -0
- package/dist/src/engine/index.d.ts +1 -1
- package/dist/src/engine/memory-store.d.ts +33 -3
- package/dist/src/engine/memory-store.js +116 -8
- package/dist/src/engine/notify-content.d.ts +9 -0
- package/dist/src/engine/notify-content.js +88 -0
- package/dist/src/engine/query.d.ts +14 -2
- package/dist/src/engine/query.js +45 -13
- package/dist/src/engine/search.d.ts +8 -0
- package/dist/src/engine/search.js +32 -0
- package/dist/src/engine/state.d.ts +5 -0
- package/dist/src/engine/storage.d.ts +46 -1
- package/dist/src/engine/storage.js +46 -3
- package/dist/src/engine/store.d.ts +39 -2
- package/dist/src/engine/summary.d.ts +25 -0
- package/dist/src/engine/summary.js +107 -0
- package/dist/src/engine/validate-input.d.ts +7 -1
- package/dist/src/engine/validate-input.js +28 -1
- package/dist/src/engine/working-copy.d.ts +30 -0
- package/dist/src/engine/working-copy.js +91 -0
- package/dist/src/platform-types.d.ts +11 -1
- package/dist/src/protocol.d.ts +1 -1
- package/dist/src/protocol.js +9 -0
- package/dist/src/testing/index.d.ts +9 -0
- package/dist/src/testing/index.js +16 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -12,8 +12,8 @@ const sdk = await connect()
|
|
|
12
12
|
const { items } = await sdk.school.students.list({ where: { yearLevel: 'Y9' } })
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
Modules: `auth` (who is signed in,
|
|
16
|
-
`appAdmins()`, D133), `school` (canonical school data, filtered by your scopes and the user's
|
|
15
|
+
Modules: `auth` (who is signed in, whether the school made them an app admin, and which of the
|
|
16
|
+
app's own roles they hold: `me()`, `appAdmins()`, D133, D143), `school` (canonical school data, filtered by your scopes and the user's
|
|
17
17
|
visibility), `db` (your app's own data), `notify`, `clock`. Slice B adds `tasks`,
|
|
18
18
|
`schedule`, `cron` and `audit`.
|
|
19
19
|
|
|
@@ -96,6 +96,9 @@ The types allow `orderBy` and ranges only on indexed fields, so most mistakes ar
|
|
|
96
96
|
|
|
97
97
|
## Versions
|
|
98
98
|
|
|
99
|
+
- **0.9.0 (D147, D148, 25 Nov 2026).** Lists and files (a contract change across all the `@quad-education/*` packages, which move together). The schema gains `listOf(inner, options?)`, a field holding up to 100 values (text, numbers, dates, dates and times, choices, links or files; no lists of lists), and `file({ accept? })`, a field holding the id of a file the app keeps; `FIELD_KINDS`, `ITEM_KINDS`, `MAX_LIST_ITEMS`, `FILE_GROUPS`, `FILE_TYPES`, `fileTypesFor` and `MAX_FILE_BYTES` are exported. `db` list gains the `{ has: value }` condition for a list field (`HasCondition`), a list is never sorted by, range-filtered or indexed, and `include` on a list of links returns a list of records. A tenth service, `sdk.files`: `upload(file, { name? })`, `info(id)` and `read(id)` (`FilesApi`, `FileInfo`, `FileSource`). A file is its uploader's alone until its id is written into a `file` field; from then on whoever can read that field can read it, and it is removed with the field or the record, or after 24 hours unattached. 10 MB a file; images, PDF, text and CSV, and office documents. The protocol gains `files.upload`, `files.info` and `files.read`, carrying contents as base64 so params stay JSON (D15). The engine's store gains the file methods of `AppStore`, the testing kit's `Effects` gains `filesUploaded`, and `@quad-education/sdk-react` gains `useFileUrl(id)`. The demo shell's app frame may start a download. **Unique rules and safe writes (D149, D150):** `entity({ unique: [['slotId'], ['studentId', 'term']] })` (up to five rules of one to four single-valued fields; `MAX_UNIQUE_RULES`, `MAX_UNIQUE_FIELDS`, `MAX_UNIQUE_TEXT`), enforced across every record of the entity whoever can read them; a new error code, `CONFLICT`; `db.batch(ops, { idempotencyKey? })`, up to 25 creates, updates and deletes written together or not at all (`DbBatchOp`, `DbBatchResults`, `MAX_BATCH_OPERATIONS`, the `db.batch` method), failing with the first operation's error and `details.index`; and `update(id, patch, { if })` and `delete(id, { if })`, which write only when the record still holds the given values (`WriteCondition`). `AppStore` gains `commit`, which stores a write call's records, files and keys in one step. **Richer notifications (D151, D152):** `notify.send` takes `content`, a list of `NotifyBlock`s (`heading`, `text`, `list`, `details`, `button`; plain text only, up to 30 and one button), with `body` optional beside it and made from the blocks; and `attachments`, up to five file ids and 10 MB in all, of files the sender can read, each copied into the message as it is sent. A file from a `visibleTo` field goes only to those roles, and one at a staff-only level only to staff (`NOT_PERMITTED`). `OutboxEntry` gains `content` and `attachments`, and the engine the platform-only `sentFile(appId, id)`. **Search and totals (D153, D154):** `entity({ search: ['title', 'body'] })` names up to five text fields (`MAX_SEARCH_FIELDS`), and `list({ search })` on `sdk.db` and on `sdk.school` collections matches records where every word appears, ignoring case and accents, after the access rules and never in a field hidden from the reader. `DbOps` gains `count({ where, search })` and `summarise({ where, search, groupBy, sum, min, max, avg })` (`DbSummary`, `DbTotals`; the `db.count` and `db.summarise` methods), over readable records and visible fields only, refused past 20,000 records or 200 groups. **Printing and made files (D155, D156):** `@quad-education/sdk/client` gains `saveFile({ name, type, data })` (`SavedFile`), which hands the person a file the app made, from text or bytes; and the demo shell's app frame allows modals, so `window.print()` works. **Live updates (D157, D158):** `db.watch(entities, callback, { intervalMs?, onError? })` calls back once at the start and whenever a record in a named entity is created, changed or deleted, and returns a `DbWatch` (`check()`, `stop()`); the client asks every 5 seconds, never faster than every 2, not while the page is hidden, and at once after a write through the same SDK. Under it the protocol gains `db.changes`, which returns an opaque stamp for each entity and no records, and is refused for an entity the caller has no read rule on; `AppStore` gains `versions`. `@quad-education/sdk-react` gains `useLive(entities, load, { deps?, intervalMs? })` (`Live`). `createEngine` takes a `channel` (`StoreChannel`, a `BroadcastChannel`), over which the in-browser stores of one browser's windows share an app's records, and the demo shell passes one.
|
|
100
|
+
- **0.8.0 (D142, D143, 24 Nov 2026).** Two access rules and app roles (a contract change across all the `@quad-education/*` packages, which move together). The schema's rules gain `'appAdmin'` (the installation's app admins, for the `staff` key) and `listedIn('entity')` or `listedIn('entity', 'field')` (the staff, students or parents a table of the app's points at); both reach every record, and who changes that table is the app's own rules' business. `accessWarnings(schema)` says when the people a rule keeps out could add themselves, and `quad gen` prints it. `auth.me()` gains `appRoles` for a user: the app's own roles (manifest `roles`) the school gave them, in the manifest's spelling. A person's rules are those of their school role and of every app role they hold. The engine gains the platform-only `setAppRoles(appId, { personId: roles })` and `schema(appId)`, and the testing kit `appRoles` and `setAppRoles`. `SDK_VERSION`, left at `0.6.0` in 0.7.0, is `0.8.0`.
|
|
101
|
+
- **0.7.0 (D132, 30 Oct 2026).** Apps are free in design; no change to the SDK's calls.
|
|
99
102
|
- **0.6.0 (D133, 30 Oct 2026).** App admins: `auth.me()` gains `appAdmin` for a user (staff the school put in charge of the app), and `auth.appAdmins()` lists them for staff and jobs (FORBIDDEN for a student or parent). The engine gains the platform-only `setAppAdmins(appId, personIds)`, the testing kit `createTestPlatform({ appAdmins })` and `setAppAdmins`, and the contract tests the `setAppAdmins` control. A contract change; every `@quad-education/*` package moves to 0.6.0.
|
|
100
103
|
- **0.4.0 (D103, 21 Oct 2026).** A small canonical model, and no field-level coverage anywhere an app can see it (a contract change across all the `@quad-education/*` packages, which move together). The model is 13 entities and 56 fields: the foundation (`schools`, `students`, `staff`, `parents`, `parentStudentLinks`, `cohorts`, `cohortMemberships`) and the extended ones some school systems supply (`periods`, `rooms`, `lessons`, `sessionAttendance`, `medicalAlerts`, `medicalNotes`). **Removed:** `enrolments`, `courses`, `courseEnrolments`, `subjects`, `calendarEvents` and `sdk.school.calendar`, `assignments`, `submissions`, `results`, `studentAbsences`, `attendanceSummaries`, `behaviours`, `achievements`, `learningSupportNeeds`, `medicalEvents`, `employeeAbsences`, `applicants` and `pastoralNotes`; and fields: `students.preferredName` and the seven sensitive demographic fields, `staff.positionTitle` and `phone`, a parent's title, mobile, address and language, `livesWith`, `primaryContact`, `cohorts.parentCohortId` and `subjectId`, the register's `comment` and `minutesLate`, a medical alert's `severity` and `actionPlan`, and a note's `title`, `conditionId` and `eventId`. **Added:** `students.gender`, `parents.phone`, `cohorts.subject` (text, such as "English"), the `form` cohort kind, and the capability map (`CAPABILITIES`, `capabilityOf`, `capabilitiesOf`, `entityKind` in `@quad-education/canonical`). **Changed:** apps no longer declare the fields they read, so the manifest `data` block is accepted and ignored (`manifestWarnings` says to remove it), the engine strips nothing, and `core` is gone; scopes are checked directly. Ids, references and names are required and every other field is typed optional, because a school's system may not supply it. A parent's contact flags (`receivesCorrespondence`, `canConsent`, `contactRestricted`) are optional too, and where a school's system does not supply one the parent is treated as contactable (D17 amended by D103). The `lms` backing goes, and `fieldTier`, `coreFields` and `varyingFields` with it.
|
|
101
104
|
- **0.3.0 (D101, 20 Oct 2026).** Every app runs in a school, so what 0.2.0 added for apps with no school is removed (a removal across all the `@quad-education/*` packages, which move together). Gone from the main entry: the `account` and `guest` principals, `ActingAs`, the account directory and `staticDirectory`, the `account` and `guest` results of `auth.me()`, the `NOT_AVAILABLE` error code (`sdk.school` is always available: the fictional school in dev and the Sandbox, the real school in a school instance), the `{ account }` recipient, and `{ role }` taking any string (it is a school role again). Gone from `@quad-education/sdk/client`: `createHttpTransport`, `connectHttp`, the live connection (`connectLive`, `getLiveStatus`, `signIn`, `continueAsGuest`, `SignInRequired`) and the live branch of `connect()`, which now only talks to the shell. Gone from `@quad-education/sdk/engine` (platform-side only): `school: false`, `accounts`, `accountsFor`, a per-app `timezone`, `attachApp`, `hasApp`, `setAccounts` and `isStandalone`. Gone from `@quad-education/sdk/contract-tests`: the `STANDALONE_APP`, `ACCOUNT_APP` and `TEST_ACCOUNTS` fixtures and the `school` option. `@quad-education/sdk-react` loses `SignInChoices` and `SignInActions`; `@quad-education/schema` loses the manifest's `guests`, the reserved role `guest` and the SDK-version rule for guests. The `subject` rule now applies to every app. **Kept:** the `createdBy, createdAt` implicit index (a list of one's own records can be sorted), and the engine's state behind an `AppStore`, so a school instance's data API can run the same rules over DynamoDB; its `inbox`, `runs`, `auditLog`, `effectsSnapshot` and `runPrincipal` still return promises. Guest access inside a school instance is wanted, and comes back as a contract change when it is designed. Every earlier version, 0.2.0 included, is withdrawn from npm after this one is out.
|