@gonvex/local-runtime 0.5.2-staging.12 → 0.5.2-staging.14

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 CHANGED
@@ -1,58 +1,57 @@
1
1
  # Local Reducer execution
2
2
 
3
- The generated Gonvex client executes an interactive Reducer's existing TypeScript
4
- body in a browser worker. Applications define argument/result schemas and `run`;
5
- they do not maintain a separate optimistic handler or effects list.
6
-
7
- The CLI compiles a local SQL schema from tenant migrations and bundles the public
8
- Reducer exports. Unused Action declarations are removed from that bundle. The
9
- worker uses PGlite as disposable execution memory, seeded from the SDK Local
10
- Replica. It does not persist another database or become a second source of server
11
- state. It captures typed database writes and SQL write CTEs as one transaction.
12
- Both seed rows and writes are rolled back after execution.
13
-
14
- The client persists the intent, arguments, command ID, artifact hash and local
15
- transaction in its existing durable outbox before publishing the predicted rows.
16
- A successful local call returns the Reducer's result without waiting for a server.
17
- On reconnect the SDK sends the same intent and idempotency key. The Rust runtime
18
- executes the Reducer in an authoritative PostgreSQL transaction, checking the
19
- artifact and current permissions. A retry of an already committed command returns
20
- its stored result and commit barrier. It does not execute the write twice.
21
-
22
- A server rejection removes the command's entire prediction and recomputes later
23
- pending intents against the remaining base. The SDK publishes that replacement
24
- atomically and emits `onReducerRejection`. Transport failures retain the intent.
25
- The queue and cached session are partitioned by project, tenant and account.
26
-
27
- Generated replica subscriptions reuse the declared visibility plans and only
28
- columns already exposed by application reads. The runtime refuses to interpret
29
- an incomplete collection or an omitted column as an empty/NULL value. A known
30
- primary-key row can be read from a partial large collection. If required input is
31
- unavailable, the intent remains queued without a guessed result or transaction.
32
- First-time authentication and data never downloaded cannot be fabricated offline.
33
-
34
- Database inserts use the same intent-owned ID allocator in the server module and
35
- the local module. Explicit IDs remain supported. Action and scheduler calls are
36
- recorded locally but only the authoritative server commits and executes their
37
- outbox work. The worker denies ambient network access after loading its WASM.
38
- Server timestamps, constraints, hidden data and concurrent writes remain
39
- server-authoritative and reconcile through the change feed.
40
-
41
- The default host targets browser workers. Other hosts can implement the exported
42
- `LocalExecutor` interface; this package does not claim a native PGlite host.
43
- The IndexedDB and Expo SQLite adapters both persist SDK session metadata.
3
+ The generated client executes the same TypeScript Reducer body used by the Rust
4
+ server. Structured reads and writes use the normalized Local Replica in browsers
5
+ and native JavaScript, and compile to parameterized PostgreSQL operations on the
6
+ server. Production execution has no PGlite, WASM startup, scratch database, or
7
+ WebView. The CLI uses PGlite only during schema compilation, and the test suite uses it
8
+ as a PostgreSQL reference. Neither use is part of application execution.
9
+
10
+ Use the module SDK structured data operations inside an interactive Reducer.
11
+ Arbitrary SQL belongs in server Queries or explicitly server-only work. One
12
+ Reducer captures one atomic transaction, including relationship rows, logs,
13
+ notifications, and deferred Action requests. The server checks permissions and
14
+ constraints and executes deferred work only after its authoritative commit.
15
+
16
+ The client first predicts against resident rows. It publishes a successful
17
+ prediction immediately, then durably stores the intent before network delivery.
18
+ A coordinated admission checks the shared journal and base version and re-executes
19
+ when necessary. Storage failure removes the prediction. A successful call resolves
20
+ after durable admission, without waiting for the server. Never treat a visible
21
+ prediction as confirmation of durable admission or server acceptance.
22
+
23
+ A missing row or projected field retries the body through a transaction-consistent
24
+ storage read view. IndexedDB and Expo SQLite use primary/secondary indexes and
25
+ bounded pages. Missing coverage is never interpreted as an empty collection.
26
+ An intent needing unavailable data waits for the server without a guessed result.
27
+ The SDK supplies stable intent-owned IDs and captures Action/scheduler requests.
28
+
29
+ The confirmed replica and ordered pending intents produce one frontend entity
30
+ view. Rejection removes the rejected prediction and rebases later intents. Server
31
+ commits and local predictions notify the same entity subscriptions. The durable
32
+ journal is scoped by project, tenant, and account; replay also checks the artifact.
33
+
34
+ ## Storage and multiple tabs
35
+
36
+ IndexedDB owns persistent rows; the Local Replica keeps a bounded resident working
37
+ set. Active rows and windows are retained while observed. Cold rows stay on disk
38
+ and can be read by Reducers without loading the entire collection into RAM.
39
+
40
+ Browser tabs share the journal and confirmed storage. Web Locks serialize intent
41
+ admission and outbox delivery. BroadcastChannel signals changes without copying
42
+ whole databases. Field revisions, tombstones, and epochs reject stale projections.
43
+ An online tab can deliver an intent created in another offline tab. Server receipts
44
+ remain the final protection against duplicate effects after a lost response.
45
+
46
+ Expo SQLite implements the same read-view contract with indexed scalar lookups,
47
+ bounded pages, projected writes, and transactional row authority. The generated
48
+ native runtime executes JavaScript directly. Native database files remain scoped
49
+ and shared only through the SDK adapter.
44
50
 
45
51
  ## Verification
46
52
 
47
- ```sh
48
- pnpm --filter @gonvex/local-runtime test
49
- pnpm --filter @gonvex/client test
50
- pnpm --filter @gonvex/module-sdk test
51
- pnpm --filter @gonvex/cli test
52
- ```
53
-
54
- Host tests cover atomic writes, SQL CTE capture, incomplete reads, ordered replay,
55
- stable IDs, validation and scope isolation. Client tests cover durable admission,
56
- restart, server rejection, dependent edits, concurrent admission, lost responses,
57
- account switching and argument capture. CLI tests cover generated execution and
58
- ensure unexposed columns and unused external Actions do not enter local delivery.
53
+ The tests cover PostgreSQL/portable conformance, deterministic IDs, atomic rollback,
54
+ read-own-writes, incomplete data, ordered replay, persistence failures, rejection,
55
+ concurrent tabs, scope changes, residency budgets, and real SQLite transactions.
56
+ CLI tests bundle and execute generated Reducers in an offline browser and verify
57
+ that execution does not start a worker or load a SQL engine.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { JsonObject, JsonValue, ReducerContext, ReducerDefinition } from "@gonvex/module-sdk";
2
2
  import type { LocalSchema } from "./schema.js";
3
3
  export type { LocalSchema, LocalTableSchema, LocalColumn } from "./schema.js";
4
+ export { MissingReducerDataError as IncompleteReplicaError } from "./portable.js";
4
5
  /** Schema emitted by code generation, never inferred from possibly empty rows. */
5
6
  export type LocalColumnType = "text" | "boolean" | "bigint" | "integer" | "double precision" | "jsonb" | "uuid";
6
7
  export type LocalTables = Readonly<Record<string, Readonly<Record<string, LocalColumnType>>>>;
@@ -48,12 +49,6 @@ export type LocalTransactionResult = {
48
49
  deferred: DeferredWork[];
49
50
  readTables: string[];
50
51
  };
51
- export type LocalRuntimeOptions = {
52
- tables?: LocalTables;
53
- schema?: LocalSchema;
54
- reducers: Readonly<Record<string, ReducerDefinition<any, any>>>;
55
- artifactHash: string;
56
- };
57
52
  /** Persist these envelopes in the SDK outbox, never application state. */
58
53
  export type LocalIntent = {
59
54
  path: string;
@@ -70,36 +65,18 @@ export type LocalReplay = {
70
65
  error: Error;
71
66
  }[];
72
67
  };
73
- export declare class IncompleteReplicaError extends Error {
74
- readonly table: string;
75
- constructor(table: string);
76
- }
77
- /**
78
- * Executes an existing module reducer against an isolated PostgreSQL workspace.
79
- * This database is disposable execution memory, never a second durable cache.
80
- * The caller supplies one immutable Local Replica snapshot. Only a successful
81
- * execution returns a transaction for the SDK's existing outbox/overlay path.
82
- */
68
+ export type LocalRuntimeOptions = {
69
+ schema?: LocalSchema;
70
+ tables?: LocalTables;
71
+ reducers: Readonly<Record<string, ReducerDefinition<any, any>>>;
72
+ artifactHash: string;
73
+ };
74
+ /** Executes the shared TypeScript body against the normalized Local Replica. */
83
75
  export declare class LocalReducerRuntime {
84
- private readonly options;
85
- private readonly schema;
86
- private readonly database;
87
- private readonly ready;
88
- private tail;
89
- private closed;
76
+ private readonly executor;
90
77
  constructor(options: LocalRuntimeOptions);
91
78
  initializeReady(): Promise<void>;
92
79
  execute(path: string, args: JsonValue, snapshot: LocalSnapshot, execution: LocalExecution): Promise<LocalTransactionResult>;
93
- /**
94
- * Rebuild pending transactions in intent order after hydration or a changed
95
- * authoritative base. Failed intent contributes no rows to later execution.
96
- * The SDK publishes the returned overlays together, after replay completes.
97
- */
98
80
  replay(snapshot: LocalSnapshot, intents: readonly LocalIntent[]): Promise<LocalReplay>;
99
81
  close(): Promise<void>;
100
- private initialize;
101
- private run;
102
- private insertRow;
103
82
  }
104
- /** Stable per-intent IDs. The server host must use the identical seed contract. */
105
- export declare function deterministicId(scope: string, commandId: string, kind: string, ordinal: number): Promise<string>;
package/dist/index.js CHANGED
@@ -1,382 +1,33 @@
1
- import { validateValue } from "./validation.js";
2
- import { PGlite } from "@electric-sql/pglite";
3
- import { reducerRowId } from "@gonvex/module-sdk";
4
- export class IncompleteReplicaError extends Error {
5
- table;
6
- constructor(table) {
7
- super(`Local replica for ${table} is incomplete; this reducer cannot decide from missing rows.`);
8
- this.table = table;
9
- this.name = "IncompleteReplicaError";
10
- }
11
- }
12
- const quote = (identifier) => `"${identifier.replaceAll('"', '""')}"`;
13
- const columnTypes = new Set(["text", "boolean", "bigint", "integer", "double precision", "jsonb", "uuid"]);
14
- const clone = (value) => structuredClone(value);
15
- const parseInteger = (value) => {
16
- const parsed = Number(value);
17
- if (!Number.isSafeInteger(parsed))
18
- throw new Error("Local reducer read an integer outside the JSON safe range");
19
- return parsed;
20
- };
21
- const queryOptions = { parsers: { 20: parseInteger } };
22
- /**
23
- * Executes an existing module reducer against an isolated PostgreSQL workspace.
24
- * This database is disposable execution memory, never a second durable cache.
25
- * The caller supplies one immutable Local Replica snapshot. Only a successful
26
- * execution returns a transaction for the SDK's existing outbox/overlay path.
27
- */
1
+ import { createPortableReducer } from "./portable-client.js";
2
+ export { MissingReducerDataError as IncompleteReplicaError } from "./portable.js";
3
+ /** Executes the shared TypeScript body against the normalized Local Replica. */
28
4
  export class LocalReducerRuntime {
29
- options;
30
- schema;
31
- database = new PGlite();
32
- ready;
33
- tail = Promise.resolve();
34
- closed = false;
5
+ executor;
35
6
  constructor(options) {
36
- this.options = options;
37
- this.schema = clone(options.schema ?? Object.fromEntries(Object.entries(options.tables ?? {}).map(([table, columns]) => [table, {
38
- key: "_id", columns: Object.fromEntries(Object.entries(columns).map(([name, type]) => [name, { type, nullable: name !== "_id" }])),
39
- }])));
40
- this.ready = this.initialize();
7
+ const schema = options.schema ??
8
+ Object.fromEntries(Object.entries(options.tables ?? {}).map(([table, columns]) => [
9
+ table,
10
+ {
11
+ key: "_id",
12
+ columns: Object.fromEntries(Object.entries(columns).map(([name, type]) => [
13
+ name,
14
+ { type, nullable: name !== "_id" },
15
+ ])),
16
+ },
17
+ ]));
18
+ this.executor = createPortableReducer({ ...options, schema });
19
+ }
20
+ async initializeReady() {
21
+ await this.executor.ready;
41
22
  }
42
- async initializeReady() { await this.ready; }
43
23
  execute(path, args, snapshot, execution) {
44
- // Capture at admission: the caller may receive a new server transaction or
45
- // switch tenants while another reducer awaits its database turn.
46
- const input = clone({ args, snapshot, execution });
47
- const job = this.tail.then(async () => {
48
- if (this.closed)
49
- throw new Error("Local reducer runtime is closed");
50
- await this.ready;
51
- return this.run(path, input.args, input.snapshot, input.execution);
52
- });
53
- this.tail = job.catch(() => undefined);
54
- return job;
24
+ return this.executor.execute(path, args, snapshot, execution);
55
25
  }
56
- /**
57
- * Rebuild pending transactions in intent order after hydration or a changed
58
- * authoritative base. Failed intent contributes no rows to later execution.
59
- * The SDK publishes the returned overlays together, after replay completes.
60
- */
61
- async replay(snapshot, intents) {
62
- const working = clone(snapshot);
63
- const queue = clone(intents);
64
- const ids = new Set();
65
- // These are journal integrity errors, not business rejections. Do not
66
- // silently drop an intent belonging to another artifact or identity.
67
- for (const intent of queue) {
68
- if (intent.execution.scope !== working.scope)
69
- throw new Error("Local reducer scope mismatch");
70
- if (intent.execution.artifactHash !== this.options.artifactHash)
71
- throw new Error("Local reducer artifact mismatch");
72
- if (ids.has(intent.execution.commandId))
73
- throw new Error("Duplicate local command id");
74
- ids.add(intent.execution.commandId);
75
- }
76
- const transactions = [];
77
- const rejected = [];
78
- for (const intent of queue) {
79
- let transaction;
80
- try {
81
- transaction = await this.execute(intent.path, intent.args, working, intent.execution);
82
- }
83
- catch (error) {
84
- // A missing cache dependency must keep the journal pending. It is not
85
- // evidence that the server will reject the business operation.
86
- if (error instanceof IncompleteReplicaError)
87
- throw error;
88
- rejected.push({ commandId: intent.execution.commandId, error: error instanceof Error ? error : new Error(String(error)) });
89
- continue;
90
- }
91
- // Invariant failures in the transaction output abort the whole replay;
92
- // they must never be downgraded to a user/business rejection.
93
- for (const patch of transaction.patches) {
94
- const table = working.tables[patch.entity] ??= { complete: false, rows: [] };
95
- const key = this.schema[patch.entity]?.key ?? "_id";
96
- const index = table.rows.findIndex((row) => (row[key] ?? row._id) === patch.rowId);
97
- if (patch.op === "delete") {
98
- if (index >= 0)
99
- table.rows.splice(index, 1);
100
- }
101
- else if (patch.op === "insert") {
102
- if (index >= 0)
103
- throw new Error("Local replay insert refers to an existing row");
104
- table.rows.push(clone(patch.fields));
105
- }
106
- else {
107
- if (index < 0)
108
- throw new Error("Local replay patch refers to a missing row");
109
- table.rows[index] = { ...table.rows[index], ...clone(patch.fields) };
110
- }
111
- }
112
- transactions.push({ commandId: intent.execution.commandId, transaction });
113
- }
114
- return { transactions, rejected };
26
+ replay(snapshot, intents) {
27
+ return this.executor.replay(snapshot, intents);
115
28
  }
116
29
  async close() {
117
- if (this.closed)
118
- return;
119
- this.closed = true;
120
- await this.tail;
121
- await this.ready.catch(() => undefined);
122
- await this.database.close();
123
- }
124
- async initialize() {
125
- for (const [table, definition] of Object.entries(this.schema)) {
126
- const { columns, key } = definition;
127
- if (!table || !columns[key])
128
- throw new Error(`Local table ${table} requires its primary key column`);
129
- const definitions = Object.entries(columns).map(([column, spec]) => {
130
- // Types/defaults come only from the generated, build-time schema.
131
- return `${quote(column)} ${spec.type}${column === key ? " PRIMARY KEY" : ""}${spec.default ? ` DEFAULT ${spec.default}` : ""}`;
132
- });
133
- await this.database.exec(`CREATE TABLE ${quote(table)} (${definitions.join(", ")})`);
134
- }
30
+ this.executor.close();
135
31
  }
136
- async run(path, args, snapshot, execution) {
137
- if (!execution.scope || execution.scope !== snapshot.scope)
138
- throw new Error("Local reducer scope mismatch");
139
- if (!execution.commandId || !Number.isSafeInteger(execution.now))
140
- throw new Error("Invalid local execution envelope");
141
- if (execution.artifactHash !== this.options.artifactHash)
142
- throw new Error("Local reducer artifact mismatch");
143
- const definition = this.options.reducers[path];
144
- if (!definition || definition.kind !== "reducer" || definition.internal || !definition.handler) {
145
- throw new Error(`No public local reducer registered for ${path}`);
146
- }
147
- validateValue(definition.options.args, args);
148
- const patches = [];
149
- const deferred = [];
150
- const reads = new Set();
151
- let ordinal = 0;
152
- const deferredOrdinals = new Map();
153
- const nextId = (kind) => deterministicId(execution.scope, execution.commandId, kind, ordinal++);
154
- const requireTable = (table) => {
155
- const definition = this.schema[table];
156
- if (!definition)
157
- throw new Error(`Unknown local table ${table}`);
158
- return definition.columns;
159
- };
160
- const requireColumns = (table) => {
161
- const columns = snapshot.tables[table]?.columns;
162
- if (columns && Object.keys(requireTable(table)).some(column => !columns.includes(column)))
163
- throw new IncompleteReplicaError(table);
164
- };
165
- const requireComplete = (table) => {
166
- requireTable(table);
167
- reads.add(table);
168
- requireColumns(table);
169
- if (!snapshot.tables[table]?.complete)
170
- throw new IncompleteReplicaError(table);
171
- };
172
- return this.database.transaction(async (tx) => {
173
- // Both the input rows and reducer writes are rolled back on success. The
174
- // only published output is the returned transaction, applied by the SDK.
175
- const seeded = new Set();
176
- const seed = async (table) => {
177
- requireTable(table);
178
- if (seeded.has(table))
179
- return;
180
- seeded.add(table);
181
- for (const row of snapshot.tables[table]?.rows ?? [])
182
- await this.insertRow(tx, table, row, true);
183
- };
184
- const readRow = async (table, id) => {
185
- requireTable(table);
186
- reads.add(table);
187
- requireColumns(table);
188
- await seed(table);
189
- const result = await tx.query(`SELECT * FROM ${quote(table)} WHERE ${quote(this.schema[table].key)} = $1`, [id], queryOptions);
190
- if (!result.rows.length && !snapshot.tables[table]?.complete)
191
- throw new IncompleteReplicaError(table);
192
- return result.rows[0];
193
- };
194
- const query = async (statement, parameters = []) => {
195
- // PostgreSQL parses the actual statement and reports every scanned
196
- // relation, including joins/subqueries. Never infer completeness using
197
- // a regex that could silently miss a nested relation.
198
- const explain = await tx.query(`EXPLAIN (FORMAT JSON) ${statement}`, [...parameters], queryOptions);
199
- const tables = new Set();
200
- const written = new Set();
201
- const inspect = (value) => {
202
- if (Array.isArray(value)) {
203
- value.forEach(inspect);
204
- return;
205
- }
206
- if (!value || typeof value !== "object")
207
- return;
208
- const node = value;
209
- if (node["Node Type"] === "ModifyTable" && typeof node["Relation Name"] === "string")
210
- written.add(node["Relation Name"]);
211
- if (typeof node["Relation Name"] === "string") {
212
- tables.add(node["Relation Name"]);
213
- }
214
- Object.values(node).forEach(inspect);
215
- };
216
- inspect(explain.rows);
217
- for (const table of tables) {
218
- // Only a proven primary-key lookup can use a partial collection.
219
- // PostgreSQL still discovers all relations above; joins, counts,
220
- // subqueries and range reads must have complete input coverage.
221
- const key = this.schema[table]?.key;
222
- const exact = /^SELECT (?:\*|"[A-Za-z_][A-Za-z0-9_]*"(?:,\s*"[A-Za-z_][A-Za-z0-9_]*")*) FROM "([A-Za-z_][A-Za-z0-9_]*)" WHERE "([A-Za-z_][A-Za-z0-9_]*)" = \$(\d+)(?: AND "deletedAt" IS NULL)?(?: LIMIT 1)?\s*;?$/i.exec(statement.trim());
223
- const id = exact ? parameters[Number(exact[3]) - 1] : undefined;
224
- if (tables.size === 1 && exact?.[1] === table && exact[2] === key && snapshot.tables[table]?.rows.some(row => row[key] === id)) {
225
- requireColumns(table);
226
- reads.add(table);
227
- }
228
- else
229
- requireComplete(table);
230
- await seed(table);
231
- }
232
- const before = new Map();
233
- for (const table of written) {
234
- const rows = (await tx.query(`SELECT * FROM ${quote(table)}`, [], queryOptions)).rows;
235
- before.set(table, new Map(rows.map(row => [String(row[this.schema[table].key]), row])));
236
- }
237
- const result = await tx.query(statement, [...parameters], queryOptions);
238
- // Reducer SQL (including data-modifying CTEs) is part of the same
239
- // transaction. Capture its row delta just like typed database writes.
240
- for (const table of written) {
241
- const prior = before.get(table);
242
- const key = this.schema[table].key;
243
- for (const row of (await tx.query(`SELECT * FROM ${quote(table)}`, [], queryOptions)).rows) {
244
- const id = String(row[key]);
245
- const old = prior.get(id);
246
- prior.delete(id);
247
- if (!old)
248
- patches.push({ entity: table, rowId: id, op: "insert", fields: clone(row) });
249
- else {
250
- const fields = Object.fromEntries(Object.entries(row).filter(([column, value]) => JSON.stringify(value) !== JSON.stringify(old[column])));
251
- if (Object.keys(fields).length)
252
- patches.push({ entity: table, rowId: id, op: "patch", fields });
253
- }
254
- }
255
- for (const id of prior.keys())
256
- patches.push({ entity: table, rowId: id, op: "delete" });
257
- }
258
- return result.rows;
259
- };
260
- const context = {
261
- intentEntropy: execution.intentEntropy,
262
- ...clone(execution.identity), now: execution.now,
263
- invocation: {
264
- channel: "ui", rootChannel: "ui", commandId: execution.commandId,
265
- rootCommandId: execution.commandId, artifactHash: execution.artifactHash,
266
- actorAccountId: execution.identity.auth.account?.id ?? null,
267
- actorMemberId: execution.identity.member?.id ?? null, onBehalfOfMemberId: null,
268
- },
269
- db: {
270
- query,
271
- insert: async (table, row, allocation) => {
272
- const columns = requireTable(table);
273
- await seed(table);
274
- const value = clone(row);
275
- const key = this.schema[table].key;
276
- if (value[key] == null)
277
- value[key] = allocation?.generatedId ?? await nextId(`insert:${table}`);
278
- if (typeof value[key] !== "string" || !value[key])
279
- throw new Error("Insert requires a non-empty string id");
280
- if (columns._creationTime && value._creationTime == null)
281
- value._creationTime = execution.now;
282
- const inserted = await this.insertRow(tx, table, value);
283
- patches.push({ entity: table, rowId: value[key], op: "insert", fields: clone(inserted) });
284
- return clone(inserted);
285
- },
286
- update: async (table, id, patch) => {
287
- const columns = requireTable(table);
288
- const key = this.schema[table].key;
289
- if (Object.hasOwn(patch, key))
290
- throw new Error("Reducer update cannot change a row id");
291
- const before = await readRow(table, id);
292
- if (!before)
293
- throw new Error(`Row ${table}/${id} not found`);
294
- const keys = Object.keys(patch);
295
- keys.forEach((key) => { if (!columns[key])
296
- throw new Error(`Unknown column ${table}.${key}`); });
297
- for (const name of keys) {
298
- if (!columns[name].nullable && patch[name] == null)
299
- throw new Error(`Required field ${table}.${name} is missing`);
300
- }
301
- if (!keys.length)
302
- return clone(before);
303
- const updated = await tx.query(`UPDATE ${quote(table)} SET ${keys.map((key, index) => `${quote(key)} = $${index + 1}`).join(", ")} WHERE ${quote(key)} = $${keys.length + 1} RETURNING *`, [...keys.map((key) => patch[key]), id], queryOptions);
304
- patches.push({ entity: table, rowId: id, op: "patch", fields: clone(patch) });
305
- return clone(updated.rows[0]);
306
- },
307
- delete: async (table, id) => {
308
- const before = await readRow(table, id);
309
- if (!before)
310
- return;
311
- await tx.query(`DELETE FROM ${quote(table)} WHERE ${quote(this.schema[table].key)} = $1`, [id]);
312
- patches.push({ entity: table, rowId: id, op: "delete" });
313
- },
314
- deleteMany: async (table, ids) => {
315
- let deleted = 0;
316
- for (const id of new Set(ids)) {
317
- if (typeof id !== "string")
318
- throw new Error("Delete requires a string id");
319
- const before = await readRow(table, id);
320
- if (before) {
321
- await context.db.delete(table, id);
322
- deleted++;
323
- }
324
- }
325
- return { deleted };
326
- },
327
- },
328
- actions: { enqueue: async (path, args) => {
329
- const ordinal = deferredOrdinals.get("action") ?? 0;
330
- deferredOrdinals.set("action", ordinal + 1);
331
- const id = await reducerRowId(context, "deferred:action", ordinal);
332
- deferred.push({ id, kind: "action", path, args: clone(args) });
333
- return id;
334
- } },
335
- scheduler: {
336
- runAfter: async (delay, path, args = {}) => context.scheduler.runAt(execution.now + delay, path, args),
337
- runAt: async (at, path, args = {}) => {
338
- if (!Number.isSafeInteger(at))
339
- throw new Error("Invalid schedule time");
340
- const ordinal = deferredOrdinals.get("schedule") ?? 0;
341
- deferredOrdinals.set("schedule", ordinal + 1);
342
- const id = `job_${await reducerRowId(context, "deferred:schedule", ordinal)}`;
343
- deferred.push({ id, kind: "schedule", path, args: clone(args), at });
344
- return id;
345
- },
346
- },
347
- };
348
- const result = clone(await definition.handler(context, args));
349
- validateValue(definition.options.result, result);
350
- await tx.rollback();
351
- return { result, patches, deferred, readTables: [...reads].sort() };
352
- });
353
- }
354
- async insertRow(tx, table, row, seed = false) {
355
- const { columns, key } = this.schema[table];
356
- if (seed) {
357
- row = Object.fromEntries(Object.entries(row).filter(([name]) => !!columns[name]));
358
- }
359
- const keys = Object.keys(row);
360
- keys.forEach((key) => { if (!columns[key])
361
- throw new Error(`Unknown column ${table}.${key}`); });
362
- if (!keys.length)
363
- throw new Error("Cannot insert an empty local row");
364
- const result = await tx.query(`INSERT INTO ${quote(table)} (${keys.map(quote).join(", ")}) VALUES (${keys.map((_, index) => `$${index + 1}`).join(", ")}) RETURNING *`, keys.map((key) => row[key]), queryOptions);
365
- const value = result.rows[0];
366
- if (!seed)
367
- for (const [name, column] of Object.entries(columns)) {
368
- if (!column.nullable && value[name] == null)
369
- throw new Error(`Required field ${table}.${name} is missing`);
370
- }
371
- return JSON.parse(JSON.stringify(value));
372
- }
373
- }
374
- /** Stable per-intent IDs. The server host must use the identical seed contract. */
375
- export async function deterministicId(scope, commandId, kind, ordinal) {
376
- const bytes = new Uint8Array(await crypto.subtle.digest("SHA-256", new TextEncoder().encode(JSON.stringify([scope, commandId, kind, ordinal]))));
377
- bytes[6] = (bytes[6] & 0x0f) | 0x80;
378
- bytes[8] = (bytes[8] & 0x3f) | 0x80;
379
- const hex = Array.from(bytes.subarray(0, 16), (byte) => byte.toString(16).padStart(2, "0")).join("");
380
- return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
381
32
  }
382
33
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAoB,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AA6ClD,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAC1B;IAArB,YAAqB,KAAa;QAChC,KAAK,CAAC,qBAAqB,KAAK,+DAA+D,CAAC,CAAC;QAD9E,UAAK,GAAL,KAAK,CAAQ;QAEhC,IAAI,CAAC,IAAI,GAAG,w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