pqb 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +250 -244
- package/dist/index.esm.js +656 -721
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +656 -721
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/query.ts +1 -0
- package/src/queryMethods/join.test.ts +2 -2
- package/src/queryMethods/join.ts +18 -12
- package/src/queryMethods/select.test.ts +6 -6
- package/src/queryMethods/where.test.ts +1 -1
- package/src/queryMethods/where.ts +8 -3
- package/src/relations.ts +1 -1
- package/src/sql/aggregate.ts +17 -14
- package/src/sql/columnInfo.ts +5 -5
- package/src/sql/delete.ts +12 -12
- package/src/sql/distinct.ts +5 -5
- package/src/sql/fromAndAs.ts +14 -10
- package/src/sql/having.ts +15 -15
- package/src/sql/insert.ts +24 -23
- package/src/sql/join.ts +73 -111
- package/src/sql/orderBy.ts +4 -4
- package/src/sql/select.ts +15 -15
- package/src/sql/toSql.ts +28 -15
- package/src/sql/truncate.ts +5 -4
- package/src/sql/update.ts +14 -14
- package/src/sql/where.ts +183 -223
- package/src/sql/with.ts +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -54,15 +54,20 @@ declare type JoinResult<T extends Query, Args extends JoinArgs<T>, A extends Que
|
|
|
54
54
|
} : never : never : never>;
|
|
55
55
|
declare type JoinCallbackArg<T extends QueryBase> = Query | keyof T['withData'] | keyof T['relations'];
|
|
56
56
|
declare type JoinCallback<T extends QueryBase, Arg extends JoinCallbackArg<T>> = (q: OnQueryBuilder<T, Arg extends keyof T['withData'] ? T['withData'][Arg] extends WithDataItem ? {
|
|
57
|
+
query: QueryData;
|
|
57
58
|
table: T['withData'][Arg]['table'];
|
|
58
59
|
tableAlias: undefined;
|
|
59
|
-
|
|
60
|
+
clone(): QueryBase;
|
|
60
61
|
selectable: {
|
|
61
62
|
[K in keyof T['withData'][Arg]['shape'] as `${T['withData'][Arg]['table']}.${StringKey<K>}`]: {
|
|
62
63
|
as: StringKey<K>;
|
|
63
64
|
column: T['withData'][Arg]['shape'][K];
|
|
64
65
|
};
|
|
65
66
|
};
|
|
67
|
+
shape: T['withData'][Arg]['shape'];
|
|
68
|
+
__model: Query;
|
|
69
|
+
relations: RelationsBase;
|
|
70
|
+
withData: WithDataBase;
|
|
66
71
|
} : never : Arg extends Query ? Arg : T['relations'] extends Record<string, Relation> ? Arg extends keyof T['relations'] ? T['relations'][Arg]['model'] : never : never>) => OnQueryBuilder;
|
|
67
72
|
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 ? {
|
|
68
73
|
table: T['withData'][Arg]['table'];
|
|
@@ -99,7 +104,6 @@ declare class Join {
|
|
|
99
104
|
_fullOuterJoin<T extends Query, Args extends JoinArgs<T>>(this: T, ...args: Args): JoinResult<T, Args>;
|
|
100
105
|
_fullOuterJoin<T extends Query, Arg extends JoinCallbackArg<T>>(this: T, arg: Arg, cb: JoinCallback<T, Arg>): JoinCallbackResult<T, Arg>;
|
|
101
106
|
}
|
|
102
|
-
declare type PickQueryForSelect<T extends QueryBase = QueryBase> = Pick<T, 'table' | 'tableAlias' | 'selectable'>;
|
|
103
107
|
declare type OnArgs<Q extends {
|
|
104
108
|
selectable: SelectableBase;
|
|
105
109
|
}> = [leftColumn: keyof Q['selectable'], rightColumn: keyof Q['selectable']] | [
|
|
@@ -117,16 +121,11 @@ declare type OnJsonPathEqualsArgs<T extends QueryBase> = [
|
|
|
117
121
|
rightColumn: keyof T['selectable'],
|
|
118
122
|
rightPath: string
|
|
119
123
|
];
|
|
120
|
-
declare class OnQueryBuilder<S extends QueryBase = QueryBase, J extends
|
|
121
|
-
selectable: S['selectable'] & J['selectable'];
|
|
124
|
+
declare class OnQueryBuilder<S extends QueryBase = QueryBase, J extends QueryBase = QueryBase> extends WhereQueryBuilder<Omit<J, 'selectable'> & {
|
|
125
|
+
selectable: Omit<S['selectable'], keyof S['shape']> & J['selectable'];
|
|
122
126
|
}> implements QueryBase {
|
|
123
|
-
joinTo: QueryBase
|
|
124
|
-
constructor(q:
|
|
125
|
-
table?: string;
|
|
126
|
-
query: {
|
|
127
|
-
as?: string;
|
|
128
|
-
};
|
|
129
|
-
}, joinTo: QueryBase | string);
|
|
127
|
+
joinTo: QueryBase;
|
|
128
|
+
constructor(q: QueryBase | string, shape: ColumnsShape, joinTo: QueryBase);
|
|
130
129
|
on<T extends this>(this: T, ...args: OnArgs<T>): T;
|
|
131
130
|
_on<T extends this>(this: T, ...args: OnArgs<T>): T;
|
|
132
131
|
orOn<T extends this>(this: T, ...args: OnArgs<T>): T;
|
|
@@ -168,6 +167,7 @@ declare const addWhereIn: <T extends QueryBase>(q: T, and: boolean, arg: unknown
|
|
|
168
167
|
declare abstract class Where implements QueryBase {
|
|
169
168
|
abstract clone<T extends this>(this: T): T;
|
|
170
169
|
abstract selectable: SelectableBase;
|
|
170
|
+
abstract shape: ColumnsShape;
|
|
171
171
|
abstract relations: RelationsBase;
|
|
172
172
|
abstract withData: WithDataBase;
|
|
173
173
|
abstract __model: Query;
|
|
@@ -220,14 +220,13 @@ declare abstract class Where implements QueryBase {
|
|
|
220
220
|
_orWhereNotExists<T extends Where, Arg extends JoinCallbackArg<T>>(this: T, arg: Arg, cb: JoinCallback<T, Arg>): WhereResult<T>;
|
|
221
221
|
}
|
|
222
222
|
declare class WhereQueryBuilder<Q extends QueryBase = QueryBase> extends Where implements QueryBase {
|
|
223
|
-
table: Q['table'];
|
|
224
|
-
tableAlias: Q['tableAlias'];
|
|
225
223
|
query: QueryData;
|
|
226
224
|
selectable: Q['selectable'];
|
|
225
|
+
shape: Q['shape'];
|
|
227
226
|
__model: Query;
|
|
228
227
|
relations: {};
|
|
229
228
|
withData: {};
|
|
230
|
-
constructor(
|
|
229
|
+
constructor(q: QueryBase | string, shape: ColumnsShape);
|
|
231
230
|
clone<T extends this>(this: T): T;
|
|
232
231
|
}
|
|
233
232
|
|
|
@@ -431,7 +430,7 @@ declare type BaseRelation = {
|
|
|
431
430
|
key: string;
|
|
432
431
|
model: QueryWithTable;
|
|
433
432
|
query: QueryWithTable;
|
|
434
|
-
joinQuery(fromQuery:
|
|
433
|
+
joinQuery(fromQuery: QueryBase, toQuery: Query): Query;
|
|
435
434
|
nestedCreateQuery: Query;
|
|
436
435
|
nestedInsert?: BelongsToNestedInsert | HasOneNestedInsert | HasManyNestedInsert;
|
|
437
436
|
nestedUpdate?: BelongsToNestedUpdate | HasOneNestedUpdate | HasManyNestedUpdate;
|
|
@@ -824,73 +823,6 @@ declare type UnionKind = 'UNION' | 'UNION ALL' | 'INTERSECT' | 'INTERSECT ALL' |
|
|
|
824
823
|
declare type OnConflictItem = string | string[] | RawExpression;
|
|
825
824
|
declare type OnConflictMergeUpdate = string | string[] | Record<string, unknown> | RawExpression;
|
|
826
825
|
|
|
827
|
-
declare const toSql: (model: Query, values?: unknown[]) => Sql;
|
|
828
|
-
|
|
829
|
-
declare type MaybeArray<T> = T | T[];
|
|
830
|
-
declare type SetOptional<T, K extends PropertyKey> = Omit<T, K> & {
|
|
831
|
-
[P in K]?: P extends keyof T ? T[P] : never;
|
|
832
|
-
};
|
|
833
|
-
declare type GetTypesOrRaw<T extends [...unknown[]]> = T extends [
|
|
834
|
-
infer Head,
|
|
835
|
-
...infer Tail
|
|
836
|
-
] ? [GetTypeOrRaw<Head>, ...GetTypesOrRaw<Tail>] : [];
|
|
837
|
-
declare type GetTypeOrRaw<T> = T | RawExpression;
|
|
838
|
-
declare type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
839
|
-
declare type UnionToOvlds<U> = UnionToIntersection<U extends any ? (f: U) => void : never>;
|
|
840
|
-
declare type PopPropertyKeyUnion<U> = UnionToOvlds<U> extends (a: infer A extends PropertyKey) => void ? A : never;
|
|
841
|
-
declare type IsUnion$1<T> = [T] extends [UnionToIntersection<T>] ? false : true;
|
|
842
|
-
declare type PropertyKeyUnionToArray<T, A extends PropertyKey[] = []> = IsUnion$1<T> extends true ? PropertyKeyUnionToArray<Exclude<T, PopPropertyKeyUnion<T>>, [
|
|
843
|
-
PopPropertyKeyUnion<T>,
|
|
844
|
-
...A
|
|
845
|
-
]> : [T, ...A];
|
|
846
|
-
declare type OptionalPropertyNames<T> = {
|
|
847
|
-
[K in keyof T]-?: {} extends {
|
|
848
|
-
[P in K]: T[K];
|
|
849
|
-
} ? K : never;
|
|
850
|
-
}[keyof T];
|
|
851
|
-
declare type SpreadProperties<L, R, K extends keyof L & keyof R> = {
|
|
852
|
-
[P in K]: L[P] | Exclude<R[P], undefined>;
|
|
853
|
-
};
|
|
854
|
-
declare type Id<T> = T extends infer U ? {
|
|
855
|
-
[K in keyof U]: U[K];
|
|
856
|
-
} : never;
|
|
857
|
-
declare type SpreadTwo<L, R> = Id<Pick<L, Exclude<keyof L, keyof R>> & Pick<R, Exclude<keyof R, OptionalPropertyNames<R>>> & Pick<R, Exclude<OptionalPropertyNames<R>, keyof L>> & SpreadProperties<L, R, OptionalPropertyNames<R> & keyof L>>;
|
|
858
|
-
declare type Spread<A extends readonly [...any]> = A extends [
|
|
859
|
-
infer L,
|
|
860
|
-
...infer R
|
|
861
|
-
] ? SpreadTwo<L, Spread<R>> : unknown;
|
|
862
|
-
declare type SimpleSpread<A extends readonly [...any]> = A extends [
|
|
863
|
-
infer L,
|
|
864
|
-
...infer R
|
|
865
|
-
] ? L & SimpleSpread<R> : {};
|
|
866
|
-
declare type FilterTuple<T extends readonly any[], E> = T extends [
|
|
867
|
-
infer F,
|
|
868
|
-
...infer R
|
|
869
|
-
] ? [F] extends [E] ? [F, ...FilterTuple<R, E>] : FilterTuple<R, E> : [];
|
|
870
|
-
declare type CoalesceString<Left extends string | undefined, Right extends string> = Left extends undefined ? Right : Left;
|
|
871
|
-
declare function applyMixins(derivedCtor: any, constructors: any[]): void;
|
|
872
|
-
declare const joinTruthy: (...strings: (string | false | undefined)[]) => string;
|
|
873
|
-
declare const getClonedQueryData: (query: QueryData) => QueryData;
|
|
874
|
-
declare const getQueryAs: (q: {
|
|
875
|
-
table?: string;
|
|
876
|
-
query: {
|
|
877
|
-
as?: string;
|
|
878
|
-
};
|
|
879
|
-
}) => string;
|
|
880
|
-
declare const toArray: <T>(item: T) => T extends unknown[] ? T : [T];
|
|
881
|
-
declare const noop: () => void;
|
|
882
|
-
declare type EmptyObject = typeof emptyObject;
|
|
883
|
-
declare const emptyObject: {};
|
|
884
|
-
|
|
885
|
-
declare type ThenResult<Res> = (resolve?: (value: Res) => any, reject?: (error: any) => any) => Promise<Res | never>;
|
|
886
|
-
declare const queryMethodByReturnType: Record<QueryReturnType, 'query' | 'arrays'>;
|
|
887
|
-
declare class Then {
|
|
888
|
-
then(this: Query, resolve?: (result: any) => any, reject?: (error: any) => any): Promise<any>;
|
|
889
|
-
}
|
|
890
|
-
declare const handleResult: CommonQueryData['handleResult'];
|
|
891
|
-
declare const parseResult: (q: Query, returnType: QueryReturnType, result: QueryResult) => unknown;
|
|
892
|
-
declare const parseRecord: (parsers: ColumnsParsers, row: any) => any;
|
|
893
|
-
|
|
894
826
|
declare type AggregateArg<T extends Query> = Expression<T> | Record<string, Expression<T>> | [Expression<T>, string];
|
|
895
827
|
declare type AggregateOptions<T extends Query = Query, As extends string | undefined = any> = {
|
|
896
828
|
as?: As;
|
|
@@ -1021,6 +953,64 @@ declare class Aggregate {
|
|
|
1021
953
|
_selectStringAgg<T extends Query, As extends string | undefined = undefined>(this: T, arg: StringExpression<T>, delimiter: string, options?: AggregateOptions<T, As>): SelectAgg<T, 'string_agg', As, NullableColumn<StringColumn>>;
|
|
1022
954
|
}
|
|
1023
955
|
|
|
956
|
+
declare type ClearStatement = 'with' | 'select' | 'where' | 'union' | 'using' | 'join' | 'group' | 'order' | 'having' | 'limit' | 'offset' | 'counters';
|
|
957
|
+
declare class Clear {
|
|
958
|
+
clear<T extends Query>(this: T, ...clears: ClearStatement[]): T;
|
|
959
|
+
_clear<T extends Query>(this: T, ...clears: ClearStatement[]): T;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
declare type ColumnInfo = {
|
|
963
|
+
defaultValue: unknown;
|
|
964
|
+
type: string;
|
|
965
|
+
maxLength: number | null;
|
|
966
|
+
nullable: boolean;
|
|
967
|
+
};
|
|
968
|
+
declare class ColumnInfoMethods {
|
|
969
|
+
columnInfo<T extends Query, Column extends keyof T['shape'] | undefined = undefined>(this: T, column?: Column): SetQueryReturnsColumnInfo<T, Column>;
|
|
970
|
+
_columnInfo<T extends Query, Column extends keyof T['shape'] | undefined = undefined>(this: T, column?: Column): SetQueryReturnsColumnInfo<T, Column>;
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
declare type DeleteArgs<T extends Query> = T['hasWhere'] extends true ? [forceAll?: boolean] : [true];
|
|
974
|
+
declare type DeleteResult<T extends Query> = T['hasSelect'] extends false ? SetQueryReturnsRowCount<T> : T;
|
|
975
|
+
declare class Delete {
|
|
976
|
+
del<T extends Query>(this: T, ...args: DeleteArgs<T>): DeleteResult<T>;
|
|
977
|
+
_del<T extends Query>(this: T, ...args: DeleteArgs<T>): DeleteResult<T>;
|
|
978
|
+
delete<T extends Query>(this: T, ...args: DeleteArgs<T>): DeleteResult<T>;
|
|
979
|
+
_delete<T extends Query>(this: T, ...args: DeleteArgs<T>): DeleteResult<T>;
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
declare type ForQueryBuilder<Q extends Query> = Q & {
|
|
983
|
+
noWait<T extends ForQueryBuilder<Q>>(this: T): T;
|
|
984
|
+
_noWait<T extends ForQueryBuilder<Q>>(this: T): T;
|
|
985
|
+
skipLocked<T extends ForQueryBuilder<Q>>(this: T): T;
|
|
986
|
+
_skipLocked<T extends ForQueryBuilder<Q>>(this: T): T;
|
|
987
|
+
};
|
|
988
|
+
declare class For {
|
|
989
|
+
forUpdate<T extends Query>(this: T, tableNames?: string[] | RawExpression): ForQueryBuilder<T>;
|
|
990
|
+
_forUpdate<T extends Query>(this: T, tableNames?: string[] | RawExpression): ForQueryBuilder<T>;
|
|
991
|
+
forNoKeyUpdate<T extends Query>(this: T, tableNames?: string[] | RawExpression): ForQueryBuilder<T>;
|
|
992
|
+
_forNoKeyUpdate<T extends Query>(this: T, tableNames?: string[] | RawExpression): ForQueryBuilder<T>;
|
|
993
|
+
forShare<T extends Query>(this: T, tableNames?: string[] | RawExpression): ForQueryBuilder<T>;
|
|
994
|
+
_forShare<T extends Query>(this: T, tableNames?: string[] | RawExpression): ForQueryBuilder<T>;
|
|
995
|
+
forKeyShare<T extends Query>(this: T, tableNames?: string[] | RawExpression): ForQueryBuilder<T>;
|
|
996
|
+
_forKeyShare<T extends Query>(this: T, tableNames?: string[] | RawExpression): ForQueryBuilder<T>;
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
declare type FromArgs<T extends Query> = [
|
|
1000
|
+
first: string | Query | RawExpression | Exclude<keyof T['withData'], symbol | number>,
|
|
1001
|
+
second?: string | {
|
|
1002
|
+
as?: string;
|
|
1003
|
+
only?: boolean;
|
|
1004
|
+
}
|
|
1005
|
+
];
|
|
1006
|
+
declare type FromResult<T extends Query, Args extends FromArgs<T>> = Args[1] extends string ? SetQueryTableAlias<T, Args[1]> : Args[1] extends {
|
|
1007
|
+
as: string;
|
|
1008
|
+
} ? SetQueryTableAlias<T, Args[1]['as']> : Args[0] extends string ? SetQueryTableAlias<T, Args[0]> : Args[0] extends Query ? SetQueryTableAlias<T, AliasOrTable<Args[0]>> : T;
|
|
1009
|
+
declare class From {
|
|
1010
|
+
from<T extends Query, Args extends FromArgs<T>>(this: T, ...args: Args): FromResult<T, Args>;
|
|
1011
|
+
_from<T extends Query, Args extends FromArgs<T>>(this: T, ...args: Args): FromResult<T, Args>;
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1024
1014
|
declare type GetArg<T extends QueryBase> = keyof T['selectable'] | (RelationQueryBase & {
|
|
1025
1015
|
returnType: 'value' | 'valueOrThrow';
|
|
1026
1016
|
}) | RawExpression;
|
|
@@ -1036,6 +1026,79 @@ declare class QueryGet {
|
|
|
1036
1026
|
_getOptional<T extends Query, Arg extends GetArg<T>>(this: T, arg: Arg): GetOptionalResult<T, Arg>;
|
|
1037
1027
|
}
|
|
1038
1028
|
|
|
1029
|
+
declare type HavingArgObject<T extends Query, Agg extends keyof Aggregate1ArgumentTypes<T>> = {
|
|
1030
|
+
[Column in Exclude<Aggregate1ArgumentTypes<T>[Agg], RawExpression>]?: T['selectable'][Column]['column']['type'] | (ColumnOperators<T['selectable'], Column> & AggregateOptions<T>);
|
|
1031
|
+
};
|
|
1032
|
+
declare type HavingArg<T extends Query = Query> = ({
|
|
1033
|
+
[Agg in keyof Aggregate1ArgumentTypes<T>]?: HavingArgObject<T, Agg>;
|
|
1034
|
+
} & {
|
|
1035
|
+
count?: number | HavingArgObject<T, 'count'>;
|
|
1036
|
+
}) | Query | RawExpression;
|
|
1037
|
+
declare class Having {
|
|
1038
|
+
having<T extends Query>(this: T, ...args: HavingArg<T>[]): T;
|
|
1039
|
+
_having<T extends Query>(this: T, ...args: HavingArg<T>[]): T;
|
|
1040
|
+
havingOr<T extends Query>(this: T, ...args: HavingArg<T>[]): T;
|
|
1041
|
+
_havingOr<T extends Query>(this: T, ...args: HavingArg<T>[]): T;
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
declare type JsonColumnName<T extends Pick<Query, 'selectable'>> = StringKey<{
|
|
1045
|
+
[K in keyof T['selectable']]: T['selectable'][K]['column']['dataType'] extends 'jsonb' ? K : never;
|
|
1046
|
+
}[keyof T['selectable']]>;
|
|
1047
|
+
declare type ColumnOrJsonMethod<T extends Query> = JsonColumnName<T> | JsonItem;
|
|
1048
|
+
declare type JsonSetResult<T extends Query, Column extends ColumnOrJsonMethod<T>, As extends string, Type extends ColumnType = Column extends keyof T['shape'] ? T['shape'][Column] : Column extends JsonItem ? Column['__json'][2] : ColumnType> = JsonItem<As, Type> & (Type extends ColumnType ? AddQuerySelect<T, Record<As, Type>> : T);
|
|
1049
|
+
declare type JsonPathQueryResult<T extends Query, As extends string, Type extends ColumnType> = JsonItem & AddQuerySelect<T, {
|
|
1050
|
+
[K in As]: Type;
|
|
1051
|
+
}>;
|
|
1052
|
+
declare class Json {
|
|
1053
|
+
json<T extends Query>(this: T): SetQueryReturnsValueOptional<T, StringColumn>;
|
|
1054
|
+
_json<T extends Query>(this: T): SetQueryReturnsValueOptional<T, StringColumn>;
|
|
1055
|
+
jsonSet<T extends Query, Column extends ColumnOrJsonMethod<T>, As extends string = Column extends JsonItem ? Column['__json'][1] : Column>(this: T, column: Column, path: Array<string | number>, value: unknown, options?: {
|
|
1056
|
+
as?: As;
|
|
1057
|
+
createIfMissing?: boolean;
|
|
1058
|
+
}): JsonSetResult<T, Column, As>;
|
|
1059
|
+
_jsonSet<T extends Query, Column extends ColumnOrJsonMethod<T>, As extends string = Column extends JsonItem ? Column['__json'][1] : Column>(this: T, column: Column, path: Array<string | number>, value: unknown, options?: {
|
|
1060
|
+
as?: As;
|
|
1061
|
+
createIfMissing?: boolean;
|
|
1062
|
+
}): JsonSetResult<T, Column, As>;
|
|
1063
|
+
jsonInsert<T extends Query, Column extends ColumnOrJsonMethod<T>, As extends string = Column extends JsonItem ? Column['__json'][1] : Column>(this: T, ...args: [
|
|
1064
|
+
column: Column,
|
|
1065
|
+
path: Array<string | number>,
|
|
1066
|
+
value: unknown,
|
|
1067
|
+
options?: {
|
|
1068
|
+
as?: As;
|
|
1069
|
+
insertAfter?: boolean;
|
|
1070
|
+
}
|
|
1071
|
+
]): JsonSetResult<T, Column, As>;
|
|
1072
|
+
_jsonInsert<T extends Query, Column extends ColumnOrJsonMethod<T>, As extends string = Column extends JsonItem ? Column['__json'][1] : Column>(this: T, column: Column, path: Array<string | number>, value: unknown, options?: {
|
|
1073
|
+
as?: As;
|
|
1074
|
+
insertAfter?: boolean;
|
|
1075
|
+
}): JsonSetResult<T, Column, As>;
|
|
1076
|
+
jsonRemove<T extends Query, Column extends ColumnOrJsonMethod<T>, As extends string = Column extends JsonItem ? Column['__json'][1] : Column>(this: T, ...args: [
|
|
1077
|
+
column: Column,
|
|
1078
|
+
path: Array<string | number>,
|
|
1079
|
+
options?: {
|
|
1080
|
+
as?: As;
|
|
1081
|
+
}
|
|
1082
|
+
]): JsonSetResult<T, Column, As>;
|
|
1083
|
+
_jsonRemove<T extends Query, Column extends ColumnOrJsonMethod<T>, As extends string = Column extends JsonItem ? Column['__json'][1] : Column>(this: T, column: Column, path: Array<string | number>, options?: {
|
|
1084
|
+
as?: As;
|
|
1085
|
+
}): JsonSetResult<T, Column, As>;
|
|
1086
|
+
jsonPathQuery<T extends Query, As extends string, Type extends ColumnType>(this: T, ...args: [
|
|
1087
|
+
type: Type,
|
|
1088
|
+
column: ColumnOrJsonMethod<T>,
|
|
1089
|
+
path: string,
|
|
1090
|
+
as: As,
|
|
1091
|
+
options?: {
|
|
1092
|
+
vars?: string;
|
|
1093
|
+
silent?: boolean;
|
|
1094
|
+
}
|
|
1095
|
+
]): JsonPathQueryResult<T, As, Type>;
|
|
1096
|
+
_jsonPathQuery<T extends Query, As extends string, Type extends ColumnType>(this: T, type: Type, column: ColumnOrJsonMethod<T>, path: string, as: As, options?: {
|
|
1097
|
+
vars?: string;
|
|
1098
|
+
silent?: boolean;
|
|
1099
|
+
}): JsonPathQueryResult<T, As, Type>;
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1039
1102
|
declare type SelectArg<T extends QueryBase> = keyof T['selectable'] | (T['relations'] extends Record<string, Relation> ? keyof T['relations'] : never) | RelationQueryBase | SelectAsArg<T>;
|
|
1040
1103
|
declare type SelectAsArg<T extends QueryBase> = Record<string, keyof T['selectable'] | Query | RawExpression>;
|
|
1041
1104
|
declare type SelectResult<T extends Query, Args extends SelectArg<T>[], SelectAsArgs = SimpleSpread<FilterTuple<Args, SelectAsArg<QueryBase>>>> = AddQuerySelect<T, {
|
|
@@ -1057,19 +1120,50 @@ declare class Select {
|
|
|
1057
1120
|
_selectAll<T extends Query>(this: T): QuerySelectAll<T>;
|
|
1058
1121
|
}
|
|
1059
1122
|
|
|
1060
|
-
declare type
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
declare
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1123
|
+
declare type ThenResult<Res> = (resolve?: (value: Res) => any, reject?: (error: any) => any) => Promise<Res | never>;
|
|
1124
|
+
declare const queryMethodByReturnType: Record<QueryReturnType, 'query' | 'arrays'>;
|
|
1125
|
+
declare class Then {
|
|
1126
|
+
then(this: Query, resolve?: (result: any) => any, reject?: (error: any) => any): Promise<any>;
|
|
1127
|
+
}
|
|
1128
|
+
declare const handleResult: CommonQueryData['handleResult'];
|
|
1129
|
+
declare const parseResult: (q: Query, returnType: QueryReturnType, result: QueryResult) => unknown;
|
|
1130
|
+
declare const parseRecord: (parsers: ColumnsParsers, row: any) => any;
|
|
1131
|
+
|
|
1132
|
+
declare class Transaction {
|
|
1133
|
+
transaction<T extends Query, Result>(this: T, cb: (query: T) => Promise<Result>): Promise<Result>;
|
|
1134
|
+
transacting<T extends Query>(this: T, query: Query): T;
|
|
1135
|
+
_transacting<T extends Query>(this: T, query: Query): T;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
declare type UnionArg<T extends Query> = (Omit<Query, 'result'> & {
|
|
1139
|
+
result: T['result'];
|
|
1140
|
+
}) | RawExpression;
|
|
1141
|
+
declare class Union {
|
|
1142
|
+
union<T extends Query>(this: T, args: UnionArg<T>[], wrap?: boolean): T;
|
|
1143
|
+
_union<T extends Query>(this: T, args: UnionArg<T>[], wrap?: boolean): T;
|
|
1144
|
+
unionAll<T extends Query>(this: T, args: UnionArg<T>[], wrap?: boolean): T;
|
|
1145
|
+
_unionAll<T extends Query>(this: T, args: UnionArg<T>[], wrap?: boolean): T;
|
|
1146
|
+
intersect<T extends Query>(this: T, args: UnionArg<T>[], wrap?: boolean): T;
|
|
1147
|
+
_intersect<T extends Query>(this: T, args: UnionArg<T>[], wrap?: boolean): T;
|
|
1148
|
+
intersectAll<T extends Query>(this: T, args: UnionArg<T>[], wrap?: boolean): T;
|
|
1149
|
+
_intersectAll<T extends Query>(this: T, args: UnionArg<T>[], wrap?: boolean): T;
|
|
1150
|
+
except<T extends Query>(this: T, args: UnionArg<T>[], wrap?: boolean): T;
|
|
1151
|
+
_except<T extends Query>(this: T, args: UnionArg<T>[], wrap?: boolean): T;
|
|
1152
|
+
exceptAll<T extends Query>(this: T, args: UnionArg<T>[], wrap?: boolean): T;
|
|
1153
|
+
_exceptAll<T extends Query>(this: T, args: UnionArg<T>[], wrap?: boolean): T;
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
declare type UpsertData<T extends Query> = {
|
|
1157
|
+
update: UpdateData<T>;
|
|
1158
|
+
create: InsertData<T>;
|
|
1159
|
+
};
|
|
1160
|
+
declare type UpsertResult<T extends Query> = T['hasSelect'] extends true ? SetQueryReturnsOne<T> : SetQueryReturnsVoid<T>;
|
|
1161
|
+
declare type UpsertThis = WhereResult<Query> & {
|
|
1162
|
+
returnType: 'one' | 'oneOrThrow';
|
|
1163
|
+
};
|
|
1164
|
+
declare class QueryUpsert {
|
|
1165
|
+
upsert<T extends UpsertThis>(this: T, data: UpsertData<T>): UpsertResult<T>;
|
|
1166
|
+
_upsert<T extends UpsertThis>(this: T, data: UpsertData<T>): UpsertResult<T>;
|
|
1073
1167
|
}
|
|
1074
1168
|
|
|
1075
1169
|
declare type DbTableOptions = {
|
|
@@ -1242,145 +1336,69 @@ declare class With {
|
|
|
1242
1336
|
_with<T extends Query, Args extends WithArgs, Shape extends ColumnsShape = WithShape<Args>>(this: T, ...args: Args): WithResult<T, Args, Shape>;
|
|
1243
1337
|
}
|
|
1244
1338
|
|
|
1245
|
-
declare type
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
_union<T extends Query>(this: T, args: UnionArg<T>[], wrap?: boolean): T;
|
|
1251
|
-
unionAll<T extends Query>(this: T, args: UnionArg<T>[], wrap?: boolean): T;
|
|
1252
|
-
_unionAll<T extends Query>(this: T, args: UnionArg<T>[], wrap?: boolean): T;
|
|
1253
|
-
intersect<T extends Query>(this: T, args: UnionArg<T>[], wrap?: boolean): T;
|
|
1254
|
-
_intersect<T extends Query>(this: T, args: UnionArg<T>[], wrap?: boolean): T;
|
|
1255
|
-
intersectAll<T extends Query>(this: T, args: UnionArg<T>[], wrap?: boolean): T;
|
|
1256
|
-
_intersectAll<T extends Query>(this: T, args: UnionArg<T>[], wrap?: boolean): T;
|
|
1257
|
-
except<T extends Query>(this: T, args: UnionArg<T>[], wrap?: boolean): T;
|
|
1258
|
-
_except<T extends Query>(this: T, args: UnionArg<T>[], wrap?: boolean): T;
|
|
1259
|
-
exceptAll<T extends Query>(this: T, args: UnionArg<T>[], wrap?: boolean): T;
|
|
1260
|
-
_exceptAll<T extends Query>(this: T, args: UnionArg<T>[], wrap?: boolean): T;
|
|
1261
|
-
}
|
|
1262
|
-
|
|
1263
|
-
declare type JsonColumnName<T extends Pick<Query, 'selectable'>> = StringKey<{
|
|
1264
|
-
[K in keyof T['selectable']]: T['selectable'][K]['column']['dataType'] extends 'jsonb' ? K : never;
|
|
1265
|
-
}[keyof T['selectable']]>;
|
|
1266
|
-
declare type ColumnOrJsonMethod<T extends Query> = JsonColumnName<T> | JsonItem;
|
|
1267
|
-
declare type JsonSetResult<T extends Query, Column extends ColumnOrJsonMethod<T>, As extends string, Type extends ColumnType = Column extends keyof T['shape'] ? T['shape'][Column] : Column extends JsonItem ? Column['__json'][2] : ColumnType> = JsonItem<As, Type> & (Type extends ColumnType ? AddQuerySelect<T, Record<As, Type>> : T);
|
|
1268
|
-
declare type JsonPathQueryResult<T extends Query, As extends string, Type extends ColumnType> = JsonItem & AddQuerySelect<T, {
|
|
1269
|
-
[K in As]: Type;
|
|
1270
|
-
}>;
|
|
1271
|
-
declare class Json {
|
|
1272
|
-
json<T extends Query>(this: T): SetQueryReturnsValueOptional<T, StringColumn>;
|
|
1273
|
-
_json<T extends Query>(this: T): SetQueryReturnsValueOptional<T, StringColumn>;
|
|
1274
|
-
jsonSet<T extends Query, Column extends ColumnOrJsonMethod<T>, As extends string = Column extends JsonItem ? Column['__json'][1] : Column>(this: T, column: Column, path: Array<string | number>, value: unknown, options?: {
|
|
1275
|
-
as?: As;
|
|
1276
|
-
createIfMissing?: boolean;
|
|
1277
|
-
}): JsonSetResult<T, Column, As>;
|
|
1278
|
-
_jsonSet<T extends Query, Column extends ColumnOrJsonMethod<T>, As extends string = Column extends JsonItem ? Column['__json'][1] : Column>(this: T, column: Column, path: Array<string | number>, value: unknown, options?: {
|
|
1279
|
-
as?: As;
|
|
1280
|
-
createIfMissing?: boolean;
|
|
1281
|
-
}): JsonSetResult<T, Column, As>;
|
|
1282
|
-
jsonInsert<T extends Query, Column extends ColumnOrJsonMethod<T>, As extends string = Column extends JsonItem ? Column['__json'][1] : Column>(this: T, ...args: [
|
|
1283
|
-
column: Column,
|
|
1284
|
-
path: Array<string | number>,
|
|
1285
|
-
value: unknown,
|
|
1286
|
-
options?: {
|
|
1287
|
-
as?: As;
|
|
1288
|
-
insertAfter?: boolean;
|
|
1289
|
-
}
|
|
1290
|
-
]): JsonSetResult<T, Column, As>;
|
|
1291
|
-
_jsonInsert<T extends Query, Column extends ColumnOrJsonMethod<T>, As extends string = Column extends JsonItem ? Column['__json'][1] : Column>(this: T, column: Column, path: Array<string | number>, value: unknown, options?: {
|
|
1292
|
-
as?: As;
|
|
1293
|
-
insertAfter?: boolean;
|
|
1294
|
-
}): JsonSetResult<T, Column, As>;
|
|
1295
|
-
jsonRemove<T extends Query, Column extends ColumnOrJsonMethod<T>, As extends string = Column extends JsonItem ? Column['__json'][1] : Column>(this: T, ...args: [
|
|
1296
|
-
column: Column,
|
|
1297
|
-
path: Array<string | number>,
|
|
1298
|
-
options?: {
|
|
1299
|
-
as?: As;
|
|
1300
|
-
}
|
|
1301
|
-
]): JsonSetResult<T, Column, As>;
|
|
1302
|
-
_jsonRemove<T extends Query, Column extends ColumnOrJsonMethod<T>, As extends string = Column extends JsonItem ? Column['__json'][1] : Column>(this: T, column: Column, path: Array<string | number>, options?: {
|
|
1303
|
-
as?: As;
|
|
1304
|
-
}): JsonSetResult<T, Column, As>;
|
|
1305
|
-
jsonPathQuery<T extends Query, As extends string, Type extends ColumnType>(this: T, ...args: [
|
|
1306
|
-
type: Type,
|
|
1307
|
-
column: ColumnOrJsonMethod<T>,
|
|
1308
|
-
path: string,
|
|
1309
|
-
as: As,
|
|
1310
|
-
options?: {
|
|
1311
|
-
vars?: string;
|
|
1312
|
-
silent?: boolean;
|
|
1313
|
-
}
|
|
1314
|
-
]): JsonPathQueryResult<T, As, Type>;
|
|
1315
|
-
_jsonPathQuery<T extends Query, As extends string, Type extends ColumnType>(this: T, type: Type, column: ColumnOrJsonMethod<T>, path: string, as: As, options?: {
|
|
1316
|
-
vars?: string;
|
|
1317
|
-
silent?: boolean;
|
|
1318
|
-
}): JsonPathQueryResult<T, As, Type>;
|
|
1319
|
-
}
|
|
1320
|
-
|
|
1321
|
-
declare type DeleteArgs<T extends Query> = T['hasWhere'] extends true ? [forceAll?: boolean] : [true];
|
|
1322
|
-
declare type DeleteResult<T extends Query> = T['hasSelect'] extends false ? SetQueryReturnsRowCount<T> : T;
|
|
1323
|
-
declare class Delete {
|
|
1324
|
-
del<T extends Query>(this: T, ...args: DeleteArgs<T>): DeleteResult<T>;
|
|
1325
|
-
_del<T extends Query>(this: T, ...args: DeleteArgs<T>): DeleteResult<T>;
|
|
1326
|
-
delete<T extends Query>(this: T, ...args: DeleteArgs<T>): DeleteResult<T>;
|
|
1327
|
-
_delete<T extends Query>(this: T, ...args: DeleteArgs<T>): DeleteResult<T>;
|
|
1328
|
-
}
|
|
1329
|
-
|
|
1330
|
-
declare class Transaction {
|
|
1331
|
-
transaction<T extends Query, Result>(this: T, cb: (query: T) => Promise<Result>): Promise<Result>;
|
|
1332
|
-
transacting<T extends Query>(this: T, query: Query): T;
|
|
1333
|
-
_transacting<T extends Query>(this: T, query: Query): T;
|
|
1334
|
-
}
|
|
1335
|
-
|
|
1336
|
-
declare type ForQueryBuilder<Q extends Query> = Q & {
|
|
1337
|
-
noWait<T extends ForQueryBuilder<Q>>(this: T): T;
|
|
1338
|
-
_noWait<T extends ForQueryBuilder<Q>>(this: T): T;
|
|
1339
|
-
skipLocked<T extends ForQueryBuilder<Q>>(this: T): T;
|
|
1340
|
-
_skipLocked<T extends ForQueryBuilder<Q>>(this: T): T;
|
|
1339
|
+
declare type ToSqlCtx = {
|
|
1340
|
+
whereQueryBuilder: typeof WhereQueryBuilder;
|
|
1341
|
+
onQueryBuilder: typeof OnQueryBuilder;
|
|
1342
|
+
sql: string[];
|
|
1343
|
+
values: unknown[];
|
|
1341
1344
|
};
|
|
1342
|
-
declare
|
|
1343
|
-
forUpdate<T extends Query>(this: T, tableNames?: string[] | RawExpression): ForQueryBuilder<T>;
|
|
1344
|
-
_forUpdate<T extends Query>(this: T, tableNames?: string[] | RawExpression): ForQueryBuilder<T>;
|
|
1345
|
-
forNoKeyUpdate<T extends Query>(this: T, tableNames?: string[] | RawExpression): ForQueryBuilder<T>;
|
|
1346
|
-
_forNoKeyUpdate<T extends Query>(this: T, tableNames?: string[] | RawExpression): ForQueryBuilder<T>;
|
|
1347
|
-
forShare<T extends Query>(this: T, tableNames?: string[] | RawExpression): ForQueryBuilder<T>;
|
|
1348
|
-
_forShare<T extends Query>(this: T, tableNames?: string[] | RawExpression): ForQueryBuilder<T>;
|
|
1349
|
-
forKeyShare<T extends Query>(this: T, tableNames?: string[] | RawExpression): ForQueryBuilder<T>;
|
|
1350
|
-
_forKeyShare<T extends Query>(this: T, tableNames?: string[] | RawExpression): ForQueryBuilder<T>;
|
|
1351
|
-
}
|
|
1345
|
+
declare const toSql: (model: Query, values?: unknown[]) => Sql;
|
|
1352
1346
|
|
|
1353
|
-
declare type
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
maxLength: number | null;
|
|
1357
|
-
nullable: boolean;
|
|
1347
|
+
declare type MaybeArray<T> = T | T[];
|
|
1348
|
+
declare type SetOptional<T, K extends PropertyKey> = Omit<T, K> & {
|
|
1349
|
+
[P in K]?: P extends keyof T ? T[P] : never;
|
|
1358
1350
|
};
|
|
1359
|
-
declare
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
declare type
|
|
1365
|
-
declare
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1351
|
+
declare type GetTypesOrRaw<T extends [...unknown[]]> = T extends [
|
|
1352
|
+
infer Head,
|
|
1353
|
+
...infer Tail
|
|
1354
|
+
] ? [GetTypeOrRaw<Head>, ...GetTypesOrRaw<Tail>] : [];
|
|
1355
|
+
declare type GetTypeOrRaw<T> = T | RawExpression;
|
|
1356
|
+
declare type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
1357
|
+
declare type UnionToOvlds<U> = UnionToIntersection<U extends any ? (f: U) => void : never>;
|
|
1358
|
+
declare type PopPropertyKeyUnion<U> = UnionToOvlds<U> extends (a: infer A extends PropertyKey) => void ? A : never;
|
|
1359
|
+
declare type IsUnion$1<T> = [T] extends [UnionToIntersection<T>] ? false : true;
|
|
1360
|
+
declare type PropertyKeyUnionToArray<T, A extends PropertyKey[] = []> = IsUnion$1<T> extends true ? PropertyKeyUnionToArray<Exclude<T, PopPropertyKeyUnion<T>>, [
|
|
1361
|
+
PopPropertyKeyUnion<T>,
|
|
1362
|
+
...A
|
|
1363
|
+
]> : [T, ...A];
|
|
1364
|
+
declare type OptionalPropertyNames<T> = {
|
|
1365
|
+
[K in keyof T]-?: {} extends {
|
|
1366
|
+
[P in K]: T[K];
|
|
1367
|
+
} ? K : never;
|
|
1368
|
+
}[keyof T];
|
|
1369
|
+
declare type SpreadProperties<L, R, K extends keyof L & keyof R> = {
|
|
1370
|
+
[P in K]: L[P] | Exclude<R[P], undefined>;
|
|
1372
1371
|
};
|
|
1373
|
-
declare type
|
|
1374
|
-
[
|
|
1375
|
-
}
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1372
|
+
declare type Id<T> = T extends infer U ? {
|
|
1373
|
+
[K in keyof U]: U[K];
|
|
1374
|
+
} : never;
|
|
1375
|
+
declare type SpreadTwo<L, R> = Id<Pick<L, Exclude<keyof L, keyof R>> & Pick<R, Exclude<keyof R, OptionalPropertyNames<R>>> & Pick<R, Exclude<OptionalPropertyNames<R>, keyof L>> & SpreadProperties<L, R, OptionalPropertyNames<R> & keyof L>>;
|
|
1376
|
+
declare type Spread<A extends readonly [...any]> = A extends [
|
|
1377
|
+
infer L,
|
|
1378
|
+
...infer R
|
|
1379
|
+
] ? SpreadTwo<L, Spread<R>> : unknown;
|
|
1380
|
+
declare type SimpleSpread<A extends readonly [...any]> = A extends [
|
|
1381
|
+
infer L,
|
|
1382
|
+
...infer R
|
|
1383
|
+
] ? L & SimpleSpread<R> : {};
|
|
1384
|
+
declare type FilterTuple<T extends readonly any[], E> = T extends [
|
|
1385
|
+
infer F,
|
|
1386
|
+
...infer R
|
|
1387
|
+
] ? [F] extends [E] ? [F, ...FilterTuple<R, E>] : FilterTuple<R, E> : [];
|
|
1388
|
+
declare type CoalesceString<Left extends string | undefined, Right extends string> = Left extends undefined ? Right : Left;
|
|
1389
|
+
declare function applyMixins(derivedCtor: any, constructors: any[]): void;
|
|
1390
|
+
declare const joinTruthy: (...strings: (string | false | undefined)[]) => string;
|
|
1391
|
+
declare const getClonedQueryData: (query: QueryData) => QueryData;
|
|
1392
|
+
declare const getQueryAs: (q: {
|
|
1393
|
+
table?: string;
|
|
1394
|
+
query: {
|
|
1395
|
+
as?: string;
|
|
1396
|
+
};
|
|
1397
|
+
}) => string;
|
|
1398
|
+
declare const toArray: <T>(item: T) => T extends unknown[] ? T : [T];
|
|
1399
|
+
declare const noop: () => void;
|
|
1400
|
+
declare type EmptyObject = typeof emptyObject;
|
|
1401
|
+
declare const emptyObject: {};
|
|
1384
1402
|
|
|
1385
1403
|
declare class Window {
|
|
1386
1404
|
selectRowNumber<T extends Query, As extends string | undefined = undefined>(this: T, options: WindowFunctionOptions<T, As>): SelectAgg<T, 'row_number', As, IntegerColumn>;
|
|
@@ -1395,19 +1413,6 @@ declare class Window {
|
|
|
1395
1413
|
_selectCumeDist<T extends Query, As extends string | undefined = undefined>(this: T, options: WindowFunctionOptions<T, As>): SelectAgg<T, 'cume_dist', As, IntegerColumn>;
|
|
1396
1414
|
}
|
|
1397
1415
|
|
|
1398
|
-
declare type UpsertData<T extends Query> = {
|
|
1399
|
-
update: UpdateData<T>;
|
|
1400
|
-
create: InsertData<T>;
|
|
1401
|
-
};
|
|
1402
|
-
declare type UpsertResult<T extends Query> = T['hasSelect'] extends true ? SetQueryReturnsOne<T> : SetQueryReturnsVoid<T>;
|
|
1403
|
-
declare type UpsertThis = WhereResult<Query> & {
|
|
1404
|
-
returnType: 'one' | 'oneOrThrow';
|
|
1405
|
-
};
|
|
1406
|
-
declare class QueryUpsert {
|
|
1407
|
-
upsert<T extends UpsertThis>(this: T, data: UpsertData<T>): UpsertResult<T>;
|
|
1408
|
-
_upsert<T extends UpsertThis>(this: T, data: UpsertData<T>): UpsertResult<T>;
|
|
1409
|
-
}
|
|
1410
|
-
|
|
1411
1416
|
declare type WindowArg<T extends Query> = Record<string, WindowArgDeclaration<T> | RawExpression>;
|
|
1412
1417
|
declare type WindowArgDeclaration<T extends Query = Query> = {
|
|
1413
1418
|
partitionBy?: Expression<T> | Expression<T>[];
|
|
@@ -1494,6 +1499,7 @@ declare type QueryBase = {
|
|
|
1494
1499
|
tableAlias?: string;
|
|
1495
1500
|
clone(): QueryBase;
|
|
1496
1501
|
selectable: SelectableBase;
|
|
1502
|
+
shape: ColumnsShape;
|
|
1497
1503
|
__model: Query;
|
|
1498
1504
|
relations: RelationsBase;
|
|
1499
1505
|
withData: WithDataBase;
|
|
@@ -4298,4 +4304,4 @@ declare class UnhandledTypeError extends PormInternalError {
|
|
|
4298
4304
|
constructor(value: never);
|
|
4299
4305
|
}
|
|
4300
4306
|
|
|
4301
|
-
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, BelongsToNestedInsert, BelongsToNestedUpdate, 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, DateBaseColumn, DateColumn, DateColumnData, DateTimeBaseClass, DateTimeColumnData, DateTimeWithTimeZoneBaseClass, Db, DbOptions, DbTableOptions, DecimalBaseColumn, DecimalColumn, DecimalColumnData, DeepPartial, DefaultSelectColumns, Delete, DeleteQueryData, DoublePrecisionColumn, DropMode, EMPTY_OBJECT, EmptyObject, EnumColumn, EnumLike, Except, Expression, ExpressionOfType, ExpressionOutput, FilterTuple, For, ForeignKey, ForeignKeyModel, ForeignKeyModelWithColumns, ForeignKeyOptions, From, GetArg, GetTypeOrRaw, GetTypesOrRaw, HasAndBelongsToManyRelation, HasManyNestedInsert, HasManyNestedUpdate, HasManyRelation, HasOneNestedInsert, HasOneNestedUpdate, HasOneRelation, Having, HavingArg, HavingItem, IndexColumnOptions, IndexOptions, InetColumn, Insert, InsertData, 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, MoneyColumn, MoreThanOneRowError, NestedInsertItem, NestedInsertManyItems, NestedInsertOneItem, NestedUpdateItem, NestedUpdateManyItems, NestedUpdateOneItem, NotFoundError, NullableColumn, NumberAsStringBaseColumn, NumberBaseColumn, NumberColumn, NumberColumnData, NumberExpression, OnConflictItem, OnConflictMergeUpdate, OnConflictQueryBuilder, OnQueryBuilder, Operator, Operators, OptionalKeys, OrderArg, OrderItem, OutputTypeOfTuple, OutputTypeOfTupleWithRest, OwnTypeProps, PathColumn, PluckResultColumnType, PointColumn, PolygonColumn, PormError, PormInternalError, Primitive, PropertyKeyUnionToArray, Query, QueryArraysResult, QueryBase, QueryCallbacks, QueryData, QueryGet, QueryInput, QueryLog, QueryLogObject, QueryLogOptions, QueryLogger, QueryMethods, QueryResult, QueryResultRow, QueryReturnType, QuerySelectAll, QueryUpsert, QueryWithTable, RawExpression, RealColumn, Relation, RelationQuery, RelationQueryBase, 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, SmallIntColumn, SmallSerialColumn, SortDir, Spread, Sql, StringColumn, StringExpression, StringKey, TableData, TableSchema, TextBaseColumn, TextColumn, TextColumnData, Then, ThenResult, TimeColumn, TimeInterval, TimeWithTimeZoneColumn, TimestampColumn, TimestampWithTimeZoneColumn, Transaction, TransactionAdapter, TruncateQueryData, TsQueryColumn, TsVectorColumn, TypeParsers, UUIDColumn, UnhandledTypeError, Union, UnionArg, UnionItem, UnionToArray, UnionToIntersection, UnionToOvlds, UnknownKeysParam, Update, UpdateData, UpdateQueryData, UpsertData, UpsertResult, UpsertThis, ValidationContext, VarCharColumn, 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, applyMixins, array, arrayToEnum, baseObjectOutputType, columnTypes, utils as columnUtils, constructType, createDb, createOperator, defaultsKey, discriminatedUnion, emptyObject, enumType, flatten, getClonedQueryData, getColumnTypes, getQueryAs, getQueryParsers, getRaw, getTableData, getValidEnumValues, getValueKey, handleResult, identity, instanceOf, intersection, isRaw, isRequiredRelationKey, joinTruthy, jsonTypes, lazy, literal, logColors, logParamToLogObject, map, nativeEnum, newTableData, noop, notNullable, notNullish, nullable, nullish, object, optional, parseRecord, parseResult, processSelectArg, pushQueryArray, pushQueryOn, pushQueryOrOn, pushQueryValue, queryKeysOfNotSimpleQuery, queryMethodByReturnType, quote, raw, record, relationQueryKey, removeFromQuery, required, resetTableData, scalarTypes, set, setQueryObjectValue, toArray, toSql, tuple, union };
|
|
4307
|
+
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, BelongsToNestedInsert, BelongsToNestedUpdate, 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, DateBaseColumn, DateColumn, DateColumnData, DateTimeBaseClass, DateTimeColumnData, DateTimeWithTimeZoneBaseClass, Db, DbOptions, DbTableOptions, DecimalBaseColumn, DecimalColumn, DecimalColumnData, DeepPartial, DefaultSelectColumns, Delete, DeleteQueryData, DoublePrecisionColumn, DropMode, EMPTY_OBJECT, EmptyObject, EnumColumn, EnumLike, Except, Expression, ExpressionOfType, ExpressionOutput, FilterTuple, For, ForeignKey, ForeignKeyModel, ForeignKeyModelWithColumns, ForeignKeyOptions, From, GetArg, GetTypeOrRaw, GetTypesOrRaw, HasAndBelongsToManyRelation, HasManyNestedInsert, HasManyNestedUpdate, HasManyRelation, HasOneNestedInsert, HasOneNestedUpdate, HasOneRelation, Having, HavingArg, HavingItem, IndexColumnOptions, IndexOptions, InetColumn, Insert, InsertData, 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, MoneyColumn, MoreThanOneRowError, NestedInsertItem, NestedInsertManyItems, NestedInsertOneItem, NestedUpdateItem, NestedUpdateManyItems, NestedUpdateOneItem, NotFoundError, NullableColumn, NumberAsStringBaseColumn, NumberBaseColumn, NumberColumn, NumberColumnData, NumberExpression, OnConflictItem, OnConflictMergeUpdate, OnConflictQueryBuilder, OnQueryBuilder, Operator, Operators, OptionalKeys, OrderArg, OrderItem, OutputTypeOfTuple, OutputTypeOfTupleWithRest, OwnTypeProps, PathColumn, PluckResultColumnType, PointColumn, PolygonColumn, PormError, PormInternalError, Primitive, PropertyKeyUnionToArray, Query, QueryArraysResult, QueryBase, QueryCallbacks, QueryData, QueryGet, QueryInput, QueryLog, QueryLogObject, QueryLogOptions, QueryLogger, QueryMethods, QueryResult, QueryResultRow, QueryReturnType, QuerySelectAll, QueryUpsert, QueryWithTable, RawExpression, RealColumn, Relation, RelationQuery, RelationQueryBase, 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, SmallIntColumn, SmallSerialColumn, SortDir, Spread, Sql, StringColumn, StringExpression, StringKey, TableData, TableSchema, TextBaseColumn, TextColumn, TextColumnData, Then, ThenResult, TimeColumn, TimeInterval, TimeWithTimeZoneColumn, TimestampColumn, TimestampWithTimeZoneColumn, ToSqlCtx, Transaction, TransactionAdapter, TruncateQueryData, TsQueryColumn, TsVectorColumn, TypeParsers, UUIDColumn, UnhandledTypeError, Union, UnionArg, UnionItem, UnionToArray, UnionToIntersection, UnionToOvlds, UnknownKeysParam, Update, UpdateData, UpdateQueryData, UpsertData, UpsertResult, UpsertThis, ValidationContext, VarCharColumn, 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, applyMixins, array, arrayToEnum, baseObjectOutputType, columnTypes, utils as columnUtils, constructType, createDb, createOperator, defaultsKey, discriminatedUnion, emptyObject, enumType, flatten, getClonedQueryData, getColumnTypes, getQueryAs, getQueryParsers, getRaw, getTableData, getValidEnumValues, getValueKey, handleResult, identity, instanceOf, intersection, isRaw, isRequiredRelationKey, joinTruthy, jsonTypes, lazy, literal, logColors, logParamToLogObject, map, nativeEnum, newTableData, noop, notNullable, notNullish, nullable, nullish, object, optional, parseRecord, parseResult, processSelectArg, pushQueryArray, pushQueryOn, pushQueryOrOn, pushQueryValue, queryKeysOfNotSimpleQuery, queryMethodByReturnType, quote, raw, record, relationQueryKey, removeFromQuery, required, resetTableData, scalarTypes, set, setQueryObjectValue, toArray, toSql, tuple, union };
|