pqb 0.3.9 → 0.4.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.
- package/dist/index.d.ts +104 -84
- package/dist/index.esm.js +150 -121
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +150 -121
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/columnSchema/columnType.test.ts +1 -1
- package/src/db.test.ts +2 -2
- package/src/db.ts +9 -1
- package/src/errors.test.ts +79 -0
- package/src/errors.ts +43 -5
- package/src/query.ts +6 -0
- package/src/queryMethods/aggregate.test.ts +11 -11
- package/src/queryMethods/aggregate.ts +5 -3
- package/src/queryMethods/callbacks.test.ts +6 -6
- package/src/queryMethods/callbacks.ts +8 -8
- package/src/queryMethods/columnInfo.ts +13 -19
- package/src/queryMethods/{insert.test.ts → create.test.ts} +106 -98
- package/src/queryMethods/{insert.ts → create.ts} +129 -113
- package/src/queryMethods/delete.test.ts +2 -2
- package/src/queryMethods/get.test.ts +2 -2
- package/src/queryMethods/index.ts +1 -1
- package/src/queryMethods/json.test.ts +1 -1
- package/src/queryMethods/log.test.ts +29 -8
- package/src/queryMethods/merge.test.ts +3 -3
- package/src/queryMethods/queryMethods.test.ts +4 -4
- package/src/queryMethods/queryMethods.ts +3 -3
- package/src/queryMethods/select.test.ts +7 -7
- package/src/queryMethods/then.test.ts +1 -73
- package/src/queryMethods/then.ts +8 -7
- package/src/queryMethods/update.test.ts +8 -8
- package/src/queryMethods/update.ts +7 -7
- package/src/queryMethods/upsert.ts +3 -3
- package/src/queryMethods/window.test.ts +2 -2
- package/src/sql/insert.ts +31 -19
- package/src/sql/types.ts +3 -2
- package/src/test-utils.ts +4 -1
package/dist/index.d.ts
CHANGED
|
@@ -226,10 +226,10 @@ declare class QueryCallbacks {
|
|
|
226
226
|
_beforeQuery<T extends Query>(this: T, cb: BeforeCallback<T>): T;
|
|
227
227
|
afterQuery<T extends Query>(this: T, cb: AfterCallback<T>): T;
|
|
228
228
|
_afterQuery<T extends Query>(this: T, cb: AfterCallback<T>): T;
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
229
|
+
beforeCreate<T extends Query>(this: T, cb: BeforeCallback<T>): T;
|
|
230
|
+
_beforeCreate<T extends Query>(this: T, cb: BeforeCallback<T>): T;
|
|
231
|
+
afterCreate<T extends Query>(this: T, cb: AfterCallback<T>): T;
|
|
232
|
+
_afterCreate<T extends Query>(this: T, cb: AfterCallback<T>): T;
|
|
233
233
|
beforeUpdate<T extends Query>(this: T, cb: BeforeCallback<T>): T;
|
|
234
234
|
_beforeUpdate<T extends Query>(this: T, cb: BeforeCallback<T>): T;
|
|
235
235
|
afterUpdate<T extends Query>(this: T, cb: AfterCallback<T>): T;
|
|
@@ -299,6 +299,7 @@ declare type InsertQueryData = CommonQueryData & {
|
|
|
299
299
|
type: 'insert';
|
|
300
300
|
columns: string[];
|
|
301
301
|
values: unknown[][] | RawExpression;
|
|
302
|
+
fromQuery?: Query;
|
|
302
303
|
using?: JoinItem[];
|
|
303
304
|
join?: JoinItem[];
|
|
304
305
|
joinedParsers?: Record<string, ColumnsParsers>;
|
|
@@ -310,8 +311,8 @@ declare type InsertQueryData = CommonQueryData & {
|
|
|
310
311
|
expr?: OnConflictItem;
|
|
311
312
|
update?: OnConflictMergeUpdate;
|
|
312
313
|
};
|
|
313
|
-
|
|
314
|
-
|
|
314
|
+
beforeCreate?: BeforeCallback[];
|
|
315
|
+
afterCreate?: AfterCallback[];
|
|
315
316
|
};
|
|
316
317
|
declare type UpdateQueryDataObject = Record<string, RawExpression | {
|
|
317
318
|
op: string;
|
|
@@ -818,6 +819,50 @@ declare class OnQueryBuilder<S extends QueryBase = QueryBase, J extends QueryBas
|
|
|
818
819
|
_onJsonPathEquals<T extends this>(this: T, ...args: OnJsonPathEqualsArgs<T>): T;
|
|
819
820
|
}
|
|
820
821
|
|
|
822
|
+
declare class PormError extends Error {
|
|
823
|
+
}
|
|
824
|
+
declare type QueryErrorName = 'parseComplete' | 'bindComplete' | 'closeComplete' | 'noData' | 'portalSuspended' | 'replicationStart' | 'emptyQuery' | 'copyDone' | 'copyData' | 'rowDescription' | 'parameterDescription' | 'parameterStatus' | 'backendKeyData' | 'notification' | 'readyForQuery' | 'commandComplete' | 'dataRow' | 'copyInResponse' | 'copyOutResponse' | 'authenticationOk' | 'authenticationMD5Password' | 'authenticationCleartextPassword' | 'authenticationSASL' | 'authenticationSASLContinue' | 'authenticationSASLFinal' | 'error' | 'notice';
|
|
825
|
+
declare class QueryError<T extends {
|
|
826
|
+
shape: ColumnsShape;
|
|
827
|
+
} = {
|
|
828
|
+
shape: ColumnsShape;
|
|
829
|
+
}> extends DatabaseError {
|
|
830
|
+
message: string;
|
|
831
|
+
name: QueryErrorName;
|
|
832
|
+
stack: string | undefined;
|
|
833
|
+
code: string | undefined;
|
|
834
|
+
detail: string | undefined;
|
|
835
|
+
severity: string | undefined;
|
|
836
|
+
hint: string | undefined;
|
|
837
|
+
position: string | undefined;
|
|
838
|
+
internalPosition: string | undefined;
|
|
839
|
+
internalQuery: string | undefined;
|
|
840
|
+
where: string | undefined;
|
|
841
|
+
schema: string | undefined;
|
|
842
|
+
table: string | undefined;
|
|
843
|
+
column: string | undefined;
|
|
844
|
+
dataType: string | undefined;
|
|
845
|
+
constraint: string | undefined;
|
|
846
|
+
file: string | undefined;
|
|
847
|
+
line: string | undefined;
|
|
848
|
+
routine: string | undefined;
|
|
849
|
+
get isUnique(): boolean;
|
|
850
|
+
columnsCache?: {
|
|
851
|
+
[K in keyof T['shape']]?: true;
|
|
852
|
+
};
|
|
853
|
+
get columns(): T["shape"] extends infer T_1 ? { [K in keyof T_1]?: true | undefined; } : never;
|
|
854
|
+
}
|
|
855
|
+
declare class NotFoundError extends PormError {
|
|
856
|
+
constructor(message?: string);
|
|
857
|
+
}
|
|
858
|
+
declare class MoreThanOneRowError extends PormError {
|
|
859
|
+
}
|
|
860
|
+
declare class PormInternalError extends Error {
|
|
861
|
+
}
|
|
862
|
+
declare class UnhandledTypeError extends PormInternalError {
|
|
863
|
+
constructor(value: never);
|
|
864
|
+
}
|
|
865
|
+
|
|
821
866
|
declare type DbTableOptions = {
|
|
822
867
|
schema?: string;
|
|
823
868
|
} & QueryLogOptions;
|
|
@@ -858,6 +903,7 @@ interface Db<Table extends string | undefined = undefined, Shape extends Columns
|
|
|
858
903
|
columnsParsers?: ColumnsParsers;
|
|
859
904
|
relations: Relations;
|
|
860
905
|
withData: Query['withData'];
|
|
906
|
+
error: new (message: string, length: number, name: QueryErrorName) => QueryError<this>;
|
|
861
907
|
[defaultsKey]: Record<{
|
|
862
908
|
[K in keyof Shape]: Shape[K]['hasDefault'] extends true ? K : never;
|
|
863
909
|
}[keyof Shape], true>;
|
|
@@ -974,18 +1020,18 @@ declare class Json {
|
|
|
974
1020
|
}): JsonPathQueryResult<T, As, Type>;
|
|
975
1021
|
}
|
|
976
1022
|
|
|
977
|
-
declare type
|
|
1023
|
+
declare type CreateData<T extends Query, DefaultKeys extends PropertyKey = keyof T[defaultsKey], Data = SetOptional<T['inputType'], DefaultKeys>> = [keyof T['relations']] extends [never] ? Data : OmitBelongsToForeignKeys<T['relations'], Data> & CreateRelationData<T>;
|
|
978
1024
|
declare type OmitBelongsToForeignKeys<R extends RelationsBase, Data> = Omit<Data, {
|
|
979
1025
|
[K in keyof R]: R[K] extends BelongsToRelation ? R[K]['options']['foreignKey'] : never;
|
|
980
1026
|
}[keyof R]>;
|
|
981
|
-
declare type
|
|
982
|
-
[K in keyof T['relations']]: T['relations'][K] extends BelongsToRelation ?
|
|
1027
|
+
declare type CreateRelationData<T extends Query> = {
|
|
1028
|
+
[K in keyof T['relations']]: T['relations'][K] extends BelongsToRelation ? CreateBelongsToData<T, K, T['relations'][K]> : T['relations'][K] extends HasOneRelation ? CreateHasOneData<T, K, T['relations'][K]> : T['relations'][K] extends HasManyRelation | HasAndBelongsToManyRelation ? CreateHasManyData<T, K, T['relations'][K]> : EmptyObject;
|
|
983
1029
|
}[keyof T['relations']];
|
|
984
|
-
declare type
|
|
1030
|
+
declare type CreateBelongsToData<T extends Query, Key extends keyof T['relations'], Rel extends BelongsToRelation> = SetOptional<{
|
|
985
1031
|
[K in Rel['options']['foreignKey']]: Rel['options']['foreignKey'] extends keyof T['inputType'] ? T['inputType'][Rel['options']['foreignKey']] : never;
|
|
986
1032
|
}, keyof T[defaultsKey]> | {
|
|
987
1033
|
[K in Key]: {
|
|
988
|
-
create:
|
|
1034
|
+
create: CreateData<Rel['nestedCreateQuery']>;
|
|
989
1035
|
connect?: never;
|
|
990
1036
|
connectOrCreate?: never;
|
|
991
1037
|
} | {
|
|
@@ -997,13 +1043,13 @@ declare type InsertBelongsToData<T extends Query, Key extends keyof T['relations
|
|
|
997
1043
|
connect?: never;
|
|
998
1044
|
connectOrCreate: {
|
|
999
1045
|
where: WhereArg<Rel['model']>;
|
|
1000
|
-
create:
|
|
1046
|
+
create: CreateData<Rel['nestedCreateQuery']>;
|
|
1001
1047
|
};
|
|
1002
1048
|
};
|
|
1003
1049
|
};
|
|
1004
|
-
declare type
|
|
1050
|
+
declare type CreateHasOneData<T extends Query, Key extends keyof T['relations'], Rel extends HasOneRelation> = 'through' extends Rel['options'] ? {} : {
|
|
1005
1051
|
[K in Key]?: {
|
|
1006
|
-
create:
|
|
1052
|
+
create: CreateData<Rel['nestedCreateQuery']>;
|
|
1007
1053
|
connect?: never;
|
|
1008
1054
|
connectOrCreate?: never;
|
|
1009
1055
|
} | {
|
|
@@ -1015,44 +1061,48 @@ declare type InsertHasOneData<T extends Query, Key extends keyof T['relations'],
|
|
|
1015
1061
|
connect?: never;
|
|
1016
1062
|
connectOrCreate: {
|
|
1017
1063
|
where?: WhereArg<Rel['model']>;
|
|
1018
|
-
create?:
|
|
1064
|
+
create?: CreateData<Rel['nestedCreateQuery']>;
|
|
1019
1065
|
};
|
|
1020
1066
|
};
|
|
1021
1067
|
};
|
|
1022
|
-
declare type
|
|
1068
|
+
declare type CreateHasManyData<T extends Query, Key extends keyof T['relations'], Rel extends HasManyRelation | HasAndBelongsToManyRelation> = 'through' extends Rel['options'] ? {} : {
|
|
1023
1069
|
[K in Key]?: {
|
|
1024
|
-
create?:
|
|
1070
|
+
create?: CreateData<Rel['nestedCreateQuery']>[];
|
|
1025
1071
|
connect?: WhereArg<Rel['model']>[];
|
|
1026
1072
|
connectOrCreate?: {
|
|
1027
1073
|
where: WhereArg<Rel['model']>;
|
|
1028
|
-
create:
|
|
1074
|
+
create: CreateData<Rel['nestedCreateQuery']>;
|
|
1029
1075
|
}[];
|
|
1030
1076
|
};
|
|
1031
1077
|
};
|
|
1032
|
-
declare type
|
|
1078
|
+
declare type CreateResult<T extends Query> = T extends {
|
|
1079
|
+
isCount: true;
|
|
1080
|
+
} ? T : QueryReturnsAll<T['returnType']> extends true ? SetQueryReturnsOne<T> : T;
|
|
1081
|
+
declare type CreateManyResult<T extends Query> = T extends {
|
|
1082
|
+
isCount: true;
|
|
1083
|
+
} ? T : T['returnType'] extends 'one' | 'oneOrThrow' ? SetQueryReturnsAll<T> : T;
|
|
1084
|
+
declare type CreateRawData = {
|
|
1033
1085
|
columns: string[];
|
|
1034
1086
|
values: RawExpression;
|
|
1035
1087
|
};
|
|
1036
|
-
declare type InsertOneResult<T extends Query> = T['hasSelect'] extends true ? QueryReturnsAll<T['returnType']> extends true ? SetQueryReturnsOne<T> : T['returnType'] extends 'one' ? SetQueryReturnsOne<T> : T : SetQueryReturnsRowCount<T>;
|
|
1037
|
-
declare type InsertManyResult<T extends Query> = T['hasSelect'] extends true ? T['returnType'] extends 'one' | 'oneOrThrow' ? SetQueryReturnsAll<T> : T : SetQueryReturnsRowCount<T>;
|
|
1038
1088
|
declare type OnConflictArg<T extends Query> = keyof T['shape'] | (keyof T['shape'])[] | RawExpression;
|
|
1039
|
-
declare class
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
defaults<T extends Query, Data extends Partial<
|
|
1089
|
+
declare class Create {
|
|
1090
|
+
create<T extends Query>(this: T, data: CreateData<T>): CreateResult<T>;
|
|
1091
|
+
_create<T extends Query>(this: T, data: CreateData<T>): CreateResult<T>;
|
|
1092
|
+
createMany<T extends Query>(this: T, data: CreateData<T>[]): CreateManyResult<T>;
|
|
1093
|
+
_createMany<T extends Query>(this: T, data: CreateData<T>[]): CreateManyResult<T>;
|
|
1094
|
+
createRaw<T extends Query>(this: T, data: CreateRawData): CreateManyResult<T>;
|
|
1095
|
+
_createRaw<T extends Query>(this: T, data: CreateRawData): CreateManyResult<T>;
|
|
1096
|
+
createFrom<T extends Query, Q extends Query & {
|
|
1097
|
+
returnType: 'one' | 'oneOrThrow';
|
|
1098
|
+
}>(this: T, query: Q, data: Omit<CreateData<T>, keyof Q['result']>): SetQueryReturnsOne<T>;
|
|
1099
|
+
_createFrom<T extends Query, Q extends Query & {
|
|
1100
|
+
returnType: 'one' | 'oneOrThrow';
|
|
1101
|
+
}>(this: T, query: Q, data: Omit<CreateData<T>, keyof Q['result']>): SetQueryReturnsOne<T>;
|
|
1102
|
+
defaults<T extends Query, Data extends Partial<CreateData<T>>>(this: T, data: Data): T & {
|
|
1053
1103
|
[defaultsKey]: Record<keyof Data, true>;
|
|
1054
1104
|
};
|
|
1055
|
-
_defaults<T extends Query, Data extends Partial<
|
|
1105
|
+
_defaults<T extends Query, Data extends Partial<CreateData<T>>>(this: T, data: Data): T & {
|
|
1056
1106
|
[defaultsKey]: Record<keyof Data, true>;
|
|
1057
1107
|
};
|
|
1058
1108
|
onConflict<T extends Query, Arg extends OnConflictArg<T>>(this: T, arg?: Arg): OnConflictQueryBuilder<T, Arg>;
|
|
@@ -1082,11 +1132,11 @@ declare type UpdateBelongsToData<T extends Query, Rel extends BelongsToRelation>
|
|
|
1082
1132
|
} | {
|
|
1083
1133
|
update: UpdateData<Rel['model']>;
|
|
1084
1134
|
} | {
|
|
1085
|
-
create:
|
|
1135
|
+
create: CreateData<Rel['nestedCreateQuery']>;
|
|
1086
1136
|
} | (QueryReturnsAll<T['returnType']> extends true ? never : {
|
|
1087
1137
|
upsert: {
|
|
1088
1138
|
update: UpdateData<Rel['model']>;
|
|
1089
|
-
create:
|
|
1139
|
+
create: CreateData<Rel['nestedCreateQuery']>;
|
|
1090
1140
|
};
|
|
1091
1141
|
});
|
|
1092
1142
|
declare type UpdateHasOneData<T extends Query, Rel extends HasOneRelation> = {
|
|
@@ -1100,10 +1150,10 @@ declare type UpdateHasOneData<T extends Query, Rel extends HasOneRelation> = {
|
|
|
1100
1150
|
} | {
|
|
1101
1151
|
upsert: {
|
|
1102
1152
|
update: UpdateData<Rel['model']>;
|
|
1103
|
-
create:
|
|
1153
|
+
create: CreateData<Rel['nestedCreateQuery']>;
|
|
1104
1154
|
};
|
|
1105
1155
|
} | {
|
|
1106
|
-
create:
|
|
1156
|
+
create: CreateData<Rel['nestedCreateQuery']>;
|
|
1107
1157
|
});
|
|
1108
1158
|
declare type UpdateHasManyData<T extends Query, Rel extends HasManyRelation> = {
|
|
1109
1159
|
disconnect?: MaybeArray<WhereArg<Rel['model']>>;
|
|
@@ -1114,7 +1164,7 @@ declare type UpdateHasManyData<T extends Query, Rel extends HasManyRelation> = {
|
|
|
1114
1164
|
};
|
|
1115
1165
|
} & (QueryReturnsAll<T['returnType']> extends true ? EmptyObject : {
|
|
1116
1166
|
set?: MaybeArray<WhereArg<Rel['model']>>;
|
|
1117
|
-
create?:
|
|
1167
|
+
create?: CreateData<Rel['nestedCreateQuery']>[];
|
|
1118
1168
|
});
|
|
1119
1169
|
declare type UpdateHasAndBelongsToManyData<Rel extends HasAndBelongsToManyRelation> = {
|
|
1120
1170
|
disconnect?: MaybeArray<WhereArg<Rel['model']>>;
|
|
@@ -1124,7 +1174,7 @@ declare type UpdateHasAndBelongsToManyData<Rel extends HasAndBelongsToManyRelati
|
|
|
1124
1174
|
where: MaybeArray<WhereArg<Rel['model']>>;
|
|
1125
1175
|
data: UpdateData<Rel['model']>;
|
|
1126
1176
|
};
|
|
1127
|
-
create?:
|
|
1177
|
+
create?: CreateData<Rel['nestedCreateQuery']>[];
|
|
1128
1178
|
};
|
|
1129
1179
|
declare type UpdateArgs<T extends Query, ForceAll extends boolean> = (T['hasWhere'] extends true ? true : ForceAll) extends true ? [update: UpdateData<T>] : [update: UpdateData<T>, forceAll: true];
|
|
1130
1180
|
declare type UpdateRawArgs<T extends Query, ForceAll extends boolean> = (T['hasWhere'] extends true ? true : ForceAll) extends true ? [update: RawExpression] : [update: RawExpression, forceAll: true];
|
|
@@ -1222,7 +1272,7 @@ declare class Window {
|
|
|
1222
1272
|
|
|
1223
1273
|
declare type UpsertData<T extends Query> = {
|
|
1224
1274
|
update: UpdateData<T>;
|
|
1225
|
-
create:
|
|
1275
|
+
create: CreateData<T>;
|
|
1226
1276
|
};
|
|
1227
1277
|
declare type UpsertResult<T extends Query> = T['hasSelect'] extends true ? SetQueryReturnsOne<T> : SetQueryReturnsVoid<T>;
|
|
1228
1278
|
declare type UpsertThis = WhereResult<Query> & {
|
|
@@ -1261,7 +1311,7 @@ declare type OrderArg<T extends Query> = keyof T['selectable'] | {
|
|
|
1261
1311
|
nulls: 'FIRST' | 'LAST';
|
|
1262
1312
|
};
|
|
1263
1313
|
} | RawExpression;
|
|
1264
|
-
interface QueryMethods extends Aggregate, Select, From, Join, With, Union, Json,
|
|
1314
|
+
interface QueryMethods extends Aggregate, Select, From, Join, With, Union, Json, Create, Update, Delete, Transaction, For, ColumnInfoMethods, Where, Clear, Having, Window, Then, QueryLog, QueryCallbacks, QueryUpsert, QueryGet, MergeQueryMethods {
|
|
1265
1315
|
}
|
|
1266
1316
|
declare class QueryMethods {
|
|
1267
1317
|
windows: EmptyObject;
|
|
@@ -1366,8 +1416,12 @@ declare type WindowFunctionOptions<T extends Query = Query, As extends string |
|
|
|
1366
1416
|
declare class Aggregate {
|
|
1367
1417
|
selectAgg<T extends Query, Func extends string, As extends string | undefined, Value extends ColumnType>(this: T, functionName: Func, arg: AggregateArg<T>, options?: AggregateOptions<T, As>): SelectAgg<T, Func, As, Value>;
|
|
1368
1418
|
_selectAgg<T extends Query, Func extends string, As extends string | undefined, Value extends ColumnType>(this: T, functionName: Func, arg: AggregateArg<T>, options?: AggregateOptions<T, As>, columnType?: ColumnType): SelectAgg<T, Func, As, Value>;
|
|
1369
|
-
count<T extends Query>(this: T, arg?: AT1<T>['count'] | '*', options?: AggregateOptions<T>): SetQueryReturnsValue<T, NumberColumn
|
|
1370
|
-
|
|
1419
|
+
count<T extends Query>(this: T, arg?: AT1<T>['count'] | '*', options?: AggregateOptions<T>): SetQueryReturnsValue<T, NumberColumn> & {
|
|
1420
|
+
isCount: true;
|
|
1421
|
+
};
|
|
1422
|
+
_count<T extends Query>(this: T, arg?: AT1<T>['count'] | '*', options?: AggregateOptions<T>): SetQueryReturnsValue<T, NumberColumn> & {
|
|
1423
|
+
isCount: true;
|
|
1424
|
+
};
|
|
1371
1425
|
selectCount<T extends Query, As extends string | undefined = undefined>(this: T, arg?: AT1<T>['count'] | '*', options?: AggregateOptions<T, As>): SelectAgg<T, 'count', As, NumberColumn>;
|
|
1372
1426
|
_selectCount<T extends Query, As extends string | undefined = undefined>(this: T, arg?: AT1<T>['count'] | '*', options?: AggregateOptions<T, As>): SelectAgg<T, 'count', As, NumberColumn>;
|
|
1373
1427
|
avg<T extends Query>(this: T, arg: Aggregate1ArgumentTypes<T>['avg'], options?: AggregateOptions<T>): SetQueryReturnsValue<T, NullableColumn<NumberColumn>>;
|
|
@@ -1496,6 +1550,7 @@ declare type Query = QueryMethods & {
|
|
|
1496
1550
|
columnsParsers?: ColumnsParsers;
|
|
1497
1551
|
relations: RelationsBase;
|
|
1498
1552
|
withData: WithDataBase;
|
|
1553
|
+
error: new (message: string, length: number, name: QueryErrorName) => QueryError;
|
|
1499
1554
|
[defaultsKey]: {};
|
|
1500
1555
|
};
|
|
1501
1556
|
declare type Selectable<T extends QueryBase> = StringKey<keyof T['selectable']>;
|
|
@@ -4037,9 +4092,9 @@ declare const jsonTypes: {
|
|
|
4037
4092
|
nativeEnum: <T_6 extends EnumLike>(givenEnum: T_6) => JSONNativeEnum<T_6>;
|
|
4038
4093
|
nullable: <T_7 extends JSONTypeAny>(type: T_7) => JSONNullable<T_7>;
|
|
4039
4094
|
nullish: <T_8 extends JSONTypeAny>(type: T_8) => JSONNullish<T_8>;
|
|
4040
|
-
object: <T_9 extends JSONObjectShape, UnknownKeys extends UnknownKeysParam = "strip", Catchall extends JSONTypeAny = JSONTypeAny>(shape: T_9) => JSONObject<T_9, UnknownKeys, Catchall, JSONTypeAny extends Catchall ? addQuestionMarks<{ [k_1 in keyof T_9]: T_9[k_1]["type"]; }> extends infer T_10
|
|
4095
|
+
object: <T_9 extends JSONObjectShape, UnknownKeys extends UnknownKeysParam = "strip", Catchall extends JSONTypeAny = JSONTypeAny>(shape: T_9) => JSONObject<T_9, UnknownKeys, Catchall, JSONTypeAny extends Catchall ? addQuestionMarks<{ [k_1 in keyof T_9]: T_9[k_1]["type"]; }> extends infer T_10 ? { [k in keyof T_10]: addQuestionMarks<{ [k_1 in keyof T_9]: T_9[k_1]["type"]; }>[k]; } : never : (addQuestionMarks<{ [k_1 in keyof T_9]: T_9[k_1]["type"]; }> extends infer T_10 ? { [k in keyof T_10]: addQuestionMarks<{ [k_1 in keyof T_9]: T_9[k_1]["type"]; }>[k]; } : never) & {
|
|
4041
4096
|
[k: string]: Catchall["type"];
|
|
4042
|
-
} extends infer T_11
|
|
4097
|
+
} extends infer T_11 ? { [k_2 in keyof T_11]: ((addQuestionMarks<{ [k_1 in keyof T_9]: T_9[k_1]["type"]; }> extends infer T_10 ? { [k in keyof T_10]: addQuestionMarks<{ [k_1 in keyof T_9]: T_9[k_1]["type"]; }>[k]; } : never) & {
|
|
4043
4098
|
[k: string]: Catchall["type"];
|
|
4044
4099
|
})[k_2]; } : never>;
|
|
4045
4100
|
optional: <T_12 extends JSONTypeAny>(type: T_12) => JSONOptional<T_12>;
|
|
@@ -4259,39 +4314,4 @@ declare const setQueryObjectValue: <T extends {
|
|
|
4259
4314
|
query: QueryData;
|
|
4260
4315
|
}>(q: T, object: string, key: string, value: unknown) => T;
|
|
4261
4316
|
|
|
4262
|
-
|
|
4263
|
-
}
|
|
4264
|
-
declare class QueryError extends DatabaseError {
|
|
4265
|
-
message: string;
|
|
4266
|
-
code: string | undefined;
|
|
4267
|
-
detail: string | undefined;
|
|
4268
|
-
severity: string | undefined;
|
|
4269
|
-
hint: string | undefined;
|
|
4270
|
-
position: string | undefined;
|
|
4271
|
-
internalPosition: string | undefined;
|
|
4272
|
-
internalQuery: string | undefined;
|
|
4273
|
-
where: string | undefined;
|
|
4274
|
-
schema: string | undefined;
|
|
4275
|
-
table: string | undefined;
|
|
4276
|
-
column: string | undefined;
|
|
4277
|
-
dataType: string | undefined;
|
|
4278
|
-
constraint: string | undefined;
|
|
4279
|
-
file: string | undefined;
|
|
4280
|
-
line: string | undefined;
|
|
4281
|
-
routine: string | undefined;
|
|
4282
|
-
get isUnique(): boolean;
|
|
4283
|
-
columnsCache?: Record<string, boolean>;
|
|
4284
|
-
get columns(): Record<string, boolean>;
|
|
4285
|
-
}
|
|
4286
|
-
declare class NotFoundError extends PormError {
|
|
4287
|
-
constructor(message?: string);
|
|
4288
|
-
}
|
|
4289
|
-
declare class MoreThanOneRowError extends PormError {
|
|
4290
|
-
}
|
|
4291
|
-
declare class PormInternalError extends Error {
|
|
4292
|
-
}
|
|
4293
|
-
declare class UnhandledTypeError extends PormInternalError {
|
|
4294
|
-
constructor(value: never);
|
|
4295
|
-
}
|
|
4296
|
-
|
|
4297
|
-
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, 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, MergeQuery, MergeQueryMethods, MoneyColumn, MoreThanOneRowError, NestedInsertItem, NestedInsertManyItems, NestedInsertOneItem, NestedUpdateItem, NestedUpdateManyItems, NestedUpdateOneItem, 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, QueryGet, QueryInput, QueryLog, QueryLogObject, QueryLogOptions, QueryLogger, QueryMethods, QueryResult, QueryResultRow, QueryReturnType, QueryReturnsAll, QuerySelectAll, QueryThen, 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, 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, UnknownKeysParam, Update, UpdateData, UpdateQueryData, UpdateQueryDataItem, UpdateQueryDataObject, UpdatedAtDataInjector, 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, checkIfASimpleQuery, 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, isRaw, isRequiredRelationKey, joinTruthy, jsonTypes, lazy, literal, logColors, logParamToLogObject, makeRegexToFindInSql, 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 };
|
|
4317
|
+
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, Create, CreateData, 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, HasAndBelongsToManyRelation, HasManyNestedInsert, HasManyNestedUpdate, HasManyRelation, HasOneNestedInsert, HasOneNestedUpdate, 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, NestedInsertItem, NestedInsertManyItems, NestedInsertOneItem, NestedUpdateItem, NestedUpdateManyItems, NestedUpdateOneItem, 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, 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, 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, UnknownKeysParam, Update, UpdateData, UpdateQueryData, UpdateQueryDataItem, UpdateQueryDataObject, UpdatedAtDataInjector, 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, checkIfASimpleQuery, 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, isRaw, isRequiredRelationKey, joinTruthy, jsonTypes, lazy, literal, logColors, logParamToLogObject, makeRegexToFindInSql, 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 };
|