@mistriwork/engine 1.0.0-rc.45 → 1.0.0-rc.46

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.
@@ -467,6 +467,10 @@ export interface WriteTransaction {
467
467
  * in this transaction, as a write's rules do, with the step's words. Writes nothing to the record. Only the flows'
468
468
  * own command reaches it, about its own target; a facade that cannot carry it omits it. */
469
469
  tell?(request: TellRequest): Promise<void>;
470
+ /** Internal: something done to a record that changed none of its fields, written to its history in this
471
+ * transaction (a link's revoke, http/recordLinkRoutes.ts). Nothing is written where the record keeps no history; a
472
+ * facade that cannot carry it omits it. */
473
+ noted?(request: NoteRequest): Promise<void>;
470
474
  }
471
475
  /** Several inserts of one table: one statement where the transaction carries a batch, else one at a time, in order. */
472
476
  export declare function insertAll(tx: WriteTransaction, requests: readonly InsertRequest[]): Promise<InsertResult[]>;
@@ -505,6 +509,12 @@ export declare function chunked<T>(rows: readonly T[], weight: (row: T) => numbe
505
509
  export declare function batchedRows(applied: ReadonlyArray<Record<string, unknown>>, stored: ReadonlyArray<Record<string, unknown>>): Record<string, unknown>[];
506
510
  /** A key that matched no row, or more than one: a guarded update's miss is a conflict, any other a refusal. */
507
511
  export declare function refuseUpdateMatches(request: UpdateRequest, count: number): never;
512
+ /** What a record's history is told that no field shows: which record, and what was done, in the words its history says. */
513
+ export interface NoteRequest {
514
+ table: string;
515
+ key: Record<string, string | number>;
516
+ action: string;
517
+ }
508
518
  /** What a flow's notify step tells: whom (an audience a `notify` rule names `on: { flow }`), about which record, and its words. */
509
519
  export interface TellRequest {
510
520
  table: string;
@@ -904,6 +904,7 @@ export class PostgresAdapter {
904
904
  remove: (r) => history.remove(r, base.remove),
905
905
  ...gatheredBatches(base, history),
906
906
  tell: (r) => history.tell(r),
907
+ ...(history.noted ? { noted: (r) => history.noted(r) } : {}),
907
908
  finish: () => finishWriteCapture(history),
908
909
  committed: () => committedWriteCapture(history),
909
910
  triggered: async (change) => history.triggered?.(change),
@@ -997,6 +998,7 @@ export class PostgresAdapter {
997
998
  update: (r) => operations.run(() => writes.update(r)),
998
999
  ...batchesThrough(writes, (work) => operations.run(work)),
999
1000
  ...(writes.tell ? { tell: (r) => operations.run(() => writes.tell(r)) } : {}),
1001
+ ...(writes.noted ? { noted: (r) => operations.run(() => writes.noted(r)) } : {}),
1000
1002
  })));
1001
1003
  await operations.finish();
1002
1004
  await writes.finish();
@@ -1160,6 +1162,7 @@ export class PostgresAdapter {
1160
1162
  update: (r) => operations.run(() => writes.update(r)),
1161
1163
  ...batchesThrough(writes, (work) => operations.run(work)),
1162
1164
  ...(writes.tell ? { tell: (r) => operations.run(() => writes.tell(r)) } : {}),
1165
+ ...(writes.noted ? { noted: (r) => operations.run(() => writes.noted(r)) } : {}),
1163
1166
  };
1164
1167
  // The transaction's own work runs without the hint: a transaction it opens is not this one.
1165
1168
  const out = await withoutWriteAhead(() => withoutSnapshotRead(() => run(Object.freeze(records), journal.open(write, operations))));
@@ -1520,6 +1523,7 @@ export class PostgresAdapter {
1520
1523
  update: (r) => invoke(r, (r) => records.update(r)),
1521
1524
  // Beneath the row scope: the flows' command tells only of its own target, which it read through the scope.
1522
1525
  ...(writes.tell ? { tell: (r) => invoke(r, (r) => writes.tell(r)) } : {}),
1526
+ ...(writes.noted ? { noted: (r) => invoke(r, (r) => writes.noted(r)) } : {}),
1523
1527
  }), journal?.open(write, operations), evidence)));
1524
1528
  await operations.finish();
1525
1529
  await writes.finish();
@@ -1621,6 +1621,7 @@ export class SqliteAdapter {
1621
1621
  : {}),
1622
1622
  // Beneath the row scope: the flows' command tells only of its own target, which it read through the scope.
1623
1623
  ...(history ? { tell: (r) => invoke(r, (r) => history.tell(r)) } : {}),
1624
+ ...(history?.noted ? { noted: (r) => invoke(r, (r) => history.noted(r)) } : {}),
1624
1625
  }), journal?.open(handle, operations, verify ? verifiedStep : undefined), evidence);
1625
1626
  await operations.finish();
1626
1627
  witness?.settle();
@@ -13,7 +13,7 @@
13
13
  * as in the database browser, no write is captured.
14
14
  */
15
15
  import type { DatabaseSync } from 'node:sqlite';
16
- import type { DeleteRequest, DeleteResult, InsertRequest, InsertResult, TellRequest, UpdateRequest, UpdateResult } from './adapter.js';
16
+ import type { DeleteRequest, DeleteResult, InsertRequest, InsertResult, NoteRequest, TellRequest, UpdateRequest, UpdateResult } from './adapter.js';
17
17
  import type { PgQuery } from './postgresPool.js';
18
18
  import type { TriggerChange } from './scoped/triggerProof.js';
19
19
  /** The transaction's writer, by dialect: a capture's own rows join it. */
@@ -47,6 +47,8 @@ interface WriteCapture {
47
47
  remove(request: DeleteRequest, write: (request: DeleteRequest) => Promise<DeleteResult>): Promise<DeleteResult>;
48
48
  /** A flow's notify step (WriteTransaction.tell). */
49
49
  tell(request: TellRequest): Promise<void>;
50
+ /** A record's history told of what changed none of its fields (WriteTransaction.noted); absent where nothing keeps one. */
51
+ noted?(request: NoteRequest): Promise<void>;
50
52
  /**
51
53
  * A row a trigger the App accepts changed, once the proof reached it (scoped/triggerProof.ts): the database wrote
52
54
  * it, not a statement of the transaction, so nothing above passes through the three writes. Kept and announced as
@@ -690,6 +690,8 @@ export interface ServedApp<View extends object = ServedDashboardView | ServedFor
690
690
  ui: ServedAppUi;
691
691
  writableTables?: string[] | false;
692
692
  exportableTables?: string[];
693
+ /** The tables whose records' capability links this reader may revoke from the record page (appPayload.ts). */
694
+ revokesLinks?: string[];
693
695
  viewerRoles?: string[];
694
696
  grantedCommands?: string[];
695
697
  grantedActions?: Record<string, string[]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mistriwork/engine",
3
- "version": "1.0.0-rc.45",
3
+ "version": "1.0.0-rc.46",
4
4
  "description": "The engine both products stand on: the adapters (SQLite, Postgres), the catalog, the query language, keyset pages, the HTTP kit and the shared rules. No React.",
5
5
  "homepage": "https://mistriwork.dev",
6
6
  "bugs": {