@quad-education/sdk 0.1.4 → 0.3.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 +3 -1
- package/dist/contract-tests/apps.d.ts +1 -1
- package/dist/contract-tests/apps.js +1 -1
- package/dist/contract-tests/harness.d.ts +11 -0
- package/dist/contract-tests/harness.js +40 -0
- package/dist/contract-tests/helpers.d.ts +5 -0
- package/dist/contract-tests/helpers.js +25 -0
- package/dist/contract-tests/index.d.ts +1 -0
- package/dist/contract-tests/index.js +1 -0
- package/dist/contract-tests/suite.js +3 -24
- package/dist/src/contract/types.d.ts +1 -1
- package/dist/src/contract/types.js +1 -1
- package/dist/src/engine/audit.d.ts +2 -2
- package/dist/src/engine/audit.js +8 -6
- package/dist/src/engine/db-indexes.js +6 -1
- package/dist/src/engine/engine.d.ts +14 -12
- package/dist/src/engine/engine.js +100 -135
- package/dist/src/engine/host.js +1 -1
- package/dist/src/engine/index.d.ts +3 -1
- package/dist/src/engine/index.js +1 -0
- package/dist/src/engine/memory-store.d.ts +32 -0
- package/dist/src/engine/memory-store.js +123 -0
- package/dist/src/engine/runner.d.ts +2 -2
- package/dist/src/engine/runner.js +27 -24
- package/dist/src/engine/state.d.ts +4 -9
- package/dist/src/engine/store.d.ts +48 -0
- package/dist/src/engine/store.js +1 -0
- package/dist/src/engine/tasks.d.ts +4 -6
- package/dist/src/engine/tasks.js +17 -21
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -95,6 +95,8 @@ The types allow `orderBy` and ranges only on indexed fields, so most mistakes ar
|
|
|
95
95
|
|
|
96
96
|
## Versions
|
|
97
97
|
|
|
98
|
+
- **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.
|
|
99
|
+
- **0.2.0** (20 Oct 2026, withdrawn). Account and guest principals, `NOT_AVAILABLE`, the manifest `guests` flag and the live connection, for apps that were to run live outside a school (V2c, D100). Removed again by D101 in 0.3.0.
|
|
98
100
|
- **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.
|
|
99
101
|
- **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`.
|
|
100
102
|
- **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.
|
|
@@ -105,4 +107,4 @@ The types allow `orderBy` and ranges only on indexed fields, so most mistakes ar
|
|
|
105
107
|
- `orca gen` and `orca-env.d.ts` became `quad gen` and `quad-env.d.ts`;
|
|
106
108
|
- the handshake and jobs messages became `quad:*`.
|
|
107
109
|
|
|
108
|
-
The version stays 0.1.0 because nothing was published under the old name.
|
|
110
|
+
The version stays 0.1.0 because nothing was published under the old name.
|
|
@@ -108,7 +108,7 @@ export declare const DATA_APP: {
|
|
|
108
108
|
schema: typeof TEST_SCHEMA;
|
|
109
109
|
};
|
|
110
110
|
/**
|
|
111
|
-
*
|
|
111
|
+
* An app (V2s D84) with version 1, two app-defined roles named like school roles, so the matching
|
|
112
112
|
* personas can preview them. The access keys are written in different cases on purpose.
|
|
113
113
|
*/
|
|
114
114
|
export declare const ROLES_SCHEMA: {
|
|
@@ -207,7 +207,7 @@ export const DATA_APP = {
|
|
|
207
207
|
schema: TEST_SCHEMA,
|
|
208
208
|
};
|
|
209
209
|
/**
|
|
210
|
-
*
|
|
210
|
+
* An app (V2s D84) with version 1, two app-defined roles named like school roles, so the matching
|
|
211
211
|
* personas can preview them. The access keys are written in different cases on purpose.
|
|
212
212
|
*/
|
|
213
213
|
export const ROLES_SCHEMA = defineSchema({
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Principal } from '@quad-education/canonical';
|
|
2
|
+
import type { ContractEnv, TestApp } from './suite.ts';
|
|
3
|
+
import type { QuadSdk } from '../src/contract/types.ts';
|
|
4
|
+
import type { Engine } from '../src/engine/index.ts';
|
|
5
|
+
type SliceBControl = Pick<ContractEnv['control'], 'advanceClock' | 'runDueJobs' | 'redeliver' | 'runs' | 'inbox' | 'auditLog'>;
|
|
6
|
+
/**
|
|
7
|
+
* The job-running and inspection controls, shared by both contract runners. Each job runs
|
|
8
|
+
* as its run's principal through whatever transport `connect` uses.
|
|
9
|
+
*/
|
|
10
|
+
export declare function sliceBControls(engine: () => Engine, app: () => TestApp, connect: (principal: Principal) => Promise<QuadSdk>, onClock?: () => Promise<void>): SliceBControl;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { executeRun } from "../src/jobs/define.js";
|
|
2
|
+
/**
|
|
3
|
+
* The job-running and inspection controls, shared by both contract runners. Each job runs
|
|
4
|
+
* as its run's principal through whatever transport `connect` uses.
|
|
5
|
+
*/
|
|
6
|
+
export function sliceBControls(engine, app, connect, onClock = async () => { }) {
|
|
7
|
+
const appId = () => app().manifest.id;
|
|
8
|
+
return {
|
|
9
|
+
async advanceClock(ms) {
|
|
10
|
+
engine().advanceClock(ms);
|
|
11
|
+
await onClock();
|
|
12
|
+
},
|
|
13
|
+
async runDueJobs() {
|
|
14
|
+
const started = await engine().startDueRuns(appId());
|
|
15
|
+
return Promise.all(started.map(async (run) => {
|
|
16
|
+
// Each run acts as its own principal: cron as the system, scheduled jobs as whoever scheduled them (D7).
|
|
17
|
+
const sdk = await connect(run.runAs);
|
|
18
|
+
const result = await executeRun(app().jobs ?? [], run, sdk);
|
|
19
|
+
await engine().finishRun(appId(), run.runId, result);
|
|
20
|
+
return {
|
|
21
|
+
runId: run.runId,
|
|
22
|
+
jobName: run.jobName,
|
|
23
|
+
scheduledFor: run.scheduledFor,
|
|
24
|
+
ok: result.ok,
|
|
25
|
+
};
|
|
26
|
+
}));
|
|
27
|
+
},
|
|
28
|
+
redeliver: (runId) => engine().redeliverRun(appId(), runId),
|
|
29
|
+
runs: async () => (await engine().runs(appId())).map(({ id, jobName, scheduledFor, status, attempts, deliveries }) => ({
|
|
30
|
+
id,
|
|
31
|
+
jobName,
|
|
32
|
+
scheduledFor,
|
|
33
|
+
status,
|
|
34
|
+
attempts,
|
|
35
|
+
deliveries,
|
|
36
|
+
})),
|
|
37
|
+
inbox: async (personId) => engine().inbox(appId(), personId),
|
|
38
|
+
auditLog: async () => engine().auditLog(appId()),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function listAll(collection: any, options?: Record<string, unknown>): Promise<any[]>;
|
|
2
|
+
export declare function expectError(promise: Promise<unknown>, code: string): Promise<Error>;
|
|
3
|
+
export declare const ids: (records: readonly {
|
|
4
|
+
id: string;
|
|
5
|
+
}[]) => string[];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any -- the suite drives the SDK untyped, like plain JS would */
|
|
2
|
+
import { expect } from 'vitest';
|
|
3
|
+
import { isQuadError } from "../src/index.js";
|
|
4
|
+
export async function listAll(collection, options = {}) {
|
|
5
|
+
const items = [];
|
|
6
|
+
let cursor;
|
|
7
|
+
do {
|
|
8
|
+
const page = await collection.list({ ...options, limit: 200, ...(cursor ? { cursor } : {}) });
|
|
9
|
+
items.push(...page.items);
|
|
10
|
+
cursor = page.nextCursor ?? undefined;
|
|
11
|
+
} while (cursor);
|
|
12
|
+
return items;
|
|
13
|
+
}
|
|
14
|
+
export async function expectError(promise, code) {
|
|
15
|
+
try {
|
|
16
|
+
await promise;
|
|
17
|
+
}
|
|
18
|
+
catch (e) {
|
|
19
|
+
expect(isQuadError(e), `expected a QuadError, got ${String(e)}`).toBe(true);
|
|
20
|
+
expect(e.code).toBe(code);
|
|
21
|
+
return e;
|
|
22
|
+
}
|
|
23
|
+
throw new Error(`expected ${code}, but the call succeeded`);
|
|
24
|
+
}
|
|
25
|
+
export const ids = (records) => records.map((r) => r.id).sort();
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { defineContractSuite } from './suite.ts';
|
|
2
2
|
export type { ContractEnv, ContractFactory, TestApp } from './suite.ts';
|
|
3
|
+
export { sliceBControls } from './harness.ts';
|
|
3
4
|
export { ACCESS_APP, AWARDS_APP, BASIC_APP, DEMOGRAPHICS_APP, HR_APP, JOBS_APP, TEST_APP, WELLBEING_APP, slowGate, } from './apps.ts';
|
|
@@ -3,8 +3,9 @@ import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
|
3
3
|
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
|
-
import {
|
|
6
|
+
import { parentsOf, staffOf, studentsOf } from "../src/index.js";
|
|
7
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
|
+
import { expectError, ids, listAll } from "./helpers.js";
|
|
8
9
|
// The fictional school is the oracle: tests compare what the SDK returns with what the
|
|
9
10
|
// dataset says should be visible. They never read an implementation's storage.
|
|
10
11
|
const ds = withDerived(stored);
|
|
@@ -23,28 +24,6 @@ const RESTRICTED_PARENT = persona('restricted-parent');
|
|
|
23
24
|
const childrenOf = (parentId) => ds.parentStudentLinks
|
|
24
25
|
.filter((l) => l.parentId === parentId && !l.contactRestricted)
|
|
25
26
|
.map((l) => l.studentId);
|
|
26
|
-
async function listAll(collection, options = {}) {
|
|
27
|
-
const items = [];
|
|
28
|
-
let cursor;
|
|
29
|
-
do {
|
|
30
|
-
const page = await collection.list({ ...options, limit: 200, ...(cursor ? { cursor } : {}) });
|
|
31
|
-
items.push(...page.items);
|
|
32
|
-
cursor = page.nextCursor ?? undefined;
|
|
33
|
-
} while (cursor);
|
|
34
|
-
return items;
|
|
35
|
-
}
|
|
36
|
-
async function expectError(promise, code) {
|
|
37
|
-
try {
|
|
38
|
-
await promise;
|
|
39
|
-
}
|
|
40
|
-
catch (e) {
|
|
41
|
-
expect(isQuadError(e), `expected a QuadError, got ${String(e)}`).toBe(true);
|
|
42
|
-
expect(e.code).toBe(code);
|
|
43
|
-
return e;
|
|
44
|
-
}
|
|
45
|
-
throw new Error(`expected ${code}, but the call succeeded`);
|
|
46
|
-
}
|
|
47
|
-
const ids = (records) => records.map((r) => r.id).sort();
|
|
48
27
|
export function defineContractSuite(name, factory) {
|
|
49
28
|
describe(`@quad-education/sdk contract: ${name}`, () => {
|
|
50
29
|
let env;
|
|
@@ -73,7 +52,7 @@ export function defineContractSuite(name, factory) {
|
|
|
73
52
|
},
|
|
74
53
|
});
|
|
75
54
|
expect(sdk.appId).toBe(TEST_APP.manifest.id);
|
|
76
|
-
expect(sdk.version).toBe('0.
|
|
55
|
+
expect(sdk.version).toBe('0.3.0');
|
|
77
56
|
});
|
|
78
57
|
it('knows parents and students', async () => {
|
|
79
58
|
expect((await (await env.connect(STUDENT)).auth.me()).role).toBe('student');
|
|
@@ -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.
|
|
4
|
+
export declare const SDK_VERSION = "0.3.0";
|
|
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
|
+
export const SDK_VERSION = '0.3.0';
|
|
@@ -21,7 +21,7 @@ export declare function recordAudit(k: Kernel, ctx: Ctx, input: unknown): Promis
|
|
|
21
21
|
* parents and students only their own. An entry about a student also needs that student
|
|
22
22
|
* to be visible, staff included (D25). The system principal sees all app entries.
|
|
23
23
|
*/
|
|
24
|
-
export declare function listAudit(k: Kernel, ctx: Ctx, options: unknown): {
|
|
24
|
+
export declare function listAudit(k: Kernel, ctx: Ctx, options: unknown): Promise<{
|
|
25
25
|
items: AuditEntry[];
|
|
26
26
|
nextCursor: string | null;
|
|
27
|
-
}
|
|
27
|
+
}>;
|
package/dist/src/engine/audit.js
CHANGED
|
@@ -3,7 +3,7 @@ import { runQuery } from "./query.js";
|
|
|
3
3
|
import { isStaffOrSystem, seesSubject, } from "./state.js";
|
|
4
4
|
import { isObject, jsonObject, onlyKeys, optionalStr, str } from "./values.js";
|
|
5
5
|
export async function appendAudit(k, app, input) {
|
|
6
|
-
const seq = (app.
|
|
6
|
+
const seq = await k.store.nextAuditSeq(app.manifest.id);
|
|
7
7
|
const entry = {
|
|
8
8
|
id: `aud-${String(seq).padStart(7, '0')}`,
|
|
9
9
|
seq,
|
|
@@ -21,7 +21,6 @@ export async function appendAudit(k, app, input) {
|
|
|
21
21
|
: {}),
|
|
22
22
|
...(input.data !== undefined ? { data: input.data } : {}),
|
|
23
23
|
};
|
|
24
|
-
app.audit.push(entry);
|
|
25
24
|
await k.persistPlatform(app, 'audit', [entry]);
|
|
26
25
|
return entry;
|
|
27
26
|
}
|
|
@@ -35,8 +34,9 @@ export async function recordAudit(k, ctx, input) {
|
|
|
35
34
|
throw new QuadError('VALIDATION', 'audit.record takes an object');
|
|
36
35
|
onlyKeys(input, ['action', 'summary', 'entity', 'recordId', 'regarding', 'data', 'idempotencyKey'], 'audit.record');
|
|
37
36
|
const key = k.idempotencyKey(input, 'audit.record');
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
const remembered = key ? await k.store.getKey(ctx.app.manifest.id, key) : undefined;
|
|
38
|
+
if (typeof remembered === 'string') {
|
|
39
|
+
const existing = await k.store.getPlatform(ctx.app.manifest.id, 'audit', remembered);
|
|
40
40
|
if (existing)
|
|
41
41
|
return auditView(existing);
|
|
42
42
|
}
|
|
@@ -80,7 +80,7 @@ export async function recordAudit(k, ctx, input) {
|
|
|
80
80
|
* parents and students only their own. An entry about a student also needs that student
|
|
81
81
|
* to be visible, staff included (D25). The system principal sees all app entries.
|
|
82
82
|
*/
|
|
83
|
-
export function listAudit(k, ctx, options) {
|
|
83
|
+
export async function listAudit(k, ctx, options) {
|
|
84
84
|
const opts = (isObject(options) ? options : {});
|
|
85
85
|
const { entity, recordId, action, limit, cursor } = opts;
|
|
86
86
|
const where = {};
|
|
@@ -90,7 +90,9 @@ export function listAudit(k, ctx, options) {
|
|
|
90
90
|
where.recordId = str(recordId, 'recordId');
|
|
91
91
|
if (action !== undefined)
|
|
92
92
|
where.action = str(action, 'action');
|
|
93
|
-
const
|
|
93
|
+
const entries = await k.store.allPlatform(ctx.app.manifest.id, 'audit');
|
|
94
|
+
entries.sort((a, b) => a.seq - b.seq);
|
|
95
|
+
const visible = entries.filter((e) => e.source === 'app' &&
|
|
94
96
|
(isStaffOrSystem(ctx) || e.actor === ctx.actorId) &&
|
|
95
97
|
seesSubject(k, ctx, e.regardingStudentId));
|
|
96
98
|
const page = runQuery(visible, {
|
|
@@ -5,7 +5,12 @@ import { QuadError } from "../contract/errors.js";
|
|
|
5
5
|
// indexes. Equality, `in` and `ne` filters work on any visible field; they only ever scan the
|
|
6
6
|
// app's own data. Pure, so the serverless data API can apply exactly the same rule.
|
|
7
7
|
/** Every app entity is indexed on these, with no declaration needed. */
|
|
8
|
-
export const IMPLICIT_INDEXES = [
|
|
8
|
+
export const IMPLICIT_INDEXES = [
|
|
9
|
+
['id'],
|
|
10
|
+
['createdAt'],
|
|
11
|
+
// So a list of one's own records (the `own` rule) is an index read, in DynamoDB too (V2c, D96).
|
|
12
|
+
['createdBy', 'createdAt'],
|
|
13
|
+
];
|
|
9
14
|
const RANGE_OPS = ['gt', 'gte', 'lt', 'lte'];
|
|
10
15
|
const isPlainObject = (v) => v !== null && typeof v === 'object' && !Array.isArray(v);
|
|
11
16
|
const isRange = (condition) => isPlainObject(condition) &&
|
|
@@ -3,20 +3,23 @@ import { type AppSchema, type Manifest } from '@quad-education/schema';
|
|
|
3
3
|
import type { OutboxEntry } from '../platform-types.ts';
|
|
4
4
|
import { type ClockState, type Method, type SessionInfo } from '../protocol.ts';
|
|
5
5
|
import { type RunRequest, type RunResult } from './runner.ts';
|
|
6
|
-
import type
|
|
7
|
-
import {
|
|
6
|
+
import { type App, type Ctx, type Kernel, type ResolvedRecipients, type StoredRun } from './state.ts';
|
|
7
|
+
import type { AppStore, PlatformKind } from './store.ts';
|
|
8
8
|
export type EngineOptions = {
|
|
9
9
|
dataset: Dataset;
|
|
10
|
-
|
|
10
|
+
/** Where in-browser state is kept; ignored when `store` is given. */
|
|
11
|
+
indexedDB?: IDBFactory;
|
|
11
12
|
/** IndexedDB database name; defaults to `quad-engine`. */
|
|
12
13
|
dbName?: string;
|
|
14
|
+
/** Keep state here instead of in memory and IndexedDB (a school instance's data API, Phase 4). */
|
|
15
|
+
store?: AppStore;
|
|
13
16
|
};
|
|
14
17
|
export declare class Engine implements Kernel {
|
|
15
18
|
private readonly apps;
|
|
16
19
|
private clock;
|
|
17
20
|
private readonly byId;
|
|
18
21
|
readonly dataset: Dataset;
|
|
19
|
-
|
|
22
|
+
readonly store: AppStore;
|
|
20
23
|
private constructor();
|
|
21
24
|
static create(options: EngineOptions): Promise<Engine>;
|
|
22
25
|
close(): void;
|
|
@@ -29,9 +32,9 @@ export declare class Engine implements Kernel {
|
|
|
29
32
|
/** Clear an app's data and outbox (the shell's reset button). */
|
|
30
33
|
resetApp(appId: string): Promise<void>;
|
|
31
34
|
/** Open tasks assigned to a person: the shell's inbox (D6). */
|
|
32
|
-
inbox(appId: string, personId: string): import("../index.ts").Task[]
|
|
35
|
+
inbox(appId: string, personId: string): Promise<import("../index.ts").Task[]>;
|
|
33
36
|
/** Every audit entry, including CIO-only ones (the shell's audit viewer, D19). */
|
|
34
|
-
auditLog(appId: string): {
|
|
37
|
+
auditLog(appId: string): Promise<{
|
|
35
38
|
visibility: "app" | "cio";
|
|
36
39
|
id: string;
|
|
37
40
|
appId: string;
|
|
@@ -46,7 +49,7 @@ export declare class Engine implements Kernel {
|
|
|
46
49
|
data?: {
|
|
47
50
|
readonly [key: string]: import("../index.ts").JsonValue;
|
|
48
51
|
};
|
|
49
|
-
}[]
|
|
52
|
+
}[]>;
|
|
50
53
|
/** Counts of everything a job can change, for run-twice tests (D20). */
|
|
51
54
|
effectsSnapshot(appId: string): Promise<{
|
|
52
55
|
outbox: number;
|
|
@@ -60,12 +63,12 @@ export declare class Engine implements Kernel {
|
|
|
60
63
|
records: Record<string, Record<string, string>>;
|
|
61
64
|
}>;
|
|
62
65
|
/** Runs for the job log, newest first. */
|
|
63
|
-
runs(appId: string): StoredRun[]
|
|
66
|
+
runs(appId: string): Promise<StoredRun[]>;
|
|
64
67
|
/**
|
|
65
68
|
* Who a call from the jobs host acts as: the principal of the run it belongs to (D7).
|
|
66
69
|
* Only runs that are currently running count, so a finished run's id can't be replayed.
|
|
67
70
|
*/
|
|
68
|
-
runPrincipal(appId: string, runId: string | undefined): Principal
|
|
71
|
+
runPrincipal(appId: string, runId: string | undefined): Promise<Principal>;
|
|
69
72
|
/** Start due runs; the caller executes each as its `runAs` principal and calls finishRun. */
|
|
70
73
|
startDueRuns(appId: string): Promise<RunRequest[]>;
|
|
71
74
|
finishRun(appId: string, runId: string, result: RunResult): Promise<void>;
|
|
@@ -135,7 +138,6 @@ export declare class Engine implements Kernel {
|
|
|
135
138
|
private checkWrite;
|
|
136
139
|
remember(ctx: Ctx, key: string, result: unknown): Promise<void>;
|
|
137
140
|
idempotencyKey(options: unknown, scope: string): string | undefined;
|
|
138
|
-
private persist;
|
|
139
141
|
private dbCreate;
|
|
140
142
|
private dbUpdate;
|
|
141
143
|
private dbGet;
|
|
@@ -148,11 +150,11 @@ export declare class Engine implements Kernel {
|
|
|
148
150
|
* Resolves recipients to people, applying the app's roles and D17. Parents are only ever
|
|
149
151
|
* reached about a specific student, and only through an eligible, unrestricted link.
|
|
150
152
|
*/
|
|
151
|
-
resolveRecipients(ctx: Ctx, to: unknown, regarding: string | undefined): ResolvedRecipients
|
|
153
|
+
resolveRecipients(ctx: Ctx, to: unknown, regarding: string | undefined): Promise<ResolvedRecipients>;
|
|
152
154
|
private suppressionReason;
|
|
153
155
|
/** D17/D19: each suppressed parent is recorded, visible only to the CIO view. */
|
|
154
156
|
private auditSuppressed;
|
|
155
157
|
/** D19: one CIO-visible entry per call that returns pastoral or medical fields. */
|
|
156
158
|
private auditSensitiveRead;
|
|
157
159
|
}
|
|
158
|
-
export declare const ENGINE_SDK_VERSION = "0.
|
|
160
|
+
export declare const ENGINE_SDK_VERSION = "0.3.0";
|