pqb 0.73.2 → 0.73.4
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/bun.js +3 -3
- package/dist/bun.js.map +1 -1
- package/dist/bun.mjs +3 -3
- package/dist/bun.mjs.map +1 -1
- package/dist/index.d.ts +7715 -7716
- package/dist/index.js +123 -112
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +123 -113
- package/dist/index.mjs.map +1 -1
- package/dist/internal.d.ts +35 -33
- package/dist/internal.js +33 -9
- package/dist/internal.js.map +1 -1
- package/dist/internal.mjs +29 -11
- package/dist/internal.mjs.map +1 -1
- package/dist/node-postgres.js +20 -3
- package/dist/node-postgres.js.map +1 -1
- package/dist/node-postgres.mjs +20 -3
- package/dist/node-postgres.mjs.map +1 -1
- package/dist/postgres-js.js +4 -4
- package/dist/postgres-js.js.map +1 -1
- package/dist/postgres-js.mjs +4 -4
- package/dist/postgres-js.mjs.map +1 -1
- package/package.json +1 -1
package/dist/internal.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Adapter, AdapterClass, AdapterConfigBase, AdapterParams, AdapterSchemaConfigOptions, AfterCommitStandaloneHook, AfterHook, ArrayColumn, ArrayColumnValue, ArrayData, AsyncState, BaseNumberData, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BoxColumn, BrandColumn, BrandColumnsShape, ByteaColumn, CidrColumn, CircleColumn, CitextColumn, Code, Codes, Column, ColumnFromDbParams, ColumnRefExpression, ColumnSchemaConfig, ColumnSchemaGetterColumns, ColumnSchemaGetterTableClass, ColumnToCodeCtx, ColumnTypeSchemaArg, ColumnsByType, ColumnsShape, ComputedColumnsFromOptions, ComputedOptionsConfig, ComputedOptionsFactory, CreateCtx, CreateData, CreateManyMethodsNames, CreateMethodsNames, CreateSelf, CustomTypeColumn, DateColumn, DateColumnData, DateColumnInput, DbDomainArg, DbExtension, DbOptions, DbResult, DbSharedOptions, DbSqlMethod, DbStructureDomainsMap, DbTableOptionScopes, DbTableOptions, DecimalColumn, DecimalColumnData, DefaultColumnTypes, DefaultPrivileges, DefaultSchemaConfig, DeleteMethodsNames, DomainColumn, DoublePrecisionColumn, DriverAdapter, DynamicRawSQL, EmptyObject, EmptyTuple, EnumColumn, Expression, ExpressionData, FromArg, FromResult, GeneratorIgnore, HookSelectValue, InetColumn, IntegerColumn, IntervalColumn, IsQuery, IsolationLevel, JSONColumn, JSONTextColumn, JoinedShapes, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, MapTableScopesOption, MaybeArray, MaybePromise, MergeQuery, MoneyColumn, NoPrimaryKeyOption, NonUniqDataItem, NumberColumnData, Operators, OperatorsArray, OperatorsDate, OperatorsJson, OperatorsNumber, OperatorsOrdinalText, OperatorsText, Ord, PathColumn, PickQueryInputType, PickQueryInternal, PickQueryQ, PickQueryRelations, PickQuerySelectableRelations, PickQueryShape, PointColumn, PolygonColumn, PostgisGeographyPointColumn, QueryAfterHook, QueryBeforeActionHook, QueryBeforeHook, QueryData, QueryHasWhere, QueryHookUtils, QueryHooks, QueryInternal, QueryLogObject, QueryLogOptions, QueryLogger, QueryManyTake, QueryManyTakeOptional, QueryOrExpression, QueryResult, QueryResultRow, QueryReturnType, QuerySchema, QueryScopes, QueryTake, RawSql, RawSqlBase, RealColumn, RecordKeyTrue, RecordOptionalString, RecordString, RecordStringOrNumber, RecordUnknown, RelationConfigBase, RelationJoinQuery, RelationsBase, Rls, RlsPolicy, SchemaConfigFnWithOptions, SearchWeight, SelectAsFnReturnType, SelectResultObj, SelectSqlColumn, SelectableFromShape, SerialColumn, SerialColumnData, ShallowSimplify, ShapeUniqueColumns, SingleSql, SingleSqlItem, SmallIntColumn, SmallSerialColumn, Sql, SqlFn, SqlSessionState, StaticSQLArgs, StorageOptions, StringColumn, StringData, TableData, TableDataFn, TableDataInput, TableDataItem, TableDataItemsUniqueColumnTuples, TableDataItemsUniqueColumns, TableDataItemsUniqueConstraints, TableDataMethods, TemplateLiteralArgs, TextColumn, TimeColumn, TimestampColumn, TimestampTZColumn, Timestamps, ToSQLCtx, ToSqlValues, TransactionAdapter, TransactionAdapterClass, TransactionOptions, TsQueryColumn, TsVectorColumn, UUIDColumn, UniqueConstraints, UniqueTableDataItem, UnknownColumn, UpdateData, UpsertData, UpsertThis, VarCharColumn, VirtualColumn, WhereArg, XMLColumn, _appendQuery, _appendQueryOnUpsertCreate, _clone, _createDbSqlMethod, _hookSelectColumns, _initQueryBuilder, _onUpsertUpdate, _orCreate, _prependWith, _prependWithOnUpsertCreate, _queryCreate, _queryCreateMany, _queryCreateManyFrom, _queryDefaults, _queryDelete, _queryFindBy, _queryFindByOptional, _queryHookAfterCreate, _queryHookAfterUpdate, _queryInsert, _queryInsertForEachFrom, _queryInsertMany, _queryJoinOn, _queryRows, _querySelect, _queryTake, _queryTakeOptional, _queryUpdate, _queryUpdateOrThrow, _queryUpsert, _queryWhere, _queryWhereExists, _queryWhereIn, addCode, addTopCte, addTopCteSql, applyMixins, assignDbDataToColumn, backtickQuote, cloneQueryBaseUnscoped, codeToString, colors, columnsShapeToCode, constraintInnerToCode, constraintToCode, consumeColumnName, deepCompare, defaultSchemaConfig, emptyArray, emptyObject, escapeForMigration, escapeString, excludeInnerToCode, excludeToCode, exhaustive, getCallerFilePath, getClonedQueryData, getColumnBaseType, getColumnTypes, getDateAsDateFn, getDateAsNumberFn, getDriverErrorCode, getFreeAlias, getFreeSetAlias, getImportPath, getPrimaryKeys, getQueryAs, getQuerySchema, getShapeFromSelect, getSqlText, getStackTrace, getSupportedDefaultPrivileges, indexInnerToCode, indexToCode, internalSchemaConfig, isExpression, isQueryReturnsAll, isRawSQL, logColors, logParamToLogObject, makeColumnNullable, makeColumnTypes, makeColumnsByType, makeConnectRetryConfig, noop, objectHasValues, omit, parseTableData, parseTableDataInput, pathToLog, pick, pluralize, prepareSubQueryForSql, primaryKeyInnerToCode, pushQueryOnForOuter, pushQueryValueImmutable, pushTableDataCode, queryToSql, quoteIdentifier, quoteObjectKey, quoteTableWithSchema, raw, rawSqlToCode, rawSqlToSql, referencesArgsToCode, returnArg, setColumnData, setColumnEncode, setColumnParse, setColumnParseNull, setCurrentColumnName, setDataValue, setDefaultLanguage, setFreeAlias, setQueryObjectValueImmutable, singleQuote, sqlToRawSql, tableDataMethods, toArray, toCamelCase, toPascalCase, toSnakeCase, wrapAdapterFnWithConnectRetry } from "./index.d.ts";
|
|
1
|
+
import { Adapter, AdapterClass, AdapterConfigBase, AdapterParams, AdapterSchemaConfigOptions, AfterCommitStandaloneHook, AfterHook, ArrayColumn, ArrayColumnValue, ArrayData, AsyncState, BaseNumberData, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BoxColumn, BrandColumn, BrandColumnsShape, ByteaColumn, CidrColumn, CircleColumn, CitextColumn, Code, Codes, Column, ColumnFromDbParams, ColumnRefExpression, ColumnSchemaConfig, ColumnSchemaGetterColumns, ColumnSchemaGetterTableClass, ColumnToCodeCtx, ColumnTypeSchemaArg, ColumnsByType, ColumnsShape, ComputedColumnsFromOptions, ComputedOptionsConfig, ComputedOptionsFactory, CreateCtx, CreateData, CreateManyMethodsNames, CreateMethodsNames, CreateSelf, CustomTypeColumn, DateColumn, DateColumnData, DateColumnInput, DbDomainArg, DbExtension, DbOptions, DbResult, DbSharedOptions, DbSqlMethod, DbStructureDomainsMap, DbTableOptionScopes, DbTableOptions, DecimalColumn, DecimalColumnData, DefaultColumnTypes, DefaultPrivileges, DefaultSchemaConfig, DeleteMethodsNames, DomainColumn, DoublePrecisionColumn, DriverAdapter, DynamicRawSQL, EmptyObject, EmptyTuple, EnumColumn, Expression, ExpressionData, FromArg, FromResult, GeneratorIgnore, HookSelectValue, InetColumn, IntegerColumn, IntervalColumn, IsQuery, IsolationLevel, JSONColumn, JSONTextColumn, JoinedShapes, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, MapTableScopesOption, MaybeArray, MaybePromise, MergeQuery, MoneyColumn, NoPrimaryKeyOption, NonUniqDataItem, NumberColumnData, Operators, OperatorsArray, OperatorsDate, OperatorsJson, OperatorsNumber, OperatorsOrdinalText, OperatorsText, Ord, PathColumn, PickQueryInputType, PickQueryInternal, PickQueryQ, PickQueryRelations, PickQuerySelectableRelations, PickQueryShape, PointColumn, PolygonColumn, PostgisGeographyPointColumn, QueryAfterHook, QueryBeforeActionHook, QueryBeforeHook, QueryCatch, QueryData, QueryHasWhere, QueryHookUtils, QueryHooks, QueryInternal, QueryLogObject, QueryLogOptions, QueryLogger, QueryManyTake, QueryManyTakeOptional, QueryOrExpression, QueryResult, QueryResultRow, QueryReturnType, QuerySchema, QueryScopes, QueryTake, QueryThenShallowSimplify, RawSql, RawSqlBase, RealColumn, RecordKeyTrue, RecordOptionalString, RecordString, RecordStringOrNumber, RecordUnknown, RelationConfigBase, RelationJoinQuery, RelationsBase, Rls, RlsPolicy, SchemaConfigFnWithOptions, SearchWeight, SelectAs, SelectAsFnReturnType, SelectResultObj, SelectSqlColumn, SelectableFromShape, SerialColumn, SerialColumnData, ShallowSimplify, ShapeUniqueColumns, SingleSql, SingleSqlItem, SmallIntColumn, SmallSerialColumn, Sql, SqlFn, SqlSessionState, StaticSQLArgs, StorageOptions, StringColumn, StringData, TableData, TableDataFn, TableDataInput, TableDataItem, TableDataItemsUniqueColumnTuples, TableDataItemsUniqueColumns, TableDataItemsUniqueConstraints, TableDataMethods, TemplateLiteralArgs, TextColumn, TimeColumn, TimestampColumn, TimestampTZColumn, Timestamps, ToSQLCtx, ToSqlValues, TransactionAdapter, TransactionAdapterClass, TransactionOptions, TsQueryColumn, TsVectorColumn, UUIDColumn, UniqueConstraints, UniqueTableDataItem, UnknownColumn, UpdateData, UpsertData, UpsertThis, ValExpression, VarCharColumn, VirtualColumn, WhereArg, XMLColumn, _appendQuery, _appendQueryOnUpsertCreate, _clone, _createDbSqlMethod, _hookSelectColumns, _initQueryBuilder, _onUpsertUpdate, _orCreate, _prependWith, _prependWithOnUpsertCreate, _queryCreate, _queryCreateMany, _queryCreateManyFrom, _queryDefaults, _queryDelete, _queryFindBy, _queryFindByOptional, _queryHookAfterCreate, _queryHookAfterUpdate, _queryInsert, _queryInsertForEachFrom, _queryInsertMany, _queryJoinOn, _queryRows, _querySelect, _queryTake, _queryTakeOptional, _queryUpdate, _queryUpdateOrThrow, _queryUpsert, _queryWhere, _queryWhereExists, _queryWhereIn, addCode, addTopCte, addTopCteSql, applyMixins, assignDbDataToColumn, backtickQuote, cloneQueryBaseUnscoped, codeToString, colors, columnsShapeToCode, constraintInnerToCode, constraintToCode, consumeColumnName, deepCompare, defaultSchemaConfig, emptyArray, emptyObject, escapeForMigration, escapeString, excludeInnerToCode, excludeToCode, exhaustive, getCallerFilePath, getClonedQueryData, getColumnBaseType, getColumnTypes, getDateAsDateFn, getDateAsNumberFn, getDriverErrorCode, getFreeAlias, getFreeSetAlias, getImportPath, getPrimaryKeys, getQueryAs, getQuerySchema, getShapeFromSelect, getSqlText, getStackTrace, getSupportedDefaultPrivileges, indexInnerToCode, indexToCode, internalSchemaConfig, isExpression, isQueryReturnsAll, isRawSQL, logColors, logParamToLogObject, makeColumnNullable, makeColumnTypes, makeColumnsByType, makeConnectRetryConfig, noop, objectHasValues, omit, parseTableData, parseTableDataInput, pathToLog, pick, pluralize, prepareSubQueryForSql, primaryKeyInnerToCode, pushQueryOnForOuter, pushQueryValueImmutable, pushTableDataCode, queryToSql, quoteIdentifier, quoteObjectKey, quoteTableWithSchema, raw, rawSqlToCode, rawSqlToSql, referencesArgsToCode, returnArg, setColumnData, setColumnEncode, setColumnParse, setColumnParseNull, setCurrentColumnName, setDataValue, setDefaultLanguage, setFreeAlias, setQueryObjectValueImmutable, singleQuote, sqlToRawSql, tableDataMethods, toArray, toCamelCase, toPascalCase, toSnakeCase, wrapAdapterFnWithConnectRetry } from "./index.d.ts";
|
|
2
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
3
|
import "node:util";
|
|
4
4
|
import "tagged-tag";
|
|
@@ -216,6 +216,15 @@ declare class SqlRefExpression extends Expression$1 {
|
|
|
216
216
|
constructor(name: string);
|
|
217
217
|
makeSQL(): string;
|
|
218
218
|
}
|
|
219
|
+
declare class ValExpression$1<T> extends Expression$1 {
|
|
220
|
+
value: unknown;
|
|
221
|
+
result: {
|
|
222
|
+
value: Column$1.Pick.QueryColumnOfType<T>;
|
|
223
|
+
};
|
|
224
|
+
q: ExpressionData$1;
|
|
225
|
+
constructor(value: unknown);
|
|
226
|
+
makeSQL(ctx: ToSqlValues$1): string;
|
|
227
|
+
}
|
|
219
228
|
interface PostgresInterval {
|
|
220
229
|
years: number;
|
|
221
230
|
months: number;
|
|
@@ -1149,15 +1158,6 @@ declare class RefExpression<T extends Column$1.Pick.QueryColumn> extends Express
|
|
|
1149
1158
|
constructor(value: T, query: Query, ref: string);
|
|
1150
1159
|
makeSQL(ctx: ToSQLCtx$1): string;
|
|
1151
1160
|
}
|
|
1152
|
-
declare class ValExpression extends Expression$1 {
|
|
1153
|
-
value: unknown;
|
|
1154
|
-
result: {
|
|
1155
|
-
value: Column$1;
|
|
1156
|
-
};
|
|
1157
|
-
q: ExpressionData$1;
|
|
1158
|
-
constructor(value: unknown);
|
|
1159
|
-
makeSQL(ctx: ToSqlValues$1): string;
|
|
1160
|
-
}
|
|
1161
1161
|
type SortDir = 'ASC' | 'DESC' | 'ASC NULLS FIRST' | 'DESC NULLS LAST';
|
|
1162
1162
|
type OrderItem = string | {
|
|
1163
1163
|
[K: string]: SortDir;
|
|
@@ -2113,7 +2113,6 @@ declare class QueryExpressions {
|
|
|
2113
2113
|
* @param arg - any available column name, such as of a joined table
|
|
2114
2114
|
*/
|
|
2115
2115
|
ref<T extends PickQuerySelectable, K extends keyof T['__selectable'] & string>(this: T, arg: K): RefExpression<T['__selectable'][K]['column']> & T['__selectable'][K]['column']['operators'];
|
|
2116
|
-
val(value: unknown): ValExpression;
|
|
2117
2116
|
/**
|
|
2118
2117
|
* `fn` allows to call an arbitrary SQL function.
|
|
2119
2118
|
*
|
|
@@ -3895,8 +3894,7 @@ declare class DynamicRawSQL$1<T extends Column$1.Pick.QueryColumn, ColumnTypes =
|
|
|
3895
3894
|
constructor(fn: DynamicSQLArg<T>);
|
|
3896
3895
|
makeSQL(ctx: ToSQLCtx$1, quotedAs?: string): string;
|
|
3897
3896
|
}
|
|
3898
|
-
interface
|
|
3899
|
-
<T, Args extends TemplateLiteralArgs$1 | [sql: string] | [values: RecordUnknown$1, sql?: string]>(this: T, ...args: Args): Args extends [RecordUnknown$1] ? (...sql: TemplateLiteralArgs$1) => RawSql$1<Column$1.Pick.QueryColumn, T> : RawSql$1<Column$1.Pick.QueryColumn, T>;
|
|
3897
|
+
interface SqlFnMethods {
|
|
3900
3898
|
/**
|
|
3901
3899
|
* `sql.join` builds a SQL list from values and expressions.
|
|
3902
3900
|
* Plain values are bound as query parameters, while SQL expressions render as SQL.
|
|
@@ -3950,6 +3948,10 @@ interface SqlFn$1 {
|
|
|
3950
3948
|
*/
|
|
3951
3949
|
ref(name: string): SqlRefExpression;
|
|
3952
3950
|
unsafe(sql: string | number | boolean): UnsafeSqlExpression;
|
|
3951
|
+
val<T>(value: T): ValExpression$1<T>;
|
|
3952
|
+
}
|
|
3953
|
+
interface SqlFn$1 extends SqlFnMethods {
|
|
3954
|
+
<T, Args extends TemplateLiteralArgs$1 | [sql: string] | [values: RecordUnknown$1, sql?: string]>(this: T, ...args: Args): Args extends [RecordUnknown$1] ? (...sql: TemplateLiteralArgs$1) => RawSql$1<Column$1.Pick.QueryColumn, T> : RawSql$1<Column$1.Pick.QueryColumn, T>;
|
|
3953
3955
|
}
|
|
3954
3956
|
declare class UnsafeSqlExpression extends Expression$1 {
|
|
3955
3957
|
sql: string | number | boolean;
|
|
@@ -3977,6 +3979,7 @@ interface SqlCommonOptions extends HasTableHook, HasCteHooks, MutativeQueriesSel
|
|
|
3977
3979
|
interface SingleSqlItem$1 {
|
|
3978
3980
|
text: string;
|
|
3979
3981
|
values?: unknown[];
|
|
3982
|
+
prepare?: true;
|
|
3980
3983
|
runAfterQuery?: RunAfterQuery;
|
|
3981
3984
|
}
|
|
3982
3985
|
interface RunAfterQuery {
|
|
@@ -4302,8 +4305,8 @@ interface Adapter$1 {
|
|
|
4302
4305
|
driverAdapter: DriverAdapter$1;
|
|
4303
4306
|
isInTransaction(this: Adapter$1): this is TransactionAdapter$1;
|
|
4304
4307
|
assignError(to: QueryError, from: Error): void;
|
|
4305
|
-
query<T extends QueryResultRow$1 = QueryResultRow$1>(text: string, values?: unknown[], sqlSessionState?: SqlSessionState$1): Promise<QueryResult$1<T>>;
|
|
4306
|
-
arrays<R extends any[] = any[]>(text: string, values?: unknown[], sqlSessionState?: SqlSessionState$1): Promise<QueryResult$1<R>>;
|
|
4308
|
+
query<T extends QueryResultRow$1 = QueryResultRow$1>(text: string, values?: unknown[], sqlSessionState?: SqlSessionState$1, prepare?: true): Promise<QueryResult$1<T>>;
|
|
4309
|
+
arrays<R extends any[] = any[]>(text: string, values?: unknown[], sqlSessionState?: SqlSessionState$1, prepare?: true): Promise<QueryResult$1<R>>;
|
|
4307
4310
|
/**
|
|
4308
4311
|
* Run a transaction
|
|
4309
4312
|
*
|
|
@@ -4330,7 +4333,7 @@ interface TransactionAdapter$1 extends Adapter$1 {
|
|
|
4330
4333
|
* - must use its `savepoint` method over manual `SAVEPOINT` because when doing it manually there is no way to prevent transaction from being rolled back when a query in a savepoint fails.
|
|
4331
4334
|
* - must use its `sql` client from inside the `savepoint` method for the lifetime of the savepoint because of the reason above.
|
|
4332
4335
|
*/
|
|
4333
|
-
hackySavepoint<T extends QueryResultRow$1 = QueryResultRow$1>(state: HackySavepointState, text: string, values?: unknown[], arraysMode?: boolean, log?: QueryLogObject$1): Promise<QueryResult$1<T>>;
|
|
4336
|
+
hackySavepoint<T extends QueryResultRow$1 = QueryResultRow$1>(state: HackySavepointState, text: string, values?: unknown[], arraysMode?: boolean, prepare?: true, log?: QueryLogObject$1): Promise<QueryResult$1<T>>;
|
|
4334
4337
|
}
|
|
4335
4338
|
type Pool = any;
|
|
4336
4339
|
type Client = any;
|
|
@@ -4352,10 +4355,10 @@ interface DriverAdapter$1 {
|
|
|
4352
4355
|
manualPool: boolean;
|
|
4353
4356
|
borrow(pool: Pool): Client;
|
|
4354
4357
|
release(client: Client): void;
|
|
4355
|
-
queryClient<T = QueryResultRow$1>(client: Client, text: string, values?: unknown[], arraysMode?: boolean): Promise<QueryResult$1<T>>;
|
|
4358
|
+
queryClient<T = QueryResultRow$1>(client: Client, text: string, values?: unknown[], arraysMode?: boolean, prepare?: true): Promise<QueryResult$1<T>>;
|
|
4356
4359
|
begin<DriverClient, Result>(pool: Pool, cb: (client: DriverClient) => Promise<Result>, options?: string): Promise<Result>;
|
|
4357
4360
|
savepoint<T>(client: Client, setClient: (client: Client) => void, name: string, cb: () => Promise<T>, onSavepoint?: SavepointCallback, beforeRelease?: SavepointCallback, onRelease?: SavepointCallback, beforeRollback?: SavepointCallback, onRollback?: SavepointCallback): Promise<T>;
|
|
4358
|
-
hackySavepoint<T extends QueryResultRow$1>(client: Client, setClient: (client: Client) => void, state: HackySavepointState, text: string, values?: unknown[], arraysMode?: boolean, onSavepoint?: SavepointCallback, beforeRelease?: SavepointCallback, onRelease?: SavepointCallback, beforeRollback?: SavepointCallback, onRollback?: SavepointCallback): Promise<QueryResult$1<T>>;
|
|
4361
|
+
hackySavepoint<T extends QueryResultRow$1>(client: Client, setClient: (client: Client) => void, state: HackySavepointState, text: string, values?: unknown[], arraysMode?: boolean, prepare?: true, onSavepoint?: SavepointCallback, beforeRelease?: SavepointCallback, onRelease?: SavepointCallback, beforeRollback?: SavepointCallback, onRollback?: SavepointCallback): Promise<QueryResult$1<T>>;
|
|
4359
4362
|
close(pool: Pool): Promise<void>;
|
|
4360
4363
|
}
|
|
4361
4364
|
type SavepointCallback = () => void;
|
|
@@ -4398,12 +4401,12 @@ type BatchParsers = BatchParser[];
|
|
|
4398
4401
|
interface QueryThen<T> {
|
|
4399
4402
|
<TResult1 = T, TResult2 = never>(onfulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>, onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>;
|
|
4400
4403
|
}
|
|
4401
|
-
type QueryThenShallowSimplify<T> = QueryThen<ShallowSimplify$1<T>>;
|
|
4404
|
+
type QueryThenShallowSimplify$1<T> = QueryThen<ShallowSimplify$1<T>>;
|
|
4402
4405
|
type QueryThenShallowSimplifyArr<T> = QueryThen<ShallowSimplify$1<T>[]>;
|
|
4403
4406
|
type QueryThenShallowSimplifyOptional<T> = QueryThen<ShallowSimplify$1<T> | undefined>;
|
|
4404
|
-
type QueryThenByQuery<T extends PickQueryReturnType, Result extends Column$1.QueryColumns> = T['returnType'] extends undefined | 'all' ? QueryThenShallowSimplifyArr<ColumnsShape$1.Output<Result>> : T['returnType'] extends 'one' ? QueryThenShallowSimplifyOptional<ColumnsShape$1.Output<Result>> : T['returnType'] extends 'oneOrThrow' ? QueryThenShallowSimplify<ColumnsShape$1.Output<Result>> : T['returnType'] extends 'value' ? QueryThen<Result['value']['__outputType'] | undefined> : T['returnType'] extends 'valueOrThrow' ? QueryThen<Result['value']['__outputType']> : T['returnType'] extends 'rows' ? QueryThen<ColumnsShape$1.Output<Result>[keyof Result][][]> : T['returnType'] extends 'pluck' ? QueryThen<Result['pluck']['__outputType'][]> : QueryThen<void>;
|
|
4405
|
-
type QueryThenByReturnType<T extends QueryReturnType$1, Result extends Column$1.QueryColumns> = T extends undefined | 'all' ? QueryThenShallowSimplifyArr<ColumnsShape$1.Output<Result>> : T extends 'one' ? QueryThenShallowSimplifyOptional<ColumnsShape$1.Output<Result>> : T extends 'oneOrThrow' ? QueryThenShallowSimplify<ColumnsShape$1.Output<Result>> : T extends 'value' ? QueryThen<Result['value']['__outputType'] | undefined> : T extends 'valueOrThrow' ? QueryThen<Result['value']['__outputType']> : T extends 'rows' ? QueryThen<ColumnsShape$1.Output<Result>[keyof Result][][]> : T extends 'pluck' ? QueryThen<Result['pluck']['__outputType'][]> : QueryThen<void>;
|
|
4406
|
-
interface QueryCatch {
|
|
4407
|
+
type QueryThenByQuery<T extends PickQueryReturnType, Result extends Column$1.QueryColumns> = T['returnType'] extends undefined | 'all' ? QueryThenShallowSimplifyArr<ColumnsShape$1.Output<Result>> : T['returnType'] extends 'one' ? QueryThenShallowSimplifyOptional<ColumnsShape$1.Output<Result>> : T['returnType'] extends 'oneOrThrow' ? QueryThenShallowSimplify$1<ColumnsShape$1.Output<Result>> : T['returnType'] extends 'value' ? QueryThen<Result['value']['__outputType'] | undefined> : T['returnType'] extends 'valueOrThrow' ? QueryThen<Result['value']['__outputType']> : T['returnType'] extends 'rows' ? QueryThen<ColumnsShape$1.Output<Result>[keyof Result][][]> : T['returnType'] extends 'pluck' ? QueryThen<Result['pluck']['__outputType'][]> : QueryThen<void>;
|
|
4408
|
+
type QueryThenByReturnType<T extends QueryReturnType$1, Result extends Column$1.QueryColumns> = T extends undefined | 'all' ? QueryThenShallowSimplifyArr<ColumnsShape$1.Output<Result>> : T extends 'one' ? QueryThenShallowSimplifyOptional<ColumnsShape$1.Output<Result>> : T extends 'oneOrThrow' ? QueryThenShallowSimplify$1<ColumnsShape$1.Output<Result>> : T extends 'value' ? QueryThen<Result['value']['__outputType'] | undefined> : T extends 'valueOrThrow' ? QueryThen<Result['value']['__outputType']> : T extends 'rows' ? QueryThen<ColumnsShape$1.Output<Result>[keyof Result][][]> : T extends 'pluck' ? QueryThen<Result['pluck']['__outputType'][]> : QueryThen<void>;
|
|
4409
|
+
interface QueryCatch$1 {
|
|
4407
4410
|
<Q, TResult = never>(this: {
|
|
4408
4411
|
then: (onfulfilled?: (value: Q) => any) => any;
|
|
4409
4412
|
}, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<Q | TResult>;
|
|
@@ -4529,8 +4532,8 @@ declare class Select {
|
|
|
4529
4532
|
*/
|
|
4530
4533
|
selectAll<T extends SelectSelf>(this: T): SelectResult<T, ['*']>;
|
|
4531
4534
|
}
|
|
4532
|
-
type SelectItem = string | SelectAs | Expression$1 | undefined;
|
|
4533
|
-
interface SelectAs {
|
|
4535
|
+
type SelectItem = string | SelectAs$1 | Expression$1 | undefined;
|
|
4536
|
+
interface SelectAs$1 {
|
|
4534
4537
|
selectAs: SelectAsValue;
|
|
4535
4538
|
}
|
|
4536
4539
|
interface SelectAsValue {
|
|
@@ -8367,7 +8370,7 @@ interface NarrowPluckTypeResult<T extends PickQueryResultReturnType, Narrow> ext
|
|
|
8367
8370
|
pluck: { [K in keyof T['result']['pluck']]: K extends '__outputType' ? Narrow extends unknown[] ? Narrow[number] : Narrow : T['result']['pluck'][K]; };
|
|
8368
8371
|
}
|
|
8369
8372
|
type QueryIfResult<T extends PickQueryResultReturnType, R extends PickQueryResult> = { [K in keyof T]: K extends 'result' ? { [K in keyof T['result'] | keyof R['result']]: K extends keyof T['result'] ? K extends keyof R['result'] ? R['result'][K] | T['result'][K] : T['result'][K] : Column$1.QueryColumnToOptional<R['result'][K]>; } : K extends 'then' ? QueryIfResultThen<T, R> : T[K]; };
|
|
8370
|
-
type QueryIfResultThen<T extends PickQueryResultReturnType, R extends PickQueryResult> = T['returnType'] extends undefined | 'all' ? QueryThenShallowSimplifyArr<{ [K in keyof T['result']]: K extends keyof R['result'] ? T['result'][K]['__outputType'] | R['result'][K]['__outputType'] : T['result'][K]['__outputType']; } & { [K in keyof R['result'] as K extends keyof T['result'] ? never : K]?: R['result'][K]['__outputType']; }> : T['returnType'] extends 'one' ? QueryThenShallowSimplifyOptional<{ [K in keyof T['result']]: K extends keyof R['result'] ? T['result'][K]['__outputType'] | R['result'][K]['__outputType'] : T['result'][K]['__outputType']; } & { [K in keyof R['result'] as K extends keyof T['result'] ? never : K]?: R['result'][K]['__outputType']; }> : T['returnType'] extends 'oneOrThrow' ? QueryThenShallowSimplify<{ [K in keyof T['result']]: K extends keyof R['result'] ? T['result'][K]['__outputType'] | R['result'][K]['__outputType'] : T['result'][K]['__outputType']; } & { [K in keyof R['result'] as K extends keyof T['result'] ? never : K]?: R['result'][K]['__outputType']; }> : T['returnType'] extends 'value' ? QueryThen<T['result']['value']['__outputType'] | R['result']['value']['__outputType'] | undefined> : T['returnType'] extends 'valueOrThrow' ? QueryThen<T['result']['value']['__outputType'] | R['result']['value']['__outputType']> : T['returnType'] extends 'rows' ? QueryThen<(T['result'][keyof T['result']]['__outputType'] | R['result'][keyof R['result']]['__outputType'])[][]> : T['returnType'] extends 'pluck' ? QueryThen<(T['result']['pluck']['__outputType'] | R['result']['pluck']['__outputType'])[]> : QueryThen<void>;
|
|
8373
|
+
type QueryIfResultThen<T extends PickQueryResultReturnType, R extends PickQueryResult> = T['returnType'] extends undefined | 'all' ? QueryThenShallowSimplifyArr<{ [K in keyof T['result']]: K extends keyof R['result'] ? T['result'][K]['__outputType'] | R['result'][K]['__outputType'] : T['result'][K]['__outputType']; } & { [K in keyof R['result'] as K extends keyof T['result'] ? never : K]?: R['result'][K]['__outputType']; }> : T['returnType'] extends 'one' ? QueryThenShallowSimplifyOptional<{ [K in keyof T['result']]: K extends keyof R['result'] ? T['result'][K]['__outputType'] | R['result'][K]['__outputType'] : T['result'][K]['__outputType']; } & { [K in keyof R['result'] as K extends keyof T['result'] ? never : K]?: R['result'][K]['__outputType']; }> : T['returnType'] extends 'oneOrThrow' ? QueryThenShallowSimplify$1<{ [K in keyof T['result']]: K extends keyof R['result'] ? T['result'][K]['__outputType'] | R['result'][K]['__outputType'] : T['result'][K]['__outputType']; } & { [K in keyof R['result'] as K extends keyof T['result'] ? never : K]?: R['result'][K]['__outputType']; }> : T['returnType'] extends 'value' ? QueryThen<T['result']['value']['__outputType'] | R['result']['value']['__outputType'] | undefined> : T['returnType'] extends 'valueOrThrow' ? QueryThen<T['result']['value']['__outputType'] | R['result']['value']['__outputType']> : T['returnType'] extends 'rows' ? QueryThen<(T['result'][keyof T['result']]['__outputType'] | R['result'][keyof R['result']]['__outputType'])[][]> : T['returnType'] extends 'pluck' ? QueryThen<(T['result']['pluck']['__outputType'] | R['result']['pluck']['__outputType'])[]> : QueryThen<void>;
|
|
8371
8374
|
interface QueryMethods<ColumnTypes> extends QueryClone, QueryAsMethods, AggregateMethods, QueryDistinct, Select, FromMethods, QueryJoin, QueryLimitOffset, CteQuery, Union, QueryJsonMethods, QueryCreate, QueryCreateFrom, QueryUpdate, QueryDelete, QueryStorage, QueryTransaction, QueryTruncate, For, Where, SearchMethods, Clear, Having, QueryCatchers, QueryLog, QueryOrder, QueryWithSchema, QueryHooks$1, QueryUpsert, QueryOrCreate, QueryGet, QueryPluck, MergeQueryMethods, QuerySql<ColumnTypes>, QueryTransform, QueryMap, QueryScope, SoftDeleteMethods, QueryExpressions, QueryWrap, QueryWindow, QueryExistsMethods {}
|
|
8372
8375
|
declare class QueryMethods<ColumnTypes> {
|
|
8373
8376
|
/**
|
|
@@ -8887,7 +8890,7 @@ interface Query extends IsQuery$1, PickQueryTable, PickQueryShape$1, PickQuerySe
|
|
|
8887
8890
|
__inputType: RecordUnknown$1;
|
|
8888
8891
|
q: QueryData$1;
|
|
8889
8892
|
then: QueryThen<unknown>;
|
|
8890
|
-
catch: QueryCatch;
|
|
8893
|
+
catch: QueryCatch$1;
|
|
8891
8894
|
windows: EmptyObject$1;
|
|
8892
8895
|
relations: RelationsBase$1;
|
|
8893
8896
|
relationsDataForCreate: RelationsDataForCreateBase;
|
|
@@ -8932,11 +8935,11 @@ type SetQueryReturnsAll<T extends PickQueryResult> = { [K in keyof T]: K extends
|
|
|
8932
8935
|
type SetQueryReturnsAllResult<T extends PickQueryResult, Result extends Column$1.QueryColumns> = { [K in keyof T]: K extends 'returnType' ? 'all' : K extends 'result' ? Result : K extends 'then' ? QueryThenShallowSimplifyArr<T['result']> : T[K]; } & QueryHasWhere$1;
|
|
8933
8936
|
type QueryTakeOptional<T extends PickQueryResultReturnType> = T['returnType'] extends 'value' | 'pluck' | 'void' ? T : T['returnType'] extends 'valueOrThrow' ? { [K in keyof T]: K extends 'returnType' ? 'value' : K extends 'then' ? QueryThen<T['result']['value']['__outputType'] | undefined> : T[K]; } : { [K in keyof T]: K extends 'returnType' ? 'one' : K extends 'then' ? QueryThenShallowSimplifyOptional<ColumnsShape$1.Output<T['result']>> : T[K]; };
|
|
8934
8937
|
type QueryManyTakeOptional$1<T extends PickQueryResultReturnType> = { [K in keyof T]: K extends 'returnType' ? 'one' : K extends 'then' ? QueryThenShallowSimplifyOptional<ColumnsShape$1.Output<T['result']>> : T[K]; };
|
|
8935
|
-
type QueryRequire<T extends PickQueryResultReturnType> = T['returnType'] extends QueryReturnTypeAll | 'valueOrThrow' | 'pluck' | 'void' ? T : T['returnType'] extends 'value' ? { [K in keyof T]: K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<Exclude<T['result']['value']['__outputType'], undefined>> : T[K]; } : { [K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'then' ? QueryThenShallowSimplify<ColumnsShape$1.Output<T['result']>> : T[K]; };
|
|
8936
|
-
type QueryTake$1<T extends PickQueryResultReturnType> = T['returnType'] extends 'valueOrThrow' | 'pluck' | 'void' ? T : T['returnType'] extends 'value' ? { [K in keyof T]: K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<Exclude<T['result']['value']['__outputType'], undefined>> : T[K]; } : { [K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'then' ? QueryThenShallowSimplify<ColumnsShape$1.Output<T['result']>> : T[K]; };
|
|
8937
|
-
type QueryManyTake$1<T extends PickQueryResultReturnType> = { [K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'then' ? QueryThenShallowSimplify<ColumnsShape$1.Output<T['result']>> : T[K]; };
|
|
8938
|
-
type SetQueryReturnsOne<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'then' ? QueryThenShallowSimplify<ColumnsShape$1.Output<T['result']>> : T[K]; };
|
|
8939
|
-
type SetQueryReturnsOneResult<T extends PickQueryResult, Result extends Column$1.QueryColumns> = { [K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'result' ? Result : K extends 'then' ? QueryThenShallowSimplify<ColumnsShape$1.Output<Result>> : T[K]; };
|
|
8938
|
+
type QueryRequire<T extends PickQueryResultReturnType> = T['returnType'] extends QueryReturnTypeAll | 'valueOrThrow' | 'pluck' | 'void' ? T : T['returnType'] extends 'value' ? { [K in keyof T]: K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<Exclude<T['result']['value']['__outputType'], undefined>> : T[K]; } : { [K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'then' ? QueryThenShallowSimplify$1<ColumnsShape$1.Output<T['result']>> : T[K]; };
|
|
8939
|
+
type QueryTake$1<T extends PickQueryResultReturnType> = T['returnType'] extends 'valueOrThrow' | 'pluck' | 'void' ? T : T['returnType'] extends 'value' ? { [K in keyof T]: K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<Exclude<T['result']['value']['__outputType'], undefined>> : T[K]; } : { [K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'then' ? QueryThenShallowSimplify$1<ColumnsShape$1.Output<T['result']>> : T[K]; };
|
|
8940
|
+
type QueryManyTake$1<T extends PickQueryResultReturnType> = { [K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'then' ? QueryThenShallowSimplify$1<ColumnsShape$1.Output<T['result']>> : T[K]; };
|
|
8941
|
+
type SetQueryReturnsOne<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'then' ? QueryThenShallowSimplify$1<ColumnsShape$1.Output<T['result']>> : T[K]; };
|
|
8942
|
+
type SetQueryReturnsOneResult<T extends PickQueryResult, Result extends Column$1.QueryColumns> = { [K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'result' ? Result : K extends 'then' ? QueryThenShallowSimplify$1<ColumnsShape$1.Output<Result>> : T[K]; };
|
|
8940
8943
|
type SetQueryReturnsRows<T extends PickQueryResult> = { [K in keyof T]: K extends 'returnType' ? 'rows' : K extends 'then' ? QueryThen<ColumnsShape$1.Output<T['result']>[keyof T['result']][][]> : T[K]; };
|
|
8941
8944
|
type SetQueryReturnsPluck<T extends PickQuerySelectable, S extends keyof T['__selectable'] | Expression$1> = S extends keyof T['__selectable'] ? { [K in keyof T]: K extends '__hasSelect' ? true : K extends 'result' ? {
|
|
8942
8945
|
pluck: T['__selectable'][S]['column'];
|
|
@@ -9521,7 +9524,6 @@ declare abstract class Column$1 {
|
|
|
9521
9524
|
* const size = await db.table.get('size');
|
|
9522
9525
|
* ```
|
|
9523
9526
|
*
|
|
9524
|
-
* @deprecated use `type` instead
|
|
9525
9527
|
*/
|
|
9526
9528
|
narrowType: this['__schema']['narrowType'];
|
|
9527
9529
|
/**
|
|
@@ -10034,4 +10036,4 @@ declare abstract class Column$1 {
|
|
|
10034
10036
|
*/
|
|
10035
10037
|
generated<T extends Column.Pick.Data>(this: T, ...args: StaticSQLArgs$1): Column.Generated<T>;
|
|
10036
10038
|
}
|
|
10037
|
-
export { type Adapter, AdapterClass, type AdapterConfigBase, type AdapterParams, type AdapterSchemaConfigOptions, type AfterCommitStandaloneHook, type AfterHook, ArrayColumn, type ArrayColumnValue, type ArrayData, type AsyncState, type BaseNumberData, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BoxColumn, type BrandColumn, type BrandColumnsShape, ByteaColumn, CannotMutateReadOnlyTableError, CidrColumn, CircleColumn, CitextColumn, type Code, type Codes, Column, type ColumnFromDbParams, type ColumnRefExpression, type ColumnSchemaConfig, type ColumnSchemaGetterColumns, type ColumnSchemaGetterTableClass, type ColumnToCodeCtx, type ColumnTypeSchemaArg, type ColumnsByType, type ColumnsShape, type ComputedColumnsFromOptions, type ComputedOptionsConfig, type ComputedOptionsFactory, type CreateCtx, type CreateData, type CreateManyMethodsNames, type CreateMethodsNames, type CreateSelf, CustomTypeColumn, DateColumn, type DateColumnData, type DateColumnInput, type DbDomainArg, type DbExtension, type DbOptions, type DbResult, type DbSharedOptions, type DbSqlMethod, type DbStructureDomainsMap, type DbTableOptionScopes, type DbTableOptions, DecimalColumn, type DecimalColumnData, type DefaultColumnTypes, type DefaultPrivileges, type DefaultSchemaConfig, type DeleteMethodsNames, DomainColumn, DoublePrecisionColumn, type DriverAdapter, DynamicRawSQL, type EmptyObject, type EmptyTuple, EnumColumn, Expression, type ExpressionData, type FromArg, type FromResult, type GeneratorIgnore, type Grant, type HookSelectValue, InetColumn, IntegerColumn, IntervalColumn, type IsQuery, type IsolationLevel, JSONColumn, JSONTextColumn, type JoinedShapes, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, type MapTableScopesOption, type MaybeArray, type MaybePromise, type MergeQuery, MoneyColumn, type NoPrimaryKeyOption, type NonUniqDataItem, type NumberColumnData, Operators, type OperatorsArray, type OperatorsDate, type OperatorsJson, type OperatorsNumber, type OperatorsOrdinalText, type OperatorsText, OrchidOrmError, type Ord, PathColumn, type PickQueryInputType, type PickQueryInternal, type PickQueryQ, type PickQueryRelations, type PickQuerySelectableRelations, type PickQueryShape, PointColumn, PolygonColumn, PostgisGeographyPointColumn, type QueryAfterHook, type QueryBeforeActionHook, type QueryBeforeHook, type QueryData, type QueryHasWhere, QueryHookUtils, QueryHooks, type QueryInternal, type QueryLogObject, type QueryLogOptions, type QueryLogger, type QueryManyTake, type QueryManyTakeOptional, type QueryOrExpression, type QueryResult, type QueryResultRow, type QueryReturnType, type QuerySchema, type QueryScopes, type QueryTake, RawSql, type RawSqlBase, RealColumn, type RecordKeyTrue, type RecordOptionalString, type RecordString, type RecordStringOrNumber, type RecordUnknown, type RelationConfigBase, type RelationJoinQuery, type RelationsBase, type Rls, type RlsPolicy, type SchemaConfigFnWithOptions, type SearchWeight, type SelectAsFnReturnType, type SelectResultObj, type SelectSqlColumn, type SelectableFromShape, SerialColumn, type SerialColumnData, type ShallowSimplify, type ShapeUniqueColumns, type SingleSql, type SingleSqlItem, SmallIntColumn, SmallSerialColumn, type Sql, type SqlFn, type SqlSessionState, type StaticSQLArgs, type StorageOptions, StringColumn, type StringData, type TableData, type TableDataFn, type TableDataInput, type TableDataItem, type TableDataItemsUniqueColumnTuples, type TableDataItemsUniqueColumns, type TableDataItemsUniqueConstraints, type TableDataMethods, type TemplateLiteralArgs, TextColumn, TimeColumn, TimestampColumn, TimestampTZColumn, type Timestamps, type ToSQLCtx, type ToSqlValues, type TransactionAdapter, TransactionAdapterClass, type TransactionOptions, TsQueryColumn, TsVectorColumn, UUIDColumn, type UniqueConstraints, type UniqueTableDataItem, UnknownColumn, type UpdateData, type UpdateSelf, type UpsertData, type UpsertThis, VarCharColumn, VirtualColumn, type WhereArg, XMLColumn, _appendQuery, _appendQueryOnUpsertCreate, _clone, _createDbSqlMethod, _hookSelectColumns, _initQueryBuilder, _onUpsertUpdate, _orCreate, _prependWith, _prependWithOnUpsertCreate, _queryCreate, _queryCreateMany, _queryCreateManyFrom, _queryDefaults, _queryDelete, _queryFindBy, _queryFindByOptional, _queryHookAfterCreate, _queryHookAfterUpdate, _queryInsert, _queryInsertForEachFrom, _queryInsertMany, _queryInsertManyFrom, _queryJoinOn, _queryRows, _querySelect, _queryTake, _queryTakeOptional, _queryUpdate, _queryUpdateOrThrow, _queryUpsert, _queryWhere, _queryWhereExists, _queryWhereIn, addCode, addTopCte, addTopCteSql, applyMixins, assignDbDataToColumn, backtickQuote, cloneQueryBaseUnscoped, codeToString, colors, columnsShapeToCode, constraintInnerToCode, constraintToCode, consumeColumnName, deepCompare, defaultSchemaConfig, emptyArray, emptyObject, escapeForMigration, escapeString, excludeInnerToCode, excludeToCode, exhaustive, getCallerFilePath, getClonedQueryData, getColumnBaseType, getColumnTypes, getDateAsDateFn, getDateAsNumberFn, getDriverErrorCode, getForeignKeyTableInstance, getFreeAlias, getFreeSetAlias, getImportPath, getPrimaryKeys, getQueryAs, getQuerySchema, getShapeFromSelect, getSqlText, getStackTrace, getSupportedDefaultPrivileges, indexInnerToCode, indexToCode, internalSchemaConfig, isExpression, isQueryReturnsAll, isRawSQL, logColors, logParamToLogObject, makeColumnNullable, makeColumnTypes, makeColumnsByType, makeConnectRetryConfig, noop, objectHasValues, omit, parseTableData, parseTableDataInput, pathToLog, pick, pluralize, prepareSubQueryForSql, primaryKeyInnerToCode, pushQueryOnForOuter, pushQueryValueImmutable, pushTableDataCode, queryToSql, quoteIdentifier, quoteObjectKey, quoteTableWithSchema, raw, rawSqlToCode, rawSqlToSql, referencesArgsToCode, returnArg, setColumnData, setColumnEncode, setColumnParse, setColumnParseNull, setCurrentColumnName, setDataValue, setDefaultLanguage, setFreeAlias, setQueryObjectValueImmutable, singleQuote, sqlToRawSql, tableDataMethods, toArray, toCamelCase, toPascalCase, toSnakeCase, wrapAdapterFnWithConnectRetry };
|
|
10039
|
+
export { type Adapter, AdapterClass, type AdapterConfigBase, type AdapterParams, type AdapterSchemaConfigOptions, type AfterCommitStandaloneHook, type AfterHook, ArrayColumn, type ArrayColumnValue, type ArrayData, type AsyncState, type BaseNumberData, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BoxColumn, type BrandColumn, type BrandColumnsShape, ByteaColumn, CannotMutateReadOnlyTableError, CidrColumn, CircleColumn, CitextColumn, type Code, type Codes, Column, type ColumnFromDbParams, type ColumnRefExpression, type ColumnSchemaConfig, type ColumnSchemaGetterColumns, type ColumnSchemaGetterTableClass, type ColumnToCodeCtx, type ColumnTypeSchemaArg, type ColumnsByType, type ColumnsShape, type ComputedColumnsFromOptions, type ComputedOptionsConfig, type ComputedOptionsFactory, type CreateCtx, type CreateData, type CreateManyMethodsNames, type CreateMethodsNames, type CreateSelf, CustomTypeColumn, DateColumn, type DateColumnData, type DateColumnInput, type DbDomainArg, type DbExtension, type DbOptions, type DbResult, type DbSharedOptions, type DbSqlMethod, type DbStructureDomainsMap, type DbTableOptionScopes, type DbTableOptions, DecimalColumn, type DecimalColumnData, type DefaultColumnTypes, type DefaultPrivileges, type DefaultSchemaConfig, type DeleteMethodsNames, DomainColumn, DoublePrecisionColumn, type DriverAdapter, DynamicRawSQL, type EmptyObject, type EmptyTuple, EnumColumn, Expression, type ExpressionData, type FromArg, type FromResult, type GeneratorIgnore, type Grant, type HookSelectValue, InetColumn, IntegerColumn, IntervalColumn, type IsQuery, type IsolationLevel, JSONColumn, JSONTextColumn, type JoinedShapes, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, type MapTableScopesOption, type MaybeArray, type MaybePromise, type MergeQuery, MoneyColumn, type NoPrimaryKeyOption, type NonUniqDataItem, type NumberColumnData, Operators, type OperatorsArray, type OperatorsDate, type OperatorsJson, type OperatorsNumber, type OperatorsOrdinalText, type OperatorsText, OrchidOrmError, type Ord, PathColumn, type PickQueryInputType, type PickQueryInternal, type PickQueryQ, type PickQueryRelations, type PickQuerySelectableRelations, type PickQueryShape, PointColumn, PolygonColumn, PostgisGeographyPointColumn, type QueryAfterHook, type QueryBeforeActionHook, type QueryBeforeHook, type QueryCatch, type QueryData, type QueryHasWhere, QueryHookUtils, QueryHooks, type QueryInternal, type QueryLogObject, type QueryLogOptions, type QueryLogger, type QueryManyTake, type QueryManyTakeOptional, type QueryOrExpression, type QueryResult, type QueryResultRow, type QueryReturnType, type QuerySchema, type QueryScopes, type QueryTake, type QueryThen, type QueryThenShallowSimplify, RawSql, type RawSqlBase, RealColumn, type RecordKeyTrue, type RecordOptionalString, type RecordString, type RecordStringOrNumber, type RecordUnknown, type RelationConfigBase, type RelationJoinQuery, type RelationsBase, type Rls, type RlsPolicy, type SchemaConfigFnWithOptions, type SearchWeight, type SelectAs, type SelectAsFnReturnType, type SelectResultObj, type SelectSqlColumn, type SelectableFromShape, SerialColumn, type SerialColumnData, type ShallowSimplify, type ShapeUniqueColumns, type SingleSql, type SingleSqlItem, SmallIntColumn, SmallSerialColumn, type Sql, type SqlFn, type SqlSessionState, type StaticSQLArgs, type StorageOptions, StringColumn, type StringData, type TableData, type TableDataFn, type TableDataInput, type TableDataItem, type TableDataItemsUniqueColumnTuples, type TableDataItemsUniqueColumns, type TableDataItemsUniqueConstraints, type TableDataMethods, type TemplateLiteralArgs, TextColumn, TimeColumn, TimestampColumn, TimestampTZColumn, type Timestamps, type ToSQLCtx, type ToSqlValues, type TransactionAdapter, TransactionAdapterClass, type TransactionOptions, TsQueryColumn, TsVectorColumn, UUIDColumn, type UniqueConstraints, type UniqueTableDataItem, UnknownColumn, type UpdateData, type UpdateSelf, type UpsertData, type UpsertThis, ValExpression, VarCharColumn, VirtualColumn, type WhereArg, XMLColumn, _appendQuery, _appendQueryOnUpsertCreate, _clone, _createDbSqlMethod, _hookSelectColumns, _initQueryBuilder, _onUpsertUpdate, _orCreate, _prependWith, _prependWithOnUpsertCreate, _queryCreate, _queryCreateMany, _queryCreateManyFrom, _queryDefaults, _queryDelete, _queryFindBy, _queryFindByOptional, _queryHookAfterCreate, _queryHookAfterUpdate, _queryInsert, _queryInsertForEachFrom, _queryInsertMany, _queryInsertManyFrom, _queryJoinOn, _queryRows, _querySelect, _queryTake, _queryTakeOptional, _queryUpdate, _queryUpdateOrThrow, _queryUpsert, _queryWhere, _queryWhereExists, _queryWhereIn, addCode, addTopCte, addTopCteSql, applyMixins, assignDbDataToColumn, backtickQuote, cloneQueryBaseUnscoped, codeToString, colors, columnsShapeToCode, constraintInnerToCode, constraintToCode, consumeColumnName, deepCompare, defaultSchemaConfig, emptyArray, emptyObject, escapeForMigration, escapeString, excludeInnerToCode, excludeToCode, exhaustive, getCallerFilePath, getClonedQueryData, getColumnBaseType, getColumnTypes, getDateAsDateFn, getDateAsNumberFn, getDriverErrorCode, getForeignKeyTableInstance, getFreeAlias, getFreeSetAlias, getImportPath, getPrimaryKeys, getQueryAs, getQuerySchema, getShapeFromSelect, getSqlText, getStackTrace, getSupportedDefaultPrivileges, indexInnerToCode, indexToCode, internalSchemaConfig, isExpression, isQueryReturnsAll, isRawSQL, logColors, logParamToLogObject, makeColumnNullable, makeColumnTypes, makeColumnsByType, makeConnectRetryConfig, noop, objectHasValues, omit, parseTableData, parseTableDataInput, pathToLog, pick, pluralize, prepareSubQueryForSql, primaryKeyInnerToCode, pushQueryOnForOuter, pushQueryValueImmutable, pushTableDataCode, queryToSql, quoteIdentifier, quoteObjectKey, quoteTableWithSchema, raw, rawSqlToCode, rawSqlToSql, referencesArgsToCode, returnArg, setColumnData, setColumnEncode, setColumnParse, setColumnParseNull, setCurrentColumnName, setDataValue, setDefaultLanguage, setFreeAlias, setQueryObjectValueImmutable, singleQuote, sqlToRawSql, tableDataMethods, toArray, toCamelCase, toPascalCase, toSnakeCase, wrapAdapterFnWithConnectRetry };
|
package/dist/internal.js
CHANGED
|
@@ -213,6 +213,17 @@ var SqlRefExpression = class extends Expression$1 {
|
|
|
213
213
|
return `"${this.name.replaceAll("\"", "\"\"").replaceAll(".", "\".\"")}"`;
|
|
214
214
|
}
|
|
215
215
|
};
|
|
216
|
+
var ValExpression$1 = class extends Expression$1 {
|
|
217
|
+
constructor(value) {
|
|
218
|
+
super();
|
|
219
|
+
this.value = value;
|
|
220
|
+
this.result = { value: emptyObject$1 };
|
|
221
|
+
this.q = { expr: this };
|
|
222
|
+
}
|
|
223
|
+
makeSQL(ctx) {
|
|
224
|
+
return addValue(ctx.values, this.value);
|
|
225
|
+
}
|
|
226
|
+
};
|
|
216
227
|
let prepareSubQueryForSql$3;
|
|
217
228
|
const setRawSqlPrepareSubQueryForSql = (fn) => {
|
|
218
229
|
prepareSubQueryForSql$3 = fn;
|
|
@@ -322,6 +333,7 @@ const sqlFn = ((...args) => {
|
|
|
322
333
|
sqlFn.ref = (name) => new SqlRefExpression(name);
|
|
323
334
|
sqlFn.join = (items, separator) => new SqlJoinExpression(items, separator);
|
|
324
335
|
sqlFn.unsafe = (sql) => new UnsafeSqlExpression(sql);
|
|
336
|
+
sqlFn.val = (value) => new ValExpression$1(value);
|
|
325
337
|
var UnsafeSqlExpression = class extends Expression$1 {
|
|
326
338
|
constructor(sql) {
|
|
327
339
|
super();
|
|
@@ -3198,8 +3210,6 @@ function maybeWrappedThen(resolve, reject, parentSavepoint) {
|
|
|
3198
3210
|
})).then(resolve, reject);
|
|
3199
3211
|
else return then(this, state?.transactionAdapter || this.q.adapter, state, beforeHooks, afterHooks, afterSaveHooks, afterCommitHooks, afterSaveCommitHooks, resolve, reject, shouldCatch, parentSavepoint);
|
|
3200
3212
|
}
|
|
3201
|
-
const queriesNames = {};
|
|
3202
|
-
let nameI = 0;
|
|
3203
3213
|
const callAfterHook = function(cb) {
|
|
3204
3214
|
return cb(this[0], this[1]);
|
|
3205
3215
|
};
|
|
@@ -3231,7 +3241,7 @@ const then = async (q, adapter, state, beforeHooks, afterHooks, afterSaveHooks,
|
|
|
3231
3241
|
const startingSavepoint = setCatchingSavepoint(!parentSavepoint && shouldCatch && state);
|
|
3232
3242
|
const releasingSavepoint = checkIfShouldReleaseSavepointForMutativeQueriesSelectRelations(sql) || parentSavepoint ? void 0 : parentSavepoint || startingSavepoint;
|
|
3233
3243
|
if ("text" in sql) {
|
|
3234
|
-
if (query.autoPreparedStatements) sql.
|
|
3244
|
+
if (query.autoPreparedStatements) sql.prepare = true;
|
|
3235
3245
|
if (log) logData = log.beforeQuery(sql);
|
|
3236
3246
|
const method = queryMethodByReturnType[tempReturnType];
|
|
3237
3247
|
queryResult = await execQuery(adapter, method, sql, log, startingSavepoint, releasingSavepoint, sqlSessionContextGetStateFromAsyncState(state));
|
|
@@ -3465,12 +3475,13 @@ const setCatchingSavepoint = (catchTrx) => {
|
|
|
3465
3475
|
* because user might expect empty objects to be returned for an empty select.
|
|
3466
3476
|
*/
|
|
3467
3477
|
const execQuery = (adapter, method, sql, log, startingSavepoint, releasingSavepoint, sqlSessionState) => {
|
|
3478
|
+
const prepare = sql.prepare;
|
|
3468
3479
|
let promise;
|
|
3469
3480
|
if (startingSavepoint) if (releasingSavepoint) promise = startingSavepoint.transactionAdapter.savepoint(startingSavepoint.name, log, () => {
|
|
3470
|
-
return promise = adapter[method](sql.text, sql.values, sqlSessionState);
|
|
3481
|
+
return prepare ? promise = adapter[method](sql.text, sql.values, sqlSessionState, prepare) : promise = adapter[method](sql.text, sql.values, sqlSessionState);
|
|
3471
3482
|
});
|
|
3472
|
-
else promise = startingSavepoint.transactionAdapter.hackySavepoint(startingSavepoint, sql.text, sql.values, method === "arrays", log);
|
|
3473
|
-
else promise = adapter[method](sql.text, sql.values, sqlSessionState);
|
|
3483
|
+
else promise = prepare ? startingSavepoint.transactionAdapter.hackySavepoint(startingSavepoint, sql.text, sql.values, method === "arrays", prepare, log) : startingSavepoint.transactionAdapter.hackySavepoint(startingSavepoint, sql.text, sql.values, method === "arrays", void 0, log);
|
|
3484
|
+
else promise = prepare ? adapter[method](sql.text, sql.values, sqlSessionState, prepare) : adapter[method](sql.text, sql.values, sqlSessionState);
|
|
3474
3485
|
if (!startingSavepoint && releasingSavepoint) promise = promise.then(async (res) => {
|
|
3475
3486
|
await releasingSavepoint.activeSavepoint?.release();
|
|
3476
3487
|
return res;
|
|
@@ -3994,8 +4005,7 @@ const addParserForSelectItem = (query, as, key, arg, columnAlias, joinQuery) =>
|
|
|
3994
4005
|
}
|
|
3995
4006
|
return arg;
|
|
3996
4007
|
}
|
|
3997
|
-
|
|
3998
|
-
return setParserForSelectedString(query, joinedAs ? joinedAs + "." + arg : arg, as, key, columnAlias);
|
|
4008
|
+
return setParserForSelectedString(query, arg, as, key, columnAlias);
|
|
3999
4009
|
};
|
|
4000
4010
|
const collectNestedSelectBatches = (batches, rows, path) => {
|
|
4001
4011
|
const last = path.length - 1;
|
|
@@ -4030,7 +4040,8 @@ const processSelectAsArg = (q, selectAs, as, key, arg, columnAlias, outerReturnT
|
|
|
4030
4040
|
if (isExpression$1(value)) column = value.result.value;
|
|
4031
4041
|
else {
|
|
4032
4042
|
const isSelfReferencingQuery = value.q.subQuery === 1;
|
|
4033
|
-
|
|
4043
|
+
const isSelectingRelation = value.q.subQuery && value.q.subQuery > 1;
|
|
4044
|
+
if (isRelationQuery(value) && isSelectingRelation) {
|
|
4034
4045
|
joinQuery = true;
|
|
4035
4046
|
setSelectRelation(query.q);
|
|
4036
4047
|
value = value.joinQuery(value, q);
|
|
@@ -4075,6 +4086,12 @@ const processSelectAsArg = (q, selectAs, as, key, arg, columnAlias, outerReturnT
|
|
|
4075
4086
|
};
|
|
4076
4087
|
const setParserForSelectedString = (query, arg, as, columnAs, columnAlias) => {
|
|
4077
4088
|
const { q } = query;
|
|
4089
|
+
const joinedAs = q.valuesJoinedAs?.[arg];
|
|
4090
|
+
if (joinedAs) {
|
|
4091
|
+
const parser = q.joinedParsers?.[joinedAs]?.v;
|
|
4092
|
+
if (parser) setParserToQuery(q, columnAs || arg, parser);
|
|
4093
|
+
return joinedAs + "." + arg;
|
|
4094
|
+
}
|
|
4078
4095
|
const index = arg.indexOf(".");
|
|
4079
4096
|
if (index === -1) return selectColumn(query, q, arg, columnAs, columnAlias);
|
|
4080
4097
|
const table = getFullColumnTable(query, arg, index, as);
|
|
@@ -4204,6 +4221,7 @@ const _get = (query, returnType, arg) => {
|
|
|
4204
4221
|
const q = query.q;
|
|
4205
4222
|
if (q.returning) q.returning = void 0;
|
|
4206
4223
|
q.returnType = returnType;
|
|
4224
|
+
q.batchParsers = void 0;
|
|
4207
4225
|
let value = arg;
|
|
4208
4226
|
const selectAs = {};
|
|
4209
4227
|
let column;
|
|
@@ -6481,6 +6499,12 @@ Object.defineProperty(exports, "UnknownColumn", {
|
|
|
6481
6499
|
return src_index_ts.UnknownColumn;
|
|
6482
6500
|
}
|
|
6483
6501
|
});
|
|
6502
|
+
Object.defineProperty(exports, "ValExpression", {
|
|
6503
|
+
enumerable: true,
|
|
6504
|
+
get: function() {
|
|
6505
|
+
return src_index_ts.ValExpression;
|
|
6506
|
+
}
|
|
6507
|
+
});
|
|
6484
6508
|
Object.defineProperty(exports, "VarCharColumn", {
|
|
6485
6509
|
enumerable: true,
|
|
6486
6510
|
get: function() {
|