kern-orm 0.3.0 → 0.4.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.
@@ -273,6 +273,11 @@ interface NestedField {
273
273
  readonly key: string;
274
274
  readonly nested: ResultPlan;
275
275
  }
276
+ /** Field of a record in the template of a result plan: its key and its value before the values of a row are assigned. */
277
+ interface RecordTemplateField {
278
+ readonly key: string;
279
+ readonly value: unknown;
280
+ }
276
281
  /**
277
282
  * How a query returns its rows: `many` as an array; `one` as one row, rejecting without it; `nullable` as one row or `null` without it; `optional` as one row or `undefined` without it.
278
283
  *
@@ -292,6 +297,12 @@ interface ResultPlan extends ResultMode {
292
297
  readonly fields: readonly ResultField[];
293
298
  /** Required relation that guarantees the row of nested rows `one`, such as `field.form`, whose missing row is a `RequiredRelationError` rather than a `NotFoundError`. */
294
299
  readonly guaranteedBy?: string | undefined;
300
+ /**
301
+ * Every field of a record in its order, with the values of its literals, which a row does not hold; `undefined` for a query without literals.
302
+ *
303
+ * A record starts from it, so its keys keep their order whichever of them a row holds.
304
+ */
305
+ readonly recordTemplate?: readonly RecordTemplateField[] | undefined;
295
306
  }
296
307
  /** Error thrown when a query of one row finds no row, executed or nested, unless a required relation guarantees the row. */
297
308
  declare class NotFoundError extends Error {
@@ -481,8 +492,15 @@ interface NestedSelectionNode {
481
492
  /** `Db` that the nested query is bound to, which must be the `Db` that runs the statement. */
482
493
  readonly db: AnyDb | undefined;
483
494
  }
484
- /** Field selected by a query: an expression, or the rows of a nested query. */
485
- type SelectedNode = ProjectionNode | NestedSelectionNode;
495
+ /** Selection of a value from code as the field `key` of every record, which a statement does not select. */
496
+ interface LiteralSelectionNode {
497
+ readonly key: string;
498
+ readonly literal: unknown;
499
+ }
500
+ /** Field that a statement selects: an expression, or the rows of a nested query. */
501
+ type SqlSelectedNode = ProjectionNode | NestedSelectionNode;
502
+ /** Field selected by a query: one that its statement selects, or a literal. */
503
+ type SelectedNode = SqlSelectedNode | LiteralSelectionNode;
486
504
  /** Select query of a table; its result mode applies when it is executed or its rows are nested. */
487
505
  interface QueryNode extends ResultMode {
488
506
  readonly kind: "query";
@@ -506,7 +524,7 @@ interface QueryNode extends ResultMode {
506
524
  * Its result mode is the rows mode of the rows it changes and whether a row is the value of its only field.
507
525
  */
508
526
  type MutationNode = MutationStatementNode<SelectedNode>;
509
- /** Query of `$select` without a source: one record whose fields are the values of expressions and the rows of independent queries. */
527
+ /** Query of `$select` without a source: one record whose fields are the values of expressions, the rows of independent queries, and literals. */
510
528
  interface RecordQueryNode {
511
529
  readonly kind: "record";
512
530
  /** Fields in the order of the record, with unique keys. */
@@ -718,7 +736,7 @@ type OrderTerm = AnyExpression | ScalarQuery | Ordering;
718
736
  /**
719
737
  * References of the callback of `orderBy` to the fields of records `R` selected by a query: their expressions by key.
720
738
  *
721
- * A field of nested rows is among them in types, but reading it throws; a field of an aggregate or of `exists` sorts by its value.
739
+ * A field of nested rows or of a literal is among them in types, but reading it throws; a field of an aggregate or of `exists` sorts by its value.
722
740
  */
723
741
  type SelectedRefs<R> = { readonly [K in keyof R & string]: AnyExpression<R[K]>; };
724
742
  /** Sort keys returned by the callback of `orderBy`: one or an array of them. */
@@ -729,17 +747,38 @@ declare function asc(value: AnyExpression | ScalarQuery): Ordering;
729
747
  declare function desc(value: AnyExpression | ScalarQuery): Ordering;
730
748
  /** Sorts by `value`, an expression or a query of one value, in `direction`, such as `"desc nulls last"`, in the callback of `orderBy`. */
731
749
  declare function orderBy(value: AnyExpression | ScalarQuery, direction: OrderDirection): Ordering;
732
- /** Expressions and nested queries selected under the keys of the result fields; a record has no symbol keys. */
750
+ /**
751
+ * Field of a selection whose value is `T`, made by `literal`.
752
+ *
753
+ * It is not an expression: it has no SQL, so only a selection takes it.
754
+ */
755
+ declare class Literal<out T> {
756
+ /** Value of the field in every record, which the query returns as it is. */
757
+ readonly literal: T;
758
+ constructor(
759
+ /** Value of the field in every record, which the query returns as it is. */
760
+ literal: T);
761
+ /** Rejects the literal as an operand of an expression: a statement has no SQL of it. */
762
+ [operandNode](): never;
763
+ }
764
+ /**
765
+ * Creates a field of a selection with `value` in every record, without selecting anything in SQL: the query returns the value itself, not a copy of it, whatever it is.
766
+ *
767
+ * It lets a branch of a selection skip a column or a nested query, such as `withHint ? field.hint : literal(null)`.
768
+ * To use a value in SQL, such as in a condition, pass it through `param` instead.
769
+ */
770
+ declare function literal<T extends {} | null | undefined>(value: T): Literal<T>;
771
+ /** Expressions, nested queries, and literals selected under the keys of the result fields; a record has no symbol keys. */
733
772
  interface Selection {
734
- readonly [key: string]: TypedExpression | NestedQuery;
773
+ readonly [key: string]: TypedExpression | NestedQuery | Literal<unknown>;
735
774
  readonly [key: symbol]: never;
736
775
  }
737
776
  /** Query whose rows a selection nests as the value of a field: a query of any state and kind, such as a query of a relation. */
738
777
  type NestedQuery = QueryOf<SelectQueryState>;
739
- /** Record of the values of the expressions and of the nested rows of a selection. */
778
+ /** Record of the values of the expressions, of the nested rows, and of the literals of a selection. */
740
779
  type SelectionResult<S extends Selection> = { [K in keyof S]: FieldValue<S[K]>; };
741
- /** Value of a selected field: of an expression, or of the nested rows of a query as the result of executing it, for each member of a union of them. */
742
- type FieldValue<V> = V extends NestedQuery ? QueryResult<V["types"]> : ExpressionValue<V>;
780
+ /** Value of a selected field: of an expression, of the nested rows of a query as the result of executing it, or of a literal, for each member of a union of them. */
781
+ type FieldValue<V> = V extends NestedQuery ? QueryResult<V["types"]> : V extends Literal<infer T> ? T : ExpressionValue<V>;
743
782
  /** Relations whose records the nested queries of a selection select. */
744
783
  type SelectionUses<S extends Selection> = S[keyof S] extends (infer V) ? V extends NestedQuery ? V["types"]["uses"] : never : never;
745
784
  /** Value of a selected expression. */
@@ -810,6 +849,10 @@ interface ScalarQueryState extends SelectQueryState {
810
849
  interface ExpressionQueryState extends ScalarQueryState {
811
850
  readonly valueType: QueryValueType;
812
851
  }
852
+ /** Query of one value of a table with the type of its value, such as of `get` or of an aggregate, which gives the expression of a function the decoding and the operators of its value. */
853
+ interface TypedScalarQuery extends ScalarQuery {
854
+ readonly types: ExpressionQueryState;
855
+ }
813
856
  /** Query of values of a table of any rows, such as of `pluck`, whose value is `T`, which `in` takes as a subquery of its values. */
814
857
  interface ValuesQuery<T = unknown> {
815
858
  readonly types: ValuesQueryState<T>;
@@ -1236,10 +1279,10 @@ interface RecordQueryState<R = unknown, U extends UsedRelation = UsedRelation> e
1236
1279
  readonly value: false;
1237
1280
  readonly uses: U;
1238
1281
  }
1239
- /** State of the query of `$select` of `Sel`: the record of the values of its expressions and the results of its queries. */
1282
+ /** State of the query of `$select` of `Sel`: the record of the values of its expressions and of its literals and the results of its queries. */
1240
1283
  type SelectionState<Sel extends Selection> = RecordQueryState<MergeSelection<EmptyRecord, SelectionResult<Sel>>, SelectionUses<Sel>>;
1241
1284
  /**
1242
- * Immutable query of `$select` of state `S`, unbound or bound to a `Db`: one record whose fields are the values of expressions and the results of independent queries, selected in one statement.
1285
+ * Immutable query of `$select` of state `S`, unbound or bound to a `Db`: one record whose fields are the values of expressions and of literals and the results of independent queries, selected in one statement.
1243
1286
  *
1244
1287
  * An unbound query is not thenable, so it can be returned from async functions; it is compiled with `toSQL` or executed by a `Db`.
1245
1288
  * A bound query executes on its `Db` when awaited.
@@ -1293,7 +1336,7 @@ interface SchemaMembers<T extends Tables, R extends SchemaRelations> extends Sch
1293
1336
  */
1294
1337
  $relations<S extends AnySchema, D extends RelationDeclarations<S["$tables"]>>(this: S, relations: D & CheckDeclarations<S["$tables"], D>): Schema<S["$tables"], MergeRelations<S[typeof schemaRelations] & DeclaredRelations<S["$tables"], D>>>;
1295
1338
  /**
1296
- * Starts an unbound query of one record whose fields are the values of the expressions and the results of the queries of `selection`, selected in one statement.
1339
+ * Starts an unbound query of one record whose fields are the values of the expressions and of the literals and the results of the queries of `selection`, selected in one statement.
1297
1340
  *
1298
1341
  * The value of the field of a query is the result it gives when executed, such as an array of records or one value.
1299
1342
  */
@@ -1978,7 +2021,7 @@ interface DbMethods<T extends Tables, R extends SchemaRelations> {
1978
2021
  */
1979
2022
  $execute<Q extends DbQuery<T, R>>(query: Q): Promise<QueryResult<Q["types"]>>;
1980
2023
  /**
1981
- * Starts a query of one record whose fields are the values of the expressions and the results of the queries of `selection`, selected in one statement when awaited.
2024
+ * Starts a query of one record whose fields are the values of the expressions and of the literals and the results of the queries of `selection`, selected in one statement when awaited.
1982
2025
  *
1983
2026
  * A query of `selection` is unbound or bound to this `Db`, and the value of its field is the result it gives when executed, such as an array of records or one value.
1984
2027
  */
@@ -2222,6 +2265,8 @@ interface SelectNode<From extends SourceNode | undefined = SourceNode | undefine
2222
2265
  readonly offset: ExpressionNode | undefined;
2223
2266
  /** Required relation that guarantees the row of the query, such as `field.form`; see `ResultPlan`. */
2224
2267
  readonly guaranteedBy: string | undefined;
2268
+ /** Template of the records of a query with literals; see `ResultPlan`. */
2269
+ readonly recordTemplate?: readonly RecordTemplateField[] | undefined;
2225
2270
  }
2226
2271
  /** Assignment of `SET` of an update: the value of the column under `key`. */
2227
2272
  interface AssignmentNode {
@@ -2236,6 +2281,8 @@ interface AssignmentNode {
2236
2281
  interface MutationParts<Field> extends ResultMode {
2237
2282
  readonly target: TableSourceNode;
2238
2283
  readonly returning: readonly Field[] | undefined;
2284
+ /** Template of the records of a mutation with literals; see `ResultPlan`. */
2285
+ readonly recordTemplate?: readonly RecordTemplateField[] | undefined;
2239
2286
  }
2240
2287
  /** Insert statement of rows of `VALUES`. */
2241
2288
  interface InsertNode<Field = ProjectionNode> extends MutationParts<Field> {
@@ -2316,19 +2363,92 @@ declare const orderingOperators: {
2316
2363
  ne: EqualityOperator<ComparisonSignature>;
2317
2364
  in: EqualityOperator<InSignature>;
2318
2365
  };
2366
+ /** Operators of the built-in types of numbers: those of `orderingOperators`. */
2367
+ type NumberTypeOperators = MergeOperators<NoOperators, typeof orderingOperators>;
2319
2368
  /** Signature of pattern matching: patterns stay strings even when the text values are transformed. */
2320
2369
  interface PatternSignature extends OperatorSignature {
2321
2370
  readonly method: <V extends Operand<string>>(pattern: V) => Expression<BooleanResult<this["T"] | OperandValue<V>>>;
2322
2371
  }
2372
+ /** Signature of `lower`, `upper`, and `trim`: a value of `text`, whatever the representation of the text values, and `NULL` when the text can be. */
2373
+ interface TextConversionSignature extends OperatorSignature {
2374
+ readonly method: () => Expression<string | (null extends this["T"] ? null : never), TextTypeOperators>;
2375
+ }
2376
+ /** Signature of `length`: the number of characters of the text, and `NULL` when the text can be. */
2377
+ interface TextLengthSignature extends OperatorSignature {
2378
+ readonly method: () => Expression<number | (null extends this["T"] ? null : never), NumberTypeOperators>;
2379
+ }
2380
+ /** Operators of `textOperators`. */
2381
+ type TextOperators = {
2382
+ like: GenericOperator<PatternSignature, AnyExpression<string | null>>;
2383
+ ilike: GenericOperator<PatternSignature, AnyExpression<string | null>>;
2384
+ lower: GenericOperator<TextConversionSignature, AnyExpression<string | null>>;
2385
+ upper: GenericOperator<TextConversionSignature, AnyExpression<string | null>>;
2386
+ trim: GenericOperator<TextConversionSignature, AnyExpression<string | null>>;
2387
+ length: GenericOperator<TextLengthSignature, AnyExpression<string | null>>;
2388
+ };
2389
+ /** Operators of the built-in text types: those of `orderingOperators` and `textOperators`. */
2390
+ type TextTypeOperators = MergeOperators<MergeOperators<NoOperators, typeof orderingOperators>, TextOperators>;
2323
2391
  /**
2324
- * Operators of text types: pattern matching with `LIKE` and `ILIKE`.
2392
+ * Operators of text types: pattern matching with `LIKE` and `ILIKE`, `lower` and `upper`, which convert the case of the text, `trim`, which removes spaces from both of its ends, and `length`, which counts its characters.
2325
2393
  *
2326
2394
  * A string pattern is sent as it is; `param(type, pattern)` encodes it with a type.
2327
2395
  */
2328
- declare const textOperators: {
2329
- like: GenericOperator<PatternSignature, AnyExpression<string | null, unknown>>;
2330
- ilike: GenericOperator<PatternSignature, AnyExpression<string | null, unknown>>;
2331
- };
2396
+ declare const textOperators: TextOperators;
2397
+ /** Condition that always holds, such as for a branch of `and` built in code: `and(check, isAdmin ? TRUE : other)`. */
2398
+ declare const TRUE: Expression<boolean>;
2399
+ /** Condition that never holds, such as for a branch of `or` built in code: `or(check, isAdmin ? other : FALSE)`. */
2400
+ declare const FALSE: Expression<boolean>;
2401
+ /** First operand of `coalesce`, `greatest`, and `least`: an expression with a type, or a query of one value, such as of an aggregate, whose type decodes the result and gives it its operators. */
2402
+ type TypedOperand = TypedExpression | TypedScalarQuery;
2403
+ /** Values that the type of the first operand `F` encodes. */
2404
+ type TypedOperandInput<F> = F extends TypedScalarQuery ? F["types"]["valueType"]["input"] : ExpressionInput<F>;
2405
+ /** Operators of the type of the first operand `F`. */
2406
+ type TypedOperandOperators<F> = F extends TypedScalarQuery ? F["types"]["valueType"]["operators"] : F extends TypedExpression ? ExpressionOperators<F> : never;
2407
+ /** Operand of `coalesce`, `greatest`, and `least` after the first operand `F`: a value that its type encodes, or an expression or a query of one value of its values. */
2408
+ type FollowingOperand<F> = Operand<OperandValue<F>, TypedOperandInput<F>>;
2409
+ /** `null` when every operand can be `NULL`: the first operand `F` and the following operands `R`. */
2410
+ type NullOfEveryOperand<F, R extends readonly unknown[]> = null extends OperandValue<F> ? number extends R["length"] ? null : { [K in keyof R]: null extends OperandValue<R[K]> ? never : true; }[number] extends never ? null : never : never;
2411
+ /** Result of a function of the first operand `F` and the following operands `R` that is `NULL` only when every operand is, whose operands all have the values of `F`. */
2412
+ type NullSkippingResult<F, R extends readonly unknown[]> = Expression<Exclude<OperandValue<F>, null> | NullOfEveryOperand<F, R>, TypedOperandOperators<F>, TypedOperandInput<F>>;
2413
+ /**
2414
+ * Returns the first of its operands other than `NULL`, such as `coalesce(field.hint, "")`, as an expression usable wherever a column is.
2415
+ *
2416
+ * `first` is an expression with a type or a query of one value; its type decodes the result and gives it its operators, and encodes plain values among `rest`.
2417
+ * A query without its row is `NULL` here, unlike with the method `coalesce` of a query, which keeps a missing row missing.
2418
+ */
2419
+ declare function coalesce<F extends TypedOperand, const R extends readonly FollowingOperand<F>[]>(first: F, ...rest: R): NullSkippingResult<F, R>;
2420
+ /**
2421
+ * Returns the largest of its operands, skipping `NULL`, which is the result only when every operand is `NULL`.
2422
+ *
2423
+ * `first` is an expression with a type or a query of one value; its type decodes the result and gives it its operators, and encodes plain values among `rest`.
2424
+ */
2425
+ declare function greatest<F extends TypedOperand, const R extends readonly FollowingOperand<F>[]>(first: F, ...rest: R): NullSkippingResult<F, R>;
2426
+ /**
2427
+ * Returns the smallest of its operands, skipping `NULL`, which is the result only when every operand is `NULL`.
2428
+ *
2429
+ * `first` is an expression with a type or a query of one value; its type decodes the result and gives it its operators, and encodes plain values among `rest`.
2430
+ */
2431
+ declare function least<F extends TypedOperand, const R extends readonly FollowingOperand<F>[]>(first: F, ...rest: R): NullSkippingResult<F, R>;
2432
+ /** Condition of a branch of `caseWhen`: a predicate, or a query of one Boolean value, such as of `exists`. */
2433
+ type CaseCondition = Predicate | ScalarQuery<boolean | null>;
2434
+ /** Value of a branch of `caseWhen` of a type of values `T` that encodes values `I`: an operand of the type, or a plain `null`. */
2435
+ type CaseValue<T, I> = Operand<T, I> | null;
2436
+ /** Branch of `caseWhen`: a condition and the value of the result when it holds. */
2437
+ type CaseBranch<T, I> = readonly [condition: CaseCondition, value: CaseValue<T, I>];
2438
+ /** Value of `caseWhen` of a type of values `T` whose branches and fallback have the values `V`, of which one gives the result. */
2439
+ type CaseResult<T, V> = Exclude<T, null> | Extract<OperandValue<V>, null>;
2440
+ /**
2441
+ * Returns the value of the first branch whose condition holds, as a SQL `CASE` expression, or `NULL` when none holds.
2442
+ *
2443
+ * `type` decodes the result and gives it its operators, and a plain value of a branch is cast to it, so that PostgreSQL does not take plain values for text.
2444
+ */
2445
+ declare function caseWhen<Output, Input, O extends OperatorDefinitions>(type: Type<Output, Input, O, any>, branches: NoInfer<readonly CaseBranch<Output, Input>[]>): Expression<Exclude<Output, null> | null, O, Input>;
2446
+ /**
2447
+ * Returns the value of the first branch whose condition holds, as a SQL `CASE` expression, or `otherwise` when none holds.
2448
+ *
2449
+ * `type` decodes the result and gives it its operators, and a plain value of a branch or of `otherwise` is cast to it, so that PostgreSQL does not take plain values for text.
2450
+ */
2451
+ declare function caseWhen<Output, Input, O extends OperatorDefinitions, const B extends readonly CaseBranch<Output, Input>[], const E extends CaseValue<Output, Input>>(type: Type<Output, Input, O, any>, branches: B, otherwise: E): Expression<CaseResult<Output, B[number][1] | E>, O, Input>;
2332
2452
  /**
2333
2453
  * State of the query that the callback of a helper of table `T` with schema context `C` receives: the fields of the query the helper is applied to, and all its rows.
2334
2454
  *
@@ -2448,4 +2568,4 @@ declare function identifier(...names: [string, ...string[]]): UntypedExpression;
2448
2568
  */
2449
2569
  declare function param<Output, Input, O extends OperatorDefinitions>(type: Type<Output, Input, O, any>, value: Input): Expression<Output, O, Input>;
2450
2570
  declare function param<E extends AnyExpression, V extends (E extends AnyExpression<infer T, infer I> ? Operand<T, I> : never)>(type: E, value: V): V extends AnyExpression ? V : V extends ScalarQuery ? AnyExpression<ScalarQueryValue<V>> : E;
2451
- export { RelationDeclarations as $, ToColumns as $n, SelectedRefs as $t, TestFixture as A, EmptyRecord as An, OperatorDefinitions as Ar, FilteredStateRows as At, InitialSqlQueryState as B, compare as Bn, ExpressionInput as Bt, Database as C, FilteredRows as Cn, Column as Cr, EqualityOperator as Ct, TransactionCoordinator as D, ResultByRows as Dn, BoundOperators as Dr, equalityOperators as Dt, createDatabase as E, QueryResult as En, ToColumn as Er, InSignature as Et, AnyQuery as F, SelectQueryState as Fn, from as Ft, MutationQuery as G, ColumnOperators as Gn, SelectionResult as Gt, SqlQueryState as H, AnyTable as Hn, MergeSelection as Ht, SelectQueryKind as I, BooleanResult as In, ColumnValue as It, MergeRelations as J, KeyColumns as Jn, OrderDirection as Jt, MutationQueryState as K, ColumnShape as Kn, SelectionUses as Kt, AnySqlQuery as L, ComparisonSignature as Ln, InsertValues as Lt, TestHooks as M, QueryState as Mn, GenericOperatorImplementation as Mr, ScalarQuery as Mt, TestTransactionOptions as N, QueryStateOf as Nn, OperatorSignature as Nr, SelectQuery as Nt, OpenedTestFixture as O, ValueRows as On, MergeOperators as Or, AnySelectQuery as Ot, createTestHelpers as P, QueryValueType as Pn, defineGenericOperator as Pr, ValuesQuery as Pt, RelationDeclaration as Q, TableOptions as Qn, Ordering as Qt, DecodedFields as R, Operand as Rn, UpdateSet as Rt, DbQueryState as S, RelationRefs as Sn, AnyColumn as Sr, SelectionState as St, TransactionOptions as T, OneValueRows as Tn, KeyKind as Tr, HasEquality as Tt, AnyMutationQuery as U, AnyTableKeys as Un, NestedQuery as Ut, SqlQuery as V, CompileOptions as Vn, ExpressionValue as Vt, InitialMutationState as W, ColumnDefinitions as Wn, Selection as Wt, OneRelationKeys as X, Table as Xn, OrderTerm as Xt, NoRelations as Y, Selectable as Yn, OrderKey as Yt, Relation as Z, TableKeys as Zn, OrderTerms as Zt, AnyDb as _, not as _n, TypeOperators as _r, Tables as _t, Helper as a, PrimaryKeyValues as an, ResultRows as ar, SchemaRelations as at, DbMutationState as b, ColumnRefs as bn, TypeTransform as br, RecordQuery as bt, PatternSignature as c, WhereCondition as cn, DriverResult as cr, UsableRelation as ct, AnyExpression as d, defineFilter as dn, createStatement as dr, one as dt, asc as en, defineTable as er, RelationKey as et, BaseOperators as f, CombinedCondition as fn, AnyType as fr, AnySchema as ft, UntypedExpression as g, and as gn, TypeInput as gr, SchemaTables as gt, TypedExpression as h, Predicate as hn, Type as hr, SchemaPartRelations as ht, sql as i, NotAKey as in, ResultMode as ir, SchemaContext as it, TestHelpers as j, InitialQueryState as jn, GenericOperator as jr, ResultOf as jt, PendingTestFixture as k, CountValueType as kn, NoOperators as kr, BoundSelectQuery as kt, textOperators as l, WhereFilter as ln, SqlStatement as lr, UsedRelation as lt, ExpressionOperators as m, ConditionOperand as mn, TextValue as mr, SchemaPart as mt, identifier as n, orderBy as nn, RequiredRelationError as nr, RelationKind as nt, HelperEffect as o, EqValue as on, Connection as or, TableContext as ot, Expression as p, Condition as pn, BaseType as pr, Schema as pt, DeclaredRelations as q, ColumnValues as qn, OrderColumns as qt, param as r, KeyCheck as rn, ResultDecodeError as rr, RequiredMember as rt, defineHelper as s, WhereCallback as sn, Driver as sr, TableRelations as st, SqlTemplate as t, desc as tn, NotFoundError as tr, RelationKeys as tt, orderingOperators as u, WhereValues as un, TransactionFailure as ur, many as ut, BindOptions as v, or as vn, TypeOptions as vr, defineSchema as vt, DatabaseOptions as w, OneRow as wn, ColumnAttributes as wr, EqualityOperators as wt, DbOf as x, QueryContext as xn, defineType as xr, RecordQueryState as xt, Db as y, ExistsValueType as yn, TypeOutput as yr, AnyRecordQuery as yt, FieldTypes as z, OperandValue as zn, UpdateValues as zt };
2571
+ export { SelectQueryKind as $, QueryStateOf as $n, OperatorSignature as $r, from as $t, Expression as A, WhereValues as An, TransactionFailure as Ar, Schema as At, Database as B, ColumnRefs as Bn, TypeTransform as Br, EqualityOperator as Bt, TextOperators as C, KeyCheck as Cn, ResultDecodeError as Cr, TableContext as Ct, orderingOperators as D, WhereCallback as Dn, Driver as Dr, many as Dt, NumberTypeOperators as E, EqValue as En, Connection as Er, UsedRelation as Et, BindOptions as F, Predicate as Fn, Type as Fr, defineSchema as Ft, OpenedTestFixture as G, OneValueRows as Gn, KeyKind as Gr, AnySelectQuery as Gt, TransactionOptions as H, RelationRefs as Hn, AnyColumn as Hr, HasEquality as Ht, Db as I, and as In, TypeInput as Ir, AnyRecordQuery as It, TestHelpers as J, ValueRows as Jn, MergeOperators as Jr, ResultOf as Jt, PendingTestFixture as K, QueryResult as Kn, ToColumn as Kr, BoundSelectQuery as Kt, DbMutationState as L, not as Ln, TypeOperators as Lr, RecordQuery as Lt, TypedExpression as M, CombinedCondition as Mn, AnyType as Mr, SchemaPartRelations as Mt, UntypedExpression as N, Condition as Nn, BaseType as Nr, SchemaTables as Nt, AnyExpression as O, WhereCondition as On, DriverResult as Or, one as Ot, AnyDb as P, ConditionOperand as Pn, TextValue as Pr, Tables as Pt, AnyQuery as Q, QueryState as Qn, GenericOperatorImplementation as Qr, ValuesQuery as Qt, DbOf as R, or as Rn, TypeOptions as Rr, RecordQueryState as Rt, TextLengthSignature as S, orderBy as Sn, RequiredRelationError as Sr, SchemaRelations as St, textOperators as T, PrimaryKeyValues as Tn, ResultRows as Tr, UsableRelation as Tt, createDatabase as U, FilteredRows as Un, Column as Ur, InSignature as Ut, DatabaseOptions as V, QueryContext as Vn, defineType as Vr, EqualityOperators as Vt, TransactionCoordinator as W, OneRow as Wn, ColumnAttributes as Wr, equalityOperators as Wt, TestTransactionOptions as X, EmptyRecord as Xn, OperatorDefinitions as Xr, SelectQuery as Xt, TestHooks as Y, CountValueType as Yn, NoOperators as Yr, ScalarQuery as Yt, createTestHelpers as Z, InitialQueryState as Zn, GenericOperator as Zr, TypedScalarQuery as Zt, least as _, OrderTerms as _n, TableKeys as _r, RelationKey as _t, Helper as a, ExpressionValue as an, OperandValue as ar, SqlQueryState as at, PatternSignature as b, asc as bn, defineTable as br, RequiredMember as bt, CaseBranch as c, Selection as cn, AnyTable as cr, MutationQuery as ct, FollowingOperand as d, Literal as dn, ColumnOperators as dr, MergeRelations as dt, defineGenericOperator as ei, ColumnValue as en, QueryValueType as er, AnySqlQuery as et, NullSkippingResult as f, literal as fn, ColumnShape as fr, NoRelations as ft, greatest as g, OrderTerm as gn, Table as gr, RelationDeclarations as gt, coalesce as h, OrderKey as hn, Selectable as hr, RelationDeclaration as ht, sql as i, ExpressionInput as in, Operand as ir, SqlQuery as it, ExpressionOperators as j, defineFilter as jn, createStatement as jr, SchemaPart as jt, BaseOperators as k, WhereFilter as kn, SqlStatement as kr, AnySchema as kt, CaseCondition as l, SelectionResult as ln, AnyTableKeys as lr, MutationQueryState as lt, caseWhen as m, OrderDirection as mn, KeyColumns as mr, Relation as mt, identifier as n, UpdateSet as nn, BooleanResult as nr, FieldTypes as nt, HelperEffect as o, MergeSelection as on, compare as or, AnyMutationQuery as ot, TypedOperand as p, OrderColumns as pn, ColumnValues as pr, OneRelationKeys as pt, TestFixture as q, ResultByRows as qn, BoundOperators as qr, FilteredStateRows as qt, param as r, UpdateValues as rn, ComparisonSignature as rr, InitialSqlQueryState as rt, defineHelper as s, NestedQuery as sn, CompileOptions as sr, InitialMutationState as st, SqlTemplate as t, InsertValues as tn, SelectQueryState as tr, DecodedFields as tt, CaseValue as u, SelectionUses as un, ColumnDefinitions as ur, DeclaredRelations as ut, FALSE as v, Ordering as vn, TableOptions as vr, RelationKeys as vt, TextTypeOperators as w, NotAKey as wn, ResultMode as wr, TableRelations as wt, TextConversionSignature as x, desc as xn, NotFoundError as xr, SchemaContext as xt, TRUE as y, SelectedRefs as yn, ToColumns as yr, RelationKind as yt, DbQueryState as z, ExistsValueType as zn, TypeOutput as zr, SelectionState as zt };
package/dist/index.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as RelationDeclarations, $n as ToColumns, $t as SelectedRefs, An as EmptyRecord, Ar as OperatorDefinitions, At as FilteredStateRows, B as InitialSqlQueryState, Bn as compare, Bt as ExpressionInput, C as Database, Cn as FilteredRows, Cr as Column, Ct as EqualityOperator, D as TransactionCoordinator, Dn as ResultByRows, Dr as BoundOperators, Dt as equalityOperators, E as createDatabase, En as QueryResult, Er as ToColumn, Et as InSignature, F as AnyQuery, Fn as SelectQueryState, Ft as from, G as MutationQuery, Gn as ColumnOperators, Gt as SelectionResult, H as SqlQueryState, Hn as AnyTable, Ht as MergeSelection, I as SelectQueryKind, In as BooleanResult, It as ColumnValue, J as MergeRelations, Jn as KeyColumns, Jt as OrderDirection, K as MutationQueryState, Kn as ColumnShape, Kt as SelectionUses, L as AnySqlQuery, Ln as ComparisonSignature, Lt as InsertValues, Mn as QueryState, Mr as GenericOperatorImplementation, Mt as ScalarQuery, Nn as QueryStateOf, Nr as OperatorSignature, Nt as SelectQuery, On as ValueRows, Or as MergeOperators, Ot as AnySelectQuery, Pn as QueryValueType, Pr as defineGenericOperator, Pt as ValuesQuery, Q as RelationDeclaration, Qn as TableOptions, Qt as Ordering, R as DecodedFields, Rn as Operand, Rt as UpdateSet, S as DbQueryState, Sn as RelationRefs, Sr as AnyColumn, St as SelectionState, T as TransactionOptions, Tn as OneValueRows, Tr as KeyKind, Tt as HasEquality, U as AnyMutationQuery, Un as AnyTableKeys, Ut as NestedQuery, V as SqlQuery, Vn as CompileOptions, Vt as ExpressionValue, W as InitialMutationState, Wn as ColumnDefinitions, Wt as Selection, X as OneRelationKeys, Xn as Table, Xt as OrderTerm, Y as NoRelations, Yn as Selectable, Yt as OrderKey, Z as Relation, Zn as TableKeys, Zt as OrderTerms, _ as AnyDb, _n as not, _r as TypeOperators, _t as Tables, a as Helper, an as PrimaryKeyValues, ar as ResultRows, at as SchemaRelations, b as DbMutationState, bn as ColumnRefs, br as TypeTransform, bt as RecordQuery, c as PatternSignature, cn as WhereCondition, cr as DriverResult, ct as UsableRelation, d as AnyExpression, dn as defineFilter, dr as createStatement, dt as one, en as asc, er as defineTable, et as RelationKey, f as BaseOperators, fn as CombinedCondition, fr as AnyType, ft as AnySchema, g as UntypedExpression, gn as and, gr as TypeInput, gt as SchemaTables, h as TypedExpression, hn as Predicate, hr as Type, ht as SchemaPartRelations, i as sql, in as NotAKey, ir as ResultMode, it as SchemaContext, jn as InitialQueryState, jr as GenericOperator, jt as ResultOf, kn as CountValueType, kr as NoOperators, kt as BoundSelectQuery, l as textOperators, ln as WhereFilter, lr as SqlStatement, lt as UsedRelation, m as ExpressionOperators, mn as ConditionOperand, mr as TextValue, mt as SchemaPart, n as identifier, nn as orderBy, nr as RequiredRelationError, nt as RelationKind, o as HelperEffect, on as EqValue, or as Connection, ot as TableContext, p as Expression, pn as Condition, pr as BaseType, pt as Schema, q as DeclaredRelations, qn as ColumnValues, qt as OrderColumns, r as param, rn as KeyCheck, rr as ResultDecodeError, rt as RequiredMember, s as defineHelper, sn as WhereCallback, sr as Driver, st as TableRelations, t as SqlTemplate, tn as desc, tr as NotFoundError, tt as RelationKeys, u as orderingOperators, un as WhereValues, ur as TransactionFailure, ut as many, v as BindOptions, vn as or, vr as TypeOptions, vt as defineSchema, w as DatabaseOptions, wn as OneRow, wr as ColumnAttributes, wt as EqualityOperators, x as DbOf, xn as QueryContext, xr as defineType, xt as RecordQueryState, y as Db, yn as ExistsValueType, yr as TypeOutput, yt as AnyRecordQuery, z as FieldTypes, zn as OperandValue, zt as UpdateValues } from "./index-CNqYlONX.mjs";
2
- export { type AnyColumn, type AnyDb, type AnyExpression, type AnyMutationQuery, type AnyQuery, type AnyRecordQuery, type AnySchema, type AnySelectQuery, type AnySqlQuery, type AnyTable, type AnyTableKeys, type AnyType, type BaseOperators, type BaseType, type BindOptions, type BooleanResult, type BoundOperators, type BoundSelectQuery, type Column, type ColumnAttributes, type ColumnDefinitions, type ColumnOperators, type ColumnRefs, type ColumnShape, type ColumnValue, type ColumnValues, type CombinedCondition, type ComparisonSignature, type CompileOptions, type Condition, type ConditionOperand, type Connection, type CountValueType, type Database, type DatabaseOptions, type Db, type DbMutationState, type DbOf, type DbQueryState, type DeclaredRelations, type DecodedFields, type Driver, type DriverResult, type EmptyRecord, type EqValue, type EqualityOperator, type EqualityOperators, type ExistsValueType, type Expression, type ExpressionInput, type ExpressionOperators, type ExpressionValue, type FieldTypes, type FilteredRows, type FilteredStateRows, type GenericOperator, type GenericOperatorImplementation, type HasEquality, type Helper, type HelperEffect, type InSignature, type InitialMutationState, type InitialQueryState, type InitialSqlQueryState, type InsertValues, type KeyCheck, type KeyColumns, type KeyKind, type MergeOperators, type MergeRelations, type MergeSelection, type MutationQuery, type MutationQueryState, type NestedQuery, type NoOperators, type NoRelations, type NotAKey, NotFoundError, type OneRelationKeys, type OneRow, type OneValueRows, type Operand, type OperandValue, type OperatorDefinitions, type OperatorSignature, type OrderColumns, type OrderDirection, type OrderKey, type OrderTerm, type OrderTerms, type Ordering, type PatternSignature, type Predicate, type PrimaryKeyValues, type QueryContext, type QueryResult, type QueryState, type QueryStateOf, type QueryValueType, type RecordQuery, type RecordQueryState, type Relation, type RelationDeclaration, type RelationDeclarations, type RelationKey, type RelationKeys, type RelationKind, type RelationRefs, type RequiredMember, RequiredRelationError, type ResultByRows, ResultDecodeError, type ResultMode, type ResultOf, type ResultRows, type ScalarQuery, type Schema, type SchemaContext, type SchemaPart, type SchemaPartRelations, type SchemaRelations, type SchemaTables, type SelectQuery, type SelectQueryKind, type SelectQueryState, type Selectable, type SelectedRefs, type Selection, type SelectionResult, type SelectionState, type SelectionUses, type SqlQuery, type SqlQueryState, type SqlStatement, type SqlTemplate, type Table, type TableContext, type TableKeys, type TableOptions, type TableRelations, type Tables, type TextValue, type ToColumn, type ToColumns, type TransactionCoordinator, type TransactionFailure, type TransactionOptions, type Type, type TypeInput, type TypeOperators, type TypeOptions, type TypeOutput, type TypeTransform, type TypedExpression, type UntypedExpression, type UpdateSet, type UpdateValues, type UsableRelation, type UsedRelation, type ValueRows, type ValuesQuery, type WhereCallback, type WhereCondition, type WhereFilter, type WhereValues, and, asc, compare, createDatabase, createStatement, defineFilter, defineGenericOperator, defineHelper, defineSchema, defineTable, defineType, desc, equalityOperators, from, identifier, many, not, one, or, orderBy, orderingOperators, param, sql, textOperators };
1
+ import { $ as SelectQueryKind, $n as QueryStateOf, $r as OperatorSignature, $t as from, A as Expression, An as WhereValues, Ar as TransactionFailure, At as Schema, B as Database, Bn as ColumnRefs, Br as TypeTransform, Bt as EqualityOperator, C as TextOperators, Cn as KeyCheck, Cr as ResultDecodeError, Ct as TableContext, D as orderingOperators, Dn as WhereCallback, Dr as Driver, Dt as many, E as NumberTypeOperators, En as EqValue, Er as Connection, Et as UsedRelation, F as BindOptions, Fn as Predicate, Fr as Type, Ft as defineSchema, Gn as OneValueRows, Gr as KeyKind, Gt as AnySelectQuery, H as TransactionOptions, Hn as RelationRefs, Hr as AnyColumn, Ht as HasEquality, I as Db, In as and, Ir as TypeInput, It as AnyRecordQuery, Jn as ValueRows, Jr as MergeOperators, Jt as ResultOf, Kn as QueryResult, Kr as ToColumn, Kt as BoundSelectQuery, L as DbMutationState, Ln as not, Lr as TypeOperators, Lt as RecordQuery, M as TypedExpression, Mn as CombinedCondition, Mr as AnyType, Mt as SchemaPartRelations, N as UntypedExpression, Nn as Condition, Nr as BaseType, Nt as SchemaTables, O as AnyExpression, On as WhereCondition, Or as DriverResult, Ot as one, P as AnyDb, Pn as ConditionOperand, Pr as TextValue, Pt as Tables, Q as AnyQuery, Qn as QueryState, Qr as GenericOperatorImplementation, Qt as ValuesQuery, R as DbOf, Rn as or, Rr as TypeOptions, Rt as RecordQueryState, S as TextLengthSignature, Sn as orderBy, Sr as RequiredRelationError, St as SchemaRelations, T as textOperators, Tn as PrimaryKeyValues, Tr as ResultRows, Tt as UsableRelation, U as createDatabase, Un as FilteredRows, Ur as Column, Ut as InSignature, V as DatabaseOptions, Vn as QueryContext, Vr as defineType, Vt as EqualityOperators, W as TransactionCoordinator, Wn as OneRow, Wr as ColumnAttributes, Wt as equalityOperators, Xn as EmptyRecord, Xr as OperatorDefinitions, Xt as SelectQuery, Yn as CountValueType, Yr as NoOperators, Yt as ScalarQuery, Zn as InitialQueryState, Zr as GenericOperator, Zt as TypedScalarQuery, _ as least, _n as OrderTerms, _r as TableKeys, _t as RelationKey, a as Helper, an as ExpressionValue, ar as OperandValue, at as SqlQueryState, b as PatternSignature, bn as asc, br as defineTable, bt as RequiredMember, c as CaseBranch, cn as Selection, cr as AnyTable, ct as MutationQuery, d as FollowingOperand, dn as Literal, dr as ColumnOperators, dt as MergeRelations, ei as defineGenericOperator, en as ColumnValue, er as QueryValueType, et as AnySqlQuery, f as NullSkippingResult, fn as literal, fr as ColumnShape, ft as NoRelations, g as greatest, gn as OrderTerm, gr as Table, gt as RelationDeclarations, h as coalesce, hn as OrderKey, hr as Selectable, ht as RelationDeclaration, i as sql, in as ExpressionInput, ir as Operand, it as SqlQuery, j as ExpressionOperators, jn as defineFilter, jr as createStatement, jt as SchemaPart, k as BaseOperators, kn as WhereFilter, kr as SqlStatement, kt as AnySchema, l as CaseCondition, ln as SelectionResult, lr as AnyTableKeys, lt as MutationQueryState, m as caseWhen, mn as OrderDirection, mr as KeyColumns, mt as Relation, n as identifier, nn as UpdateSet, nr as BooleanResult, nt as FieldTypes, o as HelperEffect, on as MergeSelection, or as compare, ot as AnyMutationQuery, p as TypedOperand, pn as OrderColumns, pr as ColumnValues, pt as OneRelationKeys, qn as ResultByRows, qr as BoundOperators, qt as FilteredStateRows, r as param, rn as UpdateValues, rr as ComparisonSignature, rt as InitialSqlQueryState, s as defineHelper, sn as NestedQuery, sr as CompileOptions, st as InitialMutationState, t as SqlTemplate, tn as InsertValues, tr as SelectQueryState, tt as DecodedFields, u as CaseValue, un as SelectionUses, ur as ColumnDefinitions, ut as DeclaredRelations, v as FALSE, vn as Ordering, vr as TableOptions, vt as RelationKeys, w as TextTypeOperators, wn as NotAKey, wr as ResultMode, wt as TableRelations, x as TextConversionSignature, xn as desc, xr as NotFoundError, xt as SchemaContext, y as TRUE, yn as SelectedRefs, yr as ToColumns, yt as RelationKind, z as DbQueryState, zn as ExistsValueType, zr as TypeOutput, zt as SelectionState } from "./index--0tyG7sU.mjs";
2
+ export { type AnyColumn, type AnyDb, type AnyExpression, type AnyMutationQuery, type AnyQuery, type AnyRecordQuery, type AnySchema, type AnySelectQuery, type AnySqlQuery, type AnyTable, type AnyTableKeys, type AnyType, type BaseOperators, type BaseType, type BindOptions, type BooleanResult, type BoundOperators, type BoundSelectQuery, type CaseBranch, type CaseCondition, type CaseValue, type Column, type ColumnAttributes, type ColumnDefinitions, type ColumnOperators, type ColumnRefs, type ColumnShape, type ColumnValue, type ColumnValues, type CombinedCondition, type ComparisonSignature, type CompileOptions, type Condition, type ConditionOperand, type Connection, type CountValueType, type Database, type DatabaseOptions, type Db, type DbMutationState, type DbOf, type DbQueryState, type DeclaredRelations, type DecodedFields, type Driver, type DriverResult, type EmptyRecord, type EqValue, type EqualityOperator, type EqualityOperators, type ExistsValueType, type Expression, type ExpressionInput, type ExpressionOperators, type ExpressionValue, FALSE, type FieldTypes, type FilteredRows, type FilteredStateRows, type FollowingOperand, type GenericOperator, type GenericOperatorImplementation, type HasEquality, type Helper, type HelperEffect, type InSignature, type InitialMutationState, type InitialQueryState, type InitialSqlQueryState, type InsertValues, type KeyCheck, type KeyColumns, type KeyKind, type Literal, type MergeOperators, type MergeRelations, type MergeSelection, type MutationQuery, type MutationQueryState, type NestedQuery, type NoOperators, type NoRelations, type NotAKey, NotFoundError, type NullSkippingResult, type NumberTypeOperators, type OneRelationKeys, type OneRow, type OneValueRows, type Operand, type OperandValue, type OperatorDefinitions, type OperatorSignature, type OrderColumns, type OrderDirection, type OrderKey, type OrderTerm, type OrderTerms, type Ordering, type PatternSignature, type Predicate, type PrimaryKeyValues, type QueryContext, type QueryResult, type QueryState, type QueryStateOf, type QueryValueType, type RecordQuery, type RecordQueryState, type Relation, type RelationDeclaration, type RelationDeclarations, type RelationKey, type RelationKeys, type RelationKind, type RelationRefs, type RequiredMember, RequiredRelationError, type ResultByRows, ResultDecodeError, type ResultMode, type ResultOf, type ResultRows, type ScalarQuery, type Schema, type SchemaContext, type SchemaPart, type SchemaPartRelations, type SchemaRelations, type SchemaTables, type SelectQuery, type SelectQueryKind, type SelectQueryState, type Selectable, type SelectedRefs, type Selection, type SelectionResult, type SelectionState, type SelectionUses, type SqlQuery, type SqlQueryState, type SqlStatement, type SqlTemplate, TRUE, type Table, type TableContext, type TableKeys, type TableOptions, type TableRelations, type Tables, type TextConversionSignature, type TextLengthSignature, type TextOperators, type TextTypeOperators, type TextValue, type ToColumn, type ToColumns, type TransactionCoordinator, type TransactionFailure, type TransactionOptions, type Type, type TypeInput, type TypeOperators, type TypeOptions, type TypeOutput, type TypeTransform, type TypedExpression, type TypedOperand, type TypedScalarQuery, type UntypedExpression, type UpdateSet, type UpdateValues, type UsableRelation, type UsedRelation, type ValueRows, type ValuesQuery, type WhereCallback, type WhereCondition, type WhereFilter, type WhereValues, and, asc, caseWhen, coalesce, compare, createDatabase, createStatement, defineFilter, defineGenericOperator, defineHelper, defineSchema, defineTable, defineType, desc, equalityOperators, from, greatest, identifier, least, literal, many, not, one, or, orderBy, orderingOperators, param, sql, textOperators };