pqb 0.5.0 → 0.5.2
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 +2 -1
- package/dist/index.esm.js +18 -18
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +18 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/columnSchema/columnType.test.ts +6 -3
- package/src/queryMethods/create.ts +13 -4
- package/src/queryMethods/json.ts +2 -2
- package/src/queryMethods/queryMethods.ts +2 -8
- package/src/queryMethods/select.test.ts +1 -1
- package/src/queryMethods/update.ts +19 -0
- package/src/sql/fromAndAs.ts +3 -3
- package/src/sql/insert.ts +2 -2
- package/src/sql/select.ts +2 -2
- package/src/sql/toSql.ts +5 -2
- package/src/sql/where.ts +2 -2
- package/src/sql/with.ts +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -508,6 +508,7 @@ declare type ToSqlOptions = {
|
|
|
508
508
|
values?: unknown[];
|
|
509
509
|
};
|
|
510
510
|
declare const toSql: (model: Query, options?: ToSqlOptions) => Sql;
|
|
511
|
+
declare const makeSql: (model: Query, { values }?: ToSqlOptions) => Sql;
|
|
511
512
|
|
|
512
513
|
declare type SomeIsTrue<T extends unknown[]> = T extends [
|
|
513
514
|
infer Head,
|
|
@@ -4344,4 +4345,4 @@ declare const setQueryObjectValue: <T extends {
|
|
|
4344
4345
|
query: QueryData;
|
|
4345
4346
|
}>(q: T, object: string, key: string, value: unknown) => T;
|
|
4346
4347
|
|
|
4347
|
-
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, 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 };
|
|
4348
|
+
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, 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
|
@@ -680,7 +680,7 @@ const pushIn = (ands, prefix, quotedAs, values, arg) => {
|
|
|
680
680
|
} else if (isRaw(arg.values)) {
|
|
681
681
|
value = getRaw(arg.values, values);
|
|
682
682
|
} else {
|
|
683
|
-
const sql = arg.values
|
|
683
|
+
const sql = makeSql(arg.values, { values });
|
|
684
684
|
value = `(${sql.text})`;
|
|
685
685
|
}
|
|
686
686
|
const columnsSql = arg.columns.map((column) => quoteFullColumn(column, quotedAs)).join(", ");
|
|
@@ -935,7 +935,7 @@ const pushSubQuerySql = (query, as, values, list) => {
|
|
|
935
935
|
default:
|
|
936
936
|
throw new UnhandledTypeError(returnType);
|
|
937
937
|
}
|
|
938
|
-
let subQuerySql = `(${query
|
|
938
|
+
let subQuerySql = `(${makeSql(query, { values }).text})`;
|
|
939
939
|
const { coalesceValue } = query.query;
|
|
940
940
|
if (coalesceValue !== void 0) {
|
|
941
941
|
const value = typeof coalesceValue === "object" && coalesceValue && isRaw(coalesceValue) ? getRaw(coalesceValue, values) : quote(coalesceValue);
|
|
@@ -1051,7 +1051,7 @@ const pushWithSql = (ctx, withData) => {
|
|
|
1051
1051
|
if (isRaw(query)) {
|
|
1052
1052
|
inner = getRaw(query, ctx.values);
|
|
1053
1053
|
} else {
|
|
1054
|
-
inner = query
|
|
1054
|
+
inner = makeSql(query, { values: ctx.values }).text;
|
|
1055
1055
|
}
|
|
1056
1056
|
return `${options.recursive ? "RECURSIVE " : ""}${q(name)}${options.columns ? `(${options.columns.map(q).join(", ")})` : ""} AS ${options.materialized ? "MATERIALIZED " : options.notMaterialized ? "NOT MATERIALIZED " : ""}(${inner})`;
|
|
1057
1057
|
}).join(", ")
|
|
@@ -1102,12 +1102,12 @@ const getFrom = (model, query, values) => {
|
|
|
1102
1102
|
return getRaw(query.from, values);
|
|
1103
1103
|
}
|
|
1104
1104
|
if (!query.from.table) {
|
|
1105
|
-
const sql = query.from
|
|
1105
|
+
const sql = makeSql(query.from, { values });
|
|
1106
1106
|
return `(${sql.text})`;
|
|
1107
1107
|
}
|
|
1108
1108
|
const q = query.from.query;
|
|
1109
1109
|
if (!checkIfASimpleQuery(q)) {
|
|
1110
|
-
const sql = query.from
|
|
1110
|
+
const sql = makeSql(query.from, { values });
|
|
1111
1111
|
return `(${sql.text})`;
|
|
1112
1112
|
}
|
|
1113
1113
|
return quoteSchemaAndTable(q.schema, query.from.table);
|
|
@@ -1154,7 +1154,7 @@ const pushInsertSql = (ctx, model, query, quotedAs) => {
|
|
|
1154
1154
|
"select",
|
|
1155
1155
|
isRaw(query.values) ? query.values : raw(encodeRow(ctx, query.values[0]))
|
|
1156
1156
|
);
|
|
1157
|
-
ctx.sql.push(q2
|
|
1157
|
+
ctx.sql.push(makeSql(q2, { values: ctx.values }).text);
|
|
1158
1158
|
} else {
|
|
1159
1159
|
ctx.sql.push(
|
|
1160
1160
|
`VALUES ${isRaw(query.values) ? getRaw(query.values, ctx.values) : query.values.map((row) => `(${encodeRow(ctx, row)})`).join(", ")}`
|
|
@@ -1396,7 +1396,7 @@ const makeSql = (model, { values = [] } = {}) => {
|
|
|
1396
1396
|
if (isRaw(item.arg)) {
|
|
1397
1397
|
itemSql = getRaw(item.arg, values);
|
|
1398
1398
|
} else {
|
|
1399
|
-
const argSql = item.arg
|
|
1399
|
+
const argSql = makeSql(item.arg, { values });
|
|
1400
1400
|
itemSql = argSql.text;
|
|
1401
1401
|
}
|
|
1402
1402
|
sql.push(`${item.kind} ${item.wrap ? `(${itemSql})` : itemSql}`);
|
|
@@ -4202,13 +4202,13 @@ const processCreateItem = (item, rowIndex, ctx, columns, encoders, columnsMap, s
|
|
|
4202
4202
|
item[key]
|
|
4203
4203
|
]);
|
|
4204
4204
|
} else {
|
|
4205
|
+
const value = item[key];
|
|
4206
|
+
if ((!value.create || Array.isArray(value.create) && value.create.length === 0) && (!value.connect || Array.isArray(value.connect) && value.connect.length === 0) && (!value.connectOrCreate || Array.isArray(value.connectOrCreate) && value.connectOrCreate.length === 0))
|
|
4207
|
+
return;
|
|
4205
4208
|
ctx.requiredReturning[ctx.relations[key].primaryKey] = true;
|
|
4206
4209
|
if (!ctx.appendRelations[key])
|
|
4207
4210
|
ctx.appendRelations[key] = [];
|
|
4208
|
-
ctx.appendRelations[key].push([
|
|
4209
|
-
rowIndex,
|
|
4210
|
-
item[key]
|
|
4211
|
-
]);
|
|
4211
|
+
ctx.appendRelations[key].push([rowIndex, value]);
|
|
4212
4212
|
}
|
|
4213
4213
|
} else if (columnsMap[key] === void 0 && (shape[key] || shape === anyShape)) {
|
|
4214
4214
|
columnsMap[key] = columns.length;
|
|
@@ -4770,7 +4770,7 @@ class Json {
|
|
|
4770
4770
|
_json() {
|
|
4771
4771
|
const q = this._wrap(this.__model.clone());
|
|
4772
4772
|
q._getOptional(
|
|
4773
|
-
|
|
4773
|
+
raw(
|
|
4774
4774
|
queryTypeWithLimitOne[this.query.returnType] ? `row_to_json("t".*)` : `COALESCE(json_agg(row_to_json("t".*)), '[]')`
|
|
4775
4775
|
)
|
|
4776
4776
|
);
|
|
@@ -5151,6 +5151,9 @@ class Update {
|
|
|
5151
5151
|
if (relations[key].type === "belongsTo") {
|
|
5152
5152
|
prependRelations[key] = data[key];
|
|
5153
5153
|
} else {
|
|
5154
|
+
const value = data[key];
|
|
5155
|
+
if (!value.set && !("upsert" in value) && (!value.disconnect || Array.isArray(value.disconnect) && value.disconnect.length === 0) && (!value.delete || Array.isArray(value.delete) && value.delete.length === 0) && (!value.update || Array.isArray(value.update.where) && value.update.where.length === 0) && (!value.create || Array.isArray(value.create) && value.create.length === 0))
|
|
5156
|
+
continue;
|
|
5154
5157
|
if (!((_a = query.select) == null ? void 0 : _a.includes("*"))) {
|
|
5155
5158
|
const primaryKey = relations[key].primaryKey;
|
|
5156
5159
|
if (!((_b = query.select) == null ? void 0 : _b.includes(primaryKey))) {
|
|
@@ -5524,11 +5527,8 @@ class QueryMethods {
|
|
|
5524
5527
|
wrap(query, as) {
|
|
5525
5528
|
return this.clone()._wrap(query, as);
|
|
5526
5529
|
}
|
|
5527
|
-
_wrap(query, as) {
|
|
5528
|
-
|
|
5529
|
-
return query.as(as != null ? as : "t")._from(
|
|
5530
|
-
this.raw(`(${sql.text})`, ...sql.values)
|
|
5531
|
-
);
|
|
5530
|
+
_wrap(query, as = "t") {
|
|
5531
|
+
return query.as(as)._from(this, as);
|
|
5532
5532
|
}
|
|
5533
5533
|
order(...args) {
|
|
5534
5534
|
return this.clone()._order(...args);
|
|
@@ -5735,5 +5735,5 @@ const createDb = (_a) => {
|
|
|
5735
5735
|
return db;
|
|
5736
5736
|
};
|
|
5737
5737
|
|
|
5738
|
-
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, 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 };
|
|
5738
|
+
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, 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 };
|
|
5739
5739
|
//# sourceMappingURL=index.esm.js.map
|