pqb 0.72.0 → 0.72.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
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, 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";
3
4
  type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends ((x: infer I) => void) ? I : never;
4
5
  type MaybeArray$1<T> = T | T[];
5
6
  type MaybePromise$1<T> = T | Promise<T>;
@@ -15,7 +16,7 @@ interface RecordOptionalString$1 {
15
16
  interface RecordUnknown$1 {
16
17
  [K: string]: unknown;
17
18
  }
18
- type ShallowSimplify$1<T> = T extends any ? { [K in keyof T]: T[K] } : T;
19
+ type ShallowSimplify$1<T> = T extends any ? { [K in keyof T]: T[K]; } : T;
19
20
  type EmptyObject$1 = {};
20
21
  type EmptyTuple$1 = [];
21
22
  interface RelationJoinQuery$1 {
@@ -61,24 +62,24 @@ interface ColumnsShape$1 {
61
62
  [K: string]: Column$1;
62
63
  }
63
64
  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'] };
65
+ export type DefaultSelectKeys<S extends Column$1.QueryColumnsInit> = { [K in keyof S]: S[K]['data']['explicitSelect'] extends true | undefined ? never : K; }[keyof S];
66
+ export type DefaultOutput<Set extends Column$1.QueryColumnsInit> = { [K in DefaultSelectKeys<Set>]: Set[K]['__outputType']; };
67
+ 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']; };
68
+ export type InputPartial<Shape extends Column$1.QueryColumnsInit> = { [K in keyof Shape]?: Shape[K]['__inputType']; };
69
+ export type Output<Shape extends Column$1.QueryColumns> = { [K in keyof Shape]: Shape[K]['__outputType']; };
70
+ 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
71
  export interface MapToObjectColumn<Shape extends Column$1.QueryColumns> {
71
72
  dataType: 'object';
72
- __type: { [K in keyof Shape]: Shape[K]['__type'] };
73
+ __type: { [K in keyof Shape]: Shape[K]['__type']; };
73
74
  __outputType: ShallowSimplify$1<ObjectOutput<Shape>>;
74
- __queryType: { [K in keyof Shape]: Shape[K]['__queryType'] };
75
+ __queryType: { [K in keyof Shape]: Shape[K]['__queryType']; };
75
76
  operators: OperatorsAny;
76
77
  }
77
78
  export interface MapToNullableObjectColumn<Shape extends Column$1.QueryColumns> {
78
79
  dataType: 'object';
79
- __type: { [K in keyof Shape]: Shape[K]['__type'] };
80
+ __type: { [K in keyof Shape]: Shape[K]['__type']; };
80
81
  __outputType: ShallowSimplify$1<ObjectOutput<Shape>> | undefined;
81
- __queryType: { [K in keyof Shape]: Shape[K]['__queryType'] } | null;
82
+ __queryType: { [K in keyof Shape]: Shape[K]['__queryType']; } | null;
82
83
  operators: OperatorsAny;
83
84
  }
84
85
  export interface MapToPluckColumn<Shape extends Column$1.QueryColumns> {
@@ -90,12 +91,12 @@ declare namespace ColumnsShape$1 {
90
91
  }
91
92
  export interface MapToObjectArrayColumn<Shape extends Column$1.QueryColumns> {
92
93
  dataType: 'array';
93
- __type: { [K in keyof Shape]: Shape[K]['__type'] }[];
94
+ __type: { [K in keyof Shape]: Shape[K]['__type']; }[];
94
95
  __outputType: ShallowSimplify$1<ObjectOutput<Shape>>[];
95
- __queryType: { [K in keyof Shape]: Shape[K]['__queryType'] }[];
96
+ __queryType: { [K in keyof Shape]: Shape[K]['__queryType']; }[];
96
97
  operators: OperatorsAny;
97
98
  }
98
- type ObjectOutput<Shape extends Column$1.QueryColumns> = { [K in keyof Shape]: Shape[K]['__outputType'] };
99
+ type ObjectOutput<Shape extends Column$1.QueryColumns> = { [K in keyof Shape]: Shape[K]['__outputType']; };
99
100
  export {};
100
101
  }
101
102
  declare abstract class OrchidOrmError extends Error {}
@@ -129,7 +130,7 @@ declare abstract class QueryError<T extends PickQueryShape$1 = PickQueryShape$1>
129
130
  line: string | undefined;
130
131
  routine: string | undefined;
131
132
  get isUnique(): boolean;
132
- get columns(): { [K in keyof T["shape"]]?: true | undefined };
133
+ get columns(): { [K in keyof T["shape"]]?: true | undefined; };
133
134
  }
134
135
  declare class CannotMutateReadOnlyTableError extends OrchidOrmInternalError {
135
136
  constructor(query: IsQuery$1);
@@ -348,7 +349,7 @@ type WithSelectable<W extends WithDataItem> = keyof W['shape'] | `${W['table']}.
348
349
  * The first argument of all `join` and `joinLateral` methods.
349
350
  * See argument of {@link join}.
350
351
  */
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;
352
+ 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
353
  interface FnPickQueryResultAs {
353
354
  (): PickQueryResultAs;
354
355
  }
@@ -356,7 +357,7 @@ interface FnPickQueryResultAs {
356
357
  * Arguments of `join` methods (not `joinLateral`).
357
358
  * See {@link join}
358
359
  */
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;
360
+ 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
361
  /**
361
362
  * Column names of the joined table that can be used to join.
362
363
  * Derived from 'result', not from 'shape',
@@ -367,16 +368,16 @@ type JoinArgs<T extends PickQuerySelectableShapeRelationsWithDataAs, Arg extends
367
368
  * And the selection becomes available to use in the `ON` and to select from the joined table.
368
369
  */
369
370
  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] };
371
+ 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];
372
+ type JoinResultRequireMain<T extends PickQuerySelectable, JoinedSelectable> = { [K in keyof T]: K extends '__selectable' ? T['__selectable'] & JoinedSelectable : T[K]; };
372
373
  /**
373
374
  * Result of all `join` methods, not `joinLateral`.
374
375
  * Adds joined table columns from its 'result' to the '__selectable' of the query.
375
376
  */
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']]: {
377
+ 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
378
  as: T['__selectable'][K]['as'];
378
379
  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] };
380
+ }; } & 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
381
  /**
381
382
  * Calls {@link JoinResult} with either callback result, if join has a callback,
382
383
  * or with a query derived from the first join argument.
@@ -415,8 +416,8 @@ type JoinResultSelectable<Result extends Column$1.QueryColumns, As extends strin
415
416
  } : {
416
417
  as: K;
417
418
  column: Result[K];
418
- } };
419
- relations: { [K in keyof JoinedRelations & string as `${As}.${K}`]: JoinedRelations[K] };
419
+ }; };
420
+ relations: { [K in keyof JoinedRelations & string as `${As}.${K}`]: JoinedRelations[K]; };
420
421
  } : {
421
422
  __selectable: { [K in '*' | (keyof Result & string) as `${As}.${K}`]: K extends '*' ? {
422
423
  as: As;
@@ -424,10 +425,10 @@ type JoinResultSelectable<Result extends Column$1.QueryColumns, As extends strin
424
425
  } : {
425
426
  as: K;
426
427
  column: Column$1.QueryColumnToNullable<Result[K]>;
427
- } };
428
- relations: { [K in keyof JoinedRelations & string as `${As}.${K}`]: JoinedRelations[K] };
428
+ }; };
429
+ relations: { [K in keyof JoinedRelations & string as `${As}.${K}`]: JoinedRelations[K]; };
429
430
  };
430
- type JoinAddSelectable<T extends PickQuerySelectable, Joined extends PickQuerySelectableRelations$1> = { [K in keyof T]: K extends '__selectable' ? T['__selectable'] & Joined['__selectable'] : T[K] };
431
+ type JoinAddSelectable<T extends PickQuerySelectable, Joined extends PickQuerySelectableRelations$1> = { [K in keyof T]: K extends '__selectable' ? T['__selectable'] & Joined['__selectable'] : T[K]; };
431
432
  /**
432
433
  * Map the first argument of `join` or `joinLateral` to a query type.
433
434
  *
@@ -438,7 +439,7 @@ type JoinAddSelectable<T extends PickQuerySelectable, Joined extends PickQuerySe
438
439
  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
440
  as: K;
440
441
  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;
442
+ }; } : 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
443
  interface JoinArgToQueryCallback {
443
444
  (...args: any[]): IsQuery$1;
444
445
  }
@@ -1071,19 +1072,16 @@ declare class QueryJoin {
1071
1072
  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
1073
  as: K;
1073
1074
  column: RecordType[K];
1074
- } } : T[K] };
1075
+ }; } : T[K]; };
1075
1076
  }
1076
1077
  type OnArgs<S extends QuerySelectable> = [leftColumn: keyof S, rightColumn: keyof S] | [leftColumn: keyof S, op: string, rightColumn: keyof S];
1077
1078
  type OnJsonPathEqualsArgs<S extends QuerySelectable> = [leftColumn: keyof S, leftPath: string, rightColumn: keyof S, rightPath: string];
1078
- /**
1079
- * Mutative {@link OnMethods.prototype.on}
1080
- */
1081
1079
  /**
1082
1080
  * Argument of join callback.
1083
1081
  * It is a query object of table that you're joining, with ability to select main table's columns.
1084
1082
  * Adds {@link OnMethods.prototype.on} method and similar to the query.
1085
1083
  */
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 };
1084
+ 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
1085
  declare class OnMethods {
1088
1086
  /**
1089
1087
  * Use `on` to specify columns to join records.
@@ -1122,7 +1120,7 @@ declare class OnMethods {
1122
1120
  */
1123
1121
  onJsonPathEquals<T extends PickQuerySelectable>(this: T, ...args: OnJsonPathEqualsArgs<T['__selectable']>): T;
1124
1122
  }
1125
- declare class ColumnRefExpression<T extends Column$1.Pick.QueryColumn> extends Expression$1<T> {
1123
+ declare class ColumnRefExpression$1<T extends Column$1.Pick.QueryColumn> extends Expression$1<T> {
1126
1124
  name: string;
1127
1125
  result: {
1128
1126
  value: T;
@@ -1200,10 +1198,10 @@ interface QueryDataSources {
1200
1198
  }
1201
1199
  declare namespace Order {
1202
1200
  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;
1201
+ 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
1202
  export type Args<T extends ArgThis> = Arg<T>[];
1205
1203
  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']];
1204
+ 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
1205
  export {};
1208
1206
  }
1209
1207
  declare class QueryOrder {
@@ -1264,7 +1262,7 @@ interface WindowArgDeclaration<T extends Order.ArgThis = Order.ArgThis> {
1264
1262
  order?: Order.Arg<T>;
1265
1263
  }
1266
1264
  type WindowResult<T, W extends RecordUnknown$1> = T & {
1267
- windows: { [K in keyof W]: true };
1265
+ windows: { [K in keyof W]: true; };
1268
1266
  };
1269
1267
  declare class QueryWindow {
1270
1268
  /**
@@ -1392,9 +1390,9 @@ type SearchArg<T extends PickQuerySelectable, As extends string> = {
1392
1390
  }) & ({
1393
1391
  text: string | Expression$1;
1394
1392
  } | {
1395
- in: MaybeArray$1<keyof T['__selectable']> | { [K in keyof T['__selectable']]?: SearchWeight$1 };
1393
+ in: MaybeArray$1<keyof T['__selectable']> | { [K in keyof T['__selectable']]?: SearchWeight$1; };
1396
1394
  } | {
1397
- vector: { [K in keyof T['__selectable']]: T['__selectable'][K]['column']['dataType'] extends 'tsvector' ? K : never }[keyof T['__selectable']];
1395
+ vector: { [K in keyof T['__selectable']]: T['__selectable'][K]['column']['dataType'] extends 'tsvector' ? K : never; }[keyof T['__selectable']];
1398
1396
  }) & ({
1399
1397
  query: string | Expression$1;
1400
1398
  } | {
@@ -1598,14 +1596,14 @@ declare class SearchMethods {
1598
1596
  */
1599
1597
  search<T extends PickQuerySelectable, As extends string>(this: T, arg: SearchArg<T, As>): WhereSearchResult<T, As>;
1600
1598
  }
1601
- interface OperatorsCount extends OperatorsNumber {
1599
+ interface OperatorsCount extends OperatorsNumber$1 {
1602
1600
  isCount: true;
1603
1601
  }
1604
1602
  type CountColumn = Column$1.Pick.QueryColumnOfTypeAndOps<'int8', number, OperatorsCount>;
1605
1603
  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;
1604
+ 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>>;
1605
+ 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;
1606
+ type NullableNumberReturn<T, DataType> = SetQueryReturnsColumnOrThrow<T, Column$1.Pick.QueryColumnOfTypeAndOps<DataType, number | null, OperatorsNumber$1>> & OperatorsNumber$1;
1609
1607
  type BooleanQueryColumn = Column$1.Pick.QueryColumnOfTypeAndOps<'bool', boolean, OperatorsBoolean>;
1610
1608
  type BooleanNullable = Column$1.Pick.QueryColumnOfTypeAndOps<'bool', boolean | null, OperatorsBoolean>;
1611
1609
  type NullableBooleanReturn<T> = SetQueryReturnsColumnOrThrow<T, BooleanNullable> & OperatorsBoolean;
@@ -1621,9 +1619,9 @@ interface RecordSelectableOrExpression<T extends PickQuerySelectable> {
1621
1619
  }
1622
1620
  type NullableJSONObjectReturn<T extends PickQuerySelectable, Obj extends RecordSelectableOrExpression<T>> = SetQueryReturnsColumnOrThrow<T, {
1623
1621
  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;
1622
+ __type: { [K in keyof Obj]: ExpressionOutput<T, Obj[K]>['__type']; } | null;
1623
+ __outputType: { [K in keyof Obj]: ExpressionOutput<T, Obj[K]>['__outputType']; } | null;
1624
+ __queryType: { [K in keyof Obj]: ExpressionOutput<T, Obj[K]>['__queryType']; } | null;
1627
1625
  operators: OperatorsAny;
1628
1626
  }> & OperatorsAny;
1629
1627
  type StringColumn$2 = Column$1.Pick.QueryColumnOfTypeAndOps<string, string, OperatorsText$1>;
@@ -1632,7 +1630,8 @@ type NullableStringReturn<T> = SetQueryReturnsColumnOrThrow<T, StringNullable> &
1632
1630
  interface AggregateArgTypes {
1633
1631
  minMax: 'citext' | 'date' | 'float4' | 'float8' | 'inet' | 'int2' | 'int4' | 'int8' | 'interval' | 'money' | 'numeric' | 'text' | 'time' | 'timestamp' | 'timestamptz';
1634
1632
  sum: 'float4' | 'float8' | 'int2' | 'int4' | 'int8' | 'interval' | 'money' | 'numeric';
1635
- avg: // unlike sum, avg has no money
1633
+ avg:
1634
+ // unlike sum, avg has no money
1636
1635
  'float4' | 'float8' | 'int2' | 'int4' | 'int8' | 'interval' | 'numeric';
1637
1636
  bit: 'bit' | 'int2' | 'int4' | 'int8';
1638
1637
  bool: 'bool';
@@ -2050,11 +2049,11 @@ declare class OrExpression extends Expression$1<BooleanQueryColumn> {
2050
2049
  interface QueryReturnsFnAdd<T extends PickQueryColumTypes> extends PickQueryHasSelect {
2051
2050
  type<C extends Column$1.Pick.QueryColumn>(fn: (types: T['columnTypes']) => C): { [K in keyof T]: K extends 'result' ? {
2052
2051
  value: C;
2053
- } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<C['__outputType']> : T[K] } & C['operators'];
2052
+ } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<C['__outputType']> : T[K]; } & C['operators'];
2054
2053
  }
2055
2054
  type SetQueryReturnsFn<T extends PickQueryColumTypes, C extends Column$1.Pick.OutputType> = { [K in keyof T]: K extends 'result' ? {
2056
2055
  value: C;
2057
- } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<C['__outputType']> : T[K] } & QueryReturnsFnAdd<T>;
2056
+ } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<C['__outputType']> : T[K]; } & QueryReturnsFnAdd<T>;
2058
2057
  declare class QueryExpressions {
2059
2058
  /**
2060
2059
  * `column` references a table column, this can be used in raw SQL or when building a column expression.
@@ -2076,7 +2075,7 @@ declare class QueryExpressions {
2076
2075
  *
2077
2076
  * @param name - column name
2078
2077
  */
2079
- column<T extends PickQueryShape$1, K extends keyof T['shape']>(this: T, name: K): ColumnRefExpression<T['shape'][K]> & T['shape'][K]['operators'];
2078
+ column<T extends PickQueryShape$1, K extends keyof T['shape']>(this: T, name: K): ColumnRefExpression$1<T['shape'][K]> & T['shape'][K]['operators'];
2080
2079
  /**
2081
2080
  * `ref` is similar to [column](#column), but it also allows to reference a column of joined table,
2082
2081
  * and other dynamically defined columns.
@@ -2147,7 +2146,7 @@ declare class QueryExpressions {
2147
2146
  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
2147
  columns: (keyof T['__selectable'])[];
2149
2148
  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'] } | {
2149
+ }> : T['__selectable'][K]['column']['__queryType'] | null | { [O in keyof T['__selectable'][K]['column']['operators']]?: T['__selectable'][K]['column']['operators'][O]['_opType']; } | {
2151
2150
  result: {
2152
2151
  value: {
2153
2152
  __queryType: T['__selectable'][K]['column']['__queryType'] | null;
@@ -2159,7 +2158,7 @@ type WhereArg$1<T extends PickQuerySelectableRelations$1> = { [K in keyof T['__s
2159
2158
  __queryType: T['__selectable'][K]['column']['__queryType'] | null;
2160
2159
  };
2161
2160
  };
2162
- }) } | ((q: WhereQueryBuilder<T>) => QueryOrExpressionBooleanOrNullResult | WhereQueryBuilder<T>);
2161
+ }); } | ((q: WhereQueryBuilder<T>) => QueryOrExpressionBooleanOrNullResult | WhereQueryBuilder<T>);
2163
2162
  /**
2164
2163
  * Callback argument of `where`.
2165
2164
  * It has `where` methods (`where`, `whereNot`, `whereExists`, etc.),
@@ -2168,25 +2167,22 @@ type WhereArg$1<T extends PickQuerySelectableRelations$1> = { [K in keyof T['__s
2168
2167
  * db.table.where((q) => q.relation.count().equals(10))
2169
2168
  * ```
2170
2169
  */
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 };
2170
+ 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
2171
  type WhereArgs<T extends PickQuerySelectableRelations$1> = WhereArg$1<T>[];
2173
2172
  type WhereNotArgs<T extends PickQuerySelectableRelations$1> = [WhereArg$1<T>];
2174
2173
  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 } & {
2174
+ 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
2175
  length: Column extends {
2177
2176
  length: number;
2178
2177
  } ? Column['length'] : never;
2179
2178
  })[] | 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 };
2179
+ type WhereInArg<T extends PickQuerySelectableRelations$1> = { [K in keyof T['__selectable']]?: Iterable<T['__selectable'][K]['column']['__queryType']> | IsQuery$1 | Expression$1; };
2181
2180
  interface QueryHasWhere$1 {
2182
2181
  __hasWhere: true;
2183
2182
  }
2184
2183
  interface QueryFnReturningSelect {
2185
2184
  (q: never): QueryHasSelect;
2186
2185
  }
2187
- /**
2188
- * Mutative {@link Where.prototype.where}
2189
- */
2190
2186
  declare class Where {
2191
2187
  /**
2192
2188
  * Constructing `WHERE` conditions:
@@ -3104,25 +3100,25 @@ interface ColumnToCodeCtx$1 {
3104
3100
  sql?: string;
3105
3101
  isSqlUsed?: boolean;
3106
3102
  }
3107
- type DateColumnInput = string | number | Date;
3103
+ type DateColumnInput$1 = string | number | Date;
3108
3104
  declare abstract class DateBaseColumn<Schema extends ColumnSchemaConfig$1> extends Column$1 {
3109
3105
  dateParsedByDriver?: boolean | undefined;
3110
3106
  __schema: Schema;
3111
3107
  __type: string;
3112
- __inputType: DateColumnInput;
3108
+ __inputType: DateColumnInput$1;
3113
3109
  inputSchema: ReturnType<Schema['stringNumberDate']>;
3114
3110
  data: DateColumnData$1;
3115
3111
  __outputType: string;
3116
3112
  outputSchema: ReturnType<Schema['stringSchema']>;
3117
- __queryType: DateColumnInput;
3113
+ __queryType: DateColumnInput$1;
3118
3114
  querySchema: ReturnType<Schema['stringNumberDate']>;
3119
- operators: OperatorsDate;
3115
+ operators: OperatorsDate$1;
3120
3116
  asNumber: Schema['dateAsNumber'];
3121
3117
  asDate: Schema['dateAsDate'];
3122
3118
  constructor(schema: Schema, dateParsedByDriver?: boolean | undefined);
3123
3119
  }
3124
3120
  declare class DateColumn$1<Schema extends ColumnSchemaConfig$1> extends DateBaseColumn<Schema> {
3125
- dataType: "date";
3121
+ dataType: 'date';
3126
3122
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
3127
3123
  }
3128
3124
  declare abstract class DateTimeBaseClass<Schema extends ColumnSchemaConfig$1> extends DateBaseColumn<Schema> {
@@ -3137,12 +3133,12 @@ declare abstract class DateTimeTzBaseClass<Schema extends ColumnSchemaConfig$1>
3137
3133
  toSQL(): string;
3138
3134
  }
3139
3135
  declare class TimestampColumn$1<Schema extends ColumnSchemaConfig$1> extends DateTimeBaseClass<Schema> {
3140
- dataType: "timestamp";
3136
+ dataType: 'timestamp';
3141
3137
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
3142
3138
  }
3143
3139
  declare class TimestampTZColumn$1<Schema extends ColumnSchemaConfig$1> extends DateTimeTzBaseClass<Schema> {
3144
- dataType: "timestamptz";
3145
- baseDataType: "timestamp";
3140
+ dataType: 'timestamptz';
3141
+ baseDataType: 'timestamp';
3146
3142
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
3147
3143
  }
3148
3144
  declare class TimeColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
@@ -3157,7 +3153,7 @@ declare class TimeColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1
3157
3153
  outputSchema: ReturnType<Schema['stringSchema']>;
3158
3154
  __queryType: string;
3159
3155
  querySchema: ReturnType<Schema['stringSchema']>;
3160
- dataType: "time";
3156
+ dataType: 'time';
3161
3157
  operators: OperatorsTime;
3162
3158
  constructor(schema: Schema, dateTimePrecision?: number);
3163
3159
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
@@ -3175,8 +3171,8 @@ declare class IntervalColumn$1<Schema extends ColumnSchemaConfig$1> extends Colu
3175
3171
  outputSchema: ReturnType<Schema['timeInterval']>;
3176
3172
  __queryType: PostgresInterval;
3177
3173
  querySchema: ReturnType<Schema['timeInterval']>;
3178
- dataType: "interval";
3179
- operators: OperatorsDate;
3174
+ dataType: 'interval';
3175
+ operators: OperatorsDate$1;
3180
3176
  constructor(schema: Schema, fields?: string, precision?: number, parse?: (input: string) => PostgresInterval);
3181
3177
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
3182
3178
  toSQL(): string;
@@ -3216,8 +3212,8 @@ interface ArrayData$1<Item extends ArrayColumnValue$1> extends Column$1.Data, Ar
3216
3212
  }
3217
3213
  declare class ArrayColumn$1<Schema extends ColumnTypeSchemaArg$1, Item extends ArrayColumnValue$1, InputType, OutputType, QueryType> extends Column$1 {
3218
3214
  __schema: Schema;
3219
- dataType: "array";
3220
- operators: OperatorsArray$1<Item["__queryType"]>;
3215
+ dataType: 'array';
3216
+ operators: OperatorsArray$1<Item['__queryType']>;
3221
3217
  data: ArrayData$1<Item>;
3222
3218
  __type: Item['__type'][];
3223
3219
  __inputType: Item['__type'][];
@@ -3232,7 +3228,7 @@ declare class ArrayColumn$1<Schema extends ColumnTypeSchemaArg$1, Item extends A
3232
3228
  }
3233
3229
  declare class JSONColumn$1<T, Schema extends ColumnTypeSchemaArg$1, InputSchema = Schema['__schemaType']> extends Column$1 {
3234
3230
  __schema: Schema;
3235
- dataType: "jsonb";
3231
+ dataType: 'jsonb';
3236
3232
  __type: T;
3237
3233
  __inputType: T;
3238
3234
  inputSchema: InputSchema;
@@ -3246,7 +3242,7 @@ declare class JSONColumn$1<T, Schema extends ColumnTypeSchemaArg$1, InputSchema
3246
3242
  }
3247
3243
  declare class JSONTextColumn$1<T, Schema extends ColumnTypeSchemaArg$1, InputSchema = Schema['__schemaType']> extends Column$1 {
3248
3244
  __schema: Schema;
3249
- dataType: "json";
3245
+ dataType: 'json';
3250
3246
  __type: T;
3251
3247
  __inputType: T;
3252
3248
  inputSchema: InputSchema;
@@ -3276,7 +3272,7 @@ declare abstract class NumberBaseColumn<Schema extends ColumnSchemaConfig$1, Sch
3276
3272
  outputSchema: SchemaType;
3277
3273
  __queryType: number;
3278
3274
  querySchema: SchemaType;
3279
- operators: OperatorsNumber;
3275
+ operators: OperatorsNumber$1;
3280
3276
  }
3281
3277
  declare abstract class IntegerBaseColumn<Schema extends ColumnSchemaConfig$1> extends NumberBaseColumn<Schema, ReturnType<Schema['int']>> {
3282
3278
  data: NumberColumnData$1;
@@ -3288,7 +3284,7 @@ declare abstract class NumberAsStringBaseColumn<Schema extends ColumnSchemaConfi
3288
3284
  __type: string;
3289
3285
  __inputType: InputType;
3290
3286
  inputSchema: ReturnType<Schema['stringSchema']>;
3291
- operators: OperatorsNumber;
3287
+ operators: OperatorsNumber$1;
3292
3288
  __outputType: string;
3293
3289
  outputSchema: ReturnType<Schema['stringSchema']>;
3294
3290
  __queryType: InputType;
@@ -3303,47 +3299,47 @@ interface DecimalColumnData$1 extends Column$1.Data {
3303
3299
  declare class DecimalColumn$1<Schema extends ColumnSchemaConfig$1> extends NumberAsStringBaseColumn<Schema> {
3304
3300
  data: DecimalColumnData$1;
3305
3301
  querySchema: ReturnType<Schema['stringSchema']>;
3306
- operators: OperatorsNumber;
3307
- dataType: "numeric";
3302
+ operators: OperatorsNumber$1;
3303
+ dataType: 'numeric';
3308
3304
  constructor(schema: Schema, numericPrecision?: number, numericScale?: number);
3309
3305
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
3310
3306
  toSQL(): string;
3311
3307
  }
3312
3308
  declare class SmallIntColumn$1<Schema extends ColumnSchemaConfig$1> extends IntegerBaseColumn<Schema> {
3313
- dataType: "int2";
3309
+ dataType: 'int2';
3314
3310
  querySchema: ReturnType<Schema['int']>;
3315
3311
  constructor(schema: Schema);
3316
3312
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
3317
3313
  identity<T extends Column$1.Pick.Data>(this: T, options?: TableData$1.Identity): Column$1.HasDefault<T>;
3318
3314
  }
3319
3315
  declare class IntegerColumn$1<Schema extends ColumnSchemaConfig$1> extends IntegerBaseColumn<Schema> {
3320
- dataType: "int4";
3316
+ dataType: 'int4';
3321
3317
  querySchema: ReturnType<Schema['int']>;
3322
3318
  constructor(schema: Schema);
3323
3319
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
3324
3320
  identity<T extends Column$1.Pick.Data>(this: T, options?: TableData$1.Identity): Column$1.HasDefault<T>;
3325
3321
  }
3326
3322
  declare class BigIntColumn$1<Schema extends ColumnSchemaConfig$1> extends NumberAsStringBaseColumn<Schema, string | number | bigint> {
3327
- dataType: "int8";
3323
+ dataType: 'int8';
3328
3324
  querySchema: ReturnType<Schema['stringSchema']>;
3329
3325
  constructor(schema: Schema);
3330
3326
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
3331
3327
  identity<T extends Column$1.Pick.Data>(this: T, options?: TableData$1.Identity): Column$1.HasDefault<T>;
3332
3328
  }
3333
3329
  declare class RealColumn$1<Schema extends ColumnSchemaConfig$1> extends NumberBaseColumn<Schema, ReturnType<Schema['number']>> {
3334
- dataType: "float4";
3330
+ dataType: 'float4';
3335
3331
  querySchema: ReturnType<Schema['number']>;
3336
3332
  constructor(schema: Schema);
3337
3333
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
3338
3334
  }
3339
3335
  declare class DoublePrecisionColumn$1<Schema extends ColumnSchemaConfig$1> extends NumberAsStringBaseColumn<Schema> {
3340
- dataType: "float8";
3336
+ dataType: 'float8';
3341
3337
  querySchema: ReturnType<Schema['stringSchema']>;
3342
3338
  constructor(schema: Schema);
3343
3339
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
3344
3340
  }
3345
3341
  declare class SmallSerialColumn$1<Schema extends ColumnSchemaConfig$1> extends IntegerBaseColumn<Schema> {
3346
- dataType: "int2";
3342
+ dataType: 'int2';
3347
3343
  data: SerialColumnData$1;
3348
3344
  querySchema: ReturnType<Schema['int']>;
3349
3345
  constructor(schema: Schema);
@@ -3351,7 +3347,7 @@ declare class SmallSerialColumn$1<Schema extends ColumnSchemaConfig$1> extends I
3351
3347
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
3352
3348
  }
3353
3349
  declare class SerialColumn$1<Schema extends ColumnSchemaConfig$1> extends IntegerBaseColumn<Schema> {
3354
- dataType: "int4";
3350
+ dataType: 'int4';
3355
3351
  data: SerialColumnData$1;
3356
3352
  querySchema: ReturnType<Schema['int']>;
3357
3353
  constructor(schema: Schema);
@@ -3359,7 +3355,7 @@ declare class SerialColumn$1<Schema extends ColumnSchemaConfig$1> extends Intege
3359
3355
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
3360
3356
  }
3361
3357
  declare class BigSerialColumn$1<Schema extends ColumnSchemaConfig$1> extends NumberAsStringBaseColumn<Schema> {
3362
- dataType: "int8";
3358
+ dataType: 'int8';
3363
3359
  data: SerialColumnData$1;
3364
3360
  querySchema: ReturnType<Schema['stringSchema']>;
3365
3361
  constructor(schema: Schema);
@@ -3384,12 +3380,12 @@ interface DefaultSchemaConfig$1 extends ColumnSchemaConfig$1<Column$1> {
3384
3380
  __inputType: Input;
3385
3381
  __outputType: Output;
3386
3382
  __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'])>() => {
3383
+ }) => Types): { [K in keyof T]: K extends '__type' ? Types['type'] : K extends keyof Types ? Types[K] : T[K]; };
3384
+ 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
3385
  __inputType: T['__inputType'] extends never ? never : Type;
3390
3386
  __outputType: Type;
3391
3387
  __queryType: Type;
3392
- }) => Types): { [K in keyof T]: K extends keyof Types ? Types[K] : T[K] };
3388
+ }) => Types): { [K in keyof T]: K extends keyof Types ? Types[K] : T[K]; };
3393
3389
  narrowAllTypes<T extends Column$1.InputOutputQueryTypes, Types extends Column$1.InputOutputQueryTypes>(this: T, _fn: (type: <Types extends {
3394
3390
  input?: T['__inputType'];
3395
3391
  output?: T['__outputType'];
@@ -3398,7 +3394,7 @@ interface DefaultSchemaConfig$1 extends ColumnSchemaConfig$1<Column$1> {
3398
3394
  __inputType: undefined extends Types['input'] ? T['__inputType'] : Types['input'];
3399
3395
  __outputType: undefined extends Types['output'] ? T['__outputType'] : Types['output'];
3400
3396
  __queryType: undefined extends Types['query'] ? T['__queryType'] : Types['query'];
3401
- }) => Types): { [K in keyof T]: K extends keyof Types ? Types[K] : T[K] };
3397
+ }) => Types): { [K in keyof T]: K extends keyof Types ? Types[K] : T[K]; };
3402
3398
  dateAsNumber<T extends Column$1.Pick.ForParse>(this: T): Column$1.Parse<T, unknown, number>;
3403
3399
  dateAsDate<T extends Column$1.Pick.ForParse>(this: T): Column$1.Parse<T, unknown, Date>;
3404
3400
  enum<const T extends readonly [string, ...string[]]>(dataType: string, type: T): EnumColumn$1<DefaultSchemaConfig$1, unknown, T>;
@@ -3647,14 +3643,14 @@ declare namespace DefaultPrivileges$1 {
3647
3643
  export {};
3648
3644
  }
3649
3645
  declare const DEFAULT_PRIVILEGE: {
3650
- OBJECT_TYPES: readonly ["TABLES", "SEQUENCES", "FUNCTIONS", "TYPES", "SCHEMAS", "LARGE_OBJECTS"];
3646
+ OBJECT_TYPES: readonly ['TABLES', 'SEQUENCES', 'FUNCTIONS', 'TYPES', 'SCHEMAS', 'LARGE_OBJECTS'];
3651
3647
  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"];
3648
+ TABLE: readonly ['ALL', 'SELECT', 'INSERT', 'UPDATE', 'DELETE', 'TRUNCATE', 'REFERENCES', 'TRIGGER', 'MAINTAIN'];
3649
+ SEQUENCE: readonly ['ALL', 'USAGE', 'SELECT', 'UPDATE'];
3650
+ FUNCTION: readonly ['ALL', 'EXECUTE'];
3651
+ TYPE: readonly ['ALL', 'USAGE'];
3652
+ SCHEMA: readonly ['ALL', 'USAGE', 'CREATE'];
3653
+ LARGE_OBJECT: readonly ['ALL', 'SELECT', 'UPDATE'];
3658
3654
  };
3659
3655
  };
3660
3656
  interface DbRole {
@@ -4125,7 +4121,7 @@ declare class QuerySql<ColumnTypes> {
4125
4121
  * @param args - template literal or an object { raw: string }
4126
4122
  * @return object that has `type` and `values` methods
4127
4123
  */
4128
- sql<T = unknown>(this: PickQueryColumTypes, ...args: StaticSQLArgs): RawSql$1<Column$1.Pick.QueryColumnOfType<T>, ColumnTypes>;
4124
+ sql<T = unknown>(this: PickQueryColumTypes, ...args: StaticSQLArgs$1): RawSql$1<Column$1.Pick.QueryColumnOfType<T>, ColumnTypes>;
4129
4125
  sql<T = unknown>(this: PickQueryColumTypes, ...args: [DynamicSQLArg<Column$1.Pick.QueryColumnOfType<T>>]): DynamicRawSQL$1<Column$1.Pick.QueryColumnOfType<T>, ColumnTypes>;
4130
4126
  }
4131
4127
  interface QueryLogObject$1 {
@@ -4386,7 +4382,7 @@ interface BatchParser {
4386
4382
  rows: unknown[];
4387
4383
  }) => MaybePromise$1<void>;
4388
4384
  }
4389
- type ColumnsParsers = { [K in string]?: ColumnParser };
4385
+ type ColumnsParsers = { [K in string]?: ColumnParser; };
4390
4386
  type BatchParsers = BatchParser[];
4391
4387
  interface QueryThen<T> {
4392
4388
  <TResult1 = T, TResult2 = never>(onfulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>;
@@ -4411,7 +4407,7 @@ type SelectArgs<T extends SelectSelf> = ('*' | keyof T['__selectable'])[];
4411
4407
  interface SubQueryAddition<T extends PickQueryWithData> extends IsSubQuery {
4412
4408
  withData: T['withData'];
4413
4409
  }
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 };
4410
+ 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
4411
  interface SelectAsArg<T extends SelectSelf> {
4416
4412
  [K: string]: keyof T['__selectable'] | Expression$1 | ((q: SelectAsFnArg<T>) => unknown);
4417
4413
  }
@@ -4423,10 +4419,10 @@ interface SelectAsCheckReturnTypes {
4423
4419
  [K: string]: PropertyKey | Expression$1 | ((q: never) => SelectAsFnReturnType);
4424
4420
  }
4425
4421
  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] };
4422
+ 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]; };
4423
+ 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}`;
4424
+ 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,
4425
+ ? { [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
4426
  interface AllowedRelationOneQueryForSelectable extends IsSubQuery {
4431
4427
  result: Column$1.QueryColumns;
4432
4428
  returnType: 'value' | 'valueOrThrow' | 'one' | 'oneOrThrow';
@@ -4434,7 +4430,7 @@ interface AllowedRelationOneQueryForSelectable extends IsSubQuery {
4434
4430
  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
4431
  as: C;
4436
4432
  column: R['returnType'] extends 'value' | 'valueOrThrow' ? R['result']['value'] : R['result'][C & keyof R['result']];
4437
- } } : never }[keyof Obj]>;
4433
+ }; } : never; }[keyof Obj]>;
4438
4434
  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
4435
  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
4436
  declare class Select {
@@ -4536,15 +4532,6 @@ type QueryDataTransform = QueryDataTransformFn | {
4536
4532
  interface QueryDataTransformFn {
4537
4533
  (data: unknown, queryData: unknown): unknown;
4538
4534
  }
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
4535
  declare class QueryTransform {
4549
4536
  /**
4550
4537
  * Transform the result of the query right after loading it.
@@ -4603,7 +4590,7 @@ declare class QueryTransform {
4603
4590
  then: QueryThen<infer Data>;
4604
4591
  } ? Data : never, queryData: QueryData$1) => Result): { [K in keyof T]: K extends 'returnType' ? 'valueOrThrow' : K extends 'result' ? {
4605
4592
  value: Column$1.Pick.QueryColumnOfType<Result>;
4606
- } : K extends 'then' ? QueryThen<Result> : T[K] };
4593
+ } : K extends 'then' ? QueryThen<Result> : T[K]; };
4607
4594
  }
4608
4595
  type SelectableOrExpression<T extends PickQuerySelectable = PickQuerySelectable, C extends Column$1.Pick.QueryColumn = Column$1.Pick.QueryColumn> = '*' | keyof T['__selectable'] | Expression$1<C>;
4609
4596
  type SelectableOrExpressions<T extends PickQuerySelectable = PickQuerySelectable, C extends Column$1.Pick.QueryColumn = Column$1.Pick.QueryColumn> = ('*' | keyof T['__selectable'] | Expression$1<C>)[];
@@ -4647,9 +4634,9 @@ declare abstract class Expression$1<T extends Column$1.Pick.QueryColumn = Column
4647
4634
  }
4648
4635
  type TemplateLiteralArgs$1 = [strings: TemplateStringsArray, ...values: unknown[]];
4649
4636
  interface DynamicSQLArg<T extends Column$1.Pick.QueryColumn> {
4650
- (sql: (...args: StaticSQLArgs) => Expression$1<T>): Expression$1<T>;
4637
+ (sql: (...args: StaticSQLArgs$1) => Expression$1<T>): Expression$1<T>;
4651
4638
  }
4652
- type StaticSQLArgs = TemplateLiteralArgs$1 | [{
4639
+ type StaticSQLArgs$1 = TemplateLiteralArgs$1 | [{
4653
4640
  raw: string;
4654
4641
  values?: RawSQLValues;
4655
4642
  }];
@@ -4660,7 +4647,8 @@ declare abstract class ExpressionTypeMethod {
4660
4647
  expr?: Expression$1;
4661
4648
  };
4662
4649
  columnTypes: unknown;
4663
- }, C extends Column$1.Pick.QueryColumn>(this: T, fn: (types: T['columnTypes']) => C): // Omit is optimal
4650
+ }, C extends Column$1.Pick.QueryColumn>(this: T, fn: (types: T['columnTypes']) => C):
4651
+ // Omit is optimal
4664
4652
  Omit<T, 'result'> & {
4665
4653
  result: {
4666
4654
  value: C;
@@ -4822,7 +4810,7 @@ interface QueryDataAliases extends PickQueryDataAliases {
4822
4810
  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
4811
  as: K;
4824
4812
  column: T['shape'][K];
4825
- } } : K extends '__as' ? As : T[K] };
4813
+ }; } : K extends '__as' ? As : T[K]; };
4826
4814
  type AsQueryArg = PickQuerySelectableShapeAs;
4827
4815
  declare abstract class QueryAsMethods {
4828
4816
  /**
@@ -4863,11 +4851,11 @@ interface CteQueryBuilder<T extends PickQueryWithDataColumnTypes> extends Query
4863
4851
  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
4852
  table: Name;
4865
4853
  shape: Q['result'];
4866
- } : K extends keyof T['withData'] ? T['withData'][K] : never } : T[K] };
4854
+ } : K extends keyof T['withData'] ? T['withData'][K] : never; } : T[K]; };
4867
4855
  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
4856
  table: Name;
4869
4857
  shape: Shape;
4870
- } : K extends keyof T['withData'] ? T['withData'][K] : never } : T[K] };
4858
+ } : K extends keyof T['withData'] ? T['withData'][K] : never; } : T[K]; };
4871
4859
  declare class CteQuery {
4872
4860
  /**
4873
4861
  * Use `with` to add a Common Table Expression (CTE) to the query.
@@ -5057,8 +5045,8 @@ declare class CteQuery {
5057
5045
  * .where({ n: { gt: 10 } });
5058
5046
  * ```
5059
5047
  */
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;
5048
+ 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;
5049
+ 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
5050
  /**
5063
5051
  * Use `withSql` to add a Common Table Expression (CTE) based on a custom SQL.
5064
5052
  *
@@ -5117,13 +5105,13 @@ declare class CteQuery {
5117
5105
  }
5118
5106
  interface FromQuerySelf extends PickQuerySelectable, PickQueryShape$1, PickQueryReturnType, PickQueryWithData, PickQueryAs, PickQueryHasSelect {}
5119
5107
  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}`]: {
5108
+ 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
5109
  as: K;
5122
5110
  column: T['withData'][A]['shape'][K];
5123
- } } : never : A extends PickQueryResultAs ? { [K in keyof A['result'] & string as `${A['__as']}.${K}`]: K extends string ? {
5111
+ }; } : never : A extends PickQueryResultAs ? { [K in keyof A['result'] & string as `${A['__as']}.${K}`]: K extends string ? {
5124
5112
  as: K;
5125
5113
  column: A['result'][K];
5126
- } : never } : never> : T[K] } : T;
5114
+ } : never; } : never> : T[K]; } : T;
5127
5115
  declare class FromMethods {
5128
5116
  /**
5129
5117
  * Set the `FROM` value, by default the table name is used.
@@ -5236,15 +5224,7 @@ type CreateManyFromResult<T extends CreateSelf$1> = T extends {
5236
5224
  isCount: true;
5237
5225
  } ? T : T['returnType'] extends 'one' | 'oneOrThrow' ? SetQueryReturnsAll<T> : T['returnType'] extends 'value' | 'valueOrThrow' ? SetValueQueryReturnsPluckColumn<T> : T;
5238
5226
  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>;
5227
+ 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
5228
  declare class QueryCreateFrom {
5249
5229
  /**
5250
5230
  * Inserts a single record based on a query that selects a single record.
@@ -5400,9 +5380,9 @@ declare class QueryCreateFrom {
5400
5380
  interface CreateSelf$1 extends PickQueryHasSelect, PickQueryDefaults, PickQueryResult, PickQueryRelations$1, PickQueryRelationsDataForCreate, PickQueryRelationsDataForCreateOptional, PickQueryWithData, PickQueryReturnType, PickQueryShape$1, PickQueryUniqueProperties, PickQueryInputType$1, Query.Pick.IsNotReadOnly {}
5401
5381
  type CreateData$1<T extends CreateSelf$1> = EmptyObject$1 extends T['relations'] ? CreateDataWithDefaults<T, keyof T['__defaults']> : CreateRelationsData<T>;
5402
5382
  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 {
5383
+ 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; };
5384
+ 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; };
5385
+ type WritableForeignKeys<T extends CreateSelf$1, AllFKeys extends PropertyKey> = AllFKeys extends (infer K) ? K extends keyof T['shape'] ? T['shape'][K] extends {
5406
5386
  data: {
5407
5387
  makeColumnWritable: true;
5408
5388
  };
@@ -5410,8 +5390,8 @@ type WritableForeignKeys<T extends CreateSelf$1, AllFKeys extends PropertyKey> =
5410
5390
  type CreateColumn<T extends CreateSelf$1, K extends keyof T['__inputType']> = T['__inputType'][K] | ((q: T) => QueryOrExpression$1<T['__inputType'][K]>);
5411
5391
  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
5392
  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;
5393
+ 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;
5394
+ 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
5395
  type CreateResult<T extends CreateSelf$1, Data> = T extends {
5416
5396
  isCount: true;
5417
5397
  } ? 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 +5406,12 @@ type InsertManyResult<T extends CreateSelf$1> = T['__hasSelect'] extends true ?
5426
5406
  *
5427
5407
  * The same should work as well with any non-null columns passed to `create`, but it's to be implemented later.
5428
5408
  */
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] };
5409
+ 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
5410
  type IgnoreResult<T extends CreateSelf$1> = T['returnType'] extends 'oneOrThrow' ? QueryTakeOptional<T> : T['returnType'] extends 'valueOrThrow' ? SetQueryReturnsColumnOptional<T, T['result']['value']> : T;
5431
5411
  type OnConflictArg<T extends PickQueryUniqueProperties> = T['internal']['uniqueColumnNames'] | T['internal']['uniqueColumnTuples'] | Expression$1 | {
5432
5412
  constraint: T['internal']['uniqueConstraints'];
5433
5413
  };
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] };
5414
+ 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
5415
  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
5416
  declare class QueryCreate {
5437
5417
  /**
@@ -5701,7 +5681,7 @@ declare class QueryCreate {
5701
5681
  */
5702
5682
  onConflictDoNothing<T extends CreateSelf$1, Arg extends OnConflictArg<T>>(this: T, arg?: Arg): IgnoreResult<T>;
5703
5683
  }
5704
- type OnConflictSet$1<T extends CreateSelf$1> = { [K in keyof T['__inputType']]?: T['__inputType'][K] | (() => QueryOrExpression$1<T['__inputType'][K]>) };
5684
+ type OnConflictSet$1<T extends CreateSelf$1> = { [K in keyof T['__inputType']]?: T['__inputType'][K] | (() => QueryOrExpression$1<T['__inputType'][K]>); };
5705
5685
  declare class OnConflictQueryBuilder<T extends CreateSelf$1, Arg extends OnConflictArg<T> | undefined> {
5706
5686
  private query;
5707
5687
  private onConflict;
@@ -5777,11 +5757,11 @@ type OnConflictMerge = string | string[] | {
5777
5757
  except: string | string[];
5778
5758
  };
5779
5759
  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'] };
5760
+ 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
5761
  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
5762
  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 };
5763
+ 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']];
5764
+ type ChangeCountArg<T extends UpdateSelf> = NumericColumns<T> | { [K in NumericColumns<T>]?: T['shape'][K]['__type'] extends number | null ? number : number | string | bigint; };
5785
5765
  interface UpdateManyBySelf extends UpdateSelf {
5786
5766
  internal: {
5787
5767
  uniqueColumns: unknown;
@@ -5790,10 +5770,10 @@ interface UpdateManyBySelf extends UpdateSelf {
5790
5770
  uniqueConstraints: unknown;
5791
5771
  };
5792
5772
  }
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 })[];
5773
+ 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
5774
  type UpdateManyByKeys<T extends UpdateManyBySelf> = T['internal']['uniqueColumnNames'] | T['internal']['uniqueColumnTuples'];
5795
5775
  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 })[];
5776
+ 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
5777
  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
5778
  declare class QueryUpdate {
5799
5779
  /**
@@ -6238,7 +6218,7 @@ declare class QueryUpdate {
6238
6218
  */
6239
6219
  updateManyByOptional<T extends UpdateManyBySelf, Keys extends UpdateManyByKeys<T>, K = UpdateManyByKeyColumns<Keys>>(this: T, keys: Keys, data: UpdateManyByData<T, K>): UpdateManyResult<T> & QueryHasWhere$1;
6240
6220
  }
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 };
6221
+ 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
6222
  type UpsertResult<T extends PickQueryHasSelectResultReturnType> = T['__hasSelect'] extends true ? T['returnType'] extends 'value' | 'valueOrThrow' ? SetValueQueryReturnsValueOrThrow<T> : SetQueryReturnsOne<T> : SetQueryReturnsVoid<T>;
6243
6223
  interface UpsertThis$1 extends UpdateSelf, CreateSelf$1 {
6244
6224
  __hasWhere: true;
@@ -6806,14 +6786,14 @@ type WrapQueryArg = FromQuerySelf;
6806
6786
  declare class QueryWrap {
6807
6787
  wrap<T extends IsQuery$1, Q extends WrapQueryArg, As extends string = 't'>(this: T, query: Q, as?: As): SetQueryTableAlias<Q, As>;
6808
6788
  }
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 }[]>;
6789
+ 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
6790
  type HookSelectArg<T extends PickQueryShape$1> = (keyof T['shape'] & string)[];
6811
6791
  declare class QueryHookUtils$1<T extends PickQueryInputType$1> {
6812
6792
  query: IsQuery$1;
6813
6793
  columns: string[];
6814
6794
  private key;
6815
6795
  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;
6796
+ set: (data: { [K in keyof T['__inputType']]?: T['__inputType'][K] | (() => QueryOrExpression$1<T['__inputType'][K]>); }) => void;
6817
6797
  }
6818
6798
  declare abstract class QueryHooks$1 {
6819
6799
  /**
@@ -6958,7 +6938,7 @@ declare abstract class QueryHooks$1 {
6958
6938
  catchAfterCommitError<T>(this: T, fn: AfterCommitErrorHandler): T;
6959
6939
  }
6960
6940
  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] };
6941
+ 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
6942
  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
6943
  declare class MergeQueryMethods {
6964
6944
  merge<T extends MergeQueryArg, Q extends MergeQueryArg>(this: T, q: Q): MergeQuery$1<T, Q>;
@@ -6968,9 +6948,9 @@ interface ColumnDataSelectSqlProp {
6968
6948
  selectSqlFn?: SelectSqlCallback;
6969
6949
  }
6970
6950
  interface SelectSqlCallback {
6971
- (column: ColumnRefExpression<Column$1.Pick.QueryColumn>): Expression$1;
6951
+ (column: ColumnRefExpression$1<Column$1.Pick.QueryColumn>): Expression$1;
6972
6952
  }
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] };
6953
+ 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
6954
  /**
6975
6955
  * Function to turn the operator expression into SQL.
6976
6956
  *
@@ -6985,7 +6965,7 @@ interface OperatorToSQL {
6985
6965
  interface Operator<Value, Column extends Column.Pick.OutputTypeAndOperators = Column.Pick.OutputTypeAndOperators> {
6986
6966
  <T extends PickQueryResult>(this: T, arg: Value): { [K in Exclude<keyof T, keyof T['result']['value']['operators']>]: K extends 'result' ? {
6987
6967
  value: Column;
6988
- } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<Column['__outputType']> : T[K] } & Column['operators'];
6968
+ } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<Column['__outputType']> : T[K]; } & Column['operators'];
6989
6969
  _opType: Value;
6990
6970
  }
6991
6971
  interface Base$1<Value> {
@@ -7009,7 +6989,7 @@ interface Ord$1<Value> extends Base$1<Value> {
7009
6989
  gte: Operator<Value | IsQuery$1 | Expression$1, BooleanQueryColumn>;
7010
6990
  between: Operator<[Value | IsQuery$1 | Expression$1, Value | IsQuery$1 | Expression$1], BooleanQueryColumn>;
7011
6991
  }
7012
- type OperatorsNumber = Ord$1<number>;
6992
+ type OperatorsNumber$1 = Ord$1<number>;
7013
6993
  interface OperatorsBoolean extends Ord$1<boolean> {
7014
6994
  and: Operator<OperatorsBooleanSelf, BooleanQueryColumn>;
7015
6995
  or: Operator<OperatorsBooleanSelf, BooleanQueryColumn>;
@@ -7197,7 +7177,7 @@ interface OperatorsJson$1 extends Ord$1<unknown> {
7197
7177
  };
7198
7178
  }
7199
7179
  type OperatorsAny = Base$1<any>;
7200
- type OperatorsDate = Ord$1<Date | string>;
7180
+ type OperatorsDate$1 = Ord$1<Date | string>;
7201
7181
  type OperatorsTime = Ord$1<string>;
7202
7182
  interface OperatorsArray$1<T> extends Ord$1<T[]> {
7203
7183
  has: Operator<T | IsQuery$1 | Expression$1, BooleanQueryColumn>;
@@ -7205,7 +7185,7 @@ interface OperatorsArray$1<T> extends Ord$1<T[]> {
7205
7185
  hasSome: Operator<T[] | IsQuery$1 | Expression$1, BooleanQueryColumn>;
7206
7186
  containedIn: Operator<T[] | IsQuery$1 | Expression$1, BooleanQueryColumn>;
7207
7187
  length: {
7208
- _opType: number | { [K in Exclude<keyof OperatorsNumber, '__hasSelect'>]?: OperatorsNumber[K]['_opType'] };
7188
+ _opType: number | { [K in Exclude<keyof OperatorsNumber$1, '__hasSelect'>]?: OperatorsNumber$1[K]['_opType']; };
7209
7189
  };
7210
7190
  }
7211
7191
  type TextColumnData = StringData$1;
@@ -7231,7 +7211,7 @@ declare abstract class LimitedTextBaseColumn<Schema extends ColumnSchemaConfig$1
7231
7211
  toSQL(): string;
7232
7212
  }
7233
7213
  declare class VarCharColumn$1<Schema extends ColumnSchemaConfig$1> extends LimitedTextBaseColumn<Schema> {
7234
- dataType: "varchar";
7214
+ dataType: 'varchar';
7235
7215
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
7236
7216
  }
7237
7217
  declare class StringColumn$1<Schema extends ColumnSchemaConfig$1> extends VarCharColumn$1<Schema> {
@@ -7239,7 +7219,7 @@ declare class StringColumn$1<Schema extends ColumnSchemaConfig$1> extends VarCha
7239
7219
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
7240
7220
  }
7241
7221
  declare class TextColumn$1<Schema extends ColumnSchemaConfig$1> extends TextBaseColumn<Schema, OperatorsOrdinalText$1> {
7242
- dataType: "text";
7222
+ dataType: 'text';
7243
7223
  data: TextColumnData & {
7244
7224
  minArg?: number;
7245
7225
  maxArg?: number;
@@ -7253,7 +7233,7 @@ declare class TextColumn$1<Schema extends ColumnSchemaConfig$1> extends TextBase
7253
7233
  }
7254
7234
  declare class ByteaColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7255
7235
  __schema: Schema;
7256
- dataType: "bytea";
7236
+ dataType: 'bytea';
7257
7237
  operators: OperatorsOrdinalText$1;
7258
7238
  __type: string;
7259
7239
  __inputType: Buffer;
@@ -7267,7 +7247,7 @@ declare class ByteaColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$
7267
7247
  }
7268
7248
  declare class PointColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7269
7249
  __schema: Schema;
7270
- dataType: "point";
7250
+ dataType: 'point';
7271
7251
  __type: string;
7272
7252
  __inputType: string;
7273
7253
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -7281,7 +7261,7 @@ declare class PointColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$
7281
7261
  }
7282
7262
  declare class LineColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7283
7263
  __schema: Schema;
7284
- dataType: "line";
7264
+ dataType: 'line';
7285
7265
  __type: string;
7286
7266
  __inputType: string;
7287
7267
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -7295,7 +7275,7 @@ declare class LineColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1
7295
7275
  }
7296
7276
  declare class LsegColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7297
7277
  __schema: Schema;
7298
- dataType: "lseg";
7278
+ dataType: 'lseg';
7299
7279
  __type: string;
7300
7280
  __inputType: string;
7301
7281
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -7309,7 +7289,7 @@ declare class LsegColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1
7309
7289
  }
7310
7290
  declare class BoxColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7311
7291
  __schema: Schema;
7312
- dataType: "box";
7292
+ dataType: 'box';
7313
7293
  __type: string;
7314
7294
  __inputType: string;
7315
7295
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -7323,7 +7303,7 @@ declare class BoxColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1
7323
7303
  }
7324
7304
  declare class PathColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7325
7305
  __schema: Schema;
7326
- dataType: "path";
7306
+ dataType: 'path';
7327
7307
  __type: string;
7328
7308
  __inputType: string;
7329
7309
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -7337,7 +7317,7 @@ declare class PathColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1
7337
7317
  }
7338
7318
  declare class PolygonColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7339
7319
  __schema: Schema;
7340
- dataType: "polygon";
7320
+ dataType: 'polygon';
7341
7321
  __type: string;
7342
7322
  __inputType: string;
7343
7323
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -7351,7 +7331,7 @@ declare class PolygonColumn$1<Schema extends ColumnSchemaConfig$1> extends Colum
7351
7331
  }
7352
7332
  declare class CircleColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7353
7333
  __schema: Schema;
7354
- dataType: "circle";
7334
+ dataType: 'circle';
7355
7335
  __type: string;
7356
7336
  __inputType: string;
7357
7337
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -7365,7 +7345,7 @@ declare class CircleColumn$1<Schema extends ColumnSchemaConfig$1> extends Column
7365
7345
  }
7366
7346
  declare class MoneyColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7367
7347
  __schema: Schema;
7368
- dataType: "money";
7348
+ dataType: 'money';
7369
7349
  __type: string;
7370
7350
  data: NumberColumnData$1;
7371
7351
  __inputType: string | number;
@@ -7374,13 +7354,13 @@ declare class MoneyColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$
7374
7354
  outputSchema: ReturnType<Schema['number']>;
7375
7355
  __queryType: string | number;
7376
7356
  querySchema: ReturnType<Schema['number']>;
7377
- operators: OperatorsNumber;
7357
+ operators: OperatorsNumber$1;
7378
7358
  constructor(schema: Schema);
7379
7359
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
7380
7360
  }
7381
7361
  declare class CidrColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7382
7362
  __schema: Schema;
7383
- dataType: "cidr";
7363
+ dataType: 'cidr';
7384
7364
  __type: string;
7385
7365
  __inputType: string;
7386
7366
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -7394,7 +7374,7 @@ declare class CidrColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1
7394
7374
  }
7395
7375
  declare class InetColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7396
7376
  __schema: Schema;
7397
- dataType: "inet";
7377
+ dataType: 'inet';
7398
7378
  __type: string;
7399
7379
  __inputType: string;
7400
7380
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -7408,7 +7388,7 @@ declare class InetColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1
7408
7388
  }
7409
7389
  declare class MacAddrColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7410
7390
  __schema: Schema;
7411
- dataType: "macaddr";
7391
+ dataType: 'macaddr';
7412
7392
  __type: string;
7413
7393
  __inputType: string;
7414
7394
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -7422,7 +7402,7 @@ declare class MacAddrColumn$1<Schema extends ColumnSchemaConfig$1> extends Colum
7422
7402
  }
7423
7403
  declare class MacAddr8Column$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7424
7404
  __schema: Schema;
7425
- dataType: "macaddr8";
7405
+ dataType: 'macaddr8';
7426
7406
  __type: string;
7427
7407
  __inputType: string;
7428
7408
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -7436,7 +7416,7 @@ declare class MacAddr8Column$1<Schema extends ColumnSchemaConfig$1> extends Colu
7436
7416
  }
7437
7417
  declare class BitColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7438
7418
  __schema: Schema;
7439
- dataType: "bit";
7419
+ dataType: 'bit';
7440
7420
  __type: string;
7441
7421
  __inputType: string;
7442
7422
  inputSchema: ReturnType<Schema['bit']>;
@@ -7454,7 +7434,7 @@ declare class BitColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1
7454
7434
  }
7455
7435
  declare class BitVaryingColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7456
7436
  __schema: Schema;
7457
- dataType: "varbit";
7437
+ dataType: 'varbit';
7458
7438
  __type: string;
7459
7439
  __inputType: string;
7460
7440
  inputSchema: ReturnType<Schema['bit']>;
@@ -7474,7 +7454,7 @@ type TsVectorGeneratedColumns = string[] | SearchWeightRecord;
7474
7454
  declare class TsVectorColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7475
7455
  defaultLanguage: string;
7476
7456
  __schema: Schema;
7477
- dataType: "tsvector";
7457
+ dataType: 'tsvector';
7478
7458
  __type: string;
7479
7459
  __inputType: string;
7480
7460
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -7509,11 +7489,11 @@ declare class TsVectorColumn$1<Schema extends ColumnSchemaConfig$1> extends Colu
7509
7489
  *
7510
7490
  * @param args
7511
7491
  */
7512
- generated<T extends Column$1.Pick.Data>(this: T, ...args: StaticSQLArgs | [language: string, columns: TsVectorGeneratedColumns] | [columns: TsVectorGeneratedColumns]): Column$1.Generated<T>;
7492
+ generated<T extends Column$1.Pick.Data>(this: T, ...args: StaticSQLArgs$1 | [language: string, columns: TsVectorGeneratedColumns] | [columns: TsVectorGeneratedColumns]): Column$1.Generated<T>;
7513
7493
  }
7514
7494
  declare class TsQueryColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7515
7495
  __schema: Schema;
7516
- dataType: "tsquery";
7496
+ dataType: 'tsquery';
7517
7497
  __type: string;
7518
7498
  __inputType: string;
7519
7499
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -7527,7 +7507,7 @@ declare class TsQueryColumn$1<Schema extends ColumnSchemaConfig$1> extends Colum
7527
7507
  }
7528
7508
  declare class UUIDColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7529
7509
  __schema: Schema;
7530
- dataType: "uuid";
7510
+ dataType: 'uuid';
7531
7511
  __type: string;
7532
7512
  __inputType: string;
7533
7513
  inputSchema: ReturnType<Schema['uuid']>;
@@ -7540,7 +7520,8 @@ declare class UUIDColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1
7540
7520
  /**
7541
7521
  * see {@link Column.primaryKey}
7542
7522
  */
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
7523
+ primaryKey<T extends Column$1.Pick.Data, Name extends string>(this: T, name?: Name):
7524
+ // using & bc otherwise the return type doesn't match `primaryKey` in ColumnType and TS complains
7544
7525
  T & {
7545
7526
  data: {
7546
7527
  primaryKey: Name;
@@ -7551,7 +7532,7 @@ declare class UUIDColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1
7551
7532
  }
7552
7533
  declare class XMLColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7553
7534
  __schema: Schema;
7554
- dataType: "xml";
7535
+ dataType: 'xml';
7555
7536
  __type: string;
7556
7537
  __inputType: string;
7557
7538
  inputSchema: ReturnType<Schema['stringSchema']>;
@@ -7567,7 +7548,7 @@ declare class XMLColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1
7567
7548
  }
7568
7549
  declare class CitextColumn$1<Schema extends ColumnSchemaConfig$1> extends TextBaseColumn<Schema, OperatorsOrdinalText$1> {
7569
7550
  __schema: Schema;
7570
- dataType: "citext";
7551
+ dataType: 'citext';
7571
7552
  data: TextColumnData & {
7572
7553
  minArg?: number;
7573
7554
  maxArg?: number;
@@ -7579,7 +7560,7 @@ declare class CitextColumn$1<Schema extends ColumnSchemaConfig$1> extends TextBa
7579
7560
  }
7580
7561
  declare class BooleanColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7581
7562
  __schema: Schema;
7582
- dataType: "bool";
7563
+ dataType: 'bool';
7583
7564
  operators: OperatorsBoolean;
7584
7565
  __type: boolean;
7585
7566
  __inputType: boolean;
@@ -7646,6 +7627,7 @@ interface PostgisPoint {
7646
7627
  lat: number;
7647
7628
  srid?: number;
7648
7629
  }
7630
+ declare const encode: ({ srid, lon, lat }: PostgisPoint) => string;
7649
7631
  declare class PostgisGeographyPointColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
7650
7632
  __schema: Schema;
7651
7633
  dataType: string;
@@ -7657,11 +7639,7 @@ declare class PostgisGeographyPointColumn$1<Schema extends ColumnSchemaConfig$1>
7657
7639
  __queryType: PostgisPoint;
7658
7640
  querySchema: ReturnType<Schema['geographyPointSchema']>;
7659
7641
  operators: OperatorsAny;
7660
- static encode: ({
7661
- srid,
7662
- lon,
7663
- lat
7664
- }: PostgisPoint) => string;
7642
+ static encode: typeof encode;
7665
7643
  static isDefaultPoint(typmod: number): boolean;
7666
7644
  constructor(schema: Schema);
7667
7645
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
@@ -7783,6 +7761,7 @@ interface QueryData$1 extends QueryDataAliases, PickQueryDataParsers, HasHookSel
7783
7761
  returningMany?: boolean;
7784
7762
  wrapInTransaction?: boolean;
7785
7763
  throwOnNotFound?: boolean;
7764
+ cteThrowOnNotFound?: boolean;
7786
7765
  ensureCount?: number;
7787
7766
  with?: WithItems;
7788
7767
  withShapes?: WithConfigs;
@@ -7974,7 +7953,7 @@ interface ToSQLQuery extends IsQuery$1 {
7974
7953
  type UnionArgs<T extends PickQueryResult> = ({
7975
7954
  result: { [K in keyof T['result']]: {
7976
7955
  __queryType: T['result'][K]['__queryType'];
7977
- } };
7956
+ }; };
7978
7957
  } | ((q: T) => Expression$1))[];
7979
7958
  declare class Union {
7980
7959
  /**
@@ -8170,7 +8149,7 @@ interface QueryPluckSelf extends PickQuerySelectable, PickQueryRelationsWithData
8170
8149
  type PluckArg<T extends QueryPluckSelf> = SelectableOrExpression<T> | ((q: SelectAsFnArg<T>) => Expression$1 | Query.Pick.SingleValueResult);
8171
8150
  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
8151
  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;
8152
+ } : K extends 'returnType' ? 'pluck' : K extends 'then' ? QueryThen<R['result']['value']['__outputType'][]> : T[K]; } : never : S extends SelectableOrExpression<T> ? SetQueryReturnsPluck<T, S> : never;
8174
8153
  declare class QueryPluck {
8175
8154
  /**
8176
8155
  * `.pluck` returns a single array of a single selected column values:
@@ -8232,7 +8211,7 @@ declare class QueryMap {
8232
8211
  then: QueryThen<(infer Data)[]>;
8233
8212
  } ? (input: Data, index: number, arr: Data[]) => Result : never : T extends {
8234
8213
  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' ? {
8214
+ } ? (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
8215
  pluck: Column$1.Pick.QueryColumnOfType<Result>;
8237
8216
  } : T['returnType'] extends QueryReturnTypeOptional ? {
8238
8217
  value: Column$1.Pick.QueryColumnOfType<Result | undefined>;
@@ -8244,7 +8223,7 @@ declare class QueryMap {
8244
8223
  } : K extends 'then' ? QueryThen<T['returnType'] extends QueryReturnTypeAll | 'pluck' ? Result[] : T['returnType'] extends QueryReturnTypeOptional ? Result | undefined : T extends {
8245
8224
  returnType: 'valueOrThrow';
8246
8225
  then: QueryThen<unknown | null>;
8247
- } ? Result | null : Result> : T[K] };
8226
+ } ? Result | null : Result> : T[K]; };
8248
8227
  }
8249
8228
  declare class QueryDistinct {
8250
8229
  /**
@@ -8336,7 +8315,7 @@ declare class QueryExistsMethods {
8336
8315
  */
8337
8316
  notExists<T extends QueryGetSelf>(this: T): SetQueryReturnsColumnOrThrow<T, BooleanQueryColumn>;
8338
8317
  }
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)[];
8318
+ 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
8319
  interface QueryHelperQuery<T extends PickQuerySelectableShapeAs> extends MergeQueryArg {
8341
8320
  returnType: QueryReturnType$1;
8342
8321
  __selectable: Omit<T['__selectable'], `${T['__as']}.${Extract<keyof T['shape'], string>}`>;
@@ -8364,15 +8343,15 @@ interface QueryHelper<T extends PickQueryTableMetaShapeTableAs, Args extends any
8364
8343
  interface NarrowTypeSelf extends PickQueryResultReturnType {
8365
8344
  returnType: undefined | 'all' | 'one' | 'oneOrThrow' | 'value' | 'valueOrThrow' | 'pluck';
8366
8345
  }
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];
8346
+ 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
8347
  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] };
8348
+ value: { [K in keyof T['result']['value']]: K extends '__outputType' ? Narrow : T['result']['value'][K]; };
8370
8349
  }
8371
8350
  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] };
8351
+ pluck: { [K in keyof T['result']['pluck']]: K extends '__outputType' ? Narrow extends unknown[] ? Narrow[number] : Narrow : T['result']['pluck'][K]; };
8373
8352
  }
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>;
8353
+ 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]; };
8354
+ 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
8355
  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
8356
  declare class QueryMethods<ColumnTypes> {
8378
8357
  /**
@@ -8813,14 +8792,14 @@ declare class QueryMethods<ColumnTypes> {
8813
8792
  */
8814
8793
  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
8794
  __outputType: Narrow[K];
8816
- } } : K extends 'then' ? QueryThenByQuery<T, T['result'] & { [K in keyof Narrow]: {
8795
+ }; } : K extends 'then' ? QueryThenByQuery<T, T['result'] & { [K in keyof Narrow]: {
8817
8796
  __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';
8797
+ }; }> : 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
8798
  if<T extends PickQueryResultReturnType, R extends PickQueryResult>(this: T, condition: boolean | null | undefined, fn: (q: T) => R & {
8820
8799
  returnType: T['returnType'];
8821
8800
  }): QueryIfResult<T, R>;
8822
8801
  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'];
8802
+ 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
8803
  }
8825
8804
  interface DbExtension$1 {
8826
8805
  name: string;
@@ -8845,10 +8824,10 @@ interface DbDomainArgRecord {
8845
8824
  type SelectableFromShape$1<Shape extends Column$1.QueryColumns, Table extends string | undefined> = { [K in keyof Shape]: {
8846
8825
  as: K;
8847
8826
  column: Shape[K];
8848
- } } & { [K in keyof Shape & string as `${Table}.${K}`]: {
8827
+ }; } & { [K in keyof Shape & string as `${Table}.${K}`]: {
8849
8828
  as: K;
8850
8829
  column: Shape[K];
8851
- } };
8830
+ }; };
8852
8831
  type QueryReturnType$1 = QueryReturnTypeAll | 'one' | 'oneOrThrow' | 'rows' | 'pluck' | 'value' | 'valueOrThrow' | 'void';
8853
8832
  type QueryReturnTypeAll = undefined | 'all';
8854
8833
  type QueryReturnTypeOptional = 'one' | 'value';
@@ -8931,52 +8910,52 @@ declare namespace Query {
8931
8910
  }
8932
8911
  }
8933
8912
  }
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']];
8913
+ 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
8914
  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] };
8915
+ 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;
8916
+ 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;
8917
+ 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]; };
8918
+ 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]; };
8919
+ 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]; };
8920
+ 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]; };
8921
+ 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]; };
8922
+ type SetQueryReturnsOne<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'then' ? QueryThenShallowSimplify<ColumnsShape$1.Output<T['result']>> : T[K]; };
8923
+ 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]; };
8924
+ 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
8925
  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
8926
  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' ? {
8927
+ } : 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
8928
  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] };
8929
+ } : K extends 'returnType' ? 'pluck' : K extends 'then' ? QueryThen<(S extends Expression$1 ? S['result']['value']['__outputType'] : never)[]> : T[K]; };
8951
8930
  type SetValueQueryReturnsPluckColumn<T extends PickQueryResult> = { [K in keyof T]: K extends 'result' ? {
8952
8931
  pluck: T['result']['value'];
8953
- } : K extends 'returnType' ? 'pluck' : K extends 'then' ? QueryThen<T['result']['value']['__outputType'][]> : T[K] } & QueryHasSelect;
8932
+ } : K extends 'returnType' ? 'pluck' : K extends 'then' ? QueryThen<T['result']['value']['__outputType'][]> : T[K]; } & QueryHasSelect;
8954
8933
  type SetQueryReturnsPluckColumnResult<T extends PickQueryResult, Result extends Column$1.QueryColumns> = { [K in keyof T]: K extends 'result' ? {
8955
8934
  pluck: T['result']['value'];
8956
- } : K extends 'returnType' ? 'pluck' : K extends 'result' ? Result : K extends 'then' ? QueryThen<T['result']['value']['__outputType'][]> : T[K] } & QueryHasSelect;
8935
+ } : K extends 'returnType' ? 'pluck' : K extends 'result' ? Result : K extends 'then' ? QueryThen<T['result']['value']['__outputType'][]> : T[K]; } & QueryHasSelect;
8957
8936
  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']>;
8937
+ type SetValueQueryReturnsValueOrThrow<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<T['result']['value']['__outputType']> : T[K]; };
8938
+ 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
8939
  type SetQueryReturnsColumnOrThrow<T, Column extends Column.Pick.OutputType> = { [K in keyof T]: K extends 'result' ? {
8961
8940
  value: Column;
8962
- } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<Column['__outputType']> : T[K] } & QueryHasSelect;
8941
+ } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<Column['__outputType']> : T[K]; } & QueryHasSelect;
8963
8942
  type SetQueryReturnsColumnOptional<T, Column extends Column.Pick.OutputType> = { [K in keyof T]: K extends 'result' ? {
8964
8943
  value: Column;
8965
- } : K extends 'returnType' ? 'value' : K extends 'then' ? QueryThen<Column['__outputType'] | undefined> : T[K] } & QueryHasSelect;
8944
+ } : K extends 'returnType' ? 'value' : K extends 'then' ? QueryThen<Column['__outputType'] | undefined> : T[K]; } & QueryHasSelect;
8966
8945
  type SetQueryReturnsColumn<T extends PickQueryResult> = { [K in keyof T]: K extends 'result' ? {
8967
8946
  value: T['result']['pluck'];
8968
- } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<T['result']['pluck']['__outputType']> : T[K] } & QueryHasSelect;
8947
+ } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<T['result']['pluck']['__outputType']> : T[K]; } & QueryHasSelect;
8969
8948
  type SetQueryReturnsColumnResult<T extends PickQueryResult, Result extends Column$1.QueryColumns> = { [K in keyof T]: K extends 'result' ? {
8970
8949
  value: T['result']['pluck'];
8971
- } : K extends 'returnType' ? 'valueOrThrow' : K extends 'result' ? Result : K extends 'then' ? QueryThen<Result['pluck']['__outputType']> : T[K] } & QueryHasSelect;
8950
+ } : K extends 'returnType' ? 'valueOrThrow' : K extends 'result' ? Result : K extends 'then' ? QueryThen<Result['pluck']['__outputType']> : T[K]; } & QueryHasSelect;
8972
8951
  type SetQueryReturnsRowCount<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'valueOrThrow' : K extends 'result' ? {
8973
8952
  value: Column$1.Pick.QueryColumnOfType<number>;
8974
- } : K extends 'then' ? QueryThen<number> : T[K] };
8953
+ } : K extends 'then' ? QueryThen<number> : T[K]; };
8975
8954
  type SetQueryReturnsRowCountMany<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'pluck' : K extends 'result' ? {
8976
8955
  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] };
8956
+ } : K extends 'then' ? QueryThen<number> : T[K]; };
8957
+ type SetQueryReturnsVoid<T> = { [K in keyof T]: K extends 'returnType' ? 'void' : K extends 'then' ? QueryThen<void> : T[K]; };
8958
+ 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
8959
  interface QueryOrExpressionBooleanOrNullResult {
8981
8960
  result: {
8982
8961
  value: Column$1.Pick.QueryColumnOfType<boolean | null>;
@@ -8993,10 +8972,10 @@ declare namespace Column$1 {
8993
8972
  unique: Name;
8994
8973
  };
8995
8974
  };
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] };
8975
+ 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]; };
8976
+ 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]; };
8977
+ export type QueryColumnToNullable<C> = { [K in keyof C]: K extends '__outputType' | '__queryType' ? C[K] | null : C[K]; };
8978
+ export type QueryColumnToOptional<C> = { [K in keyof C]: K extends '__outputType' ? C[K] | undefined : C[K]; };
9000
8979
  interface DataNullable {
9001
8980
  isNullable: true;
9002
8981
  optional: true;
@@ -9007,18 +8986,18 @@ declare namespace Column$1 {
9007
8986
  isDistinctFrom: Operator<Column['__queryType'] | null, Column>;
9008
8987
  isNotDistinctFrom: Operator<Column['__queryType'] | null, Column>;
9009
8988
  }
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] };
8989
+ export type Encode<T, InputSchema, Input> = { [K in keyof T]: K extends '__inputType' ? Input : K extends 'inputSchema' ? InputSchema : T[K]; };
8990
+ 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]; };
8991
+ 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
8992
  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] };
8993
+ type DefaultSelectData<T extends Column.Data, Value> = { [K in keyof T]: K extends 'explicitSelect' ? Value extends true ? false : true : T[K]; };
8994
+ 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
8995
  export interface IsAppReadOnly {
9017
8996
  data: {
9018
8997
  appReadOnly: true;
9019
8998
  };
9020
8999
  }
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] };
9000
+ 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]; };
9022
9001
  export namespace Pick {
9023
9002
  interface Data {
9024
9003
  data: Column.Data;
@@ -9577,13 +9556,13 @@ declare abstract class Column$1 {
9577
9556
  narrowAllTypes: this['__schema']['narrowAllTypes'];
9578
9557
  input<T extends {
9579
9558
  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] };
9559
+ }, InputSchema extends this['__schema']['__schemaType']>(this: T, fn: (schema: T['inputSchema']) => InputSchema): { [K in keyof T]: K extends 'inputSchema' ? InputSchema : T[K]; };
9581
9560
  output<T extends {
9582
9561
  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] };
9562
+ }, OutputSchema extends this['__schema']['__schemaType']>(this: T, fn: (schema: T['outputSchema']) => OutputSchema): { [K in keyof T]: K extends 'outputSchema' ? OutputSchema : T[K]; };
9584
9563
  query<T extends {
9585
9564
  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] };
9565
+ }, QuerySchema extends this['__schema']['__schemaType']>(this: T, fn: (schema: T['querySchema']) => QuerySchema): { [K in keyof T]: K extends 'querySchema' ? QuerySchema : T[K]; };
9587
9566
  /**
9588
9567
  * Set a database column name.
9589
9568
  *
@@ -9629,7 +9608,7 @@ declare abstract class Column$1 {
9629
9608
  * The column remains a regular writable database column. Create, update,
9630
9609
  * filters, ordering, grouping, and migrations still use the physical column.
9631
9610
  */
9632
- selectSql<T extends Column.Pick.DataAndDataType, Expr extends Expression$1>(this: T, fn: (column: ColumnRefExpression<T & Column.Pick.QueryColumn>) => Expr): SelectSqlColumn<T, Expr>;
9611
+ 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
9612
  /**
9634
9613
  * 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
9614
  *
@@ -10029,6 +10008,6 @@ declare abstract class Column$1 {
10029
10008
  *
10030
10009
  * @param args - raw SQL
10031
10010
  */
10032
- generated<T extends Column.Pick.Data>(this: T, ...args: StaticSQLArgs): Column.Generated<T>;
10011
+ generated<T extends Column.Pick.Data>(this: T, ...args: StaticSQLArgs$1): Column.Generated<T>;
10033
10012
  }
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 };
10013
+ 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 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 };