pqb 0.5.8 → 0.5.9
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 +8 -6
- package/dist/index.esm.js +79 -29
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +79 -28
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/sql/columnInfo.ts +1 -1
- package/src/sql/data.ts +183 -0
- package/src/sql/delete.ts +1 -1
- package/src/sql/distinct.ts +1 -1
- package/src/sql/fromAndAs.ts +2 -1
- package/src/sql/having.ts +2 -1
- package/src/sql/index.ts +1 -0
- package/src/sql/insert.ts +1 -1
- package/src/sql/join.ts +2 -1
- package/src/sql/orderBy.ts +2 -1
- package/src/sql/select.ts +2 -6
- package/src/sql/toSql.ts +2 -1
- package/src/sql/truncate.ts +1 -1
- package/src/sql/types.ts +5 -142
- package/src/sql/update.ts +5 -5
- package/src/sql/where.ts +1 -1
- package/src/sql/with.ts +1 -1
- package/src/utils.ts +5 -11
package/dist/index.d.ts
CHANGED
|
@@ -203,11 +203,6 @@ declare class TransactionAdapter implements Adapter {
|
|
|
203
203
|
close(): Promise<void>;
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
declare type Sql = {
|
|
207
|
-
text: string;
|
|
208
|
-
values: unknown[];
|
|
209
|
-
};
|
|
210
|
-
declare const checkIfASimpleQuery: (q: QueryData) => boolean;
|
|
211
206
|
declare type CommonQueryData = {
|
|
212
207
|
adapter: Adapter;
|
|
213
208
|
handleResult(q: Query, result: QueryResult): Promise<unknown>;
|
|
@@ -307,6 +302,13 @@ declare type ColumnInfoQueryData = CommonQueryData & {
|
|
|
307
302
|
column?: string;
|
|
308
303
|
};
|
|
309
304
|
declare type QueryData = SelectQueryData | InsertQueryData | UpdateQueryData | DeleteQueryData | TruncateQueryData | ColumnInfoQueryData;
|
|
305
|
+
declare const cloneQueryArrays: (q: QueryData) => void;
|
|
306
|
+
|
|
307
|
+
declare type Sql = {
|
|
308
|
+
text: string;
|
|
309
|
+
values: unknown[];
|
|
310
|
+
};
|
|
311
|
+
declare const checkIfASimpleQuery: (q: QueryData) => boolean;
|
|
310
312
|
declare type WithItem = [
|
|
311
313
|
as: string,
|
|
312
314
|
options: WithOptions,
|
|
@@ -4349,4 +4351,4 @@ declare const setQueryObjectValue: <T extends {
|
|
|
4349
4351
|
query: QueryData;
|
|
4350
4352
|
}>(q: T, object: string, key: string, value: unknown) => T;
|
|
4351
4353
|
|
|
4352
|
-
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, 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, 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, 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, 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, anyShape, 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, 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 };
|
|
4354
|
+
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, 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, 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, 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, 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, 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 };
|
package/dist/index.esm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { DatabaseError, types, Pool } from 'pg';
|
|
2
2
|
|
|
3
3
|
var __defProp$q = Object.defineProperty;
|
|
4
|
-
var __defProps$
|
|
5
|
-
var __getOwnPropDescs$
|
|
4
|
+
var __defProps$k = Object.defineProperties;
|
|
5
|
+
var __getOwnPropDescs$k = Object.getOwnPropertyDescriptors;
|
|
6
6
|
var __getOwnPropSymbols$r = Object.getOwnPropertySymbols;
|
|
7
7
|
var __hasOwnProp$r = Object.prototype.hasOwnProperty;
|
|
8
8
|
var __propIsEnum$r = Object.prototype.propertyIsEnumerable;
|
|
@@ -18,10 +18,10 @@ var __spreadValues$q = (a, b) => {
|
|
|
18
18
|
}
|
|
19
19
|
return a;
|
|
20
20
|
};
|
|
21
|
-
var __spreadProps$
|
|
21
|
+
var __spreadProps$k = (a, b) => __defProps$k(a, __getOwnPropDescs$k(b));
|
|
22
22
|
const addColumnData = (q, key, value) => {
|
|
23
23
|
const cloned = Object.create(q);
|
|
24
|
-
cloned.data = __spreadProps$
|
|
24
|
+
cloned.data = __spreadProps$k(__spreadValues$q({}, q.data), { [key]: value });
|
|
25
25
|
return cloned;
|
|
26
26
|
};
|
|
27
27
|
class ColumnType {
|
|
@@ -39,11 +39,11 @@ class ColumnType {
|
|
|
39
39
|
foreignKey(fnOrTable, column, options = {}) {
|
|
40
40
|
const cloned = Object.create(this);
|
|
41
41
|
if (typeof fnOrTable === "string") {
|
|
42
|
-
cloned.data = __spreadProps$
|
|
42
|
+
cloned.data = __spreadProps$k(__spreadValues$q({}, this.data), {
|
|
43
43
|
foreignKey: __spreadValues$q({ table: fnOrTable, columns: [column] }, options)
|
|
44
44
|
});
|
|
45
45
|
} else {
|
|
46
|
-
cloned.data = __spreadProps$
|
|
46
|
+
cloned.data = __spreadProps$k(__spreadValues$q({}, this.data), {
|
|
47
47
|
foreignKey: __spreadValues$q({ fn: fnOrTable, columns: [column] }, options)
|
|
48
48
|
});
|
|
49
49
|
}
|
|
@@ -79,7 +79,7 @@ class ColumnType {
|
|
|
79
79
|
return addColumnData(this, "index", options);
|
|
80
80
|
}
|
|
81
81
|
unique(options = {}) {
|
|
82
|
-
return addColumnData(this, "index", __spreadProps$
|
|
82
|
+
return addColumnData(this, "index", __spreadProps$k(__spreadValues$q({}, options), { unique: true }));
|
|
83
83
|
}
|
|
84
84
|
comment(comment) {
|
|
85
85
|
return addColumnData(this, "comment", comment);
|
|
@@ -197,8 +197,8 @@ const addValue = (values, value) => {
|
|
|
197
197
|
};
|
|
198
198
|
|
|
199
199
|
var __defProp$p = Object.defineProperty;
|
|
200
|
-
var __defProps$
|
|
201
|
-
var __getOwnPropDescs$
|
|
200
|
+
var __defProps$j = Object.defineProperties;
|
|
201
|
+
var __getOwnPropDescs$j = Object.getOwnPropertyDescriptors;
|
|
202
202
|
var __getOwnPropSymbols$q = Object.getOwnPropertySymbols;
|
|
203
203
|
var __hasOwnProp$q = Object.prototype.hasOwnProperty;
|
|
204
204
|
var __propIsEnum$q = Object.prototype.propertyIsEnumerable;
|
|
@@ -214,7 +214,7 @@ var __spreadValues$p = (a, b) => {
|
|
|
214
214
|
}
|
|
215
215
|
return a;
|
|
216
216
|
};
|
|
217
|
-
var __spreadProps$
|
|
217
|
+
var __spreadProps$j = (a, b) => __defProps$j(a, __getOwnPropDescs$j(b));
|
|
218
218
|
const createOperator = (fn) => {
|
|
219
219
|
return Object.assign(fn, { type: void 0 });
|
|
220
220
|
};
|
|
@@ -300,14 +300,14 @@ const base = () => ({
|
|
|
300
300
|
in: all.in(),
|
|
301
301
|
notIn: all.notIn()
|
|
302
302
|
});
|
|
303
|
-
const numeric = () => __spreadProps$
|
|
303
|
+
const numeric = () => __spreadProps$j(__spreadValues$p({}, base()), {
|
|
304
304
|
lt: all.lt(),
|
|
305
305
|
lte: all.lte(),
|
|
306
306
|
gt: all.gt(),
|
|
307
307
|
gte: all.gte(),
|
|
308
308
|
between: all.between()
|
|
309
309
|
});
|
|
310
|
-
const text = () => __spreadProps$
|
|
310
|
+
const text = () => __spreadProps$j(__spreadValues$p({}, base()), {
|
|
311
311
|
contains: all.contains(),
|
|
312
312
|
containsInsensitive: all.containsInsensitive(),
|
|
313
313
|
startsWith: all.startsWith(),
|
|
@@ -315,7 +315,7 @@ const text = () => __spreadProps$k(__spreadValues$p({}, base()), {
|
|
|
315
315
|
endsWith: all.endsWith(),
|
|
316
316
|
endsWithInsensitive: all.endsWithInsensitive()
|
|
317
317
|
});
|
|
318
|
-
const json = () => __spreadProps$
|
|
318
|
+
const json = () => __spreadProps$j(__spreadValues$p({}, base()), {
|
|
319
319
|
jsonPath: all.jsonPath(),
|
|
320
320
|
jsonSupersetOf: all.jsonSupersetOf(),
|
|
321
321
|
jsonSubsetOf: all.jsonSubsetOf()
|
|
@@ -691,8 +691,8 @@ const pushIn = (ands, prefix, quotedAs, values, arg) => {
|
|
|
691
691
|
};
|
|
692
692
|
|
|
693
693
|
var __defProp$o = Object.defineProperty;
|
|
694
|
-
var __defProps$
|
|
695
|
-
var __getOwnPropDescs$
|
|
694
|
+
var __defProps$i = Object.defineProperties;
|
|
695
|
+
var __getOwnPropDescs$i = Object.getOwnPropertyDescriptors;
|
|
696
696
|
var __getOwnPropSymbols$p = Object.getOwnPropertySymbols;
|
|
697
697
|
var __hasOwnProp$p = Object.prototype.hasOwnProperty;
|
|
698
698
|
var __propIsEnum$p = Object.prototype.propertyIsEnumerable;
|
|
@@ -708,11 +708,11 @@ var __spreadValues$o = (a, b) => {
|
|
|
708
708
|
}
|
|
709
709
|
return a;
|
|
710
710
|
};
|
|
711
|
-
var __spreadProps$
|
|
711
|
+
var __spreadProps$i = (a, b) => __defProps$i(a, __getOwnPropDescs$i(b));
|
|
712
712
|
const aggregateToSql = (ctx, model, item, quotedAs) => {
|
|
713
713
|
var _a;
|
|
714
714
|
const sql = [`${item.function}(`];
|
|
715
|
-
ctx = __spreadProps$
|
|
715
|
+
ctx = __spreadProps$i(__spreadValues$o({}, ctx), { sql });
|
|
716
716
|
const options = item.options || EMPTY_OBJECT;
|
|
717
717
|
if (options.distinct && !options.withinGroup)
|
|
718
718
|
sql.push("DISTINCT ");
|
|
@@ -1429,9 +1429,65 @@ const makeSql = (model, { values = [] } = {}) => {
|
|
|
1429
1429
|
return { text: sql.join(" "), values };
|
|
1430
1430
|
};
|
|
1431
1431
|
|
|
1432
|
+
const cloneQueryArrays = (q) => {
|
|
1433
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
1434
|
+
if (q.with)
|
|
1435
|
+
q.with = (_a = q.with) == null ? void 0 : _a.slice(0);
|
|
1436
|
+
if (q.select)
|
|
1437
|
+
q.select = (_b = q.select) == null ? void 0 : _b.slice(0);
|
|
1438
|
+
if (q.and)
|
|
1439
|
+
q.and = (_c = q.and) == null ? void 0 : _c.slice(0);
|
|
1440
|
+
if (q.or)
|
|
1441
|
+
q.or = (_d = q.or) == null ? void 0 : _d.slice(0);
|
|
1442
|
+
if (q.beforeQuery)
|
|
1443
|
+
q.beforeQuery = (_e = q.beforeQuery) == null ? void 0 : _e.slice(0);
|
|
1444
|
+
if (q.afterQuery)
|
|
1445
|
+
q.afterQuery = (_f = q.afterQuery) == null ? void 0 : _f.slice(0);
|
|
1446
|
+
q.updateData = (_g = q.updateData) == null ? void 0 : _g.slice(
|
|
1447
|
+
0
|
|
1448
|
+
);
|
|
1449
|
+
if (q.type === void 0) {
|
|
1450
|
+
if (q.distinct)
|
|
1451
|
+
q.distinct = (_h = q.distinct) == null ? void 0 : _h.slice(0);
|
|
1452
|
+
if (q.join)
|
|
1453
|
+
q.join = (_i = q.join) == null ? void 0 : _i.slice(0);
|
|
1454
|
+
if (q.group)
|
|
1455
|
+
q.group = (_j = q.group) == null ? void 0 : _j.slice(0);
|
|
1456
|
+
if (q.having)
|
|
1457
|
+
q.having = (_k = q.having) == null ? void 0 : _k.slice(0);
|
|
1458
|
+
if (q.havingOr)
|
|
1459
|
+
q.havingOr = (_l = q.havingOr) == null ? void 0 : _l.slice(0);
|
|
1460
|
+
if (q.window)
|
|
1461
|
+
q.window = (_m = q.window) == null ? void 0 : _m.slice(0);
|
|
1462
|
+
if (q.union)
|
|
1463
|
+
q.union = (_n = q.union) == null ? void 0 : _n.slice(0);
|
|
1464
|
+
if (q.order)
|
|
1465
|
+
q.order = (_o = q.order) == null ? void 0 : _o.slice(0);
|
|
1466
|
+
} else if (q.type === "insert") {
|
|
1467
|
+
q.columns = (_p = q.columns) == null ? void 0 : _p.slice(0);
|
|
1468
|
+
q.values = Array.isArray(q.values) ? q.values.slice(0) : q.values;
|
|
1469
|
+
if (q.using)
|
|
1470
|
+
q.using = (_q = q.using) == null ? void 0 : _q.slice(0);
|
|
1471
|
+
if (q.join)
|
|
1472
|
+
q.join = (_r = q.join) == null ? void 0 : _r.slice(0);
|
|
1473
|
+
if (q.beforeCreate)
|
|
1474
|
+
q.beforeCreate = (_s = q.beforeCreate) == null ? void 0 : _s.slice(0);
|
|
1475
|
+
if (q.afterCreate)
|
|
1476
|
+
q.afterCreate = (_t = q.afterCreate) == null ? void 0 : _t.slice(0);
|
|
1477
|
+
} else if (q.type === "update") {
|
|
1478
|
+
if (q.beforeUpdate)
|
|
1479
|
+
q.beforeUpdate = (_u = q.beforeUpdate) == null ? void 0 : _u.slice(0);
|
|
1480
|
+
if (q.afterUpdate)
|
|
1481
|
+
q.afterUpdate = (_v = q.afterUpdate) == null ? void 0 : _v.slice(0);
|
|
1482
|
+
} else if (q.type === "delete") {
|
|
1483
|
+
if (q.beforeDelete)
|
|
1484
|
+
q.beforeDelete = (_w = q.beforeDelete) == null ? void 0 : _w.slice(0);
|
|
1485
|
+
if (q.afterDelete)
|
|
1486
|
+
q.afterDelete = (_x = q.afterDelete) == null ? void 0 : _x.slice(0);
|
|
1487
|
+
}
|
|
1488
|
+
};
|
|
1489
|
+
|
|
1432
1490
|
var __defProp$n = Object.defineProperty;
|
|
1433
|
-
var __defProps$i = Object.defineProperties;
|
|
1434
|
-
var __getOwnPropDescs$i = Object.getOwnPropertyDescriptors;
|
|
1435
1491
|
var __getOwnPropSymbols$o = Object.getOwnPropertySymbols;
|
|
1436
1492
|
var __hasOwnProp$o = Object.prototype.hasOwnProperty;
|
|
1437
1493
|
var __propIsEnum$o = Object.prototype.propertyIsEnumerable;
|
|
@@ -1447,7 +1503,6 @@ var __spreadValues$n = (a, b) => {
|
|
|
1447
1503
|
}
|
|
1448
1504
|
return a;
|
|
1449
1505
|
};
|
|
1450
|
-
var __spreadProps$i = (a, b) => __defProps$i(a, __getOwnPropDescs$i(b));
|
|
1451
1506
|
function applyMixins(derivedCtor, constructors) {
|
|
1452
1507
|
constructors.forEach((baseCtor) => {
|
|
1453
1508
|
Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => {
|
|
@@ -1463,14 +1518,9 @@ const joinTruthy = (...strings) => {
|
|
|
1463
1518
|
return strings.filter((string) => string).join("");
|
|
1464
1519
|
};
|
|
1465
1520
|
const getClonedQueryData = (query) => {
|
|
1466
|
-
const cloned =
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
cloned[key] = [
|
|
1470
|
-
...query[key]
|
|
1471
|
-
];
|
|
1472
|
-
}
|
|
1473
|
-
}
|
|
1521
|
+
const cloned = __spreadValues$n({}, query);
|
|
1522
|
+
delete cloned[toSqlCacheKey];
|
|
1523
|
+
cloneQueryArrays(cloned);
|
|
1474
1524
|
return cloned;
|
|
1475
1525
|
};
|
|
1476
1526
|
const getQueryAs = (q) => {
|
|
@@ -5748,5 +5798,5 @@ const createDb = (_a) => {
|
|
|
5748
5798
|
return db;
|
|
5749
5799
|
};
|
|
5750
5800
|
|
|
5751
|
-
export { Adapter, Aggregate, ArrayColumn, ArrayOfColumnsObjects, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BoxColumn, ByteaColumn, CharColumn, CidrColumn, CircleColumn, Clear, ColumnInfoMethods, ColumnType, ColumnsObject, Create, DateBaseColumn, DateColumn, DateTimeBaseClass, DateTimeWithTimeZoneBaseClass, Db, DecimalBaseColumn, DecimalColumn, Delete, DoublePrecisionColumn, EMPTY_OBJECT, EnumColumn, For, From, Having, InetColumn, IntegerBaseColumn, IntegerColumn, IntervalColumn, JSONColumn, JSONTextColumn, Join, Json, LimitedTextBaseColumn, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, MergeQueryMethods, MoneyColumn, MoreThanOneRowError, NotFoundError, NumberAsStringBaseColumn, NumberBaseColumn, OnConflictQueryBuilder, OnQueryBuilder, Operators, PathColumn, PluckResultColumnType, PointColumn, PolygonColumn, PormError, PormInternalError, QueryCallbacks, QueryError, QueryGet, QueryLog, QueryMethods, QueryUpsert, RawMethods, RealColumn, Select, SerialColumn, SmallIntColumn, SmallSerialColumn, TextBaseColumn, TextColumn, Then, TimeColumn, TimeWithTimeZoneColumn, TimestampColumn, TimestampWithTimeZoneColumn, Transaction, TransactionAdapter, TsQueryColumn, TsVectorColumn, UUIDColumn, UnhandledTypeError, Union, Update, VarCharColumn, Where, WhereQueryBuilder, With, XMLColumn, addOr, addOrNot, addParserForRawExpression, addParserForSelectItem, addParserToQuery, addQueryOn, addQueryOrOn, addWhere, addWhereIn, addWhereNot, aggregate1FunctionNames, anyShape, applyMixins, array, arrayToEnum, checkIfASimpleQuery, columnTypes, utils as columnUtils, constructType, createDb, createOperator, defaultsKey, discriminatedUnion, emptyObject, enumType, getClonedQueryData, getColumnTypes, getQueryAs, getQueryParsers, getRaw, getRawSql, getTableData, getValidEnumValues, getValueKey, handleResult, 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 };
|
|
5801
|
+
export { Adapter, Aggregate, ArrayColumn, ArrayOfColumnsObjects, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BoxColumn, ByteaColumn, CharColumn, CidrColumn, CircleColumn, Clear, ColumnInfoMethods, ColumnType, ColumnsObject, Create, DateBaseColumn, DateColumn, DateTimeBaseClass, DateTimeWithTimeZoneBaseClass, Db, DecimalBaseColumn, DecimalColumn, Delete, DoublePrecisionColumn, EMPTY_OBJECT, EnumColumn, For, From, Having, InetColumn, IntegerBaseColumn, IntegerColumn, IntervalColumn, JSONColumn, JSONTextColumn, Join, Json, LimitedTextBaseColumn, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, MergeQueryMethods, MoneyColumn, MoreThanOneRowError, NotFoundError, NumberAsStringBaseColumn, NumberBaseColumn, OnConflictQueryBuilder, OnQueryBuilder, Operators, PathColumn, PluckResultColumnType, PointColumn, PolygonColumn, PormError, PormInternalError, QueryCallbacks, QueryError, QueryGet, QueryLog, QueryMethods, QueryUpsert, RawMethods, RealColumn, Select, SerialColumn, SmallIntColumn, SmallSerialColumn, TextBaseColumn, TextColumn, Then, TimeColumn, TimeWithTimeZoneColumn, TimestampColumn, TimestampWithTimeZoneColumn, Transaction, TransactionAdapter, TsQueryColumn, TsVectorColumn, UUIDColumn, UnhandledTypeError, Union, Update, VarCharColumn, Where, WhereQueryBuilder, With, XMLColumn, addOr, addOrNot, addParserForRawExpression, addParserForSelectItem, addParserToQuery, addQueryOn, addQueryOrOn, addWhere, addWhereIn, addWhereNot, aggregate1FunctionNames, anyShape, applyMixins, array, arrayToEnum, checkIfASimpleQuery, cloneQueryArrays, columnTypes, utils as columnUtils, constructType, createDb, createOperator, defaultsKey, discriminatedUnion, emptyObject, enumType, getClonedQueryData, getColumnTypes, getQueryAs, getQueryParsers, getRaw, getRawSql, getTableData, getValidEnumValues, getValueKey, handleResult, 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 };
|
|
5752
5802
|
//# sourceMappingURL=index.esm.js.map
|