@rindle/api-server 0.2.0 → 0.4.2

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/dist/index.d.ts CHANGED
@@ -1,9 +1,14 @@
1
- import type { Ast, MutationEnvelope, NamedQuery, Query } from "@rindle/client";
2
- import type { DematerializeInput, DematerializeOutput, MaterializationPolicy, MaterializeInput, MaterializeOutput, MigrateInput, MigrateOutput, MutationRejection, MutationRejectionOutput, QueryOnceInput, QueryOnceOutput, RindleDaemonClient, RowChangeTxn, RowChangeTxnOutput, SqlRead, SqlReadOutput, SqlStatement, SqlTxn, SqlTxnOutput, StreamMode, WireValue } from "@rindle/daemon-client";
1
+ import type { Ast, ColType, KeyedRow, MutationEnvelope, MutationOp, MutatorCtx, NamedQuery, Query, Schema, SharedMutator, SharedMutatorWithArgs, ServerWriteTx } from "@rindle/client";
2
+ import type { ClaimRoomEpochInput, ClaimRoomEpochOutput, DematerializeInput, DematerializeOutput, MaterializationPolicy, MaterializeInput, MaterializeOutput, MigrateInput, MigrateOutput, MutationRejection, MutationRejectionOutput, MutationSessionBegin, MutationSessionBeginOutput, MutationSessionExec, MutationSessionQuery, MutationSessionRef, QueryOnceInput, QueryOnceOutput, RindleDaemonClient, RoomLmidsInput, RoomLmidsOutput, RowChangeTxn, RowChangeTxnOutput, SqlRead, SqlReadOutput, SqlStatement, SqlTxn, SqlTxnOutput, StreamMode, WireValue } from "@rindle/daemon-client";
3
+ export { isoTx, shared } from "@rindle/client";
4
+ export type { ArgSchema, IsoTx, MutationGen, MutatorCtx, SharedMutator, SharedMutatorWithArgs } from "@rindle/client";
3
5
  export declare const DEFAULT_RINDLE_API_ROUTES: {
4
6
  readonly query: "/api/rindle/query";
5
7
  readonly read: "/api/rindle/read";
6
8
  readonly mutate: "/api/rindle/mutate";
9
+ readonly applyRowChangeTxn: "/api/rindle/apply-row-change-txn";
10
+ readonly claimRoomEpoch: "/api/rindle/claim-room-epoch";
11
+ readonly roomLmids: "/api/rindle/room-lmids";
7
12
  };
8
13
  export type MaybePromise<T> = T | PromiseLike<T>;
9
14
  export interface ApiContext<User> {
@@ -39,12 +44,36 @@ export interface MutationContext<User> {
39
44
  daemon: RindleDaemonClient;
40
45
  request?: unknown;
41
46
  }
47
+ /** The legacy raw-SQL escape hatch (still the surface for relational/authority statements a keyed op
48
+ * can't express — an owner-gated cascade, a `NOT EXISTS` dedup). `exec` accumulates on the daemon
49
+ * backend and executes live on the Postgres backend; `statements` is the collected raw list. */
42
50
  export interface SqlMutationTx {
43
51
  exec(sql: string, params?: WireValue[]): void;
44
52
  readonly statements: readonly SqlStatement[];
45
53
  }
54
+ /** The write handle a server mutator runs against — the ASYNC twin of the client's `MutationTx`. It
55
+ * is both the isomorphic {@link ServerWriteTx} logical surface (insert/update/upsert/insertIgnore/
56
+ * delete/row, rendered to dialect SQL) AND the legacy {@link SqlMutationTx} raw escape hatch. Both
57
+ * backends run reads through the OPEN transaction (read-your-writes): the Postgres backend executes
58
+ * everything live; the daemon backend accumulates writes and lazily upgrades to an interactive
59
+ * mutation session at the first read (DAEMON-INTERACTIVE-TXN-DESIGN.md §5). */
60
+ export interface ServerMutationTx extends ServerWriteTx, SqlMutationTx {
61
+ /** Run a full query (a fluent `Query` or its wire `Ast`) INSIDE the open transaction —
62
+ * read-your-writes, like {@link ServerWriteTx.row} but for arbitrary shapes. Returns the
63
+ * parsed nested result tree: an array for a plural root, an object or `null` for a `.one()`
64
+ * root, with cells in their raw SQLite storage-class representations (the same vocabulary
65
+ * `row` speaks). Daemon backend: compiled by `@rindle/query-compiler`'s sqlite dialect (bind
66
+ * params, NO casts — §5.4) and executed through the mutation session. Postgres backend: lands
67
+ * with the read-compiler catalog integration (POSTGRES-READ-COMPILER-DESIGN.md Phase B). */
68
+ query(q: Ast | Query<any, any, any>): Promise<unknown>;
69
+ }
46
70
  export type ApiMutatorResult = void | SqlStatement[] | SqlTxn;
47
- export type ApiMutator<User, Args> = (tx: SqlMutationTx, args: Args, ctx: MutationContext<User>) => MaybePromise<ApiMutatorResult>;
71
+ /** A server mutator: a plain async function against the live {@link ServerMutationTx}. Two ways to
72
+ * write one (MUTATORS-ISOMORPHIC): drive it directly (the raw escape hatch — an owner-gated cascade,
73
+ * a `NOT EXISTS` dedup — plus a returned `SqlStatement[]`/`SqlTxn`), OR delegate to a SHARED generator
74
+ * (the SAME body the client predicts) via {@link runSharedMutation}, keeping only the server-only
75
+ * authority (arg parse, principal, policy) in the wrapper. */
76
+ export type ApiMutator<User, Args> = (tx: ServerMutationTx, args: Args, ctx: MutationContext<User>) => MaybePromise<ApiMutatorResult>;
48
77
  export type ApiMutators<User> = Record<string, ApiMutator<User, any>>;
49
78
  export interface QueryLeaseRequest<User> {
50
79
  user: User;
@@ -90,6 +119,52 @@ export interface QueryReadResponse {
90
119
  * so the booting client opens its ws to the same warm follower. Absent ⇒ single-daemon. */
91
120
  wsEndpoint?: string;
92
121
  }
122
+ /** The context a {@link MutationBackend} needs to run one mutation inside its transaction. */
123
+ export interface MutationRunInput {
124
+ envelope: MutationEnvelope;
125
+ /** Schema-derived render metadata (from {@link RindleApiServerOptions.schema}). A logical op on a
126
+ * table absent here throws loudly — never a silent dropped write. `{}` when no schema is set. */
127
+ render: RenderIndex;
128
+ /** Invoke the (authorized) mutator against the backend-provided tx. A THROW that is NOT a
129
+ * {@link BackendError} is a BUSINESS rejection (roll the data back, then advance `lmid` alone,
130
+ * §2.4); a {@link BackendError} (a DB-layer failure) is INFRA and rejects the returned promise. */
131
+ run(tx: ServerMutationTx): Promise<void>;
132
+ }
133
+ /** The result of {@link MutationBackend.runMutation}: either the data+lmid committed together, or a
134
+ * business rejection whose data was rolled back but whose `lmid` still advanced (§2.4). */
135
+ export type MutationOutcome = {
136
+ accepted: true;
137
+ output: SqlTxnOutput;
138
+ } | {
139
+ accepted: false;
140
+ reason: string;
141
+ output?: unknown;
142
+ };
143
+ /**
144
+ * Where a mutation runs and who stamps `lmid` — the seam that makes the mutator authoring surface
145
+ * backend-agnostic (`BYO-POSTGRES-LMID-CONTRACT-DESIGN.md` §6; MUTATORS-ISOMORPHIC plan). Two impls
146
+ * ship: {@link daemonBackend} (the default — writes accumulate, one batch to the daemon which stamps
147
+ * `lmid` co-transactionally) and {@link postgresBackend} (a REAL interactive PG transaction — writes
148
+ * and reads execute live, `lmid` committed in the same txn, confirmation riding the CDC loop down).
149
+ *
150
+ * The load-bearing invariant is that a mutation ALWAYS advances the client's `last_mutation_id`:
151
+ * - `runMutation` runs the mutator inside the backend's transaction; on success it advances `lmid`
152
+ * to `envelope.mid` in the SAME atomic unit (OPTIMISTIC-WRITES-DESIGN.md §8.2); on a BUSINESS
153
+ * rejection it rolls the data back but STILL advances `lmid` (§2.4 — else the client's pending
154
+ * queue never drains and the optimistic stack wedges).
155
+ * - `reject` is the pre-flight path (unknown mutator, failed authorization): NO data, `lmid` alone.
156
+ * - An infrastructure failure THROWS from `runMutation` — never a user rejection (the client
157
+ * retries; mid dedup absorbs any applied prefix).
158
+ */
159
+ export interface MutationBackend {
160
+ /** The SQL dialect this backend renders logical ops to (drives placeholder style). */
161
+ readonly dialect: SqlDialect;
162
+ runMutation(input: MutationRunInput): Promise<MutationOutcome>;
163
+ reject(input: {
164
+ envelope: MutationEnvelope;
165
+ reason: string;
166
+ }): Promise<unknown>;
167
+ }
93
168
  export interface PushMutationRequest<User> {
94
169
  user: User;
95
170
  envelope: MutationEnvelope;
@@ -114,6 +189,17 @@ export interface RindleApiRoutes {
114
189
  query: string;
115
190
  read: string;
116
191
  mutate: string;
192
+ applyRowChangeTxn: string;
193
+ claimRoomEpoch: string;
194
+ roomLmids: string;
195
+ }
196
+ /** A room-host reply the transport writes VERBATIM (`status` + JSON `body`): the
197
+ * daemon's fence/conflict/identity semantics ride specific statuses and body shapes
198
+ * the room's `httpAuthority` decodes, so this endpoint trio can't run through the
199
+ * throw-on-error result shapes the viewer endpoints use. */
200
+ export interface RoomHostResponse {
201
+ status: number;
202
+ body: unknown;
117
203
  }
118
204
  /** A named query to keep permanently materialized (warm with zero subscribers). */
119
205
  export interface PinnedQuery {
@@ -129,11 +215,25 @@ export interface PinFanout {
129
215
  }
130
216
  export interface RindleApiServerOptions<User> {
131
217
  daemon: RindleDaemonClient;
218
+ /** Where mutations are applied and `lmid` is stamped ({@link MutationBackend}). Default:
219
+ * `daemonBackend(daemon)` — exactly today's behavior. Pass `postgresBackend(...)` when
220
+ * Postgres is the source of truth (the daemon leg then serves only the read side). */
221
+ backend?: MutationBackend;
222
+ /** The typed schema (`createSchema`/`refineSchema`). Required only when a mutator uses the LOGICAL
223
+ * write vocabulary (`tx.insert`/`update`/`upsert`/`insertIgnore`/`delete`/`row`) — it drives the
224
+ * dialect SQL renderer (column order, pk, quoting). A logical op with no schema configured throws
225
+ * loudly. Pure raw-`tx.exec` mutators do not need it. */
226
+ schema?: Schema;
132
227
  queries?: ApiQueries<User>;
133
228
  runQuery?: RunQuery<User>;
134
229
  mutators?: ApiMutators<User>;
135
230
  authorizeQuery?: Authorizer<AuthorizeQueryInput<User>>;
136
231
  authorizeMutation?: Authorizer<AuthorizeMutationInput<User>>;
232
+ /** The room write-authority gate (§5.3.1): validates the caller is a placed room —
233
+ * the epoch-bound flush credential rides `context.request`, and what it means is
234
+ * the app's to define. The room endpoints are DISABLED (403) until this is set:
235
+ * hosting a write authority is an explicit opt-in, never a default. */
236
+ authorizeRoom?: Authorizer<ApiContext<User>>;
137
237
  routes?: Partial<RindleApiRoutes>;
138
238
  mode?: StreamMode;
139
239
  materializationPolicy?: MaterializationPolicy | ((input: QueryLeaseRequest<User>) => MaybePromise<MaterializationPolicy>);
@@ -196,6 +296,15 @@ export interface RindleApiServer<User> {
196
296
  handleReadJson(body: unknown, context: ApiContext<User>): Promise<QueryReadResponse>;
197
297
  /** Accepts `{envelope}` (one) or `{envelopes: [...]}` (an in-order batch → array reply). */
198
298
  handleMutateJson(body: unknown, context: ApiContext<User>): Promise<PushMutationResponse | PushMutationResponse[]>;
299
+ /** The room's flush (§5.3.1): gate on `authorizeRoom`, forward the txn to the write
300
+ * authority, and pass the store's verdict through VERBATIM — `200 {applied, cv}`,
301
+ * `409 {error:"fenced"|"conflict", …}`, or the loud identity `500`. Write
302
+ * `status` + `body` as-is; the room's `httpAuthority` decodes them. */
303
+ handleApplyRowChangeTxnJson(body: unknown, context: ApiContext<User>): Promise<RoomHostResponse>;
304
+ /** Claim the next placement epoch for a doc (§2.5), same gate + envelope. */
305
+ handleClaimRoomEpochJson(body: unknown, context: ApiContext<User>): Promise<RoomHostResponse>;
306
+ /** The room's boot probe (§3.3), same gate + envelope. */
307
+ handleRoomLmidsJson(body: unknown, context: ApiContext<User>): Promise<RoomHostResponse>;
199
308
  }
200
309
  export type RindleApiErrorCode = "bad-request" | "forbidden" | "not-found" | "rejected";
201
310
  export declare class RindleApiError extends Error {
@@ -227,12 +336,113 @@ export declare class SplitDaemonClient implements RindleDaemonClient {
227
336
  executeSqlTxn(input: SqlTxn): Promise<SqlTxnOutput>;
228
337
  executeSqlRead(input: SqlRead): Promise<SqlReadOutput>;
229
338
  rejectMutation(input: MutationRejection): Promise<MutationRejectionOutput>;
339
+ beginMutationSession(input: MutationSessionBegin): Promise<MutationSessionBeginOutput>;
340
+ execInMutationSession(input: MutationSessionExec): Promise<unknown>;
341
+ queryInMutationSession(input: MutationSessionQuery): Promise<SqlReadOutput>;
342
+ commitMutationSession(input: MutationSessionRef): Promise<SqlTxnOutput>;
343
+ rollbackMutationSession(input: MutationSessionRef): Promise<unknown>;
230
344
  applyRowChangeTxn(input: RowChangeTxn): Promise<RowChangeTxnOutput>;
345
+ claimRoomEpoch(input: ClaimRoomEpochInput): Promise<ClaimRoomEpochOutput>;
346
+ roomLmids(input: RoomLmidsInput): Promise<RoomLmidsOutput>;
231
347
  migrate(input: MigrateInput): Promise<MigrateOutput>;
232
348
  materialize(input: MaterializeInput): Promise<MaterializeOutput>;
233
349
  query(input: QueryOnceInput): Promise<QueryOnceOutput>;
234
350
  dematerialize(input: DematerializeInput): Promise<DematerializeOutput>;
235
351
  }
352
+ /** A SQL dialect for the logical mutation renderer. */
353
+ export interface SqlDialect {
354
+ readonly name: "sqlite" | "postgres";
355
+ /** Render the i-th (1-based) bind placeholder. sqlite: `?`; postgres: `$i`. */
356
+ placeholder(oneBased: number): string;
357
+ /** Optional value coercion hook (e.g. a future SQLite `0/1` boolean). Default: identity. */
358
+ encodeValue?(v: WireValue, type: ColType): WireValue;
359
+ }
360
+ export declare const sqliteDialect: SqlDialect;
361
+ export declare const postgresDialect: SqlDialect;
362
+ /** Per-table metadata the renderer needs (all reachable from a `TableMeta`). */
363
+ export interface TableRenderMeta {
364
+ /** Columns in schema (wire) order — the stable INSERT column list + completeness check. */
365
+ columns: string[];
366
+ /** Primary-key column NAMES — the WHERE / ON CONFLICT target / SET partition. */
367
+ pkNames: string[];
368
+ /** Column name → declared type (only consulted by {@link SqlDialect.encodeValue}). */
369
+ types: Record<string, ColType>;
370
+ }
371
+ export type RenderIndex = Record<string, TableRenderMeta>;
372
+ /** Build the {@link RenderIndex} from a typed schema (`schema.tables[name]` is a `TableMeta`). */
373
+ export declare function buildRenderIndex(schema: Schema): RenderIndex;
374
+ /** Render one {@link MutationOp} to a `{sql, params}` for the dialect, or `null` for a no-op (an
375
+ * `update` whose row names only pk columns — nothing to SET, matching the client's no-op edit). */
376
+ export declare function renderOp(op: MutationOp, meta: TableRenderMeta, dialect: SqlDialect): SqlStatement | null;
377
+ /** Render a point read (`tx.row`) — `SELECT <cols> FROM "T" WHERE <pk>` — for read-your-writes. */
378
+ export declare function renderPointRead(table: string, pk: KeyedRow, meta: TableRenderMeta, dialect: SqlDialect): SqlStatement;
379
+ /** Thrown (wrapping the driver error) by a server tx's DB calls, so the seam can tell an INFRA
380
+ * failure (retry) from a mutator-body throw (business rejection). */
381
+ export declare class BackendError extends Error {
382
+ readonly driverError: unknown;
383
+ constructor(driverError: unknown);
384
+ }
385
+ /**
386
+ * The default {@link MutationBackend}. A pure-write mutator keeps the historical shape: writes
387
+ * ACCUMULATE and ship as ONE batch to `/execute-sql-txn`, which stamps `lmid` co-transactionally
388
+ * (and `/reject-mutation` advances it past a rejected mid) — byte-identical behavior. A
389
+ * READ-bearing mutator lazily upgrades to an interactive mutation session
390
+ * (DAEMON-INTERACTIVE-TXN-DESIGN.md): reads are read-your-writes through the open transaction
391
+ * (PG parity), the commit stamps `lmid` in the same atomic unit, and a begin-absorbed replay
392
+ * short-circuits without re-running the body.
393
+ */
394
+ export declare function daemonBackend(daemon: RindleDaemonClient): MutationBackend;
395
+ /** The query surface a {@link PostgresPlugger} transaction exposes. `exec` runs one statement;
396
+ * `query` returns rows keyed by column name (read-your-own-writes inside the txn). */
397
+ export interface PgQuery {
398
+ exec(sql: string, params?: unknown[]): Promise<void>;
399
+ query(sql: string, params?: unknown[]): Promise<Array<Record<string, unknown>>>;
400
+ }
401
+ /** The thin driver adapter that keeps `pg` / `postgres.js` out of this package's dependencies
402
+ * (`BYO-POSTGRES-LMID-CONTRACT-DESIGN.md` §6.2): run `fn` inside ONE transaction — commit on
403
+ * resolve, roll back on throw. {@link pgPoolPlugger} adapts a node-postgres `Pool`. */
404
+ export interface PostgresPlugger {
405
+ transaction<T>(fn: (q: PgQuery) => Promise<T>): Promise<T>;
406
+ }
407
+ export interface PostgresBackendOptions {
408
+ /** Rewrite each MUTATOR statement's SQL before it runs (never the lmid upsert). The intended
409
+ * use is dialect bridging for a dual-topology app whose mutators are written SQLite-style:
410
+ * pass {@link questionToDollarParams} to convert `?` placeholders to `$1..$n`. */
411
+ rewriteSql?: (sql: string) => string;
412
+ }
413
+ /**
414
+ * The BYO-Postgres {@link MutationBackend} (`BYO-POSTGRES-LMID-CONTRACT-DESIGN.md` §6.3): one PG
415
+ * transaction runs the mutator's statements and ALWAYS upserts `_rindle_client_mutations` —
416
+ * the upsert sits outside any acceptance guard by construction, so the §2.4 footgun (a rejection
417
+ * that forgets to advance `lmid` and wedges the client's pending queue) cannot be written.
418
+ *
419
+ * Confirmation does NOT come from this call's response: the lmid row rides the same PG commit
420
+ * through CDC → relay → follower and reaches the client in the same coherent release as the
421
+ * data (§8.2 relocated upstream). A rejection's `reason` still returns on the HTTP reply, but
422
+ * nothing rejection-shaped travels the replication path — the optimistic prediction snaps back
423
+ * when the advanced `lmid` arrives.
424
+ */
425
+ export declare function postgresBackend(plugger: PostgresPlugger, opts?: PostgresBackendOptions): MutationBackend;
426
+ /** The slice of a node-postgres `Pool` the plugger needs — structural, so `pg` stays a
427
+ * dependency of the APP, never of this package. */
428
+ export interface PgPoolLike {
429
+ connect(): Promise<{
430
+ query(sql: string, params?: unknown[]): Promise<{
431
+ rows: Array<Record<string, unknown>>;
432
+ }>;
433
+ release(err?: unknown): void;
434
+ }>;
435
+ }
436
+ /** Adapt a node-postgres `Pool` (or anything pool-shaped) to a {@link PostgresPlugger}:
437
+ * one client per transaction, `BEGIN`/`COMMIT` bracketing, `ROLLBACK` + rethrow on failure. */
438
+ export declare function pgPoolPlugger(pool: PgPoolLike): PostgresPlugger;
439
+ /**
440
+ * Rewrite SQLite-style `?` positional placeholders to Postgres `$1..$n`, for mutators written
441
+ * once and run against either backend (pass as {@link PostgresBackendOptions.rewriteSql}).
442
+ * Skips `'…'` string literals (with `''` escapes), `"…"` quoted identifiers, `--` line comments,
443
+ * and non-nested C-style block comments. Do not mix `?` and `$n` styles in one statement.
444
+ */
445
+ export declare function questionToDollarParams(sql: string): string;
236
446
  export declare function defineApiQueries<User, Q extends ApiQueries<User>>(queries: Q): Q;
237
447
  /**
238
448
  * Register a list of co-located client {@link NamedQuery `defineQuery`} values as the server's query
@@ -254,6 +464,72 @@ export declare function defineApiQueries<User, Q extends ApiQueries<User>>(queri
254
464
  */
255
465
  export declare function registerQueries<User>(queries: readonly NamedQuery<any, any, any>[]): ApiQueries<User>;
256
466
  export declare function defineApiMutators<User, M extends ApiMutators<User>>(mutators: M): M;
467
+ /**
468
+ * Bulk-register a SHARED (generator) mutator registry as server mutators — the mutator twin of
469
+ * {@link registerQueries} (which does the same for co-located `defineQuery` values). Each shared
470
+ * mutator carries its own arg validator (`shared(schema, gen)`), so this wraps every one with the
471
+ * UNIVERSAL server triad and nothing else: parse the UNTRUSTED wire args (its `.args`), map the server
472
+ * {@link MutationContext} to the shared {@link MutatorCtx} principal, and drive the SAME body the
473
+ * client predicts ({@link runSharedMutation}). The point is that a shared mutator whose server run
474
+ * adds NO authority beyond that triad needs no hand-written wrapper.
475
+ *
476
+ * Server-only AUTHORITY the client cannot predict (a title guard, an owner-gated cascade, a
477
+ * `NOT EXISTS` dedup) stays an explicit {@link ApiMutator} that OVERRIDES the auto-wrapped default —
478
+ * spread this first, then the overrides win by key:
479
+ *
480
+ * ```ts
481
+ * mutators: defineApiMutators({
482
+ * ...sharedApiMutators(sharedMutators, (ctx) => ({ user: requireUser(ctx.user) })),
483
+ * createIssue: withTitleGuard(sharedMutators.createIssue), // + server-only policy
484
+ * deleteIssue: async (tx, raw, ctx) => { ... }, // raw owner-gated cascade
485
+ * }),
486
+ * ```
487
+ */
488
+ export declare function sharedApiMutators<User>(registry: Record<string, SharedMutatorWithArgs<any>>, principal: (ctx: MutationContext<User>) => MutatorCtx): ApiMutators<User>;
257
489
  export declare function queryResultToAst(result: ApiQueryResult): Ast;
490
+ /** One exemplar invocation for {@link dumpQueryShapes} — the `args`/`user` a query is built with.
491
+ * Literal values never matter to the dump (shapes are deduped with literals stripped); what an
492
+ * exemplar buys is BRANCH coverage, so supply one per code path a query function can take
493
+ * (an optional filter present/absent, each enum axis, …). */
494
+ export interface ShapeExemplar<User = unknown> {
495
+ args?: unknown;
496
+ user?: User;
497
+ }
498
+ /** The query-shapes document `rindle indices suggest` consumes: the app's synced tables (name +
499
+ * primary key) and one wire AST per structurally distinct shape a registered query can build. */
500
+ export interface QueryShapesDoc {
501
+ tables: Array<{
502
+ name: string;
503
+ primaryKey: string[];
504
+ }>;
505
+ queries: Array<{
506
+ name: string;
507
+ ast: Ast;
508
+ }>;
509
+ }
510
+ /**
511
+ * Dump every registered named query's wire AST — feeder 1 ("exemplar enumeration") of
512
+ * `rindle indices suggest` (docs/INDEXING.md applied mechanically to the query set).
513
+ *
514
+ * Because named queries are FUNCTIONS of `(args, ctx)`, one query can build structurally
515
+ * different ASTs on different args; each exemplar invocation contributes its shape, and shapes
516
+ * that differ only in literal values (a limit, a filter string) dedupe to one entry. A query
517
+ * with no configured exemplars is invoked once with no args. The registry is the app's whole
518
+ * server-side query surface, so the resulting document is the complete static shape set —
519
+ * modulo arg-value-dependent branches, which need an exemplar (or runtime shape recording) to
520
+ * surface.
521
+ */
522
+ export declare function dumpQueryShapes<User>(opts: {
523
+ schema: Schema;
524
+ queries: ApiQueries<User>;
525
+ exemplars?: Partial<Record<string, ReadonlyArray<ShapeExemplar<User>>>>;
526
+ }): Promise<QueryShapesDoc>;
258
527
  export declare function createRindleApiServer<User = unknown>(opts: RindleApiServerOptions<User>): RindleApiServer<User>;
528
+ /** Run a SHARED generator mutator (the SAME body the client predicts) against a live server
529
+ * transaction (MUTATORS-ISOMORPHIC): bind the tier-agnostic {@link isoTx} factory and drive it —
530
+ * each yielded logical op renders + runs against `tx` (dialect SQL, per backend), each `tx.row`
531
+ * suspends for read-your-writes, and `tx.all` fans out. A server mutator uses this to delegate its
532
+ * write body after parsing untrusted args and applying its server-only authority (principal, policy).
533
+ * A mutator-body throw remains a business rejection; a DB failure propagates as infra. */
534
+ export declare function runSharedMutation<Args, Ctx extends MutatorCtx>(mutator: SharedMutator<Args, Ctx>, args: Args, ctx: Ctx, tx: ServerMutationTx): Promise<void>;
259
535
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,gBAAgB,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC/E,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,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