foldkit-entity 0.8.1 → 0.10.0

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.
@@ -1,4 +1,4 @@
1
- import { Option, Pipeable, Schema, SchemaAST } from "effect";
1
+ import { Array, Option, Pipeable, Schema, SchemaAST } from "effect";
2
2
  import { Metadata } from "foldkit-metadata";
3
3
  //#region src/collation.d.ts
4
4
  type Collation =
@@ -70,7 +70,7 @@ type AnyExpr = Expr<unknown>;
70
70
  * then be confused, which a structural phantom would allow. A scalar-valued
71
71
  * operation, if one is ever needed, joins `Expr` instead.
72
72
  */
73
- type Predicate = EqPredicate | NullPredicate | ContainsPredicate | InPredicate;
73
+ type Predicate = EqPredicate | NullPredicate | ContainsPredicate | InPredicate | AndPredicate | OrPredicate | NotPredicate | ComparePredicate;
74
74
  /** Two values are the same. */
75
75
  interface EqPredicate {
76
76
  readonly _tag: 'Eq';
@@ -108,6 +108,43 @@ interface InPredicate {
108
108
  readonly value: AnyExpr;
109
109
  readonly among: AnyExpr;
110
110
  }
111
+ /**
112
+ * Every operand holds. `Query.where`'s list is already a conjunction; this is
113
+ * one inside something else, `or(and(a, b), c)`. Never empty, and never holding
114
+ * another `and`: `Expr.and` flattens one into its parent.
115
+ */
116
+ interface AndPredicate {
117
+ readonly _tag: 'And';
118
+ readonly operands: Array.NonEmptyReadonlyArray<Predicate>;
119
+ }
120
+ /** At least one operand holds. Never empty, and never holding another `or`. */
121
+ interface OrPredicate {
122
+ readonly _tag: 'Or';
123
+ readonly operands: Array.NonEmptyReadonlyArray<Predicate>;
124
+ }
125
+ /**
126
+ * The operand does not hold. As SQL's `not`, an unknown stays unknown, so a row
127
+ * whose operand is unknown (a null compared) is matched by neither the operand
128
+ * nor its `not`.
129
+ */
130
+ interface NotPredicate {
131
+ readonly _tag: 'Not';
132
+ readonly operand: Predicate;
133
+ }
134
+ /** Which way a comparison orders its two sides: `left < right` for `lt`. */
135
+ type CompareOperator = 'lt' | 'lte' | 'gt' | 'gte';
136
+ /**
137
+ * One scalar orders before, or after, the other. A null on either side is
138
+ * unknown. `collation` is how text compares, decided where the comparison is
139
+ * written (see `Expr.lt`); none for values that order intrinsically, numbers.
140
+ */
141
+ interface ComparePredicate {
142
+ readonly _tag: 'Compare';
143
+ readonly operator: CompareOperator;
144
+ readonly left: AnyExpr;
145
+ readonly right: AnyExpr;
146
+ readonly collation: Option.Option<Collation>;
147
+ }
111
148
  /**
112
149
  * Anything an operation can be given: a scalar, or a predicate where a boolean
113
150
  * is wanted. `Expr.eq(Expr.isNotNull(archivedAt), input.archived)` is the
@@ -117,6 +154,36 @@ interface InPredicate {
117
154
  type Operandish = AnyExpr | Predicate;
118
155
  /** A field, a scalar already built from one, or a predicate used as a boolean. */
119
156
  type Operand<T> = EntityField<string, string, Schema.Constraint> | Expr<T> | Predicate;
157
+ /**
158
+ * Type-only: the Entities a predicate's fields belong to, by name, so
159
+ * `Query.where` can refuse one over another Entity where it is written. Never
160
+ * set at run time; a predicate built without it (typed plain `Predicate`)
161
+ * reads as unknown and is checked at run time only.
162
+ */
163
+ interface Reads<Names extends string> {
164
+ readonly '~reads'?: Names;
165
+ }
166
+ /**
167
+ * The Entity names an operand reads: a field's own, a marked node's, none for
168
+ * a value or an input. A node with no marker (a `Predicate` typed plainly)
169
+ * reads as `string`, unknown.
170
+ */
171
+ type ReadsOf<X> = X extends EntityField<infer Name, string, Schema.Constraint> ? Name : X extends PlainValue | {
172
+ readonly _tag: 'Literal' | 'Input';
173
+ } ? never : X extends {
174
+ readonly '~reads'?: infer Names;
175
+ } ? unknown extends Names ? string : Names extends string ? Names : never : never;
176
+ /**
177
+ * Nothing when a query's predicates read its own Entity, none, or one unknown
178
+ * to the type (checked at run time instead); else a failure naming both.
179
+ */
180
+ type OverEntity<Names extends string, Name extends string, What extends string> = string extends Names ? unknown : [Names] extends [Name] ? unknown : Invalid<`foldkit-entity: ${What} reads ${Exclude<Names, Name>}, but the query is from ${Name}`>;
181
+ /** A plain value, which `Expr.eq` takes on the right only. */
182
+ type PlainValue = string | number | boolean | bigint | null;
183
+ /** A compile-time failure whose type is the sentence that says what to do. */
184
+ interface Invalid<Message extends string> {
185
+ readonly '~invalid': Message;
186
+ }
120
187
  /** What an operand is worth, so a comparison's other side is checked against it. */
121
188
  type ValueOf<E> = E extends EntityField<string, string, infer S> ? Schema.Schema.Type<S> : E extends Predicate ? boolean : E extends Expr<infer T> ? T : never;
122
189
  /**
@@ -140,6 +207,7 @@ type ValueOf<E> = E extends EntityField<string, string, infer S> ? Schema.Schema
140
207
  * defeated that way.
141
208
  */
142
209
  type TextOperand = EntityField<string, string, Schema.Constraint & Schema.Codec<string | null, any, any, any>> | Expr<string> | Expr<string | null>;
210
+ declare const literal: <T>(value: T) => LiteralExpr<T>;
143
211
  /** Whether a value is a predicate, and so usable where a boolean is wanted. */
144
212
  declare const isPredicate: (value: unknown) => value is Predicate;
145
213
  /**
@@ -147,7 +215,7 @@ declare const isPredicate: (value: unknown) => value is Predicate;
147
215
  * runs, and a body needing one it does not is refused rather than answered
148
216
  * wrongly — see `Query.unsupported`.
149
217
  */
150
- type Operation = 'eq' | 'isNull' | 'isNotNull' | 'contains' | 'in';
218
+ type Operation = 'eq' | 'isNull' | 'isNotNull' | 'contains' | 'in' | 'and' | 'or' | 'not' | 'compare';
151
219
  /** One field an expression reads: its Entity's name and key, and the identity that owns it. */
152
220
  interface FieldDependency {
153
221
  /** The owning Entity's name, for display; two Entities may share one. */
@@ -174,18 +242,32 @@ interface QueryDependencies extends Dependencies {
174
242
  readonly predicate: ReadonlyArray<FieldDependency>;
175
243
  readonly order: ReadonlyArray<FieldDependency>;
176
244
  }
245
+ /**
246
+ * A field or scalar whose value orders: a number, text, a date (which orders by
247
+ * its encoded form), or one of those absent. A boolean does not order here.
248
+ * A constraint on the type parameter, as `TextOperand` is, so inference cannot
249
+ * fall back past it.
250
+ */
251
+ type OrderedOperand = EntityField<string, string, Schema.Constraint & Schema.Codec<number | string | Date | null, any, any, any>> | Expr<number> | Expr<number | null> | Expr<string> | Expr<string | null> | Expr<Date> | Expr<Date | null>;
252
+ /** `Expr.and` and `Expr.or`: one operand is that operand, and two or more are one node. */
253
+ interface Connective<Node extends Predicate> {
254
+ <P extends Predicate>(only: P): P;
255
+ <A extends Predicate, B extends Predicate, Rest extends ReadonlyArray<Predicate>>(first: A, second: B, ...rest: Rest): Node & Reads<ReadsOf<A> | ReadsOf<B> | ReadsOf<Rest[number]>>;
256
+ (...operands: Array.NonEmptyReadonlyArray<Predicate>): Predicate;
257
+ }
177
258
  declare const Expr: {
178
259
  /** A constant. Comparisons coerce a plain value, so this is rarely written. */
179
- literal: <T>(value: T) => LiteralExpr<T>;
260
+ literal: typeof literal;
180
261
  /**
181
262
  * A value the query is given when it runs. A definition builds these from its
182
263
  * `Input` schema; written by hand only when constructing a body directly.
183
264
  */
184
265
  input: <T>(key: string, schema: Schema.Codec<T, unknown>) => InputExpr<T>;
185
266
  /** One field of one Entity, as a scalar. */
186
- field: <Name extends string, Key extends string, S extends Schema.Constraint>(field: EntityField<Name, Key, S>) => FieldExpr<Schema.Schema.Type<S>>;
267
+ field: <Name extends string, Key extends string, S extends Schema.Constraint>(field: EntityField<Name, Key, S>) => FieldExpr<Schema.Schema.Type<S>> & Reads<Name>;
187
268
  /**
188
- * Two scalars are the same value. A field or a plain value on either side is
269
+ * Two scalars are the same value: a field (or an expression) on the left,
270
+ * and the value on the right, typed from it. Fields and plain values are
189
271
  * coerced, so the common form reads as it means:
190
272
  *
191
273
  * ```ts
@@ -193,15 +275,15 @@ declare const Expr: {
193
275
  * Expr.eq(Post.fields.status, 'active')
194
276
  * ```
195
277
  */
196
- eq: <L extends Operand<any>>(left: L, right: ValueOf<L> | Expr<ValueOf<L>> | (boolean extends ValueOf<L> ? Predicate : never)) => EqPredicate;
278
+ eq: <L extends Operand<any> | PlainValue, R extends (L extends PlainValue ? Invalid<'foldkit-entity: Expr.eq takes the field on the left and the value on the right'> : ValueOf<L> | Expr<ValueOf<L>> | (boolean extends ValueOf<L> ? Predicate : never))>(left: L, right: R) => EqPredicate & Reads<ReadsOf<L> | ReadsOf<R>>;
197
279
  /**
198
280
  * Whether a field holds no value. Its opposite is `isNotNull`; both are the
199
- * one node, because a query asks which of the two it means and nothing here
200
- * can negate a predicate.
281
+ * one node, since a query asks which of the two it means, and `is not null`
282
+ * has no unknown for a `not` to keep.
201
283
  */
202
- isNull: <L extends Operand<any>>(operand: L) => NullPredicate;
284
+ isNull: <L extends Operand<any>>(operand: L) => NullPredicate & Reads<ReadsOf<L>>;
203
285
  /** Whether a field holds a value. */
204
- isNotNull: <L extends Operand<any>>(operand: L) => NullPredicate;
286
+ isNotNull: <L extends Operand<any>>(operand: L) => NullPredicate & Reads<ReadsOf<L>>;
205
287
  /**
206
288
  * Whether a text value contains `search`, anywhere in it. Containing the
207
289
  * empty string is everything, so a search box with nothing typed in it is the
@@ -216,10 +298,9 @@ declare const Expr: {
216
298
  * **Over a column that can be null this is not the same as no filter.** A
217
299
  * null contains nothing, not even the empty string, so its rows drop out. A
218
300
  * nullable column that should match everything on an empty search says so:
219
- * `Expr.or` does not exist yet, so for now such a column needs its own
220
- * predicate or a native escape hatch.
301
+ * `Expr.or(Expr.isNull(field), Expr.contains(field, input.search))`.
221
302
  */
222
- contains: <L extends TextOperand>(value: L, search: string | Expr<string>) => ContainsPredicate;
303
+ contains: <L extends TextOperand>(value: L, search: string | Expr<string>) => ContainsPredicate & Reads<ReadsOf<L>>;
223
304
  /**
224
305
  * Whether a value is one of `among`: a list written out, or an input whose
225
306
  * value is one. Each element is compared as `eq` compares.
@@ -233,7 +314,76 @@ declare const Expr: {
233
314
  * holding a null, and an empty list matches no row. A list written out is
234
315
  * copied, so changing the array afterwards does not change the query.
235
316
  */
236
- in: <L extends Operand<any>>(value: L, among: ReadonlyArray<ValueOf<L>> | Expr<ReadonlyArray<ValueOf<L>>>) => InPredicate;
317
+ in: <L extends Operand<any>>(value: L, among: ReadonlyArray<ValueOf<L>> | Expr<ReadonlyArray<ValueOf<L>>>) => InPredicate & Reads<ReadsOf<L>>;
318
+ /**
319
+ * `left` orders before `right`. Numbers compare as numbers; text compares
320
+ * under a collation, the one given or the field's declared one, which must be
321
+ * `binary` or `asciiFold` (so every backend agrees), and text needs a field on
322
+ * one side. A date compares by its encoded form: as text when it is stored as
323
+ * an ISO string, so its field declares `Collation.binary`. A null on either
324
+ * side is unknown, so the row is matched by neither this nor its `not`.
325
+ *
326
+ * ```ts
327
+ * Expr.lt(fields.cents, 1000)
328
+ * Expr.and(Expr.gte(fields.at, input.from), Expr.lt(fields.at, input.until))
329
+ * ```
330
+ */
331
+ lt: <L extends OrderedOperand, R extends ValueOf<L> | Expr<ValueOf<L>>>(left: L, right: R, options?: {
332
+ readonly collation?: Collation | undefined;
333
+ }) => ComparePredicate & Reads<ReadsOf<L> | ReadsOf<R>>;
334
+ /** `left` orders before `right`, or with it; see `Expr.lt`. */
335
+ lte: <L extends OrderedOperand, R extends ValueOf<L> | Expr<ValueOf<L>>>(left: L, right: R, options?: {
336
+ readonly collation?: Collation | undefined;
337
+ }) => ComparePredicate & Reads<ReadsOf<L> | ReadsOf<R>>;
338
+ /** `left` orders after `right`; see `Expr.lt`. */
339
+ gt: <L extends OrderedOperand, R extends ValueOf<L> | Expr<ValueOf<L>>>(left: L, right: R, options?: {
340
+ readonly collation?: Collation | undefined;
341
+ }) => ComparePredicate & Reads<ReadsOf<L> | ReadsOf<R>>;
342
+ /** `left` orders after `right`, or with it; see `Expr.lt`. */
343
+ gte: <L extends OrderedOperand, R extends ValueOf<L> | Expr<ValueOf<L>>>(left: L, right: R, options?: {
344
+ readonly collation?: Collation | undefined;
345
+ }) => ComparePredicate & Reads<ReadsOf<L> | ReadsOf<R>>;
346
+ /**
347
+ * Every operand holds, as one predicate to place inside another: `where`'s
348
+ * list is already a conjunction, so this is for `or(and(a, b), c)`.
349
+ * Unknown as SQL's `and` is: false wins over unknown, which wins over true.
350
+ * Needs an operand; a list built at run time is checked non-empty first
351
+ * (`Array.isReadonlyArrayNonEmpty`), since an empty `and` would match every row.
352
+ */
353
+ and: Connective<AndPredicate>;
354
+ /**
355
+ * At least one operand holds:
356
+ *
357
+ * ```ts
358
+ * Expr.or(Expr.contains(fields.description, input.search), Expr.contains(fields.upc, input.search))
359
+ * ```
360
+ *
361
+ * Unknown as SQL's `or` is: true wins over unknown, which wins over false.
362
+ * Needs an operand, since an empty `or` would match no row.
363
+ */
364
+ or: Connective<OrPredicate>;
365
+ /**
366
+ * The operand does not hold. **A null is matched by neither side**:
367
+ * `not(eq(status, 'draft'))` leaves out a row whose `status` is null, since
368
+ * `null = 'draft'` is unknown and so is its `not`, as in SQL. "Everything
369
+ * but drafts" over a nullable column is
370
+ * `Expr.or(Expr.isNull(status), Expr.not(Expr.eq(status, 'draft')))`.
371
+ */
372
+ not: <P extends Predicate>(operand: P) => NotPredicate & Reads<ReadsOf<P>>;
373
+ /**
374
+ * A filter that applies only when its input is given: `or(isNull($x), …)`,
375
+ * with the predicate built from the input as never null.
376
+ *
377
+ * ```ts
378
+ * // Every product, or those of the chosen status.
379
+ * Expr.whenGiven(input.status, status => Expr.eq(fields.status, status))
380
+ * ```
381
+ *
382
+ * An interpreter that runs per request, as the Drizzle compiler does, decides
383
+ * `isNull($x)` before writing SQL, so this compiles to `true`, which filters
384
+ * nothing, or to the predicate alone.
385
+ */
386
+ whenGiven: <T, P extends Predicate>(input: InputExpr<T>, build: (given: InputExpr<NonNullable<T>>) => P) => Predicate & Reads<ReadsOf<P>>;
237
387
  /** An expression as readable text; see `showExpr` for what it is and is not. */
238
388
  show: (node: Operandish) => string;
239
389
  };
@@ -280,9 +430,9 @@ interface ChosenOrder {
280
430
  type Ordering = OrderTerm | ChosenOrder;
281
431
  declare const Order: {
282
432
  /** Smallest first; rows without a value last, unless `nulls` says first. */
283
- asc: <E extends Operand<any>>(expr: E, options?: TermOptions) => OrderTerm;
433
+ asc: <E extends Operand<any>>(expr: E, options?: TermOptions) => OrderTerm & Reads<ReadsOf<E>>;
284
434
  /** Largest first; rows without a value first, unless `nulls` says last. */
285
- desc: <E extends Operand<any>>(expr: E, options?: TermOptions) => OrderTerm;
435
+ desc: <E extends Operand<any>>(expr: E, options?: TermOptions) => OrderTerm & Reads<ReadsOf<E>>;
286
436
  /**
287
437
  * The order the input names, among `choices`: every name the sort can hold
288
438
  * maps to a field, so a name left out is a type error here, not a query that
@@ -293,7 +443,7 @@ declare const Order: {
293
443
  * Query.orderBy(Order.chosen(input.sort, { title: Post.fields.title }))
294
444
  * ```
295
445
  */
296
- chosen: <By extends string>(sort: InputExpr<ChosenSort<By>>, choices: { readonly [K in By]: Operand<any>; }) => ChosenOrder;
446
+ chosen: <By extends string, const Choices extends { readonly [K in By]: Operand<any>; }>(sort: InputExpr<ChosenSort<By>>, choices: Choices) => ChosenOrder & Reads<ReadsOf<Choices[keyof Choices]>>;
297
447
  };
298
448
  /**
299
449
  * Whether a client can order rows the way the server does, for one input: the
@@ -358,13 +508,13 @@ declare const Query: {
358
508
  * Query.from(Post).pipe(published, Query.where(byTitle))
359
509
  * ```
360
510
  */
361
- where: (...predicates: ReadonlyArray<Predicate>) => <E extends AnyEntity>(self: Query<E>) => Query<E>;
511
+ where: <const P extends ReadonlyArray<Predicate>>(...predicates: P) => <E extends AnyEntity>(self: Query<E> & OverEntity<ReadsOf<P[number]>, E['name'], 'a predicate'>) => Query<E>;
362
512
  /**
363
513
  * Reads the rows in this order. Two `orderBy`s append, so an earlier term
364
514
  * stays the more significant one and a later call adds a tie-breaker rather
365
515
  * than silently winning.
366
516
  */
367
- orderBy: (...terms: ReadonlyArray<Ordering>) => <E extends AnyEntity>(self: Query<E>) => Query<E>;
517
+ orderBy: <const T extends ReadonlyArray<Ordering>>(...terms: T) => <E extends AnyEntity>(self: Query<E> & OverEntity<ReadsOf<T[number]>, E['name'], 'an ordering term'>) => Query<E>;
368
518
  /**
369
519
  * The fixed terms this query orders by for one input: each chosen order
370
520
  * resolved to the field its input names, or to nothing for a `null` sort,
@@ -447,17 +597,19 @@ declare const Words: {
447
597
  };
448
598
  //#endregion
449
599
  //#region src/shape.d.ts
600
+ declare const isNullish: (ast: SchemaAST.AST) => boolean;
601
+ declare const isText: (ast: SchemaAST.AST) => boolean;
450
602
  /** What a schema's AST holds, read through Effect's own guards. */
451
603
  declare const SchemaShape: {
452
604
  /** True for the `null` and `undefined` members that make a schema optional. */
453
- isNullish: (ast: SchemaAST.AST) => boolean;
605
+ isNullish: typeof isNullish;
454
606
  /**
455
607
  * The members of a schema with `null` and `undefined` set aside, so optional
456
608
  * text is still text; a schema that is not a union is its one member.
457
609
  */
458
610
  present: (ast: SchemaAST.AST) => ReadonlyArray<SchemaAST.AST>;
459
611
  /** True when every value the schema admits is a string. */
460
- isText: (ast: SchemaAST.AST) => boolean;
612
+ isText: typeof isText;
461
613
  };
462
614
  //#endregion
463
615
  //#region src/evaluate.d.ts
@@ -466,6 +618,17 @@ type Row = Readonly<Record<string, unknown>>;
466
618
  declare class QueryEvaluateError extends Error {
467
619
  constructor(message: string);
468
620
  }
621
+ /** SQL's unknown: neither true nor false, and a row is kept only on true. */
622
+ type Truth = boolean | 'unknown';
623
+ /** What a predicate comes to: SQL's three values, of which a row is kept only on `true`. */
624
+ type PredicateTruth = Truth;
625
+ /**
626
+ * A predicate's truth from the input alone, when it reads no field; none when
627
+ * it reads one. An interpreter that runs per request decides such a predicate
628
+ * before it builds anything: `isNull($status)` is known before any row is.
629
+ * Refuses what `evaluate` refuses (text holding a NUL).
630
+ */
631
+ declare const decided: (node: Predicate, input: Row) => Option.Option<PredicateTruth>;
469
632
  /**
470
633
  * Where `left` sorts against `right` under these terms (`Query.orderFor`'s),
471
634
  * as `evaluate` sorts: negative when it comes first. Refuses what `evaluate`
@@ -836,6 +999,8 @@ type WrittenKey<M> = M extends EntityField<any, infer Key, any> ? Key : M extend
836
999
  type WrittenAs<M> = M extends NestedInput<any, EntityInput<infer Of, any, infer Members>> ? Selection<Of['name'], WrittenSpec<Members>, SelectionSchema<Of, WrittenSpec<Members>>> : true;
837
1000
  /** Every member the input writes: what to read to show the input's current values. */
838
1001
  type WrittenSpec<Members> = { readonly [K in keyof Members as WrittenKey<Members[K]>]: WrittenAs<Members[K]>; };
1002
+ declare const isSameEntity: (left: AnyEntity, right: AnyEntity) => boolean;
1003
+ declare const isEntity: (value: unknown) => value is AnyEntity;
839
1004
  declare const Entity: {
840
1005
  /** Declares an Entity from its intrinsic fields. Each call is a new identity. */
841
1006
  define: <const Name extends string, Fields extends Schema.Struct.Fields>(name: Name, schema: Schema.Struct<Fields>) => Entity<Name, Fields>;
@@ -851,7 +1016,7 @@ declare const Entity: {
851
1016
  * target, that Selection's value. `many` yields an array, an optional `one`
852
1017
  * is nullable.
853
1018
  */
854
- select: <E extends AnyEntity, const Spec>(entity: E, spec: Spec & SelectionSpec<E, Spec>) => Selection<E["name"], Spec, SelectionSchema<E, Spec>, IdOf<E>>;
1019
+ select: <E extends AnyEntity, const Spec>(entity: E, spec: Spec & SelectionSpec<E, Spec>) => Selection<E['name'], Spec, SelectionSchema<E, Spec>, IdOf<E>>;
855
1020
  /**
856
1021
  * A `many` relation read a page at a time, in place of its Selection:
857
1022
  * `comments: Entity.page(CommentSummary, { first: 10 })`. The value is a page
@@ -863,7 +1028,7 @@ declare const Entity: {
863
1028
  /** Attaches an interpreter's metadata to the Entity itself. */
864
1029
  annotate: (metadata: Metadata) => <E extends AnyEntity>(entity: E) => E;
865
1030
  /** Attaches an interpreter's metadata to members, by key. */
866
- annotateMembers: <E extends AnyEntity>(metadata: { readonly [K in keyof E["members"]]?: Metadata; }) => (entity: E) => E;
1031
+ annotateMembers: <E extends AnyEntity>(metadata: { readonly [K in keyof E['members']]?: Metadata; }) => (entity: E) => E;
867
1032
  /**
868
1033
  * Reads an operation's input schema against an Entity. A key that names a
869
1034
  * field maps to it; any other key is mapped explicitly, to a Field, to
@@ -878,12 +1043,12 @@ declare const Entity: {
878
1043
  * struct: `Schema.Struct({ ...Entity.fields(Post, 'id', 'title'), editorId: ... })`.
879
1044
  * The input then keeps the field's own rules, and its keys map themselves.
880
1045
  */
881
- fields: <E extends AnyEntity, const Keys extends ReadonlyArray<keyof E["fields"] & string>>(entity: E, ...keys: Keys) => { readonly [K in Keys[number]]: E["fields"][K]["schema"]; };
1046
+ fields: <E extends AnyEntity, const Keys extends ReadonlyArray<keyof E['fields'] & string>>(entity: E, ...keys: Keys) => { readonly [K in Keys[number]]: E['fields'][K]['schema']; };
882
1047
  /**
883
1048
  * The Selection of every member an input writes, with each relation as refs:
884
1049
  * what an edit screen loads before it shows the input's current values.
885
1050
  */
886
- selectFor: <E extends AnyEntity, Fields extends Schema.Struct.Fields, Members>(input: EntityInput<E, Fields, Members>) => Selection<E["name"], WrittenSpec<Members>, SelectionSchema<E, WrittenSpec<Members>>, IdOf<E>>;
1051
+ selectFor: <E extends AnyEntity, Fields extends Schema.Struct.Fields, Members>(input: EntityInput<E, Fields, Members>) => Selection<E['name'], WrittenSpec<Members>, SelectionSchema<E, WrittenSpec<Members>>, IdOf<E>>;
887
1052
  /**
888
1053
  * The input values that reproduce `value`, a value read through `selectFor`
889
1054
  * (or any Selection with those members): a field as it is, a relation as the
@@ -891,9 +1056,9 @@ declare const Entity: {
891
1056
  * an unmapped key, which the Entity knows nothing about.
892
1057
  */
893
1058
  valuesFor: <E extends AnyEntity, Fields extends Schema.Struct.Fields, Members>(input: EntityInput<E, Fields, Members>, value: Readonly<Record<string, unknown>>) => Partial<Schema.Struct.Type<Fields>>;
894
- is: (value: unknown) => value is AnyEntity;
1059
+ is: typeof isEntity;
895
1060
  /** True when both descriptors are versions of one Entity. */
896
- same: (left: AnyEntity, right: AnyEntity) => boolean;
1061
+ same: typeof isSameEntity;
897
1062
  };
898
1063
  declare function one<Target extends AnyEntity>(target: Target): RelationSpec<Target, 'one', false>;
899
1064
  declare function one<Target extends AnyEntity, const Optional extends boolean>(target: Target, options: {
@@ -909,11 +1074,11 @@ declare const Relation: {
909
1074
  * through `input`, an `Entity.input` of the target. A `many` holds a list.
910
1075
  */
911
1076
  nested: <R extends EntityRelation<any, any, any, any, any>, I extends EntityInput<any, any, any>>(relation: R, input: I) => NestedInput<R, I>;
912
- many: <Target extends AnyEntity>(target: Target) => RelationSpec<Target, "many", false>;
1077
+ many: <Target extends AnyEntity>(target: Target) => RelationSpec<Target, 'many', false>;
913
1078
  };
914
1079
  declare const Derived: {
915
1080
  make: <S extends Schema.Constraint>(schema: S) => DerivedSpec<S>;
916
1081
  };
917
1082
  //#endregion
918
- export { AnyExpr as $, SelectionPage as A, Write as B, Relation as C, TextOperand as Ct, RelationSpecs as D, maxQueryNodes as Dt, RelationSpec as E, isPredicate as Et, WrittenAs as F, assertSupported as G, WriteSet as H, WrittenKey as I, supported as J, compareRows as K, WrittenSpec as L, SelectionTypeId as M, TargetKey as N, Selected as O, Collation as Ot, Unmapped as P, ReadFilter as Q, AnyWrite as R, RelatedSpecs as S, TermOptions as St, RelationMap as T, dependenciesOf as Tt, QueryEvaluateError as U, WriteLink as V, Row as W, SchemaWords as X, SchemaShape as Y, Words as Z, IdSchemaOf as _, Ordering as _t, DerivedSpecs as a, EqPredicate as at, PageWindow as b, Query as bt, EntityDerived as c, FieldExpr as ct, EntityInput as d, LiteralExpr as dt, AnyQuery as et, EntityMember as f, NullPredicate as ft, IdOf as g, OrderTerm as gt, EntityTypeId as h, Order as ht, DerivedSpec as i, Dependencies as it, SelectionPageTypeId as j, Selection as k, EntityField as l, InPredicate as lt, EntityRelation as m, Operation as mt, Cardinality as n, ChosenSort as nt, Entities as o, Expr as ot, EntityRef as p, Operandish as pt, evaluate as q, Derived as r, ContainsPredicate as rt, Entity as s, FieldDependency as st, AnyEntity as t, ChosenOrder as tt, EntityIdentity as u, InputExpr as ut, InputMember as v, Placement as vt, RelationInput as w, ValueOf as wt, Related as x, QueryDependencies as xt, NestedInput as y, Predicate as yt, BoundWrite as z };
919
- //# sourceMappingURL=index-DLz2yED-.d.mts.map
1083
+ export { Words as $, SelectionPage as A, QueryDependencies as At, Write as B, Relation as C, Order as Ct, RelationSpecs as D, Placement as Dt, RelationSpec as E, Ordering as Et, WrittenAs as F, ValueOf as Ft, Row as G, WriteSet as H, WrittenKey as I, dependenciesOf as It, decided as J, assertSupported as K, WrittenSpec as L, isPredicate as Lt, SelectionTypeId as M, ReadsOf as Mt, TargetKey as N, TermOptions as Nt, Selected as O, Predicate as Ot, Unmapped as P, TextOperand as Pt, SchemaWords as Q, AnyWrite as R, maxQueryNodes as Rt, RelatedSpecs as S, OrPredicate as St, RelationMap as T, OrderedOperand as Tt, PredicateTruth as U, WriteLink as V, QueryEvaluateError as W, supported as X, evaluate as Y, SchemaShape as Z, IdSchemaOf as _, LiteralExpr as _t, DerivedSpecs as a, ChosenSort as at, PageWindow as b, Operandish as bt, EntityDerived as c, ContainsPredicate as ct, EntityInput as d, Expr as dt, ReadFilter as et, EntityMember as f, FieldDependency as ft, IdOf as g, Invalid as gt, EntityTypeId as h, InputExpr as ht, DerivedSpec as i, ChosenOrder as it, SelectionPageTypeId as j, Reads as jt, Selection as k, Query as kt, EntityField as l, Dependencies as lt, EntityRelation as m, InPredicate as mt, Cardinality as n, AnyExpr as nt, Entities as o, CompareOperator as ot, EntityRef as p, FieldExpr as pt, compareRows as q, Derived as r, AnyQuery as rt, Entity as s, ComparePredicate as st, AnyEntity as t, AndPredicate as tt, EntityIdentity as u, EqPredicate as ut, InputMember as v, NotPredicate as vt, RelationInput as w, OrderTerm as wt, Related as x, Operation as xt, NestedInput as y, NullPredicate as yt, BoundWrite as z, Collation as zt };
1084
+ //# sourceMappingURL=index-_x1ScI4v.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-_x1ScI4v.d.mts","names":["Arr"],"sources":["../src/collation.ts","../src/expr.ts","../src/readFilter.ts","../src/words.ts","../src/shape.ts","../src/evaluate.ts","../src/write.ts","../src/index.ts"],"mappings":";;;KAeY;;;WAEG;;;;WAEA;;;;WAEA;WAAyB;;cAW3B;EACX,QAA6C;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,QAAQ,SAAO,OACpE,YAAY,GAAG,QAAQ,aAC7B,UACD,WACA,YAAY,UACZ,gBAAgB,GAAG,YAAY,WAC/B,KAAK;;;;;;;EAwBK,YAAA,UAAU,WAAW,eAAe,OAAO,OAAO,QAAQ,SAAO,OACpE,YAAY,GAAG,QAAQ,UAAQ,OAC/B,SAAS,6BACf,QAAQ,OAAO,OAAO,KAAK;;;;;iBA2CvB,IAAI,eAAe,WAAW,QAAQ,SAAS,aAAa;iBAC5D,IAAI,eAAe,iBAAiB,0BAC3C,QAAQ,QACR;WAAoB,UAAU;IAC7B,aAAa,eAAe;;cASlB;;;EAIH,QAAA,UAAU,yCAAuC,UAAY,MAAI,cAAc;;;;;EAO9E,SAAA,UAAU,yCAAyC,UAAU,4BAA0B,UACpF,GAAC,OACJ,MACN,YAAY,GAAG;EAEX,OAAA,eAAe,WAAS,QAAU,WAAS,aAAa;;cAOpD;EACX,OAAO,UAAU,OAAO,YAAU,QAAU,MAAI,YAAY"}
package/dist/index.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as AnyExpr, A as SelectionPage, B as Write, C as Relation, Ct as TextOperand, D as RelationSpecs, Dt as maxQueryNodes, E as RelationSpec, Et as isPredicate, F as WrittenAs, G as assertSupported, H as WriteSet, I as WrittenKey, J as supported, K as compareRows, L as WrittenSpec, M as SelectionTypeId, N as TargetKey, O as Selected, Ot as Collation, P as Unmapped, Q as ReadFilter, R as AnyWrite, S as RelatedSpecs, St as TermOptions, T as RelationMap, Tt as dependenciesOf, U as QueryEvaluateError, V as WriteLink, W as Row, X as SchemaWords, Y as SchemaShape, Z as Words, _ as IdSchemaOf, _t as Ordering, a as DerivedSpecs, at as EqPredicate, b as PageWindow, bt as Query, c as EntityDerived, ct as FieldExpr, d as EntityInput, dt as LiteralExpr, et as AnyQuery, f as EntityMember, ft as NullPredicate, g as IdOf, gt as OrderTerm, h as EntityTypeId, ht as Order, i as DerivedSpec, it as Dependencies, j as SelectionPageTypeId, k as Selection, l as EntityField, lt as InPredicate, m as EntityRelation, mt as Operation, n as Cardinality, nt as ChosenSort, o as Entities, ot as Expr, p as EntityRef, pt as Operandish, q as evaluate, r as Derived, rt as ContainsPredicate, s as Entity, st as FieldDependency, t as AnyEntity, tt as ChosenOrder, u as EntityIdentity, ut as InputExpr, v as InputMember, vt as Placement, w as RelationInput, wt as ValueOf, x as Related, xt as QueryDependencies, y as NestedInput, yt as Predicate, z as BoundWrite } from "./index-DLz2yED-.mjs";
2
- export { AnyEntity, AnyExpr, AnyQuery, type AnyWrite, type BoundWrite, Cardinality, ChosenOrder, ChosenSort, Collation, ContainsPredicate, Dependencies, Derived, DerivedSpec, DerivedSpecs, Entities, Entity, EntityDerived, EntityField, EntityIdentity, EntityInput, EntityMember, EntityRef, EntityRelation, EntityTypeId, EqPredicate, Expr, FieldDependency, FieldExpr, IdOf, IdSchemaOf, InPredicate, InputExpr, InputMember, LiteralExpr, NestedInput, NullPredicate, Operandish, Operation, Order, OrderTerm, Ordering, PageWindow, Placement, Predicate, Query, QueryDependencies, QueryEvaluateError, ReadFilter, Related, RelatedSpecs, Relation, RelationInput, RelationMap, RelationSpec, RelationSpecs, Row, SchemaShape, SchemaWords, Selected, Selection, SelectionPage, SelectionPageTypeId, SelectionTypeId, TargetKey, TermOptions, TextOperand, Unmapped, ValueOf, Words, Write, type WriteLink, type WriteSet, WrittenAs, WrittenKey, WrittenSpec, assertSupported, compareRows, dependenciesOf, evaluate, isPredicate, maxQueryNodes, supported };
1
+ import { $ as Words, A as SelectionPage, At as QueryDependencies, B as Write, C as Relation, Ct as Order, D as RelationSpecs, Dt as Placement, E as RelationSpec, Et as Ordering, F as WrittenAs, Ft as ValueOf, G as Row, H as WriteSet, I as WrittenKey, It as dependenciesOf, J as decided, K as assertSupported, L as WrittenSpec, Lt as isPredicate, M as SelectionTypeId, Mt as ReadsOf, N as TargetKey, Nt as TermOptions, O as Selected, Ot as Predicate, P as Unmapped, Pt as TextOperand, Q as SchemaWords, R as AnyWrite, Rt as maxQueryNodes, S as RelatedSpecs, St as OrPredicate, T as RelationMap, Tt as OrderedOperand, U as PredicateTruth, V as WriteLink, W as QueryEvaluateError, X as supported, Y as evaluate, Z as SchemaShape, _ as IdSchemaOf, _t as LiteralExpr, a as DerivedSpecs, at as ChosenSort, b as PageWindow, bt as Operandish, c as EntityDerived, ct as ContainsPredicate, d as EntityInput, dt as Expr, et as ReadFilter, f as EntityMember, ft as FieldDependency, g as IdOf, gt as Invalid, h as EntityTypeId, ht as InputExpr, i as DerivedSpec, it as ChosenOrder, j as SelectionPageTypeId, jt as Reads, k as Selection, kt as Query, l as EntityField, lt as Dependencies, m as EntityRelation, mt as InPredicate, n as Cardinality, nt as AnyExpr, o as Entities, ot as CompareOperator, p as EntityRef, pt as FieldExpr, q as compareRows, r as Derived, rt as AnyQuery, s as Entity, st as ComparePredicate, t as AnyEntity, tt as AndPredicate, u as EntityIdentity, ut as EqPredicate, v as InputMember, vt as NotPredicate, w as RelationInput, wt as OrderTerm, x as Related, xt as Operation, y as NestedInput, yt as NullPredicate, z as BoundWrite, zt as Collation } from "./index-_x1ScI4v.mjs";
2
+ export { AndPredicate, AnyEntity, AnyExpr, AnyQuery, type AnyWrite, type BoundWrite, Cardinality, ChosenOrder, ChosenSort, Collation, CompareOperator, ComparePredicate, ContainsPredicate, Dependencies, Derived, DerivedSpec, DerivedSpecs, Entities, Entity, EntityDerived, EntityField, EntityIdentity, EntityInput, EntityMember, EntityRef, EntityRelation, EntityTypeId, EqPredicate, Expr, FieldDependency, FieldExpr, IdOf, IdSchemaOf, InPredicate, InputExpr, InputMember, Invalid, LiteralExpr, NestedInput, NotPredicate, NullPredicate, Operandish, Operation, OrPredicate, Order, OrderTerm, OrderedOperand, Ordering, PageWindow, Placement, Predicate, PredicateTruth, Query, QueryDependencies, QueryEvaluateError, ReadFilter, Reads, ReadsOf, Related, RelatedSpecs, Relation, RelationInput, RelationMap, RelationSpec, RelationSpecs, Row, SchemaShape, SchemaWords, Selected, Selection, SelectionPage, SelectionPageTypeId, SelectionTypeId, TargetKey, TermOptions, TextOperand, Unmapped, ValueOf, Words, Write, type WriteLink, type WriteSet, WrittenAs, WrittenKey, WrittenSpec, assertSupported, compareRows, decided, dependenciesOf, evaluate, isPredicate, maxQueryNodes, supported };
package/dist/index.mjs CHANGED
@@ -1,2 +1 @@
1
- import { S as SchemaShape, _ as Query, a as SelectionPageTypeId, b as maxQueryNodes, c as QueryEvaluateError, d as evaluate, f as supported, g as Order, h as Expr, i as Relation, l as assertSupported, m as ReadFilter, n as Entity, o as SelectionTypeId, p as Words, r as EntityTypeId, s as Write, t as Derived, u as compareRows, v as dependenciesOf, x as Collation, y as isPredicate } from "./src-BAA6oWw-.mjs";
2
- export { Collation, Derived, Entity, EntityTypeId, Expr, Order, Query, QueryEvaluateError, ReadFilter, Relation, SchemaShape, SelectionPageTypeId, SelectionTypeId, Words, Write, assertSupported, compareRows, dependenciesOf, evaluate, isPredicate, maxQueryNodes, supported };
1
+ export { S as Collation, t as Derived, n as Entity, r as EntityTypeId, g as Expr, _ as Order, v as Query, c as QueryEvaluateError, h as ReadFilter, i as Relation, C as SchemaShape, a as SelectionPageTypeId, o as SelectionTypeId, m as Words, s as Write, l as assertSupported, u as compareRows, d as decided, y as dependenciesOf, f as evaluate, b as isPredicate, x as maxQueryNodes, p as supported } from "./src-Iz7806gm.mjs";