pqb 0.72.0 → 0.72.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,7 @@
1
- import { Adapter, AdapterClass, AdapterConfigBase, AdapterParams, AdapterSchemaConfigOptions, AfterCommitStandaloneHook, AfterHook, ArrayColumn, ArrayColumnValue, ArrayData, AsyncState, BaseNumberData, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BoxColumn, ByteaColumn, CidrColumn, CircleColumn, CitextColumn, Code, Codes, Column, ColumnFromDbParams, ColumnSchemaConfig, ColumnSchemaGetterColumns, ColumnSchemaGetterTableClass, ColumnToCodeCtx, ColumnTypeSchemaArg, ColumnsByType, ColumnsShape, ComputedColumnsFromOptions, ComputedOptionsConfig, ComputedOptionsFactory, CreateCtx, CreateData, CreateManyMethodsNames, CreateMethodsNames, CreateSelf, CustomTypeColumn, DateColumn, DateColumnData, DbDomainArg, DbExtension, DbOptions, DbResult, DbSharedOptions, DbSqlMethod, DbStructureDomainsMap, DbTableOptionScopes, DbTableOptions, DecimalColumn, DecimalColumnData, DefaultColumnTypes, DefaultPrivileges, DefaultSchemaConfig, DeleteMethodsNames, DomainColumn, DoublePrecisionColumn, DriverAdapter, DynamicRawSQL, EmptyObject, EmptyTuple, EnumColumn, Expression, ExpressionData, FromArg, FromResult, GeneratorIgnore, HookSelectValue, InetColumn, IntegerColumn, IntervalColumn, IsQuery, IsolationLevel, JSONColumn, JSONTextColumn, JoinedShapes, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, MapTableScopesOption, MaybeArray, MaybePromise, MergeQuery, MoneyColumn, NoPrimaryKeyOption, NonUniqDataItem, NumberColumnData, Operators, OperatorsArray, OperatorsJson, OperatorsOrdinalText, OperatorsText, Ord, PathColumn, PickQueryInputType, PickQueryInternal, PickQueryQ, PickQueryRelations, PickQuerySelectableRelations, PickQueryShape, PointColumn, PolygonColumn, PostgisGeographyPointColumn, QueryAfterHook, QueryBeforeActionHook, QueryBeforeHook, QueryData, QueryHasWhere, QueryHookUtils, QueryHooks, QueryInternal, QueryLogObject, QueryLogOptions, QueryLogger, QueryManyTake, QueryManyTakeOptional, QueryOrExpression, QueryResult, QueryResultRow, QueryReturnType, QuerySchema, QueryScopes, RawSql, RawSqlBase, RealColumn, RecordKeyTrue, RecordOptionalString, RecordString, RecordStringOrNumber, RecordUnknown, RelationConfigBase, RelationJoinQuery, RelationsBase, Rls, RlsPolicy, SchemaConfigFnWithOptions, SearchWeight, SelectableFromShape, SerialColumn, SerialColumnData, ShallowSimplify, ShapeUniqueColumns, SingleSql, SingleSqlItem, SmallIntColumn, SmallSerialColumn, Sql, SqlFn, SqlSessionState, StorageOptions, StringColumn, StringData, TableData, TableDataFn, TableDataInput, TableDataItem, TableDataItemsUniqueColumnTuples, TableDataItemsUniqueColumns, TableDataItemsUniqueConstraints, TableDataMethods, TemplateLiteralArgs, TextColumn, TimeColumn, TimestampColumn, TimestampTZColumn, Timestamps, ToSQLCtx, ToSqlValues, TransactionAdapter, TransactionAdapterClass, TransactionOptions, TsQueryColumn, TsVectorColumn, UUIDColumn, UniqueConstraints, UniqueTableDataItem, UnknownColumn, UpdateData, UpsertData, UpsertThis, VarCharColumn, VirtualColumn, 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, deepCompare, defaultSchemaConfig, emptyArray, emptyObject, escapeForMigration, escapeString, excludeInnerToCode, excludeToCode, exhaustive, getCallerFilePath, getClonedQueryData, getColumnBaseType, 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, returnArg, setColumnData, setColumnEncode, setColumnParse, setColumnParseNull, setCurrentColumnName, setDataValue, setDefaultLanguage, setFreeAlias, setQueryObjectValueImmutable, singleQuote, sqlToRawSql, tableDataMethods, toArray, toCamelCase, toPascalCase, toSnakeCase, wrapAdapterFnWithConnectRetry } from "./index.d.ts";
1
+ import { Adapter, AdapterClass, AdapterConfigBase, AdapterParams, AdapterSchemaConfigOptions, AfterCommitStandaloneHook, AfterHook, ArrayColumn, ArrayColumnValue, ArrayData, AsyncState, BaseNumberData, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BoxColumn, BrandColumn, BrandColumnsShape, ByteaColumn, CidrColumn, CircleColumn, CitextColumn, Code, Codes, Column, ColumnFromDbParams, ColumnRefExpression, ColumnSchemaConfig, ColumnSchemaGetterColumns, ColumnSchemaGetterTableClass, ColumnToCodeCtx, ColumnTypeSchemaArg, ColumnsByType, ColumnsShape, ComputedColumnsFromOptions, ComputedOptionsConfig, ComputedOptionsFactory, CreateCtx, CreateData, CreateManyMethodsNames, CreateMethodsNames, CreateSelf, CustomTypeColumn, DateColumn, DateColumnData, DateColumnInput, DbDomainArg, DbExtension, DbOptions, DbResult, DbSharedOptions, DbSqlMethod, DbStructureDomainsMap, DbTableOptionScopes, DbTableOptions, DecimalColumn, DecimalColumnData, DefaultColumnTypes, DefaultPrivileges, DefaultSchemaConfig, DeleteMethodsNames, DomainColumn, DoublePrecisionColumn, DriverAdapter, DynamicRawSQL, EmptyObject, EmptyTuple, EnumColumn, Expression, ExpressionData, FromArg, FromResult, GeneratorIgnore, HookSelectValue, InetColumn, IntegerColumn, IntervalColumn, IsQuery, IsolationLevel, JSONColumn, JSONTextColumn, JoinedShapes, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, MapTableScopesOption, MaybeArray, MaybePromise, MergeQuery, MoneyColumn, NoPrimaryKeyOption, NonUniqDataItem, NumberColumnData, Operators, OperatorsArray, OperatorsDate, OperatorsJson, OperatorsNumber, OperatorsOrdinalText, OperatorsText, Ord, PathColumn, PickQueryInputType, PickQueryInternal, PickQueryQ, PickQueryRelations, PickQuerySelectableRelations, PickQueryShape, PointColumn, PolygonColumn, PostgisGeographyPointColumn, QueryAfterHook, QueryBeforeActionHook, QueryBeforeHook, QueryData, QueryHasWhere, QueryHookUtils, QueryHooks, QueryInternal, QueryLogObject, QueryLogOptions, QueryLogger, QueryManyTake, QueryManyTakeOptional, QueryOrExpression, QueryResult, QueryResultRow, QueryReturnType, QuerySchema, QueryScopes, RawSql, RawSqlBase, RealColumn, RecordKeyTrue, RecordOptionalString, RecordString, RecordStringOrNumber, RecordUnknown, RelationConfigBase, RelationJoinQuery, RelationsBase, Rls, RlsPolicy, SchemaConfigFnWithOptions, SearchWeight, SelectSqlColumn, SelectableFromShape, SerialColumn, SerialColumnData, ShallowSimplify, ShapeUniqueColumns, SingleSql, SingleSqlItem, SmallIntColumn, SmallSerialColumn, Sql, SqlFn, SqlSessionState, StaticSQLArgs, StorageOptions, StringColumn, StringData, TableData, TableDataFn, TableDataInput, TableDataItem, TableDataItemsUniqueColumnTuples, TableDataItemsUniqueColumns, TableDataItemsUniqueConstraints, TableDataMethods, TemplateLiteralArgs, TextColumn, TimeColumn, TimestampColumn, TimestampTZColumn, Timestamps, ToSQLCtx, ToSqlValues, TransactionAdapter, TransactionAdapterClass, TransactionOptions, TsQueryColumn, TsVectorColumn, UUIDColumn, UniqueConstraints, UniqueTableDataItem, UnknownColumn, UpdateData, UpsertData, UpsertThis, VarCharColumn, VirtualColumn, 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, deepCompare, defaultSchemaConfig, emptyArray, emptyObject, escapeForMigration, escapeString, excludeInnerToCode, excludeToCode, exhaustive, getCallerFilePath, getClonedQueryData, getColumnBaseType, 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, returnArg, setColumnData, setColumnEncode, setColumnParse, setColumnParseNull, setCurrentColumnName, setDataValue, setDefaultLanguage, setFreeAlias, setQueryObjectValueImmutable, singleQuote, sqlToRawSql, tableDataMethods, toArray, toCamelCase, toPascalCase, toSnakeCase, wrapAdapterFnWithConnectRetry } from "./index.d.ts";
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
+ import "node:util";
4
+ import "tagged-tag";
3
5
  type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends ((x: infer I) => void) ? I : never;
4
6
  type MaybeArray$1<T> = T | T[];
5
7
  type MaybePromise$1<T> = T | Promise<T>;
@@ -15,7 +17,7 @@ interface RecordOptionalString$1 {
15
17
  interface RecordUnknown$1 {
16
18
  [K: string]: unknown;
17
19
  }
18
- type ShallowSimplify$1<T> = T extends any ? { [K in keyof T]: T[K] } : T;
20
+ type ShallowSimplify$1<T> = T extends any ? { [K in keyof T]: T[K]; } : T;
19
21
  type EmptyObject$1 = {};
20
22
  type EmptyTuple$1 = [];
21
23
  interface RelationJoinQuery$1 {
@@ -61,24 +63,24 @@ interface ColumnsShape$1 {
61
63
  [K: string]: Column$1;
62
64
  }
63
65
  declare namespace ColumnsShape$1 {
64
- export type DefaultSelectKeys<S extends Column$1.QueryColumnsInit> = { [K in keyof S]: S[K]['data']['explicitSelect'] extends true | undefined ? never : K }[keyof S];
65
- export type DefaultOutput<Set extends Column$1.QueryColumnsInit> = { [K in DefaultSelectKeys<Set>]: Set[K]['__outputType'] };
66
- export type Input<Shape extends Column$1.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'] };
67
- export type InputPartial<Shape extends Column$1.QueryColumnsInit> = { [K in keyof Shape]?: Shape[K]['__inputType'] };
68
- export type Output<Shape extends Column$1.QueryColumns> = { [K in keyof Shape]: Shape[K]['__outputType'] };
69
- export type DefaultSelectOutput<Shape extends Column$1.QueryColumnsInit> = { [K in { [K in keyof Shape]: Shape[K]['data']['explicitSelect'] extends true | undefined ? never : K }[keyof Shape]]: Shape[K]['__outputType'] };
66
+ export type DefaultSelectKeys<S extends Column$1.QueryColumnsInit> = { [K in keyof S]: S[K]['data']['explicitSelect'] extends true | undefined ? never : K; }[keyof S];
67
+ export type DefaultOutput<Set extends Column$1.QueryColumnsInit> = { [K in DefaultSelectKeys<Set>]: Set[K]['__outputType']; };
68
+ export type Input<Shape extends Column$1.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']; };
69
+ export type InputPartial<Shape extends Column$1.QueryColumnsInit> = { [K in keyof Shape]?: Shape[K]['__inputType']; };
70
+ export type Output<Shape extends Column$1.QueryColumns> = { [K in keyof Shape]: Shape[K]['__outputType']; };
71
+ export type DefaultSelectOutput<Shape extends Column$1.QueryColumnsInit> = { [K in { [K in keyof Shape]: Shape[K]['data']['explicitSelect'] extends true | undefined ? never : K; }[keyof Shape]]: Shape[K]['__outputType']; };
70
72
  export interface MapToObjectColumn<Shape extends Column$1.QueryColumns> {
71
73
  dataType: 'object';
72
- __type: { [K in keyof Shape]: Shape[K]['__type'] };
74
+ __type: { [K in keyof Shape]: Shape[K]['__type']; };
73
75
  __outputType: ShallowSimplify$1<ObjectOutput<Shape>>;
74
- __queryType: { [K in keyof Shape]: Shape[K]['__queryType'] };
76
+ __queryType: { [K in keyof Shape]: Shape[K]['__queryType']; };
75
77
  operators: OperatorsAny;
76
78
  }
77
79
  export interface MapToNullableObjectColumn<Shape extends Column$1.QueryColumns> {
78
80
  dataType: 'object';
79
- __type: { [K in keyof Shape]: Shape[K]['__type'] };
81
+ __type: { [K in keyof Shape]: Shape[K]['__type']; };
80
82
  __outputType: ShallowSimplify$1<ObjectOutput<Shape>> | undefined;
81
- __queryType: { [K in keyof Shape]: Shape[K]['__queryType'] } | null;
83
+ __queryType: { [K in keyof Shape]: Shape[K]['__queryType']; } | null;
82
84
  operators: OperatorsAny;
83
85
  }
84
86
  export interface MapToPluckColumn<Shape extends Column$1.QueryColumns> {
@@ -90,12 +92,12 @@ declare namespace ColumnsShape$1 {
90
92
  }
91
93
  export interface MapToObjectArrayColumn<Shape extends Column$1.QueryColumns> {
92
94
  dataType: 'array';
93
- __type: { [K in keyof Shape]: Shape[K]['__type'] }[];
95
+ __type: { [K in keyof Shape]: Shape[K]['__type']; }[];
94
96
  __outputType: ShallowSimplify$1<ObjectOutput<Shape>>[];
95
- __queryType: { [K in keyof Shape]: Shape[K]['__queryType'] }[];
97
+ __queryType: { [K in keyof Shape]: Shape[K]['__queryType']; }[];
96
98
  operators: OperatorsAny;
97
99
  }
98
- type ObjectOutput<Shape extends Column$1.QueryColumns> = { [K in keyof Shape]: Shape[K]['__outputType'] };
100
+ type ObjectOutput<Shape extends Column$1.QueryColumns> = { [K in keyof Shape]: Shape[K]['__outputType']; };
99
101
  export {};
100
102
  }
101
103
  declare abstract class OrchidOrmError extends Error {}
@@ -129,7 +131,7 @@ declare abstract class QueryError<T extends PickQueryShape$1 = PickQueryShape$1>
129
131
  line: string | undefined;
130
132
  routine: string | undefined;
131
133
  get isUnique(): boolean;
132
- get columns(): { [K in keyof T["shape"]]?: true | undefined };
134
+ get columns(): { [K in keyof T["shape"]]?: true | undefined; };
133
135
  }
134
136
  declare class CannotMutateReadOnlyTableError extends OrchidOrmInternalError {
135
137
  constructor(query: IsQuery$1);
@@ -222,6 +224,10 @@ interface PostgresInterval {
222
224
  milliseconds: number;
223
225
  }
224
226
  interface ColumnSchemaGetterTableClass$1 {
227
+ data?: {
228
+ table: string | undefined;
229
+ name: string | undefined;
230
+ };
225
231
  prototype: {
226
232
  columns: {
227
233
  shape: Column$1.Shape.ForValidation;
@@ -348,7 +354,7 @@ type WithSelectable<W extends WithDataItem> = keyof W['shape'] | `${W['table']}.
348
354
  * The first argument of all `join` and `joinLateral` methods.
349
355
  * See argument of {@link join}.
350
356
  */
351
- type JoinFirstArg<T extends PickQueryRelationsWithData> = PickQueryResultAs | keyof T['relations'] | keyof T['withData'] | ((q: { [K in keyof T['relations']]: T['relations'][K]['query'] }) => PickQueryResultAs) | FnPickQueryResultAs;
357
+ type JoinFirstArg<T extends PickQueryRelationsWithData> = PickQueryResultAs | keyof T['relations'] | keyof T['withData'] | ((q: { [K in keyof T['relations']]: T['relations'][K]['query']; }) => PickQueryResultAs) | FnPickQueryResultAs;
352
358
  interface FnPickQueryResultAs {
353
359
  (): PickQueryResultAs;
354
360
  }
@@ -356,7 +362,7 @@ interface FnPickQueryResultAs {
356
362
  * Arguments of `join` methods (not `joinLateral`).
357
363
  * See {@link join}
358
364
  */
359
- type JoinArgs<T extends PickQuerySelectableShapeRelationsWithDataAs, Arg extends JoinFirstArg<T>> = Arg extends PickQueryResultAs ? [conditions: { [K in JoinSelectable<Arg>]: keyof T['__selectable'] | Expression$1 } | Expression$1] | [leftColumn: JoinSelectable<Arg> | Expression$1, rightColumn: keyof T['__selectable'] | Expression$1] | [leftColumn: JoinSelectable<Arg> | Expression$1, op: string, rightColumn: keyof T['__selectable'] | Expression$1] : Arg extends keyof T['withData'] ? JoinWithArgs<T, T['withData'][Arg]> : EmptyTuple$1;
365
+ type JoinArgs<T extends PickQuerySelectableShapeRelationsWithDataAs, Arg extends JoinFirstArg<T>> = Arg extends PickQueryResultAs ? [conditions: { [K in JoinSelectable<Arg>]: keyof T['__selectable'] | Expression$1; } | Expression$1] | [leftColumn: JoinSelectable<Arg> | Expression$1, rightColumn: keyof T['__selectable'] | Expression$1] | [leftColumn: JoinSelectable<Arg> | Expression$1, op: string, rightColumn: keyof T['__selectable'] | Expression$1] : Arg extends keyof T['withData'] ? JoinWithArgs<T, T['withData'][Arg]> : EmptyTuple$1;
360
366
  /**
361
367
  * Column names of the joined table that can be used to join.
362
368
  * Derived from 'result', not from 'shape',
@@ -367,16 +373,16 @@ type JoinArgs<T extends PickQuerySelectableShapeRelationsWithDataAs, Arg extends
367
373
  * And the selection becomes available to use in the `ON` and to select from the joined table.
368
374
  */
369
375
  type JoinSelectable<Q extends PickQueryResultAs> = keyof Q['result'] | `${Q['__as']}.${keyof Q['result'] & string}`;
370
- type JoinWithArgs<T extends PickQuerySelectable, Arg extends WithDataItem> = [conditions: { [K in WithSelectable<Arg>]: keyof T['__selectable'] | Expression$1 } | Expression$1] | [leftColumn: WithSelectable<Arg> | Expression$1, rightColumn: keyof T['__selectable'] | Expression$1] | [leftColumn: WithSelectable<Arg> | Expression$1, op: string, rightColumn: keyof T['__selectable'] | Expression$1];
371
- type JoinResultRequireMain<T extends PickQuerySelectable, JoinedSelectable> = { [K in keyof T]: K extends '__selectable' ? T['__selectable'] & JoinedSelectable : T[K] };
376
+ type JoinWithArgs<T extends PickQuerySelectable, Arg extends WithDataItem> = [conditions: { [K in WithSelectable<Arg>]: keyof T['__selectable'] | Expression$1; } | Expression$1] | [leftColumn: WithSelectable<Arg> | Expression$1, rightColumn: keyof T['__selectable'] | Expression$1] | [leftColumn: WithSelectable<Arg> | Expression$1, op: string, rightColumn: keyof T['__selectable'] | Expression$1];
377
+ type JoinResultRequireMain<T extends PickQuerySelectable, JoinedSelectable> = { [K in keyof T]: K extends '__selectable' ? T['__selectable'] & JoinedSelectable : T[K]; };
372
378
  /**
373
379
  * Result of all `join` methods, not `joinLateral`.
374
380
  * Adds joined table columns from its 'result' to the '__selectable' of the query.
375
381
  */
376
- type JoinResult<T extends PickQuerySelectableRelationsResultReturnType, Joined extends PickQuerySelectableRelations$1, 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']]: {
382
+ type JoinResult<T extends PickQuerySelectableRelationsResultReturnType, Joined extends PickQuerySelectableRelations$1, 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']]: {
377
383
  as: T['__selectable'][K]['as'];
378
384
  column: Column$1.QueryColumnToNullable<T['__selectable'][K]['column']>;
379
- } } & Joined['__selectable'] : K extends 'result' ? { [K in keyof T['result']]: Column$1.QueryColumnToNullable<T['result'][K]> } : K extends 'then' ? QueryThenByQuery<T, { [K in keyof T['result']]: Column$1.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] };
385
+ }; } & Joined['__selectable'] : K extends 'result' ? { [K in keyof T['result']]: Column$1.QueryColumnToNullable<T['result'][K]>; } : K extends 'then' ? QueryThenByQuery<T, { [K in keyof T['result']]: Column$1.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]; };
380
386
  /**
381
387
  * Calls {@link JoinResult} with either callback result, if join has a callback,
382
388
  * or with a query derived from the first join argument.
@@ -415,8 +421,8 @@ type JoinResultSelectable<Result extends Column$1.QueryColumns, As extends strin
415
421
  } : {
416
422
  as: K;
417
423
  column: Result[K];
418
- } };
419
- relations: { [K in keyof JoinedRelations & string as `${As}.${K}`]: JoinedRelations[K] };
424
+ }; };
425
+ relations: { [K in keyof JoinedRelations & string as `${As}.${K}`]: JoinedRelations[K]; };
420
426
  } : {
421
427
  __selectable: { [K in '*' | (keyof Result & string) as `${As}.${K}`]: K extends '*' ? {
422
428
  as: As;
@@ -424,10 +430,10 @@ type JoinResultSelectable<Result extends Column$1.QueryColumns, As extends strin
424
430
  } : {
425
431
  as: K;
426
432
  column: Column$1.QueryColumnToNullable<Result[K]>;
427
- } };
428
- relations: { [K in keyof JoinedRelations & string as `${As}.${K}`]: JoinedRelations[K] };
433
+ }; };
434
+ relations: { [K in keyof JoinedRelations & string as `${As}.${K}`]: JoinedRelations[K]; };
429
435
  };
430
- type JoinAddSelectable<T extends PickQuerySelectable, Joined extends PickQuerySelectableRelations$1> = { [K in keyof T]: K extends '__selectable' ? T['__selectable'] & Joined['__selectable'] : T[K] };
436
+ type JoinAddSelectable<T extends PickQuerySelectable, Joined extends PickQuerySelectableRelations$1> = { [K in keyof T]: K extends '__selectable' ? T['__selectable'] & Joined['__selectable'] : T[K]; };
431
437
  /**
432
438
  * Map the first argument of `join` or `joinLateral` to a query type.
433
439
  *
@@ -438,7 +444,7 @@ type JoinAddSelectable<T extends PickQuerySelectable, Joined extends PickQuerySe
438
444
  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}`]: {
439
445
  as: K;
440
446
  column: T['withData'][Arg]['shape'][K];
441
- } } : 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;
447
+ }; } : 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;
442
448
  interface JoinArgToQueryCallback {
443
449
  (...args: any[]): IsQuery$1;
444
450
  }
@@ -1071,19 +1077,16 @@ declare class QueryJoin {
1071
1077
  joinData<T extends PickQuerySelectableColumnTypes, As extends string, RecordType extends Column$1.QueryColumnsInit, Item extends ColumnsShape$1.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}`]: {
1072
1078
  as: K;
1073
1079
  column: RecordType[K];
1074
- } } : T[K] };
1080
+ }; } : T[K]; };
1075
1081
  }
1076
1082
  type OnArgs<S extends QuerySelectable> = [leftColumn: keyof S, rightColumn: keyof S] | [leftColumn: keyof S, op: string, rightColumn: keyof S];
1077
1083
  type OnJsonPathEqualsArgs<S extends QuerySelectable> = [leftColumn: keyof S, leftPath: string, rightColumn: keyof S, rightPath: string];
1078
- /**
1079
- * Mutative {@link OnMethods.prototype.on}
1080
- */
1081
1084
  /**
1082
1085
  * Argument of join callback.
1083
1086
  * It is a query object of table that you're joining, with ability to select main table's columns.
1084
1087
  * Adds {@link OnMethods.prototype.on} method and similar to the query.
1085
1088
  */
1086
- type JoinQueryBuilder<T extends PickQuerySelectableShape, J extends PickQuerySelectableResultAs> = { [K in keyof J | keyof OnMethods]: K extends '__selectable' ? SelectableFromShape$1<J['result'], J['__as']> & Omit<T['__selectable'], keyof T['shape']> : K extends keyof OnMethods ? OnMethods[K] : K extends keyof J ? J[K] : never };
1089
+ type JoinQueryBuilder<T extends PickQuerySelectableShape, J extends PickQuerySelectableResultAs> = { [K in keyof J | keyof OnMethods]: K extends '__selectable' ? SelectableFromShape$1<J['result'], J['__as']> & Omit<T['__selectable'], keyof T['shape']> : K extends keyof OnMethods ? OnMethods[K] : K extends keyof J ? J[K] : never; };
1087
1090
  declare class OnMethods {
1088
1091
  /**
1089
1092
  * Use `on` to specify columns to join records.
@@ -1122,7 +1125,7 @@ declare class OnMethods {
1122
1125
  */
1123
1126
  onJsonPathEquals<T extends PickQuerySelectable>(this: T, ...args: OnJsonPathEqualsArgs<T['__selectable']>): T;
1124
1127
  }
1125
- declare class ColumnRefExpression<T extends Column$1.Pick.QueryColumn> extends Expression$1<T> {
1128
+ declare class ColumnRefExpression$1<T extends Column$1.Pick.QueryColumn> extends Expression$1<T> {
1126
1129
  name: string;
1127
1130
  result: {
1128
1131
  value: T;
@@ -1200,10 +1203,10 @@ interface QueryDataSources {
1200
1203
  }
1201
1204
  declare namespace Order {
1202
1205
  export interface ArgThis extends PickQuerySelectable, PickQueryResult, PickQueryTsQuery {}
1203
- export type Arg<T extends ArgThis> = ArgKey<T> | ArgTsQuery<T> | { [K in ArgKey<T> | ArgTsQuery<T>]?: K extends ArgTsQuery<T> ? OrderTsQueryConfig : SortDir } | Expression$1;
1206
+ export type Arg<T extends ArgThis> = ArgKey<T> | ArgTsQuery<T> | { [K in ArgKey<T> | ArgTsQuery<T>]?: K extends ArgTsQuery<T> ? OrderTsQueryConfig : SortDir; } | Expression$1;
1204
1207
  export type Args<T extends ArgThis> = Arg<T>[];
1205
1208
  type ArgTsQuery<T extends ArgThis> = string | undefined extends T['__tsQuery'] ? never : Exclude<T['__tsQuery'], undefined>;
1206
- 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']];
1209
+ 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']];
1207
1210
  export {};
1208
1211
  }
1209
1212
  declare class QueryOrder {
@@ -1264,7 +1267,7 @@ interface WindowArgDeclaration<T extends Order.ArgThis = Order.ArgThis> {
1264
1267
  order?: Order.Arg<T>;
1265
1268
  }
1266
1269
  type WindowResult<T, W extends RecordUnknown$1> = T & {
1267
- windows: { [K in keyof W]: true };
1270
+ windows: { [K in keyof W]: true; };
1268
1271
  };
1269
1272
  declare class QueryWindow {
1270
1273
  /**
@@ -1392,9 +1395,9 @@ type SearchArg<T extends PickQuerySelectable, As extends string> = {
1392
1395
  }) & ({
1393
1396
  text: string | Expression$1;
1394
1397
  } | {
1395
- in: MaybeArray$1<keyof T['__selectable']> | { [K in keyof T['__selectable']]?: SearchWeight$1 };
1398
+ in: MaybeArray$1<keyof T['__selectable']> | { [K in keyof T['__selectable']]?: SearchWeight$1; };
1396
1399
  } | {
1397
- vector: { [K in keyof T['__selectable']]: T['__selectable'][K]['column']['dataType'] extends 'tsvector' ? K : never }[keyof T['__selectable']];
1400
+ vector: { [K in keyof T['__selectable']]: T['__selectable'][K]['column']['dataType'] extends 'tsvector' ? K : never; }[keyof T['__selectable']];
1398
1401
  }) & ({
1399
1402
  query: string | Expression$1;
1400
1403
  } | {
@@ -1598,14 +1601,14 @@ declare class SearchMethods {
1598
1601
  */
1599
1602
  search<T extends PickQuerySelectable, As extends string>(this: T, arg: SearchArg<T, As>): WhereSearchResult<T, As>;
1600
1603
  }
1601
- interface OperatorsCount extends OperatorsNumber {
1604
+ interface OperatorsCount extends OperatorsNumber$1 {
1602
1605
  isCount: true;
1603
1606
  }
1604
1607
  type CountColumn = Column$1.Pick.QueryColumnOfTypeAndOps<'int8', number, OperatorsCount>;
1605
1608
  type CountReturn<T> = SetQueryReturnsColumnOrThrow<T, CountColumn> & OperatorsCount;
1606
- 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$1<Column$1.Pick.QueryColumnOfDataType<DataType>>;
1607
- type NumericReturn<T extends PickQuerySelectable, Arg> = Arg extends keyof T['__selectable'] ? SetQueryReturnsColumnOrThrow<T, Column$1.Pick.QueryColumnOfTypeAndOps<T['__selectable'][Arg]['column']['dataType'], T['__selectable'][Arg]['column']['__type'] | null, OperatorsNumber>> & OperatorsNumber : Arg extends Expression$1 ? SetQueryReturnsColumnOrThrow<T, Column$1.Pick.QueryColumnOfTypeAndOps<Arg['result']['value']['dataType'], Arg['result']['value']['__type'] | null, OperatorsNumber>> & OperatorsNumber : never;
1608
- type NullableNumberReturn<T, DataType> = SetQueryReturnsColumnOrThrow<T, Column$1.Pick.QueryColumnOfTypeAndOps<DataType, number | null, OperatorsNumber>> & OperatorsNumber;
1609
+ 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$1<Column$1.Pick.QueryColumnOfDataType<DataType>>;
1610
+ type NumericReturn<T extends PickQuerySelectable, Arg> = Arg extends keyof T['__selectable'] ? SetQueryReturnsColumnOrThrow<T, Column$1.Pick.QueryColumnOfTypeAndOps<T['__selectable'][Arg]['column']['dataType'], T['__selectable'][Arg]['column']['__type'] | null, OperatorsNumber$1>> & OperatorsNumber$1 : Arg extends Expression$1 ? SetQueryReturnsColumnOrThrow<T, Column$1.Pick.QueryColumnOfTypeAndOps<Arg['result']['value']['dataType'], Arg['result']['value']['__type'] | null, OperatorsNumber$1>> & OperatorsNumber$1 : never;
1611
+ type NullableNumberReturn<T, DataType> = SetQueryReturnsColumnOrThrow<T, Column$1.Pick.QueryColumnOfTypeAndOps<DataType, number | null, OperatorsNumber$1>> & OperatorsNumber$1;
1609
1612
  type BooleanQueryColumn = Column$1.Pick.QueryColumnOfTypeAndOps<'bool', boolean, OperatorsBoolean>;
1610
1613
  type BooleanNullable = Column$1.Pick.QueryColumnOfTypeAndOps<'bool', boolean | null, OperatorsBoolean>;
1611
1614
  type NullableBooleanReturn<T> = SetQueryReturnsColumnOrThrow<T, BooleanNullable> & OperatorsBoolean;
@@ -1621,9 +1624,9 @@ interface RecordSelectableOrExpression<T extends PickQuerySelectable> {
1621
1624
  }
1622
1625
  type NullableJSONObjectReturn<T extends PickQuerySelectable, Obj extends RecordSelectableOrExpression<T>> = SetQueryReturnsColumnOrThrow<T, {
1623
1626
  dataType: 'json';
1624
- __type: { [K in keyof Obj]: ExpressionOutput<T, Obj[K]>['__type'] } | null;
1625
- __outputType: { [K in keyof Obj]: ExpressionOutput<T, Obj[K]>['__outputType'] } | null;
1626
- __queryType: { [K in keyof Obj]: ExpressionOutput<T, Obj[K]>['__queryType'] } | null;
1627
+ __type: { [K in keyof Obj]: ExpressionOutput<T, Obj[K]>['__type']; } | null;
1628
+ __outputType: { [K in keyof Obj]: ExpressionOutput<T, Obj[K]>['__outputType']; } | null;
1629
+ __queryType: { [K in keyof Obj]: ExpressionOutput<T, Obj[K]>['__queryType']; } | null;
1627
1630
  operators: OperatorsAny;
1628
1631
  }> & OperatorsAny;
1629
1632
  type StringColumn$2 = Column$1.Pick.QueryColumnOfTypeAndOps<string, string, OperatorsText$1>;
@@ -1632,7 +1635,8 @@ type NullableStringReturn<T> = SetQueryReturnsColumnOrThrow<T, StringNullable> &
1632
1635
  interface AggregateArgTypes {
1633
1636
  minMax: 'citext' | 'date' | 'float4' | 'float8' | 'inet' | 'int2' | 'int4' | 'int8' | 'interval' | 'money' | 'numeric' | 'text' | 'time' | 'timestamp' | 'timestamptz';
1634
1637
  sum: 'float4' | 'float8' | 'int2' | 'int4' | 'int8' | 'interval' | 'money' | 'numeric';
1635
- avg: // unlike sum, avg has no money
1638
+ avg:
1639
+ // unlike sum, avg has no money
1636
1640
  'float4' | 'float8' | 'int2' | 'int4' | 'int8' | 'interval' | 'numeric';
1637
1641
  bit: 'bit' | 'int2' | 'int4' | 'int8';
1638
1642
  bool: 'bool';
@@ -2050,11 +2054,11 @@ declare class OrExpression extends Expression$1<BooleanQueryColumn> {
2050
2054
  interface QueryReturnsFnAdd<T extends PickQueryColumTypes> extends PickQueryHasSelect {
2051
2055
  type<C extends Column$1.Pick.QueryColumn>(fn: (types: T['columnTypes']) => C): { [K in keyof T]: K extends 'result' ? {
2052
2056
  value: C;
2053
- } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<C['__outputType']> : T[K] } & C['operators'];
2057
+ } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<C['__outputType']> : T[K]; } & C['operators'];
2054
2058
  }
2055
2059
  type SetQueryReturnsFn<T extends PickQueryColumTypes, C extends Column$1.Pick.OutputType> = { [K in keyof T]: K extends 'result' ? {
2056
2060
  value: C;
2057
- } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<C['__outputType']> : T[K] } & QueryReturnsFnAdd<T>;
2061
+ } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<C['__outputType']> : T[K]; } & QueryReturnsFnAdd<T>;
2058
2062
  declare class QueryExpressions {
2059
2063
  /**
2060
2064
  * `column` references a table column, this can be used in raw SQL or when building a column expression.
@@ -2076,7 +2080,7 @@ declare class QueryExpressions {
2076
2080
  *
2077
2081
  * @param name - column name
2078
2082
  */
2079
- column<T extends PickQueryShape$1, K extends keyof T['shape']>(this: T, name: K): ColumnRefExpression<T['shape'][K]> & T['shape'][K]['operators'];
2083
+ column<T extends PickQueryShape$1, K extends keyof T['shape']>(this: T, name: K): ColumnRefExpression$1<T['shape'][K]> & T['shape'][K]['operators'];
2080
2084
  /**
2081
2085
  * `ref` is similar to [column](#column), but it also allows to reference a column of joined table,
2082
2086
  * and other dynamically defined columns.
@@ -2147,7 +2151,7 @@ declare class QueryExpressions {
2147
2151
  type WhereArg$1<T extends PickQuerySelectableRelations$1> = { [K in keyof T['__selectable'] | 'NOT' | 'OR' | 'IN']?: K extends 'NOT' ? WhereArg$1<T> | WhereArgs<T> : K extends 'OR' ? (WhereArg$1<T> | WhereArgs<T>)[] : K extends 'IN' ? MaybeArray$1<{
2148
2152
  columns: (keyof T['__selectable'])[];
2149
2153
  values: unknown[][] | IsQuery$1 | Expression$1;
2150
- }> : T['__selectable'][K]['column']['__queryType'] | null | { [O in keyof T['__selectable'][K]['column']['operators']]?: T['__selectable'][K]['column']['operators'][O]['_opType'] } | {
2154
+ }> : T['__selectable'][K]['column']['__queryType'] | null | { [O in keyof T['__selectable'][K]['column']['operators']]?: T['__selectable'][K]['column']['operators'][O]['_opType']; } | {
2151
2155
  result: {
2152
2156
  value: {
2153
2157
  __queryType: T['__selectable'][K]['column']['__queryType'] | null;
@@ -2159,7 +2163,7 @@ type WhereArg$1<T extends PickQuerySelectableRelations$1> = { [K in keyof T['__s
2159
2163
  __queryType: T['__selectable'][K]['column']['__queryType'] | null;
2160
2164
  };
2161
2165
  };
2162
- }) } | ((q: WhereQueryBuilder<T>) => QueryOrExpressionBooleanOrNullResult | WhereQueryBuilder<T>);
2166
+ }); } | ((q: WhereQueryBuilder<T>) => QueryOrExpressionBooleanOrNullResult | WhereQueryBuilder<T>);
2163
2167
  /**
2164
2168
  * Callback argument of `where`.
2165
2169
  * It has `where` methods (`where`, `whereNot`, `whereExists`, etc.),
@@ -2168,25 +2172,22 @@ type WhereArg$1<T extends PickQuerySelectableRelations$1> = { [K in keyof T['__s
2168
2172
  * db.table.where((q) => q.relation.count().equals(10))
2169
2173
  * ```
2170
2174
  */
2171
- type WhereQueryBuilder<T extends PickQueryRelations$1> = EmptyObject$1 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 };
2175
+ type WhereQueryBuilder<T extends PickQueryRelations$1> = EmptyObject$1 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; };
2172
2176
  type WhereArgs<T extends PickQuerySelectableRelations$1> = WhereArg$1<T>[];
2173
2177
  type WhereNotArgs<T extends PickQuerySelectableRelations$1> = [WhereArg$1<T>];
2174
2178
  type WhereInColumn<T extends PickQuerySelectableRelations$1> = keyof T['__selectable'] | [keyof T['__selectable'], ...(keyof T['__selectable'])[]];
2175
- type WhereInValues<T extends PickQuerySelectableRelations$1, Column> = Column extends keyof T['__selectable'] ? Iterable<T['__selectable'][Column]['column']['__queryType']> | IsQuery$1 | Expression$1 : ({ [I in keyof Column]: Column[I] extends keyof T['__selectable'] ? T['__selectable'][Column[I]]['column']['__queryType'] : never } & {
2179
+ type WhereInValues<T extends PickQuerySelectableRelations$1, Column> = Column extends keyof T['__selectable'] ? Iterable<T['__selectable'][Column]['column']['__queryType']> | IsQuery$1 | Expression$1 : ({ [I in keyof Column]: Column[I] extends keyof T['__selectable'] ? T['__selectable'][Column[I]]['column']['__queryType'] : never; } & {
2176
2180
  length: Column extends {
2177
2181
  length: number;
2178
2182
  } ? Column['length'] : never;
2179
2183
  })[] | IsQuery$1 | Expression$1;
2180
- type WhereInArg<T extends PickQuerySelectableRelations$1> = { [K in keyof T['__selectable']]?: Iterable<T['__selectable'][K]['column']['__queryType']> | IsQuery$1 | Expression$1 };
2184
+ type WhereInArg<T extends PickQuerySelectableRelations$1> = { [K in keyof T['__selectable']]?: Iterable<T['__selectable'][K]['column']['__queryType']> | IsQuery$1 | Expression$1; };
2181
2185
  interface QueryHasWhere$1 {
2182
2186
  __hasWhere: true;
2183
2187
  }
2184
2188
  interface QueryFnReturningSelect {
2185
2189
  (q: never): QueryHasSelect;
2186
2190
  }
2187
- /**
2188
- * Mutative {@link Where.prototype.where}
2189
- */
2190
2191
  declare class Where {
2191
2192
  /**
2192
2193
  * Constructing `WHERE` conditions:
@@ -3104,25 +3105,25 @@ interface ColumnToCodeCtx$1 {
3104
3105
  sql?: string;
3105
3106
  isSqlUsed?: boolean;
3106
3107
  }
3107
- type DateColumnInput = string | number | Date;
3108
+ type DateColumnInput$1 = string | number | Date;
3108
3109
  declare abstract class DateBaseColumn<Schema extends ColumnSchemaConfig$1> extends Column$1 {
3109
3110
  dateParsedByDriver?: boolean | undefined;
3110
3111
  __schema: Schema;
3111
3112
  __type: string;
3112
- __inputType: DateColumnInput;
3113
+ __inputType: DateColumnInput$1;
3113
3114
  inputSchema: ReturnType<Schema['stringNumberDate']>;
3114
3115
  data: DateColumnData$1;
3115
3116
  __outputType: string;
3116
3117
  outputSchema: ReturnType<Schema['stringSchema']>;
3117
- __queryType: DateColumnInput;
3118
+ __queryType: DateColumnInput$1;
3118
3119
  querySchema: ReturnType<Schema['stringNumberDate']>;
3119
- operators: OperatorsDate;
3120
+ operators: OperatorsDate$1;
3120
3121
  asNumber: Schema['dateAsNumber'];
3121
3122
  asDate: Schema['dateAsDate'];
3122
3123
  constructor(schema: Schema, dateParsedByDriver?: boolean | undefined);
3123
3124
  }
3124
3125
  declare class DateColumn$1<Schema extends ColumnSchemaConfig$1> extends DateBaseColumn<Schema> {
3125
- dataType: "date";
3126
+ dataType: 'date';
3126
3127
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
3127
3128
  }
3128
3129
  declare abstract class DateTimeBaseClass<Schema extends ColumnSchemaConfig$1> extends DateBaseColumn<Schema> {
@@ -3137,12 +3138,12 @@ declare abstract class DateTimeTzBaseClass<Schema extends ColumnSchemaConfig$1>
3137
3138
  toSQL(): string;
3138
3139
  }
3139
3140
  declare class TimestampColumn$1<Schema extends ColumnSchemaConfig$1> extends DateTimeBaseClass<Schema> {
3140
- dataType: "timestamp";
3141
+ dataType: 'timestamp';
3141
3142
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
3142
3143
  }
3143
3144
  declare class TimestampTZColumn$1<Schema extends ColumnSchemaConfig$1> extends DateTimeTzBaseClass<Schema> {
3144
- dataType: "timestamptz";
3145
- baseDataType: "timestamp";
3145
+ dataType: 'timestamptz';
3146
+ baseDataType: 'timestamp';
3146
3147
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
3147
3148
  }
3148
3149
  declare class TimeColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
@@ -3157,7 +3158,7 @@ declare class TimeColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1
3157
3158
  outputSchema: ReturnType<Schema['stringSchema']>;
3158
3159
  __queryType: string;
3159
3160
  querySchema: ReturnType<Schema['stringSchema']>;
3160
- dataType: "time";
3161
+ dataType: 'time';
3161
3162
  operators: OperatorsTime;
3162
3163
  constructor(schema: Schema, dateTimePrecision?: number);
3163
3164
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
@@ -3175,8 +3176,8 @@ declare class IntervalColumn$1<Schema extends ColumnSchemaConfig$1> extends Colu
3175
3176
  outputSchema: ReturnType<Schema['timeInterval']>;
3176
3177
  __queryType: PostgresInterval;
3177
3178
  querySchema: ReturnType<Schema['timeInterval']>;
3178
- dataType: "interval";
3179
- operators: OperatorsDate;
3179
+ dataType: 'interval';
3180
+ operators: OperatorsDate$1;
3180
3181
  constructor(schema: Schema, fields?: string, precision?: number, parse?: (input: string) => PostgresInterval);
3181
3182
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
3182
3183
  toSQL(): string;
@@ -3216,8 +3217,8 @@ interface ArrayData$1<Item extends ArrayColumnValue$1> extends Column$1.Data, Ar
3216
3217
  }
3217
3218
  declare class ArrayColumn$1<Schema extends ColumnTypeSchemaArg$1, Item extends ArrayColumnValue$1, InputType, OutputType, QueryType> extends Column$1 {
3218
3219
  __schema: Schema;
3219
- dataType: "array";
3220
- operators: OperatorsArray$1<Item["__queryType"]>;
3220
+ dataType: 'array';
3221
+ operators: OperatorsArray$1<Item['__queryType']>;
3221
3222
  data: ArrayData$1<Item>;
3222
3223
  __type: Item['__type'][];
3223
3224
  __inputType: Item['__type'][];
@@ -3232,7 +3233,7 @@ declare class ArrayColumn$1<Schema extends ColumnTypeSchemaArg$1, Item extends A
3232
3233
  }
3233
3234
  declare class JSONColumn$1<T, Schema extends ColumnTypeSchemaArg$1, InputSchema = Schema['__schemaType']> extends Column$1 {
3234
3235
  __schema: Schema;
3235
- dataType: "jsonb";
3236
+ dataType: 'jsonb';
3236
3237
  __type: T;
3237
3238
  __inputType: T;
3238
3239
  inputSchema: InputSchema;
@@ -3246,7 +3247,7 @@ declare class JSONColumn$1<T, Schema extends ColumnTypeSchemaArg$1, InputSchema
3246
3247
  }
3247
3248
  declare class JSONTextColumn$1<T, Schema extends ColumnTypeSchemaArg$1, InputSchema = Schema['__schemaType']> extends Column$1 {
3248
3249
  __schema: Schema;
3249
- dataType: "json";
3250
+ dataType: 'json';
3250
3251
  __type: T;
3251
3252
  __inputType: T;
3252
3253
  inputSchema: InputSchema;
@@ -3276,7 +3277,7 @@ declare abstract class NumberBaseColumn<Schema extends ColumnSchemaConfig$1, Sch
3276
3277
  outputSchema: SchemaType;
3277
3278
  __queryType: number;
3278
3279
  querySchema: SchemaType;
3279
- operators: OperatorsNumber;
3280
+ operators: OperatorsNumber$1;
3280
3281
  }
3281
3282
  declare abstract class IntegerBaseColumn<Schema extends ColumnSchemaConfig$1> extends NumberBaseColumn<Schema, ReturnType<Schema['int']>> {
3282
3283
  data: NumberColumnData$1;
@@ -3288,7 +3289,7 @@ declare abstract class NumberAsStringBaseColumn<Schema extends ColumnSchemaConfi
3288
3289
  __type: string;
3289
3290
  __inputType: InputType;
3290
3291
  inputSchema: ReturnType<Schema['stringSchema']>;
3291
- operators: OperatorsNumber;
3292
+ operators: OperatorsNumber$1;
3292
3293
  __outputType: string;
3293
3294
  outputSchema: ReturnType<Schema['stringSchema']>;
3294
3295
  __queryType: InputType;
@@ -3303,47 +3304,47 @@ interface DecimalColumnData$1 extends Column$1.Data {
3303
3304
  declare class DecimalColumn$1<Schema extends ColumnSchemaConfig$1> extends NumberAsStringBaseColumn<Schema> {
3304
3305
  data: DecimalColumnData$1;
3305
3306
  querySchema: ReturnType<Schema['stringSchema']>;
3306
- operators: OperatorsNumber;
3307
- dataType: "numeric";
3307
+ operators: OperatorsNumber$1;
3308
+ dataType: 'numeric';
3308
3309
  constructor(schema: Schema, numericPrecision?: number, numericScale?: number);
3309
3310
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
3310
3311
  toSQL(): string;
3311
3312
  }
3312
3313
  declare class SmallIntColumn$1<Schema extends ColumnSchemaConfig$1> extends IntegerBaseColumn<Schema> {
3313
- dataType: "int2";
3314
+ dataType: 'int2';
3314
3315
  querySchema: ReturnType<Schema['int']>;
3315
3316
  constructor(schema: Schema);
3316
3317
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
3317
3318
  identity<T extends Column$1.Pick.Data>(this: T, options?: TableData$1.Identity): Column$1.HasDefault<T>;
3318
3319
  }
3319
3320
  declare class IntegerColumn$1<Schema extends ColumnSchemaConfig$1> extends IntegerBaseColumn<Schema> {
3320
- dataType: "int4";
3321
+ dataType: 'int4';
3321
3322
  querySchema: ReturnType<Schema['int']>;
3322
3323
  constructor(schema: Schema);
3323
3324
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
3324
3325
  identity<T extends Column$1.Pick.Data>(this: T, options?: TableData$1.Identity): Column$1.HasDefault<T>;
3325
3326
  }
3326
3327
  declare class BigIntColumn$1<Schema extends ColumnSchemaConfig$1> extends NumberAsStringBaseColumn<Schema, string | number | bigint> {
3327
- dataType: "int8";
3328
+ dataType: 'int8';
3328
3329
  querySchema: ReturnType<Schema['stringSchema']>;
3329
3330
  constructor(schema: Schema);
3330
3331
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
3331
3332
  identity<T extends Column$1.Pick.Data>(this: T, options?: TableData$1.Identity): Column$1.HasDefault<T>;
3332
3333
  }
3333
3334
  declare class RealColumn$1<Schema extends ColumnSchemaConfig$1> extends NumberBaseColumn<Schema, ReturnType<Schema['number']>> {
3334
- dataType: "float4";
3335
+ dataType: 'float4';
3335
3336
  querySchema: ReturnType<Schema['number']>;
3336
3337
  constructor(schema: Schema);
3337
3338
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
3338
3339
  }
3339
3340
  declare class DoublePrecisionColumn$1<Schema extends ColumnSchemaConfig$1> extends NumberAsStringBaseColumn<Schema> {
3340
- dataType: "float8";
3341
+ dataType: 'float8';
3341
3342
  querySchema: ReturnType<Schema['stringSchema']>;
3342
3343
  constructor(schema: Schema);
3343
3344
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
3344
3345
  }
3345
3346
  declare class SmallSerialColumn$1<Schema extends ColumnSchemaConfig$1> extends IntegerBaseColumn<Schema> {
3346
- dataType: "int2";
3347
+ dataType: 'int2';
3347
3348
  data: SerialColumnData$1;
3348
3349
  querySchema: ReturnType<Schema['int']>;
3349
3350
  constructor(schema: Schema);
@@ -3351,7 +3352,7 @@ declare class SmallSerialColumn$1<Schema extends ColumnSchemaConfig$1> extends I
3351
3352
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
3352
3353
  }
3353
3354
  declare class SerialColumn$1<Schema extends ColumnSchemaConfig$1> extends IntegerBaseColumn<Schema> {
3354
- dataType: "int4";
3355
+ dataType: 'int4';
3355
3356
  data: SerialColumnData$1;
3356
3357
  querySchema: ReturnType<Schema['int']>;
3357
3358
  constructor(schema: Schema);
@@ -3359,7 +3360,7 @@ declare class SerialColumn$1<Schema extends ColumnSchemaConfig$1> extends Intege
3359
3360
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
3360
3361
  }
3361
3362
  declare class BigSerialColumn$1<Schema extends ColumnSchemaConfig$1> extends NumberAsStringBaseColumn<Schema> {
3362
- dataType: "int8";
3363
+ dataType: 'int8';
3363
3364
  data: SerialColumnData$1;
3364
3365
  querySchema: ReturnType<Schema['stringSchema']>;
3365
3366
  constructor(schema: Schema);
@@ -3384,12 +3385,12 @@ interface DefaultSchemaConfig$1 extends ColumnSchemaConfig$1<Column$1> {
3384
3385
  __inputType: Input;
3385
3386
  __outputType: Output;
3386
3387
  __queryType: Query;
3387
- }) => Types): { [K in keyof T]: K extends '__type' ? Types['type'] : K extends keyof Types ? Types[K] : T[K] };
3388
- narrowType<T extends Column$1.InputOutputQueryTypes, Types extends Column$1.InputOutputQueryTypes>(this: T, _fn: (type: <Type extends (T['__inputType'] extends T['__outputType'] & T['__queryType'] ? T['__outputType'] & T['__queryType'] : T['__inputType'] & T['__outputType'] & T['__queryType'])>() => {
3388
+ }) => Types): { [K in keyof T]: K extends '__type' ? Types['type'] : K extends keyof Types ? Types[K] : T[K]; };
3389
+ narrowType<T extends Column$1.InputOutputQueryTypes, Types extends Column$1.InputOutputQueryTypes>(this: T, _fn: (type: <Type extends T['__inputType'] extends T['__outputType'] & T['__queryType'] ? T['__outputType'] & T['__queryType'] : T['__inputType'] & T['__outputType'] & T['__queryType']>() => {
3389
3390
  __inputType: T['__inputType'] extends never ? never : Type;
3390
3391
  __outputType: Type;
3391
3392
  __queryType: Type;
3392
- }) => Types): { [K in keyof T]: K extends keyof Types ? Types[K] : T[K] };
3393
+ }) => Types): { [K in keyof T]: K extends keyof Types ? Types[K] : T[K]; };
3393
3394
  narrowAllTypes<T extends Column$1.InputOutputQueryTypes, Types extends Column$1.InputOutputQueryTypes>(this: T, _fn: (type: <Types extends {
3394
3395
  input?: T['__inputType'];
3395
3396
  output?: T['__outputType'];
@@ -3398,7 +3399,7 @@ interface DefaultSchemaConfig$1 extends ColumnSchemaConfig$1<Column$1> {
3398
3399
  __inputType: undefined extends Types['input'] ? T['__inputType'] : Types['input'];
3399
3400
  __outputType: undefined extends Types['output'] ? T['__outputType'] : Types['output'];
3400
3401
  __queryType: undefined extends Types['query'] ? T['__queryType'] : Types['query'];
3401
- }) => Types): { [K in keyof T]: K extends keyof Types ? Types[K] : T[K] };
3402
+ }) => Types): { [K in keyof T]: K extends keyof Types ? Types[K] : T[K]; };
3402
3403
  dateAsNumber<T extends Column$1.Pick.ForParse>(this: T): Column$1.Parse<T, unknown, number>;
3403
3404
  dateAsDate<T extends Column$1.Pick.ForParse>(this: T): Column$1.Parse<T, unknown, Date>;
3404
3405
  enum<const T extends readonly [string, ...string[]]>(dataType: string, type: T): EnumColumn$1<DefaultSchemaConfig$1, unknown, T>;
@@ -3647,14 +3648,14 @@ declare namespace DefaultPrivileges$1 {
3647
3648
  export {};
3648
3649
  }
3649
3650
  declare const DEFAULT_PRIVILEGE: {
3650
- OBJECT_TYPES: readonly ["TABLES", "SEQUENCES", "FUNCTIONS", "TYPES", "SCHEMAS", "LARGE_OBJECTS"];
3651
+ OBJECT_TYPES: readonly ['TABLES', 'SEQUENCES', 'FUNCTIONS', 'TYPES', 'SCHEMAS', 'LARGE_OBJECTS'];
3651
3652
  PRIVILEGES: {
3652
- TABLE: readonly ["ALL", "SELECT", "INSERT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", "MAINTAIN"];
3653
- SEQUENCE: readonly ["ALL", "USAGE", "SELECT", "UPDATE"];
3654
- FUNCTION: readonly ["ALL", "EXECUTE"];
3655
- TYPE: readonly ["ALL", "USAGE"];
3656
- SCHEMA: readonly ["ALL", "USAGE", "CREATE"];
3657
- LARGE_OBJECT: readonly ["ALL", "SELECT", "UPDATE"];
3653
+ TABLE: readonly ['ALL', 'SELECT', 'INSERT', 'UPDATE', 'DELETE', 'TRUNCATE', 'REFERENCES', 'TRIGGER', 'MAINTAIN'];
3654
+ SEQUENCE: readonly ['ALL', 'USAGE', 'SELECT', 'UPDATE'];
3655
+ FUNCTION: readonly ['ALL', 'EXECUTE'];
3656
+ TYPE: readonly ['ALL', 'USAGE'];
3657
+ SCHEMA: readonly ['ALL', 'USAGE', 'CREATE'];
3658
+ LARGE_OBJECT: readonly ['ALL', 'SELECT', 'UPDATE'];
3658
3659
  };
3659
3660
  };
3660
3661
  interface DbRole {
@@ -4125,7 +4126,7 @@ declare class QuerySql<ColumnTypes> {
4125
4126
  * @param args - template literal or an object { raw: string }
4126
4127
  * @return object that has `type` and `values` methods
4127
4128
  */
4128
- sql<T = unknown>(this: PickQueryColumTypes, ...args: StaticSQLArgs): RawSql$1<Column$1.Pick.QueryColumnOfType<T>, ColumnTypes>;
4129
+ sql<T = unknown>(this: PickQueryColumTypes, ...args: StaticSQLArgs$1): RawSql$1<Column$1.Pick.QueryColumnOfType<T>, ColumnTypes>;
4129
4130
  sql<T = unknown>(this: PickQueryColumTypes, ...args: [DynamicSQLArg<Column$1.Pick.QueryColumnOfType<T>>]): DynamicRawSQL$1<Column$1.Pick.QueryColumnOfType<T>, ColumnTypes>;
4130
4131
  }
4131
4132
  interface QueryLogObject$1 {
@@ -4386,7 +4387,7 @@ interface BatchParser {
4386
4387
  rows: unknown[];
4387
4388
  }) => MaybePromise$1<void>;
4388
4389
  }
4389
- type ColumnsParsers = { [K in string]?: ColumnParser };
4390
+ type ColumnsParsers = { [K in string]?: ColumnParser; };
4390
4391
  type BatchParsers = BatchParser[];
4391
4392
  interface QueryThen<T> {
4392
4393
  <TResult1 = T, TResult2 = never>(onfulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>;
@@ -4411,7 +4412,7 @@ type SelectArgs<T extends SelectSelf> = ('*' | keyof T['__selectable'])[];
4411
4412
  interface SubQueryAddition<T extends PickQueryWithData> extends IsSubQuery {
4412
4413
  withData: T['withData'];
4413
4414
  }
4414
- type SelectAsFnArg<T extends PickQueryRelationsWithData> = EmptyObject$1 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 };
4415
+ type SelectAsFnArg<T extends PickQueryRelationsWithData> = EmptyObject$1 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; };
4415
4416
  interface SelectAsArg<T extends SelectSelf> {
4416
4417
  [K: string]: keyof T['__selectable'] | Expression$1 | ((q: SelectAsFnArg<T>) => unknown);
4417
4418
  }
@@ -4423,10 +4424,10 @@ interface SelectAsCheckReturnTypes {
4423
4424
  [K: string]: PropertyKey | Expression$1 | ((q: never) => SelectAsFnReturnType);
4424
4425
  }
4425
4426
  type SelectReturnType<T extends PickQueryReturnType> = T['returnType'] extends 'valueOrThrow' ? 'oneOrThrow' : T extends 'value' ? 'one' : T['returnType'] extends 'pluck' ? 'all' : T['returnType'];
4426
- 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] };
4427
- 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}`;
4428
- 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,
4429
- { [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] };
4427
+ 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]; };
4428
+ 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}`;
4429
+ 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,
4430
+ ? { [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]; };
4430
4431
  interface AllowedRelationOneQueryForSelectable extends IsSubQuery {
4431
4432
  result: Column$1.QueryColumns;
4432
4433
  returnType: 'value' | 'valueOrThrow' | 'one' | 'oneOrThrow';
@@ -4434,7 +4435,7 @@ interface AllowedRelationOneQueryForSelectable extends IsSubQuery {
4434
4435
  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}`]: {
4435
4436
  as: C;
4436
4437
  column: R['returnType'] extends 'value' | 'valueOrThrow' ? R['result']['value'] : R['result'][C & keyof R['result']];
4437
- } } : never }[keyof Obj]>;
4438
+ }; } : never; }[keyof Obj]>;
4438
4439
  type SelectAsValueResult<T extends SelectSelf, Arg> = Arg extends keyof T['__selectable'] ? T['__selectable'][Arg]['column'] : Arg extends Expression$1 ? Arg['result']['value'] : Arg extends ((q: never) => IsQuery$1) ? SelectSubQueryResult<ReturnType<Arg>> : Arg extends ((q: never) => Expression$1) ? ReturnType<Arg>['result']['value'] : Arg extends ((q: never) => IsQuery$1 | Expression$1) ? SelectSubQueryResult<Exclude<ReturnType<Arg>, Expression$1>> | Exclude<ReturnType<Arg>, IsQuery$1>['result']['value'] : never;
4439
4440
  type SelectSubQueryResult<Arg extends SelectSelf> = Arg['returnType'] extends undefined | 'all' ? ColumnsShape$1.MapToObjectArrayColumn<Arg['result']> : Arg['returnType'] extends 'value' | 'valueOrThrow' ? Arg['result']['value'] : Arg['returnType'] extends 'pluck' ? ColumnsShape$1.MapToPluckColumn<Arg['result']> : Arg['returnType'] extends 'one' ? ColumnsShape$1.MapToNullableObjectColumn<Arg['result']> : ColumnsShape$1.MapToObjectColumn<Arg['result']>;
4440
4441
  declare class Select {
@@ -4536,15 +4537,6 @@ type QueryDataTransform = QueryDataTransformFn | {
4536
4537
  interface QueryDataTransformFn {
4537
4538
  (data: unknown, queryData: unknown): unknown;
4538
4539
  }
4539
- /**
4540
- * See `transform` query method.
4541
- * This helper applies all transform functions to a result.
4542
- *
4543
- * @param queryData - query data
4544
- * @param returnType - return type of the query, for proper `map` handling
4545
- * @param fns - array of transform functions, can be undefined
4546
- * @param result - query result to transform
4547
- */
4548
4540
  declare class QueryTransform {
4549
4541
  /**
4550
4542
  * Transform the result of the query right after loading it.
@@ -4603,7 +4595,7 @@ declare class QueryTransform {
4603
4595
  then: QueryThen<infer Data>;
4604
4596
  } ? Data : never, queryData: QueryData$1) => Result): { [K in keyof T]: K extends 'returnType' ? 'valueOrThrow' : K extends 'result' ? {
4605
4597
  value: Column$1.Pick.QueryColumnOfType<Result>;
4606
- } : K extends 'then' ? QueryThen<Result> : T[K] };
4598
+ } : K extends 'then' ? QueryThen<Result> : T[K]; };
4607
4599
  }
4608
4600
  type SelectableOrExpression<T extends PickQuerySelectable = PickQuerySelectable, C extends Column$1.Pick.QueryColumn = Column$1.Pick.QueryColumn> = '*' | keyof T['__selectable'] | Expression$1<C>;
4609
4601
  type SelectableOrExpressions<T extends PickQuerySelectable = PickQuerySelectable, C extends Column$1.Pick.QueryColumn = Column$1.Pick.QueryColumn> = ('*' | keyof T['__selectable'] | Expression$1<C>)[];
@@ -4647,9 +4639,9 @@ declare abstract class Expression$1<T extends Column$1.Pick.QueryColumn = Column
4647
4639
  }
4648
4640
  type TemplateLiteralArgs$1 = [strings: TemplateStringsArray, ...values: unknown[]];
4649
4641
  interface DynamicSQLArg<T extends Column$1.Pick.QueryColumn> {
4650
- (sql: (...args: StaticSQLArgs) => Expression$1<T>): Expression$1<T>;
4642
+ (sql: (...args: StaticSQLArgs$1) => Expression$1<T>): Expression$1<T>;
4651
4643
  }
4652
- type StaticSQLArgs = TemplateLiteralArgs$1 | [{
4644
+ type StaticSQLArgs$1 = TemplateLiteralArgs$1 | [{
4653
4645
  raw: string;
4654
4646
  values?: RawSQLValues;
4655
4647
  }];
@@ -4660,7 +4652,8 @@ declare abstract class ExpressionTypeMethod {
4660
4652
  expr?: Expression$1;
4661
4653
  };
4662
4654
  columnTypes: unknown;
4663
- }, C extends Column$1.Pick.QueryColumn>(this: T, fn: (types: T['columnTypes']) => C): // Omit is optimal
4655
+ }, C extends Column$1.Pick.QueryColumn>(this: T, fn: (types: T['columnTypes']) => C):
4656
+ // Omit is optimal
4664
4657
  Omit<T, 'result'> & {
4665
4658
  result: {
4666
4659
  value: C;
@@ -4822,7 +4815,7 @@ interface QueryDataAliases extends PickQueryDataAliases {
4822
4815
  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}`]: {
4823
4816
  as: K;
4824
4817
  column: T['shape'][K];
4825
- } } : K extends '__as' ? As : T[K] };
4818
+ }; } : K extends '__as' ? As : T[K]; };
4826
4819
  type AsQueryArg = PickQuerySelectableShapeAs;
4827
4820
  declare abstract class QueryAsMethods {
4828
4821
  /**
@@ -4863,11 +4856,11 @@ interface CteQueryBuilder<T extends PickQueryWithDataColumnTypes> extends Query
4863
4856
  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 ? {
4864
4857
  table: Name;
4865
4858
  shape: Q['result'];
4866
- } : K extends keyof T['withData'] ? T['withData'][K] : never } : T[K] };
4859
+ } : K extends keyof T['withData'] ? T['withData'][K] : never; } : T[K]; };
4867
4860
  type CteSqlResult<T extends PickQueryWithDataColumnTypes, Name extends string, Shape extends Column$1.QueryColumns> = { [K in keyof T]: K extends 'withData' ? { [K in Name | keyof T['withData']]: K extends Name ? {
4868
4861
  table: Name;
4869
4862
  shape: Shape;
4870
- } : K extends keyof T['withData'] ? T['withData'][K] : never } : T[K] };
4863
+ } : K extends keyof T['withData'] ? T['withData'][K] : never; } : T[K]; };
4871
4864
  declare class CteQuery {
4872
4865
  /**
4873
4866
  * Use `with` to add a Common Table Expression (CTE) to the query.
@@ -5057,8 +5050,8 @@ declare class CteQuery {
5057
5050
  * .where({ n: { gt: 10 } });
5058
5051
  * ```
5059
5052
  */
5060
- 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;
5061
- 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;
5053
+ 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;
5054
+ 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;
5062
5055
  /**
5063
5056
  * Use `withSql` to add a Common Table Expression (CTE) based on a custom SQL.
5064
5057
  *
@@ -5117,13 +5110,13 @@ declare class CteQuery {
5117
5110
  }
5118
5111
  interface FromQuerySelf extends PickQuerySelectable, PickQueryShape$1, PickQueryReturnType, PickQueryWithData, PickQueryAs, PickQueryHasSelect {}
5119
5112
  type FromArg$1<T extends FromQuerySelf> = IsQuery$1 | Exclude<keyof T['withData'], symbol | number>;
5120
- type FromResult$1<T extends FromQuerySelf, Arg extends MaybeArray$1<FromArg$1<T>>> = Arg extends string ? T['withData'] extends WithDataItems ? { [K in keyof T]: K extends '__selectable' ? SelectableFromShape$1<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$1<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}`]: {
5113
+ type FromResult$1<T extends FromQuerySelf, Arg extends MaybeArray$1<FromArg$1<T>>> = Arg extends string ? T['withData'] extends WithDataItems ? { [K in keyof T]: K extends '__selectable' ? SelectableFromShape$1<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$1<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}`]: {
5121
5114
  as: K;
5122
5115
  column: T['withData'][A]['shape'][K];
5123
- } } : never : A extends PickQueryResultAs ? { [K in keyof A['result'] & string as `${A['__as']}.${K}`]: K extends string ? {
5116
+ }; } : never : A extends PickQueryResultAs ? { [K in keyof A['result'] & string as `${A['__as']}.${K}`]: K extends string ? {
5124
5117
  as: K;
5125
5118
  column: A['result'][K];
5126
- } : never } : never> : T[K] } : T;
5119
+ } : never; } : never> : T[K]; } : T;
5127
5120
  declare class FromMethods {
5128
5121
  /**
5129
5122
  * Set the `FROM` value, by default the table name is used.
@@ -5236,15 +5229,7 @@ type CreateManyFromResult<T extends CreateSelf$1> = T extends {
5236
5229
  isCount: true;
5237
5230
  } ? T : T['returnType'] extends 'one' | 'oneOrThrow' ? SetQueryReturnsAll<T> : T['returnType'] extends 'value' | 'valueOrThrow' ? SetValueQueryReturnsPluckColumn<T> : T;
5238
5231
  type InsertManyFromResult<T extends CreateSelf$1> = T['__hasSelect'] extends true ? T['returnType'] extends 'one' | 'oneOrThrow' ? SetQueryReturnsAll<T> : T['returnType'] extends 'value' | 'valueOrThrow' ? SetValueQueryReturnsPluckColumn<T> : T : SetQueryReturnsRowCountMany<T>;
5239
- /**
5240
- * Function to collect column names from the inner query of create `from` methods.
5241
- *
5242
- * @param q - the creating query
5243
- * @param from - inner query to grab the columns from.
5244
- * @param obj - optionally passed object with specific data, only available when creating a single record.
5245
- * @param many - whether it's for `createForEachFrom`. If no, throws if the inner query returns multiple records.
5246
- */
5247
- declare const _queryInsertManyFrom: <T extends CreateSelf$1, Q extends QueryReturningOne>(q: T, query: Q, data: Omit<CreateData$1<T>, keyof Q["result"]>[]) => InsertManyFromResult<T>;
5232
+ declare const _queryInsertManyFrom: <T extends CreateSelf$1, Q extends QueryReturningOne>(q: T, query: Q, data: Omit<CreateData$1<T>, keyof Q['result']>[]) => InsertManyFromResult<T>;
5248
5233
  declare class QueryCreateFrom {
5249
5234
  /**
5250
5235
  * Inserts a single record based on a query that selects a single record.
@@ -5400,9 +5385,9 @@ declare class QueryCreateFrom {
5400
5385
  interface CreateSelf$1 extends PickQueryHasSelect, PickQueryDefaults, PickQueryResult, PickQueryRelations$1, PickQueryRelationsDataForCreate, PickQueryRelationsDataForCreateOptional, PickQueryWithData, PickQueryReturnType, PickQueryShape$1, PickQueryUniqueProperties, PickQueryInputType$1, Query.Pick.IsNotReadOnly {}
5401
5386
  type CreateData$1<T extends CreateSelf$1> = EmptyObject$1 extends T['relations'] ? CreateDataWithDefaults<T, keyof T['__defaults']> : CreateRelationsData<T>;
5402
5387
  type CreateDataOmit<T extends CreateSelf$1, OmitKeys> = EmptyObject$1 extends T['relations'] ? CreateDataWithDefaultsOmit<T, keyof T['__defaults'], OmitKeys> : CreateRelationsDataOmit<T, OmitKeys>;
5403
- type CreateDataWithDefaults<T extends CreateSelf$1, 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 };
5404
- type CreateDataWithDefaultsOmit<T extends CreateSelf$1, 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 };
5405
- type WritableForeignKeys<T extends CreateSelf$1, AllFKeys extends PropertyKey> = AllFKeys extends infer K ? K extends keyof T['shape'] ? T['shape'][K] extends {
5388
+ type CreateDataWithDefaults<T extends CreateSelf$1, 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; };
5389
+ type CreateDataWithDefaultsOmit<T extends CreateSelf$1, 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; };
5390
+ type WritableForeignKeys<T extends CreateSelf$1, AllFKeys extends PropertyKey> = AllFKeys extends (infer K) ? K extends keyof T['shape'] ? T['shape'][K] extends {
5406
5391
  data: {
5407
5392
  makeColumnWritable: true;
5408
5393
  };
@@ -5410,8 +5395,8 @@ type WritableForeignKeys<T extends CreateSelf$1, AllFKeys extends PropertyKey> =
5410
5395
  type CreateColumn<T extends CreateSelf$1, K extends keyof T['__inputType']> = T['__inputType'][K] | ((q: T) => QueryOrExpression$1<T['__inputType'][K]>);
5411
5396
  type CreateRelationsData<T extends CreateSelf$1> = 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'];
5412
5397
  type CreateRelationsDataOmit<T extends CreateSelf$1, 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'];
5413
- type CreateRelationsDataOmittingFKeys<T extends CreateSelf$1, Data> = EmptyObject$1 extends Data ? EmptyObject$1 : { [K in keyof Data]: CreateRelationDataOmittingFKeys<T, Data[K]> }[keyof Data] extends ((u: infer Obj) => void) ? Obj : never;
5414
- type CreateRelationDataOmittingFKeys<T extends CreateSelf$1, 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;
5398
+ type CreateRelationsDataOmittingFKeys<T extends CreateSelf$1, Data> = EmptyObject$1 extends Data ? EmptyObject$1 : { [K in keyof Data]: CreateRelationDataOmittingFKeys<T, Data[K]>; }[keyof Data] extends ((u: infer Obj) => void) ? Obj : never;
5399
+ type CreateRelationDataOmittingFKeys<T extends CreateSelf$1, 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;
5415
5400
  type CreateResult<T extends CreateSelf$1, Data> = T extends {
5416
5401
  isCount: true;
5417
5402
  } ? 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>>;
@@ -5426,12 +5411,12 @@ type InsertManyResult<T extends CreateSelf$1> = T['__hasSelect'] extends true ?
5426
5411
  *
5427
5412
  * The same should work as well with any non-null columns passed to `create`, but it's to be implemented later.
5428
5413
  */
5429
- type NarrowCreateResult<T extends CreateSelf$1, Data> = EmptyObject$1 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$1.Pick.QueryColumnOfTypeAndOps<string, Exclude<T['result'][K]['__outputType'], null>, T['result'][K]['operators']> : T['result'][K] };
5414
+ type NarrowCreateResult<T extends CreateSelf$1, Data> = EmptyObject$1 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$1.Pick.QueryColumnOfTypeAndOps<string, Exclude<T['result'][K]['__outputType'], null>, T['result'][K]['operators']> : T['result'][K]; };
5430
5415
  type IgnoreResult<T extends CreateSelf$1> = T['returnType'] extends 'oneOrThrow' ? QueryTakeOptional<T> : T['returnType'] extends 'valueOrThrow' ? SetQueryReturnsColumnOptional<T, T['result']['value']> : T;
5431
5416
  type OnConflictArg<T extends PickQueryUniqueProperties> = T['internal']['uniqueColumnNames'] | T['internal']['uniqueColumnTuples'] | Expression$1 | {
5432
5417
  constraint: T['internal']['uniqueConstraints'];
5433
5418
  };
5434
- type AddQueryDefaults<T extends CreateSelf$1, DefaultKeys extends PropertyKey> = { [K in keyof T]: K extends '__defaults' ? { [K in keyof T['__defaults'] | DefaultKeys]: true } : T[K] };
5419
+ type AddQueryDefaults<T extends CreateSelf$1, DefaultKeys extends PropertyKey> = { [K in keyof T]: K extends '__defaults' ? { [K in keyof T['__defaults'] | DefaultKeys]: true; } : T[K]; };
5435
5420
  type ExtraPropertiesAreNotAllowed<T extends CreateSelf$1, Data> = keyof Data extends keyof T['__inputType'] | keyof T['relations'] ? Data : `Extra properties are not allowed: ${Exclude<keyof Data, keyof T['__inputType'] | keyof T['relations']> & string}`;
5436
5421
  declare class QueryCreate {
5437
5422
  /**
@@ -5701,7 +5686,7 @@ declare class QueryCreate {
5701
5686
  */
5702
5687
  onConflictDoNothing<T extends CreateSelf$1, Arg extends OnConflictArg<T>>(this: T, arg?: Arg): IgnoreResult<T>;
5703
5688
  }
5704
- type OnConflictSet$1<T extends CreateSelf$1> = { [K in keyof T['__inputType']]?: T['__inputType'][K] | (() => QueryOrExpression$1<T['__inputType'][K]>) };
5689
+ type OnConflictSet$1<T extends CreateSelf$1> = { [K in keyof T['__inputType']]?: T['__inputType'][K] | (() => QueryOrExpression$1<T['__inputType'][K]>); };
5705
5690
  declare class OnConflictQueryBuilder<T extends CreateSelf$1, Arg extends OnConflictArg<T> | undefined> {
5706
5691
  private query;
5707
5692
  private onConflict;
@@ -5777,11 +5762,11 @@ type OnConflictMerge = string | string[] | {
5777
5762
  except: string | string[];
5778
5763
  };
5779
5764
  interface UpdateSelf extends PickQuerySelectable, PickQueryResult, PickQueryRelations$1, PickQueryWithData, PickQueryReturnType, PickQueryShape$1, PickQueryInputType$1, PickQueryAs, PickQueryHasSelect, PickQueryHasWhere, Query.Pick.IsNotReadOnly {}
5780
- type UpdateData$1<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$1<T['__inputType'][K]>) : T['returnType'] extends undefined | 'all' ? T['relations'][K]['dataForUpdate'] : T['relations'][K]['dataForUpdateOne'] };
5765
+ type UpdateData$1<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$1<T['__inputType'][K]>) : T['returnType'] extends undefined | 'all' ? T['relations'][K]['dataForUpdate'] : T['relations'][K]['dataForUpdateOne']; };
5781
5766
  type UpdateArg<T extends UpdateSelf> = T['__hasWhere'] extends true ? UpdateData$1<T> : 'Update statement must have where conditions. To update all prefix `update` with `all()`';
5782
5767
  type UpdateResult<T extends UpdateSelf> = T['__hasSelect'] extends true ? T : T['returnType'] extends undefined | 'all' ? SetQueryReturnsRowCountMany<T> : SetQueryReturnsRowCount<T>;
5783
- 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']];
5784
- type ChangeCountArg<T extends UpdateSelf> = NumericColumns<T> | { [K in NumericColumns<T>]?: T['shape'][K]['__type'] extends number | null ? number : number | string | bigint };
5768
+ 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']];
5769
+ type ChangeCountArg<T extends UpdateSelf> = NumericColumns<T> | { [K in NumericColumns<T>]?: T['shape'][K]['__type'] extends number | null ? number : number | string | bigint; };
5785
5770
  interface UpdateManyBySelf extends UpdateSelf {
5786
5771
  internal: {
5787
5772
  uniqueColumns: unknown;
@@ -5790,10 +5775,10 @@ interface UpdateManyBySelf extends UpdateSelf {
5790
5775
  uniqueConstraints: unknown;
5791
5776
  };
5792
5777
  }
5793
- type UpdateManyData<T extends UpdateSelf> = ({ [K in keyof T['shape'] as T['shape'][K] extends Column$1.IsPrimaryKey<string> ? K : never]: T['shape'][K]['__queryType'] | Expression$1 } & { [P in keyof T['__inputType']]?: T['__inputType'][P] | Expression$1 })[];
5778
+ type UpdateManyData<T extends UpdateSelf> = ({ [K in keyof T['shape'] as T['shape'][K] extends Column$1.IsPrimaryKey<string> ? K : never]: T['shape'][K]['__queryType'] | Expression$1; } & { [P in keyof T['__inputType']]?: T['__inputType'][P] | Expression$1; })[];
5794
5779
  type UpdateManyByKeys<T extends UpdateManyBySelf> = T['internal']['uniqueColumnNames'] | T['internal']['uniqueColumnTuples'];
5795
5780
  type UpdateManyByKeyColumns<K> = K extends string[] ? K[number] : K;
5796
- 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$1 })[];
5781
+ 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$1; })[];
5797
5782
  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>;
5798
5783
  declare class QueryUpdate {
5799
5784
  /**
@@ -6238,7 +6223,7 @@ declare class QueryUpdate {
6238
6223
  */
6239
6224
  updateManyByOptional<T extends UpdateManyBySelf, Keys extends UpdateManyByKeys<T>, K = UpdateManyByKeyColumns<Keys>>(this: T, keys: Keys, data: UpdateManyByData<T, K>): UpdateManyResult<T> & QueryHasWhere$1;
6240
6225
  }
6241
- 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 };
6226
+ 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; };
6242
6227
  type UpsertResult<T extends PickQueryHasSelectResultReturnType> = T['__hasSelect'] extends true ? T['returnType'] extends 'value' | 'valueOrThrow' ? SetValueQueryReturnsValueOrThrow<T> : SetQueryReturnsOne<T> : SetQueryReturnsVoid<T>;
6243
6228
  interface UpsertThis$1 extends UpdateSelf, CreateSelf$1 {
6244
6229
  __hasWhere: true;
@@ -6806,14 +6791,14 @@ type WrapQueryArg = FromQuerySelf;
6806
6791
  declare class QueryWrap {
6807
6792
  wrap<T extends IsQuery$1, Q extends WrapQueryArg, As extends string = 't'>(this: T, query: Q, as?: As): SetQueryTableAlias<Q, As>;
6808
6793
  }
6809
- type AfterHook$1<Select extends PropertyKey[], Shape extends Column$1.QueryColumns> = QueryAfterHook$1<{ [K in Select[number]]: K extends keyof Shape ? Shape[K]['__outputType'] : never }[]>;
6794
+ type AfterHook$1<Select extends PropertyKey[], Shape extends Column$1.QueryColumns> = QueryAfterHook$1<{ [K in Select[number]]: K extends keyof Shape ? Shape[K]['__outputType'] : never; }[]>;
6810
6795
  type HookSelectArg<T extends PickQueryShape$1> = (keyof T['shape'] & string)[];
6811
6796
  declare class QueryHookUtils$1<T extends PickQueryInputType$1> {
6812
6797
  query: IsQuery$1;
6813
6798
  columns: string[];
6814
6799
  private key;
6815
6800
  constructor(query: IsQuery$1, columns: string[], key: 'hookCreateSet' | 'hookUpdateSet');
6816
- set: (data: { [K in keyof T["__inputType"]]?: T["__inputType"][K] | (() => QueryOrExpression$1<T["__inputType"][K]>) }) => void;
6801
+ set: (data: { [K in keyof T['__inputType']]?: T['__inputType'][K] | (() => QueryOrExpression$1<T['__inputType'][K]>); }) => void;
6817
6802
  }
6818
6803
  declare abstract class QueryHooks$1 {
6819
6804
  /**
@@ -6958,7 +6943,7 @@ declare abstract class QueryHooks$1 {
6958
6943
  catchAfterCommitError<T>(this: T, fn: AfterCommitErrorHandler): T;
6959
6944
  }
6960
6945
  interface MergeQueryArg extends PickQueryTable, PickQuerySelectable, PickQueryResult, PickQueryReturnType, PickQueryWithData, PickQueryWindows, PickQueryThen, PickQueryHasSelect, PickQueryHasWhere {}
6961
- type MergeQuery$1<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] };
6946
+ type MergeQuery$1<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]; };
6962
6947
  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'];
6963
6948
  declare class MergeQueryMethods {
6964
6949
  merge<T extends MergeQueryArg, Q extends MergeQueryArg>(this: T, q: Q): MergeQuery$1<T, Q>;
@@ -6968,9 +6953,9 @@ interface ColumnDataSelectSqlProp {
6968
6953
  selectSqlFn?: SelectSqlCallback;
6969
6954
  }
6970
6955
  interface SelectSqlCallback {
6971
- (column: ColumnRefExpression<Column$1.Pick.QueryColumn>): Expression$1;
6956
+ (column: ColumnRefExpression$1<Column$1.Pick.QueryColumn>): Expression$1;
6972
6957
  }
6973
- type SelectSqlColumn<T extends Column$1.Pick.DataAndDataType, Expr extends Expression$1> = unknown extends Expr['result']['value']['__outputType'] ? T : { [K in keyof T]: K extends '__outputType' ? Expr['result']['value']['__outputType'] : T[K] };
6958
+ type SelectSqlColumn$1<T extends Column$1.Pick.DataAndDataType, Expr extends Expression$1> = unknown extends Expr['result']['value']['__outputType'] ? T : { [K in keyof T]: K extends '__outputType' ? Expr['result']['value']['__outputType'] : T[K]; };
6974
6959
  /**
6975
6960
  * Function to turn the operator expression into SQL.
6976
6961
  *
@@ -6985,7 +6970,7 @@ interface OperatorToSQL {
6985
6970
  interface Operator<Value, Column extends Column.Pick.OutputTypeAndOperators = Column.Pick.OutputTypeAndOperators> {
6986
6971
  <T extends PickQueryResult>(this: T, arg: Value): { [K in Exclude<keyof T, keyof T['result']['value']['operators']>]: K extends 'result' ? {
6987
6972
  value: Column;
6988
- } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<Column['__outputType']> : T[K] } & Column['operators'];
6973
+ } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<Column['__outputType']> : T[K]; } & Column['operators'];
6989
6974
  _opType: Value;
6990
6975
  }
6991
6976
  interface Base$1<Value> {
@@ -7009,7 +6994,7 @@ interface Ord$1<Value> extends Base$1<Value> {
7009
6994
  gte: Operator<Value | IsQuery$1 | Expression$1, BooleanQueryColumn>;
7010
6995
  between: Operator<[Value | IsQuery$1 | Expression$1, Value | IsQuery$1 | Expression$1], BooleanQueryColumn>;
7011
6996
  }
7012
- type OperatorsNumber = Ord$1<number>;
6997
+ type OperatorsNumber$1 = Ord$1<number>;
7013
6998
  interface OperatorsBoolean extends Ord$1<boolean> {
7014
6999
  and: Operator<OperatorsBooleanSelf, BooleanQueryColumn>;
7015
7000
  or: Operator<OperatorsBooleanSelf, BooleanQueryColumn>;
@@ -7197,7 +7182,7 @@ interface OperatorsJson$1 extends Ord$1<unknown> {
7197
7182
  };
7198
7183
  }
7199
7184
  type OperatorsAny = Base$1<any>;
7200
- type OperatorsDate = Ord$1<Date | string>;
7185
+ type OperatorsDate$1 = Ord$1<Date | string>;
7201
7186
  type OperatorsTime = Ord$1<string>;
7202
7187
  interface OperatorsArray$1<T> extends Ord$1<T[]> {
7203
7188
  has: Operator<T | IsQuery$1 | Expression$1, BooleanQueryColumn>;
@@ -7205,7 +7190,7 @@ interface OperatorsArray$1<T> extends Ord$1<T[]> {
7205
7190
  hasSome: Operator<T[] | IsQuery$1 | Expression$1, BooleanQueryColumn>;
7206
7191
  containedIn: Operator<T[] | IsQuery$1 | Expression$1, BooleanQueryColumn>;
7207
7192
  length: {
7208
- _opType: number | { [K in Exclude<keyof OperatorsNumber, '__hasSelect'>]?: OperatorsNumber[K]['_opType'] };
7193
+ _opType: number | { [K in Exclude<keyof OperatorsNumber$1, '__hasSelect'>]?: OperatorsNumber$1[K]['_opType']; };
7209
7194
  };
7210
7195
  }
7211
7196
  type TextColumnData = StringData$1;
@@ -7231,7 +7216,7 @@ declare abstract class LimitedTextBaseColumn<Schema extends ColumnSchemaConfig$1
7231
7216
  toSQL(): string;
7232
7217
  }
7233
7218
  declare class VarCharColumn$1<Schema extends ColumnSchemaConfig$1> extends LimitedTextBaseColumn<Schema> {
7234
- dataType: "varchar";
7219
+ dataType: 'varchar';
7235
7220
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
7236
7221
  }
7237
7222
  declare class StringColumn$1<Schema extends ColumnSchemaConfig$1> extends VarCharColumn$1<Schema> {
@@ -7239,7 +7224,7 @@ declare class StringColumn$1<Schema extends ColumnSchemaConfig$1> extends VarCha
7239
7224
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
7240
7225
  }
7241
7226
  declare class TextColumn$1<Schema extends ColumnSchemaConfig$1> extends TextBaseColumn<Schema, OperatorsOrdinalText$1> {
7242
- dataType: "text";
7227
+ dataType: 'text';
7243
7228
  data: TextColumnData & {
7244
7229
  minArg?: number;
7245
7230
  maxArg?: number;
@@ -7253,7 +7238,7 @@ declare class TextColumn$1<Schema extends ColumnSchemaConfig$1> extends TextBase
7253
7238
  }
7254
7239
  declare class ByteaColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7255
7240
  __schema: Schema;
7256
- dataType: "bytea";
7241
+ dataType: 'bytea';
7257
7242
  operators: OperatorsOrdinalText$1;
7258
7243
  __type: string;
7259
7244
  __inputType: Buffer;
@@ -7267,7 +7252,7 @@ declare class ByteaColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$
7267
7252
  }
7268
7253
  declare class PointColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7269
7254
  __schema: Schema;
7270
- dataType: "point";
7255
+ dataType: 'point';
7271
7256
  __type: string;
7272
7257
  __inputType: string;
7273
7258
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -7281,7 +7266,7 @@ declare class PointColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$
7281
7266
  }
7282
7267
  declare class LineColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7283
7268
  __schema: Schema;
7284
- dataType: "line";
7269
+ dataType: 'line';
7285
7270
  __type: string;
7286
7271
  __inputType: string;
7287
7272
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -7295,7 +7280,7 @@ declare class LineColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1
7295
7280
  }
7296
7281
  declare class LsegColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7297
7282
  __schema: Schema;
7298
- dataType: "lseg";
7283
+ dataType: 'lseg';
7299
7284
  __type: string;
7300
7285
  __inputType: string;
7301
7286
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -7309,7 +7294,7 @@ declare class LsegColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1
7309
7294
  }
7310
7295
  declare class BoxColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7311
7296
  __schema: Schema;
7312
- dataType: "box";
7297
+ dataType: 'box';
7313
7298
  __type: string;
7314
7299
  __inputType: string;
7315
7300
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -7323,7 +7308,7 @@ declare class BoxColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1
7323
7308
  }
7324
7309
  declare class PathColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7325
7310
  __schema: Schema;
7326
- dataType: "path";
7311
+ dataType: 'path';
7327
7312
  __type: string;
7328
7313
  __inputType: string;
7329
7314
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -7337,7 +7322,7 @@ declare class PathColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1
7337
7322
  }
7338
7323
  declare class PolygonColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7339
7324
  __schema: Schema;
7340
- dataType: "polygon";
7325
+ dataType: 'polygon';
7341
7326
  __type: string;
7342
7327
  __inputType: string;
7343
7328
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -7351,7 +7336,7 @@ declare class PolygonColumn$1<Schema extends ColumnSchemaConfig$1> extends Colum
7351
7336
  }
7352
7337
  declare class CircleColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7353
7338
  __schema: Schema;
7354
- dataType: "circle";
7339
+ dataType: 'circle';
7355
7340
  __type: string;
7356
7341
  __inputType: string;
7357
7342
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -7365,7 +7350,7 @@ declare class CircleColumn$1<Schema extends ColumnSchemaConfig$1> extends Column
7365
7350
  }
7366
7351
  declare class MoneyColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7367
7352
  __schema: Schema;
7368
- dataType: "money";
7353
+ dataType: 'money';
7369
7354
  __type: string;
7370
7355
  data: NumberColumnData$1;
7371
7356
  __inputType: string | number;
@@ -7374,13 +7359,13 @@ declare class MoneyColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$
7374
7359
  outputSchema: ReturnType<Schema['number']>;
7375
7360
  __queryType: string | number;
7376
7361
  querySchema: ReturnType<Schema['number']>;
7377
- operators: OperatorsNumber;
7362
+ operators: OperatorsNumber$1;
7378
7363
  constructor(schema: Schema);
7379
7364
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
7380
7365
  }
7381
7366
  declare class CidrColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7382
7367
  __schema: Schema;
7383
- dataType: "cidr";
7368
+ dataType: 'cidr';
7384
7369
  __type: string;
7385
7370
  __inputType: string;
7386
7371
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -7394,7 +7379,7 @@ declare class CidrColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1
7394
7379
  }
7395
7380
  declare class InetColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7396
7381
  __schema: Schema;
7397
- dataType: "inet";
7382
+ dataType: 'inet';
7398
7383
  __type: string;
7399
7384
  __inputType: string;
7400
7385
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -7408,7 +7393,7 @@ declare class InetColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1
7408
7393
  }
7409
7394
  declare class MacAddrColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7410
7395
  __schema: Schema;
7411
- dataType: "macaddr";
7396
+ dataType: 'macaddr';
7412
7397
  __type: string;
7413
7398
  __inputType: string;
7414
7399
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -7422,7 +7407,7 @@ declare class MacAddrColumn$1<Schema extends ColumnSchemaConfig$1> extends Colum
7422
7407
  }
7423
7408
  declare class MacAddr8Column$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7424
7409
  __schema: Schema;
7425
- dataType: "macaddr8";
7410
+ dataType: 'macaddr8';
7426
7411
  __type: string;
7427
7412
  __inputType: string;
7428
7413
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -7436,7 +7421,7 @@ declare class MacAddr8Column$1<Schema extends ColumnSchemaConfig$1> extends Colu
7436
7421
  }
7437
7422
  declare class BitColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7438
7423
  __schema: Schema;
7439
- dataType: "bit";
7424
+ dataType: 'bit';
7440
7425
  __type: string;
7441
7426
  __inputType: string;
7442
7427
  inputSchema: ReturnType<Schema['bit']>;
@@ -7454,7 +7439,7 @@ declare class BitColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1
7454
7439
  }
7455
7440
  declare class BitVaryingColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7456
7441
  __schema: Schema;
7457
- dataType: "varbit";
7442
+ dataType: 'varbit';
7458
7443
  __type: string;
7459
7444
  __inputType: string;
7460
7445
  inputSchema: ReturnType<Schema['bit']>;
@@ -7474,7 +7459,7 @@ type TsVectorGeneratedColumns = string[] | SearchWeightRecord;
7474
7459
  declare class TsVectorColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7475
7460
  defaultLanguage: string;
7476
7461
  __schema: Schema;
7477
- dataType: "tsvector";
7462
+ dataType: 'tsvector';
7478
7463
  __type: string;
7479
7464
  __inputType: string;
7480
7465
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -7509,11 +7494,11 @@ declare class TsVectorColumn$1<Schema extends ColumnSchemaConfig$1> extends Colu
7509
7494
  *
7510
7495
  * @param args
7511
7496
  */
7512
- generated<T extends Column$1.Pick.Data>(this: T, ...args: StaticSQLArgs | [language: string, columns: TsVectorGeneratedColumns] | [columns: TsVectorGeneratedColumns]): Column$1.Generated<T>;
7497
+ generated<T extends Column$1.Pick.Data>(this: T, ...args: StaticSQLArgs$1 | [language: string, columns: TsVectorGeneratedColumns] | [columns: TsVectorGeneratedColumns]): Column$1.Generated<T>;
7513
7498
  }
7514
7499
  declare class TsQueryColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7515
7500
  __schema: Schema;
7516
- dataType: "tsquery";
7501
+ dataType: 'tsquery';
7517
7502
  __type: string;
7518
7503
  __inputType: string;
7519
7504
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -7527,7 +7512,7 @@ declare class TsQueryColumn$1<Schema extends ColumnSchemaConfig$1> extends Colum
7527
7512
  }
7528
7513
  declare class UUIDColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7529
7514
  __schema: Schema;
7530
- dataType: "uuid";
7515
+ dataType: 'uuid';
7531
7516
  __type: string;
7532
7517
  __inputType: string;
7533
7518
  inputSchema: ReturnType<Schema['uuid']>;
@@ -7540,7 +7525,8 @@ declare class UUIDColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1
7540
7525
  /**
7541
7526
  * see {@link Column.primaryKey}
7542
7527
  */
7543
- primaryKey<T extends Column$1.Pick.Data, Name extends string>(this: T, name?: Name): // using & bc otherwise the return type doesn't match `primaryKey` in ColumnType and TS complains
7528
+ primaryKey<T extends Column$1.Pick.Data, Name extends string>(this: T, name?: Name):
7529
+ // using & bc otherwise the return type doesn't match `primaryKey` in ColumnType and TS complains
7544
7530
  T & {
7545
7531
  data: {
7546
7532
  primaryKey: Name;
@@ -7551,7 +7537,7 @@ declare class UUIDColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1
7551
7537
  }
7552
7538
  declare class XMLColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7553
7539
  __schema: Schema;
7554
- dataType: "xml";
7540
+ dataType: 'xml';
7555
7541
  __type: string;
7556
7542
  __inputType: string;
7557
7543
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -7567,7 +7553,7 @@ declare class XMLColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1
7567
7553
  }
7568
7554
  declare class CitextColumn$1<Schema extends ColumnSchemaConfig$1> extends TextBaseColumn<Schema, OperatorsOrdinalText$1> {
7569
7555
  __schema: Schema;
7570
- dataType: "citext";
7556
+ dataType: 'citext';
7571
7557
  data: TextColumnData & {
7572
7558
  minArg?: number;
7573
7559
  maxArg?: number;
@@ -7579,7 +7565,7 @@ declare class CitextColumn$1<Schema extends ColumnSchemaConfig$1> extends TextBa
7579
7565
  }
7580
7566
  declare class BooleanColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7581
7567
  __schema: Schema;
7582
- dataType: "bool";
7568
+ dataType: 'bool';
7583
7569
  operators: OperatorsBoolean;
7584
7570
  __type: boolean;
7585
7571
  __inputType: boolean;
@@ -7646,6 +7632,7 @@ interface PostgisPoint {
7646
7632
  lat: number;
7647
7633
  srid?: number;
7648
7634
  }
7635
+ declare const encode: ({ srid, lon, lat }: PostgisPoint) => string;
7649
7636
  declare class PostgisGeographyPointColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7650
7637
  __schema: Schema;
7651
7638
  dataType: string;
@@ -7657,11 +7644,7 @@ declare class PostgisGeographyPointColumn$1<Schema extends ColumnSchemaConfig$1>
7657
7644
  __queryType: PostgisPoint;
7658
7645
  querySchema: ReturnType<Schema['geographyPointSchema']>;
7659
7646
  operators: OperatorsAny;
7660
- static encode: ({
7661
- srid,
7662
- lon,
7663
- lat
7664
- }: PostgisPoint) => string;
7647
+ static encode: typeof encode;
7665
7648
  static isDefaultPoint(typmod: number): boolean;
7666
7649
  constructor(schema: Schema);
7667
7650
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
@@ -7783,6 +7766,7 @@ interface QueryData$1 extends QueryDataAliases, PickQueryDataParsers, HasHookSel
7783
7766
  returningMany?: boolean;
7784
7767
  wrapInTransaction?: boolean;
7785
7768
  throwOnNotFound?: boolean;
7769
+ cteThrowOnNotFound?: boolean;
7786
7770
  ensureCount?: number;
7787
7771
  with?: WithItems;
7788
7772
  withShapes?: WithConfigs;
@@ -7974,7 +7958,7 @@ interface ToSQLQuery extends IsQuery$1 {
7974
7958
  type UnionArgs<T extends PickQueryResult> = ({
7975
7959
  result: { [K in keyof T['result']]: {
7976
7960
  __queryType: T['result'][K]['__queryType'];
7977
- } };
7961
+ }; };
7978
7962
  } | ((q: T) => Expression$1))[];
7979
7963
  declare class Union {
7980
7964
  /**
@@ -8170,7 +8154,7 @@ interface QueryPluckSelf extends PickQuerySelectable, PickQueryRelationsWithData
8170
8154
  type PluckArg<T extends QueryPluckSelf> = SelectableOrExpression<T> | ((q: SelectAsFnArg<T>) => Expression$1 | Query.Pick.SingleValueResult);
8171
8155
  type PluckResult<T extends QueryPluckSelf, S extends PluckArg<T>> = S extends ((q: never) => infer R) ? R extends Expression$1 ? SetQueryReturnsPluck<T, R> : R extends Query.Pick.SingleValueResult ? { [K in keyof T]: K extends '__hasSelect' ? true : K extends 'result' ? {
8172
8156
  pluck: R['result']['value'];
8173
- } : K extends 'returnType' ? 'pluck' : K extends 'then' ? QueryThen<R['result']['value']['__outputType'][]> : T[K] } : never : S extends SelectableOrExpression<T> ? SetQueryReturnsPluck<T, S> : never;
8157
+ } : K extends 'returnType' ? 'pluck' : K extends 'then' ? QueryThen<R['result']['value']['__outputType'][]> : T[K]; } : never : S extends SelectableOrExpression<T> ? SetQueryReturnsPluck<T, S> : never;
8174
8158
  declare class QueryPluck {
8175
8159
  /**
8176
8160
  * `.pluck` returns a single array of a single selected column values:
@@ -8232,7 +8216,7 @@ declare class QueryMap {
8232
8216
  then: QueryThen<(infer Data)[]>;
8233
8217
  } ? (input: Data, index: number, arr: Data[]) => Result : never : T extends {
8234
8218
  then: QueryThen<(infer Data) | undefined>;
8235
- } ? (input: Data, index: number, value: Data) => Result : never, thisArg?: unknown): Result extends RecordUnknown$1 ? { [K in keyof T]: K extends 'result' ? { [K in keyof Result]: Column$1.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' ? {
8219
+ } ? (input: Data, index: number, value: Data) => Result : never, thisArg?: unknown): Result extends RecordUnknown$1 ? { [K in keyof T]: K extends 'result' ? { [K in keyof Result]: Column$1.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' ? {
8236
8220
  pluck: Column$1.Pick.QueryColumnOfType<Result>;
8237
8221
  } : T['returnType'] extends QueryReturnTypeOptional ? {
8238
8222
  value: Column$1.Pick.QueryColumnOfType<Result | undefined>;
@@ -8244,7 +8228,7 @@ declare class QueryMap {
8244
8228
  } : K extends 'then' ? QueryThen<T['returnType'] extends QueryReturnTypeAll | 'pluck' ? Result[] : T['returnType'] extends QueryReturnTypeOptional ? Result | undefined : T extends {
8245
8229
  returnType: 'valueOrThrow';
8246
8230
  then: QueryThen<unknown | null>;
8247
- } ? Result | null : Result> : T[K] };
8231
+ } ? Result | null : Result> : T[K]; };
8248
8232
  }
8249
8233
  declare class QueryDistinct {
8250
8234
  /**
@@ -8336,7 +8320,7 @@ declare class QueryExistsMethods {
8336
8320
  */
8337
8321
  notExists<T extends QueryGetSelf>(this: T): SetQueryReturnsColumnOrThrow<T, BooleanQueryColumn>;
8338
8322
  }
8339
- type GroupArgs<T extends PickQueryResult> = ({ [K in keyof T['result']]: T['result'][K]['dataType'] extends 'array' | 'object' | 'runtimeComputed' ? never : K }[keyof T['result']] | Expression$1)[];
8323
+ type GroupArgs<T extends PickQueryResult> = ({ [K in keyof T['result']]: T['result'][K]['dataType'] extends 'array' | 'object' | 'runtimeComputed' ? never : K; }[keyof T['result']] | Expression$1)[];
8340
8324
  interface QueryHelperQuery<T extends PickQuerySelectableShapeAs> extends MergeQueryArg {
8341
8325
  returnType: QueryReturnType$1;
8342
8326
  __selectable: Omit<T['__selectable'], `${T['__as']}.${Extract<keyof T['shape'], string>}`>;
@@ -8364,15 +8348,15 @@ interface QueryHelper<T extends PickQueryTableMetaShapeTableAs, Args extends any
8364
8348
  interface NarrowTypeSelf extends PickQueryResultReturnType {
8365
8349
  returnType: undefined | 'all' | 'one' | 'oneOrThrow' | 'value' | 'valueOrThrow' | 'pluck';
8366
8350
  }
8367
- 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];
8351
+ 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];
8368
8352
  interface NarrowValueTypeResult<T extends PickQueryResultReturnType, Narrow> extends Column$1.QueryColumns {
8369
- value: { [K in keyof T['result']['value']]: K extends '__outputType' ? Narrow : T['result']['value'][K] };
8353
+ value: { [K in keyof T['result']['value']]: K extends '__outputType' ? Narrow : T['result']['value'][K]; };
8370
8354
  }
8371
8355
  interface NarrowPluckTypeResult<T extends PickQueryResultReturnType, Narrow> extends Column$1.QueryColumns {
8372
- pluck: { [K in keyof T['result']['pluck']]: K extends '__outputType' ? Narrow extends unknown[] ? Narrow[number] : Narrow : T['result']['pluck'][K] };
8356
+ pluck: { [K in keyof T['result']['pluck']]: K extends '__outputType' ? Narrow extends unknown[] ? Narrow[number] : Narrow : T['result']['pluck'][K]; };
8373
8357
  }
8374
- 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$1.QueryColumnToOptional<R['result'][K]> } : K extends 'then' ? QueryIfResultThen<T, R> : T[K] };
8375
- 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>;
8358
+ 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$1.QueryColumnToOptional<R['result'][K]>; } : K extends 'then' ? QueryIfResultThen<T, R> : T[K]; };
8359
+ 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>;
8376
8360
  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$1, QueryUpsert, QueryOrCreate, QueryGet, QueryPluck, MergeQueryMethods, QuerySql<ColumnTypes>, QueryTransform, QueryMap, QueryScope, SoftDeleteMethods, QueryExpressions, QueryWrap, QueryWindow, QueryExistsMethods {}
8377
8361
  declare class QueryMethods<ColumnTypes> {
8378
8362
  /**
@@ -8813,14 +8797,14 @@ declare class QueryMethods<ColumnTypes> {
8813
8797
  */
8814
8798
  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]: {
8815
8799
  __outputType: Narrow[K];
8816
- } } : K extends 'then' ? QueryThenByQuery<T, T['result'] & { [K in keyof Narrow]: {
8800
+ }; } : K extends 'then' ? QueryThenByQuery<T, T['result'] & { [K in keyof Narrow]: {
8817
8801
  __outputType: Narrow[K];
8818
- } }> : 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';
8802
+ }; }> : 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';
8819
8803
  if<T extends PickQueryResultReturnType, R extends PickQueryResult>(this: T, condition: boolean | null | undefined, fn: (q: T) => R & {
8820
8804
  returnType: T['returnType'];
8821
8805
  }): QueryIfResult<T, R>;
8822
8806
  queryRelated<T extends PickQueryRelations$1, RelName extends keyof T['relations']>(this: T, relName: RelName, params: T['relations'][RelName]['params']): RelationQueryMaybeSingle<T['relations'][RelName]>;
8823
- 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'];
8807
+ 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'];
8824
8808
  }
8825
8809
  interface DbExtension$1 {
8826
8810
  name: string;
@@ -8845,10 +8829,10 @@ interface DbDomainArgRecord {
8845
8829
  type SelectableFromShape$1<Shape extends Column$1.QueryColumns, Table extends string | undefined> = { [K in keyof Shape]: {
8846
8830
  as: K;
8847
8831
  column: Shape[K];
8848
- } } & { [K in keyof Shape & string as `${Table}.${K}`]: {
8832
+ }; } & { [K in keyof Shape & string as `${Table}.${K}`]: {
8849
8833
  as: K;
8850
8834
  column: Shape[K];
8851
- } };
8835
+ }; };
8852
8836
  type QueryReturnType$1 = QueryReturnTypeAll | 'one' | 'oneOrThrow' | 'rows' | 'pluck' | 'value' | 'valueOrThrow' | 'void';
8853
8837
  type QueryReturnTypeAll = undefined | 'all';
8854
8838
  type QueryReturnTypeOptional = 'one' | 'value';
@@ -8931,52 +8915,52 @@ declare namespace Query {
8931
8915
  }
8932
8916
  }
8933
8917
  }
8934
- type SelectableOfType<T extends PickQuerySelectable, Type> = { [K in keyof T['__selectable']]: T['__selectable'][K]['column']['__type'] extends Type | null ? K : never }[keyof T['__selectable']];
8918
+ type SelectableOfType<T extends PickQuerySelectable, Type> = { [K in keyof T['__selectable']]: T['__selectable'][K]['column']['__type'] extends Type | null ? K : never; }[keyof T['__selectable']];
8935
8919
  type SelectableOrExpressionOfType<T extends PickQuerySelectable, C extends Column$1.Pick.Type> = SelectableOfType<T, C['__type']> | Expression$1<Column$1.Pick.QueryColumnOfType<C['__type'] | null>>;
8936
- type SetQueryReturnsAll<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'all' : K extends 'then' ? QueryThenShallowSimplifyArr<ColumnsShape$1.Output<T['result']>> : T[K] } & QueryHasWhere$1;
8937
- type SetQueryReturnsAllResult<T extends PickQueryResult, Result extends Column$1.QueryColumns> = { [K in keyof T]: K extends 'returnType' ? 'all' : K extends 'result' ? Result : K extends 'then' ? QueryThenShallowSimplifyArr<T['result']> : T[K] } & QueryHasWhere$1;
8938
- 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$1.Output<T['result']>> : T[K] };
8939
- type QueryManyTakeOptional$1<T extends PickQueryResultReturnType> = { [K in keyof T]: K extends 'returnType' ? 'one' : K extends 'then' ? QueryThenShallowSimplifyOptional<ColumnsShape$1.Output<T['result']>> : T[K] };
8940
- 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$1.Output<T['result']>> : T[K] };
8941
- 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$1.Output<T['result']>> : T[K] };
8942
- type QueryManyTake$1<T extends PickQueryResultReturnType> = { [K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'then' ? QueryThenShallowSimplify<ColumnsShape$1.Output<T['result']>> : T[K] };
8943
- type SetQueryReturnsOne<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'then' ? QueryThenShallowSimplify<ColumnsShape$1.Output<T['result']>> : T[K] };
8944
- type SetQueryReturnsOneResult<T extends PickQueryResult, Result extends Column$1.QueryColumns> = { [K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'result' ? Result : K extends 'then' ? QueryThenShallowSimplify<ColumnsShape$1.Output<Result>> : T[K] };
8945
- type SetQueryReturnsRows<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'rows' : K extends 'then' ? QueryThen<ColumnsShape$1.Output<T['result']>[keyof T['result']][][]> : T[K] };
8920
+ type SetQueryReturnsAll<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'all' : K extends 'then' ? QueryThenShallowSimplifyArr<ColumnsShape$1.Output<T['result']>> : T[K]; } & QueryHasWhere$1;
8921
+ type SetQueryReturnsAllResult<T extends PickQueryResult, Result extends Column$1.QueryColumns> = { [K in keyof T]: K extends 'returnType' ? 'all' : K extends 'result' ? Result : K extends 'then' ? QueryThenShallowSimplifyArr<T['result']> : T[K]; } & QueryHasWhere$1;
8922
+ 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$1.Output<T['result']>> : T[K]; };
8923
+ type QueryManyTakeOptional$1<T extends PickQueryResultReturnType> = { [K in keyof T]: K extends 'returnType' ? 'one' : K extends 'then' ? QueryThenShallowSimplifyOptional<ColumnsShape$1.Output<T['result']>> : T[K]; };
8924
+ 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$1.Output<T['result']>> : T[K]; };
8925
+ 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$1.Output<T['result']>> : T[K]; };
8926
+ type QueryManyTake$1<T extends PickQueryResultReturnType> = { [K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'then' ? QueryThenShallowSimplify<ColumnsShape$1.Output<T['result']>> : T[K]; };
8927
+ type SetQueryReturnsOne<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'then' ? QueryThenShallowSimplify<ColumnsShape$1.Output<T['result']>> : T[K]; };
8928
+ type SetQueryReturnsOneResult<T extends PickQueryResult, Result extends Column$1.QueryColumns> = { [K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'result' ? Result : K extends 'then' ? QueryThenShallowSimplify<ColumnsShape$1.Output<Result>> : T[K]; };
8929
+ type SetQueryReturnsRows<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'rows' : K extends 'then' ? QueryThen<ColumnsShape$1.Output<T['result']>[keyof T['result']][][]> : T[K]; };
8946
8930
  type SetQueryReturnsPluck<T extends PickQuerySelectable, S extends keyof T['__selectable'] | Expression$1> = S extends keyof T['__selectable'] ? { [K in keyof T]: K extends '__hasSelect' ? true : K extends 'result' ? {
8947
8931
  pluck: T['__selectable'][S]['column'];
8948
- } : 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' ? {
8932
+ } : 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' ? {
8949
8933
  pluck: S extends Expression$1 ? S['result']['value'] : never;
8950
- } : K extends 'returnType' ? 'pluck' : K extends 'then' ? QueryThen<(S extends Expression$1 ? S['result']['value']['__outputType'] : never)[]> : T[K] };
8934
+ } : K extends 'returnType' ? 'pluck' : K extends 'then' ? QueryThen<(S extends Expression$1 ? S['result']['value']['__outputType'] : never)[]> : T[K]; };
8951
8935
  type SetValueQueryReturnsPluckColumn<T extends PickQueryResult> = { [K in keyof T]: K extends 'result' ? {
8952
8936
  pluck: T['result']['value'];
8953
- } : K extends 'returnType' ? 'pluck' : K extends 'then' ? QueryThen<T['result']['value']['__outputType'][]> : T[K] } & QueryHasSelect;
8937
+ } : K extends 'returnType' ? 'pluck' : K extends 'then' ? QueryThen<T['result']['value']['__outputType'][]> : T[K]; } & QueryHasSelect;
8954
8938
  type SetQueryReturnsPluckColumnResult<T extends PickQueryResult, Result extends Column$1.QueryColumns> = { [K in keyof T]: K extends 'result' ? {
8955
8939
  pluck: T['result']['value'];
8956
- } : K extends 'returnType' ? 'pluck' : K extends 'result' ? Result : K extends 'then' ? QueryThen<T['result']['value']['__outputType'][]> : T[K] } & QueryHasSelect;
8940
+ } : K extends 'returnType' ? 'pluck' : K extends 'result' ? Result : K extends 'then' ? QueryThen<T['result']['value']['__outputType'][]> : T[K]; } & QueryHasSelect;
8957
8941
  type SetQueryReturnsValueOrThrow<T extends PickQuerySelectable, Arg extends keyof T['__selectable']> = SetQueryReturnsColumnOrThrow<T, T['__selectable'][Arg]['column']> & T['__selectable'][Arg]['column']['operators'];
8958
- type SetValueQueryReturnsValueOrThrow<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<T['result']['value']['__outputType']> : T[K] };
8959
- 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$1.OperatorsNullable<T['__selectable'][Arg]['column']>;
8942
+ type SetValueQueryReturnsValueOrThrow<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<T['result']['value']['__outputType']> : T[K]; };
8943
+ 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$1.OperatorsNullable<T['__selectable'][Arg]['column']>;
8960
8944
  type SetQueryReturnsColumnOrThrow<T, Column extends Column.Pick.OutputType> = { [K in keyof T]: K extends 'result' ? {
8961
8945
  value: Column;
8962
- } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<Column['__outputType']> : T[K] } & QueryHasSelect;
8946
+ } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<Column['__outputType']> : T[K]; } & QueryHasSelect;
8963
8947
  type SetQueryReturnsColumnOptional<T, Column extends Column.Pick.OutputType> = { [K in keyof T]: K extends 'result' ? {
8964
8948
  value: Column;
8965
- } : K extends 'returnType' ? 'value' : K extends 'then' ? QueryThen<Column['__outputType'] | undefined> : T[K] } & QueryHasSelect;
8949
+ } : K extends 'returnType' ? 'value' : K extends 'then' ? QueryThen<Column['__outputType'] | undefined> : T[K]; } & QueryHasSelect;
8966
8950
  type SetQueryReturnsColumn<T extends PickQueryResult> = { [K in keyof T]: K extends 'result' ? {
8967
8951
  value: T['result']['pluck'];
8968
- } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<T['result']['pluck']['__outputType']> : T[K] } & QueryHasSelect;
8952
+ } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<T['result']['pluck']['__outputType']> : T[K]; } & QueryHasSelect;
8969
8953
  type SetQueryReturnsColumnResult<T extends PickQueryResult, Result extends Column$1.QueryColumns> = { [K in keyof T]: K extends 'result' ? {
8970
8954
  value: T['result']['pluck'];
8971
- } : K extends 'returnType' ? 'valueOrThrow' : K extends 'result' ? Result : K extends 'then' ? QueryThen<Result['pluck']['__outputType']> : T[K] } & QueryHasSelect;
8955
+ } : K extends 'returnType' ? 'valueOrThrow' : K extends 'result' ? Result : K extends 'then' ? QueryThen<Result['pluck']['__outputType']> : T[K]; } & QueryHasSelect;
8972
8956
  type SetQueryReturnsRowCount<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'valueOrThrow' : K extends 'result' ? {
8973
8957
  value: Column$1.Pick.QueryColumnOfType<number>;
8974
- } : K extends 'then' ? QueryThen<number> : T[K] };
8958
+ } : K extends 'then' ? QueryThen<number> : T[K]; };
8975
8959
  type SetQueryReturnsRowCountMany<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'pluck' : K extends 'result' ? {
8976
8960
  pluck: Column$1.Pick.QueryColumnOfType<number>;
8977
- } : K extends 'then' ? QueryThen<number> : T[K] };
8978
- type SetQueryReturnsVoid<T> = { [K in keyof T]: K extends 'returnType' ? 'void' : K extends 'then' ? QueryThen<void> : T[K] };
8979
- type SetQueryResult<T extends PickQueryReturnType, Result extends Column$1.QueryColumns> = { [K in keyof T]: K extends 'result' ? Result : K extends 'then' ? QueryThenByQuery<T, Result> : T[K] };
8961
+ } : K extends 'then' ? QueryThen<number> : T[K]; };
8962
+ type SetQueryReturnsVoid<T> = { [K in keyof T]: K extends 'returnType' ? 'void' : K extends 'then' ? QueryThen<void> : T[K]; };
8963
+ type SetQueryResult<T extends PickQueryReturnType, Result extends Column$1.QueryColumns> = { [K in keyof T]: K extends 'result' ? Result : K extends 'then' ? QueryThenByQuery<T, Result> : T[K]; };
8980
8964
  interface QueryOrExpressionBooleanOrNullResult {
8981
8965
  result: {
8982
8966
  value: Column$1.Pick.QueryColumnOfType<boolean | null>;
@@ -8993,10 +8977,10 @@ declare namespace Column$1 {
8993
8977
  unique: Name;
8994
8978
  };
8995
8979
  };
8996
- 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] };
8997
- 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] };
8998
- export type QueryColumnToNullable<C> = { [K in keyof C]: K extends '__outputType' | '__queryType' ? C[K] | null : C[K] };
8999
- export type QueryColumnToOptional<C> = { [K in keyof C]: K extends '__outputType' ? C[K] | undefined : C[K] };
8980
+ 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]; };
8981
+ 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]; };
8982
+ export type QueryColumnToNullable<C> = { [K in keyof C]: K extends '__outputType' | '__queryType' ? C[K] | null : C[K]; };
8983
+ export type QueryColumnToOptional<C> = { [K in keyof C]: K extends '__outputType' ? C[K] | undefined : C[K]; };
9000
8984
  interface DataNullable {
9001
8985
  isNullable: true;
9002
8986
  optional: true;
@@ -9007,18 +8991,23 @@ declare namespace Column$1 {
9007
8991
  isDistinctFrom: Operator<Column['__queryType'] | null, Column>;
9008
8992
  isNotDistinctFrom: Operator<Column['__queryType'] | null, Column>;
9009
8993
  }
9010
- export type Encode<T, InputSchema, Input> = { [K in keyof T]: K extends '__inputType' ? Input : K extends 'inputSchema' ? InputSchema : T[K] };
9011
- 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] };
9012
- 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] };
8994
+ export type Encode<T, InputSchema, Input> = { [K in keyof T]: K extends '__inputType' ? Input : K extends 'inputSchema' ? InputSchema : T[K]; };
8995
+ 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]; };
8996
+ 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]; };
9013
8997
  export type HasDefault<T extends Column.Pick.Data> = T & Column.Data.Default;
9014
- type DefaultSelectData<T extends Column.Data, Value> = { [K in keyof T]: K extends 'explicitSelect' ? Value extends true ? false : true : T[K] };
9015
- export type DefaultSelect<T extends Column.Pick.Data, Value extends boolean> = { [K in keyof T]: K extends 'data' ? DefaultSelectData<T['data'], Value> : T[K] };
8998
+ type DefaultSelectData<T extends Column.Data, Value> = { [K in keyof T]: K extends 'explicitSelect' ? Value extends true ? false : true : T[K]; };
8999
+ export type DefaultSelect<T extends Column.Pick.Data, Value extends boolean> = { [K in keyof T]: K extends 'data' ? DefaultSelectData<T['data'], Value> : T[K]; };
9016
9000
  export interface IsAppReadOnly {
9017
9001
  data: {
9018
9002
  appReadOnly: true;
9019
9003
  };
9020
9004
  }
9021
- 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] };
9005
+ 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]; };
9006
+ export interface Branded<Token extends true | string = true> {
9007
+ data: {
9008
+ branded: Token;
9009
+ };
9010
+ }
9022
9011
  export namespace Pick {
9023
9012
  interface Data {
9024
9013
  data: Column.Data;
@@ -9177,6 +9166,7 @@ declare namespace Column$1 {
9177
9166
  name?: string;
9178
9167
  readOnly?: boolean;
9179
9168
  appReadOnly: true | undefined;
9169
+ branded: true | string | undefined;
9180
9170
  }
9181
9171
  export interface Data extends ColumnDataComputedProp {
9182
9172
  key: string;
@@ -9225,6 +9215,7 @@ declare namespace Column$1 {
9225
9215
  readonly?: boolean;
9226
9216
  valueToArray?: boolean;
9227
9217
  skipValueToArray?: boolean;
9218
+ branded: true | string | undefined;
9228
9219
  }
9229
9220
  export namespace Data {
9230
9221
  interface Default {
@@ -9575,15 +9566,16 @@ declare abstract class Column$1 {
9575
9566
  * @deprecated use `type`, `inputType`, `outputType`, `queryType` instead
9576
9567
  */
9577
9568
  narrowAllTypes: this['__schema']['narrowAllTypes'];
9569
+ brand<T, Token extends true | string = true>(this: T, _token?: Token): T & Column.Branded<Token>;
9578
9570
  input<T extends {
9579
9571
  inputSchema: unknown;
9580
- }, InputSchema extends this['__schema']['__schemaType']>(this: T, fn: (schema: T['inputSchema']) => InputSchema): { [K in keyof T]: K extends 'inputSchema' ? InputSchema : T[K] };
9572
+ }, InputSchema extends this['__schema']['__schemaType']>(this: T, fn: (schema: T['inputSchema']) => InputSchema): { [K in keyof T]: K extends 'inputSchema' ? InputSchema : T[K]; };
9581
9573
  output<T extends {
9582
9574
  outputSchema: unknown;
9583
- }, OutputSchema extends this['__schema']['__schemaType']>(this: T, fn: (schema: T['outputSchema']) => OutputSchema): { [K in keyof T]: K extends 'outputSchema' ? OutputSchema : T[K] };
9575
+ }, OutputSchema extends this['__schema']['__schemaType']>(this: T, fn: (schema: T['outputSchema']) => OutputSchema): { [K in keyof T]: K extends 'outputSchema' ? OutputSchema : T[K]; };
9584
9576
  query<T extends {
9585
9577
  querySchema: unknown;
9586
- }, QuerySchema extends this['__schema']['__schemaType']>(this: T, fn: (schema: T['querySchema']) => QuerySchema): { [K in keyof T]: K extends 'querySchema' ? QuerySchema : T[K] };
9578
+ }, QuerySchema extends this['__schema']['__schemaType']>(this: T, fn: (schema: T['querySchema']) => QuerySchema): { [K in keyof T]: K extends 'querySchema' ? QuerySchema : T[K]; };
9587
9579
  /**
9588
9580
  * Set a database column name.
9589
9581
  *
@@ -9629,7 +9621,7 @@ declare abstract class Column$1 {
9629
9621
  * The column remains a regular writable database column. Create, update,
9630
9622
  * filters, ordering, grouping, and migrations still use the physical column.
9631
9623
  */
9632
- selectSql<T extends Column.Pick.DataAndDataType, Expr extends Expression$1>(this: T, fn: (column: ColumnRefExpression<T & Column.Pick.QueryColumn>) => Expr): SelectSqlColumn<T, Expr>;
9624
+ selectSql<T extends Column.Pick.DataAndDataType, Expr extends Expression$1>(this: T, fn: (column: ColumnRefExpression$1<T & Column.Pick.QueryColumn>) => Expr): SelectSqlColumn$1<T, Expr>;
9633
9625
  /**
9634
9626
  * Forbid the column to be used in [create](/guide/create-update-delete.html#create-insert) and [update](/guide/create-update-delete.html#update) methods.
9635
9627
  *
@@ -10029,6 +10021,6 @@ declare abstract class Column$1 {
10029
10021
  *
10030
10022
  * @param args - raw SQL
10031
10023
  */
10032
- generated<T extends Column.Pick.Data>(this: T, ...args: StaticSQLArgs): Column.Generated<T>;
10024
+ generated<T extends Column.Pick.Data>(this: T, ...args: StaticSQLArgs$1): Column.Generated<T>;
10033
10025
  }
10034
- 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, CannotMutateReadOnlyTableError, 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, DateColumn, type DateColumnData, 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, IntegerColumn, IntervalColumn, type IsQuery, type IsolationLevel, JSONColumn, JSONTextColumn, type JoinedShapes, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, type MapTableScopesOption, type MaybeArray, type MaybePromise, type MergeQuery, MoneyColumn, type NoPrimaryKeyOption, type NonUniqDataItem, type NumberColumnData, Operators, type OperatorsArray, type OperatorsJson, type OperatorsOrdinalText, type OperatorsText, OrchidOrmError, type Ord, PathColumn, type PickQueryInputType, type PickQueryInternal, type PickQueryQ, type PickQueryRelations, type PickQuerySelectableRelations, type PickQueryShape, PointColumn, PolygonColumn, PostgisGeographyPointColumn, type QueryAfterHook, type QueryBeforeActionHook, type QueryBeforeHook, type QueryData, type QueryHasWhere, 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 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, 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 UpdateSelf, 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, _queryInsertManyFrom, _queryJoinOn, _queryRows, _querySelect, _queryTake, _queryTakeOptional, _queryUpdate, _queryUpdateOrThrow, _queryUpsert, _queryWhere, _queryWhereExists, _queryWhereIn, addCode, addTopCte, addTopCteSql, applyMixins, assignDbDataToColumn, backtickQuote, cloneQueryBaseUnscoped, codeToString, colors, columnsShapeToCode, constraintInnerToCode, constraintToCode, consumeColumnName, deepCompare, defaultSchemaConfig, emptyArray, emptyObject, escapeForMigration, escapeString, excludeInnerToCode, excludeToCode, exhaustive, getCallerFilePath, getClonedQueryData, getColumnBaseType, getColumnTypes, getDateAsDateFn, getDateAsNumberFn, getDriverErrorCode, getForeignKeyTableInstance, 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, returnArg, setColumnData, setColumnEncode, setColumnParse, setColumnParseNull, setCurrentColumnName, setDataValue, setDefaultLanguage, setFreeAlias, setQueryObjectValueImmutable, singleQuote, sqlToRawSql, tableDataMethods, toArray, toCamelCase, toPascalCase, toSnakeCase, wrapAdapterFnWithConnectRetry };
10026
+ export { type Adapter, AdapterClass, type AdapterConfigBase, type AdapterParams, type AdapterSchemaConfigOptions, type AfterCommitStandaloneHook, type AfterHook, ArrayColumn, type ArrayColumnValue, type ArrayData, type AsyncState, type BaseNumberData, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BoxColumn, type BrandColumn, type BrandColumnsShape, ByteaColumn, CannotMutateReadOnlyTableError, 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, DateColumn, type DateColumnData, type DateColumnInput, 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, IntegerColumn, IntervalColumn, type IsQuery, type IsolationLevel, JSONColumn, JSONTextColumn, type JoinedShapes, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, type MapTableScopesOption, type MaybeArray, type MaybePromise, type MergeQuery, MoneyColumn, type NoPrimaryKeyOption, type NonUniqDataItem, type NumberColumnData, Operators, type OperatorsArray, type OperatorsDate, type OperatorsJson, type OperatorsNumber, type OperatorsOrdinalText, type OperatorsText, OrchidOrmError, type Ord, PathColumn, type PickQueryInputType, type PickQueryInternal, type PickQueryQ, type PickQueryRelations, type PickQuerySelectableRelations, type PickQueryShape, PointColumn, PolygonColumn, PostgisGeographyPointColumn, type QueryAfterHook, type QueryBeforeActionHook, type QueryBeforeHook, type QueryData, type QueryHasWhere, 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 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, 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 UpdateSelf, 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, _queryInsertManyFrom, _queryJoinOn, _queryRows, _querySelect, _queryTake, _queryTakeOptional, _queryUpdate, _queryUpdateOrThrow, _queryUpsert, _queryWhere, _queryWhereExists, _queryWhereIn, addCode, addTopCte, addTopCteSql, applyMixins, assignDbDataToColumn, backtickQuote, cloneQueryBaseUnscoped, codeToString, colors, columnsShapeToCode, constraintInnerToCode, constraintToCode, consumeColumnName, deepCompare, defaultSchemaConfig, emptyArray, emptyObject, escapeForMigration, escapeString, excludeInnerToCode, excludeToCode, exhaustive, getCallerFilePath, getClonedQueryData, getColumnBaseType, getColumnTypes, getDateAsDateFn, getDateAsNumberFn, getDriverErrorCode, getForeignKeyTableInstance, 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, returnArg, setColumnData, setColumnEncode, setColumnParse, setColumnParseNull, setCurrentColumnName, setDataValue, setDefaultLanguage, setFreeAlias, setQueryObjectValueImmutable, singleQuote, sqlToRawSql, tableDataMethods, toArray, toCamelCase, toPascalCase, toSnakeCase, wrapAdapterFnWithConnectRetry };