pqb 0.7.13 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/index.d.ts +618 -563
  3. package/dist/index.esm.js +1011 -402
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/index.js +1014 -401
  6. package/dist/index.js.map +1 -1
  7. package/package.json +1 -1
  8. package/src/columnSchema/array.test.ts +67 -0
  9. package/src/columnSchema/array.ts +39 -13
  10. package/src/columnSchema/boolean.test.ts +17 -0
  11. package/src/columnSchema/boolean.ts +5 -1
  12. package/src/columnSchema/columnType.test.ts +230 -107
  13. package/src/columnSchema/columnType.ts +198 -28
  14. package/src/columnSchema/columnTypes.ts +28 -15
  15. package/src/columnSchema/columnsSchema.ts +6 -4
  16. package/src/columnSchema/commonMethods.ts +11 -4
  17. package/src/columnSchema/dateTime.test.ts +298 -0
  18. package/src/columnSchema/dateTime.ts +59 -2
  19. package/src/columnSchema/enum.test.ts +33 -0
  20. package/src/columnSchema/enum.ts +11 -1
  21. package/src/columnSchema/json/array.test.ts +21 -0
  22. package/src/columnSchema/json/array.ts +27 -13
  23. package/src/columnSchema/json/discriminatedUnion.test.ts +32 -0
  24. package/src/columnSchema/json/discriminatedUnion.ts +17 -2
  25. package/src/columnSchema/json/enum.test.ts +9 -0
  26. package/src/columnSchema/json/enum.ts +9 -1
  27. package/src/columnSchema/json/index.ts +19 -19
  28. package/src/columnSchema/json/instanceOf.test.ts +8 -0
  29. package/src/columnSchema/json/instanceOf.ts +4 -1
  30. package/src/columnSchema/json/intersection.test.ts +19 -0
  31. package/src/columnSchema/json/intersection.ts +9 -1
  32. package/src/columnSchema/json/lazy.test.ts +22 -0
  33. package/src/columnSchema/json/lazy.ts +22 -1
  34. package/src/columnSchema/json/literal.test.ts +7 -0
  35. package/src/columnSchema/json/literal.ts +12 -1
  36. package/src/columnSchema/json/map.test.ts +10 -0
  37. package/src/columnSchema/json/map.ts +21 -1
  38. package/src/columnSchema/json/nativeEnum.test.ts +10 -0
  39. package/src/columnSchema/json/nativeEnum.ts +4 -1
  40. package/src/columnSchema/json/nullable.test.ts +18 -0
  41. package/src/columnSchema/json/nullish.test.ts +18 -0
  42. package/src/columnSchema/json/object.test.ts +77 -0
  43. package/src/columnSchema/json/object.ts +31 -3
  44. package/src/columnSchema/json/optional.test.ts +18 -0
  45. package/src/columnSchema/json/record.test.ts +14 -0
  46. package/src/columnSchema/json/record.ts +12 -1
  47. package/src/columnSchema/json/scalarTypes.test.ts +133 -0
  48. package/src/columnSchema/json/scalarTypes.ts +90 -1
  49. package/src/columnSchema/json/set.test.ts +29 -0
  50. package/src/columnSchema/json/set.ts +26 -7
  51. package/src/columnSchema/json/tuple.test.ts +17 -0
  52. package/src/columnSchema/json/tuple.ts +16 -1
  53. package/src/columnSchema/json/typeBase.test.ts +123 -0
  54. package/src/columnSchema/json/typeBase.ts +52 -13
  55. package/src/columnSchema/json/union.test.ts +10 -0
  56. package/src/columnSchema/json/union.ts +18 -1
  57. package/src/columnSchema/json.test.ts +17 -0
  58. package/src/columnSchema/json.ts +10 -2
  59. package/src/columnSchema/number.test.ts +176 -0
  60. package/src/columnSchema/number.ts +48 -1
  61. package/src/columnSchema/string.test.ts +412 -0
  62. package/src/columnSchema/string.ts +126 -15
  63. package/src/columnSchema/timestamps.test.ts +6 -6
  64. package/src/columnSchema/virtual.ts +4 -0
  65. package/src/db.ts +1 -1
  66. package/src/query.ts +1 -1
  67. package/src/queryMethods/create.ts +6 -6
  68. package/src/queryMethods/for.ts +3 -3
  69. package/src/queryMethods/having.ts +1 -1
  70. package/src/queryMethods/join.ts +4 -4
  71. package/src/queryMethods/json.ts +1 -1
  72. package/src/queryMethods/queryMethods.ts +2 -2
  73. package/src/queryMethods/select.ts +3 -3
  74. package/src/queryMethods/update.ts +17 -17
  75. package/src/queryMethods/where.test.ts +1 -1
  76. package/src/queryMethods/where.ts +4 -4
  77. package/src/relations.ts +1 -1
  78. package/src/sql/aggregate.ts +2 -2
  79. package/src/sql/copy.ts +3 -3
  80. package/src/sql/delete.ts +5 -5
  81. package/src/sql/fromAndAs.ts +4 -4
  82. package/src/sql/having.ts +7 -7
  83. package/src/sql/insert.ts +5 -5
  84. package/src/sql/join.ts +16 -16
  85. package/src/sql/select.ts +6 -6
  86. package/src/sql/toSql.ts +24 -24
  87. package/src/sql/update.ts +4 -4
  88. package/src/sql/where.ts +18 -18
  89. package/src/utils.test.ts +9 -0
  90. package/src/utils.ts +3 -0
  91. package/src/columnSchema/columnTypes.test.ts +0 -527
package/dist/index.d.ts CHANGED
@@ -25,7 +25,7 @@ declare const getQueryParsers: (q: Query) => ColumnsParsers | undefined;
25
25
  declare type BaseRelation = {
26
26
  type: string;
27
27
  key: string;
28
- model: QueryWithTable;
28
+ table: QueryWithTable;
29
29
  query: QueryWithTable;
30
30
  joinQuery(fromQuery: QueryBase, toQuery: Query): Query;
31
31
  nestedCreateQuery: Query;
@@ -436,8 +436,8 @@ declare type ToSqlOptions = {
436
436
  clearCache?: boolean;
437
437
  values?: unknown[];
438
438
  };
439
- declare const toSql: (model: Query, options?: ToSqlOptions) => Sql;
440
- declare const makeSql: (model: Query, { values }?: ToSqlOptions) => Sql;
439
+ declare const toSql: (table: Query, options?: ToSqlOptions) => Sql;
440
+ declare const makeSql: (table: Query, { values }?: ToSqlOptions) => Sql;
441
441
 
442
442
  declare type SomeIsTrue<T extends unknown[]> = T extends [
443
443
  infer Head,
@@ -488,6 +488,7 @@ declare const emptyObject: {};
488
488
  declare const makeRegexToFindInSql: (value: string) => RegExp;
489
489
  declare const pushOrNewArrayToObject: <Obj extends {}, Key extends keyof Obj>(obj: Obj, key: Key, value: Exclude<Obj[Key], undefined> extends unknown[] ? Exclude<Obj[Key], undefined>[number] : never) => void;
490
490
  declare const pushOrNewArray: <Arr extends unknown[]>(arr: Arr | undefined, value: Arr[number]) => Arr;
491
+ declare const singleQuote: (s: string) => string;
491
492
 
492
493
  declare type ThenResult<Res> = (resolve?: (value: Res) => any, reject?: (error: any) => any) => Promise<Res | never>;
493
494
  declare const queryMethodByReturnType: Record<QueryReturnType, 'query' | 'arrays'>;
@@ -518,7 +519,7 @@ declare class QueryGet {
518
519
  declare type SelectArg<T extends QueryBase> = StringKey<keyof T['selectable']> | (T['relations'] extends Record<string, Relation> ? StringKey<keyof T['relations']> : never) | SelectAsArg<T>;
519
520
  declare type SelectAsArg<T extends QueryBase> = Record<string, StringKey<keyof T['selectable']> | RawExpression | ((q: T) => Query)>;
520
521
  declare type SelectResult<T extends Query, Args extends SelectArg<T>[], SelectAsArgs = SimpleSpread<FilterTuple<Args, SelectAsArg<T>>>> = AddQuerySelect<T, {
521
- [Arg in Args[number] as Arg extends keyof T['selectable'] ? T['selectable'][Arg]['as'] : Arg extends keyof T['relations'] ? Arg : never]: Arg extends keyof T['selectable'] ? T['selectable'][Arg]['column'] : T['relations'] extends Record<string, Relation> ? Arg extends keyof T['relations'] ? T['relations'][Arg]['returns'] extends 'many' ? ArrayOfColumnsObjects<T['relations'][Arg]['model']['result']> : T['relations'][Arg]['options']['required'] extends true ? ColumnsObject<T['relations'][Arg]['model']['result']> : NullableColumn<ColumnsObject<T['relations'][Arg]['model']['result']>> : never : never;
522
+ [Arg in Args[number] as Arg extends keyof T['selectable'] ? T['selectable'][Arg]['as'] : Arg extends keyof T['relations'] ? Arg : never]: Arg extends keyof T['selectable'] ? T['selectable'][Arg]['column'] : T['relations'] extends Record<string, Relation> ? Arg extends keyof T['relations'] ? T['relations'][Arg]['returns'] extends 'many' ? ArrayOfColumnsObjects<T['relations'][Arg]['table']['result']> : T['relations'][Arg]['options']['required'] extends true ? ColumnsObject<T['relations'][Arg]['table']['result']> : NullableColumn<ColumnsObject<T['relations'][Arg]['table']['result']>> : never : never;
522
523
  } & {
523
524
  [K in keyof SelectAsArgs]: SelectAsArgs[K] extends keyof T['selectable'] ? T['selectable'][SelectAsArgs[K]]['column'] : SelectAsArgs[K] extends RawExpression ? SelectAsArgs[K]['__column'] : SelectAsArgs[K] extends (q: T) => Query ? SelectSubQueryResult<ReturnType<SelectAsArgs[K]>> : SelectAsArgs[K] extends ((q: T) => Query) | RawExpression ? SelectSubQueryResult<ReturnType<Exclude<SelectAsArgs[K], RawExpression>>> | Exclude<SelectAsArgs[K], (q: T) => Query>['__column'] : never;
524
525
  }>;
@@ -587,7 +588,7 @@ declare abstract class Where implements QueryBase {
587
588
  abstract shape: ColumnsShape;
588
589
  abstract relations: RelationsBase;
589
590
  abstract withData: WithDataBase;
590
- abstract __model: Query;
591
+ abstract __table: Query;
591
592
  query: QueryData;
592
593
  table?: string;
593
594
  tableAlias?: string;
@@ -641,7 +642,7 @@ declare class WhereQueryBuilder<Q extends QueryBase = QueryBase> extends Where i
641
642
  selectable: Q['selectable'];
642
643
  shape: Q['shape'];
643
644
  relations: Q['relations'];
644
- __model: Query;
645
+ __table: Query;
645
646
  withData: {};
646
647
  constructor(q: QueryBase | string, shape: ColumnsShape);
647
648
  clone<T extends this>(this: T): T;
@@ -673,7 +674,7 @@ declare type JoinArgs<T extends QueryBase, Q extends Query = Query, R extends ke
673
674
  op: string,
674
675
  rightColumn: Selectable<T> | RawExpression
675
676
  ];
676
- declare type JoinResult<T extends Query, Args extends JoinArgs<T>, A extends Query | keyof T['relations'] = Args[0]> = AddQueryJoinedTable<T, A extends Query ? A : T['relations'] extends Record<string, Relation> ? A extends keyof T['relations'] ? T['relations'][A]['model'] : A extends keyof T['withData'] ? T['withData'][A] extends WithDataItem ? {
677
+ declare type JoinResult<T extends Query, Args extends JoinArgs<T>, A extends Query | keyof T['relations'] = Args[0]> = AddQueryJoinedTable<T, A extends Query ? A : T['relations'] extends Record<string, Relation> ? A extends keyof T['relations'] ? T['relations'][A]['table'] : A extends keyof T['withData'] ? T['withData'][A] extends WithDataItem ? {
677
678
  table: T['withData'][A]['table'];
678
679
  tableAlias: undefined;
679
680
  result: T['withData'][A]['shape'];
@@ -691,11 +692,11 @@ declare type JoinCallback<T extends QueryBase, Arg extends JoinCallbackArg<T>> =
691
692
  };
692
693
  };
693
694
  shape: T['withData'][Arg]['shape'];
694
- __model: Query;
695
+ __table: Query;
695
696
  relations: RelationsBase;
696
697
  withData: WithDataBase;
697
- } : never : Arg extends Query ? Arg : T['relations'] extends Record<string, Relation> ? Arg extends keyof T['relations'] ? T['relations'][Arg]['model'] : never : never>) => OnQueryBuilder;
698
- declare type JoinCallbackResult<T extends Query, Arg extends JoinCallbackArg<T>> = AddQueryJoinedTable<T, Arg extends Query ? Arg : T['relations'] extends Record<string, Relation> ? Arg extends keyof T['relations'] ? T['relations'][Arg]['model'] : Arg extends keyof T['withData'] ? T['withData'][Arg] extends WithDataItem ? {
698
+ } : never : Arg extends Query ? Arg : T['relations'] extends Record<string, Relation> ? Arg extends keyof T['relations'] ? T['relations'][Arg]['table'] : never : never>) => OnQueryBuilder;
699
+ declare type JoinCallbackResult<T extends Query, Arg extends JoinCallbackArg<T>> = AddQueryJoinedTable<T, Arg extends Query ? Arg : T['relations'] extends Record<string, Relation> ? Arg extends keyof T['relations'] ? T['relations'][Arg]['table'] : Arg extends keyof T['withData'] ? T['withData'][Arg] extends WithDataItem ? {
699
700
  table: T['withData'][Arg]['table'];
700
701
  tableAlias: undefined;
701
702
  result: T['withData'][Arg]['shape'];
@@ -986,13 +987,13 @@ declare type CreateBelongsToData<T extends Query, Key extends keyof T['relations
986
987
  connectOrCreate?: never;
987
988
  } | {
988
989
  create?: never;
989
- connect: WhereArg<Rel['model']>;
990
+ connect: WhereArg<Rel['table']>;
990
991
  connectOrCreate?: never;
991
992
  } | {
992
993
  create?: never;
993
994
  connect?: never;
994
995
  connectOrCreate: {
995
- where: WhereArg<Rel['model']>;
996
+ where: WhereArg<Rel['table']>;
996
997
  create: CreateData<Rel['nestedCreateQuery']>;
997
998
  };
998
999
  };
@@ -1004,13 +1005,13 @@ declare type CreateHasOneData<T extends Query, Key extends keyof T['relations'],
1004
1005
  connectOrCreate?: never;
1005
1006
  } | {
1006
1007
  create?: never;
1007
- connect: WhereArg<Rel['model']>;
1008
+ connect: WhereArg<Rel['table']>;
1008
1009
  connectOrCreate?: never;
1009
1010
  } | {
1010
1011
  create?: never;
1011
1012
  connect?: never;
1012
1013
  connectOrCreate: {
1013
- where?: WhereArg<Rel['model']>;
1014
+ where?: WhereArg<Rel['table']>;
1014
1015
  create?: CreateData<Rel['nestedCreateQuery']>;
1015
1016
  };
1016
1017
  };
@@ -1018,9 +1019,9 @@ declare type CreateHasOneData<T extends Query, Key extends keyof T['relations'],
1018
1019
  declare type CreateHasManyData<T extends Query, Key extends keyof T['relations'], Rel extends HasManyRelation | HasAndBelongsToManyRelation> = 'through' extends Rel['options'] ? {} : {
1019
1020
  [K in Key]?: {
1020
1021
  create?: CreateData<Rel['nestedCreateQuery']>[];
1021
- connect?: WhereArg<Rel['model']>[];
1022
+ connect?: WhereArg<Rel['table']>[];
1022
1023
  connectOrCreate?: {
1023
- where: WhereArg<Rel['model']>;
1024
+ where: WhereArg<Rel['table']>;
1024
1025
  create: CreateData<Rel['nestedCreateQuery']>;
1025
1026
  }[];
1026
1027
  };
@@ -1083,16 +1084,16 @@ declare type UpdateData<T extends Query> = {
1083
1084
  declare type UpdateBelongsToData<T extends Query, Rel extends BelongsToRelation> = {
1084
1085
  disconnect: boolean;
1085
1086
  } | {
1086
- set: WhereArg<Rel['model']>;
1087
+ set: WhereArg<Rel['table']>;
1087
1088
  } | {
1088
1089
  delete: boolean;
1089
1090
  } | {
1090
- update: UpdateData<Rel['model']>;
1091
+ update: UpdateData<Rel['table']>;
1091
1092
  } | {
1092
1093
  create: CreateData<Rel['nestedCreateQuery']>;
1093
1094
  } | (QueryReturnsAll<T['returnType']> extends true ? never : {
1094
1095
  upsert: {
1095
- update: UpdateData<Rel['model']>;
1096
+ update: UpdateData<Rel['table']>;
1096
1097
  create: CreateData<Rel['nestedCreateQuery']>;
1097
1098
  };
1098
1099
  });
@@ -1101,35 +1102,35 @@ declare type UpdateHasOneData<T extends Query, Rel extends HasOneRelation> = {
1101
1102
  } | {
1102
1103
  delete: boolean;
1103
1104
  } | {
1104
- update: UpdateData<Rel['model']>;
1105
+ update: UpdateData<Rel['table']>;
1105
1106
  } | (QueryReturnsAll<T['returnType']> extends true ? never : {
1106
- set: WhereArg<Rel['model']>;
1107
+ set: WhereArg<Rel['table']>;
1107
1108
  } | {
1108
1109
  upsert: {
1109
- update: UpdateData<Rel['model']>;
1110
+ update: UpdateData<Rel['table']>;
1110
1111
  create: CreateData<Rel['nestedCreateQuery']>;
1111
1112
  };
1112
1113
  } | {
1113
1114
  create: CreateData<Rel['nestedCreateQuery']>;
1114
1115
  });
1115
1116
  declare type UpdateHasManyData<T extends Query, Rel extends HasManyRelation> = {
1116
- disconnect?: MaybeArray<WhereArg<Rel['model']>>;
1117
- delete?: MaybeArray<WhereArg<Rel['model']>>;
1117
+ disconnect?: MaybeArray<WhereArg<Rel['table']>>;
1118
+ delete?: MaybeArray<WhereArg<Rel['table']>>;
1118
1119
  update?: {
1119
- where: MaybeArray<WhereArg<Rel['model']>>;
1120
- data: UpdateData<Rel['model']>;
1120
+ where: MaybeArray<WhereArg<Rel['table']>>;
1121
+ data: UpdateData<Rel['table']>;
1121
1122
  };
1122
1123
  } & (QueryReturnsAll<T['returnType']> extends true ? EmptyObject : {
1123
- set?: MaybeArray<WhereArg<Rel['model']>>;
1124
+ set?: MaybeArray<WhereArg<Rel['table']>>;
1124
1125
  create?: CreateData<Rel['nestedCreateQuery']>[];
1125
1126
  });
1126
1127
  declare type UpdateHasAndBelongsToManyData<Rel extends HasAndBelongsToManyRelation> = {
1127
- disconnect?: MaybeArray<WhereArg<Rel['model']>>;
1128
- set?: MaybeArray<WhereArg<Rel['model']>>;
1129
- delete?: MaybeArray<WhereArg<Rel['model']>>;
1128
+ disconnect?: MaybeArray<WhereArg<Rel['table']>>;
1129
+ set?: MaybeArray<WhereArg<Rel['table']>>;
1130
+ delete?: MaybeArray<WhereArg<Rel['table']>>;
1130
1131
  update?: {
1131
- where: MaybeArray<WhereArg<Rel['model']>>;
1132
- data: UpdateData<Rel['model']>;
1132
+ where: MaybeArray<WhereArg<Rel['table']>>;
1133
+ data: UpdateData<Rel['table']>;
1133
1134
  };
1134
1135
  create?: CreateData<Rel['nestedCreateQuery']>[];
1135
1136
  };
@@ -1340,7 +1341,7 @@ interface QueryMethods extends Aggregate, Select, From, Join, With, Union, Json,
1340
1341
  }
1341
1342
  declare class QueryMethods {
1342
1343
  windows: EmptyObject;
1343
- __model: Query;
1344
+ __table: Query;
1344
1345
  all<T extends Query>(this: T): SetQueryReturnsAll<T>;
1345
1346
  _all<T extends Query>(this: T): SetQueryReturnsAll<T>;
1346
1347
  take<T extends Query>(this: T): SetQueryReturnsOne<T>;
@@ -1545,7 +1546,7 @@ declare type QueryBase = {
1545
1546
  clone(): QueryBase;
1546
1547
  selectable: SelectableBase;
1547
1548
  shape: ColumnsShape;
1548
- __model: Query;
1549
+ __table: Query;
1549
1550
  relations: RelationsBase;
1550
1551
  withData: WithDataBase;
1551
1552
  };
@@ -1926,6 +1927,48 @@ declare type JSONIntersection<Left extends JSONTypeAny, Right extends JSONTypeAn
1926
1927
  };
1927
1928
  declare const intersection: <Left extends JSONTypeAny, Right extends JSONTypeAny>(left: Left, right: Right) => JSONIntersection<Left, Right>;
1928
1929
 
1930
+ declare type JSONTypeAny = JSONType<any>;
1931
+ declare type DeepPartial<T extends JSONTypeAny> = ReturnType<JSONTypeAny['deepPartial']> extends ReturnType<T['deepPartial']> ? T : ReturnType<T['deepPartial']>;
1932
+ declare type JSONTypeData = ColumnData & {
1933
+ optional?: true;
1934
+ nullable?: true;
1935
+ isDeepPartial?: true;
1936
+ isNonEmpty?: true;
1937
+ };
1938
+ declare type Primitive = string | number | bigint | boolean | null | undefined;
1939
+ declare type JSONType<Type, DataType extends string = string> = {
1940
+ type: Type;
1941
+ data: JSONTypeData;
1942
+ dataType: DataType;
1943
+ chain: ColumnChain;
1944
+ toCode(t: string): Code;
1945
+ optional<T extends JSONTypeAny>(this: T): JSONOptional<T>;
1946
+ required<T extends JSONTypeAny>(this: T): JSONRequired<T>;
1947
+ nullable<T extends JSONTypeAny>(this: T): JSONNullable<T>;
1948
+ notNullable<T extends JSONTypeAny>(this: T): JSONNotNullable<T>;
1949
+ nullish<T extends JSONTypeAny>(this: T): JSONNullish<T>;
1950
+ notNullish<T extends JSONTypeAny>(this: T): JSONNotNullish<T>;
1951
+ deepPartial(): JSONTypeAny;
1952
+ transform<T extends JSONTypeAny, Transformed>(this: T, fn: (input: T['type'], ctx: ValidationContext) => Transformed): JSONType<Transformed extends PromiseLike<unknown> ? Awaited<Transformed> : Transformed, T['dataType']>;
1953
+ to<T extends JSONTypeAny, ToType extends JSONTypeAny>(this: T, fn: (input: T['type']) => ToType['type'] | undefined, type: ToType): ToType;
1954
+ refine<T extends JSONTypeAny, RefinedOutput extends T['type']>(this: T, check: (arg: T['type']) => unknown): T & {
1955
+ type: RefinedOutput;
1956
+ };
1957
+ superRefine<T extends JSONTypeAny, RefinedOutput extends T['type']>(this: T, check: (arg: T['type'], ctx: ValidationContext) => unknown): T & {
1958
+ type: RefinedOutput;
1959
+ };
1960
+ and<A extends JSONTypeAny, B extends JSONTypeAny>(this: A, type: B): JSONIntersection<A, B>;
1961
+ or<T extends JSONTypeAny, U extends [JSONTypeAny, ...JSONTypeAny[]]>(this: T, ...types: U): T | U[number];
1962
+ default<T extends JSONTypeAny>(this: T, value: T['type'] | (() => T['type'])): JSONNotNullish<T>;
1963
+ array<T extends JSONTypeAny>(this: T): JSONArray<T>;
1964
+ };
1965
+ declare const toCode: (type: JSONTypeAny, t: string, code: Code) => Code;
1966
+ declare type BaseTypeProps<T extends JSONTypeAny> = Omit<JSONType<T['type']>, 'dataType'>;
1967
+ declare type OwnTypeProps<T extends JSONTypeAny> = Omit<T, keyof BaseTypeProps<T>> & {
1968
+ [k in keyof BaseTypeProps<T>]?: BaseTypeProps<T>[k];
1969
+ };
1970
+ declare const constructType: <T extends JSONTypeAny>(type: OwnTypeProps<T>) => T;
1971
+
1929
1972
  declare function min<T extends {
1930
1973
  data: {
1931
1974
  min?: number;
@@ -1962,28 +2005,32 @@ declare function size<T extends {
1962
2005
  size: Value;
1963
2006
  };
1964
2007
  };
1965
- declare function nonempty<T extends {
2008
+ declare type NonEmptyBase = {
1966
2009
  data: {
1967
2010
  min?: number;
2011
+ isNonEmpty?: true;
1968
2012
  };
1969
- }>(this: T): Omit<T, "data"> & {
1970
- data: Omit<T["data"], "min"> & {
1971
- min: number;
2013
+ };
2014
+ declare type NonEmptyResult<T extends NonEmptyBase> = Omit<T, 'data'> & {
2015
+ data: Omit<T['data'], 'min'> & {
2016
+ min: 1;
2017
+ isNonEmpty: true;
1972
2018
  };
1973
2019
  };
2020
+ declare function nonEmpty<T extends NonEmptyBase>(this: T): NonEmptyResult<T>;
1974
2021
  declare type ArrayMethods$1 = typeof arrayMethods;
1975
2022
  declare const arrayMethods: {
1976
2023
  min: typeof min;
1977
2024
  max: typeof max;
1978
2025
  length: typeof length;
1979
- nonempty: typeof nonempty;
2026
+ nonEmpty: typeof nonEmpty;
1980
2027
  };
1981
2028
  declare type SetMethods = typeof setMethods;
1982
2029
  declare const setMethods: {
1983
2030
  min: typeof min;
1984
2031
  max: typeof max;
1985
2032
  size: typeof size;
1986
- nonempty: typeof nonempty;
2033
+ nonEmpty: typeof nonEmpty;
1987
2034
  };
1988
2035
  declare const numberTypeMethods: {
1989
2036
  lt<T extends {
@@ -2126,303 +2173,179 @@ declare const dateTypeMethods: {
2126
2173
  };
2127
2174
 
2128
2175
  declare type ArrayCardinality = 'many' | 'atLeastOne';
2129
- declare type arrayOutputType<T extends JSONTypeAny, Cardinality extends ArrayCardinality = 'many'> = Cardinality extends 'atLeastOne' ? [T['type'], ...T['type'][]] : T['type'][];
2130
- interface JSONArray<Type extends JSONTypeAny, Cardinality extends ArrayCardinality = 'many'> extends JSONType<arrayOutputType<Type, Cardinality>, 'array'>, ArrayMethods$1 {
2176
+ declare type ArrayOutputType<T extends JSONTypeAny, Cardinality extends ArrayCardinality = 'many'> = Cardinality extends 'atLeastOne' ? [T['type'], ...T['type'][]] : T['type'][];
2177
+ interface JSONArray<Type extends JSONTypeAny, Cardinality extends ArrayCardinality = 'many'> extends JSONType<ArrayOutputType<Type, Cardinality>, 'array'>, ArrayMethods$1 {
2131
2178
  data: JSONTypeData & {
2132
2179
  min?: number;
2133
2180
  max?: number;
2134
2181
  length?: number;
2135
2182
  };
2136
2183
  element: Type;
2137
- deepPartial(): JSONArray<DeepPartial<Type>, Cardinality>;
2138
- nonEmpty(this: JSONArray<Type>): JSONArray<Type, 'atLeastOne'> & {
2139
- data: {
2140
- min: 1;
2141
- };
2142
- };
2184
+ deepPartial<T extends JSONArray<Type>>(this: T): JSONArray<DeepPartial<Type>, Cardinality>;
2143
2185
  }
2144
2186
  declare const array: <Type extends JSONTypeAny>(element: Type) => JSONArray<Type, "many">;
2145
2187
 
2146
- declare type JSONTypeAny = JSONType<any, string>;
2147
- declare type DeepPartial<T extends JSONTypeAny> = ReturnType<JSONTypeAny['deepPartial']> extends ReturnType<T['deepPartial']> ? T : ReturnType<T['deepPartial']>;
2148
- declare type JSONTypeData = ColumnData & {
2149
- optional?: true;
2150
- nullable?: true;
2188
+ declare type JSONObjectShape = Record<string, JSONTypeAny>;
2189
+ declare type UnknownKeysParam = 'passthrough' | 'strict' | 'strip';
2190
+ declare type FullyPartial<T extends JSONObjectShape> = {
2191
+ [K in keyof T]: JSONOptional<T[K]>;
2151
2192
  };
2152
- declare type Primitive = string | number | bigint | boolean | null | undefined;
2153
- declare type JSONType<Type, DataType extends string = string> = {
2154
- type: Type;
2155
- data: JSONTypeData;
2156
- dataType: DataType;
2157
- chain: (['transform', (input: unknown, ctx: ValidationContext) => unknown] | ['to', (input: unknown) => JSONTypeAny | undefined, JSONTypeAny] | ['refine', (input: unknown) => unknown] | ['superRefine', (input: unknown, ctx: ValidationContext) => unknown])[];
2158
- optional<T extends JSONTypeAny>(this: T): JSONOptional<T>;
2159
- required<T extends JSONTypeAny>(this: T): JSONRequired<T>;
2160
- nullable<T extends JSONTypeAny>(this: T): JSONNullable<T>;
2161
- notNullable<T extends JSONTypeAny>(this: T): JSONNotNullable<T>;
2162
- nullish<T extends JSONTypeAny>(this: T): JSONNullish<T>;
2163
- notNullish<T extends JSONTypeAny>(this: T): JSONNotNullish<T>;
2164
- deepPartial(): JSONTypeAny;
2165
- transform<T extends JSONTypeAny, Transformed>(this: T, fn: (input: T['type'], ctx: ValidationContext) => Transformed): JSONType<Transformed extends PromiseLike<unknown> ? Awaited<Transformed> : Transformed, T['dataType']>;
2166
- to<T extends JSONTypeAny, ToType extends JSONTypeAny>(this: T, fn: (input: T['type']) => ToType['type'] | undefined, type: ToType): ToType;
2167
- refine<T extends JSONTypeAny, RefinedOutput extends T['type']>(this: T, check: (arg: T['type']) => unknown): T & {
2168
- type: RefinedOutput;
2193
+ declare type PartiallyPartial<T extends JSONObjectShape, P extends keyof T> = {
2194
+ [K in keyof T]: K extends P ? JSONOptional<T[K]> : T[K];
2195
+ };
2196
+ declare type identity<T> = T;
2197
+ declare type flatten<T extends object> = identity<{
2198
+ [k in keyof T]: T[k];
2199
+ }>;
2200
+ declare type optionalKeys<T extends object> = {
2201
+ [k in keyof T]: undefined extends T[k] ? k : never;
2202
+ }[keyof T];
2203
+ declare type requiredKeys<T extends object> = {
2204
+ [k in keyof T]: undefined extends T[k] ? never : k;
2205
+ }[keyof T];
2206
+ declare type addQuestionMarks<T extends object> = Partial<Pick<T, optionalKeys<T>>> & Pick<T, requiredKeys<T>>;
2207
+ declare type baseObjectOutputType<Shape extends JSONObjectShape> = flatten<addQuestionMarks<{
2208
+ [k in keyof Shape]: Shape[k]['type'];
2209
+ }>>;
2210
+ declare type ObjectOutputType<Shape extends JSONObjectShape, Catchall extends JSONTypeAny> = JSONTypeAny extends Catchall ? baseObjectOutputType<Shape> : flatten<baseObjectOutputType<Shape> & {
2211
+ [k: string]: Catchall['type'];
2212
+ }>;
2213
+ declare type IsEqual<T, U> = (<G>() => G extends T ? 1 : 2) extends <G>() => G extends U ? 1 : 2 ? true : false;
2214
+ declare type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : KeyType extends ExcludeType ? never : KeyType;
2215
+ declare type Except<ObjectType, KeysType extends keyof ObjectType> = {
2216
+ [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
2217
+ };
2218
+ declare type Merge<FirstType, SecondType> = Except<FirstType, Extract<keyof FirstType, keyof SecondType>> & SecondType;
2219
+ interface JSONObject<T extends JSONObjectShape, UnknownKeys extends UnknownKeysParam = 'strip', Catchall extends JSONTypeAny = JSONTypeAny, Output = ObjectOutputType<T, Catchall>> extends JSONType<Output, 'object'> {
2220
+ shape: T;
2221
+ unknownKeys: UnknownKeys;
2222
+ catchAllType: Catchall;
2223
+ extend<S extends JSONObjectShape>(shape: S): JSONObject<Merge<T, S>, UnknownKeys, Catchall>;
2224
+ merge<S extends JSONObjectShape, U extends UnknownKeysParam, C extends JSONTypeAny>(obj: JSONObject<S, U, C>): JSONObject<Merge<T, S>, U, C>;
2225
+ pick<K extends keyof T>(...arr: K[]): JSONObject<Pick<T, K>, UnknownKeys, Catchall>;
2226
+ omit<K extends keyof T>(...arr: K[]): JSONObject<Omit<T, K>, UnknownKeys, Catchall>;
2227
+ partial(): JSONObject<FullyPartial<T>, UnknownKeys, Catchall>;
2228
+ partial<P extends keyof T>(...arr: P[]): JSONObject<PartiallyPartial<T, P>, UnknownKeys, Catchall>;
2229
+ deepPartial(): JSONObject<{
2230
+ [k in keyof T]: JSONOptional<DeepPartial<T[k]>>;
2231
+ }, UnknownKeys, Catchall>;
2232
+ passthrough(): JSONObject<T, 'passthrough', Catchall>;
2233
+ strict(): JSONObject<T, 'strict', Catchall>;
2234
+ strip(): JSONObject<T, 'strip', Catchall>;
2235
+ catchAll<C extends JSONTypeAny>(type: C): JSONObject<T, UnknownKeys, C>;
2236
+ }
2237
+ declare const object: <T extends JSONObjectShape, UnknownKeys extends UnknownKeysParam = "strip", Catchall extends JSONTypeAny = JSONTypeAny>(shape: T) => JSONObject<T, UnknownKeys, Catchall, ObjectOutputType<T, Catchall>>;
2238
+
2239
+ interface JSONLiteral<T extends Primitive> extends JSONType<T, 'literal'> {
2240
+ value: Primitive;
2241
+ }
2242
+ declare const literal: <T extends Primitive>(value: T) => JSONLiteral<T>;
2243
+
2244
+ interface JSONDiscriminatedUnion<Discriminator extends string, DiscriminatorValue extends Primitive, Option extends JSONDiscriminatedObject<Discriminator, DiscriminatorValue>> extends JSONType<Option['type'], 'discriminatedUnion'> {
2245
+ discriminator: Discriminator;
2246
+ discriminatorValue: DiscriminatorValue;
2247
+ options: Map<DiscriminatorValue, Option>;
2248
+ _option: Option;
2249
+ }
2250
+ declare type JSONDiscriminatedObject<Discriminator extends string, DiscriminatorValue extends Primitive> = JSONObject<{
2251
+ [K in Discriminator]: JSONLiteral<DiscriminatorValue>;
2252
+ } & JSONObjectShape, any>;
2253
+ declare const discriminatedUnion: <Discriminator extends string, DiscriminatorValue extends Primitive, Types extends [JSONDiscriminatedObject<Discriminator, DiscriminatorValue>, JSONDiscriminatedObject<Discriminator, DiscriminatorValue>, ...JSONDiscriminatedObject<Discriminator, DiscriminatorValue>[]]>(discriminator: Discriminator, options: Types) => JSONDiscriminatedUnion<Discriminator, DiscriminatorValue, Types[number]>;
2254
+
2255
+ interface JSONEnum<U extends string = string, T extends [U, ...U[]] = [U]> extends JSONType<T[number], 'enum'> {
2256
+ enum: {
2257
+ [k in T[number]]: k;
2169
2258
  };
2170
- superRefine<T extends JSONTypeAny, RefinedOutput extends T['type']>(this: T, check: (arg: T['type'], ctx: ValidationContext) => unknown): T & {
2171
- type: RefinedOutput;
2259
+ options: T;
2260
+ }
2261
+ declare const arrayToEnum: <U extends string, T extends [U, ...U[]]>(items: T) => { [k in T[number]]: k; };
2262
+ declare const enumType: <U extends string, T extends [U, ...U[]]>(options: T) => JSONEnum<U, T>;
2263
+
2264
+ interface JSONInstanceOf<T extends Class> extends JSONType<T, 'instanceOf'> {
2265
+ class: T;
2266
+ }
2267
+ declare type Class = new (...args: any[]) => any;
2268
+ declare const instanceOf: <T extends Class>(cls: T) => JSONInstanceOf<T>;
2269
+
2270
+ interface JSONLazy<T extends JSONTypeAny> extends JSONType<T['type'], 'lazy'> {
2271
+ data: JSONTypeData & {
2272
+ isDeepPartial?: boolean;
2172
2273
  };
2173
- and<A extends JSONTypeAny, B extends JSONTypeAny>(this: A, type: B): JSONIntersection<A, B>;
2174
- or<T extends JSONTypeAny, U extends [JSONTypeAny, ...JSONTypeAny[]]>(this: T, ...types: U): T | U[number];
2175
- default<T extends JSONTypeAny>(this: T, value: T['type'] | (() => T['type'])): JSONNotNullish<T>;
2176
- array<T extends JSONTypeAny>(this: T): JSONArray<T>;
2177
- };
2178
- declare type BaseTypeProps<T extends JSONTypeAny> = Omit<JSONType<T['type'], string>, 'dataType'>;
2179
- declare type OwnTypeProps<T extends JSONTypeAny> = Omit<T, keyof BaseTypeProps<T>> & {
2180
- [k in keyof BaseTypeProps<T>]?: BaseTypeProps<T>[k];
2274
+ typeCache?: T;
2275
+ getter(): T;
2276
+ deepPartial(): JSONLazy<ReturnType<T['deepPartial']>>;
2277
+ }
2278
+ declare const lazy: <T extends JSONTypeAny>(fn: () => T) => JSONLazy<T>;
2279
+
2280
+ interface JSONMap<Key extends JSONTypeAny, Value extends JSONTypeAny> extends JSONType<Map<Key['type'], Value['type']>, 'map'> {
2281
+ data: JSONTypeData & {
2282
+ isDeepPartial?: boolean;
2283
+ };
2284
+ keyType: Key;
2285
+ valueType: Value;
2286
+ deepPartial(): JSONMap<ReturnType<Key['deepPartial']>, ReturnType<Value['deepPartial']>>;
2287
+ }
2288
+ declare const map: <Key extends JSONTypeAny, Value extends JSONTypeAny>(keyType: Key, valueType: Value) => JSONMap<Key, Value>;
2289
+
2290
+ interface JSONNativeEnum<T extends EnumLike> extends JSONType<T[keyof T], 'nativeEnum'> {
2291
+ dataType: 'nativeEnum';
2292
+ enum: T;
2293
+ options: (number | string)[];
2294
+ }
2295
+ declare type EnumLike = {
2296
+ [k: string]: string | number;
2297
+ [nu: number]: string;
2181
2298
  };
2182
- declare const constructType: <T extends JSONTypeAny>(type: OwnTypeProps<T>) => T;
2299
+ declare const getValidEnumValues: (obj: EnumLike) => (string | number)[];
2300
+ declare const nativeEnum: <T extends EnumLike>(givenEnum: T) => JSONNativeEnum<T>;
2183
2301
 
2184
- declare type ColumnsShape = Record<string, ColumnType>;
2185
- declare type ColumnShapeOutput<Shape extends ColumnsShape> = {
2186
- [K in keyof Shape]: ColumnOutput<Shape[K]>;
2302
+ declare type BaseNumberData = ColumnData & {
2303
+ lt?: number;
2304
+ lte?: number;
2305
+ gt?: number;
2306
+ gte?: number;
2307
+ multipleOf?: number;
2308
+ int?: boolean;
2187
2309
  };
2188
- declare type OptionalColumnsForInput<Shape extends ColumnsShape> = {
2189
- [K in keyof Shape]: SomeIsTrue<[
2190
- Shape[K]['isNullable'],
2191
- Shape[K]['hasDefault']
2192
- ]> extends true ? K : never;
2193
- }[keyof Shape];
2194
- declare type ColumnShapeInput<Shape extends ColumnsShape> = SetOptional<{
2195
- [K in keyof Shape]: ColumnInput<Shape[K]>;
2196
- }, OptionalColumnsForInput<Shape>>;
2197
- declare class ColumnsObject<Shape extends ColumnsShape> extends ColumnType<{
2198
- [K in keyof Shape]: Shape[K]['type'];
2199
- }, typeof Operators.any> {
2200
- shape: Shape;
2201
- dataType: string;
2310
+ declare type NumberColumn = ColumnType<number>;
2311
+ declare type NumberColumnData = BaseNumberData;
2312
+ declare type NumberMethods = typeof numberTypeMethods;
2313
+ interface NumberBaseColumn extends ColumnType<number, typeof Operators.number>, NumberMethods {
2314
+ }
2315
+ declare abstract class NumberBaseColumn extends ColumnType<number, typeof Operators.number> {
2316
+ data: BaseNumberData;
2202
2317
  operators: {
2203
- equals: ((key: string, value: any, values: unknown[]) => string) & {
2204
- type: any;
2318
+ lt: ((key: string, value: number | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, values: unknown[]) => string) & {
2319
+ type: number | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
2205
2320
  };
2206
- not: ((key: string, value: any, values: unknown[]) => string) & {
2207
- type: any;
2321
+ lte: ((key: string, value: number | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, values: unknown[]) => string) & {
2322
+ type: number | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
2208
2323
  };
2209
- in: ((key: string, value: any[] | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, values: unknown[]) => string) & {
2210
- type: any[] | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
2324
+ gt: ((key: string, value: number | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, values: unknown[]) => string) & {
2325
+ type: number | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
2211
2326
  };
2212
- notIn: ((key: string, value: any[] | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, values: unknown[]) => string) & {
2213
- type: any[] | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
2327
+ gte: ((key: string, value: number | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, values: unknown[]) => string) & {
2328
+ type: number | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
2214
2329
  };
2215
- };
2216
- constructor(shape: Shape);
2217
- }
2218
- declare class ArrayOfColumnsObjects<Shape extends ColumnsShape> extends ColumnType<{
2219
- [K in keyof Shape]: Shape[K]['type'];
2220
- }[], typeof Operators.any> {
2221
- shape: Shape;
2222
- dataType: string;
2223
- operators: {
2224
- equals: ((key: string, value: any, values: unknown[]) => string) & {
2225
- type: any;
2330
+ between: ((key: string, value: [number | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, number | Query | RawExpression<ColumnType<unknown, Operators, unknown>>], values: unknown[]) => string) & {
2331
+ type: [number | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, number | Query | RawExpression<ColumnType<unknown, Operators, unknown>>];
2226
2332
  };
2227
- not: ((key: string, value: any, values: unknown[]) => string) & {
2228
- type: any;
2333
+ equals: ((key: string, value: number | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, values: unknown[]) => string) & {
2334
+ type: number | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
2229
2335
  };
2230
- in: ((key: string, value: any[] | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, values: unknown[]) => string) & {
2231
- type: any[] | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
2336
+ not: ((key: string, value: number | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, values: unknown[]) => string) & {
2337
+ type: number | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
2232
2338
  };
2233
- notIn: ((key: string, value: any[] | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, values: unknown[]) => string) & {
2234
- type: any[] | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
2339
+ in: ((key: string, value: Query | RawExpression<ColumnType<unknown, Operators, unknown>> | number[], values: unknown[]) => string) & {
2340
+ type: Query | RawExpression<ColumnType<unknown, Operators, unknown>> | number[];
2341
+ };
2342
+ notIn: ((key: string, value: Query | RawExpression<ColumnType<unknown, Operators, unknown>> | number[], values: unknown[]) => string) & {
2343
+ type: Query | RawExpression<ColumnType<unknown, Operators, unknown>> | number[];
2235
2344
  };
2236
2345
  };
2237
- constructor(shape: Shape);
2238
2346
  }
2239
- declare abstract class PluckResultColumnType<C extends ColumnType> extends ColumnType<C['type'][], typeof Operators.any> {
2240
- }
2241
- declare type SinglePrimaryKey<Shape extends ColumnsShape> = StringKey<{
2242
- [K in keyof Shape]: Shape[K]['isPrimaryKey'] extends true ? [
2243
- {
2244
- [S in keyof Shape]: Shape[S]['isPrimaryKey'] extends true ? S extends K ? never : S : never;
2245
- }[keyof Shape]
2246
- ] extends [never] ? K : never : never;
2247
- }[keyof Shape]>;
2248
-
2249
- declare type ColumnOutput<T extends ColumnType> = T['type'];
2250
- declare type ColumnInput<T extends ColumnType> = T['inputType'];
2251
- declare type NullableColumn<T extends ColumnType> = Omit<T, 'type' | 'inputType' | 'operators'> & {
2252
- type: T['type'] | null;
2253
- inputType: T['inputType'] | null;
2254
- isNullable: true;
2255
- operators: Omit<T['operators'], 'equals' | 'not'> & {
2256
- equals: Operator<T['type'] | null>;
2257
- not: Operator<T['type'] | null>;
2258
- };
2259
- };
2260
- declare type AnyColumnType = ColumnType<any, Record<string, Operator<any>>>;
2261
- declare type AnyColumnTypeCreator = (...args: any[]) => AnyColumnType | {};
2262
- declare type ColumnTypesBase = Record<string, AnyColumnTypeCreator>;
2263
- declare type ValidationContext = any;
2264
- declare type ColumnData = {
2265
- default?: unknown;
2266
- validationDefault?: unknown;
2267
- index?: Omit<SingleColumnIndexOptions, 'column'>;
2268
- comment?: string;
2269
- collate?: string;
2270
- compression?: string;
2271
- foreignKey?: ForeignKey<string, string[]>;
2272
- modifyQuery?: (q: Query) => void;
2273
- as?: ColumnType;
2274
- };
2275
- declare type ForeignKeyMatch = 'FULL' | 'PARTIAL' | 'SIMPLE';
2276
- declare type ForeignKeyAction = 'NO ACTION' | 'RESTRICT' | 'CASCADE' | 'SET NULL' | 'SET DEFAULT';
2277
- declare type ForeignKey<Table extends string, Columns extends string[]> = ({
2278
- fn(): new () => {
2279
- table: Table;
2280
- };
2281
- } | {
2282
- table: Table;
2283
- }) & {
2284
- columns: Columns;
2285
- } & ForeignKeyOptions;
2286
- declare type DropMode = 'CASCADE' | 'RESTRICT';
2287
- declare type ForeignKeyOptions = {
2288
- name?: string;
2289
- match?: ForeignKeyMatch;
2290
- onUpdate?: ForeignKeyAction;
2291
- onDelete?: ForeignKeyAction;
2292
- dropMode?: DropMode;
2293
- };
2294
- declare type IndexColumnOptions = {
2295
- column: string;
2296
- expression?: number | string;
2297
- collate?: string;
2298
- operator?: string;
2299
- order?: string;
2300
- };
2301
- declare type IndexOptions = {
2302
- name?: string;
2303
- unique?: boolean;
2304
- using?: string;
2305
- include?: MaybeArray<string>;
2306
- with?: string;
2307
- tablespace?: string;
2308
- where?: string;
2309
- dropMode?: 'CASCADE' | 'RESTRICT';
2310
- };
2311
- declare type SingleColumnIndexOptions = IndexColumnOptions & IndexOptions;
2312
- declare type ForeignKeyModel = new () => {
2313
- table: string;
2314
- };
2315
- declare type ForeignKeyModelWithColumns = new () => {
2316
- table: string;
2317
- columns: {
2318
- shape: ColumnsShape;
2319
- };
2320
- };
2321
- declare type ColumnNameOfModel<Model extends ForeignKeyModelWithColumns> = StringKey<keyof InstanceType<Model>['columns']['shape']>;
2322
- declare abstract class ColumnType<Type = unknown, Ops extends Operators = Operators, InputType = Type> {
2323
- abstract dataType: string;
2324
- abstract operators: Ops;
2325
- type: Type;
2326
- inputType: InputType;
2327
- data: ColumnData;
2328
- isPrimaryKey: boolean;
2329
- isHidden: boolean;
2330
- isNullable: boolean;
2331
- hasDefault: boolean;
2332
- encodeFn?: (input: any) => unknown;
2333
- parseFn?: (input: unknown) => unknown;
2334
- parseItem?: (input: string) => unknown;
2335
- chain: (["transform", (input: unknown, ctx: ValidationContext) => unknown] | ["to", (input: unknown) => JSONTypeAny | undefined, JSONTypeAny] | ["refine", (input: unknown) => unknown] | ["superRefine", (input: unknown, ctx: ValidationContext) => unknown])[];
2336
- primaryKey<T extends ColumnType>(this: T): T & {
2337
- isPrimaryKey: true;
2338
- };
2339
- foreignKey<T extends ColumnType, Model extends ForeignKeyModelWithColumns, Column extends ColumnNameOfModel<Model>>(this: T, fn: () => Model, column: Column, options?: ForeignKeyOptions): Omit<T, 'foreignKeyData'> & {
2340
- foreignKeyData: ForeignKey<InstanceType<Model>['table'], [Column]>;
2341
- };
2342
- foreignKey<T extends ColumnType, Table extends string, Column extends string>(this: T, table: Table, column: Column, options?: ForeignKeyOptions): Omit<T, 'foreignKeyData'> & {
2343
- foreignKeyData: ForeignKey<Table, [Column]>;
2344
- };
2345
- hidden<T extends ColumnType>(this: T): T & {
2346
- isHidden: true;
2347
- };
2348
- nullable<T extends ColumnType>(this: T): NullableColumn<T>;
2349
- encode<T extends ColumnType, Input>(this: T, fn: (input: Input) => unknown): Omit<T, 'inputType'> & {
2350
- inputType: Input;
2351
- };
2352
- parse<T extends ColumnType, Output>(this: T, fn: (input: T['type']) => Output): Omit<T, 'type'> & {
2353
- type: Output;
2354
- };
2355
- as<T extends ColumnType, C extends ColumnType<T['type'], Operators, T['inputType']>>(this: T, column: C): C;
2356
- toSQL(): string;
2357
- default<T extends ColumnType>(this: T, value: T['type'] | RawExpression): T & {
2358
- hasDefault: true;
2359
- };
2360
- index<T extends ColumnType>(this: T, options?: Omit<SingleColumnIndexOptions, 'column'>): T;
2361
- unique<T extends ColumnType>(this: T, options?: Omit<SingleColumnIndexOptions, 'column' | 'unique'>): T;
2362
- comment<T extends ColumnType>(this: T, comment: string): T;
2363
- validationDefault<T extends ColumnType>(this: T, value: T['type']): T;
2364
- compression<T extends ColumnType>(this: T, compression: string): T;
2365
- collate<T extends ColumnType>(this: T, collate: string): T;
2366
- modifyQuery<T extends ColumnType>(this: T, cb: (q: Query) => void): T;
2367
- transform<T extends ColumnType, Transformed>(this: T, fn: (input: T['type'], ctx: ValidationContext) => Transformed): Omit<T, 'type'> & {
2368
- type: Transformed;
2369
- };
2370
- to<T extends ColumnType, ToType extends ColumnType>(this: T, fn: (input: T['type']) => ToType['type'] | undefined, type: ToType): ToType;
2371
- refine<T extends ColumnType, RefinedOutput extends T['type']>(this: T, check: (arg: T['type']) => unknown): T & {
2372
- type: RefinedOutput;
2373
- };
2374
- superRefine<T extends ColumnType, RefinedOutput extends T['type']>(this: T, check: (arg: T['type'], ctx: ValidationContext) => unknown): T & {
2375
- type: RefinedOutput;
2376
- };
2377
- }
2378
-
2379
- declare type BaseNumberData = ColumnData & {
2380
- lt?: number;
2381
- lte?: number;
2382
- gt?: number;
2383
- gte?: number;
2384
- multipleOf?: number;
2385
- int?: boolean;
2386
- };
2387
- declare type NumberColumn = ColumnType<number>;
2388
- declare type NumberColumnData = BaseNumberData;
2389
- declare type NumberMethods = typeof numberTypeMethods;
2390
- interface NumberBaseColumn extends ColumnType<number, typeof Operators.number>, NumberMethods {
2391
- }
2392
- declare abstract class NumberBaseColumn extends ColumnType<number, typeof Operators.number> {
2393
- data: BaseNumberData;
2394
- operators: {
2395
- lt: ((key: string, value: number | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, values: unknown[]) => string) & {
2396
- type: number | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
2397
- };
2398
- lte: ((key: string, value: number | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, values: unknown[]) => string) & {
2399
- type: number | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
2400
- };
2401
- gt: ((key: string, value: number | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, values: unknown[]) => string) & {
2402
- type: number | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
2403
- };
2404
- gte: ((key: string, value: number | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, values: unknown[]) => string) & {
2405
- type: number | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
2406
- };
2407
- between: ((key: string, value: [number | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, number | Query | RawExpression<ColumnType<unknown, Operators, unknown>>], values: unknown[]) => string) & {
2408
- type: [number | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, number | Query | RawExpression<ColumnType<unknown, Operators, unknown>>];
2409
- };
2410
- equals: ((key: string, value: number | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, values: unknown[]) => string) & {
2411
- type: number | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
2412
- };
2413
- not: ((key: string, value: number | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, values: unknown[]) => string) & {
2414
- type: number | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
2415
- };
2416
- in: ((key: string, value: Query | RawExpression<ColumnType<unknown, Operators, unknown>> | number[], values: unknown[]) => string) & {
2417
- type: Query | RawExpression<ColumnType<unknown, Operators, unknown>> | number[];
2418
- };
2419
- notIn: ((key: string, value: Query | RawExpression<ColumnType<unknown, Operators, unknown>> | number[], values: unknown[]) => string) & {
2420
- type: Query | RawExpression<ColumnType<unknown, Operators, unknown>> | number[];
2421
- };
2422
- };
2423
- }
2424
- declare abstract class IntegerBaseColumn extends NumberBaseColumn {
2425
- data: BaseNumberData;
2347
+ declare abstract class IntegerBaseColumn extends NumberBaseColumn {
2348
+ data: BaseNumberData;
2426
2349
  }
2427
2350
  declare abstract class NumberAsStringBaseColumn extends ColumnType<string, typeof Operators.number> {
2428
2351
  data: {};
@@ -2496,41 +2419,50 @@ declare class DecimalBaseColumn<Precision extends number | undefined = undefined
2496
2419
  };
2497
2420
  dataType: "decimal";
2498
2421
  constructor(precision?: Precision, scale?: Scale);
2422
+ toCode(t: string): Code;
2499
2423
  toSQL(): string;
2500
2424
  }
2501
2425
  declare class SmallIntColumn extends IntegerBaseColumn {
2502
2426
  dataType: "smallint";
2503
2427
  parseItem: typeof parseInt;
2428
+ toCode(t: string): Code;
2504
2429
  }
2505
2430
  declare class IntegerColumn extends IntegerBaseColumn {
2506
2431
  dataType: "integer";
2507
2432
  parseItem: typeof parseInt;
2433
+ toCode(t: string): Code;
2508
2434
  }
2509
2435
  declare class BigIntColumn extends NumberAsStringBaseColumn {
2510
2436
  dataType: "bigint";
2437
+ toCode(t: string): Code;
2511
2438
  }
2512
2439
  declare class DecimalColumn<Precision extends number | undefined = undefined, Scale extends number | undefined = undefined> extends DecimalBaseColumn<Precision, Scale> {
2513
2440
  }
2514
2441
  declare class RealColumn extends NumberBaseColumn {
2515
2442
  dataType: "real";
2516
2443
  parseItem: typeof parseFloat;
2444
+ toCode(t: string): Code;
2517
2445
  }
2518
2446
  declare class DoublePrecisionColumn extends NumberAsStringBaseColumn {
2519
2447
  dataType: "double precision";
2448
+ toCode(t: string): Code;
2520
2449
  }
2521
2450
  declare class SmallSerialColumn extends IntegerBaseColumn {
2522
2451
  dataType: "smallserial";
2523
2452
  parseItem: typeof parseInt;
2524
2453
  hasDefault: true;
2454
+ toCode(t: string): Code;
2525
2455
  }
2526
2456
  declare class SerialColumn extends IntegerBaseColumn {
2527
2457
  dataType: "serial";
2528
2458
  parseItem: typeof parseInt;
2529
2459
  hasDefault: true;
2460
+ toCode(t: string): Code;
2530
2461
  }
2531
2462
  declare class BigSerialColumn extends NumberAsStringBaseColumn {
2532
2463
  dataType: "bigserial";
2533
2464
  hasDefault: true;
2465
+ toCode(t: string): Code;
2534
2466
  }
2535
2467
 
2536
2468
  declare type BaseStringData = ColumnData & {
@@ -2545,6 +2477,7 @@ declare type BaseStringData = ColumnData & {
2545
2477
  startsWith?: string;
2546
2478
  endsWith?: string;
2547
2479
  trim?: boolean;
2480
+ isNonEmpty?: true;
2548
2481
  };
2549
2482
  declare type StringColumn = ColumnType<string>;
2550
2483
  declare type TextColumnData = BaseStringData;
@@ -2649,15 +2582,7 @@ declare const textMethods: {
2649
2582
  length: Value_5;
2650
2583
  };
2651
2584
  };
2652
- nonempty: <T_11 extends {
2653
- data: {
2654
- min?: number | undefined;
2655
- };
2656
- }>(this: T_11) => Omit<T_11, "data"> & {
2657
- data: Omit<T_11["data"], "min"> & {
2658
- min: number;
2659
- };
2660
- };
2585
+ nonEmpty: <T_11 extends NonEmptyBase>(this: T_11) => NonEmptyResult<T_11>;
2661
2586
  };
2662
2587
  interface TextBaseColumn extends ColumnType<string, typeof Operators.text>, TextMethods {
2663
2588
  }
@@ -2698,16 +2623,18 @@ declare abstract class TextBaseColumn extends ColumnType<string, typeof Operator
2698
2623
  }
2699
2624
  declare abstract class LimitedTextBaseColumn<Limit extends number | undefined = undefined> extends TextBaseColumn {
2700
2625
  data: TextColumnData & {
2701
- max: Limit;
2626
+ arg: Limit;
2702
2627
  };
2703
2628
  constructor(limit?: Limit);
2704
2629
  toSQL(): string;
2705
2630
  }
2706
2631
  declare class VarCharColumn<Limit extends number | undefined = undefined> extends LimitedTextBaseColumn<Limit> {
2707
2632
  dataType: "varchar";
2633
+ toCode(t: string): Code;
2708
2634
  }
2709
2635
  declare class CharColumn<Limit extends number | undefined = undefined> extends LimitedTextBaseColumn<Limit> {
2710
2636
  dataType: "char";
2637
+ toCode(t: string): Code;
2711
2638
  }
2712
2639
  declare class TextColumn extends TextBaseColumn {
2713
2640
  dataType: "text";
@@ -2743,6 +2670,7 @@ declare class TextColumn extends TextBaseColumn {
2743
2670
  type: Query | RawExpression<ColumnType<unknown, Operators, unknown>> | string[];
2744
2671
  };
2745
2672
  };
2673
+ toCode(t: string): Code;
2746
2674
  }
2747
2675
  declare class ByteaColumn extends ColumnType<Buffer, typeof Operators.text> {
2748
2676
  dataType: "bytea";
@@ -2778,6 +2706,7 @@ declare class ByteaColumn extends ColumnType<Buffer, typeof Operators.text> {
2778
2706
  type: Query | RawExpression<ColumnType<unknown, Operators, unknown>> | string[];
2779
2707
  };
2780
2708
  };
2709
+ toCode(t: string): Code;
2781
2710
  }
2782
2711
  declare class PointColumn extends ColumnType<string, typeof Operators.text> {
2783
2712
  dataType: "point";
@@ -2813,9 +2742,10 @@ declare class PointColumn extends ColumnType<string, typeof Operators.text> {
2813
2742
  type: Query | RawExpression<ColumnType<unknown, Operators, unknown>> | string[];
2814
2743
  };
2815
2744
  };
2745
+ toCode(t: string): Code;
2816
2746
  }
2817
2747
  declare class LineColumn extends ColumnType<string, typeof Operators.text> {
2818
- dataType: "point";
2748
+ dataType: "line";
2819
2749
  operators: {
2820
2750
  contains: ((key: string, value: string | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, values: unknown[]) => string) & {
2821
2751
  type: string | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
@@ -2848,9 +2778,10 @@ declare class LineColumn extends ColumnType<string, typeof Operators.text> {
2848
2778
  type: Query | RawExpression<ColumnType<unknown, Operators, unknown>> | string[];
2849
2779
  };
2850
2780
  };
2781
+ toCode(t: string): Code;
2851
2782
  }
2852
2783
  declare class LsegColumn extends ColumnType<string, typeof Operators.text> {
2853
- dataType: "point";
2784
+ dataType: "lseg";
2854
2785
  operators: {
2855
2786
  contains: ((key: string, value: string | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, values: unknown[]) => string) & {
2856
2787
  type: string | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
@@ -2883,9 +2814,10 @@ declare class LsegColumn extends ColumnType<string, typeof Operators.text> {
2883
2814
  type: Query | RawExpression<ColumnType<unknown, Operators, unknown>> | string[];
2884
2815
  };
2885
2816
  };
2817
+ toCode(t: string): Code;
2886
2818
  }
2887
2819
  declare class BoxColumn extends ColumnType<string, typeof Operators.text> {
2888
- dataType: "point";
2820
+ dataType: "box";
2889
2821
  operators: {
2890
2822
  contains: ((key: string, value: string | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, values: unknown[]) => string) & {
2891
2823
  type: string | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
@@ -2918,9 +2850,10 @@ declare class BoxColumn extends ColumnType<string, typeof Operators.text> {
2918
2850
  type: Query | RawExpression<ColumnType<unknown, Operators, unknown>> | string[];
2919
2851
  };
2920
2852
  };
2853
+ toCode(t: string): Code;
2921
2854
  }
2922
2855
  declare class PathColumn extends ColumnType<string, typeof Operators.text> {
2923
- dataType: "point";
2856
+ dataType: "path";
2924
2857
  operators: {
2925
2858
  contains: ((key: string, value: string | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, values: unknown[]) => string) & {
2926
2859
  type: string | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
@@ -2953,9 +2886,10 @@ declare class PathColumn extends ColumnType<string, typeof Operators.text> {
2953
2886
  type: Query | RawExpression<ColumnType<unknown, Operators, unknown>> | string[];
2954
2887
  };
2955
2888
  };
2889
+ toCode(t: string): Code;
2956
2890
  }
2957
2891
  declare class PolygonColumn extends ColumnType<string, typeof Operators.text> {
2958
- dataType: "point";
2892
+ dataType: "polygon";
2959
2893
  operators: {
2960
2894
  contains: ((key: string, value: string | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, values: unknown[]) => string) & {
2961
2895
  type: string | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
@@ -2988,9 +2922,10 @@ declare class PolygonColumn extends ColumnType<string, typeof Operators.text> {
2988
2922
  type: Query | RawExpression<ColumnType<unknown, Operators, unknown>> | string[];
2989
2923
  };
2990
2924
  };
2925
+ toCode(t: string): Code;
2991
2926
  }
2992
2927
  declare class CircleColumn extends ColumnType<string, typeof Operators.text> {
2993
- dataType: "point";
2928
+ dataType: "circle";
2994
2929
  operators: {
2995
2930
  contains: ((key: string, value: string | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, values: unknown[]) => string) & {
2996
2931
  type: string | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
@@ -3023,10 +2958,14 @@ declare class CircleColumn extends ColumnType<string, typeof Operators.text> {
3023
2958
  type: Query | RawExpression<ColumnType<unknown, Operators, unknown>> | string[];
3024
2959
  };
3025
2960
  };
2961
+ toCode(t: string): Code;
3026
2962
  }
3027
2963
  declare class MoneyColumn extends NumberBaseColumn {
3028
2964
  dataType: "money";
3029
- parseFn: (input: unknown) => number;
2965
+ toCode(t: string): Code;
2966
+ parseFn: ((input: unknown) => number) & {
2967
+ hideFromCode: boolean;
2968
+ };
3030
2969
  }
3031
2970
  declare class CidrColumn extends ColumnType<string, typeof Operators.text> {
3032
2971
  dataType: "cidr";
@@ -3062,6 +3001,7 @@ declare class CidrColumn extends ColumnType<string, typeof Operators.text> {
3062
3001
  type: Query | RawExpression<ColumnType<unknown, Operators, unknown>> | string[];
3063
3002
  };
3064
3003
  };
3004
+ toCode(t: string): Code;
3065
3005
  }
3066
3006
  declare class InetColumn extends ColumnType<string, typeof Operators.text> {
3067
3007
  dataType: "inet";
@@ -3097,6 +3037,7 @@ declare class InetColumn extends ColumnType<string, typeof Operators.text> {
3097
3037
  type: Query | RawExpression<ColumnType<unknown, Operators, unknown>> | string[];
3098
3038
  };
3099
3039
  };
3040
+ toCode(t: string): Code;
3100
3041
  }
3101
3042
  declare class MacAddrColumn extends ColumnType<string, typeof Operators.text> {
3102
3043
  dataType: "macaddr";
@@ -3132,6 +3073,7 @@ declare class MacAddrColumn extends ColumnType<string, typeof Operators.text> {
3132
3073
  type: Query | RawExpression<ColumnType<unknown, Operators, unknown>> | string[];
3133
3074
  };
3134
3075
  };
3076
+ toCode(t: string): Code;
3135
3077
  }
3136
3078
  declare class MacAddr8Column extends ColumnType<string, typeof Operators.text> {
3137
3079
  dataType: "macaddr8";
@@ -3167,6 +3109,7 @@ declare class MacAddr8Column extends ColumnType<string, typeof Operators.text> {
3167
3109
  type: Query | RawExpression<ColumnType<unknown, Operators, unknown>> | string[];
3168
3110
  };
3169
3111
  };
3112
+ toCode(t: string): Code;
3170
3113
  }
3171
3114
  declare class BitColumn<Length extends number> extends ColumnType<string, typeof Operators.text> {
3172
3115
  dataType: "bit";
@@ -3206,6 +3149,7 @@ declare class BitColumn<Length extends number> extends ColumnType<string, typeof
3206
3149
  length: Length;
3207
3150
  };
3208
3151
  constructor(length: Length);
3152
+ toCode(t: string): Code;
3209
3153
  toSQL(): string;
3210
3154
  }
3211
3155
  declare class BitVaryingColumn<Length extends number | undefined = undefined> extends ColumnType<string, typeof Operators.text> {
@@ -3245,7 +3189,8 @@ declare class BitVaryingColumn<Length extends number | undefined = undefined> ex
3245
3189
  data: ColumnData & {
3246
3190
  length: Length;
3247
3191
  };
3248
- constructor(length: Length);
3192
+ constructor(length?: Length);
3193
+ toCode(t: string): Code;
3249
3194
  toSQL(): string;
3250
3195
  }
3251
3196
  declare class TsVectorColumn extends ColumnType<string, typeof Operators.text> {
@@ -3282,6 +3227,7 @@ declare class TsVectorColumn extends ColumnType<string, typeof Operators.text> {
3282
3227
  type: Query | RawExpression<ColumnType<unknown, Operators, unknown>> | string[];
3283
3228
  };
3284
3229
  };
3230
+ toCode(t: string): Code;
3285
3231
  }
3286
3232
  declare class TsQueryColumn extends ColumnType<string, typeof Operators.text> {
3287
3233
  dataType: "tsquery";
@@ -3317,6 +3263,7 @@ declare class TsQueryColumn extends ColumnType<string, typeof Operators.text> {
3317
3263
  type: Query | RawExpression<ColumnType<unknown, Operators, unknown>> | string[];
3318
3264
  };
3319
3265
  };
3266
+ toCode(t: string): Code;
3320
3267
  }
3321
3268
  declare class UUIDColumn extends ColumnType<string, typeof Operators.text> {
3322
3269
  dataType: "uuid";
@@ -3352,6 +3299,7 @@ declare class UUIDColumn extends ColumnType<string, typeof Operators.text> {
3352
3299
  type: Query | RawExpression<ColumnType<unknown, Operators, unknown>> | string[];
3353
3300
  };
3354
3301
  };
3302
+ toCode(t: string): Code;
3355
3303
  }
3356
3304
  declare class XMLColumn extends ColumnType<string, typeof Operators.text> {
3357
3305
  dataType: "xml";
@@ -3387,6 +3335,7 @@ declare class XMLColumn extends ColumnType<string, typeof Operators.text> {
3387
3335
  type: Query | RawExpression<ColumnType<unknown, Operators, unknown>> | string[];
3388
3336
  };
3389
3337
  };
3338
+ toCode(t: string): Code;
3390
3339
  }
3391
3340
 
3392
3341
  declare type DateColumnData = ColumnData & {
@@ -3434,6 +3383,7 @@ declare abstract class DateBaseColumn extends ColumnType<string, typeof Operator
3434
3383
  }
3435
3384
  declare class DateColumn extends DateBaseColumn {
3436
3385
  dataType: "date";
3386
+ toCode(t: string): Code;
3437
3387
  }
3438
3388
  declare type DateTimeColumnData = DateColumnData & {
3439
3389
  precision?: number;
@@ -3451,17 +3401,21 @@ declare abstract class DateTimeWithTimeZoneBaseClass<Precision extends number |
3451
3401
  }
3452
3402
  declare class TimestampColumn<Precision extends number | undefined = undefined> extends DateTimeBaseClass<Precision> {
3453
3403
  dataType: "timestamp";
3404
+ toCode(t: string): Code;
3454
3405
  }
3455
3406
  declare class TimestampWithTimeZoneColumn<Precision extends number | undefined = undefined> extends DateTimeWithTimeZoneBaseClass<Precision> {
3456
3407
  dataType: "timestamp with time zone";
3457
3408
  baseDataType: "timestamp";
3409
+ toCode(t: string): Code;
3458
3410
  }
3459
3411
  declare class TimeColumn<Precision extends number | undefined = undefined> extends DateTimeBaseClass<Precision> {
3460
3412
  dataType: "time";
3413
+ toCode(t: string): Code;
3461
3414
  }
3462
3415
  declare class TimeWithTimeZoneColumn<Precision extends number | undefined = undefined> extends DateTimeWithTimeZoneBaseClass<Precision> {
3463
3416
  dataType: "time with time zone";
3464
3417
  baseDataType: "time";
3418
+ toCode(t: string): Code;
3465
3419
  }
3466
3420
  declare type TimeInterval = {
3467
3421
  years?: number;
@@ -3473,7 +3427,7 @@ declare type TimeInterval = {
3473
3427
  };
3474
3428
  declare class IntervalColumn<Fields extends string | undefined = undefined, Precision extends number | undefined = undefined> extends ColumnType<TimeInterval, typeof Operators.date> {
3475
3429
  dataType: "interval";
3476
- data: DateTimeColumnData & {
3430
+ data: ColumnData & {
3477
3431
  fields: Fields;
3478
3432
  precision: Precision;
3479
3433
  };
@@ -3507,199 +3461,52 @@ declare class IntervalColumn<Fields extends string | undefined = undefined, Prec
3507
3461
  };
3508
3462
  };
3509
3463
  constructor(fields?: Fields, precision?: Precision);
3464
+ toCode(t: string): Code;
3510
3465
  toSQL(): string;
3511
3466
  }
3512
3467
 
3513
- declare class BooleanColumn extends ColumnType<boolean, typeof Operators.boolean> {
3514
- dataType: "boolean";
3515
- operators: {
3516
- equals: ((key: string, value: boolean | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, values: unknown[]) => string) & {
3517
- type: boolean | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
3468
+ declare type JSONAny = JSONTypeAny & {
3469
+ dataType: 'any';
3470
+ };
3471
+ declare type JSONBigInt = JSONType<bigint, 'bigint'> & {
3472
+ data: BaseNumberData;
3473
+ } & typeof bigIntMethods;
3474
+ declare const bigIntMethods: {
3475
+ toCode(this: JSONTypeAny, t: string): Code;
3476
+ lt<T extends {
3477
+ data: {
3478
+ lt?: number | undefined;
3518
3479
  };
3519
- not: ((key: string, value: boolean | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, values: unknown[]) => string) & {
3520
- type: boolean | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
3480
+ }, Value extends number>(this: T, value: Value): Omit<T, "data"> & {
3481
+ data: Omit<T["data"], "lt"> & {
3482
+ lt: Value;
3521
3483
  };
3522
- in: ((key: string, value: Query | RawExpression<ColumnType<unknown, Operators, unknown>> | boolean[], values: unknown[]) => string) & {
3523
- type: Query | RawExpression<ColumnType<unknown, Operators, unknown>> | boolean[];
3484
+ };
3485
+ lte<T_1 extends {
3486
+ data: {
3487
+ lte?: number | undefined;
3524
3488
  };
3525
- notIn: ((key: string, value: Query | RawExpression<ColumnType<unknown, Operators, unknown>> | boolean[], values: unknown[]) => string) & {
3526
- type: Query | RawExpression<ColumnType<unknown, Operators, unknown>> | boolean[];
3489
+ }, Value_1 extends number>(this: T_1, value: Value_1): Omit<T_1, "data"> & {
3490
+ data: Omit<T_1["data"], "lte"> & {
3491
+ lte: Value_1;
3527
3492
  };
3528
3493
  };
3529
- parseItem: (input: string) => boolean;
3530
- }
3531
-
3532
- declare class EnumColumn<U extends string = string, T extends [U, ...U[]] = [U]> extends ColumnType<T[number], typeof Operators.any> {
3533
- enumName: string;
3534
- options: T;
3535
- operators: {
3536
- equals: ((key: string, value: any, values: unknown[]) => string) & {
3537
- type: any;
3494
+ max<T_2 extends {
3495
+ data: {
3496
+ lte?: number | undefined;
3538
3497
  };
3539
- not: ((key: string, value: any, values: unknown[]) => string) & {
3540
- type: any;
3498
+ }, Value_2 extends number>(this: T_2, value: Value_2): Omit<T_2, "data"> & {
3499
+ data: Omit<T_2["data"], "lte"> & {
3500
+ lte: Value_2;
3541
3501
  };
3542
- in: ((key: string, value: any[] | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, values: unknown[]) => string) & {
3543
- type: any[] | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
3502
+ };
3503
+ gt<T_3 extends {
3504
+ data: {
3505
+ gt?: number | undefined;
3544
3506
  };
3545
- notIn: ((key: string, value: any[] | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, values: unknown[]) => string) & {
3546
- type: any[] | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
3547
- };
3548
- };
3549
- dataType: string;
3550
- constructor(enumName: string, options: T);
3551
- toSql(): string;
3552
- }
3553
-
3554
- declare type JSONObjectShape = Record<string, JSONTypeAny>;
3555
- declare type UnknownKeysParam = 'passthrough' | 'strict' | 'strip';
3556
- declare type FullyPartial<T extends JSONObjectShape> = {
3557
- [K in keyof T]: JSONOptional<T[K]>;
3558
- };
3559
- declare type PartiallyPartial<T extends JSONObjectShape, P extends keyof T> = {
3560
- [K in keyof T]: K extends P ? JSONOptional<T[K]> : T[K];
3561
- };
3562
- declare type identity<T> = T;
3563
- declare type flatten<T extends object> = identity<{
3564
- [k in keyof T]: T[k];
3565
- }>;
3566
- declare type optionalKeys<T extends object> = {
3567
- [k in keyof T]: undefined extends T[k] ? k : never;
3568
- }[keyof T];
3569
- declare type requiredKeys<T extends object> = {
3570
- [k in keyof T]: undefined extends T[k] ? never : k;
3571
- }[keyof T];
3572
- declare type addQuestionMarks<T extends object> = Partial<Pick<T, optionalKeys<T>>> & Pick<T, requiredKeys<T>>;
3573
- declare type baseObjectOutputType<Shape extends JSONObjectShape> = flatten<addQuestionMarks<{
3574
- [k in keyof Shape]: Shape[k]['type'];
3575
- }>>;
3576
- declare type objectOutputType<Shape extends JSONObjectShape, Catchall extends JSONTypeAny> = JSONTypeAny extends Catchall ? baseObjectOutputType<Shape> : flatten<baseObjectOutputType<Shape> & {
3577
- [k: string]: Catchall['type'];
3578
- }>;
3579
- declare type IsEqual<T, U> = (<G>() => G extends T ? 1 : 2) extends <G>() => G extends U ? 1 : 2 ? true : false;
3580
- declare type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : KeyType extends ExcludeType ? never : KeyType;
3581
- declare type Except<ObjectType, KeysType extends keyof ObjectType> = {
3582
- [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
3583
- };
3584
- declare type Merge<FirstType, SecondType> = Except<FirstType, Extract<keyof FirstType, keyof SecondType>> & SecondType;
3585
- interface JSONObject<T extends JSONObjectShape, UnknownKeys extends UnknownKeysParam = 'strip', Catchall extends JSONTypeAny = JSONTypeAny, Output = objectOutputType<T, Catchall>> extends JSONType<Output, 'object'> {
3586
- shape: T;
3587
- unknownKeys: UnknownKeys;
3588
- catchAllType: Catchall;
3589
- extend<S extends JSONObjectShape>(shape: S): JSONObject<Merge<T, S>, UnknownKeys, Catchall>;
3590
- merge<S extends JSONObjectShape, U extends UnknownKeysParam, C extends JSONTypeAny>(obj: JSONObject<S, U, C>): JSONObject<Merge<T, S>, U, C>;
3591
- pick<K extends keyof T>(...arr: K[]): JSONObject<Pick<T, K>, UnknownKeys, Catchall>;
3592
- omit<K extends keyof T>(...arr: K[]): JSONObject<Omit<T, K>, UnknownKeys, Catchall>;
3593
- partial(): JSONObject<FullyPartial<T>, UnknownKeys, Catchall>;
3594
- partial<P extends keyof T>(...arr: P[]): JSONObject<PartiallyPartial<T, P>, UnknownKeys, Catchall>;
3595
- deepPartial(): JSONObject<{
3596
- [k in keyof T]: JSONOptional<DeepPartial<T[k]>>;
3597
- }, UnknownKeys, Catchall>;
3598
- passthrough(): JSONObject<T, 'passthrough', Catchall>;
3599
- strict(): JSONObject<T, 'strict', Catchall>;
3600
- strip(): JSONObject<T, 'strip', Catchall>;
3601
- catchAll<C extends JSONTypeAny>(type: C): JSONObject<T, UnknownKeys, C>;
3602
- }
3603
- declare const object: <T extends JSONObjectShape, UnknownKeys extends UnknownKeysParam = "strip", Catchall extends JSONTypeAny = JSONTypeAny>(shape: T) => JSONObject<T, UnknownKeys, Catchall, objectOutputType<T, Catchall>>;
3604
-
3605
- interface JSONNativeEnum<T extends EnumLike> extends JSONType<T[keyof T], 'nativeEnum'> {
3606
- dataType: 'nativeEnum';
3607
- enum: T;
3608
- options: (number | string)[];
3609
- }
3610
- declare type EnumLike = {
3611
- [k: string]: string | number;
3612
- [nu: number]: string;
3613
- };
3614
- declare const getValidEnumValues: (obj: EnumLike) => (string | number)[];
3615
- declare const nativeEnum: <T extends EnumLike>(givenEnum: T) => JSONNativeEnum<T>;
3616
-
3617
- interface JSONMap<Key extends JSONTypeAny, Value extends JSONTypeAny> extends JSONType<Map<Key['type'], Value['type']>, 'map'> {
3618
- keyType: Key;
3619
- valueType: Value;
3620
- deepPartial(): JSONMap<ReturnType<Key['deepPartial']>, ReturnType<Value['deepPartial']>>;
3621
- }
3622
- declare const map: <Key extends JSONTypeAny, Value extends JSONTypeAny>(keyType: Key, valueType: Value) => JSONMap<Key, Value>;
3623
-
3624
- interface JSONLiteral<T extends Primitive> extends JSONType<T, 'literal'> {
3625
- value: Primitive;
3626
- }
3627
- declare const literal: <T extends Primitive>(value: T) => JSONLiteral<T>;
3628
-
3629
- interface JSONLazy<T extends JSONTypeAny> extends JSONType<T['type'], 'lazy'> {
3630
- typeCache?: T;
3631
- getter(): T;
3632
- deepPartial(): JSONLazy<ReturnType<T['deepPartial']>>;
3633
- }
3634
- declare const lazy: <T extends JSONTypeAny>(fn: () => T) => JSONLazy<T>;
3635
-
3636
- interface JSONInstanceOf<T extends Class> extends JSONType<T, 'instanceOf'> {
3637
- class: T;
3638
- }
3639
- declare type Class = new (...args: any[]) => any;
3640
- declare const instanceOf: <T extends Class>(cls: T) => JSONInstanceOf<T>;
3641
-
3642
- interface JSONEnum<U extends string = string, T extends [U, ...U[]] = [U]> extends JSONType<T[number], 'enum'> {
3643
- enum: {
3644
- [k in T[number]]: k;
3645
- };
3646
- options: T;
3647
- }
3648
- declare const arrayToEnum: <U extends string, T extends [U, ...U[]]>(items: T) => { [k in T[number]]: k; };
3649
- declare const enumType: <U extends string, T extends [U, ...U[]]>(options: T) => JSONEnum<U, T>;
3650
-
3651
- interface JSONDiscriminatedUnion<Discriminator extends string, DiscriminatorValue extends Primitive, Option extends JSONDiscriminatedObject<Discriminator, DiscriminatorValue>> extends JSONType<Option['type'], 'discriminatedUnion'> {
3652
- discriminator: Discriminator;
3653
- discriminatorValue: DiscriminatorValue;
3654
- options: Map<DiscriminatorValue, Option>;
3655
- _option: Option;
3656
- }
3657
- declare type JSONDiscriminatedObject<Discriminator extends string, DiscriminatorValue extends Primitive> = JSONObject<{
3658
- [K in Discriminator]: JSONLiteral<DiscriminatorValue>;
3659
- } & JSONObjectShape, any>;
3660
- declare const discriminatedUnion: <Discriminator extends string, DiscriminatorValue extends Primitive, Types extends [JSONDiscriminatedObject<Discriminator, DiscriminatorValue>, JSONDiscriminatedObject<Discriminator, DiscriminatorValue>, ...JSONDiscriminatedObject<Discriminator, DiscriminatorValue>[]]>(discriminator: Discriminator, options: Types) => JSONDiscriminatedUnion<Discriminator, DiscriminatorValue, Types[number]>;
3661
-
3662
- declare type JSONAny = JSONTypeAny & {
3663
- dataType: 'any';
3664
- };
3665
- declare type JSONBigInt = JSONType<bigint, 'bigint'> & {
3666
- data: BaseNumberData;
3667
- } & typeof bigIntMethods;
3668
- declare const bigIntMethods: {
3669
- lt<T extends {
3670
- data: {
3671
- lt?: number | undefined;
3672
- };
3673
- }, Value extends number>(this: T, value: Value): Omit<T, "data"> & {
3674
- data: Omit<T["data"], "lt"> & {
3675
- lt: Value;
3676
- };
3677
- };
3678
- lte<T_1 extends {
3679
- data: {
3680
- lte?: number | undefined;
3681
- };
3682
- }, Value_1 extends number>(this: T_1, value: Value_1): Omit<T_1, "data"> & {
3683
- data: Omit<T_1["data"], "lte"> & {
3684
- lte: Value_1;
3685
- };
3686
- };
3687
- max<T_2 extends {
3688
- data: {
3689
- lte?: number | undefined;
3690
- };
3691
- }, Value_2 extends number>(this: T_2, value: Value_2): Omit<T_2, "data"> & {
3692
- data: Omit<T_2["data"], "lte"> & {
3693
- lte: Value_2;
3694
- };
3695
- };
3696
- gt<T_3 extends {
3697
- data: {
3698
- gt?: number | undefined;
3699
- };
3700
- }, Value_3 extends number>(this: T_3, value: Value_3): Omit<T_3, "data"> & {
3701
- data: Omit<T_3["data"], "gt"> & {
3702
- gt: Value_3;
3507
+ }, Value_3 extends number>(this: T_3, value: Value_3): Omit<T_3, "data"> & {
3508
+ data: Omit<T_3["data"], "gt"> & {
3509
+ gt: Value_3;
3703
3510
  };
3704
3511
  };
3705
3512
  gte<T_4 extends {
@@ -3794,6 +3601,9 @@ declare type JSONNumber = JSONType<number, 'number'> & {
3794
3601
  } & typeof numberMethods;
3795
3602
  declare const numberMethods: {
3796
3603
  dataType: "number";
3604
+ toCode(this: JSONType<number, 'number'> & {
3605
+ data: BaseNumberData;
3606
+ }, t: string): Code;
3797
3607
  lt<T extends {
3798
3608
  data: {
3799
3609
  lt?: number | undefined;
@@ -3920,6 +3730,9 @@ declare type JSONString = JSONType<string, 'string'> & {
3920
3730
  } & typeof stringMethods;
3921
3731
  declare const stringMethods: {
3922
3732
  dataType: "string";
3733
+ toCode(this: JSONType<string, 'string'> & {
3734
+ data: BaseStringData;
3735
+ }, t: string): Code;
3923
3736
  email<T extends {
3924
3737
  data: {
3925
3738
  email?: boolean | undefined;
@@ -4019,15 +3832,7 @@ declare const stringMethods: {
4019
3832
  length: Value_5;
4020
3833
  };
4021
3834
  };
4022
- nonempty: <T_11 extends {
4023
- data: {
4024
- min?: number | undefined;
4025
- };
4026
- }>(this: T_11) => Omit<T_11, "data"> & {
4027
- data: Omit<T_11["data"], "min"> & {
4028
- min: number;
4029
- };
4030
- };
3835
+ nonEmpty: <T_11 extends NonEmptyBase>(this: T_11) => NonEmptyResult<T_11>;
4031
3836
  };
4032
3837
  declare type JSONUndefined = JSONType<undefined, 'undefined'>;
4033
3838
  declare type JSONUnknown = JSONType<unknown, 'unknown'>;
@@ -4047,10 +3852,30 @@ declare const scalarTypes: {
4047
3852
  void: () => JSONVoid;
4048
3853
  };
4049
3854
 
4050
- interface JSONUnion<T extends [JSONTypeAny, JSONTypeAny, ...JSONTypeAny[]]> extends JSONType<T[number]['type'], 'union'> {
4051
- types: T;
3855
+ interface JSONRecord<Key extends JSONRecordKeyType, Value extends JSONTypeAny> extends JSONType<Record<Key['type'], Value['type']>, 'record'> {
3856
+ keyType: Key;
3857
+ valueType: Value;
3858
+ deepPartial(): JSONRecord<Key, ReturnType<Value['deepPartial']>>;
4052
3859
  }
4053
- declare const union: <T extends [JSONTypeAny, JSONTypeAny, ...JSONTypeAny[]]>(types: T) => JSONUnion<T>;
3860
+ declare type JSONRecordKeyType = JSONType<string | number, 'string' | 'number'>;
3861
+ declare type Args<Key extends JSONRecordKeyType, Value extends JSONTypeAny> = Args2<Key, Value> | Args1<Key>;
3862
+ declare type Args2<Key extends JSONRecordKeyType, Value extends JSONTypeAny> = [
3863
+ key: Key,
3864
+ value: Value
3865
+ ];
3866
+ declare type Args1<Value extends JSONTypeAny> = [value: Value];
3867
+ declare function record<KeyType extends JSONString | JSONNumber, ValueType extends JSONTypeAny>(...args: Args<KeyType, ValueType>): JSONRecord<KeyType, ValueType>;
3868
+
3869
+ interface JSONSet<Value extends JSONTypeAny> extends JSONType<Set<Value['type']>, 'set'>, SetMethods {
3870
+ data: JSONTypeData & {
3871
+ min?: number;
3872
+ max?: number;
3873
+ size?: number;
3874
+ };
3875
+ valueType: Value;
3876
+ deepPartial(): JSONSet<ReturnType<Value['deepPartial']>>;
3877
+ }
3878
+ declare const set: <Value extends JSONTypeAny>(valueType: Value) => JSONSet<Value>;
4054
3879
 
4055
3880
  interface JSONTuple<T extends JSONTupleItems | [] = JSONTupleItems, Rest extends JSONTypeAny | null = null> extends JSONType<OutputTypeOfTupleWithRest<T, Rest>, 'tuple'> {
4056
3881
  items: T;
@@ -4068,35 +3893,10 @@ declare type OutputTypeOfTuple<T extends JSONTupleItems | []> = AssertArray<{
4068
3893
  declare type OutputTypeOfTupleWithRest<T extends JSONTupleItems | [], Rest extends JSONTypeAny | null = null> = Rest extends JSONTypeAny ? [...OutputTypeOfTuple<T>, ...Rest['type'][]] : OutputTypeOfTuple<T>;
4069
3894
  declare const tuple: <T extends [] | JSONTupleItems, Rest extends JSONTypeAny | null = null>(items: T, rest?: Rest) => JSONTuple<T, Rest>;
4070
3895
 
4071
- interface JSONSet<Value extends JSONTypeAny> extends JSONType<Set<Value['type']>, 'set'>, SetMethods {
4072
- data: JSONTypeData & {
4073
- min?: number;
4074
- max?: number;
4075
- size?: number;
4076
- };
4077
- valueType: Value;
4078
- deepPartial(): JSONSet<ReturnType<Value['deepPartial']>>;
4079
- nonEmpty(this: JSONSet<Value>): JSONSet<Value> & {
4080
- data: {
4081
- min: 1;
4082
- };
4083
- };
4084
- }
4085
- declare const set: <Value extends JSONTypeAny>(valueType: Value) => JSONSet<Value>;
4086
-
4087
- interface JSONRecord<Key extends JSONRecordKeyType, Value extends JSONTypeAny> extends JSONType<Record<Key['type'], Value['type']>, 'record'> {
4088
- keyType: Key;
4089
- valueType: Value;
4090
- deepPartial(): JSONRecord<Key, ReturnType<Value['deepPartial']>>;
3896
+ interface JSONUnion<T extends [JSONTypeAny, JSONTypeAny, ...JSONTypeAny[]]> extends JSONType<T[number]['type'], 'union'> {
3897
+ types: T;
4091
3898
  }
4092
- declare type JSONRecordKeyType = JSONType<string | number, 'string' | 'number'>;
4093
- declare type Args<Key extends JSONRecordKeyType, Value extends JSONTypeAny> = Args2<Key, Value> | Args1<Key>;
4094
- declare type Args2<Key extends JSONRecordKeyType, Value extends JSONTypeAny> = [
4095
- key: Key,
4096
- value: Value
4097
- ];
4098
- declare type Args1<Value extends JSONTypeAny> = [value: Value];
4099
- declare function record<KeyType extends JSONString | JSONNumber, ValueType extends JSONTypeAny>(...args: Args<KeyType, ValueType>): JSONRecord<KeyType, ValueType>;
3899
+ declare const union: <T extends [JSONTypeAny, JSONTypeAny, ...JSONTypeAny[]]>(types: T) => JSONUnion<T>;
4100
3900
 
4101
3901
  declare type JSONTypes = typeof jsonTypes;
4102
3902
  declare const jsonTypes: {
@@ -4163,6 +3963,7 @@ declare class JSONColumn<Type extends JSONTypeAny = JSONTypeAny> extends ColumnT
4163
3963
  schema: Type;
4164
3964
  };
4165
3965
  constructor(schemaOrFn: Type | ((j: JSONTypes) => Type));
3966
+ toCode(t: string): Code;
4166
3967
  }
4167
3968
  declare class JSONTextColumn extends ColumnType<string, typeof Operators.text> {
4168
3969
  dataType: "json";
@@ -4198,6 +3999,250 @@ declare class JSONTextColumn extends ColumnType<string, typeof Operators.text> {
4198
3999
  type: Query | RawExpression<ColumnType<unknown, Operators, unknown>> | string[];
4199
4000
  };
4200
4001
  };
4002
+ toCode(t: string): Code;
4003
+ }
4004
+
4005
+ declare type ColumnsShape = Record<string, ColumnType>;
4006
+ declare type ColumnShapeOutput<Shape extends ColumnsShape> = {
4007
+ [K in keyof Shape]: ColumnOutput<Shape[K]>;
4008
+ };
4009
+ declare type OptionalColumnsForInput<Shape extends ColumnsShape> = {
4010
+ [K in keyof Shape]: SomeIsTrue<[
4011
+ Shape[K]['isNullable'],
4012
+ Shape[K]['hasDefault']
4013
+ ]> extends true ? K : never;
4014
+ }[keyof Shape];
4015
+ declare type ColumnShapeInput<Shape extends ColumnsShape> = SetOptional<{
4016
+ [K in keyof Shape]: ColumnInput<Shape[K]>;
4017
+ }, OptionalColumnsForInput<Shape>>;
4018
+ declare abstract class ColumnsObject<Shape extends ColumnsShape> extends ColumnType<{
4019
+ [K in keyof Shape]: Shape[K]['type'];
4020
+ }, typeof Operators.any> {
4021
+ shape: Shape;
4022
+ dataType: "object";
4023
+ operators: {
4024
+ equals: ((key: string, value: any, values: unknown[]) => string) & {
4025
+ type: any;
4026
+ };
4027
+ not: ((key: string, value: any, values: unknown[]) => string) & {
4028
+ type: any;
4029
+ };
4030
+ in: ((key: string, value: any[] | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, values: unknown[]) => string) & {
4031
+ type: any[] | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
4032
+ };
4033
+ notIn: ((key: string, value: any[] | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, values: unknown[]) => string) & {
4034
+ type: any[] | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
4035
+ };
4036
+ };
4037
+ constructor(shape: Shape);
4038
+ }
4039
+ declare abstract class ArrayOfColumnsObjects<Shape extends ColumnsShape> extends ColumnType<{
4040
+ [K in keyof Shape]: Shape[K]['type'];
4041
+ }[], typeof Operators.any> {
4042
+ shape: Shape;
4043
+ dataType: "array";
4044
+ operators: {
4045
+ equals: ((key: string, value: any, values: unknown[]) => string) & {
4046
+ type: any;
4047
+ };
4048
+ not: ((key: string, value: any, values: unknown[]) => string) & {
4049
+ type: any;
4050
+ };
4051
+ in: ((key: string, value: any[] | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, values: unknown[]) => string) & {
4052
+ type: any[] | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
4053
+ };
4054
+ notIn: ((key: string, value: any[] | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, values: unknown[]) => string) & {
4055
+ type: any[] | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
4056
+ };
4057
+ };
4058
+ constructor(shape: Shape);
4059
+ }
4060
+ declare abstract class PluckResultColumnType<C extends ColumnType> extends ColumnType<C['type'][], typeof Operators.any> {
4061
+ }
4062
+ declare type SinglePrimaryKey<Shape extends ColumnsShape> = StringKey<{
4063
+ [K in keyof Shape]: Shape[K]['isPrimaryKey'] extends true ? [
4064
+ {
4065
+ [S in keyof Shape]: Shape[S]['isPrimaryKey'] extends true ? S extends K ? never : S : never;
4066
+ }[keyof Shape]
4067
+ ] extends [never] ? K : never : never;
4068
+ }[keyof Shape]>;
4069
+
4070
+ declare type ColumnOutput<T extends ColumnType> = T['type'];
4071
+ declare type ColumnInput<T extends ColumnType> = T['inputType'];
4072
+ declare type NullableColumn<T extends ColumnType> = Omit<T, 'type' | 'inputType' | 'operators'> & {
4073
+ type: T['type'] | null;
4074
+ inputType: T['inputType'] | null;
4075
+ isNullable: true;
4076
+ operators: Omit<T['operators'], 'equals' | 'not'> & {
4077
+ equals: Operator<T['type'] | null>;
4078
+ not: Operator<T['type'] | null>;
4079
+ };
4080
+ };
4081
+ declare type AnyColumnType = ColumnType<any, Record<string, Operator<any>>>;
4082
+ declare type AnyColumnTypeCreator = (...args: any[]) => AnyColumnType | {};
4083
+ declare type ColumnTypesBase = Record<string, AnyColumnTypeCreator>;
4084
+ declare type ValidationContext = any;
4085
+ declare type ColumnData = {
4086
+ default?: unknown;
4087
+ validationDefault?: unknown;
4088
+ index?: Omit<SingleColumnIndexOptions, 'column'>;
4089
+ comment?: string;
4090
+ collate?: string;
4091
+ compression?: string;
4092
+ foreignKey?: ForeignKey<string, string[]>;
4093
+ modifyQuery?: (q: Query) => void;
4094
+ as?: ColumnType;
4095
+ };
4096
+ declare type ForeignKeyMatch = 'FULL' | 'PARTIAL' | 'SIMPLE';
4097
+ declare type ForeignKeyAction = 'NO ACTION' | 'RESTRICT' | 'CASCADE' | 'SET NULL' | 'SET DEFAULT';
4098
+ declare type ForeignKey<Table extends string, Columns extends string[]> = ({
4099
+ fn(): new () => {
4100
+ table: Table;
4101
+ };
4102
+ } | {
4103
+ table: Table;
4104
+ }) & {
4105
+ columns: Columns;
4106
+ } & ForeignKeyOptions;
4107
+ declare type DropMode = 'CASCADE' | 'RESTRICT';
4108
+ declare type ForeignKeyOptions = {
4109
+ name?: string;
4110
+ match?: ForeignKeyMatch;
4111
+ onUpdate?: ForeignKeyAction;
4112
+ onDelete?: ForeignKeyAction;
4113
+ dropMode?: DropMode;
4114
+ };
4115
+ declare type IndexColumnOptions = {
4116
+ column: string;
4117
+ expression?: number | string;
4118
+ collate?: string;
4119
+ operator?: string;
4120
+ order?: string;
4121
+ };
4122
+ declare type IndexOptions = {
4123
+ name?: string;
4124
+ unique?: boolean;
4125
+ using?: string;
4126
+ include?: MaybeArray<string>;
4127
+ with?: string;
4128
+ tablespace?: string;
4129
+ where?: string;
4130
+ dropMode?: 'CASCADE' | 'RESTRICT';
4131
+ };
4132
+ declare type SingleColumnIndexOptions = IndexColumnOptions & IndexOptions;
4133
+ declare type ForeignKeyTable = new () => {
4134
+ table: string;
4135
+ };
4136
+ declare type ForeignKeyTableWithColumns = new () => {
4137
+ table: string;
4138
+ columns: {
4139
+ shape: ColumnsShape;
4140
+ };
4141
+ };
4142
+ declare type ColumnNameOfTable<Table extends ForeignKeyTableWithColumns> = StringKey<keyof InstanceType<Table>['columns']['shape']>;
4143
+ declare type Code = string | Code[];
4144
+ declare const columnChainToCode: (chain: ColumnChain, t: string, code: Code, append: Code) => Code;
4145
+ declare const columnCode: (type: ColumnType, t: string, code: Code) => Code;
4146
+ declare type ColumnChain = (['transform', (input: unknown, ctx: ValidationContext) => unknown] | ['to', (input: unknown) => JSONTypeAny | undefined, JSONTypeAny] | ['refine', (input: unknown) => unknown] | ['superRefine', (input: unknown, ctx: ValidationContext) => unknown])[];
4147
+ declare abstract class ColumnType<Type = unknown, Ops extends Operators = Operators, InputType = Type> {
4148
+ abstract dataType: string;
4149
+ abstract operators: Ops;
4150
+ abstract toCode(t: string): Code;
4151
+ type: Type;
4152
+ inputType: InputType;
4153
+ data: ColumnData;
4154
+ isPrimaryKey: boolean;
4155
+ isHidden: boolean;
4156
+ isNullable: boolean;
4157
+ hasDefault: boolean;
4158
+ encodeFn?: (input: any) => unknown;
4159
+ parseFn?: (input: unknown) => unknown;
4160
+ parseItem?: (input: string) => unknown;
4161
+ chain: ColumnChain;
4162
+ primaryKey<T extends ColumnType>(this: T): T & {
4163
+ isPrimaryKey: true;
4164
+ };
4165
+ foreignKey<T extends ColumnType, Table extends ForeignKeyTableWithColumns, Column extends ColumnNameOfTable<Table>>(this: T, fn: () => Table, column: Column, options?: ForeignKeyOptions): Omit<T, 'foreignKeyData'> & {
4166
+ foreignKeyData: ForeignKey<InstanceType<Table>['table'], [Column]>;
4167
+ };
4168
+ foreignKey<T extends ColumnType, Table extends string, Column extends string>(this: T, table: Table, column: Column, options?: ForeignKeyOptions): Omit<T, 'foreignKeyData'> & {
4169
+ foreignKeyData: ForeignKey<Table, [Column]>;
4170
+ };
4171
+ hidden<T extends ColumnType>(this: T): T & {
4172
+ isHidden: true;
4173
+ };
4174
+ nullable<T extends ColumnType>(this: T): NullableColumn<T>;
4175
+ encode<T extends ColumnType, Input>(this: T, fn: (input: Input) => unknown): Omit<T, 'inputType'> & {
4176
+ inputType: Input;
4177
+ };
4178
+ parse<T extends ColumnType, Output>(this: T, fn: (input: T['type']) => Output): Omit<T, 'type'> & {
4179
+ type: Output;
4180
+ };
4181
+ as<T extends ColumnType, C extends ColumnType<T['type'], Operators, T['inputType']>>(this: T, column: C): C;
4182
+ toSQL(): string;
4183
+ default<T extends ColumnType>(this: T, value: T['type'] | RawExpression): T & {
4184
+ hasDefault: true;
4185
+ };
4186
+ index<T extends ColumnType>(this: T, options?: Omit<SingleColumnIndexOptions, 'column'>): T;
4187
+ unique<T extends ColumnType>(this: T, options?: Omit<SingleColumnIndexOptions, 'column' | 'unique'>): T;
4188
+ comment<T extends ColumnType>(this: T, comment: string): T;
4189
+ validationDefault<T extends ColumnType>(this: T, value: T['type']): T;
4190
+ compression<T extends ColumnType>(this: T, compression: string): T;
4191
+ collate<T extends ColumnType>(this: T, collate: string): T;
4192
+ modifyQuery<T extends ColumnType>(this: T, cb: (q: Query) => void): T;
4193
+ transform<T extends ColumnType, Transformed>(this: T, fn: (input: T['type'], ctx: ValidationContext) => Transformed): Omit<T, 'type'> & {
4194
+ type: Transformed;
4195
+ };
4196
+ to<T extends ColumnType, ToType extends ColumnType>(this: T, fn: (input: T['type']) => ToType['type'] | undefined, type: ToType): ToType;
4197
+ refine<T extends ColumnType, RefinedOutput extends T['type']>(this: T, check: (arg: T['type']) => unknown): T & {
4198
+ type: RefinedOutput;
4199
+ };
4200
+ superRefine<T extends ColumnType, RefinedOutput extends T['type']>(this: T, check: (arg: T['type'], ctx: ValidationContext) => unknown): T & {
4201
+ type: RefinedOutput;
4202
+ };
4203
+ }
4204
+
4205
+ declare class BooleanColumn extends ColumnType<boolean, typeof Operators.boolean> {
4206
+ dataType: "boolean";
4207
+ operators: {
4208
+ equals: ((key: string, value: boolean | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, values: unknown[]) => string) & {
4209
+ type: boolean | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
4210
+ };
4211
+ not: ((key: string, value: boolean | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, values: unknown[]) => string) & {
4212
+ type: boolean | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
4213
+ };
4214
+ in: ((key: string, value: Query | RawExpression<ColumnType<unknown, Operators, unknown>> | boolean[], values: unknown[]) => string) & {
4215
+ type: Query | RawExpression<ColumnType<unknown, Operators, unknown>> | boolean[];
4216
+ };
4217
+ notIn: ((key: string, value: Query | RawExpression<ColumnType<unknown, Operators, unknown>> | boolean[], values: unknown[]) => string) & {
4218
+ type: Query | RawExpression<ColumnType<unknown, Operators, unknown>> | boolean[];
4219
+ };
4220
+ };
4221
+ toCode(t: string): Code;
4222
+ parseItem: (input: string) => boolean;
4223
+ }
4224
+
4225
+ declare class EnumColumn<U extends string = string, T extends [U, ...U[]] = [U]> extends ColumnType<T[number], typeof Operators.any> {
4226
+ enumName: string;
4227
+ options: T;
4228
+ operators: {
4229
+ equals: ((key: string, value: any, values: unknown[]) => string) & {
4230
+ type: any;
4231
+ };
4232
+ not: ((key: string, value: any, values: unknown[]) => string) & {
4233
+ type: any;
4234
+ };
4235
+ in: ((key: string, value: any[] | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, values: unknown[]) => string) & {
4236
+ type: any[] | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
4237
+ };
4238
+ notIn: ((key: string, value: any[] | Query | RawExpression<ColumnType<unknown, Operators, unknown>>, values: unknown[]) => string) & {
4239
+ type: any[] | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
4240
+ };
4241
+ };
4242
+ dataType: string;
4243
+ constructor(enumName: string, options: T);
4244
+ toCode(t: string): Code;
4245
+ toSql(): string;
4201
4246
  }
4202
4247
 
4203
4248
  declare type ArrayData<Item extends ColumnType> = ColumnData & {
@@ -4205,6 +4250,7 @@ declare type ArrayData<Item extends ColumnType> = ColumnData & {
4205
4250
  min?: number;
4206
4251
  max?: number;
4207
4252
  length?: number;
4253
+ isNonEmpty?: true;
4208
4254
  };
4209
4255
  declare type ArrayMethods = typeof arrayMethods;
4210
4256
  interface ArrayColumn<Item extends ColumnType> extends ColumnType<Item['type'][], typeof Operators.array>, ArrayMethods {
@@ -4228,7 +4274,10 @@ declare class ArrayColumn<Item extends ColumnType> extends ColumnType<Item['type
4228
4274
  data: ArrayData<Item>;
4229
4275
  constructor(item: Item);
4230
4276
  toSQL(): string;
4231
- parseFn: (input: unknown) => unknown[];
4277
+ toCode(this: ArrayColumn<Item>, t: string): Code;
4278
+ parseFn: ((input: unknown) => unknown[]) & {
4279
+ hideFromCode: boolean;
4280
+ };
4232
4281
  }
4233
4282
 
4234
4283
  declare function timestamps<T extends ColumnType>(this: {
@@ -4244,23 +4293,28 @@ declare function timestamps<T extends ColumnType>(this: {
4244
4293
 
4245
4294
  declare type ColumnTypes = typeof columnTypes;
4246
4295
  declare type TableData = {
4247
- primaryKey?: {
4296
+ primaryKey?: TableData.PrimaryKey;
4297
+ indexes: TableData.Index[];
4298
+ foreignKeys: TableData.ForeignKey[];
4299
+ };
4300
+ declare namespace TableData {
4301
+ type PrimaryKey = {
4248
4302
  columns: string[];
4249
4303
  options?: {
4250
4304
  name?: string;
4251
4305
  };
4252
4306
  };
4253
- indexes: {
4307
+ type Index = {
4254
4308
  columns: IndexColumnOptions[];
4255
4309
  options: IndexOptions;
4256
- }[];
4257
- foreignKeys: {
4310
+ };
4311
+ type ForeignKey = {
4258
4312
  columns: string[];
4259
- fnOrTable: (() => ForeignKeyModel) | string;
4313
+ fnOrTable: (() => ForeignKeyTable) | string;
4260
4314
  foreignColumns: string[];
4261
4315
  options: ForeignKeyOptions;
4262
- }[];
4263
- };
4316
+ };
4317
+ }
4264
4318
  declare const newTableData: () => TableData;
4265
4319
  declare const getTableData: () => TableData;
4266
4320
  declare const resetTableData: (data?: TableData) => void;
@@ -4322,7 +4376,7 @@ declare const columnTypes: {
4322
4376
  macaddr: () => MacAddrColumn;
4323
4377
  macaddr8: () => MacAddr8Column;
4324
4378
  bit: <Length extends number>(length: Length) => BitColumn<Length>;
4325
- bitVarying: <Length_1 extends number | undefined = undefined>(length?: Length_1 | undefined) => BitVaryingColumn<Length_1 | undefined>;
4379
+ bitVarying: <Length_1 extends number | undefined = undefined>(length?: Length_1 | undefined) => BitVaryingColumn<Length_1>;
4326
4380
  tsvector: () => TsVectorColumn;
4327
4381
  tsquery: () => TsQueryColumn;
4328
4382
  uuid: () => UUIDColumn;
@@ -4338,7 +4392,7 @@ declare const columnTypes: {
4338
4392
  unique(columns: MaybeArray<string | IndexColumnOptions>, options?: IndexOptions): {};
4339
4393
  foreignKey: typeof foreignKey;
4340
4394
  };
4341
- declare function foreignKey<Model extends ForeignKeyModelWithColumns, Columns extends [ColumnNameOfModel<Model>, ...ColumnNameOfModel<Model>[]]>(columns: string[], fn: () => Model, foreignColumns: Columns, options?: ForeignKeyOptions): EmptyObject;
4395
+ declare function foreignKey<Table extends ForeignKeyTableWithColumns, Columns extends [ColumnNameOfTable<Table>, ...ColumnNameOfTable<Table>[]]>(columns: string[], fn: () => Table, foreignColumns: Columns, options?: ForeignKeyOptions): EmptyObject;
4342
4396
  declare function foreignKey<Table extends string, Columns extends [string, ...string[]]>(columns: string[], table: Table, foreignColumns: Columns, options?: ForeignKeyOptions): EmptyObject;
4343
4397
 
4344
4398
  declare const cloneInstance: <T>(instance: T) => T;
@@ -4371,6 +4425,7 @@ declare abstract class VirtualColumn extends ColumnType<unknown, typeof Operator
4371
4425
  type: any[] | Query | RawExpression<ColumnType<unknown, Operators, unknown>>;
4372
4426
  };
4373
4427
  };
4428
+ toCode(): never;
4374
4429
  create?(q: Query, ctx: CreateCtx, item: Record<string, unknown>, rowIndex: number): void;
4375
4430
  update?(q: Query, ctx: UpdateCtx, set: Record<string, unknown>): void;
4376
4431
  }
@@ -4388,4 +4443,4 @@ declare const setQueryObjectValue: <T extends {
4388
4443
  query: QueryData;
4389
4444
  }>(q: T, object: string, key: string, value: unknown) => T;
4390
4445
 
4391
- export { Adapter, AdapterOptions, AddQueryJoinedTable, AddQuerySelect, AddQueryWith, AfterCallback, Aggregate, Aggregate1ArgumentTypes, AggregateArg, AggregateItem, AggregateItemArg, AggregateItemOptions, AggregateOptions, AliasOrTable, AnyColumnType, AnyColumnTypeCreator, ArrayCardinality, ArrayColumn, ArrayData, ArrayOfColumnsObjects, AssertArray, BaseNumberData, BaseRelation, BaseStringData, BeforeCallback, BelongsToRelation, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BooleanExpression, BoxColumn, ByteaColumn, CharColumn, CidrColumn, CircleColumn, Clear, ClearStatement, CoalesceString, ColumnData, ColumnInfo, ColumnInfoMethods, ColumnInfoQueryData, ColumnInput, ColumnNameOfModel, ColumnOperators, ColumnOutput, ColumnParser, ColumnShapeInput, ColumnShapeOutput, ColumnType, ColumnTypes, ColumnTypesBase, ColumnsObject, ColumnsParsers, ColumnsShape, CommonQueryData, CopyOptions, CopyQueryData, Create, CreateCtx, CreateData, CreateMethodsNames, DateBaseColumn, DateColumn, DateColumnData, DateTimeBaseClass, DateTimeColumnData, DateTimeWithTimeZoneBaseClass, Db, DbOptions, DbTableOptions, DecimalBaseColumn, DecimalColumn, DecimalColumnData, DeepPartial, DefaultSelectColumns, Delete, DeleteMethodsNames, DeleteQueryData, DoublePrecisionColumn, DropMode, EMPTY_OBJECT, EmptyObject, EnumColumn, EnumLike, Except, Expression, ExpressionOfType, ExpressionOutput, FilterTuple, For, ForeignKey, ForeignKeyModel, ForeignKeyModelWithColumns, ForeignKeyOptions, From, GetArg, HasAndBelongsToManyRelation, HasManyRelation, HasOneRelation, Having, HavingArg, HavingItem, IndexColumnOptions, IndexOptions, InetColumn, InsertQueryData, IntegerBaseColumn, IntegerColumn, IntervalColumn, IsEqual, JSONAny, JSONArray, JSONBigInt, JSONBoolean, JSONColumn, JSONDate, JSONDiscriminatedObject, JSONDiscriminatedUnion, JSONEnum, JSONInstanceOf, JSONIntersection, JSONLazy, JSONLiteral, JSONMap, JSONNaN, JSONNativeEnum, JSONNever, JSONNotNullable, JSONNotNullish, JSONNull, JSONNullable, JSONNullish, JSONNumber, JSONObject, JSONObjectShape, JSONOptional, JSONRecord, JSONRecordKeyType, JSONRequired, JSONSet, JSONString, JSONTextColumn, JSONTuple, JSONTupleItems, JSONType, JSONTypeAny, JSONTypeData, JSONTypes, JSONUndefined, JSONUnion, JSONUnknown, JSONVoid, Join, JoinArgs, JoinCallback, JoinCallbackArg, JoinItem, JoinedTablesBase, Json, JsonItem, LimitedTextBaseColumn, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, MaybeArray, Merge, MergeQuery, MergeQueryMethods, MoneyColumn, MoreThanOneRowError, NoPrimaryKeyOption, NotFoundError, NullableColumn, NumberAsStringBaseColumn, NumberBaseColumn, NumberColumn, NumberColumnData, NumberExpression, OnConflictItem, OnConflictMergeUpdate, OnConflictQueryBuilder, OnQueryBuilder, Operator, Operators, OrderArg, OrderItem, OutputTypeOfTuple, OutputTypeOfTupleWithRest, OwnTypeProps, PathColumn, PluckResultColumnType, PointColumn, PolygonColumn, PormError, PormInternalError, Primitive, Query, QueryArraysResult, QueryBase, QueryCallbacks, QueryData, QueryError, QueryErrorName, QueryGet, QueryInput, QueryLog, QueryLogObject, QueryLogOptions, QueryLogger, QueryMethods, QueryResult, QueryResultRow, QueryReturnType, QueryReturnsAll, QuerySelectAll, QueryThen, QueryUpsert, QueryWithTable, RawExpression, RawMethods, RealColumn, Relation, RelationQuery, RelationQueryBase, RelationQueryData, RelationsBase, Select, SelectAgg, SelectArg, SelectFunctionItem, SelectItem, SelectQueryData, Selectable, SelectableBase, SerialColumn, SetOptional, SetQueryJoinedTables, SetQueryReturns, SetQueryReturnsAll, SetQueryReturnsColumnInfo, SetQueryReturnsOne, SetQueryReturnsOneOptional, SetQueryReturnsPluck, SetQueryReturnsRowCount, SetQueryReturnsRows, SetQueryReturnsValue, SetQueryReturnsValueOptional, SetQueryReturnsVoid, SetQueryTableAlias, SetQueryWindows, SetQueryWith, SimpleSpread, SingleColumnIndexOptions, SinglePrimaryKey, SmallIntColumn, SmallSerialColumn, SomeIsTrue, SortDir, Spread, Sql, StringColumn, StringExpression, StringKey, TableData, TextBaseColumn, TextColumn, TextColumnData, Then, ThenResult, TimeColumn, TimeInterval, TimeWithTimeZoneColumn, TimestampColumn, TimestampWithTimeZoneColumn, ToSqlCtx, ToSqlOptions, Transaction, TransactionAdapter, TruncateQueryData, TsQueryColumn, TsVectorColumn, TypeParsers, UUIDColumn, UnhandledTypeError, Union, UnionArg, UnionItem, UnionKind, UnknownKeysParam, Update, UpdateCtx, UpdateData, UpdateQueryData, UpdateQueryDataItem, UpdateQueryDataObject, UpdatedAtDataInjector, UpsertData, UpsertResult, UpsertThis, ValidationContext, VarCharColumn, VirtualColumn, Where, WhereArg, WhereInArg, WhereInColumn, WhereInItem, WhereInValues, WhereItem, WhereJsonPathEqualsItem, WhereOnItem, WhereOnJoinItem, WhereQueryBuilder, WhereResult, WindowArg, WindowArgDeclaration, WindowDeclaration, WindowFunctionOptions, WindowItem, With, WithDataBase, WithDataItem, WithItem, WithOptions, XMLColumn, addOr, addOrNot, addParserForRawExpression, addParserForSelectItem, addParserToQuery, addQueryOn, addQueryOrOn, addQuestionMarks, addWhere, addWhereIn, addWhereNot, aggregate1FunctionNames, anyShape, applyMixins, array, arrayToEnum, baseObjectOutputType, checkIfASimpleQuery, cloneQueryArrays, columnTypes, utils as columnUtils, constructType, createDb, createOperator, defaultsKey, discriminatedUnion, emptyObject, enumType, flatten, getClonedQueryData, getColumnTypes, getQueryAs, getQueryParsers, getRaw, getRawSql, getTableData, getValidEnumValues, getValueKey, handleResult, identity, instanceOf, intersection, isQueryReturnsAll, isRaw, isRequiredRelationKey, joinTruthy, jsonTypes, lazy, literal, logColors, logParamToLogObject, makeRegexToFindInSql, makeSql, map, nativeEnum, newTableData, noop, notNullable, notNullish, nullable, nullish, object, optional, parseRecord, parseResult, processSelectArg, pushOrNewArray, pushOrNewArrayToObject, pushQueryArray, pushQueryOn, pushQueryOrOn, pushQueryValue, queryMethodByReturnType, queryTypeWithLimitOne, quote, raw, record, relationQueryKey, required, resetTableData, scalarTypes, set, setQueryObjectValue, toArray, toSql, toSqlCacheKey, tuple, union };
4446
+ export { Adapter, AdapterOptions, AddQueryJoinedTable, AddQuerySelect, AddQueryWith, AfterCallback, Aggregate, Aggregate1ArgumentTypes, AggregateArg, AggregateItem, AggregateItemArg, AggregateItemOptions, AggregateOptions, AliasOrTable, AnyColumnType, AnyColumnTypeCreator, ArrayCardinality, ArrayColumn, ArrayData, ArrayOfColumnsObjects, AssertArray, BaseNumberData, BaseRelation, BaseStringData, BeforeCallback, BelongsToRelation, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BooleanExpression, BoxColumn, ByteaColumn, CharColumn, CidrColumn, CircleColumn, Clear, ClearStatement, CoalesceString, Code, ColumnChain, ColumnData, ColumnInfo, ColumnInfoMethods, ColumnInfoQueryData, ColumnInput, ColumnNameOfTable, ColumnOperators, ColumnOutput, ColumnParser, ColumnShapeInput, ColumnShapeOutput, ColumnType, ColumnTypes, ColumnTypesBase, ColumnsObject, ColumnsParsers, ColumnsShape, CommonQueryData, CopyOptions, CopyQueryData, Create, CreateCtx, CreateData, CreateMethodsNames, DateBaseColumn, DateColumn, DateColumnData, DateTimeBaseClass, DateTimeColumnData, DateTimeWithTimeZoneBaseClass, Db, DbOptions, DbTableOptions, DecimalBaseColumn, DecimalColumn, DecimalColumnData, DeepPartial, DefaultSelectColumns, Delete, DeleteMethodsNames, DeleteQueryData, DoublePrecisionColumn, DropMode, EMPTY_OBJECT, EmptyObject, EnumColumn, EnumLike, Except, Expression, ExpressionOfType, ExpressionOutput, FilterTuple, For, ForeignKey, ForeignKeyOptions, ForeignKeyTable, ForeignKeyTableWithColumns, From, GetArg, HasAndBelongsToManyRelation, HasManyRelation, HasOneRelation, Having, HavingArg, HavingItem, IndexColumnOptions, IndexOptions, InetColumn, InsertQueryData, IntegerBaseColumn, IntegerColumn, IntervalColumn, IsEqual, JSONAny, JSONArray, JSONBigInt, JSONBoolean, JSONColumn, JSONDate, JSONDiscriminatedObject, JSONDiscriminatedUnion, JSONEnum, JSONInstanceOf, JSONIntersection, JSONLazy, JSONLiteral, JSONMap, JSONNaN, JSONNativeEnum, JSONNever, JSONNotNullable, JSONNotNullish, JSONNull, JSONNullable, JSONNullish, JSONNumber, JSONObject, JSONObjectShape, JSONOptional, JSONRecord, JSONRecordKeyType, JSONRequired, JSONSet, JSONString, JSONTextColumn, JSONTuple, JSONTupleItems, JSONType, JSONTypeAny, JSONTypeData, JSONTypes, JSONUndefined, JSONUnion, JSONUnknown, JSONVoid, Join, JoinArgs, JoinCallback, JoinCallbackArg, JoinItem, JoinedTablesBase, Json, JsonItem, LimitedTextBaseColumn, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, MaybeArray, Merge, MergeQuery, MergeQueryMethods, MoneyColumn, MoreThanOneRowError, NoPrimaryKeyOption, NotFoundError, NullableColumn, NumberAsStringBaseColumn, NumberBaseColumn, NumberColumn, NumberColumnData, NumberExpression, OnConflictItem, OnConflictMergeUpdate, OnConflictQueryBuilder, OnQueryBuilder, Operator, Operators, OrderArg, OrderItem, OutputTypeOfTuple, OutputTypeOfTupleWithRest, OwnTypeProps, PathColumn, PluckResultColumnType, PointColumn, PolygonColumn, PormError, PormInternalError, Primitive, Query, QueryArraysResult, QueryBase, QueryCallbacks, QueryData, QueryError, QueryErrorName, QueryGet, QueryInput, QueryLog, QueryLogObject, QueryLogOptions, QueryLogger, QueryMethods, QueryResult, QueryResultRow, QueryReturnType, QueryReturnsAll, QuerySelectAll, QueryThen, QueryUpsert, QueryWithTable, RawExpression, RawMethods, RealColumn, Relation, RelationQuery, RelationQueryBase, RelationQueryData, RelationsBase, Select, SelectAgg, SelectArg, SelectFunctionItem, SelectItem, SelectQueryData, Selectable, SelectableBase, SerialColumn, SetOptional, SetQueryJoinedTables, SetQueryReturns, SetQueryReturnsAll, SetQueryReturnsColumnInfo, SetQueryReturnsOne, SetQueryReturnsOneOptional, SetQueryReturnsPluck, SetQueryReturnsRowCount, SetQueryReturnsRows, SetQueryReturnsValue, SetQueryReturnsValueOptional, SetQueryReturnsVoid, SetQueryTableAlias, SetQueryWindows, SetQueryWith, SimpleSpread, SingleColumnIndexOptions, SinglePrimaryKey, SmallIntColumn, SmallSerialColumn, SomeIsTrue, SortDir, Spread, Sql, StringColumn, StringExpression, StringKey, TableData, TextBaseColumn, TextColumn, TextColumnData, Then, ThenResult, TimeColumn, TimeInterval, TimeWithTimeZoneColumn, TimestampColumn, TimestampWithTimeZoneColumn, ToSqlCtx, ToSqlOptions, Transaction, TransactionAdapter, TruncateQueryData, TsQueryColumn, TsVectorColumn, TypeParsers, UUIDColumn, UnhandledTypeError, Union, UnionArg, UnionItem, UnionKind, UnknownKeysParam, Update, UpdateCtx, UpdateData, UpdateQueryData, UpdateQueryDataItem, UpdateQueryDataObject, UpdatedAtDataInjector, UpsertData, UpsertResult, UpsertThis, ValidationContext, VarCharColumn, VirtualColumn, Where, WhereArg, WhereInArg, WhereInColumn, WhereInItem, WhereInValues, WhereItem, WhereJsonPathEqualsItem, WhereOnItem, WhereOnJoinItem, WhereQueryBuilder, WhereResult, WindowArg, WindowArgDeclaration, WindowDeclaration, WindowFunctionOptions, WindowItem, With, WithDataBase, WithDataItem, WithItem, WithOptions, XMLColumn, addOr, addOrNot, addParserForRawExpression, addParserForSelectItem, addParserToQuery, addQueryOn, addQueryOrOn, addQuestionMarks, addWhere, addWhereIn, addWhereNot, aggregate1FunctionNames, anyShape, applyMixins, array, arrayToEnum, baseObjectOutputType, checkIfASimpleQuery, cloneQueryArrays, columnChainToCode, columnCode, columnTypes, utils as columnUtils, constructType, createDb, createOperator, defaultsKey, discriminatedUnion, emptyObject, enumType, flatten, getClonedQueryData, getColumnTypes, getQueryAs, getQueryParsers, getRaw, getRawSql, getTableData, getValidEnumValues, getValueKey, handleResult, identity, instanceOf, intersection, isQueryReturnsAll, isRaw, isRequiredRelationKey, joinTruthy, jsonTypes, lazy, literal, logColors, logParamToLogObject, makeRegexToFindInSql, makeSql, map, nativeEnum, newTableData, noop, notNullable, notNullish, nullable, nullish, object, optional, parseRecord, parseResult, processSelectArg, pushOrNewArray, pushOrNewArrayToObject, pushQueryArray, pushQueryOn, pushQueryOrOn, pushQueryValue, queryMethodByReturnType, queryTypeWithLimitOne, quote, raw, record, relationQueryKey, required, resetTableData, scalarTypes, set, setQueryObjectValue, singleQuote, toArray, toCode, toSql, toSqlCacheKey, tuple, union };