@rindle/client 0.1.0-rc.5
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/LICENSE +201 -0
- package/README.md +65 -0
- package/dist/ast.d.ts +83 -0
- package/dist/ast.d.ts.map +1 -0
- package/dist/ast.js +5 -0
- package/dist/ast.js.map +1 -0
- package/dist/compare.d.ts +17 -0
- package/dist/compare.d.ts.map +1 -0
- package/dist/compare.js +81 -0
- package/dist/compare.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/key.d.ts +2 -0
- package/dist/key.d.ts.map +1 -0
- package/dist/key.js +26 -0
- package/dist/key.js.map +1 -0
- package/dist/operators.d.ts +39 -0
- package/dist/operators.d.ts.map +1 -0
- package/dist/operators.js +45 -0
- package/dist/operators.js.map +1 -0
- package/dist/query.d.ts +280 -0
- package/dist/query.d.ts.map +1 -0
- package/dist/query.js +348 -0
- package/dist/query.js.map +1 -0
- package/dist/schema.d.ts +111 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +92 -0
- package/dist/schema.js.map +1 -0
- package/dist/ssr.d.ts +73 -0
- package/dist/ssr.d.ts.map +1 -0
- package/dist/ssr.js +66 -0
- package/dist/ssr.js.map +1 -0
- package/dist/store.d.ts +90 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +225 -0
- package/dist/store.js.map +1 -0
- package/dist/types.d.ts +250 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +20 -0
- package/dist/types.js.map +1 -0
- package/dist/view.d.ts +88 -0
- package/dist/view.d.ts.map +1 -0
- package/dist/view.js +294 -0
- package/dist/view.js.map +1 -0
- package/package.json +36 -0
- package/src/ast.ts +94 -0
- package/src/compare.ts +85 -0
- package/src/index.ts +57 -0
- package/src/key.ts +23 -0
- package/src/operators.ts +68 -0
- package/src/query.ts +734 -0
- package/src/schema.ts +181 -0
- package/src/ssr.ts +115 -0
- package/src/store.ts +279 -0
- package/src/types.ts +234 -0
- package/src/view.ts +348 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Named value-operators (`eq`/`gt`/`like`/…) + boolean combinators (`or`/`and`) for the
|
|
2
|
+
// query builder. Operators are VALUE-ONLY — the value type `V` is inferred from the value,
|
|
3
|
+
// and the FIELD is bound separately (by `where.<field>(…)` or `table.<field>(…)`), so
|
|
4
|
+
// `or`/`exists` need no closure (WASM-CLIENT-DESIGN.md §6).
|
|
5
|
+
const PRED = Symbol("rindle.pred");
|
|
6
|
+
function mk(op, value) {
|
|
7
|
+
return { [PRED]: true, op, value };
|
|
8
|
+
}
|
|
9
|
+
export function isPred(x) {
|
|
10
|
+
return typeof x === "object" && x !== null && x[PRED] === true;
|
|
11
|
+
}
|
|
12
|
+
export const eq = (v) => mk("=", v);
|
|
13
|
+
export const ne = (v) => mk("!=", v);
|
|
14
|
+
export const gt = (v) => mk(">", v);
|
|
15
|
+
export const ge = (v) => mk(">=", v);
|
|
16
|
+
export const lt = (v) => mk("<", v);
|
|
17
|
+
export const le = (v) => mk("<=", v);
|
|
18
|
+
export const like = (pattern) => mk("LIKE", pattern);
|
|
19
|
+
export const notLike = (pattern) => mk("NOT LIKE", pattern);
|
|
20
|
+
export const ilike = (pattern) => mk("ILIKE", pattern);
|
|
21
|
+
export const notIlike = (pattern) => mk("NOT ILIKE", pattern);
|
|
22
|
+
export const inList = (values) => mk("IN", values);
|
|
23
|
+
export const notInList = (values) => mk("NOT IN", values);
|
|
24
|
+
export const is = (v) => mk("IS", v);
|
|
25
|
+
export const isNot = (v) => mk("IS NOT", v);
|
|
26
|
+
/** Build a `simple` condition from a field name + (predicate | bare value). */
|
|
27
|
+
export function fieldCondition(field, arg) {
|
|
28
|
+
const op = isPred(arg) ? arg.op : "=";
|
|
29
|
+
const value = isPred(arg) ? arg.value : arg;
|
|
30
|
+
return {
|
|
31
|
+
type: "simple",
|
|
32
|
+
op,
|
|
33
|
+
left: { type: "column", name: field },
|
|
34
|
+
right: { type: "literal", value },
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/** All children must hold. */
|
|
38
|
+
export function and(...conds) {
|
|
39
|
+
return { type: "and", conditions: conds };
|
|
40
|
+
}
|
|
41
|
+
/** At least one child must hold. */
|
|
42
|
+
export function or(...conds) {
|
|
43
|
+
return { type: "or", conditions: conds };
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=operators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operators.js","sourceRoot":"","sources":["../src/operators.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,2FAA2F;AAC3F,sFAAsF;AACtF,4DAA4D;AAI5D,MAAM,IAAI,GAAkB,MAAM,CAAC,aAAa,CAAC,CAAC;AAUlD,SAAS,EAAE,CAAI,EAAY,EAAE,KAAe;IAC1C,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAa,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,CAAU;IAC/B,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAK,CAA6B,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;AAC9F,CAAC;AAED,MAAM,CAAC,MAAM,EAAE,GAAG,CAAI,CAAI,EAAW,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,CAAa,CAAC,CAAC;AAC/D,MAAM,CAAC,MAAM,EAAE,GAAG,CAAI,CAAI,EAAW,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAa,CAAC,CAAC;AAChE,MAAM,CAAC,MAAM,EAAE,GAAG,CAA4B,CAAI,EAAW,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,CAAa,CAAC,CAAC;AACvF,MAAM,CAAC,MAAM,EAAE,GAAG,CAA4B,CAAI,EAAW,EAAE,CAAC,EAAE,CAAC,IAAI,EA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CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;IAChD,MAAM,KAAK,GAAa,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAE,GAAgB,CAAC;IACpE,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,EAAE;QACF,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE;QACrC,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE;KAClC,CAAC;AACJ,CAAC;AAED,8BAA8B;AAC9B,MAAM,UAAU,GAAG,CAAI,GAAG,KAAgB;IACxC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAa,CAAC;AACvD,CAAC;AAED,oCAAoC;AACpC,MAAM,UAAU,EAAE,CAAI,GAAG,KAAgB;IACvC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAa,CAAC;AACtD,CAAC"}
|
package/dist/query.d.ts
ADDED
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import type { Ast, Dir } from "./ast.ts";
|
|
2
|
+
import type { Arg, Cond } from "./operators.ts";
|
|
3
|
+
import type { AnyCols, ColsMap, ColT, Relationship, RowOf, Schema, TableLike } from "./schema.ts";
|
|
4
|
+
import type { ArrayView, SingularArrayView } from "./view.ts";
|
|
5
|
+
type FieldFn<C extends AnyCols, K extends keyof C, Rels, One extends boolean, Sel extends string> = (arg: Arg<ColT<C[K]>>) => Query<C, Rels, One, Sel>;
|
|
6
|
+
/** `where.closed(false)`, `where.priority(gt(3))`. */
|
|
7
|
+
type WhereProxy<C extends AnyCols, Rels, One extends boolean, Sel extends string> = {
|
|
8
|
+
[K in keyof C]: FieldFn<C, K, Rels, One, Sel>;
|
|
9
|
+
};
|
|
10
|
+
/** `whereClosed(false)`, `wherePriority(gt(3))`. */
|
|
11
|
+
type WhereSugar<C extends AnyCols, Rels, One extends boolean, Sel extends string> = {
|
|
12
|
+
[K in keyof C as `where${Capitalize<string & K>}`]: FieldFn<C, K, Rels, One, Sel>;
|
|
13
|
+
};
|
|
14
|
+
/** What `materialize()` returns: singular (`R | null`) for a top-level `.one()`, else plural. */
|
|
15
|
+
type MaterializedView<R, One extends boolean> = One extends true ? SingularArrayView<R> : ArrayView<R>;
|
|
16
|
+
/**
|
|
17
|
+
* The result row type of a projection (masking, FRAGMENT-COMPOSITION-DESIGN.md §6 / §10.6).
|
|
18
|
+
* `Sel` is the union of columns named via `select(...)`. With nothing selected (`Sel = never`)
|
|
19
|
+
* it stays the full {@link RowOf} — the "no `select` ⇒ all columns" convention, kept and made
|
|
20
|
+
* type-honest. Once any column is selected, the row is **masked** to exactly those columns, so a
|
|
21
|
+
* component (its fragment) can read only what it declared. `Pick` only ever *removes* fields, so
|
|
22
|
+
* narrowing is always sound versus a runtime row that may still carry more.
|
|
23
|
+
*/
|
|
24
|
+
type Projected<C extends AnyCols, Sel extends string> = [Sel] extends [never] ? RowOf<C> : Pick<RowOf<C>, Sel & keyof C>;
|
|
25
|
+
interface QueryBase<C extends AnyCols, Rels, One extends boolean, Sel extends string> {
|
|
26
|
+
/** Present when this local query came from `defineQuery`; used as the remote identity. */
|
|
27
|
+
readonly name?: string;
|
|
28
|
+
/** Present when this local query came from `defineQuery`; sent with `name` upstream. */
|
|
29
|
+
readonly args?: unknown;
|
|
30
|
+
/** Condition form — consumes `or()`/`and()`/`exists()`/field conditions (AND-ed across calls).
|
|
31
|
+
* Filters over the FULL column set (`RowOf<C>`), independent of what's `select`ed/masked. */
|
|
32
|
+
where(cond: Cond<RowOf<C>>): Query<C, Rels, One, Sel>;
|
|
33
|
+
orderBy<K extends keyof C>(col: K, dir: Dir): Query<C, Rels, One, Sel>;
|
|
34
|
+
/** Project a subset of columns (PROJECTION-SUPPORT-DESIGN.md §6, masking §6/§10.6). Chainable
|
|
35
|
+
* (each call unions into `Sel`); omit to select all. Drives what the server syncs, what the
|
|
36
|
+
* view reports, AND — once any column is named — narrows the result row TYPE to exactly the
|
|
37
|
+
* selection (masking). `where`/`orderBy`/`start`/`sub` still see the full column set. */
|
|
38
|
+
select<K extends keyof C & string>(...cols: K[]): Query<C, Rels, One, Sel | K>;
|
|
39
|
+
limit(n: number): Query<C, Rels, One, Sel>;
|
|
40
|
+
/** Cursor paging: start at (or, with `exclusive`, after) the partial `cursor` row over the
|
|
41
|
+
* sort columns. Lowers to a `Skip` in the engine. */
|
|
42
|
+
start(cursor: Partial<RowOf<C>>, opts?: {
|
|
43
|
+
exclusive?: boolean;
|
|
44
|
+
}): Query<C, Rels, One, Sel>;
|
|
45
|
+
/** Return a single row: `materialize()` yields a {@link SingularArrayView} (`data: R | null`)
|
|
46
|
+
* and the engine caps the query to `limit = 1`. */
|
|
47
|
+
one(): Query<C, Rels, true, Sel>;
|
|
48
|
+
/** **Merge** a {@link Fragment} into THIS node — Relay's "spread on the same type" (§5). The
|
|
49
|
+
* fragment must be over the same table (enforced in the result type: a fragment over a different
|
|
50
|
+
* table yields `never`, plus a runtime throw). Unions the projection (`Sel | FSel`), folds in the
|
|
51
|
+
* fragment's nested relationships (`Rels & FRels`), and merges any same-`alias` edge recursively
|
|
52
|
+
* — canonically, so `include` order doesn't matter (§10.5). Two fragments that spread the same
|
|
53
|
+
* alias with a conflicting row-set (correlation/where/orderBy/…) **throw** (§10.2); an included
|
|
54
|
+
* fragment may **not** add a root `where`/`orderBy`/`limit` (§10.3). This is also the single-shot
|
|
55
|
+
* way to ROOT a fragment onto a base query (`queries.issue.where.id(x).include(IssueCard)`) — the
|
|
56
|
+
* loader's composed root — equivalent to applying the fragment, but canonicalized.
|
|
57
|
+
*
|
|
58
|
+
* The fragment's columns are a *separate* inferred parameter `FC` (not the class `C`) so that
|
|
59
|
+
* `include` keeps `C` out of any contravariant position — preserving `Query<Concrete>`'s
|
|
60
|
+
* assignability to `Query<AnyCols>` (needed by `Store<ColsMap>`/`QueryRoot`). Same-table is then
|
|
61
|
+
* checked as the mutual-assignability of `C` and `FC` in the return type. */
|
|
62
|
+
include<FC extends AnyCols, FRels = {}, FSel extends string = never>(fragment: Fragment<FC, FRels, FSel>): [C] extends [FC] ? ([FC] extends [C] ? Query<C, Rels & FRels, One, Sel | FSel> : never) : never;
|
|
63
|
+
/** Nest a child by EXPLICIT correlation (no schema relationship). `alias` is the result key.
|
|
64
|
+
* The child's own projection (`CSel`) masks the nested row, so a fragment spread here
|
|
65
|
+
* contributes exactly the columns it declared. */
|
|
66
|
+
sub<A extends string, CC extends AnyCols, CRels = {}, CSel extends string = never>(alias: A, child: TableLike<CC>, corr: {
|
|
67
|
+
parent: Array<keyof C & string>;
|
|
68
|
+
child: Array<keyof CC & string>;
|
|
69
|
+
}, build?: (q: Query<CC>) => Query<CC, CRels, boolean, CSel>): Query<C, Rels & {
|
|
70
|
+
[P in A]: Array<Projected<CC, CSel> & CRels>;
|
|
71
|
+
}, One, Sel>;
|
|
72
|
+
/** Nest a child by a named {@link Relationship} (`rel(parent, child, {...})`) — the correlation comes
|
|
73
|
+
* from the relationship, so no `{ parent, child }` keys are restated. The relationship must belong to
|
|
74
|
+
* THIS table (its parent columns are checked against `C`). `alias` is still the result key. */
|
|
75
|
+
sub<A extends string, CC extends AnyCols, CRels = {}, CSel extends string = never>(alias: A, relationship: Relationship<C, CC>, build?: (q: Query<CC>) => Query<CC, CRels, boolean, CSel>): Query<C, Rels & {
|
|
76
|
+
[P in A]: Array<Projected<CC, CSel> & CRels>;
|
|
77
|
+
}, One, Sel>;
|
|
78
|
+
/** Add a **relationship aggregate** — `issue.countAs("commentCount", comment, …)`
|
|
79
|
+
* (`REDUCE-DESIGN.md` §9). Like {@link sub} (explicit correlation, optional child
|
|
80
|
+
* `build` for a filtered `count(child WHERE …)`), but the relationship surfaces a single
|
|
81
|
+
* scalar `count(*)` of the correlated child rows named `alias` — so the result key is a
|
|
82
|
+
* `number`, not an array; an empty (childless) parent reads `0`. */
|
|
83
|
+
countAs<A extends string, CC extends AnyCols>(alias: A, child: TableLike<CC>, corr: {
|
|
84
|
+
parent: Array<keyof C & string>;
|
|
85
|
+
child: Array<keyof CC & string>;
|
|
86
|
+
}, build?: (q: Query<CC>) => Query<CC, unknown>): Query<C, Rels & {
|
|
87
|
+
[P in A]: number;
|
|
88
|
+
}, One, Sel>;
|
|
89
|
+
/** `countAs` by a named {@link Relationship} — like the explicit form, but the correlation comes from
|
|
90
|
+
* `rel(...)` instead of being restated. */
|
|
91
|
+
countAs<A extends string, CC extends AnyCols>(alias: A, relationship: Relationship<C, CC>, build?: (q: Query<CC>) => Query<CC, unknown>): Query<C, Rels & {
|
|
92
|
+
[P in A]: number;
|
|
93
|
+
}, One, Sel>;
|
|
94
|
+
/** The compiled Zero-wire AST (what a backend's `query` consumes). */
|
|
95
|
+
ast(): Ast;
|
|
96
|
+
/** Materialize into a live, typed view. Wired by the Store/backend. A top-level `.one()`
|
|
97
|
+
* yields a {@link SingularArrayView}; otherwise an {@link ArrayView}. The row is masked to the
|
|
98
|
+
* projection ({@link Projected}) — full {@link RowOf} until a column is `select`ed. */
|
|
99
|
+
materialize(): MaterializedView<Projected<C, Sel> & Rels, One>;
|
|
100
|
+
}
|
|
101
|
+
export type Query<C extends AnyCols, Rels = {}, One extends boolean = false, Sel extends string = never> = Omit<QueryBase<C, Rels, One, Sel>, "where"> & {
|
|
102
|
+
where: QueryBase<C, Rels, One, Sel>["where"] & WhereProxy<C, Rels, One, Sel>;
|
|
103
|
+
} & WhereSugar<C, Rels, One, Sel>;
|
|
104
|
+
type AnyQuery = Query<any, any, any>;
|
|
105
|
+
/** Turn raw, UNTRUSTED wire args into the canonical, typed args a query is built from. Its return
|
|
106
|
+
* type IS the query's args type — written once, it flows to both the client call signature and the
|
|
107
|
+
* `build` step, so there's no second place to restate the shape. */
|
|
108
|
+
export type QueryValidator<Args> = (rawArgs: unknown) => Args;
|
|
109
|
+
/**
|
|
110
|
+
* Build a `Query` (an `Ast` constructor) from already-validated args, plus an optional CONTEXT — the
|
|
111
|
+
* authenticated principal the query is scoped to. `Ctx` is **off-wire**: the client passes its own
|
|
112
|
+
* session ctx at the callsite, the server injects the AUTHORITATIVE ctx ({@link NamedQuery.resolve}
|
|
113
|
+
* via `registerQueries`), and the wire still carries only `name` + args. Both tiers run the same
|
|
114
|
+
* `build`, so whenever their ctx agrees the AST is byte-identical — and a client can never spoof it,
|
|
115
|
+
* since the server re-derives ctx from its trusted session and ignores anything the client claimed.
|
|
116
|
+
*
|
|
117
|
+
* The ctx is a *tuple* so a query opts into it by how it types `build`'s second parameter — and that
|
|
118
|
+
* shape becomes the call signature verbatim:
|
|
119
|
+
* - `(args) => Q` — no ctx (`q(args)`).
|
|
120
|
+
* - `(args, ctx: C) => Q` — ctx REQUIRED (`q(args, ctx)`); for always-authenticated queries.
|
|
121
|
+
* - `(args, ctx?: C) => Q` — ctx OPTIONAL (`q(args)` or `q(args, ctx)`); sound only when "no ctx"
|
|
122
|
+
* is a real, SYMMETRIC state — i.e. the build yields the SAME broad AST whether ctx is absent or
|
|
123
|
+
* present-with-no-user (anonymous / SSR), since the server always forwards a ctx (possibly
|
|
124
|
+
* anonymous). Otherwise type ctx required so the type catches an omitted ctx.
|
|
125
|
+
*/
|
|
126
|
+
export type QueryBuilder<Args, Q extends AnyQuery, Ctx extends readonly unknown[] = []> = (args: Args, ...ctx: Ctx) => Q;
|
|
127
|
+
/**
|
|
128
|
+
* A single, co-located NAMED query (see {@link defineQuery}). It is:
|
|
129
|
+
* - **callable on the client** — `q(args, ctx?)` validates + builds + stamps the result with its
|
|
130
|
+
* remote subscription identity (`name` + args — NOT ctx), so a component that imports it always
|
|
131
|
+
* SYNCS. There is no unstamped builder to import by accident.
|
|
132
|
+
* - **registerable on the server** — it carries its `queryName` and a `resolve` that re-runs the
|
|
133
|
+
* SAME validator on untrusted wire args and builds the AUTHORITATIVE `Query` from the server's
|
|
134
|
+
* own ctx ({@link registerQueries `registerQueries`} in `@rindle/api-server`).
|
|
135
|
+
*
|
|
136
|
+
* `Ctx` is the ctx parameter list mirrored from `build` — `[]`, `[ctx: C]`, or `[ctx?: C]`. It is
|
|
137
|
+
* never part of the wire identity.
|
|
138
|
+
*/
|
|
139
|
+
export interface NamedQuery<Args, Ctx extends readonly unknown[], Q extends AnyQuery> {
|
|
140
|
+
(args: Args, ...ctx: Ctx): Q;
|
|
141
|
+
/** The wire identity. The daemon leases by this name; client and server MUST agree on it — which
|
|
142
|
+
* they do, because both sides import the SAME `defineQuery` value. */
|
|
143
|
+
readonly queryName: string;
|
|
144
|
+
/** Server-side: validate raw wire args, then build the authoritative `Query` from the server's
|
|
145
|
+
* authoritative ctx (forwarded by `registerQueries`). */
|
|
146
|
+
resolve(rawArgs: unknown, ...ctx: Ctx): Q;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Define ONE co-located, named query. Keep it next to the component that reads it (a `*.queries.ts`
|
|
150
|
+
* file), so a query lives where its fragments and its component live.
|
|
151
|
+
*
|
|
152
|
+
* The returned value is callable on the client (it stamps its result with `name` + args, so the
|
|
153
|
+
* subscription SYNCS) and registerable on the server ({@link registerQueries}). The optional
|
|
154
|
+
* `validate` step turns untrusted wire args into the canonical args type — and that type flows to
|
|
155
|
+
* both the call signature and `build`, so the shape is written exactly once. `validate` runs on
|
|
156
|
+
* BOTH tiers (it builds the byte-identical authoritative AST on the server, and guards + guarantees
|
|
157
|
+
* the same AST on the client). If the server must DIVERGE from the client, define a second
|
|
158
|
+
* `defineQuery` with the same `name` for the server and register that one instead.
|
|
159
|
+
*
|
|
160
|
+
* `build` may take a second CONTEXT parameter (see {@link QueryBuilder}). Context is off-wire: the
|
|
161
|
+
* client passes its session ctx at the callsite, the server injects its authoritative ctx — so a
|
|
162
|
+
* per-user query stays symmetric without ever trusting (or transmitting) a client-supplied identity.
|
|
163
|
+
*
|
|
164
|
+
* ```ts
|
|
165
|
+
* // recentComments({ limit }) — validated, no ctx, byte-identical on both tiers
|
|
166
|
+
* export const recentCommentsQuery = defineQuery(
|
|
167
|
+
* "recentComments",
|
|
168
|
+
* (raw): { limit: number } => ({ limit: validateFeedLimit(raw) }),
|
|
169
|
+
* ({ limit }) => q.comment.orderBy("createdAt", "desc").limit(limit).include(FeedItemFragment),
|
|
170
|
+
* );
|
|
171
|
+
*
|
|
172
|
+
* // myIssues({ limit }, ctx) — ctx-scoped; the wire still carries only { limit }
|
|
173
|
+
* export const myIssuesQuery = defineQuery(
|
|
174
|
+
* "myIssues",
|
|
175
|
+
* (raw): { limit: number } => ({ limit: validateLimit(raw) }),
|
|
176
|
+
* ({ limit }, ctx: { user: string }) => q.issue.where.ownerId(ctx.user).limit(limit),
|
|
177
|
+
* );
|
|
178
|
+
* // client: myIssuesQuery({ limit: 20 }, { user: currentUser() })
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
export declare function defineQuery<Q extends AnyQuery>(name: string, build: () => Q): NamedQuery<void, [], Q>;
|
|
182
|
+
export declare function defineQuery<Args, Ctx extends readonly unknown[], Q extends AnyQuery>(name: string, build: (args: Args, ...ctx: Ctx) => Q): NamedQuery<Args, Ctx, Q>;
|
|
183
|
+
export declare function defineQuery<Args, Ctx extends readonly unknown[], Q extends AnyQuery>(name: string, validate: QueryValidator<Args>, build: (args: Args, ...ctx: Ctx) => Q): NamedQuery<Args, Ctx, Q>;
|
|
184
|
+
declare const FRAGMENT_BRAND: unique symbol;
|
|
185
|
+
/**
|
|
186
|
+
* A reusable, typed *selection over a table* — Relay's "fragment", promoted to a first-class
|
|
187
|
+
* value. **Two verbs** compose a fragment, on one axis — does its data belong to THIS row or to a
|
|
188
|
+
* related one:
|
|
189
|
+
*
|
|
190
|
+
* - SAME node — `q.include(Frag)`: merge its selection into this node. This is also how you
|
|
191
|
+
* **root** a fragment onto a base query — `queries.t.where.id(x).include(Frag)`.
|
|
192
|
+
* - CHILD node — `q.sub(alias, child, corr, Frag)`: nest it under a relationship (`sub`'s 4th arg).
|
|
193
|
+
*
|
|
194
|
+
* A `Fragment` is therefore also a `build` transform (`(q: Query<C>) => Query<C, Rels>`); that
|
|
195
|
+
* call signature is the mechanism by which `sub` accepts a fragment as its build. Prefer
|
|
196
|
+
* `include` to root a fragment (canonical + merged) over calling it directly. It additionally
|
|
197
|
+
* carries its `table` (for {@link FragmentRef}/`useFragment` typing and masking). Composing
|
|
198
|
+
* fragments assembles ONE {@link Ast} → one materialization → one `/query` — the whole point
|
|
199
|
+
* (no request waterfall; design §1).
|
|
200
|
+
*/
|
|
201
|
+
export interface Fragment<C extends AnyCols, Rels = {}, Sel extends string = never> {
|
|
202
|
+
(q: Query<C>): Query<C, Rels, false, Sel>;
|
|
203
|
+
readonly table: TableLike<C>;
|
|
204
|
+
readonly [FRAGMENT_BRAND]: true;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* The "fragment ref" a parent passes down for a {@link Fragment} read: the already-projected
|
|
208
|
+
* node(s) at the fragment's alias in the shared root view — i.e. the fragment's result shape.
|
|
209
|
+
* It is **masked** ({@link Projected}) to the fragment's own `select` — a fragment reads only the
|
|
210
|
+
* columns it declared. A fragment with no `select` stays the full `RowOf<C> & Rels` (§10.6).
|
|
211
|
+
*/
|
|
212
|
+
export type FragmentRef<F> = F extends Fragment<infer C, infer Rels, infer Sel> ? Projected<C, Sel> & Rels : never;
|
|
213
|
+
/**
|
|
214
|
+
* Define a co-located, composable {@link Fragment}: a named selection over `table`. The returned
|
|
215
|
+
* value is callable (the `build` transform), so it threads through the existing `sub`/`Rels`
|
|
216
|
+
* spine — no GraphQL, no codegen, no schema change (design §3).
|
|
217
|
+
*
|
|
218
|
+
* ```ts
|
|
219
|
+
* const UserAvatar = defineFragment(schema.user, (f) => f.select("id", "name", "avatarUrl"));
|
|
220
|
+
* const CommentRow = defineFragment(schema.comment, (f) =>
|
|
221
|
+
* f.select("id", "body", "authorId")
|
|
222
|
+
* .sub("author", schema.user, { parent: ["authorId"], child: ["id"] }, UserAvatar));
|
|
223
|
+
* ```
|
|
224
|
+
*/
|
|
225
|
+
export declare function defineFragment<C extends AnyCols, Rels = {}, Sel extends string = never>(table: TableLike<C>, build: (q: Query<C>) => Query<C, Rels, boolean, Sel>): Fragment<C, Rels, Sel>;
|
|
226
|
+
/** Runtime guard: is `v` a {@link Fragment} (a `defineFragment` value, not a plain build fn)? */
|
|
227
|
+
export declare function isFragment(v: unknown): v is Fragment<AnyCols, unknown>;
|
|
228
|
+
/** Options for `exists` / `notExists`. */
|
|
229
|
+
export interface ExistsOpts {
|
|
230
|
+
/**
|
|
231
|
+
* Fold this `EXISTS` as a build-time **scalar** subquery: when the child binds a
|
|
232
|
+
* statically-unique key, the engine reads it once, inlines the correlation value as a
|
|
233
|
+
* literal, and deletes the join. **Snapshot semantics** — the inlined value does not
|
|
234
|
+
* react to later child changes. Defaults to `false` (a live `EXISTS` join).
|
|
235
|
+
*/
|
|
236
|
+
scalar?: boolean;
|
|
237
|
+
}
|
|
238
|
+
/** `EXISTS` by a named {@link Relationship} — correlation from the rel; the parent row type is the
|
|
239
|
+
* relationship's parent, so the condition lands on the matching `.where()`. */
|
|
240
|
+
export declare function exists<PC extends AnyCols, CC extends AnyCols>(relationship: Relationship<PC, CC>, build?: (q: Query<CC>) => Query<CC, unknown>, opts?: ExistsOpts): Cond<RowOf<PC>>;
|
|
241
|
+
/** `EXISTS (<correlated subquery>)` — a condition (use inside `where`/`or`/`and`). */
|
|
242
|
+
export declare function exists<CC extends AnyCols, R = unknown>(child: TableLike<CC>, corr: {
|
|
243
|
+
parent: Array<keyof R & string>;
|
|
244
|
+
child: Array<keyof CC & string>;
|
|
245
|
+
}, build?: (q: Query<CC>) => Query<CC, unknown>, opts?: ExistsOpts): Cond<R>;
|
|
246
|
+
/** `NOT EXISTS` by a named {@link Relationship}. */
|
|
247
|
+
export declare function notExists<PC extends AnyCols, CC extends AnyCols>(relationship: Relationship<PC, CC>, build?: (q: Query<CC>) => Query<CC, unknown>, opts?: ExistsOpts): Cond<RowOf<PC>>;
|
|
248
|
+
/** `NOT EXISTS (<correlated subquery>)`. */
|
|
249
|
+
export declare function notExists<CC extends AnyCols, R = unknown>(child: TableLike<CC>, corr: {
|
|
250
|
+
parent: Array<keyof R & string>;
|
|
251
|
+
child: Array<keyof CC & string>;
|
|
252
|
+
}, build?: (q: Query<CC>) => Query<CC, unknown>, opts?: ExistsOpts): Cond<R>;
|
|
253
|
+
/**
|
|
254
|
+
* `EXISTS (<correlated subquery>)` as a **server-only, non-syncing** gate (`exists_noSync`).
|
|
255
|
+
* Identical to {@link exists} for filtering parent visibility, but stamps the subquery
|
|
256
|
+
* `system: "permissions"`, so the engine's normalized serializer prunes its witnesses from the
|
|
257
|
+
* footprint — the permission table's rows are never synced to the client and the client never
|
|
258
|
+
* re-evaluates the gate. Use this when building the **server's** query (the user's API server);
|
|
259
|
+
* the client holds its own un-gated query.
|
|
260
|
+
*/
|
|
261
|
+
export declare function existsNoSync<PC extends AnyCols, CC extends AnyCols>(relationship: Relationship<PC, CC>, build?: (q: Query<CC>) => Query<CC, unknown>): Cond<RowOf<PC>>;
|
|
262
|
+
export declare function existsNoSync<CC extends AnyCols, R = unknown>(child: TableLike<CC>, corr: {
|
|
263
|
+
parent: Array<keyof R & string>;
|
|
264
|
+
child: Array<keyof CC & string>;
|
|
265
|
+
}, build?: (q: Query<CC>) => Query<CC, unknown>): Cond<R>;
|
|
266
|
+
/** `NOT EXISTS (<correlated subquery>)` as a **server-only, non-syncing** gate — the `NOT EXISTS` form of {@link existsNoSync} (a deny-style permission rule). */
|
|
267
|
+
export declare function notExistsNoSync<PC extends AnyCols, CC extends AnyCols>(relationship: Relationship<PC, CC>, build?: (q: Query<CC>) => Query<CC, unknown>): Cond<RowOf<PC>>;
|
|
268
|
+
export declare function notExistsNoSync<CC extends AnyCols, R = unknown>(child: TableLike<CC>, corr: {
|
|
269
|
+
parent: Array<keyof R & string>;
|
|
270
|
+
child: Array<keyof CC & string>;
|
|
271
|
+
}, build?: (q: Query<CC>) => Query<CC, unknown>): Cond<R>;
|
|
272
|
+
export type QueryRoot<S extends ColsMap> = {
|
|
273
|
+
[N in keyof S]: Query<S[N]>;
|
|
274
|
+
};
|
|
275
|
+
/** A typed query entry over a schema: `queries(schema).issue.where.closed(false)…`. */
|
|
276
|
+
export declare function queries<S extends ColsMap>(schema: Schema<S>, onMaterialize?: (query: AnyQuery) => unknown): QueryRoot<S>;
|
|
277
|
+
/** A schema-bound query-builder factory for portable client/server query definitions. */
|
|
278
|
+
export declare function newQueryBuilder<S extends ColsMap>(schema: Schema<S>): QueryRoot<S>;
|
|
279
|
+
export {};
|
|
280
|
+
//# sourceMappingURL=query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,GAAG,EAAwC,GAAG,EAAiC,MAAM,UAAU,CAAC;AAE9G,OAAO,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,KAAK,EAAE,OAAO,EAA6B,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAa,MAAM,aAAa,CAAC;AAExI,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAQ9D,KAAK,OAAO,CAAC,CAAC,SAAS,OAAO,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,IAAI,EAAE,GAAG,SAAS,OAAO,EAAE,GAAG,SAAS,MAAM,IAAI,CAClG,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KACjB,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAE9B,sDAAsD;AACtD,KAAK,UAAU,CAAC,CAAC,SAAS,OAAO,EAAE,IAAI,EAAE,GAAG,SAAS,OAAO,EAAE,GAA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