pqb 0.67.6 → 0.68.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
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, JoinQueryMethod, JoinedShapes, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, MapTableScopesOption, MaybeArray, MaybePromise, MergeQuery, MoneyColumn, NoPrimaryKeyOption, NonUniqDataItem, NumberColumnData, Operators, OperatorsArray, OperatorsJson, OperatorsOrdinalText, 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, ShapeColumnPrimaryKeys, 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, _orCreate, _prependWith, _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, consumeColumnName, deepCompare, defaultSchemaConfig, emptyArray, emptyObject, escapeForMigration, escapeString, excludeInnerToCode, exhaustive, getCallerFilePath, getClonedQueryData, getColumnBaseType, getColumnTypes, getDateAsDateFn, getDateAsNumberFn, getDriverErrorCode, getFreeAlias, getFreeSetAlias, getImportPath, getPrimaryKeys, getQueryAs, getQuerySchema, getShapeFromSelect, getSqlText, getStackTrace, getSupportedDefaultPrivileges, indexInnerToCode, 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, 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, JoinQueryMethod, 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, ShapeColumnPrimaryKeys, 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, _orCreate, _prependWith, _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, consumeColumnName, deepCompare, defaultSchemaConfig, emptyArray, emptyObject, escapeForMigration, escapeString, excludeInnerToCode, exhaustive, getCallerFilePath, getClonedQueryData, getColumnBaseType, getColumnTypes, getDateAsDateFn, getDateAsNumberFn, getDriverErrorCode, getFreeAlias, getFreeSetAlias, getImportPath, getPrimaryKeys, getQueryAs, getQuerySchema, getShapeFromSelect, getSqlText, getStackTrace, getSupportedDefaultPrivileges, indexInnerToCode, 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
3
  interface RelationJoinQuery$1 {
4
4
  (joiningQuery: IsQuery$1, baseQuery: IsQuery$1): IsQuery$1;
@@ -14,7 +14,6 @@ interface RelationConfigBase$1 extends IsQuery$1 {
14
14
  queryRelated(params: unknown): unknown;
15
15
  modifyRelatedQuery?(relatedQuery: IsQuery$1): (query: IsQuery$1) => void;
16
16
  omitForeignKeyInCreate: PropertyKey;
17
- dataForCreate: unknown;
18
17
  dataForUpdate: unknown;
19
18
  dataForUpdateOne: unknown;
20
19
  primaryKeys: string[];
@@ -24,7 +23,13 @@ interface RelationConfigDataForCreate {
24
23
  nested: RecordUnknown$1;
25
24
  }
26
25
  interface RelationsBase$1 {
27
- [K: string]: RelationConfigBase$1;
26
+ [relationName: string]: RelationConfigBase$1;
27
+ }
28
+ interface RelationsDataForCreateBase {
29
+ [relationName: string]: unknown;
30
+ }
31
+ interface RelationsDataForCreateOptionalBase {
32
+ [relationName: string]: unknown;
28
33
  }
29
34
  type RelationQueryMaybeSingle<T extends RelationConfigBase$1> = T['returnsOne'] extends true ? T['required'] extends true ? QueryManyTake$1<T['query']> : QueryManyTakeOptional$1<T['query']> : T['query'];
30
35
  interface SubQueryForSql extends ToSQLQuery {
@@ -34,6 +39,17 @@ interface HasBeforeAndBeforeSet {
34
39
  before?: QueryBeforeHook$1[];
35
40
  beforeSet?: QueryData$1['beforeSet'];
36
41
  }
42
+ interface SqlJoinExpression<T extends Column$1.Pick.QueryColumn> extends Expression$1<T>, ExpressionTypeMethod {}
43
+ declare class SqlJoinExpression<T extends Column$1.Pick.QueryColumn = Column$1.Pick.QueryColumn> extends Expression$1<T> {
44
+ items: readonly unknown[];
45
+ separator?: RawSqlBase$1 | undefined;
46
+ result: {
47
+ value: T;
48
+ };
49
+ q: ExpressionData$1;
50
+ constructor(items: readonly unknown[], separator?: RawSqlBase$1 | undefined);
51
+ makeSQL(ctx: ToSqlValues$1, quotedAs?: string): string;
52
+ }
37
53
  /**
38
54
  * Expression for a SQL identifier reference.
39
55
  * Used to safely quote identifiers in raw SQL queries.
@@ -651,7 +667,7 @@ interface ColumnSchemaGetterTableClass$1 {
651
667
  createSchema(): unknown;
652
668
  }
653
669
  interface ColumnTypeSchemaArg$1 {
654
- type: unknown;
670
+ __schemaType: unknown;
655
671
  nullable<T extends Column$1.Pick.ForNullable>(this: T): Column$1.Modifiers.Nullable<T, unknown, unknown, unknown>;
656
672
  encode: unknown;
657
673
  parse: unknown;
@@ -682,6 +698,7 @@ interface ColumnSchemaConfig$1<T extends Column$1.Pick.Data = Column$1.Pick.Data
682
698
  bit(max?: number): unknown;
683
699
  uuid(): unknown;
684
700
  json(): T;
701
+ jsonText(): T;
685
702
  inputSchema(this: ColumnSchemaGetterTableClass$1): unknown;
686
703
  outputSchema(this: ColumnSchemaGetterTableClass$1): unknown;
687
704
  querySchema(this: ColumnSchemaGetterTableClass$1): unknown;
@@ -928,16 +945,33 @@ interface NumberColumnData$1 extends BaseNumberData$1, Column$1.Data {
928
945
  interface SerialColumnData$1 extends NumberColumnData$1 {
929
946
  default: Expression$1;
930
947
  }
931
- declare abstract class NumberBaseColumn<Schema extends ColumnSchemaConfig$1, SchemaType extends Schema['type']> extends Column$1<Schema, number, SchemaType, OperatorsNumber> {
948
+ declare abstract class NumberBaseColumn<Schema extends ColumnSchemaConfig$1, SchemaType extends Schema['__schemaType']> extends Column$1 {
949
+ __schema: Schema;
950
+ __type: number;
951
+ __inputType: number;
952
+ inputSchema: SchemaType;
932
953
  data: NumberColumnData$1;
954
+ __outputType: number;
955
+ outputSchema: SchemaType;
956
+ __queryType: number;
957
+ querySchema: SchemaType;
933
958
  operators: OperatorsNumber;
934
959
  }
935
960
  declare abstract class IntegerBaseColumn<Schema extends ColumnSchemaConfig$1> extends NumberBaseColumn<Schema, ReturnType<Schema['int']>> {
936
961
  data: NumberColumnData$1;
962
+ querySchema: ReturnType<Schema['int']>;
937
963
  constructor(schema: Schema);
938
964
  }
939
- declare abstract class NumberAsStringBaseColumn<Schema extends ColumnSchemaConfig$1, InputType = string | number> extends Column$1<Schema, string, ReturnType<Schema['stringSchema']>, OperatorsNumber, InputType> {
965
+ declare abstract class NumberAsStringBaseColumn<Schema extends ColumnSchemaConfig$1, InputType = string | number> extends Column$1 {
966
+ __schema: Schema;
967
+ __type: string;
968
+ __inputType: InputType;
969
+ inputSchema: ReturnType<Schema['stringSchema']>;
940
970
  operators: OperatorsNumber;
971
+ __outputType: string;
972
+ outputSchema: ReturnType<Schema['stringSchema']>;
973
+ __queryType: InputType;
974
+ querySchema: ReturnType<Schema['stringSchema']>;
941
975
  data: Column$1.Data;
942
976
  constructor(schema: Schema);
943
977
  }
@@ -947,6 +981,7 @@ interface DecimalColumnData$1 extends Column$1.Data {
947
981
  }
948
982
  declare class DecimalColumn$1<Schema extends ColumnSchemaConfig$1> extends NumberAsStringBaseColumn<Schema> {
949
983
  data: DecimalColumnData$1;
984
+ querySchema: ReturnType<Schema['stringSchema']>;
950
985
  operators: OperatorsNumber;
951
986
  dataType: "numeric";
952
987
  constructor(schema: Schema, numericPrecision?: number, numericScale?: number);
@@ -956,35 +991,41 @@ declare class DecimalColumn$1<Schema extends ColumnSchemaConfig$1> extends Numbe
956
991
  type IdentityColumn<T extends Column$1.Pick.Data> = Column$1.Modifiers.Default<T, Expression$1>;
957
992
  declare class SmallIntColumn$1<Schema extends ColumnSchemaConfig$1> extends IntegerBaseColumn<Schema> {
958
993
  dataType: "int2";
994
+ querySchema: ReturnType<Schema['int']>;
959
995
  constructor(schema: Schema);
960
996
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
961
- identity<T extends Column$1>(this: T, options?: TableData$1.Identity): IdentityColumn<T>;
997
+ identity<T extends Column$1.Pick.Data>(this: T, options?: TableData$1.Identity): IdentityColumn<T>;
962
998
  }
963
999
  declare class IntegerColumn$1<Schema extends ColumnSchemaConfig$1> extends IntegerBaseColumn<Schema> {
964
1000
  dataType: "int4";
1001
+ querySchema: ReturnType<Schema['int']>;
965
1002
  constructor(schema: Schema);
966
1003
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
967
- identity<T extends Column$1>(this: T, options?: TableData$1.Identity): IdentityColumn<T>;
1004
+ identity<T extends Column$1.Pick.Data>(this: T, options?: TableData$1.Identity): IdentityColumn<T>;
968
1005
  }
969
1006
  declare class BigIntColumn$1<Schema extends ColumnSchemaConfig$1> extends NumberAsStringBaseColumn<Schema, string | number | bigint> {
970
1007
  dataType: "int8";
1008
+ querySchema: ReturnType<Schema['stringSchema']>;
971
1009
  constructor(schema: Schema);
972
1010
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
973
- identity<T extends Column$1>(this: T, options?: TableData$1.Identity): IdentityColumn<T>;
1011
+ identity<T extends Column$1.Pick.Data>(this: T, options?: TableData$1.Identity): IdentityColumn<T>;
974
1012
  }
975
1013
  declare class RealColumn$1<Schema extends ColumnSchemaConfig$1> extends NumberBaseColumn<Schema, ReturnType<Schema['number']>> {
976
1014
  dataType: "float4";
1015
+ querySchema: ReturnType<Schema['number']>;
977
1016
  constructor(schema: Schema);
978
1017
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
979
1018
  }
980
1019
  declare class DoublePrecisionColumn$1<Schema extends ColumnSchemaConfig$1> extends NumberAsStringBaseColumn<Schema> {
981
1020
  dataType: "float8";
1021
+ querySchema: ReturnType<Schema['stringSchema']>;
982
1022
  constructor(schema: Schema);
983
1023
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
984
1024
  }
985
1025
  declare class SmallSerialColumn$1<Schema extends ColumnSchemaConfig$1> extends IntegerBaseColumn<Schema> {
986
1026
  dataType: "int2";
987
1027
  data: SerialColumnData$1;
1028
+ querySchema: ReturnType<Schema['int']>;
988
1029
  constructor(schema: Schema);
989
1030
  toSQL(): string;
990
1031
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
@@ -992,6 +1033,7 @@ declare class SmallSerialColumn$1<Schema extends ColumnSchemaConfig$1> extends I
992
1033
  declare class SerialColumn$1<Schema extends ColumnSchemaConfig$1> extends IntegerBaseColumn<Schema> {
993
1034
  dataType: "int4";
994
1035
  data: SerialColumnData$1;
1036
+ querySchema: ReturnType<Schema['int']>;
995
1037
  constructor(schema: Schema);
996
1038
  toSQL(): string;
997
1039
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
@@ -999,14 +1041,23 @@ declare class SerialColumn$1<Schema extends ColumnSchemaConfig$1> extends Intege
999
1041
  declare class BigSerialColumn$1<Schema extends ColumnSchemaConfig$1> extends NumberAsStringBaseColumn<Schema> {
1000
1042
  dataType: "int8";
1001
1043
  data: SerialColumnData$1;
1044
+ querySchema: ReturnType<Schema['stringSchema']>;
1002
1045
  constructor(schema: Schema);
1003
1046
  toSQL(): string;
1004
1047
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
1005
1048
  }
1006
1049
  type DateColumnInput = string | number | Date;
1007
- declare abstract class DateBaseColumn<Schema extends ColumnSchemaConfig$1> extends Column$1<Schema, string, ReturnType<Schema['stringNumberDate']>, OperatorsDate, DateColumnInput, string, ReturnType<Schema['stringSchema']>> {
1050
+ declare abstract class DateBaseColumn<Schema extends ColumnSchemaConfig$1> extends Column$1 {
1008
1051
  dateParsedByDriver?: boolean | undefined;
1052
+ __schema: Schema;
1053
+ __type: string;
1054
+ __inputType: DateColumnInput;
1055
+ inputSchema: ReturnType<Schema['stringNumberDate']>;
1009
1056
  data: DateColumnData$1;
1057
+ __outputType: string;
1058
+ outputSchema: ReturnType<Schema['stringSchema']>;
1059
+ __queryType: DateColumnInput;
1060
+ querySchema: ReturnType<Schema['stringNumberDate']>;
1010
1061
  operators: OperatorsDate;
1011
1062
  asNumber: Schema['dateAsNumber'];
1012
1063
  asDate: Schema['dateAsDate'];
@@ -1036,42 +1087,66 @@ declare class TimestampTZColumn$1<Schema extends ColumnSchemaConfig$1> extends D
1036
1087
  baseDataType: "timestamp";
1037
1088
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
1038
1089
  }
1039
- declare class TimeColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1<Schema, string, ReturnType<Schema['stringSchema']>, OperatorsTime> {
1090
+ declare class TimeColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
1091
+ __schema: Schema;
1092
+ __type: string;
1093
+ __inputType: ReturnType<Schema['stringSchema']>;
1094
+ inputSchema: ReturnType<Schema['stringSchema']>;
1040
1095
  data: DateColumnData$1 & {
1041
1096
  dateTimePrecision?: number;
1042
1097
  };
1098
+ __outputType: string;
1099
+ outputSchema: ReturnType<Schema['stringSchema']>;
1100
+ __queryType: string;
1101
+ querySchema: ReturnType<Schema['stringSchema']>;
1043
1102
  dataType: "time";
1044
1103
  operators: OperatorsTime;
1045
1104
  constructor(schema: Schema, dateTimePrecision?: number);
1046
1105
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
1047
1106
  }
1048
- declare class IntervalColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1<Schema, PostgresInterval, ReturnType<Schema['timeInterval']>, OperatorsDate, Partial<PostgresInterval>, PostgresInterval> {
1107
+ declare class IntervalColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
1108
+ __schema: Schema;
1109
+ __type: PostgresInterval;
1049
1110
  data: Column$1.Data & {
1050
1111
  fields?: string;
1051
1112
  precision?: number;
1052
1113
  };
1114
+ __inputType: Partial<PostgresInterval>;
1115
+ inputSchema: ReturnType<Schema['timeInterval']>;
1116
+ __outputType: PostgresInterval;
1117
+ outputSchema: ReturnType<Schema['timeInterval']>;
1118
+ __queryType: PostgresInterval;
1119
+ querySchema: ReturnType<Schema['timeInterval']>;
1053
1120
  dataType: "interval";
1054
1121
  operators: OperatorsDate;
1055
1122
  constructor(schema: Schema, fields?: string, precision?: number, parse?: (input: string) => PostgresInterval);
1056
1123
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
1057
1124
  toSQL(): string;
1058
1125
  }
1059
- declare class EnumColumn$1<Schema extends ColumnTypeSchemaArg$1, SchemaType extends Schema['type'], const T extends readonly string[]> extends Column$1<Schema, T[number], SchemaType, OperatorsOrdinalText$1> {
1126
+ declare class EnumColumn$1<Schema extends ColumnTypeSchemaArg$1, SchemaType extends Schema['__schemaType'], const T extends readonly string[]> extends Column$1 {
1060
1127
  enumName: string;
1061
1128
  options: T;
1129
+ __schema: Schema;
1062
1130
  operators: OperatorsOrdinalText$1;
1131
+ __type: T[number];
1132
+ __inputType: T[number];
1133
+ inputSchema: SchemaType;
1134
+ __outputType: T[number];
1135
+ outputSchema: SchemaType;
1136
+ __queryType: T[number];
1137
+ querySchema: SchemaType;
1063
1138
  dataType: string;
1064
1139
  constructor(schema: Schema, enumName: string, options: T, schemaType: SchemaType);
1065
1140
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
1066
1141
  toSQL(): string;
1067
1142
  }
1068
1143
  interface ArrayColumnValue$1 {
1069
- type: unknown;
1144
+ __type: unknown;
1070
1145
  inputSchema: any;
1071
- inputType: unknown;
1072
- outputType: unknown;
1146
+ __inputType: unknown;
1147
+ __outputType: unknown;
1073
1148
  outputSchema: any;
1074
- queryType: any;
1149
+ __queryType: any;
1075
1150
  querySchema: any;
1076
1151
  toSQL(): string;
1077
1152
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
@@ -1081,67 +1156,90 @@ interface ArrayData$1<Item extends ArrayColumnValue$1> extends Column$1.Data, Ar
1081
1156
  item: Item;
1082
1157
  arrayDims: number;
1083
1158
  }
1084
- declare class ArrayColumn$1<Schema extends ColumnTypeSchemaArg$1, Item extends ArrayColumnValue$1, InputType, OutputType, QueryType> extends Column$1<Schema, Item['type'][], InputType, OperatorsArray$1<Item['queryType']>, Item['inputType'][], Item['outputType'][], OutputType, Item['queryType'][], QueryType> {
1159
+ declare class ArrayColumn$1<Schema extends ColumnTypeSchemaArg$1, Item extends ArrayColumnValue$1, InputType, OutputType, QueryType> extends Column$1 {
1160
+ __schema: Schema;
1085
1161
  dataType: "array";
1086
- operators: OperatorsArray$1<Item["queryType"]>;
1162
+ operators: OperatorsArray$1<Item["__queryType"]>;
1087
1163
  data: ArrayData$1<Item>;
1088
- constructor(schema: Schema, item: Item, inputType: InputType, defaultEncode?: (input: unknown) => unknown, outputType?: OutputType, queryType?: QueryType);
1164
+ __type: Item['__type'][];
1165
+ __inputType: Item['__type'][];
1166
+ inputSchema: InputType;
1167
+ __outputType: Item['__outputType'][];
1168
+ outputSchema: OutputType;
1169
+ __queryType: Item['__queryType'][];
1170
+ querySchema: QueryType;
1171
+ constructor(schema: Schema, item: Item, __inputType: InputType, defaultEncode?: (input: unknown) => unknown, __outputType?: OutputType, __queryType?: QueryType);
1089
1172
  toSQL(): string;
1090
1173
  toCode(this: ArrayColumn$1<ColumnSchemaConfig$1, ArrayColumnValue$1, unknown, unknown, unknown>, ctx: ColumnToCodeCtx$1, key: string): Code$1;
1091
1174
  }
1092
- declare class JSONColumn$1<T, Schema extends ColumnTypeSchemaArg$1, InputSchema = Schema['type']> extends Column$1<Schema, T, InputSchema, OperatorsJson$1> {
1175
+ declare class JSONColumn$1<T, Schema extends ColumnTypeSchemaArg$1, InputSchema = Schema['__schemaType']> extends Column$1 {
1176
+ __schema: Schema;
1093
1177
  dataType: "jsonb";
1178
+ __type: T;
1179
+ __inputType: T;
1180
+ inputSchema: InputSchema;
1181
+ __outputType: T;
1182
+ outputSchema: InputSchema;
1183
+ __queryType: T;
1184
+ querySchema: InputSchema;
1094
1185
  operators: OperatorsJson$1;
1095
- constructor(schema: Schema, inputType: Schema['type'], encodedByDriver?: boolean);
1186
+ constructor(schema: Schema, __inputType: InputSchema, encodedByDriver?: boolean);
1096
1187
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
1097
1188
  }
1098
- declare class JSONTextColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1<Schema, unknown, ReturnType<Schema['unknown']>, OperatorsText> {
1189
+ declare class JSONTextColumn$1<T, Schema extends ColumnTypeSchemaArg$1, InputSchema = Schema['__schemaType']> extends Column$1 {
1190
+ __schema: Schema;
1099
1191
  dataType: "json";
1100
- operators: OperatorsText;
1192
+ __type: T;
1193
+ __inputType: T;
1194
+ inputSchema: InputSchema;
1195
+ __outputType: T;
1196
+ outputSchema: InputSchema;
1197
+ __queryType: T;
1198
+ querySchema: InputSchema;
1199
+ operators: OperatorsText$1;
1101
1200
  private static _instance;
1102
- static get instance(): JSONTextColumn$1<DefaultSchemaConfig$1>;
1103
- constructor(schema: Schema);
1201
+ static get instance(): JSONTextColumn$1<unknown, DefaultSchemaConfig$1, unknown>;
1202
+ constructor(schema: Schema, __inputType: InputSchema);
1104
1203
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
1105
1204
  }
1106
1205
  interface DefaultSchemaConfig$1 extends ColumnSchemaConfig$1<Column$1> {
1107
- parse<T extends Column$1.Pick.ForParse, Output>(this: T, fn: (input: T['type']) => Output): Column$1.Modifiers.Parse<T, unknown, Output>;
1206
+ parse<T extends Column$1.Pick.ForParse, Output>(this: T, fn: (input: T['__type']) => Output): Column$1.Modifiers.Parse<T, unknown, Output>;
1108
1207
  parseNull<T extends Column$1.Pick.ForParseNull, Output>(this: T, fn: () => Output): Column$1.Modifiers.ParseNull<T, unknown, Output>;
1109
- encode<T extends {
1110
- type: unknown;
1111
- }, Input>(this: T, fn: (input: Input) => unknown): Column$1.Modifiers.Encode<T, unknown, Input>;
1208
+ encode<T extends Column$1.Pick.Type, Input>(this: T, fn: (input: Input) => unknown): Column$1.Modifiers.Encode<T, unknown, Input>;
1112
1209
  /**
1113
1210
  * @deprecated use narrowType instead
1114
1211
  */
1115
1212
  asType<T, Types extends {
1116
1213
  type: unknown;
1117
- inputType: unknown;
1118
- outputType: unknown;
1119
- queryType: unknown;
1214
+ __inputType: unknown;
1215
+ __outputType: unknown;
1216
+ __queryType: unknown;
1120
1217
  }>(this: T, _fn: (type: <Type, Input = Type, Output = Type, Query = Type>() => {
1121
1218
  type: Type;
1122
- inputType: Input;
1123
- outputType: Output;
1124
- queryType: Query;
1125
- }) => Types): { [K in keyof T]: K extends keyof Types ? Types[K] : T[K] };
1126
- 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'])>() => {
1127
- inputType: T['inputType'] extends never ? never : Type;
1128
- outputType: Type;
1129
- queryType: Type;
1219
+ __inputType: Input;
1220
+ __outputType: Output;
1221
+ __queryType: Query;
1222
+ }) => Types): { [K in keyof T]: K extends '__type' ? Types['type'] : K extends keyof Types ? Types[K] : T[K] };
1223
+ 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'])>() => {
1224
+ __inputType: T['__inputType'] extends never ? never : Type;
1225
+ __outputType: Type;
1226
+ __queryType: Type;
1130
1227
  }) => Types): { [K in keyof T]: K extends keyof Types ? Types[K] : T[K] };
1131
1228
  narrowAllTypes<T extends Column$1.InputOutputQueryTypes, Types extends Column$1.InputOutputQueryTypes>(this: T, _fn: (type: <Types extends {
1132
- input?: T['inputType'];
1133
- output?: T['outputType'];
1134
- query?: T['queryType'];
1229
+ input?: T['__inputType'];
1230
+ output?: T['__outputType'];
1231
+ query?: T['__queryType'];
1135
1232
  }>() => {
1136
- inputType: undefined extends Types['input'] ? T['inputType'] : Types['input'];
1137
- outputType: undefined extends Types['output'] ? T['outputType'] : Types['output'];
1138
- queryType: undefined extends Types['query'] ? T['queryType'] : Types['query'];
1233
+ __inputType: undefined extends Types['input'] ? T['__inputType'] : Types['input'];
1234
+ __outputType: undefined extends Types['output'] ? T['__outputType'] : Types['output'];
1235
+ __queryType: undefined extends Types['query'] ? T['__queryType'] : Types['query'];
1139
1236
  }) => Types): { [K in keyof T]: K extends keyof Types ? Types[K] : T[K] };
1140
- dateAsNumber<T extends Column$1>(this: T): Column$1.Modifiers.Parse<T, unknown, number>;
1141
- dateAsDate<T extends Column$1>(this: T): Column$1.Modifiers.Parse<T, unknown, Date>;
1237
+ dateAsNumber<T extends Column$1.Pick.ForParse>(this: T): Column$1.Modifiers.Parse<T, unknown, number>;
1238
+ dateAsDate<T extends Column$1.Pick.ForParse>(this: T): Column$1.Modifiers.Parse<T, unknown, Date>;
1142
1239
  enum<const T extends readonly [string, ...string[]]>(dataType: string, type: T): EnumColumn$1<DefaultSchemaConfig$1, unknown, T>;
1143
1240
  array<Item extends ArrayColumnValue$1>(item: Item): ArrayColumn$1<DefaultSchemaConfig$1, Item, unknown, unknown, unknown>;
1144
1241
  json<T>(): JSONColumn$1<unknown extends T ? MaybeArray$1<string | number | boolean | object> : T, DefaultSchemaConfig$1>;
1242
+ jsonText<T>(): JSONTextColumn$1<unknown extends T ? MaybeArray$1<string | number | boolean | object> : T, DefaultSchemaConfig$1>;
1145
1243
  inputSchema(): undefined;
1146
1244
  outputSchema(): undefined;
1147
1245
  querySchema(): undefined;
@@ -1166,8 +1264,16 @@ interface DefaultSchemaConfig$1 extends ColumnSchemaConfig$1<Column$1> {
1166
1264
  timestamp(precision?: number): TimestampTZColumn$1<DefaultSchemaConfig$1>;
1167
1265
  }
1168
1266
  type TextColumnData = StringData$1;
1169
- declare abstract class TextBaseColumn<Schema extends ColumnSchemaConfig$1, Ops = OperatorsText> extends Column$1<Schema, string, ReturnType<Schema['stringSchema']>, Ops> {
1267
+ declare abstract class TextBaseColumn<Schema extends ColumnSchemaConfig$1, Ops = OperatorsText$1> extends Column$1 {
1268
+ __schema: Schema;
1269
+ __type: string;
1270
+ __inputType: string;
1271
+ inputSchema: ReturnType<Schema['stringSchema']>;
1170
1272
  data: TextColumnData;
1273
+ __outputType: string;
1274
+ outputSchema: ReturnType<Schema['stringSchema']>;
1275
+ __queryType: string;
1276
+ querySchema: ReturnType<Schema['stringSchema']>;
1171
1277
  operators: Ops;
1172
1278
  constructor(schema: Schema, schemaType?: ReturnType<Schema['stringSchema']>);
1173
1279
  }
@@ -1193,93 +1299,206 @@ declare class TextColumn$1<Schema extends ColumnSchemaConfig$1> extends TextBase
1193
1299
  minArg?: number;
1194
1300
  maxArg?: number;
1195
1301
  };
1302
+ querySchema: ReturnType<Schema['stringSchema']>;
1196
1303
  operators: OperatorsOrdinalText$1;
1197
1304
  private static _instance;
1198
1305
  static get instance(): TextColumn$1<DefaultSchemaConfig$1>;
1199
1306
  constructor(schema: Schema);
1200
1307
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
1201
1308
  }
1202
- declare class ByteaColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1<Schema, string, ReturnType<Schema['buffer']>, OperatorsOrdinalText$1, Buffer, Buffer, ReturnType<Schema['buffer']>, string, ReturnType<Schema['stringSchema']>> {
1309
+ declare class ByteaColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
1310
+ __schema: Schema;
1203
1311
  dataType: "bytea";
1204
1312
  operators: OperatorsOrdinalText$1;
1313
+ __type: string;
1314
+ __inputType: Buffer;
1315
+ inputSchema: ReturnType<Schema['buffer']>;
1316
+ __outputType: Buffer;
1317
+ outputSchema: ReturnType<Schema['buffer']>;
1318
+ __queryType: string;
1319
+ querySchema: ReturnType<Schema['stringSchema']>;
1205
1320
  constructor(schema: Schema);
1206
1321
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
1207
1322
  }
1208
- declare class PointColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1<Schema, string, ReturnType<Schema['stringSchema']>, OperatorsText> {
1323
+ declare class PointColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
1324
+ __schema: Schema;
1209
1325
  dataType: "point";
1210
- operators: OperatorsText;
1326
+ __type: string;
1327
+ __inputType: string;
1328
+ inputSchema: ReturnType<Schema['stringSchema']>;
1329
+ __outputType: string;
1330
+ outputSchema: ReturnType<Schema['stringSchema']>;
1331
+ __queryType: string;
1332
+ querySchema: ReturnType<Schema['stringSchema']>;
1333
+ operators: OperatorsText$1;
1211
1334
  constructor(schema: Schema);
1212
1335
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
1213
1336
  }
1214
- declare class LineColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1<Schema, string, ReturnType<Schema['stringSchema']>, OperatorsText> {
1337
+ declare class LineColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
1338
+ __schema: Schema;
1215
1339
  dataType: "line";
1216
- operators: OperatorsText;
1340
+ __type: string;
1341
+ __inputType: string;
1342
+ inputSchema: ReturnType<Schema['stringSchema']>;
1343
+ __outputType: string;
1344
+ outputSchema: ReturnType<Schema['stringSchema']>;
1345
+ __queryType: string;
1346
+ querySchema: ReturnType<Schema['stringSchema']>;
1347
+ operators: OperatorsText$1;
1217
1348
  constructor(schema: Schema);
1218
1349
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
1219
1350
  }
1220
- declare class LsegColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1<Schema, string, ReturnType<Schema['stringSchema']>, OperatorsText> {
1351
+ declare class LsegColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
1352
+ __schema: Schema;
1221
1353
  dataType: "lseg";
1222
- operators: OperatorsText;
1354
+ __type: string;
1355
+ __inputType: string;
1356
+ inputSchema: ReturnType<Schema['stringSchema']>;
1357
+ __outputType: string;
1358
+ outputSchema: ReturnType<Schema['stringSchema']>;
1359
+ __queryType: string;
1360
+ querySchema: ReturnType<Schema['stringSchema']>;
1361
+ operators: OperatorsText$1;
1223
1362
  constructor(schema: Schema);
1224
1363
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
1225
1364
  }
1226
- declare class BoxColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1<Schema, string, ReturnType<Schema['stringSchema']>, OperatorsText> {
1365
+ declare class BoxColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
1366
+ __schema: Schema;
1227
1367
  dataType: "box";
1228
- operators: OperatorsText;
1368
+ __type: string;
1369
+ __inputType: string;
1370
+ inputSchema: ReturnType<Schema['stringSchema']>;
1371
+ __outputType: string;
1372
+ outputSchema: ReturnType<Schema['stringSchema']>;
1373
+ __queryType: string;
1374
+ querySchema: ReturnType<Schema['stringSchema']>;
1375
+ operators: OperatorsText$1;
1229
1376
  constructor(schema: Schema);
1230
1377
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
1231
1378
  }
1232
- declare class PathColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1<Schema, string, ReturnType<Schema['stringSchema']>, OperatorsText> {
1379
+ declare class PathColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
1380
+ __schema: Schema;
1233
1381
  dataType: "path";
1234
- operators: OperatorsText;
1382
+ __type: string;
1383
+ __inputType: string;
1384
+ inputSchema: ReturnType<Schema['stringSchema']>;
1385
+ __outputType: string;
1386
+ outputSchema: ReturnType<Schema['stringSchema']>;
1387
+ __queryType: string;
1388
+ querySchema: ReturnType<Schema['stringSchema']>;
1389
+ operators: OperatorsText$1;
1235
1390
  constructor(schema: Schema);
1236
1391
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
1237
1392
  }
1238
- declare class PolygonColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1<Schema, string, ReturnType<Schema['stringSchema']>, OperatorsText> {
1393
+ declare class PolygonColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
1394
+ __schema: Schema;
1239
1395
  dataType: "polygon";
1240
- operators: OperatorsText;
1396
+ __type: string;
1397
+ __inputType: string;
1398
+ inputSchema: ReturnType<Schema['stringSchema']>;
1399
+ __outputType: string;
1400
+ outputSchema: ReturnType<Schema['stringSchema']>;
1401
+ __queryType: string;
1402
+ querySchema: ReturnType<Schema['stringSchema']>;
1403
+ operators: OperatorsText$1;
1241
1404
  constructor(schema: Schema);
1242
1405
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
1243
1406
  }
1244
- declare class CircleColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1<Schema, string, ReturnType<Schema['stringSchema']>, OperatorsText> {
1407
+ declare class CircleColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
1408
+ __schema: Schema;
1245
1409
  dataType: "circle";
1246
- operators: OperatorsText;
1410
+ __type: string;
1411
+ __inputType: string;
1412
+ inputSchema: ReturnType<Schema['stringSchema']>;
1413
+ __outputType: string;
1414
+ outputSchema: ReturnType<Schema['stringSchema']>;
1415
+ __queryType: string;
1416
+ querySchema: ReturnType<Schema['stringSchema']>;
1417
+ operators: OperatorsText$1;
1247
1418
  constructor(schema: Schema);
1248
1419
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
1249
1420
  }
1250
- declare class MoneyColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1<Schema, string, ReturnType<Schema['number']>, OperatorsNumber, string | number, number, ReturnType<Schema['number']>, string | number> {
1421
+ declare class MoneyColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
1422
+ __schema: Schema;
1251
1423
  dataType: "money";
1424
+ __type: string;
1252
1425
  data: NumberColumnData$1;
1426
+ __inputType: string | number;
1427
+ inputSchema: ReturnType<Schema['number']>;
1428
+ __outputType: number;
1429
+ outputSchema: ReturnType<Schema['number']>;
1430
+ __queryType: string | number;
1431
+ querySchema: ReturnType<Schema['number']>;
1253
1432
  operators: OperatorsNumber;
1254
1433
  constructor(schema: Schema);
1255
1434
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
1256
1435
  }
1257
- declare class CidrColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1<Schema, string, ReturnType<Schema['stringSchema']>, OperatorsText> {
1436
+ declare class CidrColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
1437
+ __schema: Schema;
1258
1438
  dataType: "cidr";
1259
- operators: OperatorsText;
1439
+ __type: string;
1440
+ __inputType: string;
1441
+ inputSchema: ReturnType<Schema['stringSchema']>;
1442
+ __outputType: string;
1443
+ outputSchema: ReturnType<Schema['stringSchema']>;
1444
+ __queryType: string;
1445
+ querySchema: ReturnType<Schema['stringSchema']>;
1446
+ operators: OperatorsText$1;
1260
1447
  constructor(schema: Schema);
1261
1448
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
1262
1449
  }
1263
- declare class InetColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1<Schema, string, ReturnType<Schema['stringSchema']>, OperatorsOrdinalText$1> {
1450
+ declare class InetColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
1451
+ __schema: Schema;
1264
1452
  dataType: "inet";
1453
+ __type: string;
1454
+ __inputType: string;
1455
+ inputSchema: ReturnType<Schema['stringSchema']>;
1456
+ __outputType: string;
1457
+ outputSchema: ReturnType<Schema['stringSchema']>;
1458
+ __queryType: string;
1459
+ querySchema: ReturnType<Schema['stringSchema']>;
1265
1460
  operators: OperatorsOrdinalText$1;
1266
1461
  constructor(schema: Schema);
1267
1462
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
1268
1463
  }
1269
- declare class MacAddrColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1<Schema, string, ReturnType<Schema['stringSchema']>, OperatorsOrdinalText$1> {
1464
+ declare class MacAddrColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
1465
+ __schema: Schema;
1270
1466
  dataType: "macaddr";
1467
+ __type: string;
1468
+ __inputType: string;
1469
+ inputSchema: ReturnType<Schema['stringSchema']>;
1470
+ __outputType: string;
1471
+ outputSchema: ReturnType<Schema['stringSchema']>;
1472
+ __queryType: string;
1473
+ querySchema: ReturnType<Schema['stringSchema']>;
1271
1474
  operators: OperatorsOrdinalText$1;
1272
1475
  constructor(schema: Schema);
1273
1476
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
1274
1477
  }
1275
- declare class MacAddr8Column$1<Schema extends ColumnSchemaConfig$1> extends Column$1<Schema, string, ReturnType<Schema['stringSchema']>, OperatorsOrdinalText$1> {
1478
+ declare class MacAddr8Column$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
1479
+ __schema: Schema;
1276
1480
  dataType: "macaddr8";
1481
+ __type: string;
1482
+ __inputType: string;
1483
+ inputSchema: ReturnType<Schema['stringSchema']>;
1484
+ __outputType: string;
1485
+ outputSchema: ReturnType<Schema['stringSchema']>;
1486
+ __queryType: string;
1487
+ querySchema: ReturnType<Schema['stringSchema']>;
1277
1488
  operators: OperatorsOrdinalText$1;
1278
1489
  constructor(schema: Schema);
1279
1490
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
1280
1491
  }
1281
- declare class BitColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1<Schema, string, ReturnType<Schema['bit']>, OperatorsOrdinalText$1> {
1492
+ declare class BitColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
1493
+ __schema: Schema;
1282
1494
  dataType: "bit";
1495
+ __type: string;
1496
+ __inputType: string;
1497
+ inputSchema: ReturnType<Schema['bit']>;
1498
+ __outputType: string;
1499
+ outputSchema: ReturnType<Schema['bit']>;
1500
+ __queryType: string;
1501
+ querySchema: ReturnType<Schema['bit']>;
1283
1502
  operators: OperatorsOrdinalText$1;
1284
1503
  data: Column$1.Data & {
1285
1504
  length: number;
@@ -1288,8 +1507,16 @@ declare class BitColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1<
1288
1507
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
1289
1508
  toSQL(): string;
1290
1509
  }
1291
- declare class BitVaryingColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1<Schema, string, ReturnType<Schema['bit']>, OperatorsOrdinalText$1> {
1510
+ declare class BitVaryingColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
1511
+ __schema: Schema;
1292
1512
  dataType: "varbit";
1513
+ __type: string;
1514
+ __inputType: string;
1515
+ inputSchema: ReturnType<Schema['bit']>;
1516
+ __outputType: string;
1517
+ outputSchema: ReturnType<Schema['bit']>;
1518
+ __queryType: string;
1519
+ querySchema: ReturnType<Schema['bit']>;
1293
1520
  operators: OperatorsOrdinalText$1;
1294
1521
  data: Column$1.Data & {
1295
1522
  length?: number;
@@ -1299,9 +1526,17 @@ declare class BitVaryingColumn$1<Schema extends ColumnSchemaConfig$1> extends Co
1299
1526
  toSQL(): string;
1300
1527
  }
1301
1528
  type TsVectorGeneratedColumns = string[] | SearchWeightRecord;
1302
- declare class TsVectorColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1<Schema, string, ReturnType<Schema['stringSchema']>, OperatorsOrdinalText$1> {
1529
+ declare class TsVectorColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
1303
1530
  defaultLanguage: string;
1531
+ __schema: Schema;
1304
1532
  dataType: "tsvector";
1533
+ __type: string;
1534
+ __inputType: string;
1535
+ inputSchema: ReturnType<Schema['stringSchema']>;
1536
+ __outputType: string;
1537
+ outputSchema: ReturnType<Schema['stringSchema']>;
1538
+ __queryType: string;
1539
+ querySchema: ReturnType<Schema['stringSchema']>;
1305
1540
  operators: OperatorsOrdinalText$1;
1306
1541
  constructor(schema: Schema, defaultLanguage?: string);
1307
1542
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
@@ -1331,14 +1566,30 @@ declare class TsVectorColumn$1<Schema extends ColumnSchemaConfig$1> extends Colu
1331
1566
  */
1332
1567
  generated<T extends Column$1.Pick.Data>(this: T, ...args: StaticSQLArgs | [language: string, columns: TsVectorGeneratedColumns] | [columns: TsVectorGeneratedColumns]): Column$1.Modifiers.Generated<T>;
1333
1568
  }
1334
- declare class TsQueryColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1<Schema, string, ReturnType<Schema['stringSchema']>, OperatorsOrdinalText$1> {
1569
+ declare class TsQueryColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
1570
+ __schema: Schema;
1335
1571
  dataType: "tsquery";
1572
+ __type: string;
1573
+ __inputType: string;
1574
+ inputSchema: ReturnType<Schema['stringSchema']>;
1575
+ __outputType: string;
1576
+ outputSchema: ReturnType<Schema['stringSchema']>;
1577
+ __queryType: string;
1578
+ querySchema: ReturnType<Schema['stringSchema']>;
1336
1579
  operators: OperatorsOrdinalText$1;
1337
1580
  constructor(schema: Schema);
1338
1581
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
1339
1582
  }
1340
- declare class UUIDColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1<Schema, string, ReturnType<Schema['uuid']>, OperatorsOrdinalText$1> {
1583
+ declare class UUIDColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
1584
+ __schema: Schema;
1341
1585
  dataType: "uuid";
1586
+ __type: string;
1587
+ __inputType: string;
1588
+ inputSchema: ReturnType<Schema['uuid']>;
1589
+ __outputType: string;
1590
+ outputSchema: ReturnType<Schema['uuid']>;
1591
+ __queryType: string;
1592
+ querySchema: ReturnType<Schema['uuid']>;
1342
1593
  operators: OperatorsOrdinalText$1;
1343
1594
  constructor(schema: Schema);
1344
1595
  /**
@@ -1353,27 +1604,45 @@ declare class UUIDColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1
1353
1604
  };
1354
1605
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
1355
1606
  }
1356
- declare class XMLColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1<Schema, string, ReturnType<Schema['stringSchema']>, OperatorsText> {
1607
+ declare class XMLColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
1608
+ __schema: Schema;
1357
1609
  dataType: "xml";
1358
- operators: OperatorsText;
1610
+ __type: string;
1611
+ __inputType: string;
1612
+ inputSchema: ReturnType<Schema['stringSchema']>;
1613
+ __outputType: string;
1614
+ outputSchema: ReturnType<Schema['stringSchema']>;
1615
+ __queryType: string;
1616
+ querySchema: ReturnType<Schema['stringSchema']>;
1617
+ operators: OperatorsText$1;
1359
1618
  private static _instance;
1360
1619
  static get instance(): XMLColumn$1<DefaultSchemaConfig$1>;
1361
1620
  constructor(schema: Schema);
1362
1621
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
1363
1622
  }
1364
1623
  declare class CitextColumn$1<Schema extends ColumnSchemaConfig$1> extends TextBaseColumn<Schema, OperatorsOrdinalText$1> {
1624
+ __schema: Schema;
1365
1625
  dataType: "citext";
1366
1626
  data: TextColumnData & {
1367
1627
  minArg?: number;
1368
1628
  maxArg?: number;
1369
1629
  };
1630
+ querySchema: ReturnType<Schema['stringSchema']>;
1370
1631
  operators: OperatorsOrdinalText$1;
1371
1632
  constructor(schema: Schema);
1372
1633
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
1373
1634
  }
1374
- declare class BooleanColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1<Schema, boolean, ReturnType<Schema['boolean']>, OperatorsBoolean> {
1635
+ declare class BooleanColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
1636
+ __schema: Schema;
1375
1637
  dataType: "bool";
1376
1638
  operators: OperatorsBoolean;
1639
+ __type: boolean;
1640
+ __inputType: boolean;
1641
+ inputSchema: ReturnType<Schema['boolean']>;
1642
+ __outputType: boolean;
1643
+ outputSchema: ReturnType<Schema['boolean']>;
1644
+ __queryType: boolean;
1645
+ querySchema: ReturnType<Schema['boolean']>;
1377
1646
  private static _instance;
1378
1647
  static get instance(): BooleanColumn$1<DefaultSchemaConfig$1>;
1379
1648
  constructor(schema: Schema);
@@ -1397,20 +1666,29 @@ interface TimestampHelpers {
1397
1666
  timestampNoTZ(): T;
1398
1667
  }): Timestamps$1<T>;
1399
1668
  }
1400
- declare class CustomTypeColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1<Schema, unknown, ReturnType<Schema['unknown']>, OperatorsAny> {
1669
+ declare class CustomTypeColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
1401
1670
  typeName: string;
1402
1671
  typeSchema?: string | undefined;
1672
+ __schema: Schema;
1403
1673
  operators: OperatorsAny;
1674
+ __type: unknown;
1675
+ __inputType: unknown;
1676
+ inputSchema: ReturnType<Schema['unknown']>;
1677
+ __outputType: unknown;
1678
+ outputSchema: ReturnType<Schema['unknown']>;
1679
+ __queryType: unknown;
1680
+ querySchema: ReturnType<Schema['unknown']>;
1681
+ data: Column$1.Data;
1404
1682
  dataType: string;
1405
1683
  constructor(schema: Schema, typeName: string, typeSchema?: string | undefined, extension?: string);
1406
1684
  toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
1407
1685
  as<T extends {
1408
- inputType: unknown;
1409
- outputType: unknown;
1686
+ __inputType: unknown;
1687
+ __outputType: unknown;
1410
1688
  data: Column$1.Data;
1411
1689
  }, C extends {
1412
- inputType: T['inputType'];
1413
- outputType: T['outputType'];
1690
+ __inputType: T['__inputType'];
1691
+ __outputType: T['__outputType'];
1414
1692
  }>(this: T, column: C): C;
1415
1693
  }
1416
1694
  declare class DomainColumn$1<Schema extends ColumnSchemaConfig$1> extends CustomTypeColumn$1<Schema> {
@@ -1421,8 +1699,16 @@ interface PostgisPoint {
1421
1699
  lat: number;
1422
1700
  srid?: number;
1423
1701
  }
1424
- declare class PostgisGeographyPointColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1<Schema, PostgisPoint, ReturnType<Schema['geographyPointSchema']>, OperatorsAny> {
1702
+ declare class PostgisGeographyPointColumn$1<Schema extends ColumnSchemaConfig$1> extends Column$1 {
1703
+ __schema: Schema;
1425
1704
  dataType: string;
1705
+ __type: PostgisPoint;
1706
+ __inputType: PostgisPoint;
1707
+ inputSchema: ReturnType<Schema['geographyPointSchema']>;
1708
+ __outputType: PostgisPoint;
1709
+ outputSchema: ReturnType<Schema['geographyPointSchema']>;
1710
+ __queryType: PostgisPoint;
1711
+ querySchema: ReturnType<Schema['geographyPointSchema']>;
1426
1712
  operators: OperatorsAny;
1427
1713
  static encode: ({
1428
1714
  srid,
@@ -1480,7 +1766,7 @@ interface DefaultColumnTypes$1<SchemaConfig extends ColumnSchemaConfig$1> extend
1480
1766
  uuid(): UUIDColumn$1<SchemaConfig>;
1481
1767
  xml(): XMLColumn$1<SchemaConfig>;
1482
1768
  json: SchemaConfig['json'];
1483
- jsonText(): JSONTextColumn$1<SchemaConfig>;
1769
+ jsonText: SchemaConfig['jsonText'];
1484
1770
  type(dataType: string): CustomTypeColumn$1<SchemaConfig>;
1485
1771
  domain(dataType: string): DomainColumn$1<SchemaConfig>;
1486
1772
  geography: {
@@ -1801,6 +2087,37 @@ declare class DynamicRawSQL$1<T extends Column$1.Pick.QueryColumn, ColumnTypes =
1801
2087
  }
1802
2088
  interface SqlFn$1 {
1803
2089
  <T, Args extends TemplateLiteralArgs$1 | [sql: string] | [values: RecordUnknown$1, sql?: string]>(this: T, ...args: Args): Args extends [RecordUnknown$1] ? (...sql: TemplateLiteralArgs$1) => RawSql$1<Column$1.Pick.QueryColumn, T> : RawSql$1<Column$1.Pick.QueryColumn, T>;
2090
+ /**
2091
+ * `sql.join` builds a SQL list from values and expressions.
2092
+ * Plain values are bound as query parameters, while SQL expressions render as SQL.
2093
+ *
2094
+ * Use it for SQL constructs such as `ARRAY[...]`, `IN (...)`, function arguments,
2095
+ * or tuple lists. The default separator is `, `. Provide a SQL expression as the
2096
+ * custom separator when a different separator is needed.
2097
+ *
2098
+ * ```ts
2099
+ * await db.user.whereSql`"id" IN (${sql.join([1, 2, 3])})`;
2100
+ * ```
2101
+ *
2102
+ * ```ts
2103
+ * await db.user.whereSql`
2104
+ * (${sql.join([sql.ref('name'), sql.ref('age')])}) IN (${sql.join(
2105
+ * users.map((user) => sql`(${user.name}, ${user.age})`),
2106
+ * )})
2107
+ * `;
2108
+ * ```
2109
+ *
2110
+ * ```ts
2111
+ * await db.user.select({
2112
+ * displayName: (q) =>
2113
+ * sql<string>`concat(${sql.join(
2114
+ * [q.column('firstName'), q.column('lastName')],
2115
+ * sql` || ' ' || `,
2116
+ * )})`,
2117
+ * });
2118
+ * ```
2119
+ */
2120
+ join<T = unknown>(items: readonly unknown[], separator?: RawSqlBase$1): SqlJoinExpression<Column$1.Pick.QueryColumnOfType<T>>;
1804
2121
  /**
1805
2122
  * `sql.ref` quotes a SQL identifier such as a table name, column name, or schema name.
1806
2123
  * Use it when you need to dynamically reference an identifier in raw SQL.
@@ -1855,8 +2172,8 @@ interface QueryThen<T> {
1855
2172
  type QueryThenShallowSimplify<T> = QueryThen<ShallowSimplify$1<T>>;
1856
2173
  type QueryThenShallowSimplifyArr<T> = QueryThen<ShallowSimplify$1<T>[]>;
1857
2174
  type QueryThenShallowSimplifyOptional<T> = QueryThen<ShallowSimplify$1<T> | undefined>;
1858
- type QueryThenByQuery<T extends PickQueryReturnType, Result extends Column$1.QueryColumns> = T['returnType'] extends undefined | 'all' ? QueryThenShallowSimplifyArr<ColumnsShape$1.Output<Result>> : T['returnType'] extends 'one' ? QueryThenShallowSimplifyOptional<ColumnsShape$1.Output<Result>> : T['returnType'] extends 'oneOrThrow' ? QueryThenShallowSimplify<ColumnsShape$1.Output<Result>> : T['returnType'] extends 'value' ? QueryThen<Result['value']['outputType'] | undefined> : T['returnType'] extends 'valueOrThrow' ? QueryThen<Result['value']['outputType']> : T['returnType'] extends 'rows' ? QueryThen<ColumnsShape$1.Output<Result>[keyof Result][][]> : T['returnType'] extends 'pluck' ? QueryThen<Result['pluck']['outputType'][]> : QueryThen<void>;
1859
- type QueryThenByReturnType<T extends QueryReturnType$1, Result extends Column$1.QueryColumns> = T extends undefined | 'all' ? QueryThenShallowSimplifyArr<ColumnsShape$1.Output<Result>> : T extends 'one' ? QueryThenShallowSimplifyOptional<ColumnsShape$1.Output<Result>> : T extends 'oneOrThrow' ? QueryThenShallowSimplify<ColumnsShape$1.Output<Result>> : T extends 'value' ? QueryThen<Result['value']['outputType'] | undefined> : T extends 'valueOrThrow' ? QueryThen<Result['value']['outputType']> : T extends 'rows' ? QueryThen<ColumnsShape$1.Output<Result>[keyof Result][][]> : T extends 'pluck' ? QueryThen<Result['pluck']['outputType'][]> : QueryThen<void>;
2175
+ type QueryThenByQuery<T extends PickQueryReturnType, Result extends Column$1.QueryColumns> = T['returnType'] extends undefined | 'all' ? QueryThenShallowSimplifyArr<ColumnsShape$1.Output<Result>> : T['returnType'] extends 'one' ? QueryThenShallowSimplifyOptional<ColumnsShape$1.Output<Result>> : T['returnType'] extends 'oneOrThrow' ? QueryThenShallowSimplify<ColumnsShape$1.Output<Result>> : T['returnType'] extends 'value' ? QueryThen<Result['value']['__outputType'] | undefined> : T['returnType'] extends 'valueOrThrow' ? QueryThen<Result['value']['__outputType']> : T['returnType'] extends 'rows' ? QueryThen<ColumnsShape$1.Output<Result>[keyof Result][][]> : T['returnType'] extends 'pluck' ? QueryThen<Result['pluck']['__outputType'][]> : QueryThen<void>;
2176
+ type QueryThenByReturnType<T extends QueryReturnType$1, Result extends Column$1.QueryColumns> = T extends undefined | 'all' ? QueryThenShallowSimplifyArr<ColumnsShape$1.Output<Result>> : T extends 'one' ? QueryThenShallowSimplifyOptional<ColumnsShape$1.Output<Result>> : T extends 'oneOrThrow' ? QueryThenShallowSimplify<ColumnsShape$1.Output<Result>> : T extends 'value' ? QueryThen<Result['value']['__outputType'] | undefined> : T extends 'valueOrThrow' ? QueryThen<Result['value']['__outputType']> : T extends 'rows' ? QueryThen<ColumnsShape$1.Output<Result>[keyof Result][][]> : T extends 'pluck' ? QueryThen<Result['pluck']['__outputType'][]> : QueryThen<void>;
1860
2177
  interface QueryCatch {
1861
2178
  <Q, TResult = never>(this: {
1862
2179
  then: (onfulfilled?: (value: Q) => any) => any;
@@ -2742,7 +3059,7 @@ declare namespace Order {
2742
3059
  export type Arg<T extends ArgThis> = ArgKey<T> | ArgTsQuery<T> | { [K in ArgKey<T> | ArgTsQuery<T>]?: K extends ArgTsQuery<T> ? OrderTsQueryConfig : SortDir } | Expression$1;
2743
3060
  export type Args<T extends ArgThis> = Arg<T>[];
2744
3061
  type ArgTsQuery<T extends ArgThis> = string | undefined extends T['__tsQuery'] ? never : Exclude<T['__tsQuery'], undefined>;
2745
- 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']];
3062
+ 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']];
2746
3063
  export {};
2747
3064
  }
2748
3065
  declare class QueryOrder {
@@ -2848,40 +3165,40 @@ interface ColumnsShape$1 {
2848
3165
  }
2849
3166
  declare namespace ColumnsShape$1 {
2850
3167
  export type DefaultSelectKeys<S extends Column$1.QueryColumnsInit> = { [K in keyof S]: S[K]['data']['explicitSelect'] extends true | undefined ? never : K }[keyof S];
2851
- export type DefaultOutput<Set extends Column$1.QueryColumnsInit> = { [K in DefaultSelectKeys<Set>]: Set[K]['outputType'] };
2852
- 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'] };
2853
- export type InputPartial<Shape extends Column$1.QueryColumnsInit> = { [K in keyof Shape]?: Shape[K]['inputType'] };
2854
- export type Output<Shape extends Column$1.QueryColumns> = { [K in keyof Shape]: Shape[K]['outputType'] };
2855
- 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'] };
3168
+ export type DefaultOutput<Set extends Column$1.QueryColumnsInit> = { [K in DefaultSelectKeys<Set>]: Set[K]['__outputType'] };
3169
+ 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'] };
3170
+ export type InputPartial<Shape extends Column$1.QueryColumnsInit> = { [K in keyof Shape]?: Shape[K]['__inputType'] };
3171
+ export type Output<Shape extends Column$1.QueryColumns> = { [K in keyof Shape]: Shape[K]['__outputType'] };
3172
+ 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'] };
2856
3173
  export interface MapToObjectColumn<Shape extends Column$1.QueryColumns> {
2857
3174
  dataType: 'object';
2858
- type: { [K in keyof Shape]: Shape[K]['type'] };
2859
- outputType: ShallowSimplify$1<ObjectOutput<Shape>>;
2860
- queryType: { [K in keyof Shape]: Shape[K]['queryType'] };
3175
+ __type: { [K in keyof Shape]: Shape[K]['__type'] };
3176
+ __outputType: ShallowSimplify$1<ObjectOutput<Shape>>;
3177
+ __queryType: { [K in keyof Shape]: Shape[K]['__queryType'] };
2861
3178
  operators: OperatorsAny;
2862
3179
  }
2863
3180
  export interface MapToNullableObjectColumn<Shape extends Column$1.QueryColumns> {
2864
3181
  dataType: 'object';
2865
- type: { [K in keyof Shape]: Shape[K]['type'] };
2866
- outputType: ShallowSimplify$1<ObjectOutput<Shape>> | undefined;
2867
- queryType: { [K in keyof Shape]: Shape[K]['queryType'] } | null;
3182
+ __type: { [K in keyof Shape]: Shape[K]['__type'] };
3183
+ __outputType: ShallowSimplify$1<ObjectOutput<Shape>> | undefined;
3184
+ __queryType: { [K in keyof Shape]: Shape[K]['__queryType'] } | null;
2868
3185
  operators: OperatorsAny;
2869
3186
  }
2870
3187
  export interface MapToPluckColumn<Shape extends Column$1.QueryColumns> {
2871
3188
  dataType: 'array';
2872
- type: Shape['pluck']['type'][];
2873
- outputType: Shape['pluck']['outputType'][];
2874
- queryType: Shape['pluck']['queryType'][];
3189
+ __type: Shape['pluck']['__type'][];
3190
+ __outputType: Shape['pluck']['__outputType'][];
3191
+ __queryType: Shape['pluck']['__queryType'][];
2875
3192
  operators: OperatorsAny;
2876
3193
  }
2877
3194
  export interface MapToObjectArrayColumn<Shape extends Column$1.QueryColumns> {
2878
3195
  dataType: 'array';
2879
- type: { [K in keyof Shape]: Shape[K]['type'] }[];
2880
- outputType: ShallowSimplify$1<ObjectOutput<Shape>>[];
2881
- queryType: { [K in keyof Shape]: Shape[K]['queryType'] }[];
3196
+ __type: { [K in keyof Shape]: Shape[K]['__type'] }[];
3197
+ __outputType: ShallowSimplify$1<ObjectOutput<Shape>>[];
3198
+ __queryType: { [K in keyof Shape]: Shape[K]['__queryType'] }[];
2882
3199
  operators: OperatorsAny;
2883
3200
  }
2884
- type ObjectOutput<Shape extends Column$1.QueryColumns> = { [K in keyof Shape]: Shape[K]['outputType'] };
3201
+ type ObjectOutput<Shape extends Column$1.QueryColumns> = { [K in keyof Shape]: Shape[K]['__outputType'] };
2885
3202
  export {};
2886
3203
  }
2887
3204
  interface SelectSelf extends PickQuerySelectable, PickQueryHasSelect, PickQueryDefaultSelect, PickQueryShape$1, PickQueryRelations$1, PickQueryResult, PickQueryReturnType, PickQueryWithData {}
@@ -3306,16 +3623,16 @@ interface OperatorsCount extends OperatorsNumber {
3306
3623
  type CountColumn = Column$1.Pick.QueryColumnOfTypeAndOps<'int8', number, OperatorsCount>;
3307
3624
  type CountReturn<T> = SetQueryReturnsColumnOrThrow<T, CountColumn> & OperatorsCount;
3308
3625
  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>>;
3309
- 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;
3626
+ 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;
3310
3627
  type NullableNumberReturn<T, DataType> = SetQueryReturnsColumnOrThrow<T, Column$1.Pick.QueryColumnOfTypeAndOps<DataType, number | null, OperatorsNumber>> & OperatorsNumber;
3311
3628
  type BooleanQueryColumn = Column$1.Pick.QueryColumnOfTypeAndOps<'bool', boolean, OperatorsBoolean>;
3312
3629
  type BooleanNullable = Column$1.Pick.QueryColumnOfTypeAndOps<'bool', boolean | null, OperatorsBoolean>;
3313
3630
  type NullableBooleanReturn<T> = SetQueryReturnsColumnOrThrow<T, BooleanNullable> & OperatorsBoolean;
3314
3631
  type NullableJSONAggReturn<T extends PickQuerySelectable, Arg extends SelectableOrExpression<T>> = SetQueryReturnsColumnOrThrow<T, {
3315
3632
  dataType: 'json';
3316
- type: (ExpressionOutput<T, Arg>['type'] | null)[] | null;
3317
- outputType: (ExpressionOutput<T, Arg>['outputType'] | null)[] | null;
3318
- queryType: (ExpressionOutput<T, Arg>['queryType'] | null)[] | null;
3633
+ __type: (ExpressionOutput<T, Arg>['__type'] | null)[] | null;
3634
+ __outputType: (ExpressionOutput<T, Arg>['__outputType'] | null)[] | null;
3635
+ __queryType: (ExpressionOutput<T, Arg>['__queryType'] | null)[] | null;
3319
3636
  operators: OperatorsArray$1<never>;
3320
3637
  }> & OperatorsArray$1<never>;
3321
3638
  interface RecordSelectableOrExpression<T extends PickQuerySelectable> {
@@ -3323,14 +3640,14 @@ interface RecordSelectableOrExpression<T extends PickQuerySelectable> {
3323
3640
  }
3324
3641
  type NullableJSONObjectReturn<T extends PickQuerySelectable, Obj extends RecordSelectableOrExpression<T>> = SetQueryReturnsColumnOrThrow<T, {
3325
3642
  dataType: 'json';
3326
- type: { [K in keyof Obj]: ExpressionOutput<T, Obj[K]>['type'] } | null;
3327
- outputType: { [K in keyof Obj]: ExpressionOutput<T, Obj[K]>['outputType'] } | null;
3328
- queryType: { [K in keyof Obj]: ExpressionOutput<T, Obj[K]>['queryType'] } | null;
3643
+ __type: { [K in keyof Obj]: ExpressionOutput<T, Obj[K]>['__type'] } | null;
3644
+ __outputType: { [K in keyof Obj]: ExpressionOutput<T, Obj[K]>['__outputType'] } | null;
3645
+ __queryType: { [K in keyof Obj]: ExpressionOutput<T, Obj[K]>['__queryType'] } | null;
3329
3646
  operators: OperatorsAny;
3330
3647
  }> & OperatorsAny;
3331
- type StringColumn$1 = Column$1.Pick.QueryColumnOfTypeAndOps<string, string, OperatorsText>;
3332
- type StringNullable = Column$1.Pick.QueryColumnOfTypeAndOps<string, string | null, OperatorsText>;
3333
- type NullableStringReturn<T> = SetQueryReturnsColumnOrThrow<T, StringNullable> & OperatorsText;
3648
+ type StringColumn$1 = Column$1.Pick.QueryColumnOfTypeAndOps<string, string, OperatorsText$1>;
3649
+ type StringNullable = Column$1.Pick.QueryColumnOfTypeAndOps<string, string | null, OperatorsText$1>;
3650
+ type NullableStringReturn<T> = SetQueryReturnsColumnOrThrow<T, StringNullable> & OperatorsText$1;
3334
3651
  interface AggregateArgTypes {
3335
3652
  minMax: 'citext' | 'date' | 'float4' | 'float8' | 'inet' | 'int2' | 'int4' | 'int8' | 'interval' | 'money' | 'numeric' | 'text' | 'time' | 'timestamp' | 'timestamptz';
3336
3653
  sum: 'float4' | 'float8' | 'int2' | 'int4' | 'int8' | 'interval' | 'money' | 'numeric';
@@ -3762,11 +4079,11 @@ declare class OrExpression extends Expression$1<BooleanQueryColumn> {
3762
4079
  interface QueryReturnsFnAdd<T extends PickQueryColumTypes> extends PickQueryHasSelect {
3763
4080
  type<C extends Column$1.Pick.QueryColumn>(fn: (types: T['columnTypes']) => C): { [K in keyof T]: K extends 'result' ? {
3764
4081
  value: C;
3765
- } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<C['outputType']> : T[K] } & C['operators'];
4082
+ } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<C['__outputType']> : T[K] } & C['operators'];
3766
4083
  }
3767
4084
  type SetQueryReturnsFn<T extends PickQueryColumTypes, C extends Column$1.Pick.OutputType> = { [K in keyof T]: K extends 'result' ? {
3768
4085
  value: C;
3769
- } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<C['outputType']> : T[K] } & QueryReturnsFnAdd<T>;
4086
+ } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<C['__outputType']> : T[K] } & QueryReturnsFnAdd<T>;
3770
4087
  declare class QueryExpressions {
3771
4088
  /**
3772
4089
  * `column` references a table column, this can be used in raw SQL or when building a column expression.
@@ -3859,16 +4176,16 @@ declare class QueryExpressions {
3859
4176
  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<{
3860
4177
  columns: (keyof T['__selectable'])[];
3861
4178
  values: unknown[][] | IsQuery$1 | Expression$1;
3862
- }> : T['__selectable'][K]['column']['queryType'] | null | { [O in keyof T['__selectable'][K]['column']['operators']]?: T['__selectable'][K]['column']['operators'][O]['_opType'] } | {
4179
+ }> : T['__selectable'][K]['column']['__queryType'] | null | { [O in keyof T['__selectable'][K]['column']['operators']]?: T['__selectable'][K]['column']['operators'][O]['_opType'] } | {
3863
4180
  result: {
3864
4181
  value: {
3865
- queryType: T['__selectable'][K]['column']['queryType'] | null;
4182
+ __queryType: T['__selectable'][K]['column']['__queryType'] | null;
3866
4183
  };
3867
4184
  };
3868
4185
  } | ((q: T) => {
3869
4186
  result: {
3870
4187
  value: {
3871
- queryType: T['__selectable'][K]['column']['queryType'] | null;
4188
+ __queryType: T['__selectable'][K]['column']['__queryType'] | null;
3872
4189
  };
3873
4190
  };
3874
4191
  }) } | ((q: WhereQueryBuilder<T>) => QueryOrExpressionBooleanOrNullResult | WhereQueryBuilder<T>);
@@ -3884,12 +4201,12 @@ type WhereQueryBuilder<T extends PickQueryRelations$1> = EmptyObject$1 extends T
3884
4201
  type WhereArgs<T extends PickQuerySelectableRelations$1> = WhereArg$1<T>[];
3885
4202
  type WhereNotArgs<T extends PickQuerySelectableRelations$1> = [WhereArg$1<T>];
3886
4203
  type WhereInColumn<T extends PickQuerySelectableRelations$1> = keyof T['__selectable'] | [keyof T['__selectable'], ...(keyof T['__selectable'])[]];
3887
- 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 } & {
4204
+ 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 } & {
3888
4205
  length: Column extends {
3889
4206
  length: number;
3890
4207
  } ? Column['length'] : never;
3891
4208
  })[] | IsQuery$1 | Expression$1;
3892
- type WhereInArg<T extends PickQuerySelectableRelations$1> = { [K in keyof T['__selectable']]?: Iterable<T['__selectable'][K]['column']['queryType']> | IsQuery$1 | Expression$1 };
4209
+ type WhereInArg<T extends PickQuerySelectableRelations$1> = { [K in keyof T['__selectable']]?: Iterable<T['__selectable'][K]['column']['__queryType']> | IsQuery$1 | Expression$1 };
3893
4210
  interface QueryHasWhere$1 {
3894
4211
  __hasWhere: true;
3895
4212
  }
@@ -4715,7 +5032,7 @@ interface OperatorToSQL {
4715
5032
  interface Operator<Value, Column extends Column.Pick.OutputTypeAndOperators = Column.Pick.OutputTypeAndOperators> {
4716
5033
  <T extends PickQueryResult>(this: T, arg: Value): { [K in Exclude<keyof T, keyof T['result']['value']['operators']>]: K extends 'result' ? {
4717
5034
  value: Column;
4718
- } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<Column['outputType']> : T[K] } & Column['operators'];
5035
+ } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<Column['__outputType']> : T[K] } & Column['operators'];
4719
5036
  _opType: Value;
4720
5037
  }
4721
5038
  interface Base$1<Value> {
@@ -4742,7 +5059,7 @@ interface OperatorsBoolean extends Ord$1<boolean> {
4742
5059
  and: Operator<OperatorsBooleanSelf, BooleanQueryColumn>;
4743
5060
  or: Operator<OperatorsBooleanSelf, BooleanQueryColumn>;
4744
5061
  }
4745
- interface OperatorsText extends Base$1<string> {
5062
+ interface OperatorsText$1 extends Base$1<string> {
4746
5063
  contains: Operator<string | IsQuery$1 | Expression$1, BooleanQueryColumn>;
4747
5064
  containsSensitive: Operator<string | IsQuery$1 | Expression$1, BooleanQueryColumn>;
4748
5065
  startsWith: Operator<string | IsQuery$1 | Expression$1, BooleanQueryColumn>;
@@ -4750,7 +5067,7 @@ interface OperatorsText extends Base$1<string> {
4750
5067
  endsWith: Operator<string | IsQuery$1 | Expression$1, BooleanQueryColumn>;
4751
5068
  endsWithSensitive: Operator<string | IsQuery$1 | Expression$1, BooleanQueryColumn>;
4752
5069
  }
4753
- interface OperatorsOrdinalText$1 extends Ord$1<string>, OperatorsText {}
5070
+ interface OperatorsOrdinalText$1 extends Ord$1<string>, OperatorsText$1 {}
4754
5071
  interface JsonPathQueryOptions {
4755
5072
  vars?: RecordUnknown$1;
4756
5073
  silent?: boolean;
@@ -5080,7 +5397,7 @@ interface PickQueryUniqueProperties {
5080
5397
  };
5081
5398
  }
5082
5399
  interface PickQueryInputType$1 {
5083
- inputType: RecordUnknown$1;
5400
+ __inputType: RecordUnknown$1;
5084
5401
  }
5085
5402
  interface PickQueryWithData {
5086
5403
  withData: WithDataItems;
@@ -5091,6 +5408,12 @@ interface PickQueryWindows {
5091
5408
  interface PickQueryRelations$1 {
5092
5409
  relations: RelationsBase$1;
5093
5410
  }
5411
+ interface PickQueryRelationsDataForCreate {
5412
+ relationsDataForCreate: RelationsDataForCreateBase;
5413
+ }
5414
+ interface PickQueryRelationsDataForCreateOptional {
5415
+ relationsDataForCreateOptional: RelationsDataForCreateOptionalBase;
5416
+ }
5094
5417
  interface PickQueryColumTypes {
5095
5418
  columnTypes: unknown;
5096
5419
  }
@@ -5426,7 +5749,7 @@ declare class CteQuery {
5426
5749
  }
5427
5750
  interface FromQuerySelf extends PickQuerySelectable, PickQueryShape$1, PickQueryReturnType, PickQueryWithData, PickQueryAs, PickQueryHasSelect {}
5428
5751
  type FromArg$1<T extends FromQuerySelf> = IsQuery$1 | Exclude<keyof T['withData'], symbol | number>;
5429
- 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}`]: {
5752
+ 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}`]: {
5430
5753
  as: K;
5431
5754
  column: T['withData'][A]['shape'][K];
5432
5755
  } } : never : A extends PickQueryResultAs ? { [K in keyof A['result'] & string as `${A['__as']}.${K}`]: K extends string ? {
@@ -5699,13 +6022,14 @@ declare class QueryCreateFrom {
5699
6022
  */
5700
6023
  insertForEachFrom<T extends CreateSelf$1>(this: T, query: IsQuery$1): InsertManyFromResult<T>;
5701
6024
  }
5702
- interface CreateSelf$1 extends PickQueryHasSelect, PickQueryDefaults, PickQueryResult, PickQueryRelations$1, PickQueryWithData, PickQueryReturnType, PickQueryShape$1, PickQueryUniqueProperties, PickQueryInputType$1, Query.Pick.IsNotReadOnly {}
6025
+ interface CreateSelf$1 extends PickQueryHasSelect, PickQueryDefaults, PickQueryResult, PickQueryRelations$1, PickQueryRelationsDataForCreate, PickQueryRelationsDataForCreateOptional, PickQueryWithData, PickQueryReturnType, PickQueryShape$1, PickQueryUniqueProperties, PickQueryInputType$1, Query.Pick.IsNotReadOnly {}
5703
6026
  type CreateData$1<T extends CreateSelf$1> = EmptyObject$1 extends T['relations'] ? CreateDataWithDefaults<T, keyof T['__defaults']> : CreateRelationsData<T>;
5704
- 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 };
5705
- type CreateDataWithDefaultsForRelations<T extends CreateSelf$1, Defaults extends keyof T['inputType'], OmitFKeys extends PropertyKey> = { [K in keyof T['inputType'] as K extends Defaults | OmitFKeys ? never : K]: K extends Defaults | OmitFKeys ? never : CreateColumn<T, K> } & { [K in Defaults as K extends OmitFKeys ? never : K]?: CreateColumn<T, K> };
5706
- type CreateColumn<T extends CreateSelf$1, K extends keyof T['inputType']> = T['inputType'][K] | ((q: T) => QueryOrExpression$1<T['inputType'][K]>);
5707
- type CreateRelationsData<T extends CreateSelf$1> = CreateDataWithDefaultsForRelations<T, keyof T['__defaults'], T['relations'][keyof T['relations']]['omitForeignKeyInCreate']> & CreateRelationsDataOmittingFKeys<T, T['relations'][keyof T['relations']]['dataForCreate']>;
5708
- type CreateRelationsDataOmittingFKeys<T extends CreateSelf$1, Union> = (Union extends RelationConfigDataForCreate ? (u: 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']) => void : (u: Union) => void) extends ((u: infer Obj) => void) ? Obj : never;
6027
+ 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 };
6028
+ type CreateDataWithDefaultsForRelations<T extends CreateSelf$1, Defaults extends keyof T['__inputType'], OmitFKeys extends PropertyKey> = { [K in keyof T['__inputType'] as K extends Defaults | OmitFKeys ? never : K]: K extends Defaults | OmitFKeys ? never : CreateColumn<T, K> } & { [K in Defaults as K extends OmitFKeys ? never : K]?: CreateColumn<T, K> };
6029
+ type CreateColumn<T extends CreateSelf$1, K extends keyof T['__inputType']> = T['__inputType'][K] | ((q: T) => QueryOrExpression$1<T['__inputType'][K]>);
6030
+ type CreateRelationsData<T extends CreateSelf$1> = CreateDataWithDefaultsForRelations<T, keyof T['__defaults'], T['relations'][keyof T['relations']]['omitForeignKeyInCreate']> & CreateRelationsDataOmittingFKeys<T, T['relationsDataForCreate']> & T['relationsDataForCreateOptional'];
6031
+ 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;
6032
+ 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;
5709
6033
  type CreateResult<T extends CreateSelf$1, Data> = T extends {
5710
6034
  isCount: true;
5711
6035
  } ? 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>>;
@@ -5720,13 +6044,13 @@ type InsertManyResult<T extends CreateSelf$1> = T['__hasSelect'] extends true ?
5720
6044
  *
5721
6045
  * The same should work as well with any non-null columns passed to `create`, but it's to be implemented later.
5722
6046
  */
5723
- 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] };
6047
+ 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] };
5724
6048
  type IgnoreResult<T extends CreateSelf$1> = T['returnType'] extends 'oneOrThrow' ? QueryTakeOptional<T> : T['returnType'] extends 'valueOrThrow' ? SetQueryReturnsColumnOptional<T, T['result']['value']> : T;
5725
6049
  type OnConflictArg<T extends PickQueryUniqueProperties> = T['internal']['uniqueColumnNames'] | T['internal']['uniqueColumnTuples'] | Expression$1 | {
5726
6050
  constraint: T['internal']['uniqueConstraints'];
5727
6051
  };
5728
6052
  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] };
5729
- 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}`;
6053
+ 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}`;
5730
6054
  declare class QueryCreate {
5731
6055
  /**
5732
6056
  * `create` and `insert` create a single record.
@@ -6000,7 +6324,7 @@ declare class QueryCreate {
6000
6324
  */
6001
6325
  onConflictDoNothing<T extends CreateSelf$1, Arg extends OnConflictArg<T>>(this: T, arg?: Arg): IgnoreResult<T>;
6002
6326
  }
6003
- type OnConflictSet$1<T extends CreateSelf$1> = { [K in keyof T['inputType']]?: T['inputType'][K] | (() => QueryOrExpression$1<T['inputType'][K]>) };
6327
+ type OnConflictSet$1<T extends CreateSelf$1> = { [K in keyof T['__inputType']]?: T['__inputType'][K] | (() => QueryOrExpression$1<T['__inputType'][K]>) };
6004
6328
  declare class OnConflictQueryBuilder<T extends CreateSelf$1, Arg extends OnConflictArg<T> | undefined> {
6005
6329
  private query;
6006
6330
  private onConflict;
@@ -6731,14 +7055,14 @@ declare class QueryTransform {
6731
7055
  value: Column$1.Pick.QueryColumnOfType<Result>;
6732
7056
  } : K extends 'then' ? QueryThen<Result> : T[K] };
6733
7057
  }
6734
- 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 }[]>;
7058
+ 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 }[]>;
6735
7059
  type HookSelectArg<T extends PickQueryShape$1> = (keyof T['shape'] & string)[];
6736
7060
  declare class QueryHookUtils$1<T extends PickQueryInputType$1> {
6737
7061
  query: IsQuery$1;
6738
7062
  columns: string[];
6739
7063
  private key;
6740
7064
  constructor(query: IsQuery$1, columns: string[], key: 'hookCreateSet' | 'hookUpdateSet');
6741
- set: (data: { [K in keyof T["inputType"]]?: T["inputType"][K] | (() => QueryOrExpression$1<T["inputType"][K]>) }) => void;
7065
+ set: (data: { [K in keyof T["__inputType"]]?: T["__inputType"][K] | (() => QueryOrExpression$1<T["__inputType"][K]>) }) => void;
6742
7066
  }
6743
7067
  declare abstract class QueryHooks$1 {
6744
7068
  /**
@@ -6895,7 +7219,7 @@ interface ColumnDataSelectSqlProp {
6895
7219
  interface SelectSqlCallback {
6896
7220
  (column: ColumnRefExpression<Column$1.Pick.QueryColumn>): Expression$1;
6897
7221
  }
6898
- 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] };
7222
+ 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] };
6899
7223
  type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends ((x: infer I) => void) ? I : never;
6900
7224
  type MaybeArray$1<T> = T | T[];
6901
7225
  type MaybePromise$1<T> = T | Promise<T>;
@@ -6926,9 +7250,9 @@ declare namespace Column$1 {
6926
7250
  unique: Name;
6927
7251
  };
6928
7252
  };
6929
- export type Nullable<T extends Column$1.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' ? Operator<T | null> : T['operators'][K] } : T[K] };
6930
- export type QueryColumnToNullable<C> = { [K in keyof C]: K extends 'outputType' | 'queryType' ? C[K] | null : C[K] };
6931
- export type QueryColumnToOptional<C> = { [K in keyof C]: K extends 'outputType' ? C[K] | undefined : C[K] };
7253
+ export type Nullable<T extends Column$1.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' ? Operator<T | null> : T['operators'][K] } : T[K] };
7254
+ export type QueryColumnToNullable<C> = { [K in keyof C]: K extends '__outputType' | '__queryType' ? C[K] | null : C[K] };
7255
+ export type QueryColumnToOptional<C> = { [K in keyof C]: K extends '__outputType' ? C[K] | undefined : C[K] };
6932
7256
  interface DataNullable {
6933
7257
  isNullable: true;
6934
7258
  optional: true;
@@ -6937,9 +7261,9 @@ declare namespace Column$1 {
6937
7261
  equals: Operator<T | null>;
6938
7262
  not: Operator<T | null>;
6939
7263
  }
6940
- export type Encode<T, InputSchema, Input> = { [K in keyof T]: K extends 'inputType' ? Input : K extends 'inputSchema' ? InputSchema : T[K] };
6941
- 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] };
6942
- export type ParseNull<T extends Column$1.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] };
7264
+ export type Encode<T, InputSchema, Input> = { [K in keyof T]: K extends '__inputType' ? Input : K extends 'inputSchema' ? InputSchema : T[K] };
7265
+ 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] };
7266
+ export type ParseNull<T extends Column$1.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] };
6943
7267
  type DefaultData<T extends Column$1.Data, Value> = { [K in keyof T]: K extends 'default' ? Value extends null ? never : Value : K extends 'optional' ? true : T[K] };
6944
7268
  export type Default<T extends Column$1.Pick.Data, Value> = { [K in keyof T]: K extends 'data' ? DefaultData<T['data'], Value> : T[K] };
6945
7269
  type DefaultSelectData<T extends Column$1.Data, Value> = { [K in keyof T]: K extends 'explicitSelect' ? Value extends true ? false : true : T[K] };
@@ -6949,7 +7273,7 @@ declare namespace Column$1 {
6949
7273
  appReadOnly: true;
6950
7274
  };
6951
7275
  }
6952
- export type Generated<T extends Column$1.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] };
7276
+ export type Generated<T extends Column$1.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] };
6953
7277
  export {};
6954
7278
  }
6955
7279
  export namespace Pick {
@@ -6957,17 +7281,17 @@ declare namespace Column$1 {
6957
7281
  data: Column$1.Data;
6958
7282
  }
6959
7283
  interface Type {
6960
- type: unknown;
7284
+ __type: unknown;
6961
7285
  }
6962
7286
  interface OutputType {
6963
- outputType: unknown;
7287
+ __outputType: unknown;
6964
7288
  }
6965
7289
  interface InputType {
6966
- inputType: unknown;
7290
+ __inputType: unknown;
6967
7291
  }
6968
7292
  interface DataAndInputType extends Data, InputType {}
6969
7293
  interface NullType {
6970
- nullType: unknown;
7294
+ __nullType: unknown;
6971
7295
  }
6972
7296
  interface OutputTypeAndOperators extends OutputType {
6973
7297
  operators: unknown;
@@ -6977,22 +7301,22 @@ declare namespace Column$1 {
6977
7301
  }
6978
7302
  interface QueryColumn extends OutputType {
6979
7303
  dataType: string;
6980
- type: unknown;
6981
- queryType: unknown;
7304
+ __type: unknown;
7305
+ __queryType: unknown;
6982
7306
  operators: any;
6983
7307
  }
6984
7308
  interface QueryColumnOfType<T> {
6985
7309
  dataType: string;
6986
- type: T;
6987
- outputType: T;
6988
- queryType: T;
7310
+ __type: T;
7311
+ __outputType: T;
7312
+ __queryType: T;
6989
7313
  operators: any;
6990
7314
  }
6991
7315
  interface QueryColumnOfTypeAndOps<DataType, T, Ops> {
6992
7316
  dataType: DataType;
6993
- type: T;
6994
- outputType: T;
6995
- queryType: T;
7317
+ __type: T;
7318
+ __outputType: T;
7319
+ __queryType: T;
6996
7320
  operators: Ops;
6997
7321
  }
6998
7322
  interface QueryColumnOfDataType<T extends string> extends QueryColumn {
@@ -7012,8 +7336,8 @@ declare namespace Column$1 {
7012
7336
  querySchema: any;
7013
7337
  }
7014
7338
  interface ForNullable extends Data, Type, InputType, OutputType, TypeSchemas {
7015
- nullType: unknown;
7016
- queryType: unknown;
7339
+ __nullType: unknown;
7340
+ __queryType: unknown;
7017
7341
  operators: unknown;
7018
7342
  }
7019
7343
  interface ForParse extends Type, NullType, NullSchema {}
@@ -7063,9 +7387,9 @@ declare namespace Column$1 {
7063
7387
  type StringOrMessage = string | Message;
7064
7388
  }
7065
7389
  export interface InputOutputQueryTypes {
7066
- inputType: unknown;
7067
- outputType: unknown;
7068
- queryType: unknown;
7390
+ __inputType: unknown;
7391
+ __outputType: unknown;
7392
+ __queryType: unknown;
7069
7393
  }
7070
7394
  export interface InputOutputQueryTypesWithSchemas extends InputOutputQueryTypes {
7071
7395
  inputSchema: unknown;
@@ -7156,24 +7480,24 @@ declare namespace Column$1 {
7156
7480
  export type AsTypeArg<Schema> = AsTypeArgWithType<Schema> | AsTypeArgWithoutType<Schema>;
7157
7481
  export {};
7158
7482
  }
7159
- declare abstract class Column$1<Schema extends ColumnTypeSchemaArg$1 = ColumnTypeSchemaArg$1, Type = unknown, InputSchema = any, Ops = any, InputType = Type, OutputType = Type, OutputSchema = InputSchema, QueryType = InputType, QuerySchema = InputSchema> {
7160
- inputSchema: InputSchema;
7161
- outputSchema: OutputSchema;
7162
- querySchema: QuerySchema;
7483
+ declare abstract class Column$1 {
7484
+ abstract __schema: ColumnTypeSchemaArg$1;
7163
7485
  abstract dataType: string;
7164
- abstract operators: Ops;
7486
+ abstract operators: any;
7165
7487
  abstract toCode(ctx: ColumnToCodeCtx$1, key: string): Code$1;
7166
- type: Type;
7167
- inputType: InputType;
7168
- outputType: OutputType;
7169
- queryType: QueryType;
7170
- nullType: unknown;
7488
+ abstract __type: unknown;
7489
+ abstract __inputType: unknown;
7490
+ abstract __outputType: unknown;
7491
+ abstract __queryType: unknown;
7492
+ __nullType: unknown;
7171
7493
  nullSchema: unknown;
7172
- isNullable: boolean;
7494
+ abstract inputSchema: unknown;
7495
+ abstract outputSchema: unknown;
7496
+ abstract querySchema: unknown;
7173
7497
  data: Column.Data;
7174
- error: Schema['error'];
7498
+ error: this['__schema']['error'];
7175
7499
  _parse?: (input: unknown) => unknown;
7176
- constructor(schema: ColumnTypeSchemaArg$1, inputSchema: InputSchema, outputSchema?: OutputSchema, querySchema?: QuerySchema);
7500
+ constructor(schema: ColumnTypeSchemaArg$1, inputSchema: unknown, outputSchema?: unknown, querySchema?: unknown);
7177
7501
  /**
7178
7502
  * Set a default value to a column. Columns that have defaults become optional when creating a record.
7179
7503
  *
@@ -7200,7 +7524,7 @@ declare abstract class Column$1<Schema extends ColumnTypeSchemaArg$1 = ColumnTyp
7200
7524
  *
7201
7525
  * @param value - default value or a function returning a value
7202
7526
  */
7203
- default<T extends Column.Pick.DataAndInputType, Value extends T['inputType'] | null | RawSqlBase$1 | (() => T['inputType'])>(this: T, value: Value): Column.Modifiers.Default<T, Value>;
7527
+ default<T extends Column.Pick.DataAndInputType, Value extends T['__inputType'] | null | RawSqlBase$1 | (() => T['__inputType'])>(this: T, value: Value): Column.Modifiers.Default<T, Value>;
7204
7528
  /**
7205
7529
  * Use `hasDefault` to let the column be omitted when creating records.
7206
7530
  *
@@ -7246,7 +7570,7 @@ declare abstract class Column$1<Schema extends ColumnTypeSchemaArg$1 = ColumnTyp
7246
7570
  * }
7247
7571
  * ```
7248
7572
  */
7249
- nullable: Schema['nullable'];
7573
+ nullable: this['__schema']['nullable'];
7250
7574
  /**
7251
7575
  * Set a custom function to process value for the column when creating or updating a record.
7252
7576
  *
@@ -7282,7 +7606,7 @@ declare abstract class Column$1<Schema extends ColumnTypeSchemaArg$1 = ColumnTyp
7282
7606
  *
7283
7607
  * @param fn - function to encode value for a database, argument type is specified by you, return type must be compatible with a database
7284
7608
  */
7285
- encode: Schema['encode'];
7609
+ encode: this['__schema']['encode'];
7286
7610
  /**
7287
7611
  * Set a custom function to process value after loading it from a database.
7288
7612
  *
@@ -7320,7 +7644,7 @@ declare abstract class Column$1<Schema extends ColumnTypeSchemaArg$1 = ColumnTyp
7320
7644
  *
7321
7645
  * @param fn - function to parse a value from the database, argument is the type of this column, return type is up to you
7322
7646
  */
7323
- parse: Schema['parse'];
7647
+ parse: this['__schema']['parse'];
7324
7648
  /**
7325
7649
  * Use `parseNull` to specify runtime defaults at selection time.
7326
7650
  *
@@ -7365,7 +7689,7 @@ declare abstract class Column$1<Schema extends ColumnTypeSchemaArg$1 = ColumnTyp
7365
7689
  * })
7366
7690
  * ```
7367
7691
  */
7368
- parseNull: Schema['parseNull'];
7692
+ parseNull: this['__schema']['parseNull'];
7369
7693
  /**
7370
7694
  * This method changes a column type without modifying its behavior.
7371
7695
  * This is needed when converting columns to a validation schema, the converter will pick a different type specified by `.as`.
@@ -7385,17 +7709,17 @@ declare abstract class Column$1<Schema extends ColumnTypeSchemaArg$1 = ColumnTyp
7385
7709
  * @param column - other column type to inherit from
7386
7710
  */
7387
7711
  as<T extends {
7388
- inputType: unknown;
7389
- outputType: unknown;
7712
+ __inputType: unknown;
7713
+ __outputType: unknown;
7390
7714
  data: Column.Data;
7391
7715
  }, C extends {
7392
- inputType: T['inputType'];
7393
- outputType: T['outputType'];
7716
+ __inputType: T['__inputType'];
7717
+ __outputType: T['__outputType'];
7394
7718
  }>(this: T, column: C): C;
7395
7719
  /**
7396
7720
  * @deprecated use narrowType instead
7397
7721
  */
7398
- asType: Schema['asType'];
7722
+ asType: this['__schema']['asType'];
7399
7723
  /**
7400
7724
  * `narrowType` narrows TypeScript types of a column. It sets input, output, query type altogether.
7401
7725
  *
@@ -7438,8 +7762,10 @@ declare abstract class Column$1<Schema extends ColumnTypeSchemaArg$1 = ColumnTyp
7438
7762
  * // size will be typed as 'small' | 'medium' | 'large'
7439
7763
  * const size = await db.table.get('size');
7440
7764
  * ```
7765
+ *
7766
+ * @deprecated use `type` instead
7441
7767
  */
7442
- narrowType: Schema['narrowType'];
7768
+ narrowType: this['__schema']['narrowType'];
7443
7769
  /**
7444
7770
  * Allows to narrow different TypeScript types of a column granularly.
7445
7771
  *
@@ -7495,17 +7821,19 @@ declare abstract class Column$1<Schema extends ColumnTypeSchemaArg$1 = ColumnTyp
7495
7821
  * // size will be typed as 'small' | 'medium' | 'large'
7496
7822
  * const size = await db.table.get('size');
7497
7823
  * ```
7824
+ *
7825
+ * @deprecated use `type`, `inputType`, `outputType`, `queryType` instead
7498
7826
  */
7499
- narrowAllTypes: Schema['narrowAllTypes'];
7827
+ narrowAllTypes: this['__schema']['narrowAllTypes'];
7500
7828
  input<T extends {
7501
7829
  inputSchema: unknown;
7502
- }, InputSchema extends Schema['type']>(this: T, fn: (schema: T['inputSchema']) => InputSchema): { [K in keyof T]: K extends 'inputSchema' ? InputSchema : T[K] };
7830
+ }, InputSchema extends this['__schema']['__schemaType']>(this: T, fn: (schema: T['inputSchema']) => InputSchema): { [K in keyof T]: K extends 'inputSchema' ? InputSchema : T[K] };
7503
7831
  output<T extends {
7504
7832
  outputSchema: unknown;
7505
- }, OutputSchema extends Schema['type']>(this: T, fn: (schema: T['outputSchema']) => OutputSchema): { [K in keyof T]: K extends 'outputSchema' ? OutputSchema : T[K] };
7833
+ }, OutputSchema extends this['__schema']['__schemaType']>(this: T, fn: (schema: T['outputSchema']) => OutputSchema): { [K in keyof T]: K extends 'outputSchema' ? OutputSchema : T[K] };
7506
7834
  query<T extends {
7507
7835
  querySchema: unknown;
7508
- }, QuerySchema extends Schema['type']>(this: T, fn: (schema: T['querySchema']) => QuerySchema): { [K in keyof T]: K extends 'querySchema' ? QuerySchema : T[K] };
7836
+ }, QuerySchema extends this['__schema']['__schemaType']>(this: T, fn: (schema: T['querySchema']) => QuerySchema): { [K in keyof T]: K extends 'querySchema' ? QuerySchema : T[K] };
7509
7837
  /**
7510
7838
  * Set a database column name.
7511
7839
  *
@@ -7599,7 +7927,7 @@ declare abstract class Column$1<Schema extends ColumnTypeSchemaArg$1 = ColumnTyp
7599
7927
  * }
7600
7928
  * ```
7601
7929
  */
7602
- setOnCreate<T extends Column.Pick.QueryInit>(this: T, fn: (arg: QueryHookUtils$1<PickQueryInputType$1>) => T['inputType'] | void): T;
7930
+ setOnCreate<T extends Column.Pick.QueryInit>(this: T, fn: (arg: QueryHookUtils$1<PickQueryInputType$1>) => T['__inputType'] | void): T;
7603
7931
  /**
7604
7932
  * Set a column value when updating a record.
7605
7933
  * This works for [readOnly](#readonly) columns as well.
@@ -7616,7 +7944,7 @@ declare abstract class Column$1<Schema extends ColumnTypeSchemaArg$1 = ColumnTyp
7616
7944
  * }
7617
7945
  * ```
7618
7946
  */
7619
- setOnUpdate<T extends Column.Pick.QueryInit>(this: T, fn: (arg: QueryHookUtils$1<PickQueryInputType$1>) => T['inputType'] | void): T;
7947
+ setOnUpdate<T extends Column.Pick.QueryInit>(this: T, fn: (arg: QueryHookUtils$1<PickQueryInputType$1>) => T['__inputType'] | void): T;
7620
7948
  /**
7621
7949
  * Set a column value when creating or updating a record.
7622
7950
  * This works for [readOnly](#readonly) columns as well.
@@ -7633,7 +7961,7 @@ declare abstract class Column$1<Schema extends ColumnTypeSchemaArg$1 = ColumnTyp
7633
7961
  * }
7634
7962
  * ```
7635
7963
  */
7636
- setOnSave<T extends Column.Pick.QueryInit>(this: T, fn: (arg: QueryHookUtils$1<PickQueryInputType$1>) => T['inputType'] | void): T;
7964
+ setOnSave<T extends Column.Pick.QueryInit>(this: T, fn: (arg: QueryHookUtils$1<PickQueryInputType$1>) => T['__inputType'] | void): T;
7637
7965
  /**
7638
7966
  * Mark the column as a primary key.
7639
7967
  * This column type becomes an argument of the `.find` method.
@@ -8213,7 +8541,7 @@ interface ToSQLQuery extends IsQuery$1 {
8213
8541
  }
8214
8542
  type UnionArgs<T extends PickQueryResult> = ({
8215
8543
  result: { [K in keyof T['result']]: {
8216
- queryType: T['result'][K]['queryType'];
8544
+ __queryType: T['result'][K]['__queryType'];
8217
8545
  } };
8218
8546
  } | ((q: T) => Expression$1))[];
8219
8547
  declare class Union {
@@ -8337,7 +8665,7 @@ declare class Clear {
8337
8665
  type HavingArgFn<T> = (q: T) => {
8338
8666
  result: {
8339
8667
  value: {
8340
- outputType: boolean;
8668
+ __outputType: boolean;
8341
8669
  };
8342
8670
  };
8343
8671
  };
@@ -8410,7 +8738,7 @@ interface QueryPluckSelf extends PickQuerySelectable, PickQueryRelationsWithData
8410
8738
  type PluckArg<T extends QueryPluckSelf> = SelectableOrExpression<T> | ((q: SelectAsFnArg<T>) => Expression$1 | Query.Pick.SingleValueResult);
8411
8739
  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' ? {
8412
8740
  pluck: R['result']['value'];
8413
- } : K extends 'returnType' ? 'pluck' : K extends 'then' ? QueryThen<R['result']['value']['outputType'][]> : T[K] } : never : S extends SelectableOrExpression<T> ? SetQueryReturnsPluck<T, S> : never;
8741
+ } : K extends 'returnType' ? 'pluck' : K extends 'then' ? QueryThen<R['result']['value']['__outputType'][]> : T[K] } : never : S extends SelectableOrExpression<T> ? SetQueryReturnsPluck<T, S> : never;
8414
8742
  declare class QueryPluck {
8415
8743
  /**
8416
8744
  * `.pluck` returns a single array of a single selected column values:
@@ -8582,15 +8910,15 @@ interface QueryHelper<T extends PickQueryTableMetaShapeTableAs, Args extends any
8582
8910
  interface NarrowTypeSelf extends PickQueryResultReturnType {
8583
8911
  returnType: undefined | 'all' | 'one' | 'oneOrThrow' | 'value' | 'valueOrThrow' | 'pluck';
8584
8912
  }
8585
- 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];
8913
+ 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];
8586
8914
  interface NarrowValueTypeResult<T extends PickQueryResultReturnType, Narrow> extends Column$1.QueryColumns {
8587
- value: { [K in keyof T['result']['value']]: K extends 'outputType' ? Narrow : T['result']['value'][K] };
8915
+ value: { [K in keyof T['result']['value']]: K extends '__outputType' ? Narrow : T['result']['value'][K] };
8588
8916
  }
8589
8917
  interface NarrowPluckTypeResult<T extends PickQueryResultReturnType, Narrow> extends Column$1.QueryColumns {
8590
- pluck: { [K in keyof T['result']['pluck']]: K extends 'outputType' ? Narrow extends unknown[] ? Narrow[number] : Narrow : T['result']['pluck'][K] };
8918
+ pluck: { [K in keyof T['result']['pluck']]: K extends '__outputType' ? Narrow extends unknown[] ? Narrow[number] : Narrow : T['result']['pluck'][K] };
8591
8919
  }
8592
8920
  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.Modifiers.QueryColumnToOptional<R['result'][K]> } : K extends 'then' ? QueryIfResultThen<T, R> : T[K] };
8593
- 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>;
8921
+ 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>;
8594
8922
  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 {}
8595
8923
  declare class QueryMethods<ColumnTypes> {
8596
8924
  /**
@@ -9021,10 +9349,10 @@ declare class QueryMethods<ColumnTypes> {
9021
9349
  * ```
9022
9350
  */
9023
9351
  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]: {
9024
- outputType: Narrow[K];
9352
+ __outputType: Narrow[K];
9025
9353
  } } : K extends 'then' ? QueryThenByQuery<T, T['result'] & { [K in keyof Narrow]: {
9026
- outputType: Narrow[K];
9027
- } }> : 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';
9354
+ __outputType: Narrow[K];
9355
+ } }> : 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';
9028
9356
  if<T extends PickQueryResultReturnType, R extends PickQueryResult>(this: T, condition: boolean | null | undefined, fn: (q: T) => R & {
9029
9357
  returnType: T['returnType'];
9030
9358
  }): QueryIfResult<T, R>;
@@ -9098,12 +9426,14 @@ interface Query extends IsQuery$1, PickQueryTable, PickQueryShape$1, PickQuerySe
9098
9426
  returnType: QueryReturnType$1;
9099
9427
  qb: QueryBuilder;
9100
9428
  columnTypes: unknown;
9101
- inputType: RecordUnknown$1;
9429
+ __inputType: RecordUnknown$1;
9102
9430
  q: QueryData$1;
9103
9431
  then: QueryThen<unknown>;
9104
9432
  catch: QueryCatch;
9105
9433
  windows: EmptyObject$1;
9106
9434
  relations: RelationsBase$1;
9435
+ relationsDataForCreate: RelationsDataForCreateBase;
9436
+ relationsDataForCreateOptional: RelationsDataForCreateOptionalBase;
9107
9437
  relationQueries: IsQueries;
9108
9438
  error: new (message: string, length: number, name: QueryErrorName) => QueryError;
9109
9439
  __readOnly: true | undefined;
@@ -9135,43 +9465,43 @@ declare namespace Query {
9135
9465
  }
9136
9466
  }
9137
9467
  }
9138
- type SelectableOfType<T extends PickQuerySelectable, Type> = { [K in keyof T['__selectable']]: T['__selectable'][K]['column']['type'] extends Type | null ? K : never }[keyof T['__selectable']];
9139
- type SelectableOrExpressionOfType<T extends PickQuerySelectable, C extends Column$1.Pick.Type> = SelectableOfType<T, C['type']> | Expression$1<Column$1.Pick.QueryColumnOfType<C['type'] | null>>;
9468
+ type SelectableOfType<T extends PickQuerySelectable, Type> = { [K in keyof T['__selectable']]: T['__selectable'][K]['column']['__type'] extends Type | null ? K : never }[keyof T['__selectable']];
9469
+ type SelectableOrExpressionOfType<T extends PickQuerySelectable, C extends Column$1.Pick.Type> = SelectableOfType<T, C['__type']> | Expression$1<Column$1.Pick.QueryColumnOfType<C['__type'] | null>>;
9140
9470
  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;
9141
9471
  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;
9142
- 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] };
9472
+ 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] };
9143
9473
  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] };
9144
- 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] };
9474
+ 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] };
9145
9475
  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] };
9146
9476
  type SetQueryReturnsOne<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'then' ? QueryThenShallowSimplify<ColumnsShape$1.Output<T['result']>> : T[K] };
9147
9477
  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] };
9148
9478
  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] };
9149
9479
  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' ? {
9150
9480
  pluck: T['__selectable'][S]['column'];
9151
- } : 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' ? {
9481
+ } : 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' ? {
9152
9482
  pluck: S extends Expression$1 ? S['result']['value'] : never;
9153
- } : K extends 'returnType' ? 'pluck' : K extends 'then' ? QueryThen<(S extends Expression$1 ? S['result']['value']['outputType'] : never)[]> : T[K] };
9483
+ } : K extends 'returnType' ? 'pluck' : K extends 'then' ? QueryThen<(S extends Expression$1 ? S['result']['value']['__outputType'] : never)[]> : T[K] };
9154
9484
  type SetValueQueryReturnsPluckColumn<T extends PickQueryResult> = { [K in keyof T]: K extends 'result' ? {
9155
9485
  pluck: T['result']['value'];
9156
- } : K extends 'returnType' ? 'pluck' : K extends 'then' ? QueryThen<T['result']['value']['outputType'][]> : T[K] } & QueryHasSelect;
9486
+ } : K extends 'returnType' ? 'pluck' : K extends 'then' ? QueryThen<T['result']['value']['__outputType'][]> : T[K] } & QueryHasSelect;
9157
9487
  type SetQueryReturnsPluckColumnResult<T extends PickQueryResult, Result extends Column$1.QueryColumns> = { [K in keyof T]: K extends 'result' ? {
9158
9488
  pluck: T['result']['value'];
9159
- } : K extends 'returnType' ? 'pluck' : K extends 'result' ? Result : K extends 'then' ? QueryThen<T['result']['value']['outputType'][]> : T[K] } & QueryHasSelect;
9489
+ } : K extends 'returnType' ? 'pluck' : K extends 'result' ? Result : K extends 'then' ? QueryThen<T['result']['value']['__outputType'][]> : T[K] } & QueryHasSelect;
9160
9490
  type SetQueryReturnsValueOrThrow<T extends PickQuerySelectable, Arg extends keyof T['__selectable']> = SetQueryReturnsColumnOrThrow<T, T['__selectable'][Arg]['column']> & T['__selectable'][Arg]['column']['operators'];
9161
- type SetValueQueryReturnsValueOrThrow<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<T['result']['value']['outputType']> : T[K] };
9162
- 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.Modifiers.OperatorsNullable<T['__selectable'][Arg]['column']>;
9491
+ type SetValueQueryReturnsValueOrThrow<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<T['result']['value']['__outputType']> : T[K] };
9492
+ 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.Modifiers.OperatorsNullable<T['__selectable'][Arg]['column']>;
9163
9493
  type SetQueryReturnsColumnOrThrow<T, Column extends Column.Pick.OutputType> = { [K in keyof T]: K extends 'result' ? {
9164
9494
  value: Column;
9165
- } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<Column['outputType']> : T[K] } & QueryHasSelect;
9495
+ } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<Column['__outputType']> : T[K] } & QueryHasSelect;
9166
9496
  type SetQueryReturnsColumnOptional<T, Column extends Column.Pick.OutputType> = { [K in keyof T]: K extends 'result' ? {
9167
9497
  value: Column;
9168
- } : K extends 'returnType' ? 'value' : K extends 'then' ? QueryThen<Column['outputType'] | undefined> : T[K] } & QueryHasSelect;
9498
+ } : K extends 'returnType' ? 'value' : K extends 'then' ? QueryThen<Column['__outputType'] | undefined> : T[K] } & QueryHasSelect;
9169
9499
  type SetQueryReturnsColumn<T extends PickQueryResult> = { [K in keyof T]: K extends 'result' ? {
9170
9500
  value: T['result']['pluck'];
9171
- } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<T['result']['pluck']['outputType']> : T[K] } & QueryHasSelect;
9501
+ } : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<T['result']['pluck']['__outputType']> : T[K] } & QueryHasSelect;
9172
9502
  type SetQueryReturnsColumnResult<T extends PickQueryResult, Result extends Column$1.QueryColumns> = { [K in keyof T]: K extends 'result' ? {
9173
9503
  value: T['result']['pluck'];
9174
- } : K extends 'returnType' ? 'valueOrThrow' : K extends 'result' ? Result : K extends 'then' ? QueryThen<Result['pluck']['outputType']> : T[K] } & QueryHasSelect;
9504
+ } : K extends 'returnType' ? 'valueOrThrow' : K extends 'result' ? Result : K extends 'then' ? QueryThen<Result['pluck']['__outputType']> : T[K] } & QueryHasSelect;
9175
9505
  type SetQueryReturnsRowCount<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'valueOrThrow' : K extends 'result' ? {
9176
9506
  value: Column$1.Pick.QueryColumnOfType<number>;
9177
9507
  } : K extends 'then' ? QueryThen<number> : T[K] };
@@ -9186,11 +9516,11 @@ interface QueryOrExpressionBooleanOrNullResult {
9186
9516
  };
9187
9517
  }
9188
9518
  interface UpdateSelf extends PickQuerySelectable, PickQueryResult, PickQueryRelations$1, PickQueryWithData, PickQueryReturnType, PickQueryShape$1, PickQueryInputType$1, PickQueryAs, PickQueryHasSelect, PickQueryHasWhere, Query.Pick.IsNotReadOnly {}
9189
- 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'] };
9519
+ 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'] };
9190
9520
  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()`';
9191
9521
  type UpdateResult<T extends UpdateSelf> = T['__hasSelect'] extends true ? T : T['returnType'] extends undefined | 'all' ? SetQueryReturnsRowCountMany<T> : SetQueryReturnsRowCount<T>;
9192
- 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']];
9193
- type ChangeCountArg<T extends UpdateSelf> = NumericColumns<T> | { [K in NumericColumns<T>]?: T['shape'][K]['type'] extends number | null ? number : number | string | bigint };
9522
+ 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']];
9523
+ type ChangeCountArg<T extends UpdateSelf> = NumericColumns<T> | { [K in NumericColumns<T>]?: T['shape'][K]['__type'] extends number | null ? number : number | string | bigint };
9194
9524
  interface UpdateManyBySelf extends UpdateSelf {
9195
9525
  internal: {
9196
9526
  uniqueColumns: unknown;
@@ -9199,10 +9529,10 @@ interface UpdateManyBySelf extends UpdateSelf {
9199
9529
  uniqueConstraints: unknown;
9200
9530
  };
9201
9531
  }
9202
- type UpdateManyData<T extends UpdateSelf> = ({ [K in keyof T['shape'] as T['shape'][K] extends Column$1.Modifiers.IsPrimaryKey<string> ? K : never]: T['shape'][K]['queryType'] | Expression$1 } & { [P in keyof T['inputType']]?: T['inputType'][P] | Expression$1 })[];
9532
+ type UpdateManyData<T extends UpdateSelf> = ({ [K in keyof T['shape'] as T['shape'][K] extends Column$1.Modifiers.IsPrimaryKey<string> ? K : never]: T['shape'][K]['__queryType'] | Expression$1 } & { [P in keyof T['__inputType']]?: T['__inputType'][P] | Expression$1 })[];
9203
9533
  type UpdateManyByKeys<T extends UpdateManyBySelf> = T['internal']['uniqueColumnNames'] | T['internal']['uniqueColumnTuples'];
9204
9534
  type UpdateManyByKeyColumns<K> = K extends string[] ? K[number] : K;
9205
- 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 })[];
9535
+ 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 })[];
9206
9536
  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>;
9207
9537
  declare class QueryUpdate {
9208
9538
  /**
@@ -9647,4 +9977,4 @@ declare class QueryUpdate {
9647
9977
  */
9648
9978
  updateManyByOptional<T extends UpdateManyBySelf, Keys extends UpdateManyByKeys<T>, K = UpdateManyByKeyColumns<Keys>>(this: T, keys: Keys, data: UpdateManyByData<T, K>): UpdateManyResult<T> & QueryHasWhere$1;
9649
9979
  }
9650
- 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 JoinQueryMethod, 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, 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 ShapeColumnPrimaryKeys, 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, _orCreate, _prependWith, _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, consumeColumnName, deepCompare, defaultSchemaConfig, emptyArray, emptyObject, escapeForMigration, escapeString, excludeInnerToCode, exhaustive, getCallerFilePath, getClonedQueryData, getColumnBaseType, getColumnTypes, getDateAsDateFn, getDateAsNumberFn, getDriverErrorCode, getFreeAlias, getFreeSetAlias, getImportPath, getPrimaryKeys, getQueryAs, getQuerySchema, getShapeFromSelect, getSqlText, getStackTrace, getSupportedDefaultPrivileges, indexInnerToCode, 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 };
9980
+ 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 JoinQueryMethod, 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 ShapeColumnPrimaryKeys, 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, _orCreate, _prependWith, _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, consumeColumnName, deepCompare, defaultSchemaConfig, emptyArray, emptyObject, escapeForMigration, escapeString, excludeInnerToCode, exhaustive, getCallerFilePath, getClonedQueryData, getColumnBaseType, getColumnTypes, getDateAsDateFn, getDateAsNumberFn, getDriverErrorCode, getFreeAlias, getFreeSetAlias, getImportPath, getPrimaryKeys, getQueryAs, getQuerySchema, getShapeFromSelect, getSqlText, getStackTrace, getSupportedDefaultPrivileges, indexInnerToCode, 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 };