@rindle/client 0.3.1 → 0.4.3
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 +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/mutation-ops.d.ts +200 -0
- package/dist/mutation-ops.d.ts.map +1 -0
- package/dist/mutation-ops.js +79 -0
- package/dist/mutation-ops.js.map +1 -0
- package/dist/schema.d.ts +147 -15
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +90 -4
- package/dist/schema.js.map +1 -1
- package/dist/ssr.d.ts +14 -0
- package/dist/ssr.d.ts.map +1 -1
- package/dist/ssr.js +15 -0
- package/dist/ssr.js.map +1 -1
- package/dist/store.d.ts +7 -3
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +29 -1
- package/src/mutation-ops.ts +264 -0
- package/src/schema.ts +260 -24
- package/src/ssr.ts +21 -0
- package/src/store.ts +7 -3
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,9 @@ export * from "./store.ts";
|
|
|
6
6
|
export * from "./ssr.ts";
|
|
7
7
|
export { resolveChange, subRow } from "./resolve.ts";
|
|
8
8
|
export type { NamedRow, ResolvedChange } from "./resolve.ts";
|
|
9
|
+
export type { KeyedRow, MutationOp, ServerWriteTx } from "./mutation-ops.ts";
|
|
10
|
+
export { defineMutators, driveMutationAsync, driveMutationSync, isGeneratorMutator, isoTx, shared, } from "./mutation-ops.ts";
|
|
11
|
+
export type { ArgSchema, AsyncEffectExec, BatchEffect, IsoTx, IsoTxOf, MutationGen, MutatorCtx, QueryArg, QueryEffect, QueryResultRow, ReadEffect, SharedMutator, SharedMutatorWithArgs, SyncEffectExec, YieldEffect, } from "./mutation-ops.ts";
|
|
9
12
|
export { stableKey } from "./key.ts";
|
|
10
13
|
export { COMPARATOR_VERSION, compareNumber, compareRows, compareString, compareValue } from "./compare.ts";
|
|
11
14
|
export type { Backend, BackendDevObserver, BackendServerDelta, ChangeEvent, ColType, FlatChange, FlatOp, Mutation, MutationEnvelope, NormalizedEvent, NormalizedOp, NormalizedSource, NormalizedTableSchema, OptimisticSource, PathSeg, ProgressFrame, QueryId, RemoteQuery, ResultType, WireNode, WireProjection, WireRel, WireSchema, WireValue, } from "./types.ts";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AAEzB,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACrD,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE7D,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE3G,YAAY,EACV,OAAO,EACP,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,EACX,OAAO,EACP,UAAU,EACV,MAAM,EACN,QAAQ,EACR,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,OAAO,EACP,aAAa,EACb,OAAO,EACP,WAAW,EACX,UAAU,EACV,QAAQ,EACR,cAAc,EACd,OAAO,EACP,UAAU,EACV,SAAS,GACV,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAG9F,YAAY,EACV,SAAS,EACT,GAAG,EACH,KAAK,EACL,S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,OAAO,EACP,WAAW,EACX,UAAU,EACV,QAAQ,EACR,cAAc,EACd,OAAO,EACP,UAAU,EACV,SAAS,GACV,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAG9F,YAAY,EACV,SAAS,EACT,GAAG,EACH,KAAK,EACL,SAAS,EACT,kBAAkB,EAClB,WAAW,EACX,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,aAAa,GACd,MAAM,UAAU,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
// @rindle/client — the backend-agnostic flat-change client core: typed schema, query builder,
|
|
2
2
|
// comparator, Backend seam, and the ArrayView contract. (The ArrayView folding impl + the
|
|
3
3
|
// Store/backend wiring land in later slices.)
|
|
4
|
-
export * from "./schema.js"; // table/columns/primaryKey, createSchema/extendSchema, string/number/boolean/json, Col, RowOf, Row, TableDef, tableSpec, SCHEMA
|
|
4
|
+
export * from "./schema.js"; // table/columns/primaryKey, createSchema/extendSchema, refineTable/refineSchema, string/number/boolean/json, Col, RowOf, Row, InsertOf, Insert, insertPlan, insertCell, TableDef, tableSpec, SCHEMA
|
|
5
5
|
export * from "./operators.js"; // eq/ne/gt/ge/lt/le/like/notLike/ilike/notIlike/inList/notInList/is/isNot, and/or, Pred, Cond, Arg
|
|
6
6
|
export * from "./query.js"; // Query, QueryRoot, queries/newQueryBuilder, defineQuery/NamedQuery, exists, notExists, defineFragment/Fragment/FragmentRef/isFragment
|
|
7
7
|
export * from "./view.js"; // ArrayView, SingularArrayView, FlatArrayView, SingularView, ViewTypes
|
|
8
8
|
export * from "./store.js"; // Store, WriteTx, AssembledNode, DehydratedQuery, DehydratedState
|
|
9
9
|
export * from "./ssr.js"; // createServerStore, ServerStore, OneShotBackend, OneShotQueryFn, OneShotResult, ServerStoreOptions
|
|
10
10
|
export { resolveChange, subRow } from "./resolve.js"; // positional FlatChange → named rows (inverse of the wire encoder)
|
|
11
|
+
// shared (generator) mutator seam — one body, sync on the client + async on the server
|
|
12
|
+
export { defineMutators, driveMutationAsync, driveMutationSync, isGeneratorMutator, isoTx, shared, } from "./mutation-ops.js";
|
|
11
13
|
export { stableKey } from "./key.js"; // canonical viewKey for an AST (shared with @rindle/react)
|
|
12
14
|
export { COMPARATOR_VERSION, compareNumber, compareRows, compareString, compareValue } from "./compare.js";
|
|
13
15
|
export { CLIENT_MUTATIONS_SCHEMA, CLIENT_MUTATIONS_TABLE, LMID_QUERY_NAME } from "./types.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,0FAA0F;AAC1F,8CAA8C;AAE9C,cAAc,aAAa,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,0FAA0F;AAC1F,8CAA8C;AAE9C,cAAc,aAAa,CAAC,CAAC,oMAAoM;AACjO,cAAc,gBAAgB,CAAC,CAAC,mGAAmG;AACnI,cAAc,YAAY,CAAC,CAAC,uIAAuI;AACnK,cAAc,WAAW,CAAC,CAAC,uEAAuE;AAClG,cAAc,YAAY,CAAC,CAAC,kEAAkE;AAC9F,cAAc,UAAU,CAAC,CAAC,oGAAoG;AAE9H,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC,CAAC,mEAAmE;AAIzH,uFAAuF;AACvF,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,KAAK,EACL,MAAM,GACP,MAAM,mBAAmB,CAAC;AAmB3B,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC,CAAC,2DAA2D;AAEjG,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AA6B3G,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import type { Ast } from "./ast.ts";
|
|
2
|
+
import type { ColsMap, InsertOf, PkColsOf, PkMap, PkOf, Schema, UpdateOf } from "./schema.ts";
|
|
3
|
+
import type { WireValue } from "./types.ts";
|
|
4
|
+
/** A keyed row: column name → cell. The ergonomic write shape (validated against the schema at
|
|
5
|
+
* runtime). JSON columns carry their raw JSON string (a {@link WireValue}), never a parsed object. */
|
|
6
|
+
export type KeyedRow = Record<string, WireValue>;
|
|
7
|
+
/** One structured write intent — the discriminated union that mirrors the write half of the client
|
|
8
|
+
* `MutationTx` 1:1. Keyed (column-name addressed), so it is independent of column order. */
|
|
9
|
+
export type MutationOp = {
|
|
10
|
+
kind: "insert";
|
|
11
|
+
table: string;
|
|
12
|
+
row: KeyedRow;
|
|
13
|
+
} | {
|
|
14
|
+
kind: "upsert";
|
|
15
|
+
table: string;
|
|
16
|
+
row: KeyedRow;
|
|
17
|
+
} | {
|
|
18
|
+
kind: "insertIgnore";
|
|
19
|
+
table: string;
|
|
20
|
+
row: KeyedRow;
|
|
21
|
+
} | {
|
|
22
|
+
kind: "update";
|
|
23
|
+
table: string;
|
|
24
|
+
row: KeyedRow;
|
|
25
|
+
} | {
|
|
26
|
+
kind: "delete";
|
|
27
|
+
table: string;
|
|
28
|
+
pk: KeyedRow;
|
|
29
|
+
};
|
|
30
|
+
/** The ASYNC server-side write surface a mutator runs against. Semantically the twin of the client's
|
|
31
|
+
* synchronous `MutationTx` write methods — same names, same keyed-row arguments — but every op is a
|
|
32
|
+
* Promise so a Postgres backend can execute it live against an open transaction (read-your-writes).
|
|
33
|
+
* A rindle/daemon backend resolves writes immediately (accumulate) and serves `row` from committed
|
|
34
|
+
* state. `insert` requires every column; `update`/`delete` require the pk columns. */
|
|
35
|
+
export interface ServerWriteTx {
|
|
36
|
+
/** Insert a FULL row (every column named; missing or unknown columns throw). */
|
|
37
|
+
insert(table: string, row: KeyedRow): Promise<void>;
|
|
38
|
+
/** Update the row identified by the pk columns; only the named non-pk columns change. A missing
|
|
39
|
+
* row is a NO-OP. */
|
|
40
|
+
update(table: string, row: KeyedRow): Promise<void>;
|
|
41
|
+
/** Insert, or fully replace when the pk already exists (a FULL row, like `insert`). */
|
|
42
|
+
upsert(table: string, row: KeyedRow): Promise<void>;
|
|
43
|
+
/** Insert a FULL row, or do nothing if the pk already exists (the SQL twin of the client
|
|
44
|
+
* `if (!tx.row(pk)) tx.insert(row)` pattern). */
|
|
45
|
+
insertIgnore(table: string, row: KeyedRow): Promise<void>;
|
|
46
|
+
/** Delete the row identified by the pk columns. A missing row is a NO-OP. */
|
|
47
|
+
delete(table: string, pk: KeyedRow): Promise<void>;
|
|
48
|
+
/** Read one row by primary key, through the OPEN transaction on both backends
|
|
49
|
+
* (read-your-writes: live on Postgres; via an interactive mutation session on the daemon,
|
|
50
|
+
* DAEMON-INTERACTIVE-TXN-DESIGN.md §5.3). */
|
|
51
|
+
row(table: string, pk: KeyedRow): Promise<KeyedRow | undefined>;
|
|
52
|
+
}
|
|
53
|
+
/** A point read a generator mutator yields; the driver resolves it and feeds the row back through
|
|
54
|
+
* `gen.next(row)`. Read-your-writes on every tier: the client reads its local engine, and both
|
|
55
|
+
* server backends read the open transaction (the daemon via an interactive mutation session). */
|
|
56
|
+
export type ReadEffect = {
|
|
57
|
+
kind: "row";
|
|
58
|
+
table: string;
|
|
59
|
+
pk: KeyedRow;
|
|
60
|
+
};
|
|
61
|
+
/** A fan-out a generator mutator yields: run several effects "together". The server driver resolves
|
|
62
|
+
* them with `Promise.all`; the client driver runs them in array order (already synchronous). Results
|
|
63
|
+
* return in the SAME order on both tiers, so the mutator stays deterministic. The `yield` evaluates
|
|
64
|
+
* to `(KeyedRow | undefined)[]` at runtime (cast it — the generator's single next-type is a row). */
|
|
65
|
+
export type BatchEffect = {
|
|
66
|
+
kind: "all";
|
|
67
|
+
effects: readonly YieldEffect[];
|
|
68
|
+
};
|
|
69
|
+
/** A row returned by a {@link QueryEffect}: column name → cell, plus each materialized relationship
|
|
70
|
+
* name → its nested row(s) — an array (a plural relationship) or a single row / `null` (a `.one()`
|
|
71
|
+
* relationship). Recursive. Presented identically on both tiers (a `view.data` row of the same
|
|
72
|
+
* query). */
|
|
73
|
+
export type QueryResultRow = {
|
|
74
|
+
[key: string]: WireValue | QueryResultRow | QueryResultRow[];
|
|
75
|
+
};
|
|
76
|
+
/** What {@link IsoTx.query} accepts: a query handle whose `.ast()` lowers to the wire {@link Ast} —
|
|
77
|
+
* exactly what the typed query builder produces (`newQueryBuilder(schema).<table>…`, the tier-agnostic
|
|
78
|
+
* server-scope builder both tiers can construct because it performs no I/O). Structural so the seam
|
|
79
|
+
* need not carry the builder's heavy generics. */
|
|
80
|
+
export type QueryArg = {
|
|
81
|
+
ast(): Ast;
|
|
82
|
+
};
|
|
83
|
+
/** A full-shape read a generator mutator yields — a `where`/`orderBy`/`limit`/join query over the
|
|
84
|
+
* state this mutator is mutating (read-your-writes, like {@link ReadEffect} but an arbitrary shape).
|
|
85
|
+
* Evaluates to {@link QueryResultRow}`[]` — ALWAYS an array of the matching rows, in the query's
|
|
86
|
+
* order, on BOTH tiers (a root `.one()` is not unwrapped here: take `[0]`). The single next-type is
|
|
87
|
+
* a row, so cast the yield (`(yield tx.query(q)) as unknown as QueryResultRow[]`), same as `all`. */
|
|
88
|
+
export type QueryEffect = {
|
|
89
|
+
kind: "query";
|
|
90
|
+
query: QueryArg;
|
|
91
|
+
};
|
|
92
|
+
/** Everything a generator mutator may `yield`: a write {@link MutationOp}, a point {@link ReadEffect},
|
|
93
|
+
* a full-query {@link QueryEffect}, or a {@link BatchEffect} fan-out. */
|
|
94
|
+
export type YieldEffect = MutationOp | ReadEffect | BatchEffect | QueryEffect;
|
|
95
|
+
/** The tier-AGNOSTIC effect factory a generator mutator writes against. Every method just BUILDS an
|
|
96
|
+
* effect to `yield` — it performs no I/O and holds no state, so the single {@link isoTx} instance is
|
|
97
|
+
* shared by every mutator on both tiers; only the driver differs. `insert`/`upsert`/`insertIgnore`
|
|
98
|
+
* take a FULL row; `update`/`delete` take the pk columns (`update` adds the columns to change). */
|
|
99
|
+
export interface IsoTx<S extends ColsMap = ColsMap, P extends Record<string, string> = PkMap<S>> {
|
|
100
|
+
/** Insert a FULL row — nullable columns may be omitted (filled `null`, design 206 §6.2/§7). */
|
|
101
|
+
insert<N extends keyof S & string>(table: N, row: InsertOf<S[N]>): MutationOp;
|
|
102
|
+
/** Update the row identified by its pk columns (REQUIRED); only the named non-pk columns change. */
|
|
103
|
+
update<N extends keyof S & string>(table: N, row: UpdateOf<S[N], PkColsOf<S, P, N>>): MutationOp;
|
|
104
|
+
/** Insert, or fully replace on pk conflict (a FULL row, like {@link IsoTx.insert}). */
|
|
105
|
+
upsert<N extends keyof S & string>(table: N, row: InsertOf<S[N]>): MutationOp;
|
|
106
|
+
/** Insert a FULL row, or do nothing if the pk already exists. */
|
|
107
|
+
insertIgnore<N extends keyof S & string>(table: N, row: InsertOf<S[N]>): MutationOp;
|
|
108
|
+
/** Delete the row identified by its pk columns. */
|
|
109
|
+
delete<N extends keyof S & string>(table: N, pk: PkOf<S[N], PkColsOf<S, P, N>>): MutationOp;
|
|
110
|
+
/** Read one row by primary key (read-your-writes). */
|
|
111
|
+
row<N extends keyof S & string>(table: N, pk: PkOf<S[N], PkColsOf<S, P, N>>): ReadEffect;
|
|
112
|
+
/** Run a full query (`where`/`orderBy`/`limit`/join) over the state this mutator is mutating —
|
|
113
|
+
* read-your-writes, like {@link row} but for arbitrary shapes. Pass a query from the tier-agnostic
|
|
114
|
+
* builder, e.g. `tx.query(q.issue.where("ownerId", "=", ctx.user))` where `q = newQueryBuilder(schema)`.
|
|
115
|
+
* The `yield` evaluates to {@link QueryResultRow}`[]` (cast it — the generator's single next-type is a row). */
|
|
116
|
+
query(query: QueryArg): QueryEffect;
|
|
117
|
+
all(effects: readonly YieldEffect[]): BatchEffect;
|
|
118
|
+
}
|
|
119
|
+
/** The one shared effect factory (stateless — see {@link IsoTx}). Its methods just BUILD a
|
|
120
|
+
* {@link MutationOp}, so the single instance serves every schema; the generic {@link IsoTx} view is
|
|
121
|
+
* applied at the authoring site (a `json<T>` cell is a parsed object here and is stringified by the
|
|
122
|
+
* funnels, {@link toCell}), hence the cast — the runtime shape is schema-agnostic. */
|
|
123
|
+
export declare const isoTx: IsoTx;
|
|
124
|
+
/** The minimal per-invocation context a shared mutator sees on BOTH tiers: the acting principal. The
|
|
125
|
+
* server injects its AUTHENTICATED user; the client injects its local user. (The server's own
|
|
126
|
+
* `MutationContext` is a superset of this.) */
|
|
127
|
+
export interface MutatorCtx {
|
|
128
|
+
user: string;
|
|
129
|
+
}
|
|
130
|
+
/** What a generator mutator IS: `yield tx.<op>()` on every side effect; a `yield tx.row()` expression
|
|
131
|
+
* evaluates to the row. Neither sync nor async — the tier's driver decides, which is what lets one
|
|
132
|
+
* body run synchronously on the client and against a live async transaction on the server. */
|
|
133
|
+
export type MutationGen = Generator<YieldEffect, void, KeyedRow | undefined>;
|
|
134
|
+
/** A generator (isomorphic) mutator, shared verbatim by both tiers: the client trusts typed `args`,
|
|
135
|
+
* the server parses untrusted args into `Args` before invoking. */
|
|
136
|
+
export type SharedMutator<Args, Ctx extends MutatorCtx = MutatorCtx> = (tx: IsoTx, args: Args, ctx: Ctx) => MutationGen;
|
|
137
|
+
/** The minimal arg validator a shared mutator can carry so the SERVER can parse UNTRUSTED wire args
|
|
138
|
+
* before driving it (the client trusts its typed callsites and never calls this). Structural on
|
|
139
|
+
* purpose — a zod schema satisfies it as-is — so `@rindle/client` stays validator-library-agnostic. */
|
|
140
|
+
export interface ArgSchema<Args> {
|
|
141
|
+
parse(raw: unknown): Args;
|
|
142
|
+
}
|
|
143
|
+
/** A shared mutator that CARRIES its own arg validator, co-located at the def site (`shared(schema,
|
|
144
|
+
* gen)`). The client registers it exactly like a bare generator mutator — the `.args` validator is
|
|
145
|
+
* inert there (typed callsites skip the parse); the server ({@link runSharedMutation}, via the
|
|
146
|
+
* api-server's `sharedApiMutators`) reads `.args` to parse untrusted wire args before driving the
|
|
147
|
+
* SAME body. */
|
|
148
|
+
export type SharedMutatorWithArgs<Args, Ctx extends MutatorCtx = MutatorCtx> = SharedMutator<Args, Ctx> & {
|
|
149
|
+
args: ArgSchema<Args>;
|
|
150
|
+
};
|
|
151
|
+
/** Co-locate a shared (generator) mutator with the validator for its args — pairing the arg SHAPE
|
|
152
|
+
* with the body that consumes it at ONE site, so neither tier restates it (the client derives its
|
|
153
|
+
* callsite type from `Args`; the server parses untrusted args through `.args`). Returns the SAME
|
|
154
|
+
* generator function with an `args` property attached (`Object.assign` mutates + returns it), so the
|
|
155
|
+
* registered value is byte-for-byte what the client drove before: {@link isGeneratorMutator} still
|
|
156
|
+
* detects it and it still `satisfies ClientRegistry`. */
|
|
157
|
+
export declare function shared<Args, Ctx extends MutatorCtx = MutatorCtx>(args: ArgSchema<Args>, run: SharedMutator<Args, Ctx>): SharedMutatorWithArgs<Args, Ctx>;
|
|
158
|
+
/** Bind a schema to the mutator authoring surface: `const { shared } = defineMutators(schema)`.
|
|
159
|
+
*
|
|
160
|
+
* The returned `shared` is the schema-typed twin of the bare {@link shared} — its `tx` is an
|
|
161
|
+
* {@link IsoTx} parameterized by THIS schema, so `tx.insert`/`update`/`upsert`/`insertIgnore`/`delete`
|
|
162
|
+
* check the table name, every column name, each column's value type, nullable-omit on inserts, and
|
|
163
|
+
* the exact primary-key columns on `update`/`delete` — all at compile time. It registers identically
|
|
164
|
+
* to the bare form (same runtime value, still `satisfies ClientRegistry`, still an isomorphic
|
|
165
|
+
* generator the server drives): only the AUTHORING types tighten. `schema` is read for its TYPE only
|
|
166
|
+
* (never at runtime). Reads (`yield tx.row(...)`) stay loosely typed — a generator's single
|
|
167
|
+
* next-type can't carry a per-table row. */
|
|
168
|
+
/** The typed {@link IsoTx} for a given schema — `IsoTxOf<typeof schema>`. Use it to annotate a helper
|
|
169
|
+
* that a mutator body passes its `tx` to (e.g. `const ensureUser = (tx: IsoTxOf<typeof schema>, …)`),
|
|
170
|
+
* so the helper gets the same table/column/pk typing the `defineMutators` `shared` callback does. */
|
|
171
|
+
export type IsoTxOf<Sch extends Schema> = Sch extends Schema<infer S, infer P> ? IsoTx<S, P> : never;
|
|
172
|
+
export declare function defineMutators<S extends ColsMap, P extends Record<string, string>>(_schema: Schema<S, P>): {
|
|
173
|
+
shared<Args, Ctx extends MutatorCtx = MutatorCtx>(args: ArgSchema<Args>, run: (tx: IsoTx<S, P>, args: Args, ctx: Ctx) => MutationGen): SharedMutatorWithArgs<Args, Ctx>;
|
|
174
|
+
};
|
|
175
|
+
/** True iff `fn` is a generator function (a shared/isomorphic mutator) rather than a plain function —
|
|
176
|
+
* the driver accepts both forms. Detected structurally (native `GeneratorFunction`). */
|
|
177
|
+
export declare function isGeneratorMutator(fn: unknown): fn is (...args: never[]) => MutationGen;
|
|
178
|
+
/** A tier's SYNCHRONOUS effect executor (the browser wasm engine): apply a write, resolve a read —
|
|
179
|
+
* both immediate. */
|
|
180
|
+
export interface SyncEffectExec {
|
|
181
|
+
apply(op: MutationOp): void;
|
|
182
|
+
read(table: string, pk: KeyedRow): KeyedRow | undefined;
|
|
183
|
+
query(q: QueryArg): QueryResultRow[];
|
|
184
|
+
}
|
|
185
|
+
/** Drive a generator mutator SYNCHRONOUSLY (the client, inside the wasm write transaction). Each
|
|
186
|
+
* yielded write applies immediately; each read (point or query) is resolved and fed back; a batch
|
|
187
|
+
* runs in order. */
|
|
188
|
+
export declare function driveMutationSync(gen: MutationGen, exec: SyncEffectExec): void;
|
|
189
|
+
/** A tier's ASYNCHRONOUS effect executor (the server transaction): every op is a Promise. */
|
|
190
|
+
export interface AsyncEffectExec {
|
|
191
|
+
apply(op: MutationOp): Promise<void>;
|
|
192
|
+
read(table: string, pk: KeyedRow): Promise<KeyedRow | undefined>;
|
|
193
|
+
query(q: QueryArg): Promise<QueryResultRow[]>;
|
|
194
|
+
}
|
|
195
|
+
/** Drive a generator mutator ASYNCHRONOUSLY (the server, against the open transaction). Writes are
|
|
196
|
+
* awaited (harmless: a single interactive Postgres connection serializes statements anyway, and the
|
|
197
|
+
* daemon backend resolves them instantly), reads (point or query) suspend, and a batch fans out with
|
|
198
|
+
* `Promise.all`. */
|
|
199
|
+
export declare function driveMutationAsync(gen: MutationGen, exec: AsyncEffectExec): Promise<void>;
|
|
200
|
+
//# sourceMappingURL=mutation-ops.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutation-ops.d.ts","sourceRoot":"","sources":["../src/mutation-ops.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC9F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;uGACuG;AACvG,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAEjD;6FAC6F;AAC7F,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,QAAQ,CAAA;CAAE,GAChD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,QAAQ,CAAA;CAAE,GAChD;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,QAAQ,CAAA;CAAE,GACtD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,C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AI,CAAC;IAC5B,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IACxD,KAAK,CAAC,CAAC,EAAE,QAAQ,GAAG,cAAc,EAAE,CAAC;CACtC;AAED;;qBAEqB;AACrB,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,cAAc,GAAG,IAAI,CAS9E;AAED,6FAA6F;AAC7F,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAAC;IACjE,KAAK,CAAC,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;CAC/C;AAED;;;qBAGqB;AACrB,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAS/F"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// Isomorphic mutation ops — the backend-agnostic "rindle mutation" vocabulary
|
|
2
|
+
// (MUTATORS-ISOMORPHIC plan). A mutator names WHAT it writes (insert/update/upsert/
|
|
3
|
+
// insertIgnore/delete over a keyed row), not HOW — the server renders dialect SQL and the
|
|
4
|
+
// client applies to its local engine. This lives in `@rindle/client` (the leaf both tiers
|
|
5
|
+
// import); the SQL renderer that consumes it is server-only (`@rindle/api-server`).
|
|
6
|
+
/** The one shared effect factory (stateless — see {@link IsoTx}). Its methods just BUILD a
|
|
7
|
+
* {@link MutationOp}, so the single instance serves every schema; the generic {@link IsoTx} view is
|
|
8
|
+
* applied at the authoring site (a `json<T>` cell is a parsed object here and is stringified by the
|
|
9
|
+
* funnels, {@link toCell}), hence the cast — the runtime shape is schema-agnostic. */
|
|
10
|
+
export const isoTx = {
|
|
11
|
+
insert: (table, row) => ({ kind: "insert", table, row }),
|
|
12
|
+
update: (table, row) => ({ kind: "update", table, row }),
|
|
13
|
+
upsert: (table, row) => ({ kind: "upsert", table, row }),
|
|
14
|
+
insertIgnore: (table, row) => ({ kind: "insertIgnore", table, row }),
|
|
15
|
+
delete: (table, pk) => ({ kind: "delete", table, pk }),
|
|
16
|
+
row: (table, pk) => ({ kind: "row", table, pk }),
|
|
17
|
+
query: (query) => ({ kind: "query", query }),
|
|
18
|
+
all: (effects) => ({ kind: "all", effects }),
|
|
19
|
+
};
|
|
20
|
+
/** Co-locate a shared (generator) mutator with the validator for its args — pairing the arg SHAPE
|
|
21
|
+
* with the body that consumes it at ONE site, so neither tier restates it (the client derives its
|
|
22
|
+
* callsite type from `Args`; the server parses untrusted args through `.args`). Returns the SAME
|
|
23
|
+
* generator function with an `args` property attached (`Object.assign` mutates + returns it), so the
|
|
24
|
+
* registered value is byte-for-byte what the client drove before: {@link isGeneratorMutator} still
|
|
25
|
+
* detects it and it still `satisfies ClientRegistry`. */
|
|
26
|
+
export function shared(args, run) {
|
|
27
|
+
return Object.assign(run, { args });
|
|
28
|
+
}
|
|
29
|
+
export function defineMutators(_schema) {
|
|
30
|
+
return {
|
|
31
|
+
shared(args, run) {
|
|
32
|
+
// The typed `tx: IsoTx<S, P>` is authoring-only; the driver invokes with the loose `isoTx`
|
|
33
|
+
// singleton (cast at the call boundary, like the bare `shared`), so the value is registry-shaped.
|
|
34
|
+
return Object.assign(run, { args });
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/** True iff `fn` is a generator function (a shared/isomorphic mutator) rather than a plain function —
|
|
39
|
+
* the driver accepts both forms. Detected structurally (native `GeneratorFunction`). */
|
|
40
|
+
export function isGeneratorMutator(fn) {
|
|
41
|
+
return (typeof fn === "function" &&
|
|
42
|
+
fn.constructor?.name === "GeneratorFunction");
|
|
43
|
+
}
|
|
44
|
+
/** Drive a generator mutator SYNCHRONOUSLY (the client, inside the wasm write transaction). Each
|
|
45
|
+
* yielded write applies immediately; each read (point or query) is resolved and fed back; a batch
|
|
46
|
+
* runs in order. */
|
|
47
|
+
export function driveMutationSync(gen, exec) {
|
|
48
|
+
const run = (eff) => {
|
|
49
|
+
if (eff.kind === "row")
|
|
50
|
+
return exec.read(eff.table, eff.pk);
|
|
51
|
+
if (eff.kind === "query")
|
|
52
|
+
return exec.query(eff.query);
|
|
53
|
+
if (eff.kind === "all")
|
|
54
|
+
return eff.effects.map(run);
|
|
55
|
+
exec.apply(eff);
|
|
56
|
+
return undefined;
|
|
57
|
+
};
|
|
58
|
+
for (let step = gen.next(); !step.done; step = gen.next(run(step.value)))
|
|
59
|
+
;
|
|
60
|
+
}
|
|
61
|
+
/** Drive a generator mutator ASYNCHRONOUSLY (the server, against the open transaction). Writes are
|
|
62
|
+
* awaited (harmless: a single interactive Postgres connection serializes statements anyway, and the
|
|
63
|
+
* daemon backend resolves them instantly), reads (point or query) suspend, and a batch fans out with
|
|
64
|
+
* `Promise.all`. */
|
|
65
|
+
export async function driveMutationAsync(gen, exec) {
|
|
66
|
+
const run = async (eff) => {
|
|
67
|
+
if (eff.kind === "row")
|
|
68
|
+
return exec.read(eff.table, eff.pk);
|
|
69
|
+
if (eff.kind === "query")
|
|
70
|
+
return (await exec.query(eff.query));
|
|
71
|
+
if (eff.kind === "all")
|
|
72
|
+
return (await Promise.all(eff.effects.map(run)));
|
|
73
|
+
await exec.apply(eff);
|
|
74
|
+
return undefined;
|
|
75
|
+
};
|
|
76
|
+
for (let step = gen.next(); !step.done; step = gen.next(await run(step.value)))
|
|
77
|
+
;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=mutation-ops.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutation-ops.js","sourceRoot":"","sources":["../src/mutation-ops.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,oFAAoF;AACpF,0FAA0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,EAAE,IAAqB;IAC9E,MAAM,GAAG,GAAG,KAAK,EAAE,GAAgB,EAAiC,EAAE;QACpE,IAAI,GAAG,CAAC,IAAI,KAAK,KAAK;YAAE,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;QAC5D,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO;YAAE,OAAO,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAoC,CAAC;QAClG,IAAI,GAAG,CAAC,IAAI,KAAK,KAAK;YAAE,OAAO,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAoC,CAAC;QAC5G,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACtB,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;IACF,KAAK,IAAI,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAAC,CAAC;AAClF,CAAC"}
|
package/dist/schema.d.ts
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import type { Arg, Cond } from "./operators.ts";
|
|
2
|
-
import type { ColType } from "./types.ts";
|
|
3
|
-
/** A column descriptor. `type` drives the comparator + JSON parsing; `__t` is a phantom.
|
|
2
|
+
import type { ColType, WireValue } from "./types.ts";
|
|
3
|
+
/** A column descriptor. `type` drives the comparator + JSON parsing; `__t` is a phantom. A
|
|
4
|
+
* nullable column is a `Col<T | null>` — that is the ONLY thing nullability changes at the type
|
|
5
|
+
* level, so `RowOf` (and the field-condition factory) widen automatically.
|
|
6
|
+
*
|
|
7
|
+
* `optional` is the runtime companion of that phantom: set by {@link ColBuilder.nullable}, it is
|
|
8
|
+
* what the write funnels read to make a nullable column omittable from an insert (filled with
|
|
9
|
+
* `null`, design 206 §6.2). It mirrors the engine's `ColumnDef.optional`
|
|
10
|
+
* (`pragma_table_info.notnull == 0`); absent ⇒ `NOT NULL` / required. */
|
|
4
11
|
export interface Col<T> {
|
|
5
12
|
readonly type: ColType;
|
|
13
|
+
readonly optional?: boolean;
|
|
6
14
|
readonly __t?: T;
|
|
7
15
|
}
|
|
8
16
|
export type ColT<X> = X extends Col<infer T> ? T : never;
|
|
@@ -10,16 +18,26 @@ export type AnyCols = Record<string, Col<unknown>>;
|
|
|
10
18
|
export type RowOf<C extends AnyCols> = {
|
|
11
19
|
[K in keyof C]: ColT<C[K]>;
|
|
12
20
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
21
|
+
/** The chainable form returned by the column factories: a {@link Col} plus `.nullable()`.
|
|
22
|
+
*
|
|
23
|
+
* `.nullable()` widens the column's value type to `T | null` — its `Row<…>` field becomes
|
|
24
|
+
* `T | null` — and sets the runtime {@link Col.optional} marker so it may be omitted from an insert
|
|
25
|
+
* (design 206 §6.2). `rindle schema gen` emits `.nullable()` for every nullable (non-`NOT NULL`) SQL
|
|
26
|
+
* column; you can also call it by hand on a local-only table's columns. It is idempotent and stays
|
|
27
|
+
* chainable. */
|
|
28
|
+
export interface ColBuilder<T> extends Col<T> {
|
|
29
|
+
nullable(): ColBuilder<T | null>;
|
|
30
|
+
}
|
|
31
|
+
export declare const string: <T extends string = string>() => ColBuilder<T>;
|
|
32
|
+
export declare const number: <T extends number = number>() => ColBuilder<T>;
|
|
33
|
+
export declare const boolean: () => ColBuilder<boolean>;
|
|
34
|
+
export declare const json: <T = unknown>() => ColBuilder<T>;
|
|
17
35
|
/** Metadata key on a {@link TableDef} (a `unique symbol`, so no column name collides). */
|
|
18
36
|
export declare const SCHEMA: unique symbol;
|
|
19
|
-
export interface TableMeta<N extends string = string, C extends AnyCols = AnyCols> {
|
|
37
|
+
export interface TableMeta<N extends string = string, C extends AnyCols = AnyCols, PK extends string = string> {
|
|
20
38
|
readonly name: N;
|
|
21
39
|
readonly columns: C;
|
|
22
|
-
readonly primaryKey: readonly
|
|
40
|
+
readonly primaryKey: readonly PK[];
|
|
23
41
|
/** A **local-only** table (`201-LOCAL-ONLY-TABLES-DESIGN.md`): client-authoritative,
|
|
24
42
|
* never synced/tracked/rebased. The single marker the whole design keys off (§4) — it is
|
|
25
43
|
* immutable for the table's lifetime (N2) and never crosses the wire (C2). Absent ⇒ an
|
|
@@ -33,8 +51,8 @@ export interface TableOptions {
|
|
|
33
51
|
* `201-LOCAL-ONLY-TABLES-DESIGN.md`. */
|
|
34
52
|
local?: boolean;
|
|
35
53
|
}
|
|
36
|
-
export type TableDef<N extends string, C extends AnyCols> = {
|
|
37
|
-
readonly [SCHEMA]: TableMeta<N, C>;
|
|
54
|
+
export type TableDef<N extends string, C extends AnyCols, PK extends string = string> = {
|
|
55
|
+
readonly [SCHEMA]: TableMeta<N, C, PK>;
|
|
38
56
|
} & {
|
|
39
57
|
readonly [K in keyof C]: (arg: Arg<ColT<C[K]>>) => Cond<RowOf<C>>;
|
|
40
58
|
};
|
|
@@ -49,11 +67,52 @@ export type AnyTable = TableLike<AnyCols>;
|
|
|
49
67
|
* whole-table ergonomic form of {@link RowOf}, so app code derives its row interfaces from
|
|
50
68
|
* the schema instead of hand-maintaining a parallel twin. */
|
|
51
69
|
export type Row<T extends AnyTable> = RowOf<T[typeof SCHEMA]["columns"]>;
|
|
70
|
+
/** Flatten an intersection of mapped types into a single object type (preserving `?`/`readonly`) so
|
|
71
|
+
* {@link InsertOf} reads as one clean shape in editor hovers, not `A & B`. */
|
|
72
|
+
type Simplify<T> = {
|
|
73
|
+
[K in keyof T]: T[K];
|
|
74
|
+
};
|
|
75
|
+
/** True for the top types `unknown`/`any` (`unknown extends any` too), where `[null] extends [T]` is
|
|
76
|
+
* vacuously true and so can't tell a `.nullable()` apart. */
|
|
77
|
+
type IsTop<T> = unknown extends T ? true : false;
|
|
78
|
+
/** Whether column `X` may be OMITTED from an insert: it admits `null` at the type level — EXCLUDING
|
|
79
|
+
* the top types. A bare `json()` is `json<unknown>()`, and `unknown | null` collapses back to
|
|
80
|
+
* `unknown`, erasing whether `.nullable()` was applied; treating it as required is the safe
|
|
81
|
+
* direction (a `NOT NULL` json column is never wrongly made optional). Declare `json<T>()` to make a
|
|
82
|
+
* nullable json column omittable. The runtime companion is `Col.optional` (design 206 §6.2/§7). */
|
|
83
|
+
type InsertOptional<X> = IsTop<ColT<X>> extends true ? false : [null] extends [ColT<X>] ? true : false;
|
|
84
|
+
/** The INSERT shape of a column map: {@link RowOf} with every NULLABLE column made OPTIONAL (`?`) —
|
|
85
|
+
* it may be omitted and is filled with `null` by both write funnels (design 206 §6.2/§7). `NOT NULL`
|
|
86
|
+
* columns stay required. The insert-side twin of {@link RowOf}, mirroring Drizzle's `$inferInsert`
|
|
87
|
+
* vs `$inferSelect` split. */
|
|
88
|
+
export type InsertOf<C extends AnyCols> = Simplify<{
|
|
89
|
+
[K in keyof C as InsertOptional<C[K]> extends true ? never : K]: ColT<C[K]>;
|
|
90
|
+
} & {
|
|
91
|
+
[K in keyof C as InsertOptional<C[K]> extends true ? K : never]?: ColT<C[K]>;
|
|
92
|
+
}>;
|
|
93
|
+
/** The insert type of a table def: `Insert<typeof issue>` → `{ id: string; … assignee?: string | null }`.
|
|
94
|
+
* The whole-table ergonomic form of {@link InsertOf} (the insert-side twin of {@link Row}). */
|
|
95
|
+
export type Insert<T extends AnyTable> = InsertOf<T[typeof SCHEMA]["columns"]>;
|
|
96
|
+
/** The exact PRIMARY-KEY columns of a table (each typed), required — the identity a `delete`/`row`,
|
|
97
|
+
* and the WHERE half of an `update`, take. `PK` is the table's pk-column union (the schema's `__pk`). */
|
|
98
|
+
export type PkOf<C extends AnyCols, PK extends string> = {
|
|
99
|
+
[K in PK & keyof C]: ColT<C[K & keyof C]>;
|
|
100
|
+
};
|
|
101
|
+
/** The UPDATE shape of a table: its {@link PkOf primary-key columns} REQUIRED (they identify the row)
|
|
102
|
+
* plus every non-pk column OPTIONAL (`?`) and typed — a nullable one stays `T | null` (settable to
|
|
103
|
+
* null), a `NOT NULL` one is `T`. Omitted non-pk columns are left unchanged. */
|
|
104
|
+
export type UpdateOf<C extends AnyCols, PK extends string> = Simplify<PkOf<C, PK> & {
|
|
105
|
+
[K in Exclude<keyof C, PK>]?: ColT<C[K]>;
|
|
106
|
+
}>;
|
|
107
|
+
/** The primary-key column union for table `N` of a schema, read from its `__pk` map `P` and narrowed
|
|
108
|
+
* to `N`'s actual columns (falling back to all columns when `P` doesn't name `N` — e.g. the loose
|
|
109
|
+
* default schema). Feeds {@link PkOf}/{@link UpdateOf} in the typed mutator tx. */
|
|
110
|
+
export type PkColsOf<S extends ColsMap, P extends Record<string, string>, N extends keyof S> = (N extends keyof P ? P[N] : keyof S[N] & string) & keyof S[N] & string;
|
|
52
111
|
/** `table("issue").columns({ id: string(), … }).primaryKey("id")`. Pass `{ local: true }` for a
|
|
53
112
|
* {@link TableMeta.local local-only} table (`201-LOCAL-ONLY-TABLES-DESIGN.md`). */
|
|
54
113
|
export declare function table<N extends string>(name: N, opts?: TableOptions): {
|
|
55
114
|
columns<C extends AnyCols>(cols: C): {
|
|
56
|
-
primaryKey<K extends keyof C & string>(...keys: K[]): TableDef<N, C>;
|
|
115
|
+
primaryKey<K extends keyof C & string>(...keys: K[]): TableDef<N, C, K>;
|
|
57
116
|
};
|
|
58
117
|
};
|
|
59
118
|
/** Read a table's metadata (columns / PK / name). */
|
|
@@ -62,12 +121,24 @@ export declare function tableMeta(t: AnyTable): TableMeta;
|
|
|
62
121
|
export type SchemaOf<T extends readonly AnyTable[]> = {
|
|
63
122
|
[E in T[number] as E[typeof SCHEMA]["name"]]: E[typeof SCHEMA]["columns"];
|
|
64
123
|
};
|
|
124
|
+
/** name → its primary-key column union, derived from the tables array (the PK captured by the
|
|
125
|
+
* `primaryKey(...)` builder). Powers the mutator tx's typed `update`/`delete`/`row` pk args. */
|
|
126
|
+
export type PkMapOf<T extends readonly AnyTable[]> = {
|
|
127
|
+
[E in T[number] as E[typeof SCHEMA]["name"]]: E[typeof SCHEMA]["primaryKey"][number];
|
|
128
|
+
};
|
|
65
129
|
/** name → columns, the resolved schema map carried in the {@link Schema} type. */
|
|
66
130
|
export type ColsMap = Record<string, AnyCols>;
|
|
67
|
-
|
|
131
|
+
/** name → (some subset of its column names): the loose shape a {@link Schema}'s pk-map satisfies. The
|
|
132
|
+
* fallback when a schema wasn't built through {@link createSchema} — every column could be the pk. */
|
|
133
|
+
export type PkMap<S extends ColsMap> = {
|
|
134
|
+
[N in keyof S]: keyof S[N] & string;
|
|
135
|
+
};
|
|
136
|
+
export interface Schema<S extends ColsMap = ColsMap, P extends Record<string, string> = PkMap<S>> {
|
|
68
137
|
readonly tables: Readonly<Record<string, TableMeta>>;
|
|
69
138
|
/** Phantom carrying name→columns for query-root inference (never read at runtime). */
|
|
70
139
|
readonly __cols: S;
|
|
140
|
+
/** Phantom carrying name→pk-column-union for the typed mutator tx (never read at runtime). */
|
|
141
|
+
readonly __pk: P;
|
|
71
142
|
}
|
|
72
143
|
/** Table-name prefixes reserved by the engine for SYNTHETIC tables — `__agg_<fnv>` aggregate
|
|
73
144
|
* bases (`AGGREGATE-SYNC-DESIGN.md` §3.3) and `_rindle_*` system tables (e.g. the lmid table).
|
|
@@ -81,7 +152,7 @@ export declare const RESERVED_TABLE_PREFIXES: readonly ["__agg_", "_rindle_"];
|
|
|
81
152
|
export declare function isReservedTableName(name: string): boolean;
|
|
82
153
|
export declare function createSchema<const T extends readonly AnyTable[]>(opts: {
|
|
83
154
|
tables: T;
|
|
84
|
-
}): Schema<SchemaOf<T>>;
|
|
155
|
+
}): Schema<SchemaOf<T>, PkMapOf<T>>;
|
|
85
156
|
/** Extend a generated/synced schema with client-authoritative local-only tables.
|
|
86
157
|
*
|
|
87
158
|
* This is the ergonomic path for SQL-first apps: keep `schema.gen.ts` fully generated, define
|
|
@@ -89,9 +160,46 @@ export declare function createSchema<const T extends readonly AnyTable[]>(opts:
|
|
|
89
160
|
* client. The added tables MUST be `table(name, { local: true })`: `extendSchema` deliberately
|
|
90
161
|
* refuses to append ordinary synced tables, because those need to come from daemon introspection
|
|
91
162
|
* (`rindle schema gen`) so the server and client cannot drift. */
|
|
92
|
-
export declare function extendSchema<S extends ColsMap, const T extends readonly AnyTable[]>(base: Schema<S>, opts: {
|
|
163
|
+
export declare function extendSchema<S extends ColsMap, P extends Record<string, string>, const T extends readonly AnyTable[]>(base: Schema<S, P>, opts: {
|
|
93
164
|
tables: T;
|
|
94
|
-
}): Schema<S & SchemaOf<T>>;
|
|
165
|
+
}): Schema<S & SchemaOf<T>, P & PkMapOf<T>>;
|
|
166
|
+
/** Per-column narrowings for {@link refineTable}: each entry must keep the column's kind and narrow
|
|
167
|
+
* its TS type (`Col<T2>` with `T2 extends T`) — `json<Meta>()` on a json column, a literal-union
|
|
168
|
+
* `string<"a" | "b">()` on a string column. Kind changes are rejected (cross-kind at compile time,
|
|
169
|
+
* same-phantom kind flips like `string()` on a json column at runtime). */
|
|
170
|
+
export type ColRefinements<C extends AnyCols> = {
|
|
171
|
+
readonly [K in keyof C]?: Col<ColT<C[K]>>;
|
|
172
|
+
};
|
|
173
|
+
/** `C` with the columns named in `R` re-typed to their refined `Col`s. */
|
|
174
|
+
export type RefinedCols<C extends AnyCols, R extends ColRefinements<C>> = {
|
|
175
|
+
[K in keyof C]: K extends keyof R ? (R[K] extends Col<unknown> ? R[K] : C[K]) : C[K];
|
|
176
|
+
};
|
|
177
|
+
/** Narrow a generated table's column TYPES without touching its runtime shape.
|
|
178
|
+
*
|
|
179
|
+
* Returns the SAME def, re-typed (identity, after validating that every refined column exists and
|
|
180
|
+
* keeps its kind) — so conditions built from it, `rel(...)`s anchored on it, and `Row<typeof t>`
|
|
181
|
+
* all see the narrowed types. Pass the result to {@link refineSchema} so query roots narrow too. */
|
|
182
|
+
export declare function refineTable<N extends string, C extends AnyCols, R extends ColRefinements<C>>(base: TableDef<N, C>, cols: R): TableDef<N, RefinedCols<C, R>>;
|
|
183
|
+
/** A table def acceptable to {@link refineSchema} over `Schema<S>`: its NAME must be one of `S`'s
|
|
184
|
+
* tables (a def for an unknown table is a compile error at the call site). */
|
|
185
|
+
export type RefinableTable<S extends ColsMap> = {
|
|
186
|
+
readonly [SCHEMA]: TableMeta<Extract<keyof S, string>, AnyCols>;
|
|
187
|
+
};
|
|
188
|
+
/** `S` with each table named in `T` re-typed to that def's (refined) columns. (The inner
|
|
189
|
+
* `extends AnyCols` guard is how the checker proves the remapped `SchemaOf<T>[K]` is a column
|
|
190
|
+
* map while `T` is still generic; it always holds for a concrete `T`.) */
|
|
191
|
+
export type RefinedColsMap<S extends ColsMap, T extends readonly AnyTable[]> = {
|
|
192
|
+
[K in keyof S]: K extends keyof SchemaOf<T> ? (SchemaOf<T>[K] extends AnyCols ? SchemaOf<T>[K] : S[K]) : S[K];
|
|
193
|
+
};
|
|
194
|
+
/** Swap {@link refineTable}-narrowed table defs into a generated schema, re-typing those tables for
|
|
195
|
+
* everything downstream of the schema (`newQueryBuilder`/`queries` roots, store row types).
|
|
196
|
+
*
|
|
197
|
+
* Runtime-validated identity: each def must name a table already in the schema and match its
|
|
198
|
+
* runtime shape exactly (same columns, kinds, primary key, and locality) — refinement narrows TS
|
|
199
|
+
* types, never what's on the wire. Composes with {@link extendSchema} in either order. */
|
|
200
|
+
export declare function refineSchema<S extends ColsMap, P extends Record<string, string>, const T extends readonly RefinableTable<S>[]>(base: Schema<S, P>, opts: {
|
|
201
|
+
tables: T;
|
|
202
|
+
}): Schema<RefinedColsMap<S, T>, P>;
|
|
95
203
|
/** Whether `table` is a {@link TableMeta.local local-only} table in `schema` (an unknown table
|
|
96
204
|
* reads as non-local). The single locality predicate the backends key off. */
|
|
97
205
|
export declare function isLocalTable<S extends ColsMap>(schema: Schema<S>, table: string): boolean;
|
|
@@ -135,6 +243,30 @@ export declare function tableSpec(meta: TableMeta): {
|
|
|
135
243
|
columns: string[];
|
|
136
244
|
primaryKey: number[];
|
|
137
245
|
};
|
|
246
|
+
/** A table's insert-completeness plan, derived once from its `Col` markers and shared by BOTH write
|
|
247
|
+
* funnels — the client `trackingTx` and the server `renderOp` — so their required-sets can't drift
|
|
248
|
+
* (design 206 §6.1/§6.2). A `NOT NULL` column is `required`; a nullable column (`.nullable()` set
|
|
249
|
+
* `Col.optional`) may be omitted and is filled with `null` (see {@link insertCell}). PK columns are
|
|
250
|
+
* never nullable (introspection forces them non-null), so they are always required. */
|
|
251
|
+
export interface InsertPlan {
|
|
252
|
+
/** Every column, in wire order. */
|
|
253
|
+
readonly columns: string[];
|
|
254
|
+
/** Columns that MUST be present on a full insert — the non-nullable ones. */
|
|
255
|
+
readonly required: string[];
|
|
256
|
+
/** The nullable (omittable-to-null) columns, for a fast membership test in the fill. */
|
|
257
|
+
readonly nullable: ReadonlySet<string>;
|
|
258
|
+
}
|
|
259
|
+
/** Derive a table's {@link InsertPlan} from its column markers. */
|
|
260
|
+
export declare function insertPlan(meta: TableMeta): InsertPlan;
|
|
261
|
+
/** The cell a full insert writes for column `c`: the given value, or `null` when a nullable column
|
|
262
|
+
* is omitted (design 206 §6.2). The caller's completeness check ({@link InsertPlan.required})
|
|
263
|
+
* guarantees a non-nullable column is present, so its omission never reaches here. */
|
|
264
|
+
export declare function insertCell(row: Record<string, WireValue>, c: string): WireValue;
|
|
265
|
+
/** Encode a keyed-row cell to its wire {@link WireValue} for a column KIND — the one place both write
|
|
266
|
+
* funnels stringify a `json<T>` object (the typed mutator surface / design 206 §7). An
|
|
267
|
+
* already-stringified json value (a `string`) or any non-json cell passes through unchanged, so a
|
|
268
|
+
* mutator may pass EITHER a parsed object OR a JSON string. Mirrors `store.positionalize`. */
|
|
269
|
+
export declare function toCell(v: WireValue | object, type: ColType): WireValue;
|
|
138
270
|
/** The client's per-table flat schema (name + column order + PK indices), the shape a
|
|
139
271
|
* normalized `hello` advertises (NORMALIZED-CHANGES-DESIGN.md §3). Used to validate a
|
|
140
272
|
* server hello against the CLIENT's own typed schema so a column-order / PK skew is caught
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAErD;;;;;;;0EAO0E;AAC1E,MAAM,WAAW,GAAG,CAAC,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;CAClB;AACD,MAAM,MAAM,IAAI,CAAC,CAAC,IAAI,CAAC,SAAS,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AACzD,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;AACnD,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,OAAO,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC;AAEtE;;;;;;iBAMiB;AACjB,MAAM,WAAW,UAAU,CAAC,CAAC,CAAE,SAAQ,GAAG,CAAC,CAAC,CAAC;IAC3C,QAAQ,IAAI,UAAU,CAAC,CAAC,GAA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