pqb 0.72.0 → 0.72.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { AsyncLocalStorage } from "node:async_hooks";
2
2
  import { inspect } from "node:util";
3
+ import tag from "tagged-tag";
3
4
  type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends ((x: infer I) => void) ? I : never;
4
5
  type MaybeArray<T> = T | T[];
5
6
  type MaybePromise<T> = T | Promise<T>;
@@ -21,7 +22,7 @@ interface RecordOptionalString {
21
22
  interface RecordUnknown {
22
23
  [K: string]: unknown;
23
24
  }
24
- type ShallowSimplify<T> = T extends any ? { [K in keyof T]: T[K] } : T;
25
+ type ShallowSimplify<T> = T extends any ? { [K in keyof T]: T[K]; } : T;
25
26
  /**
26
27
  * Merge methods from multiple class into another class.
27
28
  * @param derivedCtor - target class to merge methods into
@@ -241,7 +242,7 @@ declare abstract class QueryError<T extends PickQueryShape = PickQueryShape> ext
241
242
  line: string | undefined;
242
243
  routine: string | undefined;
243
244
  get isUnique(): boolean;
244
- get columns(): { [K in keyof T["shape"]]?: true | undefined };
245
+ get columns(): { [K in keyof T["shape"]]?: true | undefined; };
245
246
  }
246
247
  interface QueryLogObject {
247
248
  colors: boolean;
@@ -265,7 +266,7 @@ declare const logColors: {
265
266
  boldMagenta: (message: string) => string;
266
267
  boldRed: (message: string) => string;
267
268
  };
268
- declare const logParamToLogObject: (logger: QueryLogger, log: QueryLogOptions["log"]) => QueryLogObject | undefined;
269
+ declare const logParamToLogObject: (logger: QueryLogger, log: QueryLogOptions['log']) => QueryLogObject | undefined;
269
270
  declare class QueryLog {
270
271
  /**
271
272
  * Override the `log` option, which can also be set in `createDb` or when creating a table instance:
@@ -629,6 +630,10 @@ declare class SqlRefExpression extends Expression {
629
630
  makeSQL(): string;
630
631
  }
631
632
  interface ColumnSchemaGetterTableClass {
633
+ data?: {
634
+ table: string | undefined;
635
+ name: string | undefined;
636
+ };
632
637
  prototype: {
633
638
  columns: {
634
639
  shape: Column.Shape.ForValidation;
@@ -909,7 +914,7 @@ interface TableDataMethods<Key extends PropertyKey> {
909
914
  };
910
915
  unique<Columns extends [Key | TableData.Index.ColumnOrExpressionOptions<Key>, ...(Key | TableData.Index.ColumnOrExpressionOptions<Key>)[]], Name extends string>(columns: Columns, options?: TableData.Index.UniqueOptionsArg<Name>): {
911
916
  tableDataItem: true;
912
- columns: Columns extends (Key | TableData.Index.ColumnOptionsForColumn<Key>)[] ? { [I in keyof Columns]: 'column' extends keyof Columns[I] ? Columns[I]['column'] : Columns[I] } : never;
917
+ columns: Columns extends (Key | TableData.Index.ColumnOptionsForColumn<Key>)[] ? { [I in keyof Columns]: 'column' extends keyof Columns[I] ? Columns[I]['column'] : Columns[I]; } : never;
913
918
  name: string extends Name ? never : Name;
914
919
  };
915
920
  index(columns: (Key | TableData.Index.ColumnOrExpressionOptions<Key>)[], options?: TableData.Index.OptionsArg): NonUniqDataItem;
@@ -998,8 +1003,8 @@ interface TableDataMethods<Key extends PropertyKey> {
998
1003
  check(check: RawSqlBase, name?: string): NonUniqDataItem;
999
1004
  sql: SqlFn;
1000
1005
  }
1001
- type TableDataItemsUniqueColumns<Shape extends Column.QueryColumns, T extends MaybeArray<TableDataItem>> = MaybeArray<TableDataItem> extends T ? never : T extends UniqueTableDataItem<Shape> ? ItemUniqueColumns<Shape, T> : T extends unknown[] ? { [Item in T[number] as PropertyKey]: Item extends UniqueTableDataItem<Shape> ? ItemUniqueColumns<Shape, Item> : never }[PropertyKey] : never;
1002
- type ItemUniqueColumns<Shape extends Column.QueryColumns, T extends UniqueTableDataItem<Shape>> = { [Column in T['columns'][number]]: UniqueQueryTypeOrExpression<Shape[Column]['__queryType']> };
1006
+ type TableDataItemsUniqueColumns<Shape extends Column.QueryColumns, T extends MaybeArray<TableDataItem>> = MaybeArray<TableDataItem> extends T ? never : T extends UniqueTableDataItem<Shape> ? ItemUniqueColumns<Shape, T> : T extends unknown[] ? { [Item in T[number] as PropertyKey]: Item extends UniqueTableDataItem<Shape> ? ItemUniqueColumns<Shape, Item> : never; }[PropertyKey] : never;
1007
+ type ItemUniqueColumns<Shape extends Column.QueryColumns, T extends UniqueTableDataItem<Shape>> = { [Column in T['columns'][number]]: UniqueQueryTypeOrExpression<Shape[Column]['__queryType']>; };
1003
1008
  type TableDataItemsUniqueColumnTuples<Shape extends Column.QueryColumns, T extends MaybeArray<TableDataItem>> = MaybeArray<TableDataItem> extends T ? never : T extends UniqueTableDataItem<Shape> ? T['columns'] : T extends TableDataItem[] ? Exclude<T[number]['columns'], []> : never;
1004
1009
  type UniqueQueryTypeOrExpression<T> = T | Expression<Column.Pick.QueryColumnOfType<T>>;
1005
1010
  type TableDataItemsUniqueConstraints<T extends MaybeArray<TableDataItem>> = MaybeArray<TableDataItem> extends T ? never : T extends UniqueTableDataItem ? T['name'] : T extends UniqueTableDataItem[] ? T[number]['name'] : never;
@@ -1090,12 +1095,7 @@ declare const excludeInnerToCode: (item: TableData.Exclude, t: string) => Codes;
1090
1095
  declare const excludeToCode: (item: TableData.Exclude, t: string, prefix?: string) => Codes;
1091
1096
  declare const constraintToCode: (item: TableData.Constraint, t: string, m?: boolean, prefix?: string, ctx?: ColumnToCodeCtx) => Codes;
1092
1097
  declare const constraintInnerToCode: (item: TableData.Constraint, t: string, m?: boolean, ctx?: ColumnToCodeCtx) => Codes;
1093
- declare const referencesArgsToCode: ({
1094
- columns,
1095
- fnOrTable,
1096
- foreignColumns,
1097
- options
1098
- }: Exclude<TableData.Constraint["references"], undefined>, name?: string | false, m?: boolean) => Codes;
1098
+ declare const referencesArgsToCode: ({ columns, fnOrTable, foreignColumns, options }: Exclude<TableData.Constraint['references'], undefined>, name?: string | false, m?: boolean) => Codes;
1099
1099
  interface NumberColumnData extends BaseNumberData, Column.Data {
1100
1100
  identity?: TableData.Identity;
1101
1101
  }
@@ -1140,46 +1140,46 @@ declare class DecimalColumn<Schema extends ColumnSchemaConfig> extends NumberAsS
1140
1140
  data: DecimalColumnData;
1141
1141
  querySchema: ReturnType<Schema['stringSchema']>;
1142
1142
  operators: OperatorsNumber;
1143
- dataType: "numeric";
1143
+ dataType: 'numeric';
1144
1144
  constructor(schema: Schema, numericPrecision?: number, numericScale?: number);
1145
1145
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
1146
1146
  toSQL(): string;
1147
1147
  }
1148
1148
  declare class SmallIntColumn<Schema extends ColumnSchemaConfig> extends IntegerBaseColumn<Schema> {
1149
- dataType: "int2";
1149
+ dataType: 'int2';
1150
1150
  querySchema: ReturnType<Schema['int']>;
1151
1151
  constructor(schema: Schema);
1152
1152
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
1153
1153
  identity<T extends Column.Pick.Data>(this: T, options?: TableData.Identity): Column.HasDefault<T>;
1154
1154
  }
1155
1155
  declare class IntegerColumn<Schema extends ColumnSchemaConfig> extends IntegerBaseColumn<Schema> {
1156
- dataType: "int4";
1156
+ dataType: 'int4';
1157
1157
  querySchema: ReturnType<Schema['int']>;
1158
1158
  constructor(schema: Schema);
1159
1159
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
1160
1160
  identity<T extends Column.Pick.Data>(this: T, options?: TableData.Identity): Column.HasDefault<T>;
1161
1161
  }
1162
1162
  declare class BigIntColumn<Schema extends ColumnSchemaConfig> extends NumberAsStringBaseColumn<Schema, string | number | bigint> {
1163
- dataType: "int8";
1163
+ dataType: 'int8';
1164
1164
  querySchema: ReturnType<Schema['stringSchema']>;
1165
1165
  constructor(schema: Schema);
1166
1166
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
1167
1167
  identity<T extends Column.Pick.Data>(this: T, options?: TableData.Identity): Column.HasDefault<T>;
1168
1168
  }
1169
1169
  declare class RealColumn<Schema extends ColumnSchemaConfig> extends NumberBaseColumn<Schema, ReturnType<Schema['number']>> {
1170
- dataType: "float4";
1170
+ dataType: 'float4';
1171
1171
  querySchema: ReturnType<Schema['number']>;
1172
1172
  constructor(schema: Schema);
1173
1173
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
1174
1174
  }
1175
1175
  declare class DoublePrecisionColumn<Schema extends ColumnSchemaConfig> extends NumberAsStringBaseColumn<Schema> {
1176
- dataType: "float8";
1176
+ dataType: 'float8';
1177
1177
  querySchema: ReturnType<Schema['stringSchema']>;
1178
1178
  constructor(schema: Schema);
1179
1179
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
1180
1180
  }
1181
1181
  declare class SmallSerialColumn<Schema extends ColumnSchemaConfig> extends IntegerBaseColumn<Schema> {
1182
- dataType: "int2";
1182
+ dataType: 'int2';
1183
1183
  data: SerialColumnData;
1184
1184
  querySchema: ReturnType<Schema['int']>;
1185
1185
  constructor(schema: Schema);
@@ -1187,7 +1187,7 @@ declare class SmallSerialColumn<Schema extends ColumnSchemaConfig> extends Integ
1187
1187
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
1188
1188
  }
1189
1189
  declare class SerialColumn<Schema extends ColumnSchemaConfig> extends IntegerBaseColumn<Schema> {
1190
- dataType: "int4";
1190
+ dataType: 'int4';
1191
1191
  data: SerialColumnData;
1192
1192
  querySchema: ReturnType<Schema['int']>;
1193
1193
  constructor(schema: Schema);
@@ -1195,7 +1195,7 @@ declare class SerialColumn<Schema extends ColumnSchemaConfig> extends IntegerBas
1195
1195
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
1196
1196
  }
1197
1197
  declare class BigSerialColumn<Schema extends ColumnSchemaConfig> extends NumberAsStringBaseColumn<Schema> {
1198
- dataType: "int8";
1198
+ dataType: 'int8';
1199
1199
  data: SerialColumnData;
1200
1200
  querySchema: ReturnType<Schema['stringSchema']>;
1201
1201
  constructor(schema: Schema);
@@ -1203,14 +1203,16 @@ declare class BigSerialColumn<Schema extends ColumnSchemaConfig> extends NumberA
1203
1203
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
1204
1204
  }
1205
1205
  type DateColumnInput = string | number | Date;
1206
+ declare const parseStringOrDateToNumber: (value: unknown) => number;
1206
1207
  declare const getDateAsNumberFn: (column: {
1207
1208
  data: Column.Data;
1208
1209
  dateParsedByDriver?: boolean;
1209
- }) => (value: unknown) => number;
1210
+ }) => typeof parseStringOrDateToNumber;
1211
+ declare const parseDateToDate: (value: unknown) => Date;
1210
1212
  declare const getDateAsDateFn: (column: {
1211
1213
  data: Column.Data;
1212
1214
  dateParsedByDriver?: boolean;
1213
- }) => (value: unknown) => Date;
1215
+ }) => typeof parseDateToDate;
1214
1216
  declare abstract class DateBaseColumn<Schema extends ColumnSchemaConfig> extends Column {
1215
1217
  dateParsedByDriver?: boolean | undefined;
1216
1218
  __schema: Schema;
@@ -1228,7 +1230,7 @@ declare abstract class DateBaseColumn<Schema extends ColumnSchemaConfig> extends
1228
1230
  constructor(schema: Schema, dateParsedByDriver?: boolean | undefined);
1229
1231
  }
1230
1232
  declare class DateColumn<Schema extends ColumnSchemaConfig> extends DateBaseColumn<Schema> {
1231
- dataType: "date";
1233
+ dataType: 'date';
1232
1234
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
1233
1235
  }
1234
1236
  declare abstract class DateTimeBaseClass<Schema extends ColumnSchemaConfig> extends DateBaseColumn<Schema> {
@@ -1243,12 +1245,12 @@ declare abstract class DateTimeTzBaseClass<Schema extends ColumnSchemaConfig> ex
1243
1245
  toSQL(): string;
1244
1246
  }
1245
1247
  declare class TimestampColumn<Schema extends ColumnSchemaConfig> extends DateTimeBaseClass<Schema> {
1246
- dataType: "timestamp";
1248
+ dataType: 'timestamp';
1247
1249
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
1248
1250
  }
1249
1251
  declare class TimestampTZColumn<Schema extends ColumnSchemaConfig> extends DateTimeTzBaseClass<Schema> {
1250
- dataType: "timestamptz";
1251
- baseDataType: "timestamp";
1252
+ dataType: 'timestamptz';
1253
+ baseDataType: 'timestamp';
1252
1254
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
1253
1255
  }
1254
1256
  declare class TimeColumn<Schema extends ColumnSchemaConfig> extends Column {
@@ -1263,7 +1265,7 @@ declare class TimeColumn<Schema extends ColumnSchemaConfig> extends Column {
1263
1265
  outputSchema: ReturnType<Schema['stringSchema']>;
1264
1266
  __queryType: string;
1265
1267
  querySchema: ReturnType<Schema['stringSchema']>;
1266
- dataType: "time";
1268
+ dataType: 'time';
1267
1269
  operators: OperatorsTime;
1268
1270
  constructor(schema: Schema, dateTimePrecision?: number);
1269
1271
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
@@ -1281,7 +1283,7 @@ declare class IntervalColumn<Schema extends ColumnSchemaConfig> extends Column {
1281
1283
  outputSchema: ReturnType<Schema['timeInterval']>;
1282
1284
  __queryType: PostgresInterval;
1283
1285
  querySchema: ReturnType<Schema['timeInterval']>;
1284
- dataType: "interval";
1286
+ dataType: 'interval';
1285
1287
  operators: OperatorsDate;
1286
1288
  constructor(schema: Schema, fields?: string, precision?: number, parse?: (input: string) => PostgresInterval);
1287
1289
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
@@ -1322,8 +1324,8 @@ interface ArrayData<Item extends ArrayColumnValue> extends Column.Data, ArrayMet
1322
1324
  }
1323
1325
  declare class ArrayColumn<Schema extends ColumnTypeSchemaArg, Item extends ArrayColumnValue, InputType, OutputType, QueryType> extends Column {
1324
1326
  __schema: Schema;
1325
- dataType: "array";
1326
- operators: OperatorsArray<Item["__queryType"]>;
1327
+ dataType: 'array';
1328
+ operators: OperatorsArray<Item['__queryType']>;
1327
1329
  data: ArrayData<Item>;
1328
1330
  __type: Item['__type'][];
1329
1331
  __inputType: Item['__type'][];
@@ -1338,7 +1340,7 @@ declare class ArrayColumn<Schema extends ColumnTypeSchemaArg, Item extends Array
1338
1340
  }
1339
1341
  declare class JSONColumn<T, Schema extends ColumnTypeSchemaArg, InputSchema = Schema['__schemaType']> extends Column {
1340
1342
  __schema: Schema;
1341
- dataType: "jsonb";
1343
+ dataType: 'jsonb';
1342
1344
  __type: T;
1343
1345
  __inputType: T;
1344
1346
  inputSchema: InputSchema;
@@ -1352,7 +1354,7 @@ declare class JSONColumn<T, Schema extends ColumnTypeSchemaArg, InputSchema = Sc
1352
1354
  }
1353
1355
  declare class JSONTextColumn<T, Schema extends ColumnTypeSchemaArg, InputSchema = Schema['__schemaType']> extends Column {
1354
1356
  __schema: Schema;
1355
- dataType: "json";
1357
+ dataType: 'json';
1356
1358
  __type: T;
1357
1359
  __inputType: T;
1358
1360
  inputSchema: InputSchema;
@@ -1384,12 +1386,12 @@ interface DefaultSchemaConfig extends ColumnSchemaConfig<Column> {
1384
1386
  __inputType: Input;
1385
1387
  __outputType: Output;
1386
1388
  __queryType: Query;
1387
- }) => Types): { [K in keyof T]: K extends '__type' ? Types['type'] : K extends keyof Types ? Types[K] : T[K] };
1388
- narrowType<T extends Column.InputOutputQueryTypes, Types extends Column.InputOutputQueryTypes>(this: T, _fn: (type: <Type extends (T['__inputType'] extends T['__outputType'] & T['__queryType'] ? T['__outputType'] & T['__queryType'] : T['__inputType'] & T['__outputType'] & T['__queryType'])>() => {
1389
+ }) => Types): { [K in keyof T]: K extends '__type' ? Types['type'] : K extends keyof Types ? Types[K] : T[K]; };
1390
+ narrowType<T extends Column.InputOutputQueryTypes, Types extends Column.InputOutputQueryTypes>(this: T, _fn: (type: <Type extends T['__inputType'] extends T['__outputType'] & T['__queryType'] ? T['__outputType'] & T['__queryType'] : T['__inputType'] & T['__outputType'] & T['__queryType']>() => {
1389
1391
  __inputType: T['__inputType'] extends never ? never : Type;
1390
1392
  __outputType: Type;
1391
1393
  __queryType: Type;
1392
- }) => Types): { [K in keyof T]: K extends keyof Types ? Types[K] : T[K] };
1394
+ }) => Types): { [K in keyof T]: K extends keyof Types ? Types[K] : T[K]; };
1393
1395
  narrowAllTypes<T extends Column.InputOutputQueryTypes, Types extends Column.InputOutputQueryTypes>(this: T, _fn: (type: <Types extends {
1394
1396
  input?: T['__inputType'];
1395
1397
  output?: T['__outputType'];
@@ -1398,7 +1400,7 @@ interface DefaultSchemaConfig extends ColumnSchemaConfig<Column> {
1398
1400
  __inputType: undefined extends Types['input'] ? T['__inputType'] : Types['input'];
1399
1401
  __outputType: undefined extends Types['output'] ? T['__outputType'] : Types['output'];
1400
1402
  __queryType: undefined extends Types['query'] ? T['__queryType'] : Types['query'];
1401
- }) => Types): { [K in keyof T]: K extends keyof Types ? Types[K] : T[K] };
1403
+ }) => Types): { [K in keyof T]: K extends keyof Types ? Types[K] : T[K]; };
1402
1404
  dateAsNumber<T extends Column.Pick.ForParse>(this: T): Column.Parse<T, unknown, number>;
1403
1405
  dateAsDate<T extends Column.Pick.ForParse>(this: T): Column.Parse<T, unknown, Date>;
1404
1406
  enum<const T extends readonly [string, ...string[]]>(dataType: string, type: T): EnumColumn<DefaultSchemaConfig, unknown, T>;
@@ -1453,7 +1455,7 @@ declare abstract class LimitedTextBaseColumn<Schema extends ColumnSchemaConfig>
1453
1455
  toSQL(): string;
1454
1456
  }
1455
1457
  declare class VarCharColumn<Schema extends ColumnSchemaConfig> extends LimitedTextBaseColumn<Schema> {
1456
- dataType: "varchar";
1458
+ dataType: 'varchar';
1457
1459
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
1458
1460
  }
1459
1461
  declare class StringColumn<Schema extends ColumnSchemaConfig> extends VarCharColumn<Schema> {
@@ -1461,7 +1463,7 @@ declare class StringColumn<Schema extends ColumnSchemaConfig> extends VarCharCol
1461
1463
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
1462
1464
  }
1463
1465
  declare class TextColumn<Schema extends ColumnSchemaConfig> extends TextBaseColumn<Schema, OperatorsOrdinalText> {
1464
- dataType: "text";
1466
+ dataType: 'text';
1465
1467
  data: TextColumnData & {
1466
1468
  minArg?: number;
1467
1469
  maxArg?: number;
@@ -1475,7 +1477,7 @@ declare class TextColumn<Schema extends ColumnSchemaConfig> extends TextBaseColu
1475
1477
  }
1476
1478
  declare class ByteaColumn<Schema extends ColumnSchemaConfig> extends Column {
1477
1479
  __schema: Schema;
1478
- dataType: "bytea";
1480
+ dataType: 'bytea';
1479
1481
  operators: OperatorsOrdinalText;
1480
1482
  __type: string;
1481
1483
  __inputType: Buffer;
@@ -1489,7 +1491,7 @@ declare class ByteaColumn<Schema extends ColumnSchemaConfig> extends Column {
1489
1491
  }
1490
1492
  declare class PointColumn<Schema extends ColumnSchemaConfig> extends Column {
1491
1493
  __schema: Schema;
1492
- dataType: "point";
1494
+ dataType: 'point';
1493
1495
  __type: string;
1494
1496
  __inputType: string;
1495
1497
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -1503,7 +1505,7 @@ declare class PointColumn<Schema extends ColumnSchemaConfig> extends Column {
1503
1505
  }
1504
1506
  declare class LineColumn<Schema extends ColumnSchemaConfig> extends Column {
1505
1507
  __schema: Schema;
1506
- dataType: "line";
1508
+ dataType: 'line';
1507
1509
  __type: string;
1508
1510
  __inputType: string;
1509
1511
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -1517,7 +1519,7 @@ declare class LineColumn<Schema extends ColumnSchemaConfig> extends Column {
1517
1519
  }
1518
1520
  declare class LsegColumn<Schema extends ColumnSchemaConfig> extends Column {
1519
1521
  __schema: Schema;
1520
- dataType: "lseg";
1522
+ dataType: 'lseg';
1521
1523
  __type: string;
1522
1524
  __inputType: string;
1523
1525
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -1531,7 +1533,7 @@ declare class LsegColumn<Schema extends ColumnSchemaConfig> extends Column {
1531
1533
  }
1532
1534
  declare class BoxColumn<Schema extends ColumnSchemaConfig> extends Column {
1533
1535
  __schema: Schema;
1534
- dataType: "box";
1536
+ dataType: 'box';
1535
1537
  __type: string;
1536
1538
  __inputType: string;
1537
1539
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -1545,7 +1547,7 @@ declare class BoxColumn<Schema extends ColumnSchemaConfig> extends Column {
1545
1547
  }
1546
1548
  declare class PathColumn<Schema extends ColumnSchemaConfig> extends Column {
1547
1549
  __schema: Schema;
1548
- dataType: "path";
1550
+ dataType: 'path';
1549
1551
  __type: string;
1550
1552
  __inputType: string;
1551
1553
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -1559,7 +1561,7 @@ declare class PathColumn<Schema extends ColumnSchemaConfig> extends Column {
1559
1561
  }
1560
1562
  declare class PolygonColumn<Schema extends ColumnSchemaConfig> extends Column {
1561
1563
  __schema: Schema;
1562
- dataType: "polygon";
1564
+ dataType: 'polygon';
1563
1565
  __type: string;
1564
1566
  __inputType: string;
1565
1567
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -1573,7 +1575,7 @@ declare class PolygonColumn<Schema extends ColumnSchemaConfig> extends Column {
1573
1575
  }
1574
1576
  declare class CircleColumn<Schema extends ColumnSchemaConfig> extends Column {
1575
1577
  __schema: Schema;
1576
- dataType: "circle";
1578
+ dataType: 'circle';
1577
1579
  __type: string;
1578
1580
  __inputType: string;
1579
1581
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -1587,7 +1589,7 @@ declare class CircleColumn<Schema extends ColumnSchemaConfig> extends Column {
1587
1589
  }
1588
1590
  declare class MoneyColumn<Schema extends ColumnSchemaConfig> extends Column {
1589
1591
  __schema: Schema;
1590
- dataType: "money";
1592
+ dataType: 'money';
1591
1593
  __type: string;
1592
1594
  data: NumberColumnData;
1593
1595
  __inputType: string | number;
@@ -1602,7 +1604,7 @@ declare class MoneyColumn<Schema extends ColumnSchemaConfig> extends Column {
1602
1604
  }
1603
1605
  declare class CidrColumn<Schema extends ColumnSchemaConfig> extends Column {
1604
1606
  __schema: Schema;
1605
- dataType: "cidr";
1607
+ dataType: 'cidr';
1606
1608
  __type: string;
1607
1609
  __inputType: string;
1608
1610
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -1616,7 +1618,7 @@ declare class CidrColumn<Schema extends ColumnSchemaConfig> extends Column {
1616
1618
  }
1617
1619
  declare class InetColumn<Schema extends ColumnSchemaConfig> extends Column {
1618
1620
  __schema: Schema;
1619
- dataType: "inet";
1621
+ dataType: 'inet';
1620
1622
  __type: string;
1621
1623
  __inputType: string;
1622
1624
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -1630,7 +1632,7 @@ declare class InetColumn<Schema extends ColumnSchemaConfig> extends Column {
1630
1632
  }
1631
1633
  declare class MacAddrColumn<Schema extends ColumnSchemaConfig> extends Column {
1632
1634
  __schema: Schema;
1633
- dataType: "macaddr";
1635
+ dataType: 'macaddr';
1634
1636
  __type: string;
1635
1637
  __inputType: string;
1636
1638
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -1644,7 +1646,7 @@ declare class MacAddrColumn<Schema extends ColumnSchemaConfig> extends Column {
1644
1646
  }
1645
1647
  declare class MacAddr8Column<Schema extends ColumnSchemaConfig> extends Column {
1646
1648
  __schema: Schema;
1647
- dataType: "macaddr8";
1649
+ dataType: 'macaddr8';
1648
1650
  __type: string;
1649
1651
  __inputType: string;
1650
1652
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -1658,7 +1660,7 @@ declare class MacAddr8Column<Schema extends ColumnSchemaConfig> extends Column {
1658
1660
  }
1659
1661
  declare class BitColumn<Schema extends ColumnSchemaConfig> extends Column {
1660
1662
  __schema: Schema;
1661
- dataType: "bit";
1663
+ dataType: 'bit';
1662
1664
  __type: string;
1663
1665
  __inputType: string;
1664
1666
  inputSchema: ReturnType<Schema['bit']>;
@@ -1676,7 +1678,7 @@ declare class BitColumn<Schema extends ColumnSchemaConfig> extends Column {
1676
1678
  }
1677
1679
  declare class BitVaryingColumn<Schema extends ColumnSchemaConfig> extends Column {
1678
1680
  __schema: Schema;
1679
- dataType: "varbit";
1681
+ dataType: 'varbit';
1680
1682
  __type: string;
1681
1683
  __inputType: string;
1682
1684
  inputSchema: ReturnType<Schema['bit']>;
@@ -1696,7 +1698,7 @@ type TsVectorGeneratedColumns = string[] | SearchWeightRecord;
1696
1698
  declare class TsVectorColumn<Schema extends ColumnSchemaConfig> extends Column {
1697
1699
  defaultLanguage: string;
1698
1700
  __schema: Schema;
1699
- dataType: "tsvector";
1701
+ dataType: 'tsvector';
1700
1702
  __type: string;
1701
1703
  __inputType: string;
1702
1704
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -1735,7 +1737,7 @@ declare class TsVectorColumn<Schema extends ColumnSchemaConfig> extends Column {
1735
1737
  }
1736
1738
  declare class TsQueryColumn<Schema extends ColumnSchemaConfig> extends Column {
1737
1739
  __schema: Schema;
1738
- dataType: "tsquery";
1740
+ dataType: 'tsquery';
1739
1741
  __type: string;
1740
1742
  __inputType: string;
1741
1743
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -1749,7 +1751,7 @@ declare class TsQueryColumn<Schema extends ColumnSchemaConfig> extends Column {
1749
1751
  }
1750
1752
  declare class UUIDColumn<Schema extends ColumnSchemaConfig> extends Column {
1751
1753
  __schema: Schema;
1752
- dataType: "uuid";
1754
+ dataType: 'uuid';
1753
1755
  __type: string;
1754
1756
  __inputType: string;
1755
1757
  inputSchema: ReturnType<Schema['uuid']>;
@@ -1762,7 +1764,8 @@ declare class UUIDColumn<Schema extends ColumnSchemaConfig> extends Column {
1762
1764
  /**
1763
1765
  * see {@link Column.primaryKey}
1764
1766
  */
1765
- primaryKey<T extends Column.Pick.Data, Name extends string>(this: T, name?: Name): // using & bc otherwise the return type doesn't match `primaryKey` in ColumnType and TS complains
1767
+ primaryKey<T extends Column.Pick.Data, Name extends string>(this: T, name?: Name):
1768
+ // using & bc otherwise the return type doesn't match `primaryKey` in ColumnType and TS complains
1766
1769
  T & {
1767
1770
  data: {
1768
1771
  primaryKey: Name;
@@ -1773,7 +1776,7 @@ declare class UUIDColumn<Schema extends ColumnSchemaConfig> extends Column {
1773
1776
  }
1774
1777
  declare class XMLColumn<Schema extends ColumnSchemaConfig> extends Column {
1775
1778
  __schema: Schema;
1776
- dataType: "xml";
1779
+ dataType: 'xml';
1777
1780
  __type: string;
1778
1781
  __inputType: string;
1779
1782
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -1789,7 +1792,7 @@ declare class XMLColumn<Schema extends ColumnSchemaConfig> extends Column {
1789
1792
  }
1790
1793
  declare class CitextColumn<Schema extends ColumnSchemaConfig> extends TextBaseColumn<Schema, OperatorsOrdinalText> {
1791
1794
  __schema: Schema;
1792
- dataType: "citext";
1795
+ dataType: 'citext';
1793
1796
  data: TextColumnData & {
1794
1797
  minArg?: number;
1795
1798
  maxArg?: number;
@@ -1801,7 +1804,7 @@ declare class CitextColumn<Schema extends ColumnSchemaConfig> extends TextBaseCo
1801
1804
  }
1802
1805
  declare class BooleanColumn<Schema extends ColumnSchemaConfig> extends Column {
1803
1806
  __schema: Schema;
1804
- dataType: "bool";
1807
+ dataType: 'bool';
1805
1808
  operators: OperatorsBoolean;
1806
1809
  __type: boolean;
1807
1810
  __inputType: boolean;
@@ -1868,6 +1871,7 @@ interface PostgisPoint {
1868
1871
  lat: number;
1869
1872
  srid?: number;
1870
1873
  }
1874
+ declare const encode: ({ srid, lon, lat }: PostgisPoint) => string;
1871
1875
  declare class PostgisGeographyPointColumn<Schema extends ColumnSchemaConfig> extends Column {
1872
1876
  __schema: Schema;
1873
1877
  dataType: string;
@@ -1879,11 +1883,7 @@ declare class PostgisGeographyPointColumn<Schema extends ColumnSchemaConfig> ext
1879
1883
  __queryType: PostgisPoint;
1880
1884
  querySchema: ReturnType<Schema['geographyPointSchema']>;
1881
1885
  operators: OperatorsAny;
1882
- static encode: ({
1883
- srid,
1884
- lon,
1885
- lat
1886
- }: PostgisPoint) => string;
1886
+ static encode: typeof encode;
1887
1887
  static isDefaultPoint(typmod: number): boolean;
1888
1888
  constructor(schema: Schema);
1889
1889
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
@@ -2013,7 +2013,7 @@ interface BatchParser {
2013
2013
  rows: unknown[];
2014
2014
  }) => MaybePromise<void>;
2015
2015
  }
2016
- type ColumnsParsers = { [K in string]?: ColumnParser };
2016
+ type ColumnsParsers = { [K in string]?: ColumnParser; };
2017
2017
  type BatchParsers = BatchParser[];
2018
2018
  interface QueryThen<T> {
2019
2019
  <TResult1 = T, TResult2 = never>(onfulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>;
@@ -2038,7 +2038,7 @@ type WithSelectable<W extends WithDataItem> = keyof W['shape'] | `${W['table']}.
2038
2038
  * The first argument of all `join` and `joinLateral` methods.
2039
2039
  * See argument of {@link join}.
2040
2040
  */
2041
- type JoinFirstArg<T extends PickQueryRelationsWithData> = PickQueryResultAs | keyof T['relations'] | keyof T['withData'] | ((q: { [K in keyof T['relations']]: T['relations'][K]['query'] }) => PickQueryResultAs) | FnPickQueryResultAs;
2041
+ type JoinFirstArg<T extends PickQueryRelationsWithData> = PickQueryResultAs | keyof T['relations'] | keyof T['withData'] | ((q: { [K in keyof T['relations']]: T['relations'][K]['query']; }) => PickQueryResultAs) | FnPickQueryResultAs;
2042
2042
  interface FnPickQueryResultAs {
2043
2043
  (): PickQueryResultAs;
2044
2044
  }
@@ -2046,7 +2046,7 @@ interface FnPickQueryResultAs {
2046
2046
  * Arguments of `join` methods (not `joinLateral`).
2047
2047
  * See {@link join}
2048
2048
  */
2049
- type JoinArgs<T extends PickQuerySelectableShapeRelationsWithDataAs, Arg extends JoinFirstArg<T>> = Arg extends PickQueryResultAs ? [conditions: { [K in JoinSelectable<Arg>]: keyof T['__selectable'] | Expression } | Expression] | [leftColumn: JoinSelectable<Arg> | Expression, rightColumn: keyof T['__selectable'] | Expression] | [leftColumn: JoinSelectable<Arg> | Expression, op: string, rightColumn: keyof T['__selectable'] | Expression] : Arg extends keyof T['withData'] ? JoinWithArgs<T, T['withData'][Arg]> : EmptyTuple;
2049
+ type JoinArgs<T extends PickQuerySelectableShapeRelationsWithDataAs, Arg extends JoinFirstArg<T>> = Arg extends PickQueryResultAs ? [conditions: { [K in JoinSelectable<Arg>]: keyof T['__selectable'] | Expression; } | Expression] | [leftColumn: JoinSelectable<Arg> | Expression, rightColumn: keyof T['__selectable'] | Expression] | [leftColumn: JoinSelectable<Arg> | Expression, op: string, rightColumn: keyof T['__selectable'] | Expression] : Arg extends keyof T['withData'] ? JoinWithArgs<T, T['withData'][Arg]> : EmptyTuple;
2050
2050
  /**
2051
2051
  * Column names of the joined table that can be used to join.
2052
2052
  * Derived from 'result', not from 'shape',
@@ -2057,16 +2057,16 @@ type JoinArgs<T extends PickQuerySelectableShapeRelationsWithDataAs, Arg extends
2057
2057
  * And the selection becomes available to use in the `ON` and to select from the joined table.
2058
2058
  */
2059
2059
  type JoinSelectable<Q extends PickQueryResultAs> = keyof Q['result'] | `${Q['__as']}.${keyof Q['result'] & string}`;
2060
- type JoinWithArgs<T extends PickQuerySelectable, Arg extends WithDataItem> = [conditions: { [K in WithSelectable<Arg>]: keyof T['__selectable'] | Expression } | Expression] | [leftColumn: WithSelectable<Arg> | Expression, rightColumn: keyof T['__selectable'] | Expression] | [leftColumn: WithSelectable<Arg> | Expression, op: string, rightColumn: keyof T['__selectable'] | Expression];
2061
- type JoinResultRequireMain<T extends PickQuerySelectable, JoinedSelectable> = { [K in keyof T]: K extends '__selectable' ? T['__selectable'] & JoinedSelectable : T[K] };
2060
+ type JoinWithArgs<T extends PickQuerySelectable, Arg extends WithDataItem> = [conditions: { [K in WithSelectable<Arg>]: keyof T['__selectable'] | Expression; } | Expression] | [leftColumn: WithSelectable<Arg> | Expression, rightColumn: keyof T['__selectable'] | Expression] | [leftColumn: WithSelectable<Arg> | Expression, op: string, rightColumn: keyof T['__selectable'] | Expression];
2061
+ type JoinResultRequireMain<T extends PickQuerySelectable, JoinedSelectable> = { [K in keyof T]: K extends '__selectable' ? T['__selectable'] & JoinedSelectable : T[K]; };
2062
2062
  /**
2063
2063
  * Result of all `join` methods, not `joinLateral`.
2064
2064
  * Adds joined table columns from its 'result' to the '__selectable' of the query.
2065
2065
  */
2066
- type JoinResult<T extends PickQuerySelectableRelationsResultReturnType, Joined extends PickQuerySelectableRelations, RequireMain> = RequireMain extends true ? { [K in keyof T]: K extends '__selectable' ? T['__selectable'] & Joined['__selectable'] : K extends 'relations' ? { [K in keyof T['relations'] | keyof Joined['relations']]: K extends keyof Joined['relations'] ? Joined['relations'][K] : T['relations'][K] } : T[K] } : { [K in keyof T]: K extends '__selectable' ? { [K in keyof T['__selectable']]: {
2066
+ type JoinResult<T extends PickQuerySelectableRelationsResultReturnType, Joined extends PickQuerySelectableRelations, RequireMain> = RequireMain extends true ? { [K in keyof T]: K extends '__selectable' ? T['__selectable'] & Joined['__selectable'] : K extends 'relations' ? { [K in keyof T['relations'] | keyof Joined['relations']]: K extends keyof Joined['relations'] ? Joined['relations'][K] : T['relations'][K]; } : T[K]; } : { [K in keyof T]: K extends '__selectable' ? { [K in keyof T['__selectable']]: {
2067
2067
  as: T['__selectable'][K]['as'];
2068
2068
  column: Column.QueryColumnToNullable<T['__selectable'][K]['column']>;
2069
- } } & Joined['__selectable'] : K extends 'result' ? { [K in keyof T['result']]: Column.QueryColumnToNullable<T['result'][K]> } : K extends 'then' ? QueryThenByQuery<T, { [K in keyof T['result']]: Column.QueryColumnToNullable<T['result'][K]> }> : K extends 'relations' ? { [K in keyof T['relations'] | keyof Joined['relations']]: K extends keyof Joined['relations'] ? Joined['relations'][K] : T['relations'][K] } : T[K] };
2069
+ }; } & Joined['__selectable'] : K extends 'result' ? { [K in keyof T['result']]: Column.QueryColumnToNullable<T['result'][K]>; } : K extends 'then' ? QueryThenByQuery<T, { [K in keyof T['result']]: Column.QueryColumnToNullable<T['result'][K]>; }> : K extends 'relations' ? { [K in keyof T['relations'] | keyof Joined['relations']]: K extends keyof Joined['relations'] ? Joined['relations'][K] : T['relations'][K]; } : T[K]; };
2070
2070
  /**
2071
2071
  * Calls {@link JoinResult} with either callback result, if join has a callback,
2072
2072
  * or with a query derived from the first join argument.
@@ -2105,8 +2105,8 @@ type JoinResultSelectable<Result extends Column.QueryColumns, As extends string,
2105
2105
  } : {
2106
2106
  as: K;
2107
2107
  column: Result[K];
2108
- } };
2109
- relations: { [K in keyof JoinedRelations & string as `${As}.${K}`]: JoinedRelations[K] };
2108
+ }; };
2109
+ relations: { [K in keyof JoinedRelations & string as `${As}.${K}`]: JoinedRelations[K]; };
2110
2110
  } : {
2111
2111
  __selectable: { [K in '*' | (keyof Result & string) as `${As}.${K}`]: K extends '*' ? {
2112
2112
  as: As;
@@ -2114,10 +2114,10 @@ type JoinResultSelectable<Result extends Column.QueryColumns, As extends string,
2114
2114
  } : {
2115
2115
  as: K;
2116
2116
  column: Column.QueryColumnToNullable<Result[K]>;
2117
- } };
2118
- relations: { [K in keyof JoinedRelations & string as `${As}.${K}`]: JoinedRelations[K] };
2117
+ }; };
2118
+ relations: { [K in keyof JoinedRelations & string as `${As}.${K}`]: JoinedRelations[K]; };
2119
2119
  };
2120
- type JoinAddSelectable<T extends PickQuerySelectable, Joined extends PickQuerySelectableRelations> = { [K in keyof T]: K extends '__selectable' ? T['__selectable'] & Joined['__selectable'] : T[K] };
2120
+ type JoinAddSelectable<T extends PickQuerySelectable, Joined extends PickQuerySelectableRelations> = { [K in keyof T]: K extends '__selectable' ? T['__selectable'] & Joined['__selectable'] : T[K]; };
2121
2121
  /**
2122
2122
  * Map the first argument of `join` or `joinLateral` to a query type.
2123
2123
  *
@@ -2128,7 +2128,7 @@ type JoinAddSelectable<T extends PickQuerySelectable, Joined extends PickQuerySe
2128
2128
  type JoinArgToQuery<T extends PickQueryRelationsWithData, Arg extends JoinFirstArg<T>> = Arg extends keyof T['withData'] ? T['withData'][Arg] extends WithDataItem ? { [K in 'result' | '__as' | keyof T]: K extends '__as' ? T['withData'][Arg]['table'] : K extends '__selectable' ? { [K in keyof T['withData'][Arg]['shape'] & string as `${T['withData'][Arg]['table']}.${K}`]: {
2129
2129
  as: K;
2130
2130
  column: T['withData'][Arg]['shape'][K];
2131
- } } : K extends 'result' ? T['withData'][Arg]['shape'] : K extends keyof T ? T[K] : never } : never : Arg extends PickQuerySelectableResultAs ? Arg : Arg extends keyof T['relations'] ? T['relations'][Arg]['query'] : Arg extends JoinArgToQueryCallback ? ReturnType<Arg> : never;
2131
+ }; } : K extends 'result' ? T['withData'][Arg]['shape'] : K extends keyof T ? T[K] : never; } : never : Arg extends PickQuerySelectableResultAs ? Arg : Arg extends keyof T['relations'] ? T['relations'][Arg]['query'] : Arg extends JoinArgToQueryCallback ? ReturnType<Arg> : never;
2132
2132
  interface JoinArgToQueryCallback {
2133
2133
  (...args: any[]): IsQuery;
2134
2134
  }
@@ -2761,7 +2761,7 @@ declare class QueryJoin {
2761
2761
  joinData<T extends PickQuerySelectableColumnTypes, As extends string, RecordType extends Column.QueryColumnsInit, Item extends ColumnsShape.Input<RecordType>>(this: T, as: As, fn: (types: T['columnTypes']) => RecordType, data: Item[]): { [K in keyof T]: K extends '__selectable' ? T['__selectable'] & { [K in keyof RecordType & string as `${As}.${K}`]: {
2762
2762
  as: K;
2763
2763
  column: RecordType[K];
2764
- } } : T[K] };
2764
+ }; } : T[K]; };
2765
2765
  }
2766
2766
  type OnArgs<S extends QuerySelectable> = [leftColumn: keyof S, rightColumn: keyof S] | [leftColumn: keyof S, op: string, rightColumn: keyof S];
2767
2767
  declare const pushQueryOnForOuter: <T extends PickQuerySelectable>(q: T, joinFrom: PickQuerySelectable, joinTo: PickQuerySelectable, leftColumn: string, rightColumn: string) => T;
@@ -2769,13 +2769,13 @@ type OnJsonPathEqualsArgs<S extends QuerySelectable> = [leftColumn: keyof S, lef
2769
2769
  /**
2770
2770
  * Mutative {@link OnMethods.prototype.on}
2771
2771
  */
2772
- declare const _queryJoinOn: <T extends PickQuerySelectable>(q: T, args: OnArgs<T["__selectable"]>) => T;
2772
+ declare const _queryJoinOn: <T extends PickQuerySelectable>(q: T, args: OnArgs<T['__selectable']>) => T;
2773
2773
  /**
2774
2774
  * Argument of join callback.
2775
2775
  * It is a query object of table that you're joining, with ability to select main table's columns.
2776
2776
  * Adds {@link OnMethods.prototype.on} method and similar to the query.
2777
2777
  */
2778
- type JoinQueryBuilder<T extends PickQuerySelectableShape, J extends PickQuerySelectableResultAs> = { [K in keyof J | keyof OnMethods]: K extends '__selectable' ? SelectableFromShape<J['result'], J['__as']> & Omit<T['__selectable'], keyof T['shape']> : K extends keyof OnMethods ? OnMethods[K] : K extends keyof J ? J[K] : never };
2778
+ type JoinQueryBuilder<T extends PickQuerySelectableShape, J extends PickQuerySelectableResultAs> = { [K in keyof J | keyof OnMethods]: K extends '__selectable' ? SelectableFromShape<J['result'], J['__as']> & Omit<T['__selectable'], keyof T['shape']> : K extends keyof OnMethods ? OnMethods[K] : K extends keyof J ? J[K] : never; };
2779
2779
  declare class OnMethods {
2780
2780
  /**
2781
2781
  * Use `on` to specify columns to join records.
@@ -2892,10 +2892,10 @@ interface QueryDataSources {
2892
2892
  }
2893
2893
  declare namespace Order {
2894
2894
  export interface ArgThis extends PickQuerySelectable, PickQueryResult, PickQueryTsQuery {}
2895
- export type Arg<T extends ArgThis> = ArgKey<T> | ArgTsQuery<T> | { [K in ArgKey<T> | ArgTsQuery<T>]?: K extends ArgTsQuery<T> ? OrderTsQueryConfig : SortDir } | Expression;
2895
+ export type Arg<T extends ArgThis> = ArgKey<T> | ArgTsQuery<T> | { [K in ArgKey<T> | ArgTsQuery<T>]?: K extends ArgTsQuery<T> ? OrderTsQueryConfig : SortDir; } | Expression;
2896
2896
  export type Args<T extends ArgThis> = Arg<T>[];
2897
2897
  type ArgTsQuery<T extends ArgThis> = string | undefined extends T['__tsQuery'] ? never : Exclude<T['__tsQuery'], undefined>;
2898
- type ArgKey<T extends ArgThis> = { [K in keyof T['__selectable']]: T['__selectable'][K]['column']['__queryType'] extends undefined ? never : K }[keyof T['__selectable']] | { [K in keyof T['result']]: T['result'][K]['dataType'] extends 'array' | 'object' | 'runtimeComputed' ? never : K }[keyof T['result']];
2898
+ type ArgKey<T extends ArgThis> = { [K in keyof T['__selectable']]: T['__selectable'][K]['column']['__queryType'] extends undefined ? never : K; }[keyof T['__selectable']] | { [K in keyof T['result']]: T['result'][K]['dataType'] extends 'array' | 'object' | 'runtimeComputed' ? never : K; }[keyof T['result']];
2899
2899
  export {};
2900
2900
  }
2901
2901
  declare class QueryOrder {
@@ -2956,7 +2956,7 @@ interface WindowArgDeclaration<T extends Order.ArgThis = Order.ArgThis> {
2956
2956
  order?: Order.Arg<T>;
2957
2957
  }
2958
2958
  type WindowResult<T, W extends RecordUnknown> = T & {
2959
- windows: { [K in keyof W]: true };
2959
+ windows: { [K in keyof W]: true; };
2960
2960
  };
2961
2961
  declare class QueryWindow {
2962
2962
  /**
@@ -3084,9 +3084,9 @@ type SearchArg<T extends PickQuerySelectable, As extends string> = {
3084
3084
  }) & ({
3085
3085
  text: string | Expression;
3086
3086
  } | {
3087
- in: MaybeArray<keyof T['__selectable']> | { [K in keyof T['__selectable']]?: SearchWeight };
3087
+ in: MaybeArray<keyof T['__selectable']> | { [K in keyof T['__selectable']]?: SearchWeight; };
3088
3088
  } | {
3089
- vector: { [K in keyof T['__selectable']]: T['__selectable'][K]['column']['dataType'] extends 'tsvector' ? K : never }[keyof T['__selectable']];
3089
+ vector: { [K in keyof T['__selectable']]: T['__selectable'][K]['column']['dataType'] extends 'tsvector' ? K : never; }[keyof T['__selectable']];
3090
3090
  }) & ({
3091
3091
  query: string | Expression;
3092
3092
  } | {
@@ -3295,7 +3295,7 @@ interface OperatorsCount extends OperatorsNumber {
3295
3295
  }
3296
3296
  type CountColumn = Column.Pick.QueryColumnOfTypeAndOps<'int8', number, OperatorsCount>;
3297
3297
  type CountReturn<T> = SetQueryReturnsColumnOrThrow<T, CountColumn> & OperatorsCount;
3298
- type SelectableDataType<T extends PickQuerySelectable, DataType extends string> = { [K in keyof T['__selectable']]: T['__selectable'][K]['column']['dataType'] extends DataType ? K : never }[keyof T['__selectable']] | Expression<Column.Pick.QueryColumnOfDataType<DataType>>;
3298
+ type SelectableDataType<T extends PickQuerySelectable, DataType extends string> = { [K in keyof T['__selectable']]: T['__selectable'][K]['column']['dataType'] extends DataType ? K : never; }[keyof T['__selectable']] | Expression<Column.Pick.QueryColumnOfDataType<DataType>>;
3299
3299
  type NumericReturn<T extends PickQuerySelectable, Arg> = Arg extends keyof T['__selectable'] ? SetQueryReturnsColumnOrThrow<T, Column.Pick.QueryColumnOfTypeAndOps<T['__selectable'][Arg]['column']['dataType'], T['__selectable'][Arg]['column']['__type'] | null, OperatorsNumber>> & OperatorsNumber : Arg extends Expression ? SetQueryReturnsColumnOrThrow<T, Column.Pick.QueryColumnOfTypeAndOps<Arg['result']['value']['dataType'], Arg['result']['value']['__type'] | null, OperatorsNumber>> & OperatorsNumber : never;
3300
3300
  type NullableNumberReturn<T, DataType> = SetQueryReturnsColumnOrThrow<T, Column.Pick.QueryColumnOfTypeAndOps<DataType, number | null, OperatorsNumber>> & OperatorsNumber;
3301
3301
  type BooleanQueryColumn = Column.Pick.QueryColumnOfTypeAndOps<'bool', boolean, OperatorsBoolean>;
@@ -3313,9 +3313,9 @@ interface RecordSelectableOrExpression<T extends PickQuerySelectable> {
3313
3313
  }
3314
3314
  type NullableJSONObjectReturn<T extends PickQuerySelectable, Obj extends RecordSelectableOrExpression<T>> = SetQueryReturnsColumnOrThrow<T, {
3315
3315
  dataType: 'json';
3316
- __type: { [K in keyof Obj]: ExpressionOutput<T, Obj[K]>['__type'] } | null;
3317
- __outputType: { [K in keyof Obj]: ExpressionOutput<T, Obj[K]>['__outputType'] } | null;
3318
- __queryType: { [K in keyof Obj]: ExpressionOutput<T, Obj[K]>['__queryType'] } | null;
3316
+ __type: { [K in keyof Obj]: ExpressionOutput<T, Obj[K]>['__type']; } | null;
3317
+ __outputType: { [K in keyof Obj]: ExpressionOutput<T, Obj[K]>['__outputType']; } | null;
3318
+ __queryType: { [K in keyof Obj]: ExpressionOutput<T, Obj[K]>['__queryType']; } | null;
3319
3319
  operators: OperatorsAny;
3320
3320
  }> & OperatorsAny;
3321
3321
  type StringColumn$1 = Column.Pick.QueryColumnOfTypeAndOps<string, string, OperatorsText>;
@@ -3324,7 +3324,8 @@ type NullableStringReturn<T> = SetQueryReturnsColumnOrThrow<T, StringNullable> &
3324
3324
  interface AggregateArgTypes {
3325
3325
  minMax: 'citext' | 'date' | 'float4' | 'float8' | 'inet' | 'int2' | 'int4' | 'int8' | 'interval' | 'money' | 'numeric' | 'text' | 'time' | 'timestamp' | 'timestamptz';
3326
3326
  sum: 'float4' | 'float8' | 'int2' | 'int4' | 'int8' | 'interval' | 'money' | 'numeric';
3327
- avg: // unlike sum, avg has no money
3327
+ avg:
3328
+ // unlike sum, avg has no money
3328
3329
  'float4' | 'float8' | 'int2' | 'int4' | 'int8' | 'interval' | 'numeric';
3329
3330
  bit: 'bit' | 'int2' | 'int4' | 'int8';
3330
3331
  bool: 'bool';
@@ -3742,11 +3743,11 @@ declare class OrExpression extends Expression<BooleanQueryColumn> {
3742
3743
  interface QueryReturnsFnAdd<T extends PickQueryColumTypes> extends PickQueryHasSelect {
3743
3744
  type<C extends Column.Pick.QueryColumn>(fn: (types: T['columnTypes']) => C): { [K in keyof T]: K extends 'result' ? {
3744
3745
  value: C;
3745
- } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<C['__outputType']> : T[K] } & C['operators'];
3746
+ } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<C['__outputType']> : T[K]; } & C['operators'];
3746
3747
  }
3747
3748
  type SetQueryReturnsFn<T extends PickQueryColumTypes, C extends Column.Pick.OutputType> = { [K in keyof T]: K extends 'result' ? {
3748
3749
  value: C;
3749
- } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<C['__outputType']> : T[K] } & QueryReturnsFnAdd<T>;
3750
+ } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<C['__outputType']> : T[K]; } & QueryReturnsFnAdd<T>;
3750
3751
  declare class QueryExpressions {
3751
3752
  /**
3752
3753
  * `column` references a table column, this can be used in raw SQL or when building a column expression.
@@ -3839,7 +3840,7 @@ declare class QueryExpressions {
3839
3840
  type WhereArg<T extends PickQuerySelectableRelations> = { [K in keyof T['__selectable'] | 'NOT' | 'OR' | 'IN']?: K extends 'NOT' ? WhereArg<T> | WhereArgs<T> : K extends 'OR' ? (WhereArg<T> | WhereArgs<T>)[] : K extends 'IN' ? MaybeArray<{
3840
3841
  columns: (keyof T['__selectable'])[];
3841
3842
  values: unknown[][] | IsQuery | Expression;
3842
- }> : T['__selectable'][K]['column']['__queryType'] | null | { [O in keyof T['__selectable'][K]['column']['operators']]?: T['__selectable'][K]['column']['operators'][O]['_opType'] } | {
3843
+ }> : T['__selectable'][K]['column']['__queryType'] | null | { [O in keyof T['__selectable'][K]['column']['operators']]?: T['__selectable'][K]['column']['operators'][O]['_opType']; } | {
3843
3844
  result: {
3844
3845
  value: {
3845
3846
  __queryType: T['__selectable'][K]['column']['__queryType'] | null;
@@ -3851,7 +3852,7 @@ type WhereArg<T extends PickQuerySelectableRelations> = { [K in keyof T['__selec
3851
3852
  __queryType: T['__selectable'][K]['column']['__queryType'] | null;
3852
3853
  };
3853
3854
  };
3854
- }) } | ((q: WhereQueryBuilder<T>) => QueryOrExpressionBooleanOrNullResult | WhereQueryBuilder<T>);
3855
+ }); } | ((q: WhereQueryBuilder<T>) => QueryOrExpressionBooleanOrNullResult | WhereQueryBuilder<T>);
3855
3856
  /**
3856
3857
  * Callback argument of `where`.
3857
3858
  * It has `where` methods (`where`, `whereNot`, `whereExists`, etc.),
@@ -3860,16 +3861,16 @@ type WhereArg<T extends PickQuerySelectableRelations> = { [K in keyof T['__selec
3860
3861
  * db.table.where((q) => q.relation.count().equals(10))
3861
3862
  * ```
3862
3863
  */
3863
- type WhereQueryBuilder<T extends PickQueryRelations> = EmptyObject extends T['relations'] ? { [K in keyof T]: K extends keyof Where | keyof QueryExpressions | 'table' | 'get' | 'columnTypes' | '__selectable' | 'relations' | 'useHelper' | 'modify' | 'result' | 'returnType' | 'withData' | 'windows' | 'then' ? T[K] : never } : { [K in keyof T['relations'] | keyof T]: K extends keyof T['relations'] ? T['relations'][K]['query'] : K extends keyof T & (keyof Where | keyof QueryExpressions | 'table' | 'get' | 'columnTypes' | '__selectable' | 'relations' | 'useHelper' | 'modify' | 'result' | 'returnType' | 'withData' | 'windows' | 'then') ? T[K] : never };
3864
+ type WhereQueryBuilder<T extends PickQueryRelations> = EmptyObject extends T['relations'] ? { [K in keyof T]: K extends keyof Where | keyof QueryExpressions | 'table' | 'get' | 'columnTypes' | '__selectable' | 'relations' | 'useHelper' | 'modify' | 'result' | 'returnType' | 'withData' | 'windows' | 'then' ? T[K] : never; } : { [K in keyof T['relations'] | keyof T]: K extends keyof T['relations'] ? T['relations'][K]['query'] : K extends keyof T & (keyof Where | keyof QueryExpressions | 'table' | 'get' | 'columnTypes' | '__selectable' | 'relations' | 'useHelper' | 'modify' | 'result' | 'returnType' | 'withData' | 'windows' | 'then') ? T[K] : never; };
3864
3865
  type WhereArgs<T extends PickQuerySelectableRelations> = WhereArg<T>[];
3865
3866
  type WhereNotArgs<T extends PickQuerySelectableRelations> = [WhereArg<T>];
3866
3867
  type WhereInColumn<T extends PickQuerySelectableRelations> = keyof T['__selectable'] | [keyof T['__selectable'], ...(keyof T['__selectable'])[]];
3867
- type WhereInValues<T extends PickQuerySelectableRelations, Column> = Column extends keyof T['__selectable'] ? Iterable<T['__selectable'][Column]['column']['__queryType']> | IsQuery | Expression : ({ [I in keyof Column]: Column[I] extends keyof T['__selectable'] ? T['__selectable'][Column[I]]['column']['__queryType'] : never } & {
3868
+ type WhereInValues<T extends PickQuerySelectableRelations, Column> = Column extends keyof T['__selectable'] ? Iterable<T['__selectable'][Column]['column']['__queryType']> | IsQuery | Expression : ({ [I in keyof Column]: Column[I] extends keyof T['__selectable'] ? T['__selectable'][Column[I]]['column']['__queryType'] : never; } & {
3868
3869
  length: Column extends {
3869
3870
  length: number;
3870
3871
  } ? Column['length'] : never;
3871
3872
  })[] | IsQuery | Expression;
3872
- type WhereInArg<T extends PickQuerySelectableRelations> = { [K in keyof T['__selectable']]?: Iterable<T['__selectable'][K]['column']['__queryType']> | IsQuery | Expression };
3873
+ type WhereInArg<T extends PickQuerySelectableRelations> = { [K in keyof T['__selectable']]?: Iterable<T['__selectable'][K]['column']['__queryType']> | IsQuery | Expression; };
3873
3874
  interface QueryHasWhere {
3874
3875
  __hasWhere: true;
3875
3876
  }
@@ -4508,7 +4509,7 @@ declare class Where {
4508
4509
  */
4509
4510
  orWhereNotExists<T extends PickQuerySelectableShapeRelationsWithDataAs, Arg extends JoinFirstArg<T>>(this: T, arg: Arg, ...args: JoinArgs<T, Arg>): T & QueryHasWhere;
4510
4511
  }
4511
- type QueryScopes<Keys extends string> = { [K in Keys]: unknown };
4512
+ type QueryScopes<Keys extends string> = { [K in Keys]: unknown; };
4512
4513
  interface ScopeArgumentQuery<Table extends string | undefined, Shape extends Column.QueryColumns> extends Where, PickQuerySelectableShapeRelationsWithData {
4513
4514
  __isQuery: true;
4514
4515
  table: Table;
@@ -4793,14 +4794,14 @@ declare namespace DefaultPrivileges {
4793
4794
  export {};
4794
4795
  }
4795
4796
  declare const DEFAULT_PRIVILEGE: {
4796
- OBJECT_TYPES: readonly ["TABLES", "SEQUENCES", "FUNCTIONS", "TYPES", "SCHEMAS", "LARGE_OBJECTS"];
4797
+ OBJECT_TYPES: readonly ['TABLES', 'SEQUENCES', 'FUNCTIONS', 'TYPES', 'SCHEMAS', 'LARGE_OBJECTS'];
4797
4798
  PRIVILEGES: {
4798
- TABLE: readonly ["ALL", "SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", "MAINTAIN"];
4799
- SEQUENCE: readonly ["ALL", "USAGE", "SELECT", "UPDATE"];
4800
- FUNCTION: readonly ["ALL", "EXECUTE"];
4801
- TYPE: readonly ["ALL", "USAGE"];
4802
- SCHEMA: readonly ["ALL", "USAGE", "CREATE"];
4803
- LARGE_OBJECT: readonly ["ALL", "SELECT", "UPDATE"];
4799
+ TABLE: readonly ['ALL', 'SELECT', 'INSERT', 'UPDATE', 'DELETE', 'TRUNCATE', 'REFERENCES', 'TRIGGER', 'MAINTAIN'];
4800
+ SEQUENCE: readonly ['ALL', 'USAGE', 'SELECT', 'UPDATE'];
4801
+ FUNCTION: readonly ['ALL', 'EXECUTE'];
4802
+ TYPE: readonly ['ALL', 'USAGE'];
4803
+ SCHEMA: readonly ['ALL', 'USAGE', 'CREATE'];
4804
+ LARGE_OBJECT: readonly ['ALL', 'SELECT', 'UPDATE'];
4804
4805
  };
4805
4806
  };
4806
4807
  declare function getSupportedDefaultPrivileges(version: number): DefaultPrivileges.SupportedDefaultPrivileges;
@@ -4979,10 +4980,22 @@ interface QueryInternal<SinglePrimaryKey = any, UniqueColumns = any, UniqueColum
4979
4980
  */
4980
4981
  nestedCreateBatchMax: number;
4981
4982
  }
4982
- type ShapeHasPrimaryKeys<Shape extends Column.QueryColumnsInit> = { [K in keyof Shape]: Shape[K]['data']['primaryKey'] extends string ? K : never }[keyof Shape];
4983
- type TablePrimaryKeys<Shape extends Column.QueryColumnsInit> = ShapeHasPrimaryKeys<Shape> extends never ? never : { [K in ShapeHasPrimaryKeys<Shape>]: UniqueQueryTypeOrExpression<Shape[K]['__queryType']> };
4984
- type ShapeUniqueColumns<Shape extends Column.QueryColumnsInit> = { [K in keyof Shape]: Shape[K]['data']['unique'] extends string ? { [C in K]: UniqueQueryTypeOrExpression<Shape[K]['__queryType']> } : never }[keyof Shape];
4985
- type UniqueConstraints<Shape extends Column.QueryColumnsInit> = { [K in keyof Shape]: Shape[K]['data']['primaryKey'] extends string ? string extends Shape[K]['data']['primaryKey'] ? never : Shape[K]['data']['primaryKey'] : Shape[K]['data']['unique'] extends string ? string extends Shape[K]['data']['unique'] ? never : Shape[K]['data']['unique'] : never }[keyof Shape];
4983
+ interface Brand<Token extends PropertyKey> {
4984
+ readonly [tag]: { [K in Token]: never; };
4985
+ }
4986
+ type Branded<Type, Token extends PropertyKey> = Type & Brand<Token>;
4987
+ type BrandColumnKey = '__inputType' | '__outputType' | '__queryType';
4988
+ type BrandToken<Token extends PropertyKey, ColumnToken extends true | string> = string extends ColumnToken ? Token : ColumnToken extends string ? ColumnToken : Token;
4989
+ type BrandColumn<Column, Token extends PropertyKey> = Column extends {
4990
+ data: {
4991
+ branded: infer ColumnToken extends true | string;
4992
+ };
4993
+ } ? { [K in keyof Column]: K extends BrandColumnKey ? Branded<Column[K], BrandToken<Token, ColumnToken>> : Column[K]; } : Column;
4994
+ type BrandColumnsShape<Shape, Table extends string | undefined> = { [K in keyof Shape]: BrandColumn<Shape[K], `${Table}.${K & string}`>; };
4995
+ type ShapeHasPrimaryKeys<Shape extends Column.QueryColumnsInit> = { [K in keyof Shape]: Shape[K]['data']['primaryKey'] extends string ? K : never; }[keyof Shape];
4996
+ type TablePrimaryKeys<Shape extends Column.QueryColumnsInit> = ShapeHasPrimaryKeys<Shape> extends never ? never : { [K in ShapeHasPrimaryKeys<Shape>]: UniqueQueryTypeOrExpression<Shape[K]['__queryType']>; };
4997
+ type ShapeUniqueColumns<Shape extends Column.QueryColumnsInit> = { [K in keyof Shape]: Shape[K]['data']['unique'] extends string ? { [C in K]: UniqueQueryTypeOrExpression<Shape[K]['__queryType']>; } : never; }[keyof Shape];
4998
+ type UniqueConstraints<Shape extends Column.QueryColumnsInit> = { [K in keyof Shape]: Shape[K]['data']['primaryKey'] extends string ? string extends Shape[K]['data']['primaryKey'] ? never : Shape[K]['data']['primaryKey'] : Shape[K]['data']['unique'] extends string ? string extends Shape[K]['data']['unique'] ? never : Shape[K]['data']['unique'] : never; }[keyof Shape];
4986
4999
  type NoPrimaryKeyOption = 'error' | 'warning' | 'ignore';
4987
5000
  interface DbSharedOptions extends QueryLogOptions {
4988
5001
  autoPreparedStatements?: boolean;
@@ -5069,7 +5082,7 @@ interface DbTableOptions<ColumnTypes, Table extends string | undefined, Shape ex
5069
5082
  */
5070
5083
  nowSQL?: string;
5071
5084
  }
5072
- type DbTableOptionScopes<Table extends string | undefined, Shape extends Column.QueryColumns, Keys extends string = string> = { [K in Keys]: (q: ScopeArgumentQuery<Table, Shape>) => IsQuery };
5085
+ type DbTableOptionScopes<Table extends string | undefined, Shape extends Column.QueryColumns, Keys extends string = string> = { [K in Keys]: (q: ScopeArgumentQuery<Table, Shape>) => IsQuery; };
5073
5086
  interface QueryBuilder extends Query.NotReadOnlyQuery {
5074
5087
  returnType: undefined;
5075
5088
  }
@@ -5081,21 +5094,21 @@ declare class Db<Table extends string | undefined = undefined, Shape extends Col
5081
5094
  q: QueryData;
5082
5095
  __isQuery: true;
5083
5096
  __as: Table & string;
5084
- __selectable: SelectableFromShape<ComputedColumnsFromOptions<Shape, Options>, Table>;
5097
+ __selectable: SelectableFromShape<ComputedColumnsFromOptions<Table, Shape, Options>, Table>;
5085
5098
  __readOnly: ReadOnly;
5086
5099
  __materialized: Options extends {
5087
5100
  materialized: true;
5088
5101
  } ? true : undefined;
5089
5102
  __hasSelect: boolean;
5090
5103
  __hasWhere: boolean;
5091
- __defaults: { [K in { [K in keyof Shape]: Shape[K]['data']['default'] extends true ? K : never }[keyof Shape]]: true };
5092
- __scopes: { [K in keyof MapTableScopesOption<Options>]: true };
5104
+ __defaults: { [K in { [K in keyof Shape]: Shape[K]['data']['default'] extends true ? K : never; }[keyof Shape]]: true; };
5105
+ __scopes: { [K in keyof MapTableScopesOption<Options>]: true; };
5093
5106
  __defaultSelect: ColumnsShape.DefaultSelectKeys<Shape>;
5094
5107
  baseQuery: Query;
5095
5108
  columns: (keyof Shape)[];
5096
5109
  __outputType: ColumnsShape.DefaultSelectOutput<Shape>;
5097
5110
  __inputType: ColumnsShape.Input<Shape>;
5098
- result: { [K in ColumnsShape.DefaultSelectKeys<Shape>]: Shape[K] };
5111
+ result: { [K in ColumnsShape.DefaultSelectKeys<Shape>]: Shape[K]; };
5099
5112
  returnType: undefined;
5100
5113
  then: QueryThenShallowSimplifyArr<ColumnsShape.DefaultOutput<Shape>>;
5101
5114
  windows: EmptyObject;
@@ -5105,10 +5118,10 @@ declare class Db<Table extends string | undefined = undefined, Shape extends Col
5105
5118
  relationQueries: EmptyObject;
5106
5119
  withData: EmptyObject;
5107
5120
  error: new (message: string, length: number, name: QueryErrorName) => QueryError<this>;
5108
- internal: QueryInternal<TablePrimaryKeys<Shape> extends never ? never : { [K in keyof TablePrimaryKeys<Shape>]: (keyof TablePrimaryKeys<Shape> extends K ? never : keyof TablePrimaryKeys<Shape>) extends never ? TablePrimaryKeys<Shape>[K] : never }[keyof TablePrimaryKeys<Shape>], TablePrimaryKeys<Shape> | ShapeUniqueColumns<Shape> | TableDataItemsUniqueColumns<Shape, Data>, { [K in keyof Shape]: Shape[K]['data']['unique'] extends string ? K : never }[keyof Shape] | keyof TablePrimaryKeys<Shape>, TableDataItemsUniqueColumnTuples<Shape, Data>, UniqueConstraints<Shape> | TableDataItemsUniqueConstraints<Data>>;
5121
+ internal: QueryInternal<TablePrimaryKeys<Shape> extends never ? never : { [K in keyof TablePrimaryKeys<Shape>]: (keyof TablePrimaryKeys<Shape> extends K ? never : keyof TablePrimaryKeys<Shape>) extends never ? TablePrimaryKeys<Shape>[K] : never; }[keyof TablePrimaryKeys<Shape>], TablePrimaryKeys<Shape> | ShapeUniqueColumns<Shape> | TableDataItemsUniqueColumns<Shape, Data>, { [K in keyof Shape]: Shape[K]['data']['unique'] extends string ? K : never; }[keyof Shape] | keyof TablePrimaryKeys<Shape>, TableDataItemsUniqueColumnTuples<Shape, Data>, UniqueConstraints<Shape> | TableDataItemsUniqueConstraints<Data>>;
5109
5122
  catch: QueryCatch;
5110
- shape: ComputedColumnsFromOptions<Shape, Options>;
5111
- constructor(adapterNotInTransaction: Adapter, qb: QueryBuilder, table: Table | undefined, shape: ComputedColumnsFromOptions<Shape, Options>, columnTypes: ColumnTypes, asyncStorage: AsyncLocalStorage<AsyncState>, options: DbTableOptions<ColumnTypes, Table, ComputedColumnsFromOptions<Shape, Options>>, tableData?: TableData, viewData?: QueryInternal['viewData']);
5123
+ shape: ComputedColumnsFromOptions<Table, Shape, Options>;
5124
+ constructor(adapterNotInTransaction: Adapter, qb: QueryBuilder, table: Table | undefined, shape: ComputedColumnsFromOptions<Table, Shape, Options>, columnTypes: ColumnTypes, asyncStorage: AsyncLocalStorage<AsyncState>, options: DbTableOptions<ColumnTypes, Table, ComputedColumnsFromOptions<Table, Shape, Options>>, tableData?: TableData, viewData?: QueryInternal['viewData']);
5112
5125
  /**
5113
5126
  * When in transaction, returns a db adapter object for the transaction,
5114
5127
  * returns a default adapter object otherwise.
@@ -5177,7 +5190,7 @@ declare class Db<Table extends string | undefined = undefined, Shape extends Col
5177
5190
  queryArrays<R extends any[] = any[]>(...args: SQLQueryArgs): Promise<QueryResult<R>>;
5178
5191
  }
5179
5192
  interface DbTableConstructor<ColumnTypes> {
5180
- <Table extends string, Shape extends Column.QueryColumnsInit, Data extends MaybeArray<TableDataItem>, Options extends DbTableOptions<ColumnTypes, Table, Shape> | undefined>(table: Table, shape?: ((t: ColumnTypes) => Shape) | Shape, tableData?: TableDataFn<Shape, Data>, options?: Options): Db<Table, Shape, Data, ColumnTypes, Options extends {
5193
+ <Table extends string, Shape extends Column.QueryColumnsInit, Data extends MaybeArray<TableDataItem>, Options extends DbTableOptions<ColumnTypes, Table, Shape> | undefined>(table: Table, shape?: ((t: ColumnTypes) => Shape) | Shape, tableData?: TableDataFn<Shape, Data>, options?: Options): Db<Table, BrandColumnsShape<Shape, Table>, Data, ColumnTypes, Options extends {
5181
5194
  readOnly: true;
5182
5195
  } ? true : undefined, Options>;
5183
5196
  }
@@ -5197,7 +5210,7 @@ type MapTableScopesOption<T> = T extends {
5197
5210
  } ? {
5198
5211
  nonDeleted: unknown;
5199
5212
  } : EmptyObject;
5200
- interface DbResult<ColumnTypes> extends Db<undefined, EmptyObject, never, ColumnTypes, never, never>, DbTableConstructor<ColumnTypes> {
5213
+ interface DbResult<ColumnTypes> extends Db<undefined, EmptyObject, never, ColumnTypes, never>, DbTableConstructor<ColumnTypes> {
5201
5214
  adapterNotInTransaction: Adapter;
5202
5215
  adapter: Adapter;
5203
5216
  close: Adapter['close'];
@@ -5279,15 +5292,7 @@ interface DbResult<ColumnTypes> extends Db<undefined, EmptyObject, never, Column
5279
5292
  * })
5280
5293
  * ```
5281
5294
  */
5282
- declare const createDbWithAdapter: <SchemaConfig extends ColumnSchemaConfig = DefaultSchemaConfig, ColumnTypes = DefaultColumnTypes<SchemaConfig>>({
5283
- log,
5284
- logger,
5285
- snakeCase,
5286
- schemaConfig: schemaConfigFn,
5287
- columnTypes,
5288
- schema,
5289
- ...options
5290
- }: DbOptionsWithAdapter<SchemaConfig, ColumnTypes>) => DbResult<ColumnTypes>;
5295
+ declare const createDbWithAdapter: <SchemaConfig extends ColumnSchemaConfig = DefaultSchemaConfig, ColumnTypes = DefaultColumnTypes<SchemaConfig>>({ log, logger, snakeCase, schemaConfig: schemaConfigFn, columnTypes, schema, ...options }: DbOptionsWithAdapter<SchemaConfig, ColumnTypes>) => DbResult<ColumnTypes>;
5291
5296
  declare function _createDbSqlMethod<ColumnTypes>(columnTypes: ColumnTypes): DbSqlMethod<ColumnTypes>;
5292
5297
  declare const _initQueryBuilder: (adapter: Adapter, columnTypes: unknown, asyncStorage: AsyncLocalStorage<AsyncState>, commonOptions: DbTableOptions<unknown, undefined, Column.QueryColumns>, options: DbSharedOptions) => Db;
5293
5298
  type SQLQueryArgs = TemplateLiteralArgs | [RawSqlBase];
@@ -5667,7 +5672,7 @@ interface TopCTE {
5667
5672
  append: string[][];
5668
5673
  }
5669
5674
  declare const addTopCteSql: (ctx: ToSQLCtx, as: string | undefined, sql: string) => string;
5670
- declare const addTopCte: (place: "before" | "after", ctx: ToSQLCtx, q: SubQueryForSql, type: QueryData["type"], as?: string | ((as: string) => void), dontAddTableHook?: boolean) => string;
5675
+ declare const addTopCte: (place: 'before' | 'after', ctx: ToSQLCtx, q: SubQueryForSql, type: QueryData['type'], as?: string | ((as: string) => void), dontAddTableHook?: boolean) => string;
5671
5676
  /**
5672
5677
  * Function to turn the operator expression into SQL.
5673
5678
  *
@@ -5682,7 +5687,7 @@ interface OperatorToSQL {
5682
5687
  interface Operator<Value, Column extends Column.Pick.OutputTypeAndOperators = Column.Pick.OutputTypeAndOperators> {
5683
5688
  <T extends PickQueryResult>(this: T, arg: Value): { [K in Exclude<keyof T, keyof T['result']['value']['operators']>]: K extends 'result' ? {
5684
5689
  value: Column;
5685
- } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<Column['__outputType']> : T[K] } & Column['operators'];
5690
+ } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<Column['__outputType']> : T[K]; } & Column['operators'];
5686
5691
  _opType: Value;
5687
5692
  }
5688
5693
  interface Base$1<Value> {
@@ -5902,7 +5907,7 @@ interface OperatorsArray<T> extends Ord<T[]> {
5902
5907
  hasSome: Operator<T[] | IsQuery | Expression, BooleanQueryColumn>;
5903
5908
  containedIn: Operator<T[] | IsQuery | Expression, BooleanQueryColumn>;
5904
5909
  length: {
5905
- _opType: number | { [K in Exclude<keyof OperatorsNumber, '__hasSelect'>]?: OperatorsNumber[K]['_opType'] };
5910
+ _opType: number | { [K in Exclude<keyof OperatorsNumber, '__hasSelect'>]?: OperatorsNumber[K]['_opType']; };
5906
5911
  };
5907
5912
  }
5908
5913
  declare const Operators: {
@@ -5920,24 +5925,24 @@ interface ColumnsShape {
5920
5925
  [K: string]: Column;
5921
5926
  }
5922
5927
  declare namespace ColumnsShape {
5923
- export type DefaultSelectKeys<S extends Column.QueryColumnsInit> = { [K in keyof S]: S[K]['data']['explicitSelect'] extends true | undefined ? never : K }[keyof S];
5924
- export type DefaultOutput<Set extends Column.QueryColumnsInit> = { [K in DefaultSelectKeys<Set>]: Set[K]['__outputType'] };
5925
- export type Input<Shape extends Column.QueryColumnsInit, AppReadOnly = { [K in keyof Shape]: Shape[K]['data']['appReadOnly'] extends true ? K : never }[keyof Shape], Optional extends keyof Shape = { [K in keyof Shape]: Shape[K]['data']['optional'] extends true ? K : never }[keyof Shape]> = { [K in Exclude<keyof Shape, AppReadOnly | Optional>]: Shape[K]['__inputType'] } & { [K in Exclude<Optional, AppReadOnly>]?: Shape[K]['__inputType'] };
5926
- export type InputPartial<Shape extends Column.QueryColumnsInit> = { [K in keyof Shape]?: Shape[K]['__inputType'] };
5927
- export type Output<Shape extends Column.QueryColumns> = { [K in keyof Shape]: Shape[K]['__outputType'] };
5928
- export type DefaultSelectOutput<Shape extends Column.QueryColumnsInit> = { [K in { [K in keyof Shape]: Shape[K]['data']['explicitSelect'] extends true | undefined ? never : K }[keyof Shape]]: Shape[K]['__outputType'] };
5928
+ export type DefaultSelectKeys<S extends Column.QueryColumnsInit> = { [K in keyof S]: S[K]['data']['explicitSelect'] extends true | undefined ? never : K; }[keyof S];
5929
+ export type DefaultOutput<Set extends Column.QueryColumnsInit> = { [K in DefaultSelectKeys<Set>]: Set[K]['__outputType']; };
5930
+ export type Input<Shape extends Column.QueryColumnsInit, AppReadOnly = { [K in keyof Shape]: Shape[K]['data']['appReadOnly'] extends true ? K : never; }[keyof Shape], Optional extends keyof Shape = { [K in keyof Shape]: Shape[K]['data']['optional'] extends true ? K : never; }[keyof Shape]> = { [K in Exclude<keyof Shape, AppReadOnly | Optional>]: Shape[K]['__inputType']; } & { [K in Exclude<Optional, AppReadOnly>]?: Shape[K]['__inputType']; };
5931
+ export type InputPartial<Shape extends Column.QueryColumnsInit> = { [K in keyof Shape]?: Shape[K]['__inputType']; };
5932
+ export type Output<Shape extends Column.QueryColumns> = { [K in keyof Shape]: Shape[K]['__outputType']; };
5933
+ export type DefaultSelectOutput<Shape extends Column.QueryColumnsInit> = { [K in { [K in keyof Shape]: Shape[K]['data']['explicitSelect'] extends true | undefined ? never : K; }[keyof Shape]]: Shape[K]['__outputType']; };
5929
5934
  export interface MapToObjectColumn<Shape extends Column.QueryColumns> {
5930
5935
  dataType: 'object';
5931
- __type: { [K in keyof Shape]: Shape[K]['__type'] };
5936
+ __type: { [K in keyof Shape]: Shape[K]['__type']; };
5932
5937
  __outputType: ShallowSimplify<ObjectOutput<Shape>>;
5933
- __queryType: { [K in keyof Shape]: Shape[K]['__queryType'] };
5938
+ __queryType: { [K in keyof Shape]: Shape[K]['__queryType']; };
5934
5939
  operators: OperatorsAny;
5935
5940
  }
5936
5941
  export interface MapToNullableObjectColumn<Shape extends Column.QueryColumns> {
5937
5942
  dataType: 'object';
5938
- __type: { [K in keyof Shape]: Shape[K]['__type'] };
5943
+ __type: { [K in keyof Shape]: Shape[K]['__type']; };
5939
5944
  __outputType: ShallowSimplify<ObjectOutput<Shape>> | undefined;
5940
- __queryType: { [K in keyof Shape]: Shape[K]['__queryType'] } | null;
5945
+ __queryType: { [K in keyof Shape]: Shape[K]['__queryType']; } | null;
5941
5946
  operators: OperatorsAny;
5942
5947
  }
5943
5948
  export interface MapToPluckColumn<Shape extends Column.QueryColumns> {
@@ -5949,12 +5954,12 @@ declare namespace ColumnsShape {
5949
5954
  }
5950
5955
  export interface MapToObjectArrayColumn<Shape extends Column.QueryColumns> {
5951
5956
  dataType: 'array';
5952
- __type: { [K in keyof Shape]: Shape[K]['__type'] }[];
5957
+ __type: { [K in keyof Shape]: Shape[K]['__type']; }[];
5953
5958
  __outputType: ShallowSimplify<ObjectOutput<Shape>>[];
5954
- __queryType: { [K in keyof Shape]: Shape[K]['__queryType'] }[];
5959
+ __queryType: { [K in keyof Shape]: Shape[K]['__queryType']; }[];
5955
5960
  operators: OperatorsAny;
5956
5961
  }
5957
- type ObjectOutput<Shape extends Column.QueryColumns> = { [K in keyof Shape]: Shape[K]['__outputType'] };
5962
+ type ObjectOutput<Shape extends Column.QueryColumns> = { [K in keyof Shape]: Shape[K]['__outputType']; };
5958
5963
  export {};
5959
5964
  }
5960
5965
  interface SelectSelf extends PickQuerySelectable, PickQueryHasSelect, PickQueryDefaultSelect, PickQueryShape, PickQueryRelations, PickQueryResult, PickQueryReturnType, PickQueryWithData {}
@@ -5962,7 +5967,7 @@ type SelectArgs<T extends SelectSelf> = ('*' | keyof T['__selectable'])[];
5962
5967
  interface SubQueryAddition<T extends PickQueryWithData> extends IsSubQuery {
5963
5968
  withData: T['withData'];
5964
5969
  }
5965
- type SelectAsFnArg<T extends PickQueryRelationsWithData> = EmptyObject extends T['relations'] ? T : { [K in keyof T['relations'] | keyof T]: K extends keyof T['relations'] ? RelationQueryMaybeSingle<T['relations'][K]> & SubQueryAddition<T> : K extends keyof T ? T[K] : never };
5970
+ type SelectAsFnArg<T extends PickQueryRelationsWithData> = EmptyObject extends T['relations'] ? T : { [K in keyof T['relations'] | keyof T]: K extends keyof T['relations'] ? RelationQueryMaybeSingle<T['relations'][K]> & SubQueryAddition<T> : K extends keyof T ? T[K] : never; };
5966
5971
  interface SelectAsArg<T extends SelectSelf> {
5967
5972
  [K: string]: keyof T['__selectable'] | Expression | ((q: SelectAsFnArg<T>) => unknown);
5968
5973
  }
@@ -5974,10 +5979,10 @@ interface SelectAsCheckReturnTypes {
5974
5979
  [K: string]: PropertyKey | Expression | ((q: never) => SelectAsFnReturnType);
5975
5980
  }
5976
5981
  type SelectReturnType<T extends PickQueryReturnType> = T['returnType'] extends 'valueOrThrow' ? 'oneOrThrow' : T extends 'value' ? 'one' : T['returnType'] extends 'pluck' ? 'all' : T['returnType'];
5977
- type SelectResult<T extends SelectSelf, Columns extends PropertyKey[]> = { [K in keyof T]: K extends '__hasSelect' ? true : K extends 'result' ? { [K in '*' extends Columns[number] ? Exclude<Columns[number], '*'> | T['__defaultSelect'] : Columns[number] as T['__selectable'][K]['as']]: T['__selectable'][K]['column'] } & (T['__hasSelect'] extends (T['returnType'] extends 'value' | 'valueOrThrow' ? never : true) ? Omit<T['result'], Columns[number]> : unknown) : K extends 'returnType' ? SelectReturnType<T> : K extends 'then' ? QueryThenByReturnType<SelectReturnType<T>, { [K in '*' extends Columns[number] ? Exclude<Columns[number], '*'> | T['__defaultSelect'] : Columns[number] as T['__selectable'][K]['as']]: T['__selectable'][K]['column'] } & (T['__hasSelect'] extends (T['returnType'] extends 'value' | 'valueOrThrow' ? never : true) ? Omit<T['result'], Columns[number]> : unknown)> : T[K] };
5978
- type SelectResultObj<T extends SelectSelf, Obj> = Obj extends SelectAsCheckReturnTypes ? { [K in keyof T]: K extends '__hasSelect' ? true : K extends '__selectable' ? T['__selectable'] & SelectAsSelectable<Obj> : K extends 'result' ? { [K in T['__hasSelect'] extends (T['returnType'] extends 'value' | 'valueOrThrow' ? never : true) ? keyof Obj | keyof T['result'] : keyof Obj]: K extends keyof Obj ? SelectAsValueResult<T, Obj[K]> : K extends keyof T['result'] ? T['result'][K] : never } : K extends 'returnType' ? SelectReturnType<T> : K extends 'then' ? QueryThenByReturnType<SelectReturnType<T>, { [K in T['__hasSelect'] extends (T['returnType'] extends 'value' | 'valueOrThrow' ? never : true) ? keyof Obj | keyof T['result'] : keyof Obj]: K extends keyof Obj ? SelectAsValueResult<T, Obj[K]> : K extends keyof T['result'] ? T['result'][K] : never }> : T[K] } : `Invalid return type of ${{ [K in keyof Obj]: Obj[K] extends ((...args: any[]) => any) ? ReturnType<Obj[K]> extends SelectAsFnReturnType ? never : K : never }[keyof Obj] & string}`;
5979
- type SelectResultColumnsAndObj<T extends SelectSelf, Columns extends PropertyKey[], Obj> = { [K in keyof T]: K extends '__hasSelect' ? true : K extends '__selectable' ? T['__selectable'] & SelectAsSelectable<Obj> : K extends 'result' ? // Combine previously selected items, all columns if * was provided,
5980
- { [K in ('*' extends Columns[number] ? Exclude<Columns[number], '*'> | T['__defaultSelect'] : Columns[number]) | keyof Obj as K extends Columns[number] ? T['__selectable'][K]['as'] : K]: K extends keyof Obj ? SelectAsValueResult<T, Obj[K]> : T['__selectable'][K]['column'] } & (T['__hasSelect'] extends (T['returnType'] extends 'value' | 'valueOrThrow' ? never : true) ? Omit<T['result'], Columns[number]> : unknown) : K extends 'returnType' ? SelectReturnType<T> : K extends 'then' ? QueryThenByReturnType<SelectReturnType<T>, { [K in ('*' extends Columns[number] ? Exclude<Columns[number], '*'> | T['__defaultSelect'] : Columns[number]) | keyof Obj as K extends Columns[number] ? T['__selectable'][K]['as'] : K]: K extends keyof Obj ? SelectAsValueResult<T, Obj[K]> : T['__selectable'][K]['column'] } & (T['__hasSelect'] extends (T['returnType'] extends 'value' | 'valueOrThrow' ? never : true) ? Omit<T['result'], Columns[number]> : unknown)> : T[K] };
5982
+ type SelectResult<T extends SelectSelf, Columns extends PropertyKey[]> = { [K in keyof T]: K extends '__hasSelect' ? true : K extends 'result' ? { [K in '*' extends Columns[number] ? Exclude<Columns[number], '*'> | T['__defaultSelect'] : Columns[number] as T['__selectable'][K]['as']]: T['__selectable'][K]['column']; } & (T['__hasSelect'] extends (T['returnType'] extends 'value' | 'valueOrThrow' ? never : true) ? Omit<T['result'], Columns[number]> : unknown) : K extends 'returnType' ? SelectReturnType<T> : K extends 'then' ? QueryThenByReturnType<SelectReturnType<T>, { [K in '*' extends Columns[number] ? Exclude<Columns[number], '*'> | T['__defaultSelect'] : Columns[number] as T['__selectable'][K]['as']]: T['__selectable'][K]['column']; } & (T['__hasSelect'] extends (T['returnType'] extends 'value' | 'valueOrThrow' ? never : true) ? Omit<T['result'], Columns[number]> : unknown)> : T[K]; };
5983
+ type SelectResultObj<T extends SelectSelf, Obj> = Obj extends SelectAsCheckReturnTypes ? { [K in keyof T]: K extends '__hasSelect' ? true : K extends '__selectable' ? T['__selectable'] & SelectAsSelectable<Obj> : K extends 'result' ? { [K in T['__hasSelect'] extends (T['returnType'] extends 'value' | 'valueOrThrow' ? never : true) ? keyof Obj | keyof T['result'] : keyof Obj]: K extends keyof Obj ? SelectAsValueResult<T, Obj[K]> : K extends keyof T['result'] ? T['result'][K] : never; } : K extends 'returnType' ? SelectReturnType<T> : K extends 'then' ? QueryThenByReturnType<SelectReturnType<T>, { [K in T['__hasSelect'] extends (T['returnType'] extends 'value' | 'valueOrThrow' ? never : true) ? keyof Obj | keyof T['result'] : keyof Obj]: K extends keyof Obj ? SelectAsValueResult<T, Obj[K]> : K extends keyof T['result'] ? T['result'][K] : never; }> : T[K]; } : `Invalid return type of ${{ [K in keyof Obj]: Obj[K] extends ((...args: any[]) => any) ? ReturnType<Obj[K]> extends SelectAsFnReturnType ? never : K : never; }[keyof Obj] & string}`;
5984
+ type SelectResultColumnsAndObj<T extends SelectSelf, Columns extends PropertyKey[], Obj> = { [K in keyof T]: K extends '__hasSelect' ? true : K extends '__selectable' ? T['__selectable'] & SelectAsSelectable<Obj> : K extends 'result' // Combine previously selected items, all columns if * was provided,
5985
+ ? { [K in ('*' extends Columns[number] ? Exclude<Columns[number], '*'> | T['__defaultSelect'] : Columns[number]) | keyof Obj as K extends Columns[number] ? T['__selectable'][K]['as'] : K]: K extends keyof Obj ? SelectAsValueResult<T, Obj[K]> : T['__selectable'][K]['column']; } & (T['__hasSelect'] extends (T['returnType'] extends 'value' | 'valueOrThrow' ? never : true) ? Omit<T['result'], Columns[number]> : unknown) : K extends 'returnType' ? SelectReturnType<T> : K extends 'then' ? QueryThenByReturnType<SelectReturnType<T>, { [K in ('*' extends Columns[number] ? Exclude<Columns[number], '*'> | T['__defaultSelect'] : Columns[number]) | keyof Obj as K extends Columns[number] ? T['__selectable'][K]['as'] : K]: K extends keyof Obj ? SelectAsValueResult<T, Obj[K]> : T['__selectable'][K]['column']; } & (T['__hasSelect'] extends (T['returnType'] extends 'value' | 'valueOrThrow' ? never : true) ? Omit<T['result'], Columns[number]> : unknown)> : T[K]; };
5981
5986
  interface AllowedRelationOneQueryForSelectable extends IsSubQuery {
5982
5987
  result: Column.QueryColumns;
5983
5988
  returnType: 'value' | 'valueOrThrow' | 'one' | 'oneOrThrow';
@@ -5985,7 +5990,7 @@ interface AllowedRelationOneQueryForSelectable extends IsSubQuery {
5985
5990
  type SelectAsSelectable<Obj> = UnionToIntersection<{ [K in keyof Obj]: Obj[K] extends ((q: never) => infer R extends AllowedRelationOneQueryForSelectable) ? { [C in R['returnType'] extends 'value' | 'valueOrThrow' ? K : keyof R['result'] as R['returnType'] extends 'value' | 'valueOrThrow' ? K : `${K & string}.${C & string}`]: {
5986
5991
  as: C;
5987
5992
  column: R['returnType'] extends 'value' | 'valueOrThrow' ? R['result']['value'] : R['result'][C & keyof R['result']];
5988
- } } : never }[keyof Obj]>;
5993
+ }; } : never; }[keyof Obj]>;
5989
5994
  type SelectAsValueResult<T extends SelectSelf, Arg> = Arg extends keyof T['__selectable'] ? T['__selectable'][Arg]['column'] : Arg extends Expression ? Arg['result']['value'] : Arg extends ((q: never) => IsQuery) ? SelectSubQueryResult<ReturnType<Arg>> : Arg extends ((q: never) => Expression) ? ReturnType<Arg>['result']['value'] : Arg extends ((q: never) => IsQuery | Expression) ? SelectSubQueryResult<Exclude<ReturnType<Arg>, Expression>> | Exclude<ReturnType<Arg>, IsQuery>['result']['value'] : never;
5990
5995
  type SelectSubQueryResult<Arg extends SelectSelf> = Arg['returnType'] extends undefined | 'all' ? ColumnsShape.MapToObjectArrayColumn<Arg['result']> : Arg['returnType'] extends 'value' | 'valueOrThrow' ? Arg['result']['value'] : Arg['returnType'] extends 'pluck' ? ColumnsShape.MapToPluckColumn<Arg['result']> : Arg['returnType'] extends 'one' ? ColumnsShape.MapToNullableObjectColumn<Arg['result']> : ColumnsShape.MapToObjectColumn<Arg['result']>;
5991
5996
  declare function _querySelect<T extends SelectSelf, Columns extends SelectArgs<T>>(q: T, columns: Columns): SelectResult<T, Columns>;
@@ -6091,15 +6096,6 @@ type QueryDataTransform = QueryDataTransformFn | {
6091
6096
  interface QueryDataTransformFn {
6092
6097
  (data: unknown, queryData: unknown): unknown;
6093
6098
  }
6094
- /**
6095
- * See `transform` query method.
6096
- * This helper applies all transform functions to a result.
6097
- *
6098
- * @param queryData - query data
6099
- * @param returnType - return type of the query, for proper `map` handling
6100
- * @param fns - array of transform functions, can be undefined
6101
- * @param result - query result to transform
6102
- */
6103
6099
  declare class QueryTransform {
6104
6100
  /**
6105
6101
  * Transform the result of the query right after loading it.
@@ -6158,7 +6154,7 @@ declare class QueryTransform {
6158
6154
  then: QueryThen<infer Data>;
6159
6155
  } ? Data : never, queryData: QueryData) => Result): { [K in keyof T]: K extends 'returnType' ? 'valueOrThrow' : K extends 'result' ? {
6160
6156
  value: Column.Pick.QueryColumnOfType<Result>;
6161
- } : K extends 'then' ? QueryThen<Result> : T[K] };
6157
+ } : K extends 'then' ? QueryThen<Result> : T[K]; };
6162
6158
  }
6163
6159
  type SelectableOrExpression<T extends PickQuerySelectable = PickQuerySelectable, C extends Column.Pick.QueryColumn = Column.Pick.QueryColumn> = '*' | keyof T['__selectable'] | Expression<C>;
6164
6160
  type SelectableOrExpressions<T extends PickQuerySelectable = PickQuerySelectable, C extends Column.Pick.QueryColumn = Column.Pick.QueryColumn> = ('*' | keyof T['__selectable'] | Expression<C>)[];
@@ -6216,7 +6212,8 @@ declare abstract class ExpressionTypeMethod {
6216
6212
  expr?: Expression;
6217
6213
  };
6218
6214
  columnTypes: unknown;
6219
- }, C extends Column.Pick.QueryColumn>(this: T, fn: (types: T['columnTypes']) => C): // Omit is optimal
6215
+ }, C extends Column.Pick.QueryColumn>(this: T, fn: (types: T['columnTypes']) => C):
6216
+ // Omit is optimal
6220
6217
  Omit<T, 'result'> & {
6221
6218
  result: {
6222
6219
  value: C;
@@ -6545,7 +6542,7 @@ declare class QueryTransaction {
6545
6542
  */
6546
6543
  recoverable<T>(this: T): T;
6547
6544
  }
6548
- type AfterHook<Select extends PropertyKey[], Shape extends Column.QueryColumns> = QueryAfterHook<{ [K in Select[number]]: K extends keyof Shape ? Shape[K]['__outputType'] : never }[]>;
6545
+ type AfterHook<Select extends PropertyKey[], Shape extends Column.QueryColumns> = QueryAfterHook<{ [K in Select[number]]: K extends keyof Shape ? Shape[K]['__outputType'] : never; }[]>;
6549
6546
  type HookSelectArg<T extends PickQueryShape> = (keyof T['shape'] & string)[];
6550
6547
  declare const _hookSelectColumns: (query: Query, columns: string[], asFn: (as: string[]) => void) => void;
6551
6548
  declare class QueryHookUtils<T extends PickQueryInputType> {
@@ -6553,10 +6550,10 @@ declare class QueryHookUtils<T extends PickQueryInputType> {
6553
6550
  columns: string[];
6554
6551
  private key;
6555
6552
  constructor(query: IsQuery, columns: string[], key: 'hookCreateSet' | 'hookUpdateSet');
6556
- set: (data: { [K in keyof T["__inputType"]]?: T["__inputType"][K] | (() => QueryOrExpression<T["__inputType"][K]>) }) => void;
6553
+ set: (data: { [K in keyof T['__inputType']]?: T['__inputType'][K] | (() => QueryOrExpression<T['__inputType'][K]>); }) => void;
6557
6554
  }
6558
- declare const _queryHookAfterCreate: <T extends PickQueryShape, S extends HookSelectArg<T>>(q: T, select: S, cb: AfterHook<S, T["shape"]>) => T;
6559
- declare const _queryHookAfterUpdate: <T extends PickQueryShape, S extends HookSelectArg<T>>(q: T, select: S, cb: AfterHook<S, T["shape"]>) => T;
6555
+ declare const _queryHookAfterCreate: (q: PickQueryShape, select: HookSelectArg<PickQueryShape>, cb: AfterHook<HookSelectArg<PickQueryShape>, Column.QueryColumns>) => PickQueryShape;
6556
+ declare const _queryHookAfterUpdate: (q: PickQueryShape, select: HookSelectArg<PickQueryShape>, cb: AfterHook<HookSelectArg<PickQueryShape>, PickQueryShape['shape']>) => PickQueryShape;
6560
6557
  declare abstract class QueryHooks {
6561
6558
  /**
6562
6559
  * Run the function before any kind of query.
@@ -6706,7 +6703,7 @@ interface ColumnDataSelectSqlProp {
6706
6703
  interface SelectSqlCallback {
6707
6704
  (column: ColumnRefExpression<Column.Pick.QueryColumn>): Expression;
6708
6705
  }
6709
- type SelectSqlColumn<T extends Column.Pick.DataAndDataType, Expr extends Expression> = unknown extends Expr['result']['value']['__outputType'] ? T : { [K in keyof T]: K extends '__outputType' ? Expr['result']['value']['__outputType'] : T[K] };
6706
+ type SelectSqlColumn<T extends Column.Pick.DataAndDataType, Expr extends Expression> = unknown extends Expr['result']['value']['__outputType'] ? T : { [K in keyof T]: K extends '__outputType' ? Expr['result']['value']['__outputType'] : T[K]; };
6710
6707
  declare namespace Column {
6711
6708
  export interface IsPrimaryKey<Name extends string> {
6712
6709
  data: {
@@ -6718,10 +6715,10 @@ declare namespace Column {
6718
6715
  unique: Name;
6719
6716
  };
6720
6717
  };
6721
- export type Nullable<T extends Column.Pick.ForNullable> = { [K in keyof T]: K extends '__type' ? T['__type'] | null : K extends '__inputType' ? T['__inputType'] | null : K extends '__outputType' ? T['__outputType'] | (unknown extends T['__nullType'] ? null : T['__nullType']) : K extends '__queryType' ? T['__queryType'] | null : K extends 'data' ? T['data'] & DataNullable : K extends 'operators' ? { [K in keyof T['operators']]: K extends 'equals' | 'not' | 'isDistinctFrom' | 'isNotDistinctFrom' ? Operator<T['__queryType'] | null, T> : T['operators'][K] } : T[K] };
6722
- export type NullableWithSchema<T extends Column.Pick.ForNullable, InputSchema, OutputSchema, QuerySchema> = { [K in keyof T]: K extends '__type' ? T['__type'] | null : K extends '__inputType' ? T['__inputType'] | null : K extends 'inputSchema' ? InputSchema : K extends '__outputType' ? T['__outputType'] | (unknown extends T['__nullType'] ? null : T['__nullType']) : K extends 'outputSchema' ? OutputSchema : K extends '__queryType' ? T['__queryType'] | null : K extends 'querySchema' ? QuerySchema : K extends 'data' ? T['data'] & DataNullable : K extends 'operators' ? { [K in keyof T['operators']]: K extends 'equals' | 'not' | 'isDistinctFrom' | 'isNotDistinctFrom' ? Operator<T['__queryType'] | null, T> : T['operators'][K] } : T[K] };
6723
- export type QueryColumnToNullable<C> = { [K in keyof C]: K extends '__outputType' | '__queryType' ? C[K] | null : C[K] };
6724
- export type QueryColumnToOptional<C> = { [K in keyof C]: K extends '__outputType' ? C[K] | undefined : C[K] };
6718
+ export type Nullable<T extends Column.Pick.ForNullable> = { [K in keyof T]: K extends '__type' ? T['__type'] | null : K extends '__inputType' ? T['__inputType'] | null : K extends '__outputType' ? T['__outputType'] | (unknown extends T['__nullType'] ? null : T['__nullType']) : K extends '__queryType' ? T['__queryType'] | null : K extends 'data' ? T['data'] & DataNullable : K extends 'operators' ? { [K in keyof T['operators']]: K extends 'equals' | 'not' | 'isDistinctFrom' | 'isNotDistinctFrom' ? Operator<T['__queryType'] | null, T> : T['operators'][K]; } : T[K]; };
6719
+ export type NullableWithSchema<T extends Column.Pick.ForNullable, InputSchema, OutputSchema, QuerySchema> = { [K in keyof T]: K extends '__type' ? T['__type'] | null : K extends '__inputType' ? T['__inputType'] | null : K extends 'inputSchema' ? InputSchema : K extends '__outputType' ? T['__outputType'] | (unknown extends T['__nullType'] ? null : T['__nullType']) : K extends 'outputSchema' ? OutputSchema : K extends '__queryType' ? T['__queryType'] | null : K extends 'querySchema' ? QuerySchema : K extends 'data' ? T['data'] & DataNullable : K extends 'operators' ? { [K in keyof T['operators']]: K extends 'equals' | 'not' | 'isDistinctFrom' | 'isNotDistinctFrom' ? Operator<T['__queryType'] | null, T> : T['operators'][K]; } : T[K]; };
6720
+ export type QueryColumnToNullable<C> = { [K in keyof C]: K extends '__outputType' | '__queryType' ? C[K] | null : C[K]; };
6721
+ export type QueryColumnToOptional<C> = { [K in keyof C]: K extends '__outputType' ? C[K] | undefined : C[K]; };
6725
6722
  interface DataNullable {
6726
6723
  isNullable: true;
6727
6724
  optional: true;
@@ -6732,18 +6729,23 @@ declare namespace Column {
6732
6729
  isDistinctFrom: Operator<Column['__queryType'] | null, Column>;
6733
6730
  isNotDistinctFrom: Operator<Column['__queryType'] | null, Column>;
6734
6731
  }
6735
- export type Encode<T, InputSchema, Input> = { [K in keyof T]: K extends '__inputType' ? Input : K extends 'inputSchema' ? InputSchema : T[K] };
6736
- export type Parse<T extends Pick.ForParse, OutputSchema, Output> = { [K in keyof T]: K extends '__outputType' ? null extends T['__type'] ? (Output extends null ? never : Output) | (unknown extends T['__nullType'] ? null : T['__nullType']) : Output : K extends 'outputSchema' ? null extends T['__type'] ? OutputSchema | T['nullSchema'] : OutputSchema : T[K] };
6737
- export type ParseNull<T extends Column.Pick.ForParseNull, NullSchema, NullType> = { [K in keyof T]: K extends '__outputType' ? null extends T['__type'] ? Exclude<T['__outputType'], null> | NullType : T['__outputType'] : K extends '__nullType' ? NullType : K extends 'outputSchema' ? null extends T['__type'] ? T['outputSchema'] | NullSchema : T['outputSchema'] : K extends 'nullSchema' ? NullSchema : T[K] };
6732
+ export type Encode<T, InputSchema, Input> = { [K in keyof T]: K extends '__inputType' ? Input : K extends 'inputSchema' ? InputSchema : T[K]; };
6733
+ export type Parse<T extends Pick.ForParse, OutputSchema, Output> = { [K in keyof T]: K extends '__outputType' ? null extends T['__type'] ? (Output extends null ? never : Output) | (unknown extends T['__nullType'] ? null : T['__nullType']) : Output : K extends 'outputSchema' ? null extends T['__type'] ? OutputSchema | T['nullSchema'] : OutputSchema : T[K]; };
6734
+ export type ParseNull<T extends Column.Pick.ForParseNull, NullSchema, NullType> = { [K in keyof T]: K extends '__outputType' ? null extends T['__type'] ? Exclude<T['__outputType'], null> | NullType : T['__outputType'] : K extends '__nullType' ? NullType : K extends 'outputSchema' ? null extends T['__type'] ? T['outputSchema'] | NullSchema : T['outputSchema'] : K extends 'nullSchema' ? NullSchema : T[K]; };
6738
6735
  export type HasDefault<T extends Column.Pick.Data> = T & Column.Data.Default;
6739
- type DefaultSelectData<T extends Column.Data, Value> = { [K in keyof T]: K extends 'explicitSelect' ? Value extends true ? false : true : T[K] };
6740
- export type DefaultSelect<T extends Column.Pick.Data, Value extends boolean> = { [K in keyof T]: K extends 'data' ? DefaultSelectData<T['data'], Value> : T[K] };
6736
+ type DefaultSelectData<T extends Column.Data, Value> = { [K in keyof T]: K extends 'explicitSelect' ? Value extends true ? false : true : T[K]; };
6737
+ export type DefaultSelect<T extends Column.Pick.Data, Value extends boolean> = { [K in keyof T]: K extends 'data' ? DefaultSelectData<T['data'], Value> : T[K]; };
6741
6738
  export interface IsAppReadOnly {
6742
6739
  data: {
6743
6740
  appReadOnly: true;
6744
6741
  };
6745
6742
  }
6746
- export type Generated<T extends Column.Pick.Data> = { [K in keyof T]: K extends 'data' ? { [K in keyof T['data']]: K extends 'default' ? true : T['data'][K] } : K extends '__inputType' ? never : T[K] };
6743
+ export type Generated<T extends Column.Pick.Data> = { [K in keyof T]: K extends 'data' ? { [K in keyof T['data']]: K extends 'default' ? true : T['data'][K]; } : K extends '__inputType' ? never : T[K]; };
6744
+ export interface Branded<Token extends true | string = true> {
6745
+ data: {
6746
+ branded: Token;
6747
+ };
6748
+ }
6747
6749
  export namespace Pick {
6748
6750
  interface Data {
6749
6751
  data: Column.Data;
@@ -6902,6 +6904,7 @@ declare namespace Column {
6902
6904
  name?: string;
6903
6905
  readOnly?: boolean;
6904
6906
  appReadOnly: true | undefined;
6907
+ branded: true | string | undefined;
6905
6908
  }
6906
6909
  export interface Data extends ColumnDataComputedProp {
6907
6910
  key: string;
@@ -6950,6 +6953,7 @@ declare namespace Column {
6950
6953
  readonly?: boolean;
6951
6954
  valueToArray?: boolean;
6952
6955
  skipValueToArray?: boolean;
6956
+ branded: true | string | undefined;
6953
6957
  }
6954
6958
  export namespace Data {
6955
6959
  interface Default {
@@ -6985,7 +6989,7 @@ declare namespace Column {
6985
6989
  export {};
6986
6990
  }
6987
6991
  declare function makeColumnNullable<T extends Column.Pick.ForNullable, InputSchema, OutputSchema, QuerySchema>(column: T, inputSchema: InputSchema, outputSchema: OutputSchema, querySchema: QuerySchema): Column.NullableWithSchema<T, InputSchema, OutputSchema, QuerySchema>;
6988
- declare const setColumnData: <T extends Column.Pick.Data, K extends keyof T["data"]>(q: T, key: K, value: T["data"][K]) => T;
6992
+ declare const setColumnData: <T extends Column.Pick.Data, K extends keyof T['data']>(q: T, key: K, value: T['data'][K]) => T;
6989
6993
  declare const setDataValue: <T extends Column.Pick.Data, Key extends string, Value>(item: T, key: Key, value: Value, params?: Column.Error.StringOrMessage) => T;
6990
6994
  declare function setCurrentColumnName(name: string): void;
6991
6995
  declare const consumeColumnName: () => string | undefined;
@@ -7305,15 +7309,16 @@ declare abstract class Column {
7305
7309
  * @deprecated use `type`, `inputType`, `outputType`, `queryType` instead
7306
7310
  */
7307
7311
  narrowAllTypes: this['__schema']['narrowAllTypes'];
7312
+ brand<T, Token extends true | string = true>(this: T, _token?: Token): T & Column.Branded<Token>;
7308
7313
  input<T extends {
7309
7314
  inputSchema: unknown;
7310
- }, InputSchema extends this['__schema']['__schemaType']>(this: T, fn: (schema: T['inputSchema']) => InputSchema): { [K in keyof T]: K extends 'inputSchema' ? InputSchema : T[K] };
7315
+ }, InputSchema extends this['__schema']['__schemaType']>(this: T, fn: (schema: T['inputSchema']) => InputSchema): { [K in keyof T]: K extends 'inputSchema' ? InputSchema : T[K]; };
7311
7316
  output<T extends {
7312
7317
  outputSchema: unknown;
7313
- }, OutputSchema extends this['__schema']['__schemaType']>(this: T, fn: (schema: T['outputSchema']) => OutputSchema): { [K in keyof T]: K extends 'outputSchema' ? OutputSchema : T[K] };
7318
+ }, OutputSchema extends this['__schema']['__schemaType']>(this: T, fn: (schema: T['outputSchema']) => OutputSchema): { [K in keyof T]: K extends 'outputSchema' ? OutputSchema : T[K]; };
7314
7319
  query<T extends {
7315
7320
  querySchema: unknown;
7316
- }, QuerySchema extends this['__schema']['__schemaType']>(this: T, fn: (schema: T['querySchema']) => QuerySchema): { [K in keyof T]: K extends 'querySchema' ? QuerySchema : T[K] };
7321
+ }, QuerySchema extends this['__schema']['__schemaType']>(this: T, fn: (schema: T['querySchema']) => QuerySchema): { [K in keyof T]: K extends 'querySchema' ? QuerySchema : T[K]; };
7317
7322
  /**
7318
7323
  * Set a database column name.
7319
7324
  *
@@ -7788,15 +7793,7 @@ type CreateManyFromResult<T extends CreateSelf> = T extends {
7788
7793
  isCount: true;
7789
7794
  } ? T : T['returnType'] extends 'one' | 'oneOrThrow' ? SetQueryReturnsAll<T> : T['returnType'] extends 'value' | 'valueOrThrow' ? SetValueQueryReturnsPluckColumn<T> : T;
7790
7795
  type InsertManyFromResult<T extends CreateSelf> = T['__hasSelect'] extends true ? T['returnType'] extends 'one' | 'oneOrThrow' ? SetQueryReturnsAll<T> : T['returnType'] extends 'value' | 'valueOrThrow' ? SetValueQueryReturnsPluckColumn<T> : T : SetQueryReturnsRowCountMany<T>;
7791
- /**
7792
- * Function to collect column names from the inner query of create `from` methods.
7793
- *
7794
- * @param q - the creating query
7795
- * @param from - inner query to grab the columns from.
7796
- * @param obj - optionally passed object with specific data, only available when creating a single record.
7797
- * @param many - whether it's for `createForEachFrom`. If no, throws if the inner query returns multiple records.
7798
- */
7799
- declare const _queryCreateManyFrom: <T extends CreateSelf, Q extends QueryReturningOne>(q: T, query: Q, data: Omit<CreateData<T>, keyof Q["result"]>[]) => CreateManyFromResult<T>;
7796
+ declare const _queryCreateManyFrom: <T extends CreateSelf, Q extends QueryReturningOne>(q: T, query: Q, data: Omit<CreateData<T>, keyof Q['result']>[]) => CreateManyFromResult<T>;
7800
7797
  declare class QueryCreateFrom {
7801
7798
  /**
7802
7799
  * Inserts a single record based on a query that selects a single record.
@@ -7952,9 +7949,9 @@ declare class QueryCreateFrom {
7952
7949
  interface CreateSelf extends PickQueryHasSelect, PickQueryDefaults, PickQueryResult, PickQueryRelations, PickQueryRelationsDataForCreate, PickQueryRelationsDataForCreateOptional, PickQueryWithData, PickQueryReturnType, PickQueryShape, PickQueryUniqueProperties, PickQueryInputType, Query.Pick.IsNotReadOnly {}
7953
7950
  type CreateData<T extends CreateSelf> = EmptyObject extends T['relations'] ? CreateDataWithDefaults<T, keyof T['__defaults']> : CreateRelationsData<T>;
7954
7951
  type CreateDataOmit<T extends CreateSelf, OmitKeys> = EmptyObject extends T['relations'] ? CreateDataWithDefaultsOmit<T, keyof T['__defaults'], OmitKeys> : CreateRelationsDataOmit<T, OmitKeys>;
7955
- type CreateDataWithDefaults<T extends CreateSelf, Defaults extends PropertyKey> = { [K in keyof T['__inputType'] as K extends Defaults ? never : K]: K extends Defaults ? never : CreateColumn<T, K> } & { [K in Defaults]?: K extends keyof T['__inputType'] ? CreateColumn<T, K> : never };
7956
- type CreateDataWithDefaultsOmit<T extends CreateSelf, Defaults extends PropertyKey, OmitKeys> = { [K in keyof T['__inputType'] as K extends Defaults | OmitKeys ? never : K]: K extends Defaults ? never : CreateColumn<T, K> } & { [K in Defaults as K extends OmitKeys ? never : K]?: K extends keyof T['__inputType'] ? CreateColumn<T, K> : never };
7957
- type WritableForeignKeys<T extends CreateSelf, AllFKeys extends PropertyKey> = AllFKeys extends infer K ? K extends keyof T['shape'] ? T['shape'][K] extends {
7952
+ type CreateDataWithDefaults<T extends CreateSelf, Defaults extends PropertyKey> = { [K in keyof T['__inputType'] as K extends Defaults ? never : K]: K extends Defaults ? never : CreateColumn<T, K>; } & { [K in Defaults]?: K extends keyof T['__inputType'] ? CreateColumn<T, K> : never; };
7953
+ type CreateDataWithDefaultsOmit<T extends CreateSelf, Defaults extends PropertyKey, OmitKeys> = { [K in keyof T['__inputType'] as K extends Defaults | OmitKeys ? never : K]: K extends Defaults ? never : CreateColumn<T, K>; } & { [K in Defaults as K extends OmitKeys ? never : K]?: K extends keyof T['__inputType'] ? CreateColumn<T, K> : never; };
7954
+ type WritableForeignKeys<T extends CreateSelf, AllFKeys extends PropertyKey> = AllFKeys extends (infer K) ? K extends keyof T['shape'] ? T['shape'][K] extends {
7958
7955
  data: {
7959
7956
  makeColumnWritable: true;
7960
7957
  };
@@ -7962,8 +7959,8 @@ type WritableForeignKeys<T extends CreateSelf, AllFKeys extends PropertyKey> = A
7962
7959
  type CreateColumn<T extends CreateSelf, K extends keyof T['__inputType']> = T['__inputType'][K] | ((q: T) => QueryOrExpression<T['__inputType'][K]>);
7963
7960
  type CreateRelationsData<T extends CreateSelf> = CreateDataWithDefaultsOmit<T, keyof T['__defaults'], Exclude<T['relations'][keyof T['relations']]['omitForeignKeyInCreate'], WritableForeignKeys<T, T['relations'][keyof T['relations']]['omitForeignKeyInCreate']>>> & CreateRelationsDataOmittingFKeys<T, T['relationsDataForCreate']> & T['relationsDataForCreateOptional'];
7964
7961
  type CreateRelationsDataOmit<T extends CreateSelf, OmitKeys> = CreateDataWithDefaultsOmit<T, keyof T['__defaults'], Exclude<T['relations'][keyof T['relations']]['omitForeignKeyInCreate'], WritableForeignKeys<T, T['relations'][keyof T['relations']]['omitForeignKeyInCreate']>> | OmitKeys> & CreateRelationsDataOmittingFKeys<T, T['relationsDataForCreate']> & T['relationsDataForCreateOptional'];
7965
- type CreateRelationsDataOmittingFKeys<T extends CreateSelf, Data> = EmptyObject extends Data ? EmptyObject : { [K in keyof Data]: CreateRelationDataOmittingFKeys<T, Data[K]> }[keyof Data] extends ((u: infer Obj) => void) ? Obj : never;
7966
- type CreateRelationDataOmittingFKeys<T extends CreateSelf, Union> = (u: Union extends RelationConfigDataForCreate ? Union['columns'] extends keyof T['__defaults'] ? Pick<CreateDataWithDefaults<T, keyof T['__defaults']>, Union['columns']> & Partial<Union['nested']> : (Pick<{ [P in keyof T['__inputType']]: CreateColumn<T, P> }, Union['columns'] & keyof T['__inputType']> & { [K in keyof Union['nested']]?: never }) | Union['nested'] : Union) => void;
7962
+ type CreateRelationsDataOmittingFKeys<T extends CreateSelf, Data> = EmptyObject extends Data ? EmptyObject : { [K in keyof Data]: CreateRelationDataOmittingFKeys<T, Data[K]>; }[keyof Data] extends ((u: infer Obj) => void) ? Obj : never;
7963
+ type CreateRelationDataOmittingFKeys<T extends CreateSelf, Union> = (u: Union extends RelationConfigDataForCreate ? Union['columns'] extends keyof T['__defaults'] ? Pick<CreateDataWithDefaults<T, keyof T['__defaults']>, Union['columns']> & Partial<Union['nested']> : (Pick<{ [P in keyof T['__inputType']]: CreateColumn<T, P>; }, Union['columns'] & keyof T['__inputType']> & { [K in keyof Union['nested']]?: never; }) | Union['nested'] : Union) => void;
7967
7964
  type CreateResult<T extends CreateSelf, Data> = T extends {
7968
7965
  isCount: true;
7969
7966
  } ? T : T['returnType'] extends undefined | 'all' ? SetQueryReturnsOneResult<T, NarrowCreateResult<T, Data>> : T['returnType'] extends 'pluck' ? SetQueryReturnsColumnResult<T, NarrowCreateResult<T, Data>> : SetQueryResult<T, NarrowCreateResult<T, Data>>;
@@ -7978,12 +7975,12 @@ type InsertManyResult<T extends CreateSelf> = T['__hasSelect'] extends true ? T[
7978
7975
  *
7979
7976
  * The same should work as well with any non-null columns passed to `create`, but it's to be implemented later.
7980
7977
  */
7981
- type NarrowCreateResult<T extends CreateSelf, Data> = EmptyObject extends T['relations'] ? T['result'] : { [K in keyof T['result']]: true extends { [R in keyof T['relations']]: K extends T['relations'][R]['omitForeignKeyInCreate'] ? R extends keyof Data ? true : T['relations'][R]['omitForeignKeyInCreate'] extends keyof Data ? null | undefined extends Data[T['relations'][R]['omitForeignKeyInCreate']] ? never : true : never : never }[keyof T['relations']] ? Column.Pick.QueryColumnOfTypeAndOps<string, Exclude<T['result'][K]['__outputType'], null>, T['result'][K]['operators']> : T['result'][K] };
7978
+ type NarrowCreateResult<T extends CreateSelf, Data> = EmptyObject extends T['relations'] ? T['result'] : { [K in keyof T['result']]: true extends { [R in keyof T['relations']]: K extends T['relations'][R]['omitForeignKeyInCreate'] ? R extends keyof Data ? true : T['relations'][R]['omitForeignKeyInCreate'] extends keyof Data ? null | undefined extends Data[T['relations'][R]['omitForeignKeyInCreate']] ? never : true : never : never; }[keyof T['relations']] ? Column.Pick.QueryColumnOfTypeAndOps<string, Exclude<T['result'][K]['__outputType'], null>, T['result'][K]['operators']> : T['result'][K]; };
7982
7979
  type IgnoreResult<T extends CreateSelf> = T['returnType'] extends 'oneOrThrow' ? QueryTakeOptional<T> : T['returnType'] extends 'valueOrThrow' ? SetQueryReturnsColumnOptional<T, T['result']['value']> : T;
7983
7980
  type OnConflictArg<T extends PickQueryUniqueProperties> = T['internal']['uniqueColumnNames'] | T['internal']['uniqueColumnTuples'] | Expression | {
7984
7981
  constraint: T['internal']['uniqueConstraints'];
7985
7982
  };
7986
- type AddQueryDefaults<T extends CreateSelf, DefaultKeys extends PropertyKey> = { [K in keyof T]: K extends '__defaults' ? { [K in keyof T['__defaults'] | DefaultKeys]: true } : T[K] };
7983
+ type AddQueryDefaults<T extends CreateSelf, DefaultKeys extends PropertyKey> = { [K in keyof T]: K extends '__defaults' ? { [K in keyof T['__defaults'] | DefaultKeys]: true; } : T[K]; };
7987
7984
  /**
7988
7985
  * Used by ORM to access the context of current create query.
7989
7986
  * Is passed to the `create` method of a {@link VirtualColumn}
@@ -8274,7 +8271,7 @@ declare class QueryCreate {
8274
8271
  */
8275
8272
  onConflictDoNothing<T extends CreateSelf, Arg extends OnConflictArg<T>>(this: T, arg?: Arg): IgnoreResult<T>;
8276
8273
  }
8277
- type OnConflictSet$1<T extends CreateSelf> = { [K in keyof T['__inputType']]?: T['__inputType'][K] | (() => QueryOrExpression<T['__inputType'][K]>) };
8274
+ type OnConflictSet$1<T extends CreateSelf> = { [K in keyof T['__inputType']]?: T['__inputType'][K] | (() => QueryOrExpression<T['__inputType'][K]>); };
8278
8275
  declare class OnConflictQueryBuilder<T extends CreateSelf, Arg extends OnConflictArg<T> | undefined> {
8279
8276
  private query;
8280
8277
  private onConflict;
@@ -8343,11 +8340,11 @@ declare class OnConflictQueryBuilder<T extends CreateSelf, Arg extends OnConflic
8343
8340
  }): T;
8344
8341
  }
8345
8342
  interface UpdateSelf extends PickQuerySelectable, PickQueryResult, PickQueryRelations, PickQueryWithData, PickQueryReturnType, PickQueryShape, PickQueryInputType, PickQueryAs, PickQueryHasSelect, PickQueryHasWhere, Query.Pick.IsNotReadOnly {}
8346
- type UpdateData<T extends UpdateSelf> = { [K in keyof T['__inputType'] | keyof T['relations']]?: K extends keyof T['__inputType'] ? T['__inputType'][K] | ((q: { [K in keyof T['relations'] | keyof T]: K extends keyof T['relations'] ? T['relations'][K]['query'] : K extends keyof T ? T[K] : never }) => QueryOrExpression<T['__inputType'][K]>) : T['returnType'] extends undefined | 'all' ? T['relations'][K]['dataForUpdate'] : T['relations'][K]['dataForUpdateOne'] };
8343
+ type UpdateData<T extends UpdateSelf> = { [K in keyof T['__inputType'] | keyof T['relations']]?: K extends keyof T['__inputType'] ? T['__inputType'][K] | ((q: { [K in keyof T['relations'] | keyof T]: K extends keyof T['relations'] ? T['relations'][K]['query'] : K extends keyof T ? T[K] : never; }) => QueryOrExpression<T['__inputType'][K]>) : T['returnType'] extends undefined | 'all' ? T['relations'][K]['dataForUpdate'] : T['relations'][K]['dataForUpdateOne']; };
8347
8344
  type UpdateArg<T extends UpdateSelf> = T['__hasWhere'] extends true ? UpdateData<T> : 'Update statement must have where conditions. To update all prefix `update` with `all()`';
8348
8345
  type UpdateResult<T extends UpdateSelf> = T['__hasSelect'] extends true ? T : T['returnType'] extends undefined | 'all' ? SetQueryReturnsRowCountMany<T> : SetQueryReturnsRowCount<T>;
8349
- type NumericColumns<T extends UpdateSelf> = { [K in keyof T['__inputType']]: Exclude<T['shape'][K]['__queryType'], string> extends number | bigint | null ? K : never }[keyof T['__inputType']];
8350
- type ChangeCountArg<T extends UpdateSelf> = NumericColumns<T> | { [K in NumericColumns<T>]?: T['shape'][K]['__type'] extends number | null ? number : number | string | bigint };
8346
+ type NumericColumns<T extends UpdateSelf> = { [K in keyof T['__inputType']]: Exclude<T['shape'][K]['__queryType'], string> extends number | bigint | null ? K : never; }[keyof T['__inputType']];
8347
+ type ChangeCountArg<T extends UpdateSelf> = NumericColumns<T> | { [K in NumericColumns<T>]?: T['shape'][K]['__type'] extends number | null ? number : number | string | bigint; };
8351
8348
  interface UpdateManyBySelf extends UpdateSelf {
8352
8349
  internal: {
8353
8350
  uniqueColumns: unknown;
@@ -8356,10 +8353,10 @@ interface UpdateManyBySelf extends UpdateSelf {
8356
8353
  uniqueConstraints: unknown;
8357
8354
  };
8358
8355
  }
8359
- type UpdateManyData<T extends UpdateSelf> = ({ [K in keyof T['shape'] as T['shape'][K] extends Column.IsPrimaryKey<string> ? K : never]: T['shape'][K]['__queryType'] | Expression } & { [P in keyof T['__inputType']]?: T['__inputType'][P] | Expression })[];
8356
+ type UpdateManyData<T extends UpdateSelf> = ({ [K in keyof T['shape'] as T['shape'][K] extends Column.IsPrimaryKey<string> ? K : never]: T['shape'][K]['__queryType'] | Expression; } & { [P in keyof T['__inputType']]?: T['__inputType'][P] | Expression; })[];
8360
8357
  type UpdateManyByKeys<T extends UpdateManyBySelf> = T['internal']['uniqueColumnNames'] | T['internal']['uniqueColumnTuples'];
8361
8358
  type UpdateManyByKeyColumns<K> = K extends string[] ? K[number] : K;
8362
- type UpdateManyByData<T extends UpdateSelf, K> = ({ [P in K & keyof T['__inputType']]: T['__inputType'][P] } & { [P in keyof T['__inputType']]?: P extends K ? T['__inputType'][P] : T['__inputType'][P] | Expression })[];
8359
+ type UpdateManyByData<T extends UpdateSelf, K> = ({ [P in K & keyof T['__inputType']]: T['__inputType'][P]; } & { [P in keyof T['__inputType']]?: P extends K ? T['__inputType'][P] : T['__inputType'][P] | Expression; })[];
8363
8360
  type UpdateManyResult<T extends UpdateSelf> = T['__hasSelect'] extends true ? T['returnType'] extends 'one' | 'oneOrThrow' ? SetQueryReturnsAllResult<T, T['result']> : T['returnType'] extends 'value' | 'valueOrThrow' ? SetQueryReturnsPluckColumnResult<T, T['result']> : SetQueryResult<T, T['result']> : SetQueryReturnsRowCountMany<T>;
8364
8361
  declare const _queryUpdate: <T extends UpdateSelf>(updateSelf: T, arg: UpdateArg<T>) => UpdateResult<T>;
8365
8362
  declare const _queryUpdateOrThrow: <T extends UpdateSelf>(q: T, arg: UpdateArg<T>) => UpdateResult<T>;
@@ -8841,13 +8838,18 @@ declare const getColumnBaseType: (column: Column.Pick.Data, domainsMap: DbStruct
8841
8838
  interface ColumnDataComputedProp extends ColumnDataSelectSqlProp {
8842
8839
  computed?: Expression;
8843
8840
  }
8844
- type ComputedColumnsFromOptions<Shape, Options> = Options extends {
8841
+ type ComputedColumnsFromOptions<Table extends string | undefined, Shape, Options> = Options extends {
8845
8842
  computed: (...args: any) => infer R;
8846
- } ? { [K in (keyof Shape | keyof R) & string]: K extends keyof Shape ? Shape[K] : K extends keyof R ? R[K] extends QueryOrExpression<unknown> ? R[K]['result']['value'] : R[K] extends (() => {
8843
+ } ? { [K in (keyof Shape | keyof R) & string]: K extends keyof Shape ? Shape[K] : K extends keyof R ? BrandColumn<ComputedColumnValue<R[K]>, `${Table}.${K & string}`> : never; } : Shape;
8844
+ type ComputedColumnValue<T> = T extends {
8845
+ result: {
8846
+ value: infer Value extends Column.Pick.QueryColumn;
8847
+ };
8848
+ } | (() => {
8847
8849
  result: {
8848
8850
  value: infer Value extends Column.Pick.QueryColumn;
8849
8851
  };
8850
- }) ? Value : never : never } : Shape;
8852
+ }) ? Value : never;
8851
8853
  interface ComputedOptionsConfig {
8852
8854
  [K: string]: QueryOrExpression<unknown> | ReturnsQueryOrExpression<unknown>;
8853
8855
  }
@@ -8862,12 +8864,12 @@ interface RuntimeComputedQueryColumn<OutputType> extends Column.Pick.QueryColumn
8862
8864
  };
8863
8865
  }
8864
8866
  interface ComputedMethods<ColumnTypes, Shape extends Column.QueryColumns> extends QueryComputedArg<ColumnTypes, Shape> {
8865
- computeAtRuntime<Deps extends keyof Shape, OutputType>(dependsOn: Deps[], fn: (record: { [K in keyof Shape & Deps]: Shape[K]['__outputType'] }) => OutputType): {
8867
+ computeAtRuntime<Deps extends keyof Shape, OutputType>(dependsOn: Deps[], fn: (record: { [K in keyof Shape & Deps]: Shape[K]['__outputType']; }) => OutputType): {
8866
8868
  result: {
8867
8869
  value: RuntimeComputedQueryColumn<OutputType>;
8868
8870
  };
8869
8871
  };
8870
- computeBatchAtRuntime<Deps extends keyof Shape, OutputType>(dependsOn: Deps[], fn: (record: { [K in keyof Shape & Deps]: Shape[K]['__outputType'] }[]) => MaybePromise<OutputType[]>): {
8872
+ computeBatchAtRuntime<Deps extends keyof Shape, OutputType>(dependsOn: Deps[], fn: (record: { [K in keyof Shape & Deps]: Shape[K]['__outputType']; }[]) => MaybePromise<OutputType[]>): {
8871
8873
  result: {
8872
8874
  value: RuntimeComputedQueryColumn<OutputType>;
8873
8875
  };
@@ -8891,7 +8893,7 @@ interface QueryComputedArg<ColumnTypes, Shape extends Column.QueryColumns> exten
8891
8893
  __selectable: { [K in keyof Shape]: {
8892
8894
  as: string;
8893
8895
  column: Column.Pick.QueryColumn;
8894
- } };
8896
+ }; };
8895
8897
  }
8896
8898
  type WhereItem = {
8897
8899
  [K: string]: unknown | {
@@ -9001,6 +9003,7 @@ interface QueryData extends QueryDataAliases, PickQueryDataParsers, HasHookSelec
9001
9003
  returningMany?: boolean;
9002
9004
  wrapInTransaction?: boolean;
9003
9005
  throwOnNotFound?: boolean;
9006
+ cteThrowOnNotFound?: boolean;
9004
9007
  ensureCount?: number;
9005
9008
  with?: WithItems;
9006
9009
  withShapes?: WithConfigs;
@@ -9200,13 +9203,13 @@ interface ToSQLQuery extends IsQuery {
9200
9203
  }
9201
9204
  interface FromQuerySelf extends PickQuerySelectable, PickQueryShape, PickQueryReturnType, PickQueryWithData, PickQueryAs, PickQueryHasSelect {}
9202
9205
  type FromArg<T extends FromQuerySelf> = IsQuery | Exclude<keyof T['withData'], symbol | number>;
9203
- type FromResult<T extends FromQuerySelf, Arg extends MaybeArray<FromArg<T>>> = Arg extends string ? T['withData'] extends WithDataItems ? { [K in keyof T]: K extends '__selectable' ? SelectableFromShape<T['withData'][Arg]['shape'], Arg> : K extends 'result' ? T['withData'][Arg]['shape'] : K extends 'then' ? QueryThenByQuery<T, T['withData'][Arg]['shape']> : T[K] } : SetQueryTableAlias<T, Arg> : Arg extends PickQuerySelectableResultInputTypeAs ? { [K in keyof T]: K extends '__defaultSelect' ? keyof Arg['result'] : K extends '__selectable' ? SelectableFromShape<Arg['result'], Arg['__as']> : K extends '__as' ? Arg['__as'] : K extends 'result' ? Arg['result'] : K extends 'shape' ? Arg['result'] : K extends '__inputType' ? Arg['__inputType'] : K extends 'then' ? QueryThenByQuery<T, Arg['result']> : T[K] } : Arg extends (infer A)[] ? { [K in keyof T]: K extends '__selectable' ? UnionToIntersection<A extends string ? T['withData'] extends WithDataItems ? { [K in keyof T['withData'][A]['shape'] & string as `${A}.${K}`]: {
9206
+ type FromResult<T extends FromQuerySelf, Arg extends MaybeArray<FromArg<T>>> = Arg extends string ? T['withData'] extends WithDataItems ? { [K in keyof T]: K extends '__selectable' ? SelectableFromShape<T['withData'][Arg]['shape'], Arg> : K extends 'result' ? T['withData'][Arg]['shape'] : K extends 'then' ? QueryThenByQuery<T, T['withData'][Arg]['shape']> : T[K]; } : SetQueryTableAlias<T, Arg> : Arg extends PickQuerySelectableResultInputTypeAs ? { [K in keyof T]: K extends '__defaultSelect' ? keyof Arg['result'] : K extends '__selectable' ? SelectableFromShape<Arg['result'], Arg['__as']> : K extends '__as' ? Arg['__as'] : K extends 'result' ? Arg['result'] : K extends 'shape' ? Arg['result'] : K extends '__inputType' ? Arg['__inputType'] : K extends 'then' ? QueryThenByQuery<T, Arg['result']> : T[K]; } : Arg extends (infer A)[] ? { [K in keyof T]: K extends '__selectable' ? UnionToIntersection<A extends string ? T['withData'] extends WithDataItems ? { [K in keyof T['withData'][A]['shape'] & string as `${A}.${K}`]: {
9204
9207
  as: K;
9205
9208
  column: T['withData'][A]['shape'][K];
9206
- } } : never : A extends PickQueryResultAs ? { [K in keyof A['result'] & string as `${A['__as']}.${K}`]: K extends string ? {
9209
+ }; } : never : A extends PickQueryResultAs ? { [K in keyof A['result'] & string as `${A['__as']}.${K}`]: K extends string ? {
9207
9210
  as: K;
9208
9211
  column: A['result'][K];
9209
- } : never } : never> : T[K] } : T;
9212
+ } : never; } : never> : T[K]; } : T;
9210
9213
  declare class FromMethods {
9211
9214
  /**
9212
9215
  * Set the `FROM` value, by default the table name is used.
@@ -9283,11 +9286,11 @@ interface CteQueryBuilder<T extends PickQueryWithDataColumnTypes> extends Query
9283
9286
  type CteResult<T extends PickQueryWithDataColumnTypes, Name extends string, Q extends PickQueryResult> = { [K in keyof T]: K extends 'withData' ? { [K in keyof T['withData'] | Name]: K extends Name ? {
9284
9287
  table: Name;
9285
9288
  shape: Q['result'];
9286
- } : K extends keyof T['withData'] ? T['withData'][K] : never } : T[K] };
9289
+ } : K extends keyof T['withData'] ? T['withData'][K] : never; } : T[K]; };
9287
9290
  type CteSqlResult<T extends PickQueryWithDataColumnTypes, Name extends string, Shape extends Column.QueryColumns> = { [K in keyof T]: K extends 'withData' ? { [K in Name | keyof T['withData']]: K extends Name ? {
9288
9291
  table: Name;
9289
9292
  shape: Shape;
9290
- } : K extends keyof T['withData'] ? T['withData'][K] : never } : T[K] };
9293
+ } : K extends keyof T['withData'] ? T['withData'][K] : never; } : T[K]; };
9291
9294
  declare const _prependWith: (q: Query, name: string | ((as: string) => void), queryArg: PickQueryResult | ((q: CteQueryBuilder<PickQueryWithDataColumnTypes>) => PickQueryResult)) => Query;
9292
9295
  declare class CteQuery {
9293
9296
  /**
@@ -9478,8 +9481,8 @@ declare class CteQuery {
9478
9481
  * .where({ n: { gt: 10 } });
9479
9482
  * ```
9480
9483
  */
9481
- withRecursive<T extends PickQueryWithDataColumnTypes, Name extends string, Q extends PickQueryResult, Result = CteResult<T, Name, Q>>(this: T, name: Name, base: Q | ((qb: CteQueryBuilder<T>) => Q), recursive: (qb: { [K in keyof Result]: K extends 'result' ? Q['result'] : Result[K] }) => PickQueryResult): Result;
9482
- withRecursive<T extends PickQueryWithDataColumnTypes, Name extends string, Q extends PickQueryResult, Result = CteResult<T, Name, Q>>(this: T, name: Name, options: CteRecursiveOptions, base: Q | ((qb: CteQueryBuilder<T>) => Q), recursive: (qb: { [K in keyof Result]: K extends 'result' ? Q['result'] : Result[K] }) => PickQueryResult): Result;
9484
+ withRecursive<T extends PickQueryWithDataColumnTypes, Name extends string, Q extends PickQueryResult, Result = CteResult<T, Name, Q>>(this: T, name: Name, base: Q | ((qb: CteQueryBuilder<T>) => Q), recursive: (qb: { [K in keyof Result]: K extends 'result' ? Q['result'] : Result[K]; }) => PickQueryResult): Result;
9485
+ withRecursive<T extends PickQueryWithDataColumnTypes, Name extends string, Q extends PickQueryResult, Result = CteResult<T, Name, Q>>(this: T, name: Name, options: CteRecursiveOptions, base: Q | ((qb: CteQueryBuilder<T>) => Q), recursive: (qb: { [K in keyof Result]: K extends 'result' ? Q['result'] : Result[K]; }) => PickQueryResult): Result;
9483
9486
  /**
9484
9487
  * Use `withSql` to add a Common Table Expression (CTE) based on a custom SQL.
9485
9488
  *
@@ -9539,7 +9542,7 @@ declare class CteQuery {
9539
9542
  type UnionArgs<T extends PickQueryResult> = ({
9540
9543
  result: { [K in keyof T['result']]: {
9541
9544
  __queryType: T['result'][K]['__queryType'];
9542
- } };
9545
+ }; };
9543
9546
  } | ((q: T) => Expression))[];
9544
9547
  declare class Union {
9545
9548
  /**
@@ -9731,7 +9734,7 @@ declare class Having {
9731
9734
  */
9732
9735
  havingSql<T>(this: T, ...args: SQLQueryArgs): T;
9733
9736
  }
9734
- type UpsertCreate<DataKey extends PropertyKey, CD> = { [K in keyof CD as K extends DataKey ? never : K]: CD[K] } & { [K in DataKey]?: K extends keyof CD ? CD[K] : never };
9737
+ type UpsertCreate<DataKey extends PropertyKey, CD> = { [K in keyof CD as K extends DataKey ? never : K]: CD[K]; } & { [K in DataKey]?: K extends keyof CD ? CD[K] : never; };
9735
9738
  type UpsertResult<T extends PickQueryHasSelectResultReturnType> = T['__hasSelect'] extends true ? T['returnType'] extends 'value' | 'valueOrThrow' ? SetValueQueryReturnsValueOrThrow<T> : SetQueryReturnsOne<T> : SetQueryReturnsVoid<T>;
9736
9739
  interface UpsertThis extends UpdateSelf, CreateSelf {
9737
9740
  __hasWhere: true;
@@ -9898,7 +9901,7 @@ interface QueryPluckSelf extends PickQuerySelectable, PickQueryRelationsWithData
9898
9901
  type PluckArg<T extends QueryPluckSelf> = SelectableOrExpression<T> | ((q: SelectAsFnArg<T>) => Expression | Query.Pick.SingleValueResult);
9899
9902
  type PluckResult<T extends QueryPluckSelf, S extends PluckArg<T>> = S extends ((q: never) => infer R) ? R extends Expression ? SetQueryReturnsPluck<T, R> : R extends Query.Pick.SingleValueResult ? { [K in keyof T]: K extends '__hasSelect' ? true : K extends 'result' ? {
9900
9903
  pluck: R['result']['value'];
9901
- } : K extends 'returnType' ? 'pluck' : K extends 'then' ? QueryThen<R['result']['value']['__outputType'][]> : T[K] } : never : S extends SelectableOrExpression<T> ? SetQueryReturnsPluck<T, S> : never;
9904
+ } : K extends 'returnType' ? 'pluck' : K extends 'then' ? QueryThen<R['result']['value']['__outputType'][]> : T[K]; } : never : S extends SelectableOrExpression<T> ? SetQueryReturnsPluck<T, S> : never;
9902
9905
  declare class QueryPluck {
9903
9906
  /**
9904
9907
  * `.pluck` returns a single array of a single selected column values:
@@ -9912,7 +9915,7 @@ declare class QueryPluck {
9912
9915
  pluck<T extends QueryPluckSelf, S extends PluckArg<T>>(this: T, select: S): PluckResult<T, S>;
9913
9916
  }
9914
9917
  interface MergeQueryArg extends PickQueryTable, PickQuerySelectable, PickQueryResult, PickQueryReturnType, PickQueryWithData, PickQueryWindows, PickQueryThen, PickQueryHasSelect, PickQueryHasWhere {}
9915
- type MergeQuery<T extends MergeQueryArg, Q extends MergeQueryArg> = { [K in keyof T]: K extends '__hasWhere' | '__hasSelect' ? T[K] & Q[K] : K extends '__selectable' | 'windows' | 'withData' ? Q[K] & Omit<T[K], keyof Q[K]> : K extends 'result' ? MergeQueryResult<T, Q> : K extends 'returnType' ? Q['returnType'] extends undefined ? T['returnType'] : Q['returnType'] : K extends 'then' ? Q['returnType'] extends undefined ? QueryThenByQuery<T, MergeQueryResult<T, Q>> : Q['returnType'] extends 'all' | 'one' | 'oneOrThrow' | 'rows' ? QueryThenByQuery<Q, MergeQueryResult<T, Q>> : Q['__hasSelect'] extends true ? Q['then'] : T['__hasSelect'] extends true ? T['then'] : Q['then'] : T[K] };
9918
+ type MergeQuery<T extends MergeQueryArg, Q extends MergeQueryArg> = { [K in keyof T]: K extends '__hasWhere' | '__hasSelect' ? T[K] & Q[K] : K extends '__selectable' | 'windows' | 'withData' ? Q[K] & Omit<T[K], keyof Q[K]> : K extends 'result' ? MergeQueryResult<T, Q> : K extends 'returnType' ? Q['returnType'] extends undefined ? T['returnType'] : Q['returnType'] : K extends 'then' ? Q['returnType'] extends undefined ? QueryThenByQuery<T, MergeQueryResult<T, Q>> : Q['returnType'] extends 'all' | 'one' | 'oneOrThrow' | 'rows' ? QueryThenByQuery<Q, MergeQueryResult<T, Q>> : Q['__hasSelect'] extends true ? Q['then'] : T['__hasSelect'] extends true ? T['then'] : Q['then'] : T[K]; };
9916
9919
  type MergeQueryResult<T extends PickQueryHasSelectResult, Q extends PickQueryHasSelectResult> = T['__hasSelect'] extends true ? Q['__hasSelect'] extends true ? Omit<T['result'], keyof Q['result']> & Q['result'] : T['result'] : Q['result'];
9917
9920
  declare class MergeQueryMethods {
9918
9921
  merge<T extends MergeQueryArg, Q extends MergeQueryArg>(this: T, q: Q): MergeQuery<T, Q>;
@@ -9966,7 +9969,7 @@ declare class QueryMap {
9966
9969
  then: QueryThen<(infer Data)[]>;
9967
9970
  } ? (input: Data, index: number, arr: Data[]) => Result : never : T extends {
9968
9971
  then: QueryThen<(infer Data) | undefined>;
9969
- } ? (input: Data, index: number, value: Data) => Result : never, thisArg?: unknown): Result extends RecordUnknown ? { [K in keyof T]: K extends 'result' ? { [K in keyof Result]: Column.Pick.QueryColumnOfType<Result[K]> } : K extends 'then' ? QueryThen<T['returnType'] extends QueryReturnTypeAll | 'pluck' ? Result[] : T['returnType'] extends QueryReturnTypeOptional ? Result | undefined : Result> : T[K] } : { [K in keyof T]: K extends 'returnType' ? T['returnType'] extends QueryReturnTypeAll | 'pluck' ? 'pluck' : T['returnType'] extends 'one' ? 'value' : 'valueOrThrow' : K extends 'result' ? T['returnType'] extends QueryReturnTypeAll | 'pluck' ? {
9972
+ } ? (input: Data, index: number, value: Data) => Result : never, thisArg?: unknown): Result extends RecordUnknown ? { [K in keyof T]: K extends 'result' ? { [K in keyof Result]: Column.Pick.QueryColumnOfType<Result[K]>; } : K extends 'then' ? QueryThen<T['returnType'] extends QueryReturnTypeAll | 'pluck' ? Result[] : T['returnType'] extends QueryReturnTypeOptional ? Result | undefined : Result> : T[K]; } : { [K in keyof T]: K extends 'returnType' ? T['returnType'] extends QueryReturnTypeAll | 'pluck' ? 'pluck' : T['returnType'] extends 'one' ? 'value' : 'valueOrThrow' : K extends 'result' ? T['returnType'] extends QueryReturnTypeAll | 'pluck' ? {
9970
9973
  pluck: Column.Pick.QueryColumnOfType<Result>;
9971
9974
  } : T['returnType'] extends QueryReturnTypeOptional ? {
9972
9975
  value: Column.Pick.QueryColumnOfType<Result | undefined>;
@@ -9978,7 +9981,7 @@ declare class QueryMap {
9978
9981
  } : K extends 'then' ? QueryThen<T['returnType'] extends QueryReturnTypeAll | 'pluck' ? Result[] : T['returnType'] extends QueryReturnTypeOptional ? Result | undefined : T extends {
9979
9982
  returnType: 'valueOrThrow';
9980
9983
  then: QueryThen<unknown | null>;
9981
- } ? Result | null : Result> : T[K] };
9984
+ } ? Result | null : Result> : T[K]; };
9982
9985
  }
9983
9986
  type OrCreateArg<Data> = Data | (() => Data);
9984
9987
  declare function _orCreate<T extends PickQueryHasSelectResultReturnType>(query: T, data: unknown | FnUnknownToUnknown, updateData?: unknown, mergeData?: unknown): UpsertResult<T>;
@@ -10164,7 +10167,7 @@ declare class QueryExistsMethods {
10164
10167
  */
10165
10168
  notExists<T extends QueryGetSelf>(this: T): SetQueryReturnsColumnOrThrow<T, BooleanQueryColumn>;
10166
10169
  }
10167
- type GroupArgs<T extends PickQueryResult> = ({ [K in keyof T['result']]: T['result'][K]['dataType'] extends 'array' | 'object' | 'runtimeComputed' ? never : K }[keyof T['result']] | Expression)[];
10170
+ type GroupArgs<T extends PickQueryResult> = ({ [K in keyof T['result']]: T['result'][K]['dataType'] extends 'array' | 'object' | 'runtimeComputed' ? never : K; }[keyof T['result']] | Expression)[];
10168
10171
  interface QueryHelperQuery<T extends PickQuerySelectableShapeAs> extends MergeQueryArg {
10169
10172
  returnType: QueryReturnType;
10170
10173
  __selectable: Omit<T['__selectable'], `${T['__as']}.${Extract<keyof T['shape'], string>}`>;
@@ -10193,15 +10196,15 @@ type QueryHelperResult<T extends IsQueryHelper> = T['__result'];
10193
10196
  interface NarrowTypeSelf extends PickQueryResultReturnType {
10194
10197
  returnType: undefined | 'all' | 'one' | 'oneOrThrow' | 'value' | 'valueOrThrow' | 'pluck';
10195
10198
  }
10196
- type NarrowInvalidKeys<T extends PickQueryResult, Narrow> = { [K in keyof Narrow]: K extends keyof T['result'] ? Narrow[K] extends T['result'][K]['__outputType'] ? never : K : K }[keyof Narrow];
10199
+ type NarrowInvalidKeys<T extends PickQueryResult, Narrow> = { [K in keyof Narrow]: K extends keyof T['result'] ? Narrow[K] extends T['result'][K]['__outputType'] ? never : K : K; }[keyof Narrow];
10197
10200
  interface NarrowValueTypeResult<T extends PickQueryResultReturnType, Narrow> extends Column.QueryColumns {
10198
- value: { [K in keyof T['result']['value']]: K extends '__outputType' ? Narrow : T['result']['value'][K] };
10201
+ value: { [K in keyof T['result']['value']]: K extends '__outputType' ? Narrow : T['result']['value'][K]; };
10199
10202
  }
10200
10203
  interface NarrowPluckTypeResult<T extends PickQueryResultReturnType, Narrow> extends Column.QueryColumns {
10201
- pluck: { [K in keyof T['result']['pluck']]: K extends '__outputType' ? Narrow extends unknown[] ? Narrow[number] : Narrow : T['result']['pluck'][K] };
10204
+ pluck: { [K in keyof T['result']['pluck']]: K extends '__outputType' ? Narrow extends unknown[] ? Narrow[number] : Narrow : T['result']['pluck'][K]; };
10202
10205
  }
10203
- type QueryIfResult<T extends PickQueryResultReturnType, R extends PickQueryResult> = { [K in keyof T]: K extends 'result' ? { [K in keyof T['result'] | keyof R['result']]: K extends keyof T['result'] ? K extends keyof R['result'] ? R['result'][K] | T['result'][K] : T['result'][K] : Column.QueryColumnToOptional<R['result'][K]> } : K extends 'then' ? QueryIfResultThen<T, R> : T[K] };
10204
- type QueryIfResultThen<T extends PickQueryResultReturnType, R extends PickQueryResult> = T['returnType'] extends undefined | 'all' ? QueryThenShallowSimplifyArr<{ [K in keyof T['result']]: K extends keyof R['result'] ? T['result'][K]['__outputType'] | R['result'][K]['__outputType'] : T['result'][K]['__outputType'] } & { [K in keyof R['result'] as K extends keyof T['result'] ? never : K]?: R['result'][K]['__outputType'] }> : T['returnType'] extends 'one' ? QueryThenShallowSimplifyOptional<{ [K in keyof T['result']]: K extends keyof R['result'] ? T['result'][K]['__outputType'] | R['result'][K]['__outputType'] : T['result'][K]['__outputType'] } & { [K in keyof R['result'] as K extends keyof T['result'] ? never : K]?: R['result'][K]['__outputType'] }> : T['returnType'] extends 'oneOrThrow' ? QueryThenShallowSimplify<{ [K in keyof T['result']]: K extends keyof R['result'] ? T['result'][K]['__outputType'] | R['result'][K]['__outputType'] : T['result'][K]['__outputType'] } & { [K in keyof R['result'] as K extends keyof T['result'] ? never : K]?: R['result'][K]['__outputType'] }> : T['returnType'] extends 'value' ? QueryThen<T['result']['value']['__outputType'] | R['result']['value']['__outputType'] | undefined> : T['returnType'] extends 'valueOrThrow' ? QueryThen<T['result']['value']['__outputType'] | R['result']['value']['__outputType']> : T['returnType'] extends 'rows' ? QueryThen<(T['result'][keyof T['result']]['__outputType'] | R['result'][keyof R['result']]['__outputType'])[][]> : T['returnType'] extends 'pluck' ? QueryThen<(T['result']['pluck']['__outputType'] | R['result']['pluck']['__outputType'])[]> : QueryThen<void>;
10206
+ type QueryIfResult<T extends PickQueryResultReturnType, R extends PickQueryResult> = { [K in keyof T]: K extends 'result' ? { [K in keyof T['result'] | keyof R['result']]: K extends keyof T['result'] ? K extends keyof R['result'] ? R['result'][K] | T['result'][K] : T['result'][K] : Column.QueryColumnToOptional<R['result'][K]>; } : K extends 'then' ? QueryIfResultThen<T, R> : T[K]; };
10207
+ type QueryIfResultThen<T extends PickQueryResultReturnType, R extends PickQueryResult> = T['returnType'] extends undefined | 'all' ? QueryThenShallowSimplifyArr<{ [K in keyof T['result']]: K extends keyof R['result'] ? T['result'][K]['__outputType'] | R['result'][K]['__outputType'] : T['result'][K]['__outputType']; } & { [K in keyof R['result'] as K extends keyof T['result'] ? never : K]?: R['result'][K]['__outputType']; }> : T['returnType'] extends 'one' ? QueryThenShallowSimplifyOptional<{ [K in keyof T['result']]: K extends keyof R['result'] ? T['result'][K]['__outputType'] | R['result'][K]['__outputType'] : T['result'][K]['__outputType']; } & { [K in keyof R['result'] as K extends keyof T['result'] ? never : K]?: R['result'][K]['__outputType']; }> : T['returnType'] extends 'oneOrThrow' ? QueryThenShallowSimplify<{ [K in keyof T['result']]: K extends keyof R['result'] ? T['result'][K]['__outputType'] | R['result'][K]['__outputType'] : T['result'][K]['__outputType']; } & { [K in keyof R['result'] as K extends keyof T['result'] ? never : K]?: R['result'][K]['__outputType']; }> : T['returnType'] extends 'value' ? QueryThen<T['result']['value']['__outputType'] | R['result']['value']['__outputType'] | undefined> : T['returnType'] extends 'valueOrThrow' ? QueryThen<T['result']['value']['__outputType'] | R['result']['value']['__outputType']> : T['returnType'] extends 'rows' ? QueryThen<(T['result'][keyof T['result']]['__outputType'] | R['result'][keyof R['result']]['__outputType'])[][]> : T['returnType'] extends 'pluck' ? QueryThen<(T['result']['pluck']['__outputType'] | R['result']['pluck']['__outputType'])[]> : QueryThen<void>;
10205
10208
  interface QueryMethods<ColumnTypes> extends QueryClone, QueryAsMethods, AggregateMethods, QueryDistinct, Select, FromMethods, QueryJoin, QueryLimitOffset, CteQuery, Union, QueryJsonMethods, QueryCreate, QueryCreateFrom, QueryUpdate, QueryDelete, QueryStorage, QueryTransaction, QueryTruncate, For, Where, SearchMethods, Clear, Having, QueryCatchers, QueryLog, QueryOrder, QueryWithSchema, QueryHooks, QueryUpsert, QueryOrCreate, QueryGet, QueryPluck, MergeQueryMethods, QuerySql<ColumnTypes>, QueryTransform, QueryMap, QueryScope, SoftDeleteMethods, QueryExpressions, QueryWrap, QueryWindow, QueryExistsMethods {}
10206
10209
  declare class QueryMethods<ColumnTypes> {
10207
10210
  /**
@@ -10642,14 +10645,14 @@ declare class QueryMethods<ColumnTypes> {
10642
10645
  */
10643
10646
  narrowType<T extends NarrowTypeSelf>(this: T): <Narrow>() => T['returnType'] extends undefined | 'all' | 'one' | 'oneOrThrow' ? [NarrowInvalidKeys<T, Narrow>] extends [never] ? { [K in keyof T]: K extends 'result' ? T['result'] & { [K in keyof Narrow]: {
10644
10647
  __outputType: Narrow[K];
10645
- } } : K extends 'then' ? QueryThenByQuery<T, T['result'] & { [K in keyof Narrow]: {
10648
+ }; } : K extends 'then' ? QueryThenByQuery<T, T['result'] & { [K in keyof Narrow]: {
10646
10649
  __outputType: Narrow[K];
10647
- } }> : T[K] } : `narrowType() error: provided type does not extend the '${NarrowInvalidKeys<T, Narrow> & string}' column type` : (T['returnType'] extends 'pluck' ? Narrow extends unknown[] ? Narrow[number] : Narrow : Narrow) extends (T['returnType'] extends 'pluck' ? T['result']['pluck']['__outputType'] : T['result']['value']['__outputType']) ? { [K in keyof T]: K extends 'result' ? T['returnType'] extends 'value' | 'valueOrThrow' ? NarrowValueTypeResult<T, Narrow> : NarrowPluckTypeResult<T, Narrow> : K extends 'then' ? QueryThenByQuery<T, T['returnType'] extends 'value' | 'valueOrThrow' ? NarrowValueTypeResult<T, Narrow> : NarrowPluckTypeResult<T, Narrow>> : T[K] } : 'narrowType() error: provided type does not extend the returning column column type';
10650
+ }; }> : T[K]; } : `narrowType() error: provided type does not extend the '${NarrowInvalidKeys<T, Narrow> & string}' column type` : (T['returnType'] extends 'pluck' ? Narrow extends unknown[] ? Narrow[number] : Narrow : Narrow) extends (T['returnType'] extends 'pluck' ? T['result']['pluck']['__outputType'] : T['result']['value']['__outputType']) ? { [K in keyof T]: K extends 'result' ? T['returnType'] extends 'value' | 'valueOrThrow' ? NarrowValueTypeResult<T, Narrow> : NarrowPluckTypeResult<T, Narrow> : K extends 'then' ? QueryThenByQuery<T, T['returnType'] extends 'value' | 'valueOrThrow' ? NarrowValueTypeResult<T, Narrow> : NarrowPluckTypeResult<T, Narrow>> : T[K]; } : 'narrowType() error: provided type does not extend the returning column column type';
10648
10651
  if<T extends PickQueryResultReturnType, R extends PickQueryResult>(this: T, condition: boolean | null | undefined, fn: (q: T) => R & {
10649
10652
  returnType: T['returnType'];
10650
10653
  }): QueryIfResult<T, R>;
10651
10654
  queryRelated<T extends PickQueryRelations, RelName extends keyof T['relations']>(this: T, relName: RelName, params: T['relations'][RelName]['params']): RelationQueryMaybeSingle<T['relations'][RelName]>;
10652
- chain<T extends PickQuerySelectableShapeRelationsReturnTypeIsSubQuery, RelName extends keyof T['relations']>(this: T, relName: RelName): T['__subQuery'] extends true | undefined ? [T['returnType'], T['relations'][RelName]['returnsOne']] extends ['one' | 'oneOrThrow', true] ? { [K in keyof RelationQueryMaybeSingle<T['relations'][RelName]>]: K extends '__selectable' ? RelationQueryMaybeSingle<T['relations'][RelName]>['__selectable'] & Omit<T['__selectable'], keyof T['shape']> : RelationQueryMaybeSingle<T['relations'][RelName]>[K] } & IsSubQuery : JoinResultRequireMain<T['relations'][RelName]['query'], Omit<T['__selectable'], keyof T['shape']>> : T['relations'][RelName]['query'];
10655
+ chain<T extends PickQuerySelectableShapeRelationsReturnTypeIsSubQuery, RelName extends keyof T['relations']>(this: T, relName: RelName): T['__subQuery'] extends true | undefined ? [T['returnType'], T['relations'][RelName]['returnsOne']] extends ['one' | 'oneOrThrow', true] ? { [K in keyof RelationQueryMaybeSingle<T['relations'][RelName]>]: K extends '__selectable' ? RelationQueryMaybeSingle<T['relations'][RelName]>['__selectable'] & Omit<T['__selectable'], keyof T['shape']> : RelationQueryMaybeSingle<T['relations'][RelName]>[K]; } & IsSubQuery : JoinResultRequireMain<T['relations'][RelName]['query'], Omit<T['__selectable'], keyof T['shape']>> : T['relations'][RelName]['query'];
10653
10656
  }
10654
10657
  interface DbExtension {
10655
10658
  name: string;
@@ -10674,10 +10677,10 @@ interface DbDomainArgRecord {
10674
10677
  type SelectableFromShape<Shape extends Column.QueryColumns, Table extends string | undefined> = { [K in keyof Shape]: {
10675
10678
  as: K;
10676
10679
  column: Shape[K];
10677
- } } & { [K in keyof Shape & string as `${Table}.${K}`]: {
10680
+ }; } & { [K in keyof Shape & string as `${Table}.${K}`]: {
10678
10681
  as: K;
10679
10682
  column: Shape[K];
10680
- } };
10683
+ }; };
10681
10684
  type QueryReturnType = QueryReturnTypeAll | 'one' | 'oneOrThrow' | 'rows' | 'pluck' | 'value' | 'valueOrThrow' | 'void';
10682
10685
  type QueryReturnTypeAll = undefined | 'all';
10683
10686
  type QueryReturnTypeOptional = 'one' | 'value';
@@ -10760,52 +10763,52 @@ declare namespace Query {
10760
10763
  }
10761
10764
  }
10762
10765
  }
10763
- type SelectableOfType<T extends PickQuerySelectable, Type> = { [K in keyof T['__selectable']]: T['__selectable'][K]['column']['__type'] extends Type | null ? K : never }[keyof T['__selectable']];
10766
+ type SelectableOfType<T extends PickQuerySelectable, Type> = { [K in keyof T['__selectable']]: T['__selectable'][K]['column']['__type'] extends Type | null ? K : never; }[keyof T['__selectable']];
10764
10767
  type SelectableOrExpressionOfType<T extends PickQuerySelectable, C extends Column.Pick.Type> = SelectableOfType<T, C['__type']> | Expression<Column.Pick.QueryColumnOfType<C['__type'] | null>>;
10765
- type SetQueryReturnsAll<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'all' : K extends 'then' ? QueryThenShallowSimplifyArr<ColumnsShape.Output<T['result']>> : T[K] } & QueryHasWhere;
10766
- type SetQueryReturnsAllResult<T extends PickQueryResult, Result extends Column.QueryColumns> = { [K in keyof T]: K extends 'returnType' ? 'all' : K extends 'result' ? Result : K extends 'then' ? QueryThenShallowSimplifyArr<T['result']> : T[K] } & QueryHasWhere;
10767
- type QueryTakeOptional<T extends PickQueryResultReturnType> = T['returnType'] extends 'value' | 'pluck' | 'void' ? T : T['returnType'] extends 'valueOrThrow' ? { [K in keyof T]: K extends 'returnType' ? 'value' : K extends 'then' ? QueryThen<T['result']['value']['__outputType'] | undefined> : T[K] } : { [K in keyof T]: K extends 'returnType' ? 'one' : K extends 'then' ? QueryThenShallowSimplifyOptional<ColumnsShape.Output<T['result']>> : T[K] };
10768
- type QueryManyTakeOptional<T extends PickQueryResultReturnType> = { [K in keyof T]: K extends 'returnType' ? 'one' : K extends 'then' ? QueryThenShallowSimplifyOptional<ColumnsShape.Output<T['result']>> : T[K] };
10769
- type QueryRequire<T extends PickQueryResultReturnType> = T['returnType'] extends QueryReturnTypeAll | 'valueOrThrow' | 'pluck' | 'void' ? T : T['returnType'] extends 'value' ? { [K in keyof T]: K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<Exclude<T['result']['value']['__outputType'], undefined>> : T[K] } : { [K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'then' ? QueryThenShallowSimplify<ColumnsShape.Output<T['result']>> : T[K] };
10770
- type QueryTake<T extends PickQueryResultReturnType> = T['returnType'] extends 'valueOrThrow' | 'pluck' | 'void' ? T : T['returnType'] extends 'value' ? { [K in keyof T]: K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<Exclude<T['result']['value']['__outputType'], undefined>> : T[K] } : { [K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'then' ? QueryThenShallowSimplify<ColumnsShape.Output<T['result']>> : T[K] };
10771
- type QueryManyTake<T extends PickQueryResultReturnType> = { [K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'then' ? QueryThenShallowSimplify<ColumnsShape.Output<T['result']>> : T[K] };
10772
- type SetQueryReturnsOne<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'then' ? QueryThenShallowSimplify<ColumnsShape.Output<T['result']>> : T[K] };
10773
- type SetQueryReturnsOneResult<T extends PickQueryResult, Result extends Column.QueryColumns> = { [K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'result' ? Result : K extends 'then' ? QueryThenShallowSimplify<ColumnsShape.Output<Result>> : T[K] };
10774
- type SetQueryReturnsRows<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'rows' : K extends 'then' ? QueryThen<ColumnsShape.Output<T['result']>[keyof T['result']][][]> : T[K] };
10768
+ type SetQueryReturnsAll<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'all' : K extends 'then' ? QueryThenShallowSimplifyArr<ColumnsShape.Output<T['result']>> : T[K]; } & QueryHasWhere;
10769
+ type SetQueryReturnsAllResult<T extends PickQueryResult, Result extends Column.QueryColumns> = { [K in keyof T]: K extends 'returnType' ? 'all' : K extends 'result' ? Result : K extends 'then' ? QueryThenShallowSimplifyArr<T['result']> : T[K]; } & QueryHasWhere;
10770
+ type QueryTakeOptional<T extends PickQueryResultReturnType> = T['returnType'] extends 'value' | 'pluck' | 'void' ? T : T['returnType'] extends 'valueOrThrow' ? { [K in keyof T]: K extends 'returnType' ? 'value' : K extends 'then' ? QueryThen<T['result']['value']['__outputType'] | undefined> : T[K]; } : { [K in keyof T]: K extends 'returnType' ? 'one' : K extends 'then' ? QueryThenShallowSimplifyOptional<ColumnsShape.Output<T['result']>> : T[K]; };
10771
+ type QueryManyTakeOptional<T extends PickQueryResultReturnType> = { [K in keyof T]: K extends 'returnType' ? 'one' : K extends 'then' ? QueryThenShallowSimplifyOptional<ColumnsShape.Output<T['result']>> : T[K]; };
10772
+ type QueryRequire<T extends PickQueryResultReturnType> = T['returnType'] extends QueryReturnTypeAll | 'valueOrThrow' | 'pluck' | 'void' ? T : T['returnType'] extends 'value' ? { [K in keyof T]: K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<Exclude<T['result']['value']['__outputType'], undefined>> : T[K]; } : { [K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'then' ? QueryThenShallowSimplify<ColumnsShape.Output<T['result']>> : T[K]; };
10773
+ type QueryTake<T extends PickQueryResultReturnType> = T['returnType'] extends 'valueOrThrow' | 'pluck' | 'void' ? T : T['returnType'] extends 'value' ? { [K in keyof T]: K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<Exclude<T['result']['value']['__outputType'], undefined>> : T[K]; } : { [K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'then' ? QueryThenShallowSimplify<ColumnsShape.Output<T['result']>> : T[K]; };
10774
+ type QueryManyTake<T extends PickQueryResultReturnType> = { [K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'then' ? QueryThenShallowSimplify<ColumnsShape.Output<T['result']>> : T[K]; };
10775
+ type SetQueryReturnsOne<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'then' ? QueryThenShallowSimplify<ColumnsShape.Output<T['result']>> : T[K]; };
10776
+ type SetQueryReturnsOneResult<T extends PickQueryResult, Result extends Column.QueryColumns> = { [K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'result' ? Result : K extends 'then' ? QueryThenShallowSimplify<ColumnsShape.Output<Result>> : T[K]; };
10777
+ type SetQueryReturnsRows<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'rows' : K extends 'then' ? QueryThen<ColumnsShape.Output<T['result']>[keyof T['result']][][]> : T[K]; };
10775
10778
  type SetQueryReturnsPluck<T extends PickQuerySelectable, S extends keyof T['__selectable'] | Expression> = S extends keyof T['__selectable'] ? { [K in keyof T]: K extends '__hasSelect' ? true : K extends 'result' ? {
10776
10779
  pluck: T['__selectable'][S]['column'];
10777
- } : K extends 'returnType' ? 'pluck' : K extends 'then' ? QueryThen<T['__selectable'][S]['column']['__outputType'][]> : T[K] } : { [K in keyof T]: K extends '__hasSelect' ? true : K extends 'result' ? {
10780
+ } : K extends 'returnType' ? 'pluck' : K extends 'then' ? QueryThen<T['__selectable'][S]['column']['__outputType'][]> : T[K]; } : { [K in keyof T]: K extends '__hasSelect' ? true : K extends 'result' ? {
10778
10781
  pluck: S extends Expression ? S['result']['value'] : never;
10779
- } : K extends 'returnType' ? 'pluck' : K extends 'then' ? QueryThen<(S extends Expression ? S['result']['value']['__outputType'] : never)[]> : T[K] };
10782
+ } : K extends 'returnType' ? 'pluck' : K extends 'then' ? QueryThen<(S extends Expression ? S['result']['value']['__outputType'] : never)[]> : T[K]; };
10780
10783
  type SetValueQueryReturnsPluckColumn<T extends PickQueryResult> = { [K in keyof T]: K extends 'result' ? {
10781
10784
  pluck: T['result']['value'];
10782
- } : K extends 'returnType' ? 'pluck' : K extends 'then' ? QueryThen<T['result']['value']['__outputType'][]> : T[K] } & QueryHasSelect;
10785
+ } : K extends 'returnType' ? 'pluck' : K extends 'then' ? QueryThen<T['result']['value']['__outputType'][]> : T[K]; } & QueryHasSelect;
10783
10786
  type SetQueryReturnsPluckColumnResult<T extends PickQueryResult, Result extends Column.QueryColumns> = { [K in keyof T]: K extends 'result' ? {
10784
10787
  pluck: T['result']['value'];
10785
- } : K extends 'returnType' ? 'pluck' : K extends 'result' ? Result : K extends 'then' ? QueryThen<T['result']['value']['__outputType'][]> : T[K] } & QueryHasSelect;
10788
+ } : K extends 'returnType' ? 'pluck' : K extends 'result' ? Result : K extends 'then' ? QueryThen<T['result']['value']['__outputType'][]> : T[K]; } & QueryHasSelect;
10786
10789
  type SetQueryReturnsValueOrThrow<T extends PickQuerySelectable, Arg extends keyof T['__selectable']> = SetQueryReturnsColumnOrThrow<T, T['__selectable'][Arg]['column']> & T['__selectable'][Arg]['column']['operators'];
10787
- type SetValueQueryReturnsValueOrThrow<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<T['result']['value']['__outputType']> : T[K] };
10788
- type SetQueryReturnsValueOptional<T extends PickQuerySelectable, Arg extends GetStringArg<T>> = SetQueryReturnsColumnOptional<T, { [K in keyof T['__selectable'][Arg]['column']]: K extends '__outputType' ? T['__selectable'][Arg]['column'][K] | undefined : T['__selectable'][Arg]['column'][K] }> & Omit<T['__selectable'][Arg]['column']['operators'], 'equals' | 'not'> & Column.OperatorsNullable<T['__selectable'][Arg]['column']>;
10790
+ type SetValueQueryReturnsValueOrThrow<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<T['result']['value']['__outputType']> : T[K]; };
10791
+ type SetQueryReturnsValueOptional<T extends PickQuerySelectable, Arg extends GetStringArg<T>> = SetQueryReturnsColumnOptional<T, { [K in keyof T['__selectable'][Arg]['column']]: K extends '__outputType' ? T['__selectable'][Arg]['column'][K] | undefined : T['__selectable'][Arg]['column'][K]; }> & Omit<T['__selectable'][Arg]['column']['operators'], 'equals' | 'not'> & Column.OperatorsNullable<T['__selectable'][Arg]['column']>;
10789
10792
  type SetQueryReturnsColumnOrThrow<T, Column extends Column.Pick.OutputType> = { [K in keyof T]: K extends 'result' ? {
10790
10793
  value: Column;
10791
- } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<Column['__outputType']> : T[K] } & QueryHasSelect;
10794
+ } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<Column['__outputType']> : T[K]; } & QueryHasSelect;
10792
10795
  type SetQueryReturnsColumnOptional<T, Column extends Column.Pick.OutputType> = { [K in keyof T]: K extends 'result' ? {
10793
10796
  value: Column;
10794
- } : K extends 'returnType' ? 'value' : K extends 'then' ? QueryThen<Column['__outputType'] | undefined> : T[K] } & QueryHasSelect;
10797
+ } : K extends 'returnType' ? 'value' : K extends 'then' ? QueryThen<Column['__outputType'] | undefined> : T[K]; } & QueryHasSelect;
10795
10798
  type SetQueryReturnsColumn<T extends PickQueryResult> = { [K in keyof T]: K extends 'result' ? {
10796
10799
  value: T['result']['pluck'];
10797
- } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<T['result']['pluck']['__outputType']> : T[K] } & QueryHasSelect;
10800
+ } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<T['result']['pluck']['__outputType']> : T[K]; } & QueryHasSelect;
10798
10801
  type SetQueryReturnsColumnResult<T extends PickQueryResult, Result extends Column.QueryColumns> = { [K in keyof T]: K extends 'result' ? {
10799
10802
  value: T['result']['pluck'];
10800
- } : K extends 'returnType' ? 'valueOrThrow' : K extends 'result' ? Result : K extends 'then' ? QueryThen<Result['pluck']['__outputType']> : T[K] } & QueryHasSelect;
10803
+ } : K extends 'returnType' ? 'valueOrThrow' : K extends 'result' ? Result : K extends 'then' ? QueryThen<Result['pluck']['__outputType']> : T[K]; } & QueryHasSelect;
10801
10804
  type SetQueryReturnsRowCount<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'valueOrThrow' : K extends 'result' ? {
10802
10805
  value: Column.Pick.QueryColumnOfType<number>;
10803
- } : K extends 'then' ? QueryThen<number> : T[K] };
10806
+ } : K extends 'then' ? QueryThen<number> : T[K]; };
10804
10807
  type SetQueryReturnsRowCountMany<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'pluck' : K extends 'result' ? {
10805
10808
  pluck: Column.Pick.QueryColumnOfType<number>;
10806
- } : K extends 'then' ? QueryThen<number> : T[K] };
10807
- type SetQueryReturnsVoid<T> = { [K in keyof T]: K extends 'returnType' ? 'void' : K extends 'then' ? QueryThen<void> : T[K] };
10808
- type SetQueryResult<T extends PickQueryReturnType, Result extends Column.QueryColumns> = { [K in keyof T]: K extends 'result' ? Result : K extends 'then' ? QueryThenByQuery<T, Result> : T[K] };
10809
+ } : K extends 'then' ? QueryThen<number> : T[K]; };
10810
+ type SetQueryReturnsVoid<T> = { [K in keyof T]: K extends 'returnType' ? 'void' : K extends 'then' ? QueryThen<void> : T[K]; };
10811
+ type SetQueryResult<T extends PickQueryReturnType, Result extends Column.QueryColumns> = { [K in keyof T]: K extends 'result' ? Result : K extends 'then' ? QueryThenByQuery<T, Result> : T[K]; };
10809
10812
  interface ReturnsQueryOrExpression<T> {
10810
10813
  (): QueryOrExpression<T>;
10811
10814
  }
@@ -10977,7 +10980,7 @@ interface QueryDataAliases extends PickQueryDataAliases {
10977
10980
  type SetQueryTableAlias<T extends PickQuerySelectableShapeAs, As extends string> = { [K in keyof T]: K extends '__selectable' ? Omit<T['__selectable'], `${T['__as']}.${keyof T['shape'] & string}`> & { [K in keyof T['shape'] & string as `${As}.${K}`]: {
10978
10981
  as: K;
10979
10982
  column: T['shape'][K];
10980
- } } : K extends '__as' ? As : T[K] };
10983
+ }; } : K extends '__as' ? As : T[K]; };
10981
10984
  type AsQueryArg = PickQuerySelectableShapeAs;
10982
10985
  /** getters **/
10983
10986
  declare const getQueryAs: (q: {
@@ -11041,7 +11044,7 @@ declare const escapeString: (value: string) => string;
11041
11044
  * Sets query kind to 'columnInfo', returns a single value (may return undefined),
11042
11045
  * the value is a {@link GetColumnInfo} object or a Record with keys for column names and ColumnInfo objects as values.
11043
11046
  **/
11044
- type SetQueryReturnsColumnInfo<T extends PickQueryShape, Column extends keyof T['shape'] | undefined, Result = (Column extends keyof T['shape'] ? GetColumnInfo : { [K in keyof T['shape']]: GetColumnInfo })> = Omit<T, 'result' | 'returnType' | 'then'> & {
11047
+ type SetQueryReturnsColumnInfo<T extends PickQueryShape, Column extends keyof T['shape'] | undefined, Result = Column extends keyof T['shape'] ? GetColumnInfo : { [K in keyof T['shape']]: GetColumnInfo; }> = Omit<T, 'result' | 'returnType' | 'then'> & {
11045
11048
  result: {
11046
11049
  value: Column.Pick.QueryColumnOfType<Result>;
11047
11050
  };
@@ -11174,4 +11177,4 @@ declare const testTransaction: {
11174
11177
  */
11175
11178
  close(arg: Arg$1): Promise<void>;
11176
11179
  };
11177
- export { type Adapter, AdapterClass, type AdapterConfigBase, type AdapterParams, type AdapterSchemaConfigOptions, type AfterCommitStandaloneHook, type AfterHook, ArrayColumn, type ArrayColumnValue, type ArrayData, type AsyncState, type BaseNumberData, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BoxColumn, ByteaColumn, CidrColumn, CircleColumn, CitextColumn, type Code, type Codes, Column, type ColumnFromDbParams, type ColumnSchemaConfig, type ColumnSchemaGetterColumns, type ColumnSchemaGetterTableClass, type ColumnToCodeCtx, type ColumnTypeSchemaArg, type ColumnsByType, type ColumnsShape, type ComputedColumnsFromOptions, type ComputedOptionsConfig, type ComputedOptionsFactory, type CreateCtx, type CreateData, type CreateManyMethodsNames, type CreateMethodsNames, type CreateSelf, CustomTypeColumn, DateBaseColumn, DateColumn, type DateColumnData, DateTimeBaseClass, DateTimeTzBaseClass, Db, type DbDomainArg, type DbExtension, type DbOptions, type DbResult, type DbSharedOptions, type DbSqlMethod, type DbStructureDomainsMap, type DbTableOptionScopes, type DbTableOptions, DecimalColumn, type DecimalColumnData, type DefaultColumnTypes, type DefaultPrivileges, type DefaultSchemaConfig, type DeleteMethodsNames, DomainColumn, DoublePrecisionColumn, type DriverAdapter, DynamicRawSQL, type EmptyObject, type EmptyTuple, EnumColumn, Expression, type ExpressionData, type FromArg, type FromResult, type GeneratorIgnore, type Grant, type HookSelectValue, InetColumn, IntegerBaseColumn, IntegerColumn, IntervalColumn, type IsQuery, type IsolationLevel, JSONColumn, JSONTextColumn, type JoinedShapes, LimitedTextBaseColumn, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, type MapTableScopesOption, type MaybeArray, type MaybePromise, type MergeQuery, MoneyColumn, type NoPrimaryKeyOption, type NonUniqDataItem, NotFoundError, NumberAsStringBaseColumn, NumberBaseColumn, type NumberColumnData, Operators, type OperatorsArray, type OperatorsJson, type OperatorsOrdinalText, type OperatorsText, OrchidOrmInternalError, type Ord, PathColumn, type PickQueryInputType, type PickQueryInternal, type PickQueryQ, type PickQueryRelations, type PickQuerySelectableRelations, type PickQueryShape, PointColumn, PolygonColumn, PostgisGeographyPointColumn, type Query, type QueryAfterHook, type QueryBeforeActionHook, type QueryBeforeHook, type QueryData, QueryError, type QueryHasWhere, type QueryHelperResult, QueryHookUtils, QueryHooks, type QueryInternal, type QueryLogObject, type QueryLogOptions, type QueryLogger, type QueryManyTake, type QueryManyTakeOptional, type QueryOrExpression, type QueryResult, type QueryResultRow, type QueryReturnType, type QuerySchema, type QueryScopes, RawSql, type RawSqlBase, RealColumn, type RecordKeyTrue, type RecordOptionalString, type RecordString, type RecordStringOrNumber, type RecordUnknown, type RefreshMaterializedViewOptions, type RelationConfigBase, type RelationJoinQuery, type RelationsBase, type Rls, type RlsPolicy, type SchemaConfigFnWithOptions, type SearchWeight, type SelectableFromShape, SerialColumn, type SerialColumnData, type ShallowSimplify, type ShapeUniqueColumns, type SingleSql, type SingleSqlItem, SmallIntColumn, SmallSerialColumn, type Sql, type SqlFn, type SqlSessionState, type StorageOptions, StringColumn, type StringData, type TableData, type TableDataFn, type TableDataInput, type TableDataItem, type TableDataItemsUniqueColumnTuples, type TableDataItemsUniqueColumns, type TableDataItemsUniqueConstraints, type TableDataMethods, type TemplateLiteralArgs, TextBaseColumn, TextColumn, TimeColumn, TimestampColumn, TimestampTZColumn, type Timestamps, type ToSQLCtx, type ToSqlValues, type TransactionAdapter, TransactionAdapterClass, type TransactionOptions, TsQueryColumn, TsVectorColumn, UUIDColumn, type UniqueConstraints, type UniqueTableDataItem, UnknownColumn, type UpdateData, type UpsertData, type UpsertThis, VarCharColumn, VirtualColumn, type WhereArg, XMLColumn, _appendQuery, _appendQueryOnUpsertCreate, _clone, _createDbSqlMethod, _hookSelectColumns, _initQueryBuilder, _onUpsertUpdate, _orCreate, _prependWith, _prependWithOnUpsertCreate, _queryCreate, _queryCreateMany, _queryCreateManyFrom, _queryDefaults, _queryDelete, _queryFindBy, _queryFindByOptional, _queryHookAfterCreate, _queryHookAfterUpdate, _queryInsert, _queryInsertMany, _queryJoinOn, _queryRows, _querySelect, _queryTake, _queryTakeOptional, _queryUpdate, _queryUpdateOrThrow, _queryUpsert, _queryWhere, _queryWhereExists, _queryWhereIn, addCode, addTopCte, addTopCteSql, applyMixins, assignDbDataToColumn, backtickQuote, cloneQueryBaseUnscoped, codeToString, colors, columnsShapeToCode, constraintInnerToCode, constraintToCode, consumeColumnName, copyTableData, createDbWithAdapter, deepCompare, defaultSchemaConfig, emptyArray, emptyObject, escapeForMigration, escapeString, excludeInnerToCode, excludeToCode, exhaustive, getCallerFilePath, getClonedQueryData, getColumnBaseType, getColumnInfo, getColumnTypes, getDateAsDateFn, getDateAsNumberFn, getDriverErrorCode, getFreeAlias, getFreeSetAlias, getImportPath, getPrimaryKeys, getQueryAs, getQuerySchema, getShapeFromSelect, getSqlText, getStackTrace, getSupportedDefaultPrivileges, indexInnerToCode, indexToCode, internalSchemaConfig, isExpression, isQueryReturnsAll, isRawSQL, logColors, logParamToLogObject, makeColumnNullable, makeColumnTypes, makeColumnsByType, makeConnectRetryConfig, noop, objectHasValues, omit, parseTableData, parseTableDataInput, pathToLog, pick, pluralize, prepareSubQueryForSql, primaryKeyInnerToCode, pushQueryOnForOuter, pushQueryValueImmutable, pushTableDataCode, queryToSql, quoteIdentifier, quoteObjectKey, quoteTableWithSchema, raw, rawSqlToCode, rawSqlToSql, referencesArgsToCode, refreshMaterializedView, returnArg, setColumnData, setColumnEncode, setColumnParse, setColumnParseNull, setCurrentColumnName, setDataValue, setDefaultLanguage, setFreeAlias, setQueryObjectValueImmutable, singleQuote, sqlToRawSql, tableDataMethods, testTransaction, toArray, toCamelCase, toPascalCase, toSnakeCase, wrapAdapterFnWithConnectRetry };
11180
+ export { type Adapter, AdapterClass, type AdapterConfigBase, type AdapterParams, type AdapterSchemaConfigOptions, type AfterCommitStandaloneHook, type AfterHook, ArrayColumn, type ArrayColumnValue, type ArrayData, type AsyncState, type BaseNumberData, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BoxColumn, type BrandColumn, type BrandColumnsShape, type Branded, ByteaColumn, CidrColumn, CircleColumn, CitextColumn, type Code, type Codes, Column, type ColumnFromDbParams, type ColumnRefExpression, type ColumnSchemaConfig, type ColumnSchemaGetterColumns, type ColumnSchemaGetterTableClass, type ColumnToCodeCtx, type ColumnTypeSchemaArg, type ColumnsByType, type ColumnsShape, type ComputedColumnsFromOptions, type ComputedOptionsConfig, type ComputedOptionsFactory, type CreateCtx, type CreateData, type CreateManyMethodsNames, type CreateMethodsNames, type CreateSelf, CustomTypeColumn, DateBaseColumn, DateColumn, type DateColumnData, type DateColumnInput, DateTimeBaseClass, DateTimeTzBaseClass, Db, type DbDomainArg, type DbExtension, type DbOptions, type DbResult, type DbSharedOptions, type DbSqlMethod, type DbStructureDomainsMap, type DbTableOptionScopes, type DbTableOptions, DecimalColumn, type DecimalColumnData, type DefaultColumnTypes, type DefaultPrivileges, type DefaultSchemaConfig, type DeleteMethodsNames, DomainColumn, DoublePrecisionColumn, type DriverAdapter, DynamicRawSQL, type EmptyObject, type EmptyTuple, EnumColumn, Expression, type ExpressionData, type FromArg, type FromResult, type GeneratorIgnore, type Grant, type HookSelectValue, InetColumn, IntegerBaseColumn, IntegerColumn, IntervalColumn, type IsQuery, type IsolationLevel, JSONColumn, JSONTextColumn, type JoinedShapes, LimitedTextBaseColumn, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, type MapTableScopesOption, type MaybeArray, type MaybePromise, type MergeQuery, MoneyColumn, type NoPrimaryKeyOption, type NonUniqDataItem, NotFoundError, NumberAsStringBaseColumn, NumberBaseColumn, type NumberColumnData, Operators, type OperatorsArray, type OperatorsDate, type OperatorsJson, type OperatorsNumber, type OperatorsOrdinalText, type OperatorsText, OrchidOrmInternalError, type Ord, PathColumn, type PickQueryInputType, type PickQueryInternal, type PickQueryQ, type PickQueryRelations, type PickQuerySelectableRelations, type PickQueryShape, PointColumn, PolygonColumn, PostgisGeographyPointColumn, type Query, type QueryAfterHook, type QueryBeforeActionHook, type QueryBeforeHook, type QueryData, QueryError, type QueryHasWhere, type QueryHelperResult, QueryHookUtils, QueryHooks, type QueryInternal, type QueryLogObject, type QueryLogOptions, type QueryLogger, type QueryManyTake, type QueryManyTakeOptional, type QueryOrExpression, type QueryResult, type QueryResultRow, type QueryReturnType, type QuerySchema, type QueryScopes, RawSql, type RawSqlBase, RealColumn, type RecordKeyTrue, type RecordOptionalString, type RecordString, type RecordStringOrNumber, type RecordUnknown, type RefreshMaterializedViewOptions, type RelationConfigBase, type RelationJoinQuery, type RelationsBase, type Rls, type RlsPolicy, type SchemaConfigFnWithOptions, type SearchWeight, type SelectSqlColumn, type SelectableFromShape, SerialColumn, type SerialColumnData, type ShallowSimplify, type ShapeUniqueColumns, type SingleSql, type SingleSqlItem, SmallIntColumn, SmallSerialColumn, type Sql, type SqlFn, type SqlSessionState, type StaticSQLArgs, type StorageOptions, StringColumn, type StringData, type TableData, type TableDataFn, type TableDataInput, type TableDataItem, type TableDataItemsUniqueColumnTuples, type TableDataItemsUniqueColumns, type TableDataItemsUniqueConstraints, type TableDataMethods, type TemplateLiteralArgs, TextBaseColumn, TextColumn, TimeColumn, TimestampColumn, TimestampTZColumn, type Timestamps, type ToSQLCtx, type ToSqlValues, type TransactionAdapter, TransactionAdapterClass, type TransactionOptions, TsQueryColumn, TsVectorColumn, UUIDColumn, type UniqueConstraints, type UniqueTableDataItem, UnknownColumn, type UpdateData, type UpsertData, type UpsertThis, VarCharColumn, VirtualColumn, type WhereArg, XMLColumn, _appendQuery, _appendQueryOnUpsertCreate, _clone, _createDbSqlMethod, _hookSelectColumns, _initQueryBuilder, _onUpsertUpdate, _orCreate, _prependWith, _prependWithOnUpsertCreate, _queryCreate, _queryCreateMany, _queryCreateManyFrom, _queryDefaults, _queryDelete, _queryFindBy, _queryFindByOptional, _queryHookAfterCreate, _queryHookAfterUpdate, _queryInsert, _queryInsertMany, _queryJoinOn, _queryRows, _querySelect, _queryTake, _queryTakeOptional, _queryUpdate, _queryUpdateOrThrow, _queryUpsert, _queryWhere, _queryWhereExists, _queryWhereIn, addCode, addTopCte, addTopCteSql, applyMixins, assignDbDataToColumn, backtickQuote, cloneQueryBaseUnscoped, codeToString, colors, columnsShapeToCode, constraintInnerToCode, constraintToCode, consumeColumnName, copyTableData, createDbWithAdapter, deepCompare, defaultSchemaConfig, emptyArray, emptyObject, escapeForMigration, escapeString, excludeInnerToCode, excludeToCode, exhaustive, getCallerFilePath, getClonedQueryData, getColumnBaseType, getColumnInfo, getColumnTypes, getDateAsDateFn, getDateAsNumberFn, getDriverErrorCode, getFreeAlias, getFreeSetAlias, getImportPath, getPrimaryKeys, getQueryAs, getQuerySchema, getShapeFromSelect, getSqlText, getStackTrace, getSupportedDefaultPrivileges, indexInnerToCode, indexToCode, internalSchemaConfig, isExpression, isQueryReturnsAll, isRawSQL, logColors, logParamToLogObject, makeColumnNullable, makeColumnTypes, makeColumnsByType, makeConnectRetryConfig, noop, objectHasValues, omit, parseTableData, parseTableDataInput, pathToLog, pick, pluralize, prepareSubQueryForSql, primaryKeyInnerToCode, pushQueryOnForOuter, pushQueryValueImmutable, pushTableDataCode, queryToSql, quoteIdentifier, quoteObjectKey, quoteTableWithSchema, raw, rawSqlToCode, rawSqlToSql, referencesArgsToCode, refreshMaterializedView, returnArg, setColumnData, setColumnEncode, setColumnParse, setColumnParseNull, setCurrentColumnName, setDataValue, setDefaultLanguage, setFreeAlias, setQueryObjectValueImmutable, singleQuote, sqlToRawSql, tableDataMethods, testTransaction, toArray, toCamelCase, toPascalCase, toSnakeCase, wrapAdapterFnWithConnectRetry };