pqb 0.72.0 → 0.72.1

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
@@ -21,7 +21,7 @@ interface RecordOptionalString {
21
21
  interface RecordUnknown {
22
22
  [K: string]: unknown;
23
23
  }
24
- type ShallowSimplify<T> = T extends any ? { [K in keyof T]: T[K] } : T;
24
+ type ShallowSimplify<T> = T extends any ? { [K in keyof T]: T[K]; } : T;
25
25
  /**
26
26
  * Merge methods from multiple class into another class.
27
27
  * @param derivedCtor - target class to merge methods into
@@ -241,7 +241,7 @@ declare abstract class QueryError<T extends PickQueryShape = PickQueryShape> ext
241
241
  line: string | undefined;
242
242
  routine: string | undefined;
243
243
  get isUnique(): boolean;
244
- get columns(): { [K in keyof T["shape"]]?: true | undefined };
244
+ get columns(): { [K in keyof T["shape"]]?: true | undefined; };
245
245
  }
246
246
  interface QueryLogObject {
247
247
  colors: boolean;
@@ -265,7 +265,7 @@ declare const logColors: {
265
265
  boldMagenta: (message: string) => string;
266
266
  boldRed: (message: string) => string;
267
267
  };
268
- declare const logParamToLogObject: (logger: QueryLogger, log: QueryLogOptions["log"]) => QueryLogObject | undefined;
268
+ declare const logParamToLogObject: (logger: QueryLogger, log: QueryLogOptions['log']) => QueryLogObject | undefined;
269
269
  declare class QueryLog {
270
270
  /**
271
271
  * Override the `log` option, which can also be set in `createDb` or when creating a table instance:
@@ -909,7 +909,7 @@ interface TableDataMethods<Key extends PropertyKey> {
909
909
  };
910
910
  unique<Columns extends [Key | TableData.Index.ColumnOrExpressionOptions<Key>, ...(Key | TableData.Index.ColumnOrExpressionOptions<Key>)[]], Name extends string>(columns: Columns, options?: TableData.Index.UniqueOptionsArg<Name>): {
911
911
  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;
912
+ columns: Columns extends (Key | TableData.Index.ColumnOptionsForColumn<Key>)[] ? { [I in keyof Columns]: 'column' extends keyof Columns[I] ? Columns[I]['column'] : Columns[I]; } : never;
913
913
  name: string extends Name ? never : Name;
914
914
  };
915
915
  index(columns: (Key | TableData.Index.ColumnOrExpressionOptions<Key>)[], options?: TableData.Index.OptionsArg): NonUniqDataItem;
@@ -998,8 +998,8 @@ interface TableDataMethods<Key extends PropertyKey> {
998
998
  check(check: RawSqlBase, name?: string): NonUniqDataItem;
999
999
  sql: SqlFn;
1000
1000
  }
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']> };
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']>; };
1003
1003
  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
1004
  type UniqueQueryTypeOrExpression<T> = T | Expression<Column.Pick.QueryColumnOfType<T>>;
1005
1005
  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 +1090,7 @@ declare const excludeInnerToCode: (item: TableData.Exclude, t: string) => Codes;
1090
1090
  declare const excludeToCode: (item: TableData.Exclude, t: string, prefix?: string) => Codes;
1091
1091
  declare const constraintToCode: (item: TableData.Constraint, t: string, m?: boolean, prefix?: string, ctx?: ColumnToCodeCtx) => Codes;
1092
1092
  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;
1093
+ declare const referencesArgsToCode: ({ columns, fnOrTable, foreignColumns, options }: Exclude<TableData.Constraint['references'], undefined>, name?: string | false, m?: boolean) => Codes;
1099
1094
  interface NumberColumnData extends BaseNumberData, Column.Data {
1100
1095
  identity?: TableData.Identity;
1101
1096
  }
@@ -1140,46 +1135,46 @@ declare class DecimalColumn<Schema extends ColumnSchemaConfig> extends NumberAsS
1140
1135
  data: DecimalColumnData;
1141
1136
  querySchema: ReturnType<Schema['stringSchema']>;
1142
1137
  operators: OperatorsNumber;
1143
- dataType: "numeric";
1138
+ dataType: 'numeric';
1144
1139
  constructor(schema: Schema, numericPrecision?: number, numericScale?: number);
1145
1140
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
1146
1141
  toSQL(): string;
1147
1142
  }
1148
1143
  declare class SmallIntColumn<Schema extends ColumnSchemaConfig> extends IntegerBaseColumn<Schema> {
1149
- dataType: "int2";
1144
+ dataType: 'int2';
1150
1145
  querySchema: ReturnType<Schema['int']>;
1151
1146
  constructor(schema: Schema);
1152
1147
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
1153
1148
  identity<T extends Column.Pick.Data>(this: T, options?: TableData.Identity): Column.HasDefault<T>;
1154
1149
  }
1155
1150
  declare class IntegerColumn<Schema extends ColumnSchemaConfig> extends IntegerBaseColumn<Schema> {
1156
- dataType: "int4";
1151
+ dataType: 'int4';
1157
1152
  querySchema: ReturnType<Schema['int']>;
1158
1153
  constructor(schema: Schema);
1159
1154
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
1160
1155
  identity<T extends Column.Pick.Data>(this: T, options?: TableData.Identity): Column.HasDefault<T>;
1161
1156
  }
1162
1157
  declare class BigIntColumn<Schema extends ColumnSchemaConfig> extends NumberAsStringBaseColumn<Schema, string | number | bigint> {
1163
- dataType: "int8";
1158
+ dataType: 'int8';
1164
1159
  querySchema: ReturnType<Schema['stringSchema']>;
1165
1160
  constructor(schema: Schema);
1166
1161
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
1167
1162
  identity<T extends Column.Pick.Data>(this: T, options?: TableData.Identity): Column.HasDefault<T>;
1168
1163
  }
1169
1164
  declare class RealColumn<Schema extends ColumnSchemaConfig> extends NumberBaseColumn<Schema, ReturnType<Schema['number']>> {
1170
- dataType: "float4";
1165
+ dataType: 'float4';
1171
1166
  querySchema: ReturnType<Schema['number']>;
1172
1167
  constructor(schema: Schema);
1173
1168
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
1174
1169
  }
1175
1170
  declare class DoublePrecisionColumn<Schema extends ColumnSchemaConfig> extends NumberAsStringBaseColumn<Schema> {
1176
- dataType: "float8";
1171
+ dataType: 'float8';
1177
1172
  querySchema: ReturnType<Schema['stringSchema']>;
1178
1173
  constructor(schema: Schema);
1179
1174
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
1180
1175
  }
1181
1176
  declare class SmallSerialColumn<Schema extends ColumnSchemaConfig> extends IntegerBaseColumn<Schema> {
1182
- dataType: "int2";
1177
+ dataType: 'int2';
1183
1178
  data: SerialColumnData;
1184
1179
  querySchema: ReturnType<Schema['int']>;
1185
1180
  constructor(schema: Schema);
@@ -1187,7 +1182,7 @@ declare class SmallSerialColumn<Schema extends ColumnSchemaConfig> extends Integ
1187
1182
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
1188
1183
  }
1189
1184
  declare class SerialColumn<Schema extends ColumnSchemaConfig> extends IntegerBaseColumn<Schema> {
1190
- dataType: "int4";
1185
+ dataType: 'int4';
1191
1186
  data: SerialColumnData;
1192
1187
  querySchema: ReturnType<Schema['int']>;
1193
1188
  constructor(schema: Schema);
@@ -1195,7 +1190,7 @@ declare class SerialColumn<Schema extends ColumnSchemaConfig> extends IntegerBas
1195
1190
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
1196
1191
  }
1197
1192
  declare class BigSerialColumn<Schema extends ColumnSchemaConfig> extends NumberAsStringBaseColumn<Schema> {
1198
- dataType: "int8";
1193
+ dataType: 'int8';
1199
1194
  data: SerialColumnData;
1200
1195
  querySchema: ReturnType<Schema['stringSchema']>;
1201
1196
  constructor(schema: Schema);
@@ -1203,14 +1198,16 @@ declare class BigSerialColumn<Schema extends ColumnSchemaConfig> extends NumberA
1203
1198
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
1204
1199
  }
1205
1200
  type DateColumnInput = string | number | Date;
1201
+ declare const parseStringOrDateToNumber: (value: unknown) => number;
1206
1202
  declare const getDateAsNumberFn: (column: {
1207
1203
  data: Column.Data;
1208
1204
  dateParsedByDriver?: boolean;
1209
- }) => (value: unknown) => number;
1205
+ }) => typeof parseStringOrDateToNumber;
1206
+ declare const parseDateToDate: (value: unknown) => Date;
1210
1207
  declare const getDateAsDateFn: (column: {
1211
1208
  data: Column.Data;
1212
1209
  dateParsedByDriver?: boolean;
1213
- }) => (value: unknown) => Date;
1210
+ }) => typeof parseDateToDate;
1214
1211
  declare abstract class DateBaseColumn<Schema extends ColumnSchemaConfig> extends Column {
1215
1212
  dateParsedByDriver?: boolean | undefined;
1216
1213
  __schema: Schema;
@@ -1228,7 +1225,7 @@ declare abstract class DateBaseColumn<Schema extends ColumnSchemaConfig> extends
1228
1225
  constructor(schema: Schema, dateParsedByDriver?: boolean | undefined);
1229
1226
  }
1230
1227
  declare class DateColumn<Schema extends ColumnSchemaConfig> extends DateBaseColumn<Schema> {
1231
- dataType: "date";
1228
+ dataType: 'date';
1232
1229
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
1233
1230
  }
1234
1231
  declare abstract class DateTimeBaseClass<Schema extends ColumnSchemaConfig> extends DateBaseColumn<Schema> {
@@ -1243,12 +1240,12 @@ declare abstract class DateTimeTzBaseClass<Schema extends ColumnSchemaConfig> ex
1243
1240
  toSQL(): string;
1244
1241
  }
1245
1242
  declare class TimestampColumn<Schema extends ColumnSchemaConfig> extends DateTimeBaseClass<Schema> {
1246
- dataType: "timestamp";
1243
+ dataType: 'timestamp';
1247
1244
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
1248
1245
  }
1249
1246
  declare class TimestampTZColumn<Schema extends ColumnSchemaConfig> extends DateTimeTzBaseClass<Schema> {
1250
- dataType: "timestamptz";
1251
- baseDataType: "timestamp";
1247
+ dataType: 'timestamptz';
1248
+ baseDataType: 'timestamp';
1252
1249
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
1253
1250
  }
1254
1251
  declare class TimeColumn<Schema extends ColumnSchemaConfig> extends Column {
@@ -1263,7 +1260,7 @@ declare class TimeColumn<Schema extends ColumnSchemaConfig> extends Column {
1263
1260
  outputSchema: ReturnType<Schema['stringSchema']>;
1264
1261
  __queryType: string;
1265
1262
  querySchema: ReturnType<Schema['stringSchema']>;
1266
- dataType: "time";
1263
+ dataType: 'time';
1267
1264
  operators: OperatorsTime;
1268
1265
  constructor(schema: Schema, dateTimePrecision?: number);
1269
1266
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
@@ -1281,7 +1278,7 @@ declare class IntervalColumn<Schema extends ColumnSchemaConfig> extends Column {
1281
1278
  outputSchema: ReturnType<Schema['timeInterval']>;
1282
1279
  __queryType: PostgresInterval;
1283
1280
  querySchema: ReturnType<Schema['timeInterval']>;
1284
- dataType: "interval";
1281
+ dataType: 'interval';
1285
1282
  operators: OperatorsDate;
1286
1283
  constructor(schema: Schema, fields?: string, precision?: number, parse?: (input: string) => PostgresInterval);
1287
1284
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
@@ -1322,8 +1319,8 @@ interface ArrayData<Item extends ArrayColumnValue> extends Column.Data, ArrayMet
1322
1319
  }
1323
1320
  declare class ArrayColumn<Schema extends ColumnTypeSchemaArg, Item extends ArrayColumnValue, InputType, OutputType, QueryType> extends Column {
1324
1321
  __schema: Schema;
1325
- dataType: "array";
1326
- operators: OperatorsArray<Item["__queryType"]>;
1322
+ dataType: 'array';
1323
+ operators: OperatorsArray<Item['__queryType']>;
1327
1324
  data: ArrayData<Item>;
1328
1325
  __type: Item['__type'][];
1329
1326
  __inputType: Item['__type'][];
@@ -1338,7 +1335,7 @@ declare class ArrayColumn<Schema extends ColumnTypeSchemaArg, Item extends Array
1338
1335
  }
1339
1336
  declare class JSONColumn<T, Schema extends ColumnTypeSchemaArg, InputSchema = Schema['__schemaType']> extends Column {
1340
1337
  __schema: Schema;
1341
- dataType: "jsonb";
1338
+ dataType: 'jsonb';
1342
1339
  __type: T;
1343
1340
  __inputType: T;
1344
1341
  inputSchema: InputSchema;
@@ -1352,7 +1349,7 @@ declare class JSONColumn<T, Schema extends ColumnTypeSchemaArg, InputSchema = Sc
1352
1349
  }
1353
1350
  declare class JSONTextColumn<T, Schema extends ColumnTypeSchemaArg, InputSchema = Schema['__schemaType']> extends Column {
1354
1351
  __schema: Schema;
1355
- dataType: "json";
1352
+ dataType: 'json';
1356
1353
  __type: T;
1357
1354
  __inputType: T;
1358
1355
  inputSchema: InputSchema;
@@ -1384,12 +1381,12 @@ interface DefaultSchemaConfig extends ColumnSchemaConfig<Column> {
1384
1381
  __inputType: Input;
1385
1382
  __outputType: Output;
1386
1383
  __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'])>() => {
1384
+ }) => Types): { [K in keyof T]: K extends '__type' ? Types['type'] : K extends keyof Types ? Types[K] : T[K]; };
1385
+ 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
1386
  __inputType: T['__inputType'] extends never ? never : Type;
1390
1387
  __outputType: Type;
1391
1388
  __queryType: Type;
1392
- }) => Types): { [K in keyof T]: K extends keyof Types ? Types[K] : T[K] };
1389
+ }) => Types): { [K in keyof T]: K extends keyof Types ? Types[K] : T[K]; };
1393
1390
  narrowAllTypes<T extends Column.InputOutputQueryTypes, Types extends Column.InputOutputQueryTypes>(this: T, _fn: (type: <Types extends {
1394
1391
  input?: T['__inputType'];
1395
1392
  output?: T['__outputType'];
@@ -1398,7 +1395,7 @@ interface DefaultSchemaConfig extends ColumnSchemaConfig<Column> {
1398
1395
  __inputType: undefined extends Types['input'] ? T['__inputType'] : Types['input'];
1399
1396
  __outputType: undefined extends Types['output'] ? T['__outputType'] : Types['output'];
1400
1397
  __queryType: undefined extends Types['query'] ? T['__queryType'] : Types['query'];
1401
- }) => Types): { [K in keyof T]: K extends keyof Types ? Types[K] : T[K] };
1398
+ }) => Types): { [K in keyof T]: K extends keyof Types ? Types[K] : T[K]; };
1402
1399
  dateAsNumber<T extends Column.Pick.ForParse>(this: T): Column.Parse<T, unknown, number>;
1403
1400
  dateAsDate<T extends Column.Pick.ForParse>(this: T): Column.Parse<T, unknown, Date>;
1404
1401
  enum<const T extends readonly [string, ...string[]]>(dataType: string, type: T): EnumColumn<DefaultSchemaConfig, unknown, T>;
@@ -1453,7 +1450,7 @@ declare abstract class LimitedTextBaseColumn<Schema extends ColumnSchemaConfig>
1453
1450
  toSQL(): string;
1454
1451
  }
1455
1452
  declare class VarCharColumn<Schema extends ColumnSchemaConfig> extends LimitedTextBaseColumn<Schema> {
1456
- dataType: "varchar";
1453
+ dataType: 'varchar';
1457
1454
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
1458
1455
  }
1459
1456
  declare class StringColumn<Schema extends ColumnSchemaConfig> extends VarCharColumn<Schema> {
@@ -1461,7 +1458,7 @@ declare class StringColumn<Schema extends ColumnSchemaConfig> extends VarCharCol
1461
1458
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
1462
1459
  }
1463
1460
  declare class TextColumn<Schema extends ColumnSchemaConfig> extends TextBaseColumn<Schema, OperatorsOrdinalText> {
1464
- dataType: "text";
1461
+ dataType: 'text';
1465
1462
  data: TextColumnData & {
1466
1463
  minArg?: number;
1467
1464
  maxArg?: number;
@@ -1475,7 +1472,7 @@ declare class TextColumn<Schema extends ColumnSchemaConfig> extends TextBaseColu
1475
1472
  }
1476
1473
  declare class ByteaColumn<Schema extends ColumnSchemaConfig> extends Column {
1477
1474
  __schema: Schema;
1478
- dataType: "bytea";
1475
+ dataType: 'bytea';
1479
1476
  operators: OperatorsOrdinalText;
1480
1477
  __type: string;
1481
1478
  __inputType: Buffer;
@@ -1489,7 +1486,7 @@ declare class ByteaColumn<Schema extends ColumnSchemaConfig> extends Column {
1489
1486
  }
1490
1487
  declare class PointColumn<Schema extends ColumnSchemaConfig> extends Column {
1491
1488
  __schema: Schema;
1492
- dataType: "point";
1489
+ dataType: 'point';
1493
1490
  __type: string;
1494
1491
  __inputType: string;
1495
1492
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -1503,7 +1500,7 @@ declare class PointColumn<Schema extends ColumnSchemaConfig> extends Column {
1503
1500
  }
1504
1501
  declare class LineColumn<Schema extends ColumnSchemaConfig> extends Column {
1505
1502
  __schema: Schema;
1506
- dataType: "line";
1503
+ dataType: 'line';
1507
1504
  __type: string;
1508
1505
  __inputType: string;
1509
1506
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -1517,7 +1514,7 @@ declare class LineColumn<Schema extends ColumnSchemaConfig> extends Column {
1517
1514
  }
1518
1515
  declare class LsegColumn<Schema extends ColumnSchemaConfig> extends Column {
1519
1516
  __schema: Schema;
1520
- dataType: "lseg";
1517
+ dataType: 'lseg';
1521
1518
  __type: string;
1522
1519
  __inputType: string;
1523
1520
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -1531,7 +1528,7 @@ declare class LsegColumn<Schema extends ColumnSchemaConfig> extends Column {
1531
1528
  }
1532
1529
  declare class BoxColumn<Schema extends ColumnSchemaConfig> extends Column {
1533
1530
  __schema: Schema;
1534
- dataType: "box";
1531
+ dataType: 'box';
1535
1532
  __type: string;
1536
1533
  __inputType: string;
1537
1534
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -1545,7 +1542,7 @@ declare class BoxColumn<Schema extends ColumnSchemaConfig> extends Column {
1545
1542
  }
1546
1543
  declare class PathColumn<Schema extends ColumnSchemaConfig> extends Column {
1547
1544
  __schema: Schema;
1548
- dataType: "path";
1545
+ dataType: 'path';
1549
1546
  __type: string;
1550
1547
  __inputType: string;
1551
1548
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -1559,7 +1556,7 @@ declare class PathColumn<Schema extends ColumnSchemaConfig> extends Column {
1559
1556
  }
1560
1557
  declare class PolygonColumn<Schema extends ColumnSchemaConfig> extends Column {
1561
1558
  __schema: Schema;
1562
- dataType: "polygon";
1559
+ dataType: 'polygon';
1563
1560
  __type: string;
1564
1561
  __inputType: string;
1565
1562
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -1573,7 +1570,7 @@ declare class PolygonColumn<Schema extends ColumnSchemaConfig> extends Column {
1573
1570
  }
1574
1571
  declare class CircleColumn<Schema extends ColumnSchemaConfig> extends Column {
1575
1572
  __schema: Schema;
1576
- dataType: "circle";
1573
+ dataType: 'circle';
1577
1574
  __type: string;
1578
1575
  __inputType: string;
1579
1576
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -1587,7 +1584,7 @@ declare class CircleColumn<Schema extends ColumnSchemaConfig> extends Column {
1587
1584
  }
1588
1585
  declare class MoneyColumn<Schema extends ColumnSchemaConfig> extends Column {
1589
1586
  __schema: Schema;
1590
- dataType: "money";
1587
+ dataType: 'money';
1591
1588
  __type: string;
1592
1589
  data: NumberColumnData;
1593
1590
  __inputType: string | number;
@@ -1602,7 +1599,7 @@ declare class MoneyColumn<Schema extends ColumnSchemaConfig> extends Column {
1602
1599
  }
1603
1600
  declare class CidrColumn<Schema extends ColumnSchemaConfig> extends Column {
1604
1601
  __schema: Schema;
1605
- dataType: "cidr";
1602
+ dataType: 'cidr';
1606
1603
  __type: string;
1607
1604
  __inputType: string;
1608
1605
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -1616,7 +1613,7 @@ declare class CidrColumn<Schema extends ColumnSchemaConfig> extends Column {
1616
1613
  }
1617
1614
  declare class InetColumn<Schema extends ColumnSchemaConfig> extends Column {
1618
1615
  __schema: Schema;
1619
- dataType: "inet";
1616
+ dataType: 'inet';
1620
1617
  __type: string;
1621
1618
  __inputType: string;
1622
1619
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -1630,7 +1627,7 @@ declare class InetColumn<Schema extends ColumnSchemaConfig> extends Column {
1630
1627
  }
1631
1628
  declare class MacAddrColumn<Schema extends ColumnSchemaConfig> extends Column {
1632
1629
  __schema: Schema;
1633
- dataType: "macaddr";
1630
+ dataType: 'macaddr';
1634
1631
  __type: string;
1635
1632
  __inputType: string;
1636
1633
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -1644,7 +1641,7 @@ declare class MacAddrColumn<Schema extends ColumnSchemaConfig> extends Column {
1644
1641
  }
1645
1642
  declare class MacAddr8Column<Schema extends ColumnSchemaConfig> extends Column {
1646
1643
  __schema: Schema;
1647
- dataType: "macaddr8";
1644
+ dataType: 'macaddr8';
1648
1645
  __type: string;
1649
1646
  __inputType: string;
1650
1647
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -1658,7 +1655,7 @@ declare class MacAddr8Column<Schema extends ColumnSchemaConfig> extends Column {
1658
1655
  }
1659
1656
  declare class BitColumn<Schema extends ColumnSchemaConfig> extends Column {
1660
1657
  __schema: Schema;
1661
- dataType: "bit";
1658
+ dataType: 'bit';
1662
1659
  __type: string;
1663
1660
  __inputType: string;
1664
1661
  inputSchema: ReturnType<Schema['bit']>;
@@ -1676,7 +1673,7 @@ declare class BitColumn<Schema extends ColumnSchemaConfig> extends Column {
1676
1673
  }
1677
1674
  declare class BitVaryingColumn<Schema extends ColumnSchemaConfig> extends Column {
1678
1675
  __schema: Schema;
1679
- dataType: "varbit";
1676
+ dataType: 'varbit';
1680
1677
  __type: string;
1681
1678
  __inputType: string;
1682
1679
  inputSchema: ReturnType<Schema['bit']>;
@@ -1696,7 +1693,7 @@ type TsVectorGeneratedColumns = string[] | SearchWeightRecord;
1696
1693
  declare class TsVectorColumn<Schema extends ColumnSchemaConfig> extends Column {
1697
1694
  defaultLanguage: string;
1698
1695
  __schema: Schema;
1699
- dataType: "tsvector";
1696
+ dataType: 'tsvector';
1700
1697
  __type: string;
1701
1698
  __inputType: string;
1702
1699
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -1735,7 +1732,7 @@ declare class TsVectorColumn<Schema extends ColumnSchemaConfig> extends Column {
1735
1732
  }
1736
1733
  declare class TsQueryColumn<Schema extends ColumnSchemaConfig> extends Column {
1737
1734
  __schema: Schema;
1738
- dataType: "tsquery";
1735
+ dataType: 'tsquery';
1739
1736
  __type: string;
1740
1737
  __inputType: string;
1741
1738
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -1749,7 +1746,7 @@ declare class TsQueryColumn<Schema extends ColumnSchemaConfig> extends Column {
1749
1746
  }
1750
1747
  declare class UUIDColumn<Schema extends ColumnSchemaConfig> extends Column {
1751
1748
  __schema: Schema;
1752
- dataType: "uuid";
1749
+ dataType: 'uuid';
1753
1750
  __type: string;
1754
1751
  __inputType: string;
1755
1752
  inputSchema: ReturnType<Schema['uuid']>;
@@ -1762,7 +1759,8 @@ declare class UUIDColumn<Schema extends ColumnSchemaConfig> extends Column {
1762
1759
  /**
1763
1760
  * see {@link Column.primaryKey}
1764
1761
  */
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
1762
+ primaryKey<T extends Column.Pick.Data, Name extends string>(this: T, name?: Name):
1763
+ // using & bc otherwise the return type doesn't match `primaryKey` in ColumnType and TS complains
1766
1764
  T & {
1767
1765
  data: {
1768
1766
  primaryKey: Name;
@@ -1773,7 +1771,7 @@ declare class UUIDColumn<Schema extends ColumnSchemaConfig> extends Column {
1773
1771
  }
1774
1772
  declare class XMLColumn<Schema extends ColumnSchemaConfig> extends Column {
1775
1773
  __schema: Schema;
1776
- dataType: "xml";
1774
+ dataType: 'xml';
1777
1775
  __type: string;
1778
1776
  __inputType: string;
1779
1777
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -1789,7 +1787,7 @@ declare class XMLColumn<Schema extends ColumnSchemaConfig> extends Column {
1789
1787
  }
1790
1788
  declare class CitextColumn<Schema extends ColumnSchemaConfig> extends TextBaseColumn<Schema, OperatorsOrdinalText> {
1791
1789
  __schema: Schema;
1792
- dataType: "citext";
1790
+ dataType: 'citext';
1793
1791
  data: TextColumnData & {
1794
1792
  minArg?: number;
1795
1793
  maxArg?: number;
@@ -1801,7 +1799,7 @@ declare class CitextColumn<Schema extends ColumnSchemaConfig> extends TextBaseCo
1801
1799
  }
1802
1800
  declare class BooleanColumn<Schema extends ColumnSchemaConfig> extends Column {
1803
1801
  __schema: Schema;
1804
- dataType: "bool";
1802
+ dataType: 'bool';
1805
1803
  operators: OperatorsBoolean;
1806
1804
  __type: boolean;
1807
1805
  __inputType: boolean;
@@ -1868,6 +1866,7 @@ interface PostgisPoint {
1868
1866
  lat: number;
1869
1867
  srid?: number;
1870
1868
  }
1869
+ declare const encode: ({ srid, lon, lat }: PostgisPoint) => string;
1871
1870
  declare class PostgisGeographyPointColumn<Schema extends ColumnSchemaConfig> extends Column {
1872
1871
  __schema: Schema;
1873
1872
  dataType: string;
@@ -1879,11 +1878,7 @@ declare class PostgisGeographyPointColumn<Schema extends ColumnSchemaConfig> ext
1879
1878
  __queryType: PostgisPoint;
1880
1879
  querySchema: ReturnType<Schema['geographyPointSchema']>;
1881
1880
  operators: OperatorsAny;
1882
- static encode: ({
1883
- srid,
1884
- lon,
1885
- lat
1886
- }: PostgisPoint) => string;
1881
+ static encode: typeof encode;
1887
1882
  static isDefaultPoint(typmod: number): boolean;
1888
1883
  constructor(schema: Schema);
1889
1884
  toCode(ctx: ColumnToCodeCtx, key: string): Code;
@@ -2013,7 +2008,7 @@ interface BatchParser {
2013
2008
  rows: unknown[];
2014
2009
  }) => MaybePromise<void>;
2015
2010
  }
2016
- type ColumnsParsers = { [K in string]?: ColumnParser };
2011
+ type ColumnsParsers = { [K in string]?: ColumnParser; };
2017
2012
  type BatchParsers = BatchParser[];
2018
2013
  interface QueryThen<T> {
2019
2014
  <TResult1 = T, TResult2 = never>(onfulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>;
@@ -2038,7 +2033,7 @@ type WithSelectable<W extends WithDataItem> = keyof W['shape'] | `${W['table']}.
2038
2033
  * The first argument of all `join` and `joinLateral` methods.
2039
2034
  * See argument of {@link join}.
2040
2035
  */
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;
2036
+ 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
2037
  interface FnPickQueryResultAs {
2043
2038
  (): PickQueryResultAs;
2044
2039
  }
@@ -2046,7 +2041,7 @@ interface FnPickQueryResultAs {
2046
2041
  * Arguments of `join` methods (not `joinLateral`).
2047
2042
  * See {@link join}
2048
2043
  */
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;
2044
+ 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
2045
  /**
2051
2046
  * Column names of the joined table that can be used to join.
2052
2047
  * Derived from 'result', not from 'shape',
@@ -2057,16 +2052,16 @@ type JoinArgs<T extends PickQuerySelectableShapeRelationsWithDataAs, Arg extends
2057
2052
  * And the selection becomes available to use in the `ON` and to select from the joined table.
2058
2053
  */
2059
2054
  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] };
2055
+ 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];
2056
+ type JoinResultRequireMain<T extends PickQuerySelectable, JoinedSelectable> = { [K in keyof T]: K extends '__selectable' ? T['__selectable'] & JoinedSelectable : T[K]; };
2062
2057
  /**
2063
2058
  * Result of all `join` methods, not `joinLateral`.
2064
2059
  * Adds joined table columns from its 'result' to the '__selectable' of the query.
2065
2060
  */
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']]: {
2061
+ 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
2062
  as: T['__selectable'][K]['as'];
2068
2063
  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] };
2064
+ }; } & 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
2065
  /**
2071
2066
  * Calls {@link JoinResult} with either callback result, if join has a callback,
2072
2067
  * or with a query derived from the first join argument.
@@ -2105,8 +2100,8 @@ type JoinResultSelectable<Result extends Column.QueryColumns, As extends string,
2105
2100
  } : {
2106
2101
  as: K;
2107
2102
  column: Result[K];
2108
- } };
2109
- relations: { [K in keyof JoinedRelations & string as `${As}.${K}`]: JoinedRelations[K] };
2103
+ }; };
2104
+ relations: { [K in keyof JoinedRelations & string as `${As}.${K}`]: JoinedRelations[K]; };
2110
2105
  } : {
2111
2106
  __selectable: { [K in '*' | (keyof Result & string) as `${As}.${K}`]: K extends '*' ? {
2112
2107
  as: As;
@@ -2114,10 +2109,10 @@ type JoinResultSelectable<Result extends Column.QueryColumns, As extends string,
2114
2109
  } : {
2115
2110
  as: K;
2116
2111
  column: Column.QueryColumnToNullable<Result[K]>;
2117
- } };
2118
- relations: { [K in keyof JoinedRelations & string as `${As}.${K}`]: JoinedRelations[K] };
2112
+ }; };
2113
+ relations: { [K in keyof JoinedRelations & string as `${As}.${K}`]: JoinedRelations[K]; };
2119
2114
  };
2120
- type JoinAddSelectable<T extends PickQuerySelectable, Joined extends PickQuerySelectableRelations> = { [K in keyof T]: K extends '__selectable' ? T['__selectable'] & Joined['__selectable'] : T[K] };
2115
+ type JoinAddSelectable<T extends PickQuerySelectable, Joined extends PickQuerySelectableRelations> = { [K in keyof T]: K extends '__selectable' ? T['__selectable'] & Joined['__selectable'] : T[K]; };
2121
2116
  /**
2122
2117
  * Map the first argument of `join` or `joinLateral` to a query type.
2123
2118
  *
@@ -2128,7 +2123,7 @@ type JoinAddSelectable<T extends PickQuerySelectable, Joined extends PickQuerySe
2128
2123
  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
2124
  as: K;
2130
2125
  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;
2126
+ }; } : 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
2127
  interface JoinArgToQueryCallback {
2133
2128
  (...args: any[]): IsQuery;
2134
2129
  }
@@ -2761,7 +2756,7 @@ declare class QueryJoin {
2761
2756
  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
2757
  as: K;
2763
2758
  column: RecordType[K];
2764
- } } : T[K] };
2759
+ }; } : T[K]; };
2765
2760
  }
2766
2761
  type OnArgs<S extends QuerySelectable> = [leftColumn: keyof S, rightColumn: keyof S] | [leftColumn: keyof S, op: string, rightColumn: keyof S];
2767
2762
  declare const pushQueryOnForOuter: <T extends PickQuerySelectable>(q: T, joinFrom: PickQuerySelectable, joinTo: PickQuerySelectable, leftColumn: string, rightColumn: string) => T;
@@ -2769,13 +2764,13 @@ type OnJsonPathEqualsArgs<S extends QuerySelectable> = [leftColumn: keyof S, lef
2769
2764
  /**
2770
2765
  * Mutative {@link OnMethods.prototype.on}
2771
2766
  */
2772
- declare const _queryJoinOn: <T extends PickQuerySelectable>(q: T, args: OnArgs<T["__selectable"]>) => T;
2767
+ declare const _queryJoinOn: <T extends PickQuerySelectable>(q: T, args: OnArgs<T['__selectable']>) => T;
2773
2768
  /**
2774
2769
  * Argument of join callback.
2775
2770
  * It is a query object of table that you're joining, with ability to select main table's columns.
2776
2771
  * Adds {@link OnMethods.prototype.on} method and similar to the query.
2777
2772
  */
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 };
2773
+ 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
2774
  declare class OnMethods {
2780
2775
  /**
2781
2776
  * Use `on` to specify columns to join records.
@@ -2892,10 +2887,10 @@ interface QueryDataSources {
2892
2887
  }
2893
2888
  declare namespace Order {
2894
2889
  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;
2890
+ export type Arg<T extends ArgThis> = ArgKey<T> | ArgTsQuery<T> | { [K in ArgKey<T> | ArgTsQuery<T>]?: K extends ArgTsQuery<T> ? OrderTsQueryConfig : SortDir; } | Expression;
2896
2891
  export type Args<T extends ArgThis> = Arg<T>[];
2897
2892
  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']];
2893
+ 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
2894
  export {};
2900
2895
  }
2901
2896
  declare class QueryOrder {
@@ -2956,7 +2951,7 @@ interface WindowArgDeclaration<T extends Order.ArgThis = Order.ArgThis> {
2956
2951
  order?: Order.Arg<T>;
2957
2952
  }
2958
2953
  type WindowResult<T, W extends RecordUnknown> = T & {
2959
- windows: { [K in keyof W]: true };
2954
+ windows: { [K in keyof W]: true; };
2960
2955
  };
2961
2956
  declare class QueryWindow {
2962
2957
  /**
@@ -3084,9 +3079,9 @@ type SearchArg<T extends PickQuerySelectable, As extends string> = {
3084
3079
  }) & ({
3085
3080
  text: string | Expression;
3086
3081
  } | {
3087
- in: MaybeArray<keyof T['__selectable']> | { [K in keyof T['__selectable']]?: SearchWeight };
3082
+ in: MaybeArray<keyof T['__selectable']> | { [K in keyof T['__selectable']]?: SearchWeight; };
3088
3083
  } | {
3089
- vector: { [K in keyof T['__selectable']]: T['__selectable'][K]['column']['dataType'] extends 'tsvector' ? K : never }[keyof T['__selectable']];
3084
+ vector: { [K in keyof T['__selectable']]: T['__selectable'][K]['column']['dataType'] extends 'tsvector' ? K : never; }[keyof T['__selectable']];
3090
3085
  }) & ({
3091
3086
  query: string | Expression;
3092
3087
  } | {
@@ -3295,7 +3290,7 @@ interface OperatorsCount extends OperatorsNumber {
3295
3290
  }
3296
3291
  type CountColumn = Column.Pick.QueryColumnOfTypeAndOps<'int8', number, OperatorsCount>;
3297
3292
  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>>;
3293
+ 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
3294
  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
3295
  type NullableNumberReturn<T, DataType> = SetQueryReturnsColumnOrThrow<T, Column.Pick.QueryColumnOfTypeAndOps<DataType, number | null, OperatorsNumber>> & OperatorsNumber;
3301
3296
  type BooleanQueryColumn = Column.Pick.QueryColumnOfTypeAndOps<'bool', boolean, OperatorsBoolean>;
@@ -3313,9 +3308,9 @@ interface RecordSelectableOrExpression<T extends PickQuerySelectable> {
3313
3308
  }
3314
3309
  type NullableJSONObjectReturn<T extends PickQuerySelectable, Obj extends RecordSelectableOrExpression<T>> = SetQueryReturnsColumnOrThrow<T, {
3315
3310
  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;
3311
+ __type: { [K in keyof Obj]: ExpressionOutput<T, Obj[K]>['__type']; } | null;
3312
+ __outputType: { [K in keyof Obj]: ExpressionOutput<T, Obj[K]>['__outputType']; } | null;
3313
+ __queryType: { [K in keyof Obj]: ExpressionOutput<T, Obj[K]>['__queryType']; } | null;
3319
3314
  operators: OperatorsAny;
3320
3315
  }> & OperatorsAny;
3321
3316
  type StringColumn$1 = Column.Pick.QueryColumnOfTypeAndOps<string, string, OperatorsText>;
@@ -3324,7 +3319,8 @@ type NullableStringReturn<T> = SetQueryReturnsColumnOrThrow<T, StringNullable> &
3324
3319
  interface AggregateArgTypes {
3325
3320
  minMax: 'citext' | 'date' | 'float4' | 'float8' | 'inet' | 'int2' | 'int4' | 'int8' | 'interval' | 'money' | 'numeric' | 'text' | 'time' | 'timestamp' | 'timestamptz';
3326
3321
  sum: 'float4' | 'float8' | 'int2' | 'int4' | 'int8' | 'interval' | 'money' | 'numeric';
3327
- avg: // unlike sum, avg has no money
3322
+ avg:
3323
+ // unlike sum, avg has no money
3328
3324
  'float4' | 'float8' | 'int2' | 'int4' | 'int8' | 'interval' | 'numeric';
3329
3325
  bit: 'bit' | 'int2' | 'int4' | 'int8';
3330
3326
  bool: 'bool';
@@ -3742,11 +3738,11 @@ declare class OrExpression extends Expression<BooleanQueryColumn> {
3742
3738
  interface QueryReturnsFnAdd<T extends PickQueryColumTypes> extends PickQueryHasSelect {
3743
3739
  type<C extends Column.Pick.QueryColumn>(fn: (types: T['columnTypes']) => C): { [K in keyof T]: K extends 'result' ? {
3744
3740
  value: C;
3745
- } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<C['__outputType']> : T[K] } & C['operators'];
3741
+ } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<C['__outputType']> : T[K]; } & C['operators'];
3746
3742
  }
3747
3743
  type SetQueryReturnsFn<T extends PickQueryColumTypes, C extends Column.Pick.OutputType> = { [K in keyof T]: K extends 'result' ? {
3748
3744
  value: C;
3749
- } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<C['__outputType']> : T[K] } & QueryReturnsFnAdd<T>;
3745
+ } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<C['__outputType']> : T[K]; } & QueryReturnsFnAdd<T>;
3750
3746
  declare class QueryExpressions {
3751
3747
  /**
3752
3748
  * `column` references a table column, this can be used in raw SQL or when building a column expression.
@@ -3839,7 +3835,7 @@ declare class QueryExpressions {
3839
3835
  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
3836
  columns: (keyof T['__selectable'])[];
3841
3837
  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'] } | {
3838
+ }> : T['__selectable'][K]['column']['__queryType'] | null | { [O in keyof T['__selectable'][K]['column']['operators']]?: T['__selectable'][K]['column']['operators'][O]['_opType']; } | {
3843
3839
  result: {
3844
3840
  value: {
3845
3841
  __queryType: T['__selectable'][K]['column']['__queryType'] | null;
@@ -3851,7 +3847,7 @@ type WhereArg<T extends PickQuerySelectableRelations> = { [K in keyof T['__selec
3851
3847
  __queryType: T['__selectable'][K]['column']['__queryType'] | null;
3852
3848
  };
3853
3849
  };
3854
- }) } | ((q: WhereQueryBuilder<T>) => QueryOrExpressionBooleanOrNullResult | WhereQueryBuilder<T>);
3850
+ }); } | ((q: WhereQueryBuilder<T>) => QueryOrExpressionBooleanOrNullResult | WhereQueryBuilder<T>);
3855
3851
  /**
3856
3852
  * Callback argument of `where`.
3857
3853
  * It has `where` methods (`where`, `whereNot`, `whereExists`, etc.),
@@ -3860,16 +3856,16 @@ type WhereArg<T extends PickQuerySelectableRelations> = { [K in keyof T['__selec
3860
3856
  * db.table.where((q) => q.relation.count().equals(10))
3861
3857
  * ```
3862
3858
  */
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 };
3859
+ 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
3860
  type WhereArgs<T extends PickQuerySelectableRelations> = WhereArg<T>[];
3865
3861
  type WhereNotArgs<T extends PickQuerySelectableRelations> = [WhereArg<T>];
3866
3862
  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 } & {
3863
+ 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
3864
  length: Column extends {
3869
3865
  length: number;
3870
3866
  } ? Column['length'] : never;
3871
3867
  })[] | IsQuery | Expression;
3872
- type WhereInArg<T extends PickQuerySelectableRelations> = { [K in keyof T['__selectable']]?: Iterable<T['__selectable'][K]['column']['__queryType']> | IsQuery | Expression };
3868
+ type WhereInArg<T extends PickQuerySelectableRelations> = { [K in keyof T['__selectable']]?: Iterable<T['__selectable'][K]['column']['__queryType']> | IsQuery | Expression; };
3873
3869
  interface QueryHasWhere {
3874
3870
  __hasWhere: true;
3875
3871
  }
@@ -4508,7 +4504,7 @@ declare class Where {
4508
4504
  */
4509
4505
  orWhereNotExists<T extends PickQuerySelectableShapeRelationsWithDataAs, Arg extends JoinFirstArg<T>>(this: T, arg: Arg, ...args: JoinArgs<T, Arg>): T & QueryHasWhere;
4510
4506
  }
4511
- type QueryScopes<Keys extends string> = { [K in Keys]: unknown };
4507
+ type QueryScopes<Keys extends string> = { [K in Keys]: unknown; };
4512
4508
  interface ScopeArgumentQuery<Table extends string | undefined, Shape extends Column.QueryColumns> extends Where, PickQuerySelectableShapeRelationsWithData {
4513
4509
  __isQuery: true;
4514
4510
  table: Table;
@@ -4793,14 +4789,14 @@ declare namespace DefaultPrivileges {
4793
4789
  export {};
4794
4790
  }
4795
4791
  declare const DEFAULT_PRIVILEGE: {
4796
- OBJECT_TYPES: readonly ["TABLES", "SEQUENCES", "FUNCTIONS", "TYPES", "SCHEMAS", "LARGE_OBJECTS"];
4792
+ OBJECT_TYPES: readonly ['TABLES', 'SEQUENCES', 'FUNCTIONS', 'TYPES', 'SCHEMAS', 'LARGE_OBJECTS'];
4797
4793
  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"];
4794
+ TABLE: readonly ['ALL', 'SELECT', 'INSERT', 'UPDATE', 'DELETE', 'TRUNCATE', 'REFERENCES', 'TRIGGER', 'MAINTAIN'];
4795
+ SEQUENCE: readonly ['ALL', 'USAGE', 'SELECT', 'UPDATE'];
4796
+ FUNCTION: readonly ['ALL', 'EXECUTE'];
4797
+ TYPE: readonly ['ALL', 'USAGE'];
4798
+ SCHEMA: readonly ['ALL', 'USAGE', 'CREATE'];
4799
+ LARGE_OBJECT: readonly ['ALL', 'SELECT', 'UPDATE'];
4804
4800
  };
4805
4801
  };
4806
4802
  declare function getSupportedDefaultPrivileges(version: number): DefaultPrivileges.SupportedDefaultPrivileges;
@@ -4979,10 +4975,10 @@ interface QueryInternal<SinglePrimaryKey = any, UniqueColumns = any, UniqueColum
4979
4975
  */
4980
4976
  nestedCreateBatchMax: number;
4981
4977
  }
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];
4978
+ type ShapeHasPrimaryKeys<Shape extends Column.QueryColumnsInit> = { [K in keyof Shape]: Shape[K]['data']['primaryKey'] extends string ? K : never; }[keyof Shape];
4979
+ type TablePrimaryKeys<Shape extends Column.QueryColumnsInit> = ShapeHasPrimaryKeys<Shape> extends never ? never : { [K in ShapeHasPrimaryKeys<Shape>]: UniqueQueryTypeOrExpression<Shape[K]['__queryType']>; };
4980
+ 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];
4981
+ 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
4982
  type NoPrimaryKeyOption = 'error' | 'warning' | 'ignore';
4987
4983
  interface DbSharedOptions extends QueryLogOptions {
4988
4984
  autoPreparedStatements?: boolean;
@@ -5069,7 +5065,7 @@ interface DbTableOptions<ColumnTypes, Table extends string | undefined, Shape ex
5069
5065
  */
5070
5066
  nowSQL?: string;
5071
5067
  }
5072
- type DbTableOptionScopes<Table extends string | undefined, Shape extends Column.QueryColumns, Keys extends string = string> = { [K in Keys]: (q: ScopeArgumentQuery<Table, Shape>) => IsQuery };
5068
+ type DbTableOptionScopes<Table extends string | undefined, Shape extends Column.QueryColumns, Keys extends string = string> = { [K in Keys]: (q: ScopeArgumentQuery<Table, Shape>) => IsQuery; };
5073
5069
  interface QueryBuilder extends Query.NotReadOnlyQuery {
5074
5070
  returnType: undefined;
5075
5071
  }
@@ -5088,14 +5084,14 @@ declare class Db<Table extends string | undefined = undefined, Shape extends Col
5088
5084
  } ? true : undefined;
5089
5085
  __hasSelect: boolean;
5090
5086
  __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 };
5087
+ __defaults: { [K in { [K in keyof Shape]: Shape[K]['data']['default'] extends true ? K : never; }[keyof Shape]]: true; };
5088
+ __scopes: { [K in keyof MapTableScopesOption<Options>]: true; };
5093
5089
  __defaultSelect: ColumnsShape.DefaultSelectKeys<Shape>;
5094
5090
  baseQuery: Query;
5095
5091
  columns: (keyof Shape)[];
5096
5092
  __outputType: ColumnsShape.DefaultSelectOutput<Shape>;
5097
5093
  __inputType: ColumnsShape.Input<Shape>;
5098
- result: { [K in ColumnsShape.DefaultSelectKeys<Shape>]: Shape[K] };
5094
+ result: { [K in ColumnsShape.DefaultSelectKeys<Shape>]: Shape[K]; };
5099
5095
  returnType: undefined;
5100
5096
  then: QueryThenShallowSimplifyArr<ColumnsShape.DefaultOutput<Shape>>;
5101
5097
  windows: EmptyObject;
@@ -5105,7 +5101,7 @@ declare class Db<Table extends string | undefined = undefined, Shape extends Col
5105
5101
  relationQueries: EmptyObject;
5106
5102
  withData: EmptyObject;
5107
5103
  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>>;
5104
+ 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
5105
  catch: QueryCatch;
5110
5106
  shape: ComputedColumnsFromOptions<Shape, Options>;
5111
5107
  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']);
@@ -5279,15 +5275,7 @@ interface DbResult<ColumnTypes> extends Db<undefined, EmptyObject, never, Column
5279
5275
  * })
5280
5276
  * ```
5281
5277
  */
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>;
5278
+ declare const createDbWithAdapter: <SchemaConfig extends ColumnSchemaConfig = DefaultSchemaConfig, ColumnTypes = DefaultColumnTypes<SchemaConfig>>({ log, logger, snakeCase, schemaConfig: schemaConfigFn, columnTypes, schema, ...options }: DbOptionsWithAdapter<SchemaConfig, ColumnTypes>) => DbResult<ColumnTypes>;
5291
5279
  declare function _createDbSqlMethod<ColumnTypes>(columnTypes: ColumnTypes): DbSqlMethod<ColumnTypes>;
5292
5280
  declare const _initQueryBuilder: (adapter: Adapter, columnTypes: unknown, asyncStorage: AsyncLocalStorage<AsyncState>, commonOptions: DbTableOptions<unknown, undefined, Column.QueryColumns>, options: DbSharedOptions) => Db;
5293
5281
  type SQLQueryArgs = TemplateLiteralArgs | [RawSqlBase];
@@ -5667,7 +5655,7 @@ interface TopCTE {
5667
5655
  append: string[][];
5668
5656
  }
5669
5657
  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;
5658
+ declare const addTopCte: (place: 'before' | 'after', ctx: ToSQLCtx, q: SubQueryForSql, type: QueryData['type'], as?: string | ((as: string) => void), dontAddTableHook?: boolean) => string;
5671
5659
  /**
5672
5660
  * Function to turn the operator expression into SQL.
5673
5661
  *
@@ -5682,7 +5670,7 @@ interface OperatorToSQL {
5682
5670
  interface Operator<Value, Column extends Column.Pick.OutputTypeAndOperators = Column.Pick.OutputTypeAndOperators> {
5683
5671
  <T extends PickQueryResult>(this: T, arg: Value): { [K in Exclude<keyof T, keyof T['result']['value']['operators']>]: K extends 'result' ? {
5684
5672
  value: Column;
5685
- } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<Column['__outputType']> : T[K] } & Column['operators'];
5673
+ } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<Column['__outputType']> : T[K]; } & Column['operators'];
5686
5674
  _opType: Value;
5687
5675
  }
5688
5676
  interface Base$1<Value> {
@@ -5902,7 +5890,7 @@ interface OperatorsArray<T> extends Ord<T[]> {
5902
5890
  hasSome: Operator<T[] | IsQuery | Expression, BooleanQueryColumn>;
5903
5891
  containedIn: Operator<T[] | IsQuery | Expression, BooleanQueryColumn>;
5904
5892
  length: {
5905
- _opType: number | { [K in Exclude<keyof OperatorsNumber, '__hasSelect'>]?: OperatorsNumber[K]['_opType'] };
5893
+ _opType: number | { [K in Exclude<keyof OperatorsNumber, '__hasSelect'>]?: OperatorsNumber[K]['_opType']; };
5906
5894
  };
5907
5895
  }
5908
5896
  declare const Operators: {
@@ -5920,24 +5908,24 @@ interface ColumnsShape {
5920
5908
  [K: string]: Column;
5921
5909
  }
5922
5910
  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'] };
5911
+ export type DefaultSelectKeys<S extends Column.QueryColumnsInit> = { [K in keyof S]: S[K]['data']['explicitSelect'] extends true | undefined ? never : K; }[keyof S];
5912
+ export type DefaultOutput<Set extends Column.QueryColumnsInit> = { [K in DefaultSelectKeys<Set>]: Set[K]['__outputType']; };
5913
+ 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']; };
5914
+ export type InputPartial<Shape extends Column.QueryColumnsInit> = { [K in keyof Shape]?: Shape[K]['__inputType']; };
5915
+ export type Output<Shape extends Column.QueryColumns> = { [K in keyof Shape]: Shape[K]['__outputType']; };
5916
+ 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
5917
  export interface MapToObjectColumn<Shape extends Column.QueryColumns> {
5930
5918
  dataType: 'object';
5931
- __type: { [K in keyof Shape]: Shape[K]['__type'] };
5919
+ __type: { [K in keyof Shape]: Shape[K]['__type']; };
5932
5920
  __outputType: ShallowSimplify<ObjectOutput<Shape>>;
5933
- __queryType: { [K in keyof Shape]: Shape[K]['__queryType'] };
5921
+ __queryType: { [K in keyof Shape]: Shape[K]['__queryType']; };
5934
5922
  operators: OperatorsAny;
5935
5923
  }
5936
5924
  export interface MapToNullableObjectColumn<Shape extends Column.QueryColumns> {
5937
5925
  dataType: 'object';
5938
- __type: { [K in keyof Shape]: Shape[K]['__type'] };
5926
+ __type: { [K in keyof Shape]: Shape[K]['__type']; };
5939
5927
  __outputType: ShallowSimplify<ObjectOutput<Shape>> | undefined;
5940
- __queryType: { [K in keyof Shape]: Shape[K]['__queryType'] } | null;
5928
+ __queryType: { [K in keyof Shape]: Shape[K]['__queryType']; } | null;
5941
5929
  operators: OperatorsAny;
5942
5930
  }
5943
5931
  export interface MapToPluckColumn<Shape extends Column.QueryColumns> {
@@ -5949,12 +5937,12 @@ declare namespace ColumnsShape {
5949
5937
  }
5950
5938
  export interface MapToObjectArrayColumn<Shape extends Column.QueryColumns> {
5951
5939
  dataType: 'array';
5952
- __type: { [K in keyof Shape]: Shape[K]['__type'] }[];
5940
+ __type: { [K in keyof Shape]: Shape[K]['__type']; }[];
5953
5941
  __outputType: ShallowSimplify<ObjectOutput<Shape>>[];
5954
- __queryType: { [K in keyof Shape]: Shape[K]['__queryType'] }[];
5942
+ __queryType: { [K in keyof Shape]: Shape[K]['__queryType']; }[];
5955
5943
  operators: OperatorsAny;
5956
5944
  }
5957
- type ObjectOutput<Shape extends Column.QueryColumns> = { [K in keyof Shape]: Shape[K]['__outputType'] };
5945
+ type ObjectOutput<Shape extends Column.QueryColumns> = { [K in keyof Shape]: Shape[K]['__outputType']; };
5958
5946
  export {};
5959
5947
  }
5960
5948
  interface SelectSelf extends PickQuerySelectable, PickQueryHasSelect, PickQueryDefaultSelect, PickQueryShape, PickQueryRelations, PickQueryResult, PickQueryReturnType, PickQueryWithData {}
@@ -5962,7 +5950,7 @@ type SelectArgs<T extends SelectSelf> = ('*' | keyof T['__selectable'])[];
5962
5950
  interface SubQueryAddition<T extends PickQueryWithData> extends IsSubQuery {
5963
5951
  withData: T['withData'];
5964
5952
  }
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 };
5953
+ 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
5954
  interface SelectAsArg<T extends SelectSelf> {
5967
5955
  [K: string]: keyof T['__selectable'] | Expression | ((q: SelectAsFnArg<T>) => unknown);
5968
5956
  }
@@ -5974,10 +5962,10 @@ interface SelectAsCheckReturnTypes {
5974
5962
  [K: string]: PropertyKey | Expression | ((q: never) => SelectAsFnReturnType);
5975
5963
  }
5976
5964
  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] };
5965
+ 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]; };
5966
+ 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}`;
5967
+ 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,
5968
+ ? { [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
5969
  interface AllowedRelationOneQueryForSelectable extends IsSubQuery {
5982
5970
  result: Column.QueryColumns;
5983
5971
  returnType: 'value' | 'valueOrThrow' | 'one' | 'oneOrThrow';
@@ -5985,7 +5973,7 @@ interface AllowedRelationOneQueryForSelectable extends IsSubQuery {
5985
5973
  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
5974
  as: C;
5987
5975
  column: R['returnType'] extends 'value' | 'valueOrThrow' ? R['result']['value'] : R['result'][C & keyof R['result']];
5988
- } } : never }[keyof Obj]>;
5976
+ }; } : never; }[keyof Obj]>;
5989
5977
  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
5978
  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
5979
  declare function _querySelect<T extends SelectSelf, Columns extends SelectArgs<T>>(q: T, columns: Columns): SelectResult<T, Columns>;
@@ -6091,15 +6079,6 @@ type QueryDataTransform = QueryDataTransformFn | {
6091
6079
  interface QueryDataTransformFn {
6092
6080
  (data: unknown, queryData: unknown): unknown;
6093
6081
  }
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
6082
  declare class QueryTransform {
6104
6083
  /**
6105
6084
  * Transform the result of the query right after loading it.
@@ -6158,7 +6137,7 @@ declare class QueryTransform {
6158
6137
  then: QueryThen<infer Data>;
6159
6138
  } ? Data : never, queryData: QueryData) => Result): { [K in keyof T]: K extends 'returnType' ? 'valueOrThrow' : K extends 'result' ? {
6160
6139
  value: Column.Pick.QueryColumnOfType<Result>;
6161
- } : K extends 'then' ? QueryThen<Result> : T[K] };
6140
+ } : K extends 'then' ? QueryThen<Result> : T[K]; };
6162
6141
  }
6163
6142
  type SelectableOrExpression<T extends PickQuerySelectable = PickQuerySelectable, C extends Column.Pick.QueryColumn = Column.Pick.QueryColumn> = '*' | keyof T['__selectable'] | Expression<C>;
6164
6143
  type SelectableOrExpressions<T extends PickQuerySelectable = PickQuerySelectable, C extends Column.Pick.QueryColumn = Column.Pick.QueryColumn> = ('*' | keyof T['__selectable'] | Expression<C>)[];
@@ -6216,7 +6195,8 @@ declare abstract class ExpressionTypeMethod {
6216
6195
  expr?: Expression;
6217
6196
  };
6218
6197
  columnTypes: unknown;
6219
- }, C extends Column.Pick.QueryColumn>(this: T, fn: (types: T['columnTypes']) => C): // Omit is optimal
6198
+ }, C extends Column.Pick.QueryColumn>(this: T, fn: (types: T['columnTypes']) => C):
6199
+ // Omit is optimal
6220
6200
  Omit<T, 'result'> & {
6221
6201
  result: {
6222
6202
  value: C;
@@ -6545,7 +6525,7 @@ declare class QueryTransaction {
6545
6525
  */
6546
6526
  recoverable<T>(this: T): T;
6547
6527
  }
6548
- type AfterHook<Select extends PropertyKey[], Shape extends Column.QueryColumns> = QueryAfterHook<{ [K in Select[number]]: K extends keyof Shape ? Shape[K]['__outputType'] : never }[]>;
6528
+ type AfterHook<Select extends PropertyKey[], Shape extends Column.QueryColumns> = QueryAfterHook<{ [K in Select[number]]: K extends keyof Shape ? Shape[K]['__outputType'] : never; }[]>;
6549
6529
  type HookSelectArg<T extends PickQueryShape> = (keyof T['shape'] & string)[];
6550
6530
  declare const _hookSelectColumns: (query: Query, columns: string[], asFn: (as: string[]) => void) => void;
6551
6531
  declare class QueryHookUtils<T extends PickQueryInputType> {
@@ -6553,10 +6533,10 @@ declare class QueryHookUtils<T extends PickQueryInputType> {
6553
6533
  columns: string[];
6554
6534
  private key;
6555
6535
  constructor(query: IsQuery, columns: string[], key: 'hookCreateSet' | 'hookUpdateSet');
6556
- set: (data: { [K in keyof T["__inputType"]]?: T["__inputType"][K] | (() => QueryOrExpression<T["__inputType"][K]>) }) => void;
6536
+ set: (data: { [K in keyof T['__inputType']]?: T['__inputType'][K] | (() => QueryOrExpression<T['__inputType'][K]>); }) => void;
6557
6537
  }
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;
6538
+ declare const _queryHookAfterCreate: (q: PickQueryShape, select: HookSelectArg<PickQueryShape>, cb: AfterHook<HookSelectArg<PickQueryShape>, Column.QueryColumns>) => PickQueryShape;
6539
+ declare const _queryHookAfterUpdate: (q: PickQueryShape, select: HookSelectArg<PickQueryShape>, cb: AfterHook<HookSelectArg<PickQueryShape>, PickQueryShape['shape']>) => PickQueryShape;
6560
6540
  declare abstract class QueryHooks {
6561
6541
  /**
6562
6542
  * Run the function before any kind of query.
@@ -6706,7 +6686,7 @@ interface ColumnDataSelectSqlProp {
6706
6686
  interface SelectSqlCallback {
6707
6687
  (column: ColumnRefExpression<Column.Pick.QueryColumn>): Expression;
6708
6688
  }
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] };
6689
+ 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
6690
  declare namespace Column {
6711
6691
  export interface IsPrimaryKey<Name extends string> {
6712
6692
  data: {
@@ -6718,10 +6698,10 @@ declare namespace Column {
6718
6698
  unique: Name;
6719
6699
  };
6720
6700
  };
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] };
6701
+ 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]; };
6702
+ 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]; };
6703
+ export type QueryColumnToNullable<C> = { [K in keyof C]: K extends '__outputType' | '__queryType' ? C[K] | null : C[K]; };
6704
+ export type QueryColumnToOptional<C> = { [K in keyof C]: K extends '__outputType' ? C[K] | undefined : C[K]; };
6725
6705
  interface DataNullable {
6726
6706
  isNullable: true;
6727
6707
  optional: true;
@@ -6732,18 +6712,18 @@ declare namespace Column {
6732
6712
  isDistinctFrom: Operator<Column['__queryType'] | null, Column>;
6733
6713
  isNotDistinctFrom: Operator<Column['__queryType'] | null, Column>;
6734
6714
  }
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] };
6715
+ export type Encode<T, InputSchema, Input> = { [K in keyof T]: K extends '__inputType' ? Input : K extends 'inputSchema' ? InputSchema : T[K]; };
6716
+ 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]; };
6717
+ 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
6718
  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] };
6719
+ type DefaultSelectData<T extends Column.Data, Value> = { [K in keyof T]: K extends 'explicitSelect' ? Value extends true ? false : true : T[K]; };
6720
+ 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
6721
  export interface IsAppReadOnly {
6742
6722
  data: {
6743
6723
  appReadOnly: true;
6744
6724
  };
6745
6725
  }
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] };
6726
+ 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]; };
6747
6727
  export namespace Pick {
6748
6728
  interface Data {
6749
6729
  data: Column.Data;
@@ -6985,7 +6965,7 @@ declare namespace Column {
6985
6965
  export {};
6986
6966
  }
6987
6967
  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;
6968
+ declare const setColumnData: <T extends Column.Pick.Data, K extends keyof T['data']>(q: T, key: K, value: T['data'][K]) => T;
6989
6969
  declare const setDataValue: <T extends Column.Pick.Data, Key extends string, Value>(item: T, key: Key, value: Value, params?: Column.Error.StringOrMessage) => T;
6990
6970
  declare function setCurrentColumnName(name: string): void;
6991
6971
  declare const consumeColumnName: () => string | undefined;
@@ -7307,13 +7287,13 @@ declare abstract class Column {
7307
7287
  narrowAllTypes: this['__schema']['narrowAllTypes'];
7308
7288
  input<T extends {
7309
7289
  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] };
7290
+ }, InputSchema extends this['__schema']['__schemaType']>(this: T, fn: (schema: T['inputSchema']) => InputSchema): { [K in keyof T]: K extends 'inputSchema' ? InputSchema : T[K]; };
7311
7291
  output<T extends {
7312
7292
  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] };
7293
+ }, OutputSchema extends this['__schema']['__schemaType']>(this: T, fn: (schema: T['outputSchema']) => OutputSchema): { [K in keyof T]: K extends 'outputSchema' ? OutputSchema : T[K]; };
7314
7294
  query<T extends {
7315
7295
  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] };
7296
+ }, QuerySchema extends this['__schema']['__schemaType']>(this: T, fn: (schema: T['querySchema']) => QuerySchema): { [K in keyof T]: K extends 'querySchema' ? QuerySchema : T[K]; };
7317
7297
  /**
7318
7298
  * Set a database column name.
7319
7299
  *
@@ -7788,15 +7768,7 @@ type CreateManyFromResult<T extends CreateSelf> = T extends {
7788
7768
  isCount: true;
7789
7769
  } ? T : T['returnType'] extends 'one' | 'oneOrThrow' ? SetQueryReturnsAll<T> : T['returnType'] extends 'value' | 'valueOrThrow' ? SetValueQueryReturnsPluckColumn<T> : T;
7790
7770
  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>;
7771
+ declare const _queryCreateManyFrom: <T extends CreateSelf, Q extends QueryReturningOne>(q: T, query: Q, data: Omit<CreateData<T>, keyof Q['result']>[]) => CreateManyFromResult<T>;
7800
7772
  declare class QueryCreateFrom {
7801
7773
  /**
7802
7774
  * Inserts a single record based on a query that selects a single record.
@@ -7952,9 +7924,9 @@ declare class QueryCreateFrom {
7952
7924
  interface CreateSelf extends PickQueryHasSelect, PickQueryDefaults, PickQueryResult, PickQueryRelations, PickQueryRelationsDataForCreate, PickQueryRelationsDataForCreateOptional, PickQueryWithData, PickQueryReturnType, PickQueryShape, PickQueryUniqueProperties, PickQueryInputType, Query.Pick.IsNotReadOnly {}
7953
7925
  type CreateData<T extends CreateSelf> = EmptyObject extends T['relations'] ? CreateDataWithDefaults<T, keyof T['__defaults']> : CreateRelationsData<T>;
7954
7926
  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 {
7927
+ 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; };
7928
+ 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; };
7929
+ type WritableForeignKeys<T extends CreateSelf, AllFKeys extends PropertyKey> = AllFKeys extends (infer K) ? K extends keyof T['shape'] ? T['shape'][K] extends {
7958
7930
  data: {
7959
7931
  makeColumnWritable: true;
7960
7932
  };
@@ -7962,8 +7934,8 @@ type WritableForeignKeys<T extends CreateSelf, AllFKeys extends PropertyKey> = A
7962
7934
  type CreateColumn<T extends CreateSelf, K extends keyof T['__inputType']> = T['__inputType'][K] | ((q: T) => QueryOrExpression<T['__inputType'][K]>);
7963
7935
  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
7936
  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;
7937
+ 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;
7938
+ 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
7939
  type CreateResult<T extends CreateSelf, Data> = T extends {
7968
7940
  isCount: true;
7969
7941
  } ? 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 +7950,12 @@ type InsertManyResult<T extends CreateSelf> = T['__hasSelect'] extends true ? T[
7978
7950
  *
7979
7951
  * The same should work as well with any non-null columns passed to `create`, but it's to be implemented later.
7980
7952
  */
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] };
7953
+ 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
7954
  type IgnoreResult<T extends CreateSelf> = T['returnType'] extends 'oneOrThrow' ? QueryTakeOptional<T> : T['returnType'] extends 'valueOrThrow' ? SetQueryReturnsColumnOptional<T, T['result']['value']> : T;
7983
7955
  type OnConflictArg<T extends PickQueryUniqueProperties> = T['internal']['uniqueColumnNames'] | T['internal']['uniqueColumnTuples'] | Expression | {
7984
7956
  constraint: T['internal']['uniqueConstraints'];
7985
7957
  };
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] };
7958
+ 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
7959
  /**
7988
7960
  * Used by ORM to access the context of current create query.
7989
7961
  * Is passed to the `create` method of a {@link VirtualColumn}
@@ -8274,7 +8246,7 @@ declare class QueryCreate {
8274
8246
  */
8275
8247
  onConflictDoNothing<T extends CreateSelf, Arg extends OnConflictArg<T>>(this: T, arg?: Arg): IgnoreResult<T>;
8276
8248
  }
8277
- type OnConflictSet$1<T extends CreateSelf> = { [K in keyof T['__inputType']]?: T['__inputType'][K] | (() => QueryOrExpression<T['__inputType'][K]>) };
8249
+ type OnConflictSet$1<T extends CreateSelf> = { [K in keyof T['__inputType']]?: T['__inputType'][K] | (() => QueryOrExpression<T['__inputType'][K]>); };
8278
8250
  declare class OnConflictQueryBuilder<T extends CreateSelf, Arg extends OnConflictArg<T> | undefined> {
8279
8251
  private query;
8280
8252
  private onConflict;
@@ -8343,11 +8315,11 @@ declare class OnConflictQueryBuilder<T extends CreateSelf, Arg extends OnConflic
8343
8315
  }): T;
8344
8316
  }
8345
8317
  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'] };
8318
+ 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
8319
  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
8320
  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 };
8321
+ 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']];
8322
+ type ChangeCountArg<T extends UpdateSelf> = NumericColumns<T> | { [K in NumericColumns<T>]?: T['shape'][K]['__type'] extends number | null ? number : number | string | bigint; };
8351
8323
  interface UpdateManyBySelf extends UpdateSelf {
8352
8324
  internal: {
8353
8325
  uniqueColumns: unknown;
@@ -8356,10 +8328,10 @@ interface UpdateManyBySelf extends UpdateSelf {
8356
8328
  uniqueConstraints: unknown;
8357
8329
  };
8358
8330
  }
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 })[];
8331
+ 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
8332
  type UpdateManyByKeys<T extends UpdateManyBySelf> = T['internal']['uniqueColumnNames'] | T['internal']['uniqueColumnTuples'];
8361
8333
  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 })[];
8334
+ 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
8335
  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
8336
  declare const _queryUpdate: <T extends UpdateSelf>(updateSelf: T, arg: UpdateArg<T>) => UpdateResult<T>;
8365
8337
  declare const _queryUpdateOrThrow: <T extends UpdateSelf>(q: T, arg: UpdateArg<T>) => UpdateResult<T>;
@@ -8847,7 +8819,7 @@ type ComputedColumnsFromOptions<Shape, Options> = Options extends {
8847
8819
  result: {
8848
8820
  value: infer Value extends Column.Pick.QueryColumn;
8849
8821
  };
8850
- }) ? Value : never : never } : Shape;
8822
+ }) ? Value : never : never; } : Shape;
8851
8823
  interface ComputedOptionsConfig {
8852
8824
  [K: string]: QueryOrExpression<unknown> | ReturnsQueryOrExpression<unknown>;
8853
8825
  }
@@ -8862,12 +8834,12 @@ interface RuntimeComputedQueryColumn<OutputType> extends Column.Pick.QueryColumn
8862
8834
  };
8863
8835
  }
8864
8836
  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): {
8837
+ computeAtRuntime<Deps extends keyof Shape, OutputType>(dependsOn: Deps[], fn: (record: { [K in keyof Shape & Deps]: Shape[K]['__outputType']; }) => OutputType): {
8866
8838
  result: {
8867
8839
  value: RuntimeComputedQueryColumn<OutputType>;
8868
8840
  };
8869
8841
  };
8870
- computeBatchAtRuntime<Deps extends keyof Shape, OutputType>(dependsOn: Deps[], fn: (record: { [K in keyof Shape & Deps]: Shape[K]['__outputType'] }[]) => MaybePromise<OutputType[]>): {
8842
+ computeBatchAtRuntime<Deps extends keyof Shape, OutputType>(dependsOn: Deps[], fn: (record: { [K in keyof Shape & Deps]: Shape[K]['__outputType']; }[]) => MaybePromise<OutputType[]>): {
8871
8843
  result: {
8872
8844
  value: RuntimeComputedQueryColumn<OutputType>;
8873
8845
  };
@@ -8891,7 +8863,7 @@ interface QueryComputedArg<ColumnTypes, Shape extends Column.QueryColumns> exten
8891
8863
  __selectable: { [K in keyof Shape]: {
8892
8864
  as: string;
8893
8865
  column: Column.Pick.QueryColumn;
8894
- } };
8866
+ }; };
8895
8867
  }
8896
8868
  type WhereItem = {
8897
8869
  [K: string]: unknown | {
@@ -9001,6 +8973,7 @@ interface QueryData extends QueryDataAliases, PickQueryDataParsers, HasHookSelec
9001
8973
  returningMany?: boolean;
9002
8974
  wrapInTransaction?: boolean;
9003
8975
  throwOnNotFound?: boolean;
8976
+ cteThrowOnNotFound?: boolean;
9004
8977
  ensureCount?: number;
9005
8978
  with?: WithItems;
9006
8979
  withShapes?: WithConfigs;
@@ -9200,13 +9173,13 @@ interface ToSQLQuery extends IsQuery {
9200
9173
  }
9201
9174
  interface FromQuerySelf extends PickQuerySelectable, PickQueryShape, PickQueryReturnType, PickQueryWithData, PickQueryAs, PickQueryHasSelect {}
9202
9175
  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}`]: {
9176
+ 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
9177
  as: K;
9205
9178
  column: T['withData'][A]['shape'][K];
9206
- } } : never : A extends PickQueryResultAs ? { [K in keyof A['result'] & string as `${A['__as']}.${K}`]: K extends string ? {
9179
+ }; } : never : A extends PickQueryResultAs ? { [K in keyof A['result'] & string as `${A['__as']}.${K}`]: K extends string ? {
9207
9180
  as: K;
9208
9181
  column: A['result'][K];
9209
- } : never } : never> : T[K] } : T;
9182
+ } : never; } : never> : T[K]; } : T;
9210
9183
  declare class FromMethods {
9211
9184
  /**
9212
9185
  * Set the `FROM` value, by default the table name is used.
@@ -9283,11 +9256,11 @@ interface CteQueryBuilder<T extends PickQueryWithDataColumnTypes> extends Query
9283
9256
  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
9257
  table: Name;
9285
9258
  shape: Q['result'];
9286
- } : K extends keyof T['withData'] ? T['withData'][K] : never } : T[K] };
9259
+ } : K extends keyof T['withData'] ? T['withData'][K] : never; } : T[K]; };
9287
9260
  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
9261
  table: Name;
9289
9262
  shape: Shape;
9290
- } : K extends keyof T['withData'] ? T['withData'][K] : never } : T[K] };
9263
+ } : K extends keyof T['withData'] ? T['withData'][K] : never; } : T[K]; };
9291
9264
  declare const _prependWith: (q: Query, name: string | ((as: string) => void), queryArg: PickQueryResult | ((q: CteQueryBuilder<PickQueryWithDataColumnTypes>) => PickQueryResult)) => Query;
9292
9265
  declare class CteQuery {
9293
9266
  /**
@@ -9478,8 +9451,8 @@ declare class CteQuery {
9478
9451
  * .where({ n: { gt: 10 } });
9479
9452
  * ```
9480
9453
  */
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;
9454
+ 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;
9455
+ 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
9456
  /**
9484
9457
  * Use `withSql` to add a Common Table Expression (CTE) based on a custom SQL.
9485
9458
  *
@@ -9539,7 +9512,7 @@ declare class CteQuery {
9539
9512
  type UnionArgs<T extends PickQueryResult> = ({
9540
9513
  result: { [K in keyof T['result']]: {
9541
9514
  __queryType: T['result'][K]['__queryType'];
9542
- } };
9515
+ }; };
9543
9516
  } | ((q: T) => Expression))[];
9544
9517
  declare class Union {
9545
9518
  /**
@@ -9731,7 +9704,7 @@ declare class Having {
9731
9704
  */
9732
9705
  havingSql<T>(this: T, ...args: SQLQueryArgs): T;
9733
9706
  }
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 };
9707
+ 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
9708
  type UpsertResult<T extends PickQueryHasSelectResultReturnType> = T['__hasSelect'] extends true ? T['returnType'] extends 'value' | 'valueOrThrow' ? SetValueQueryReturnsValueOrThrow<T> : SetQueryReturnsOne<T> : SetQueryReturnsVoid<T>;
9736
9709
  interface UpsertThis extends UpdateSelf, CreateSelf {
9737
9710
  __hasWhere: true;
@@ -9898,7 +9871,7 @@ interface QueryPluckSelf extends PickQuerySelectable, PickQueryRelationsWithData
9898
9871
  type PluckArg<T extends QueryPluckSelf> = SelectableOrExpression<T> | ((q: SelectAsFnArg<T>) => Expression | Query.Pick.SingleValueResult);
9899
9872
  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
9873
  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;
9874
+ } : K extends 'returnType' ? 'pluck' : K extends 'then' ? QueryThen<R['result']['value']['__outputType'][]> : T[K]; } : never : S extends SelectableOrExpression<T> ? SetQueryReturnsPluck<T, S> : never;
9902
9875
  declare class QueryPluck {
9903
9876
  /**
9904
9877
  * `.pluck` returns a single array of a single selected column values:
@@ -9912,7 +9885,7 @@ declare class QueryPluck {
9912
9885
  pluck<T extends QueryPluckSelf, S extends PluckArg<T>>(this: T, select: S): PluckResult<T, S>;
9913
9886
  }
9914
9887
  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] };
9888
+ 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
9889
  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
9890
  declare class MergeQueryMethods {
9918
9891
  merge<T extends MergeQueryArg, Q extends MergeQueryArg>(this: T, q: Q): MergeQuery<T, Q>;
@@ -9966,7 +9939,7 @@ declare class QueryMap {
9966
9939
  then: QueryThen<(infer Data)[]>;
9967
9940
  } ? (input: Data, index: number, arr: Data[]) => Result : never : T extends {
9968
9941
  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' ? {
9942
+ } ? (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
9943
  pluck: Column.Pick.QueryColumnOfType<Result>;
9971
9944
  } : T['returnType'] extends QueryReturnTypeOptional ? {
9972
9945
  value: Column.Pick.QueryColumnOfType<Result | undefined>;
@@ -9978,7 +9951,7 @@ declare class QueryMap {
9978
9951
  } : K extends 'then' ? QueryThen<T['returnType'] extends QueryReturnTypeAll | 'pluck' ? Result[] : T['returnType'] extends QueryReturnTypeOptional ? Result | undefined : T extends {
9979
9952
  returnType: 'valueOrThrow';
9980
9953
  then: QueryThen<unknown | null>;
9981
- } ? Result | null : Result> : T[K] };
9954
+ } ? Result | null : Result> : T[K]; };
9982
9955
  }
9983
9956
  type OrCreateArg<Data> = Data | (() => Data);
9984
9957
  declare function _orCreate<T extends PickQueryHasSelectResultReturnType>(query: T, data: unknown | FnUnknownToUnknown, updateData?: unknown, mergeData?: unknown): UpsertResult<T>;
@@ -10164,7 +10137,7 @@ declare class QueryExistsMethods {
10164
10137
  */
10165
10138
  notExists<T extends QueryGetSelf>(this: T): SetQueryReturnsColumnOrThrow<T, BooleanQueryColumn>;
10166
10139
  }
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)[];
10140
+ 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
10141
  interface QueryHelperQuery<T extends PickQuerySelectableShapeAs> extends MergeQueryArg {
10169
10142
  returnType: QueryReturnType;
10170
10143
  __selectable: Omit<T['__selectable'], `${T['__as']}.${Extract<keyof T['shape'], string>}`>;
@@ -10193,15 +10166,15 @@ type QueryHelperResult<T extends IsQueryHelper> = T['__result'];
10193
10166
  interface NarrowTypeSelf extends PickQueryResultReturnType {
10194
10167
  returnType: undefined | 'all' | 'one' | 'oneOrThrow' | 'value' | 'valueOrThrow' | 'pluck';
10195
10168
  }
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];
10169
+ 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
10170
  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] };
10171
+ value: { [K in keyof T['result']['value']]: K extends '__outputType' ? Narrow : T['result']['value'][K]; };
10199
10172
  }
10200
10173
  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] };
10174
+ pluck: { [K in keyof T['result']['pluck']]: K extends '__outputType' ? Narrow extends unknown[] ? Narrow[number] : Narrow : T['result']['pluck'][K]; };
10202
10175
  }
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>;
10176
+ 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]; };
10177
+ 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
10178
  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
10179
  declare class QueryMethods<ColumnTypes> {
10207
10180
  /**
@@ -10642,14 +10615,14 @@ declare class QueryMethods<ColumnTypes> {
10642
10615
  */
10643
10616
  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
10617
  __outputType: Narrow[K];
10645
- } } : K extends 'then' ? QueryThenByQuery<T, T['result'] & { [K in keyof Narrow]: {
10618
+ }; } : K extends 'then' ? QueryThenByQuery<T, T['result'] & { [K in keyof Narrow]: {
10646
10619
  __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';
10620
+ }; }> : 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
10621
  if<T extends PickQueryResultReturnType, R extends PickQueryResult>(this: T, condition: boolean | null | undefined, fn: (q: T) => R & {
10649
10622
  returnType: T['returnType'];
10650
10623
  }): QueryIfResult<T, R>;
10651
10624
  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'];
10625
+ 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
10626
  }
10654
10627
  interface DbExtension {
10655
10628
  name: string;
@@ -10674,10 +10647,10 @@ interface DbDomainArgRecord {
10674
10647
  type SelectableFromShape<Shape extends Column.QueryColumns, Table extends string | undefined> = { [K in keyof Shape]: {
10675
10648
  as: K;
10676
10649
  column: Shape[K];
10677
- } } & { [K in keyof Shape & string as `${Table}.${K}`]: {
10650
+ }; } & { [K in keyof Shape & string as `${Table}.${K}`]: {
10678
10651
  as: K;
10679
10652
  column: Shape[K];
10680
- } };
10653
+ }; };
10681
10654
  type QueryReturnType = QueryReturnTypeAll | 'one' | 'oneOrThrow' | 'rows' | 'pluck' | 'value' | 'valueOrThrow' | 'void';
10682
10655
  type QueryReturnTypeAll = undefined | 'all';
10683
10656
  type QueryReturnTypeOptional = 'one' | 'value';
@@ -10760,52 +10733,52 @@ declare namespace Query {
10760
10733
  }
10761
10734
  }
10762
10735
  }
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']];
10736
+ 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
10737
  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] };
10738
+ type SetQueryReturnsAll<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'all' : K extends 'then' ? QueryThenShallowSimplifyArr<ColumnsShape.Output<T['result']>> : T[K]; } & QueryHasWhere;
10739
+ 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;
10740
+ 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]; };
10741
+ type QueryManyTakeOptional<T extends PickQueryResultReturnType> = { [K in keyof T]: K extends 'returnType' ? 'one' : K extends 'then' ? QueryThenShallowSimplifyOptional<ColumnsShape.Output<T['result']>> : T[K]; };
10742
+ 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]; };
10743
+ 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]; };
10744
+ type QueryManyTake<T extends PickQueryResultReturnType> = { [K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'then' ? QueryThenShallowSimplify<ColumnsShape.Output<T['result']>> : T[K]; };
10745
+ type SetQueryReturnsOne<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'then' ? QueryThenShallowSimplify<ColumnsShape.Output<T['result']>> : T[K]; };
10746
+ 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]; };
10747
+ 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
10748
  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
10749
  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' ? {
10750
+ } : 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
10751
  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] };
10752
+ } : K extends 'returnType' ? 'pluck' : K extends 'then' ? QueryThen<(S extends Expression ? S['result']['value']['__outputType'] : never)[]> : T[K]; };
10780
10753
  type SetValueQueryReturnsPluckColumn<T extends PickQueryResult> = { [K in keyof T]: K extends 'result' ? {
10781
10754
  pluck: T['result']['value'];
10782
- } : K extends 'returnType' ? 'pluck' : K extends 'then' ? QueryThen<T['result']['value']['__outputType'][]> : T[K] } & QueryHasSelect;
10755
+ } : K extends 'returnType' ? 'pluck' : K extends 'then' ? QueryThen<T['result']['value']['__outputType'][]> : T[K]; } & QueryHasSelect;
10783
10756
  type SetQueryReturnsPluckColumnResult<T extends PickQueryResult, Result extends Column.QueryColumns> = { [K in keyof T]: K extends 'result' ? {
10784
10757
  pluck: T['result']['value'];
10785
- } : K extends 'returnType' ? 'pluck' : K extends 'result' ? Result : K extends 'then' ? QueryThen<T['result']['value']['__outputType'][]> : T[K] } & QueryHasSelect;
10758
+ } : K extends 'returnType' ? 'pluck' : K extends 'result' ? Result : K extends 'then' ? QueryThen<T['result']['value']['__outputType'][]> : T[K]; } & QueryHasSelect;
10786
10759
  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']>;
10760
+ type SetValueQueryReturnsValueOrThrow<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<T['result']['value']['__outputType']> : T[K]; };
10761
+ 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
10762
  type SetQueryReturnsColumnOrThrow<T, Column extends Column.Pick.OutputType> = { [K in keyof T]: K extends 'result' ? {
10790
10763
  value: Column;
10791
- } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<Column['__outputType']> : T[K] } & QueryHasSelect;
10764
+ } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<Column['__outputType']> : T[K]; } & QueryHasSelect;
10792
10765
  type SetQueryReturnsColumnOptional<T, Column extends Column.Pick.OutputType> = { [K in keyof T]: K extends 'result' ? {
10793
10766
  value: Column;
10794
- } : K extends 'returnType' ? 'value' : K extends 'then' ? QueryThen<Column['__outputType'] | undefined> : T[K] } & QueryHasSelect;
10767
+ } : K extends 'returnType' ? 'value' : K extends 'then' ? QueryThen<Column['__outputType'] | undefined> : T[K]; } & QueryHasSelect;
10795
10768
  type SetQueryReturnsColumn<T extends PickQueryResult> = { [K in keyof T]: K extends 'result' ? {
10796
10769
  value: T['result']['pluck'];
10797
- } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<T['result']['pluck']['__outputType']> : T[K] } & QueryHasSelect;
10770
+ } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<T['result']['pluck']['__outputType']> : T[K]; } & QueryHasSelect;
10798
10771
  type SetQueryReturnsColumnResult<T extends PickQueryResult, Result extends Column.QueryColumns> = { [K in keyof T]: K extends 'result' ? {
10799
10772
  value: T['result']['pluck'];
10800
- } : K extends 'returnType' ? 'valueOrThrow' : K extends 'result' ? Result : K extends 'then' ? QueryThen<Result['pluck']['__outputType']> : T[K] } & QueryHasSelect;
10773
+ } : K extends 'returnType' ? 'valueOrThrow' : K extends 'result' ? Result : K extends 'then' ? QueryThen<Result['pluck']['__outputType']> : T[K]; } & QueryHasSelect;
10801
10774
  type SetQueryReturnsRowCount<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'valueOrThrow' : K extends 'result' ? {
10802
10775
  value: Column.Pick.QueryColumnOfType<number>;
10803
- } : K extends 'then' ? QueryThen<number> : T[K] };
10776
+ } : K extends 'then' ? QueryThen<number> : T[K]; };
10804
10777
  type SetQueryReturnsRowCountMany<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'pluck' : K extends 'result' ? {
10805
10778
  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] };
10779
+ } : K extends 'then' ? QueryThen<number> : T[K]; };
10780
+ type SetQueryReturnsVoid<T> = { [K in keyof T]: K extends 'returnType' ? 'void' : K extends 'then' ? QueryThen<void> : T[K]; };
10781
+ 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
10782
  interface ReturnsQueryOrExpression<T> {
10810
10783
  (): QueryOrExpression<T>;
10811
10784
  }
@@ -10977,7 +10950,7 @@ interface QueryDataAliases extends PickQueryDataAliases {
10977
10950
  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
10951
  as: K;
10979
10952
  column: T['shape'][K];
10980
- } } : K extends '__as' ? As : T[K] };
10953
+ }; } : K extends '__as' ? As : T[K]; };
10981
10954
  type AsQueryArg = PickQuerySelectableShapeAs;
10982
10955
  /** getters **/
10983
10956
  declare const getQueryAs: (q: {
@@ -11041,7 +11014,7 @@ declare const escapeString: (value: string) => string;
11041
11014
  * Sets query kind to 'columnInfo', returns a single value (may return undefined),
11042
11015
  * the value is a {@link GetColumnInfo} object or a Record with keys for column names and ColumnInfo objects as values.
11043
11016
  **/
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'> & {
11017
+ 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
11018
  result: {
11046
11019
  value: Column.Pick.QueryColumnOfType<Result>;
11047
11020
  };
@@ -11174,4 +11147,4 @@ declare const testTransaction: {
11174
11147
  */
11175
11148
  close(arg: Arg$1): Promise<void>;
11176
11149
  };
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 };
11150
+ 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 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 };