pqb 0.61.3 → 0.61.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/index.d.ts +11 -8
- package/dist/index.js +28 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -15
- package/dist/index.mjs.map +1 -1
- package/dist/node-postgres.d.ts +10 -6
- package/dist/node-postgres.js +26 -8
- package/dist/node-postgres.js.map +1 -1
- package/dist/node-postgres.mjs +26 -8
- package/dist/node-postgres.mjs.map +1 -1
- package/dist/postgres-js.d.ts +8 -4
- package/dist/postgres-js.js +35 -20
- package/dist/postgres-js.js.map +1 -1
- package/dist/postgres-js.mjs +35 -20
- package/dist/postgres-js.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -10894,16 +10894,17 @@ declare abstract class OrchidOrmError extends Error {
|
|
|
10894
10894
|
declare class NotFoundError extends OrchidOrmError {
|
|
10895
10895
|
#private;
|
|
10896
10896
|
constructor(query: IsQuery, message?: string);
|
|
10897
|
-
|
|
10897
|
+
getQuery(): Query;
|
|
10898
10898
|
}
|
|
10899
10899
|
declare class OrchidOrmInternalError extends Error {
|
|
10900
10900
|
#private;
|
|
10901
10901
|
data?: RecordUnknown | undefined;
|
|
10902
10902
|
constructor(query: IsQuery, message?: string, data?: RecordUnknown | undefined);
|
|
10903
|
-
|
|
10903
|
+
getQuery(): Query;
|
|
10904
10904
|
}
|
|
10905
10905
|
type QueryErrorName = 'parseComplete' | 'bindComplete' | 'closeComplete' | 'noData' | 'portalSuspended' | 'replicationStart' | 'emptyQuery' | 'copyDone' | 'copyData' | 'rowDescription' | 'parameterDescription' | 'parameterStatus' | 'backendKeyData' | 'notification' | 'readyForQuery' | 'commandComplete' | 'dataRow' | 'copyInResponse' | 'copyOutResponse' | 'authenticationOk' | 'authenticationMD5Password' | 'authenticationCleartextPassword' | 'authenticationSASL' | 'authenticationSASLContinue' | 'authenticationSASLFinal' | 'error' | 'notice';
|
|
10906
10906
|
declare abstract class QueryError<T extends PickQueryShape = PickQueryShape> extends OrchidOrmInternalError {
|
|
10907
|
+
#private;
|
|
10907
10908
|
message: string;
|
|
10908
10909
|
name: QueryErrorName;
|
|
10909
10910
|
stack: string | undefined;
|
|
@@ -10924,9 +10925,6 @@ declare abstract class QueryError<T extends PickQueryShape = PickQueryShape> ext
|
|
|
10924
10925
|
line: string | undefined;
|
|
10925
10926
|
routine: string | undefined;
|
|
10926
10927
|
get isUnique(): boolean;
|
|
10927
|
-
columnsCache?: {
|
|
10928
|
-
[K in keyof T['shape']]?: true;
|
|
10929
|
-
};
|
|
10930
10928
|
get columns(): { [K in keyof T["shape"]]?: true | undefined; };
|
|
10931
10929
|
}
|
|
10932
10930
|
declare class MoreThanOneRowError extends OrchidOrmInternalError {
|
|
@@ -11021,6 +11019,10 @@ interface AdapterConfigConnectRetry {
|
|
|
11021
11019
|
interface AdapterConfigConnectRetryStrategy {
|
|
11022
11020
|
(attempt: number, attempts: number): Promise<void> | void;
|
|
11023
11021
|
}
|
|
11022
|
+
interface AdapterTransactionOptions {
|
|
11023
|
+
options?: string;
|
|
11024
|
+
searchPath?: string;
|
|
11025
|
+
}
|
|
11024
11026
|
interface AdapterBase {
|
|
11025
11027
|
connectRetryConfig?: AdapterConfigConnectRetry;
|
|
11026
11028
|
searchPath?: string;
|
|
@@ -11038,6 +11040,7 @@ interface AdapterBase {
|
|
|
11038
11040
|
getUser(): string;
|
|
11039
11041
|
getSearchPath(): string | undefined;
|
|
11040
11042
|
getHost(): string;
|
|
11043
|
+
getSchema(): QuerySchema | undefined;
|
|
11041
11044
|
connect?(): Promise<unknown>;
|
|
11042
11045
|
query<T extends QueryResultRow = QueryResultRow>(text: string, values?: unknown[], catchingSavepoint?: string): Promise<QueryResult<T>>;
|
|
11043
11046
|
arrays<R extends any[] = any[]>(// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
@@ -11045,10 +11048,10 @@ interface AdapterBase {
|
|
|
11045
11048
|
/**
|
|
11046
11049
|
* Run a transaction
|
|
11047
11050
|
*
|
|
11048
|
-
* @param options - optional transaction parameters
|
|
11049
11051
|
* @param cb - callback will be called with a db client with a dedicated connection.
|
|
11052
|
+
* @param options - optional transaction parameters
|
|
11050
11053
|
*/
|
|
11051
|
-
transaction<T>(
|
|
11054
|
+
transaction<T>(cb: (adapter: TransactionAdapterBase) => Promise<T>, options?: AdapterTransactionOptions): Promise<T>;
|
|
11052
11055
|
close(): Promise<void>;
|
|
11053
11056
|
}
|
|
11054
11057
|
/**
|
|
@@ -11101,4 +11104,4 @@ declare const testTransaction: {
|
|
|
11101
11104
|
close(arg: Arg): Promise<void>;
|
|
11102
11105
|
};
|
|
11103
11106
|
|
|
11104
|
-
export { type AdapterBase, type AdapterConfigBase, type AdapterConfigConnectRetry, type AddQueryDefaults, type AdditionalDateData, type AdditionalNumberData, type AdditionalStringData, AfterCommitError, type AfterCommitErrorFulfilledResult, type AfterCommitErrorHandler, type AfterCommitErrorRejectedResult, type AfterCommitErrorResult, type AfterCommitHook, type AfterCommitStandaloneHook, type AfterHook, type AggregateOptions, type ArgWithBeforeAndBeforeSet, ArrayColumn, type ArrayColumnValue, type ArrayData, type ArrayMethodsData, type ArrayMethodsDataForBaseColumn, type AsFn, type AsQueryArg, type AsyncState, type AsyncTransactionState, type BaseNumberData, type BatchSql, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BoxColumn, ByteaColumn, type ChangeCountArg, CidrColumn, CircleColumn, CitextColumn, type Code, type Codes, Column, type ColumnFromDbParams, ColumnRefExpression, type ColumnSchemaConfig, type ColumnSchemaGetterColumns, type ColumnSchemaGetterTableClass, type ColumnToCodeCtx, type ColumnTypeSchemaArg, type ColumnsByType, ColumnsShape, ComputedColumn, type ComputedColumns, type ComputedColumnsFromOptions, type ComputedMethods, type ComputedOptionsConfig, type ComputedOptionsFactory, type CreateBelongsToData, type CreateColumn, type CreateCtx, type CreateData, type CreateFromMethodNames, type CreateManyFromMethodNames, type CreateManyMethodsNames, type CreateMethodsNames, type CreateRelationsData, type CreateRelationsDataOmittingFKeys, type CreateResult, type CreateSelf, type CteArgsOptions, type CteHooks, type CteItem, type CteOptions, CteQuery, type CteQueryBuilder, type CteRecursiveOptions, type CteResult, type CteSqlResult, type CteTableHook, type CteTableHooks, CustomTypeColumn, DateBaseColumn, DateColumn, type DateColumnData, type DateColumnInput, DateTimeBaseClass, DateTimeTzBaseClass, Db, type DbDomainArg, type DbDomainArgRecord, type DbExtension, type DbOptions, type DbOptionsWithAdapter, type DbResult, type DbSharedOptions, type DbSqlMethod, type DbSqlQuery, type DbStructureDomainsMap, type DbTableConstructor, type DbTableOptionScopes, type DbTableOptions, DecimalColumn, type DecimalColumnData, type DefaultColumnTypes, type DefaultSchemaConfig, type DelayedRelationSelect, type DeleteArgs, type DeleteMethodsNames, type DeleteResult, DomainColumn, DoublePrecisionColumn, DynamicRawSQL, type DynamicSQLArg, type EmptyObject, type EmptyTuple, EnumColumn, Expression, type ExpressionChain, type ExpressionData, type ExpressionOutput, ExpressionTypeMethod, FnExpression, type FnExpressionArgs, type FnExpressionArgsPairs, type FnExpressionArgsValue, type FnUnknownToUnknown, type FromArg, FromMethods, type FromQuerySelf, type FromResult, type GeneratorIgnore, type GroupArgs, type HandleResult, type HasBeforeAndBeforeSet, type HasCteHooks, type HasHookSelect, type HasTableHook, type HavingItem, type HookAction, type HookSelect, type HookSelectArg, type HookSelectValue, type IdentityColumn, InetColumn, type InsertQueryDataObjectValues, IntegerBaseColumn, IntegerColumn, IntervalColumn, type IsQueries, type IsQuery, type IsSubQuery, type IsolationLevel, JSONColumn, JSONTextColumn, type JoinArgToQuery, type JoinArgs, type JoinCallback, type JoinFirstArg, type JoinItem, type JoinItemArgs, type JoinLateralResult, type JoinQueryBuilder, type JoinQueryMethod, type JoinResult, type JoinResultFromArgs, type JoinResultRequireMain, type JoinResultSelectable, type JoinValueDedupItem, type JoinedParsers, type JoinedShapes, LimitedTextBaseColumn, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, type MapTableScopesOption, type MaybeArray, type MaybePromise, type MergeQuery, type MergeQueryArg, MergeQueryMethods, MoneyColumn, MoreThanOneRowError, type MoveMutativeQueryToCte, type NoPrimaryKeyOption, type NonUniqDataItem, NotFoundError, NumberAsStringBaseColumn, NumberBaseColumn, type NumberColumnData, type NumericColumns, type OnConflictMerge, OnConflictQueryBuilder, type OnConflictSet, type OnConflictTarget, OnMethods, type Operator, type OperatorToSQL, Operators, type OperatorsAny, type OperatorsArray, type OperatorsBoolean, type OperatorsDate, type OperatorsJson, type OperatorsNumber, type OperatorsOrdinalText, type OperatorsText, type OperatorsTime, type OrCreateArg, OrExpression, type OrExpressionArg, OrchidOrmError, OrchidOrmInternalError, type OrderArg, type OrderItem, type OrderTsQueryConfig, type Over, PathColumn, type PickQueryAs, type PickQueryBaseQuery, type PickQueryColumTypes, type PickQueryDataShapeAndJoinedShapes, type PickQueryDataShapeAndJoinedShapesAndAliases, type PickQueryDefaultSelect, type PickQueryDefaults, type PickQueryHasSelect, type PickQueryHasSelectHasWhereResultReturnType, type PickQueryHasSelectResult, type PickQueryHasSelectResultReturnType, type PickQueryHasSelectResultShapeAs, type PickQueryHasWhere, type PickQueryInputType, type PickQueryInternal, type PickQueryIsSubQuery, type PickQueryMetaSelectableResultRelationsWindowsColumnTypes, type PickQueryMetaSelectableResultRelationsWithDataReturnTypeShapeAs, type PickQueryQ, type PickQueryQAndBaseQuery, type PickQueryQAndInternal, type PickQueryRelationQueries, type PickQueryRelations, type PickQueryRelationsWithData, type PickQueryResult, type PickQueryResultAs, type PickQueryResultColumnTypes, type PickQueryResultRelationsWithDataReturnTypeShape, type PickQueryResultReturnType, type PickQueryResultReturnTypeUniqueColumns, type PickQueryResultUniqueColumns, type PickQueryReturnType, type PickQueryScopes, type PickQuerySelectable, type PickQuerySelectableColumnTypes, type PickQuerySelectableRelations, type PickQuerySelectableRelationsResultReturnType, type PickQuerySelectableResult, type PickQuerySelectableResultAs, type PickQuerySelectableResultInputTypeAs, type PickQuerySelectableResultRelationsWindows, type PickQuerySelectableResultRelationsWithDataReturnType, type PickQuerySelectableResultRelationsWithDataReturnTypeShapeAs, type PickQuerySelectableResultReturnType, type PickQuerySelectableResultWindows, type PickQuerySelectableReturnType, type PickQuerySelectableShape, type PickQuerySelectableShapeAs, type PickQuerySelectableShapeRelationsReturnTypeIsSubQuery, type PickQuerySelectableShapeRelationsWithData, type PickQuerySelectableShapeRelationsWithDataAs, type PickQuerySelectableShapeRelationsWithDataAsResultReturnType, type PickQueryShape, type PickQueryShapeAs, type PickQueryShapeResultReturnTypeSinglePrimaryKey, type PickQueryShapeResultSinglePrimaryKey, type PickQueryShapeSinglePrimaryKey, type PickQuerySinglePrimaryKey, type PickQueryTable, type PickQueryTableMetaShapeTableAs, type PickQueryThen, type PickQueryTsQuery, type PickQueryUniqueProperties, type PickQueryWindows, type PickQueryWithData, type PickQueryWithDataColumnTypes, PointColumn, PolygonColumn, PostgisGeographyPointColumn, type PostgisPoint, type PrepareSubQueryForSql, type PrepareSubQueryForSqlArg, type Query, type QueryAfterHook, type QueryArraysResult, QueryAsMethods, type QueryBatchResult, type QueryBeforeActionHook, type QueryBeforeHook, type QueryBuilder, type QueryCatch, type QueryCatchers, QueryClone, type QueryComputedArg, QueryCreate, QueryCreateFrom, type QueryData, type QueryDataAliases, type QueryDataFromItem, type QueryDataJoinTo, type QueryDataScopes, type QueryDataSources, type QueryDataTransform, type QueryDataUnion, QueryDelete, QueryError, type QueryErrorName, QueryExpressions, QueryGet, type QueryHasSelect, type QueryHasWhere, type QueryHelperResult, QueryHookUtils, QueryHooks, type QueryIfResultThen, type QueryInternal, type QueryInternalColumnNameToKey, QueryJoin, QueryLog, type QueryLogObject, type QueryLogOptions, type QueryLogger, type QueryManyTake, type QueryManyTakeOptional, QueryMethods, QueryOrCreate, type QueryOrExpression, type QueryOrExpressionBooleanOrNullResult, type QueryResult, type QueryResultRow, type QueryReturnType, type QueryReturnTypeAll, type QueryReturnTypeOptional, type QuerySchema, QueryScope, type QueryScopeData, type QueryScopes, type QuerySelectable, type QuerySourceItem, QuerySql, type QueryTake, type QueryTakeOptional, type QueryThen, type QueryThenByQuery, type QueryThenByReturnType, type QueryThenShallowSimplify, type QueryThenShallowSimplifyArr, type QueryThenShallowSimplifyOptional, QueryTransaction, QueryTransform, type QueryType, QueryUpdate, QueryUpsert, QueryWithSchema, QueryWrap, type RawSQLValues, RawSql, type RawSqlBase, RealColumn, type RecordBoolean, type RecordKeyTrue, type RecordOfColumnsShapeBase, type RecordOptionalString, type RecordString, type RecordUnknown, RefExpression, type RelationConfigBase, type RelationConfigDataForCreate, type RelationConfigQuery, type RelationJoinQuery, type RelationsBase, type ReturnsQueryOrExpression, type RunAfterQuery, type RuntimeComputedQueryColumn, type SQLArgs, type SQLQueryArgs, type ScopeArgumentQuery, type SearchWeight, type SearchWeightRecord, Select, type SelectArg, type SelectArgs, type SelectAs, type SelectAsArg, type SelectAsFnArg, type SelectAsValue, type SelectItem, type SelectSelf, type SelectSubQueryResult, type SelectableFromShape, type SelectableOfType, type SelectableOrExpression, type SelectableOrExpressionOfType, type SelectableOrExpressions, SerialColumn, type SerialColumnData, type SetQueryResult, type SetQueryReturnsAll, type SetQueryReturnsAllResult, type SetQueryReturnsColumn, type SetQueryReturnsColumnOptional, type SetQueryReturnsColumnOrThrow, type SetQueryReturnsColumnResult, type SetQueryReturnsOne, type SetQueryReturnsOneResult, type SetQueryReturnsPluck, type SetQueryReturnsPluckColumnResult, type SetQueryReturnsRowCount, type SetQueryReturnsRowCountMany, type SetQueryReturnsRows, type SetQueryReturnsValueOptional, type SetQueryReturnsValueOrThrow, type SetQueryReturnsVoid, type SetQueryTableAlias, type SetValueQueryReturnsPluckColumn, type SetValueQueryReturnsValueOrThrow, type ShallowSimplify, type ShapeColumnPrimaryKeys, type ShapeUniqueColumns, type SimpleJoinItemNonSubQueryArgs, type SingleSql, type SingleSqlItem, SmallIntColumn, SmallSerialColumn, type SortDir, type Sql, type SqlCommonOptions, type SqlFn, SqlRefExpression, type StaticSQLArgs, type StorageOptions, StringColumn$1 as StringColumn, type StringData, type SubQueryForSql, TableData, type TableDataFn, type TableDataInput, type TableDataItem, type TableDataItemsUniqueColumnTuples, type TableDataItemsUniqueColumns, type TableDataItemsUniqueConstraints, type TableDataMethods, type TableHook, type TemplateLiteralArgs, TextBaseColumn, TextColumn, type TextColumnData, Then, TimeColumn, type TimeInterval, TimestampColumn, type TimestampHelpers, TimestampTZColumn, type Timestamps, type TopCTE, type TransactionAdapterBase, type TransactionAfterCommitHook, type TransactionOptions, TsQueryColumn, TsVectorColumn, UUIDColumn, UnhandledTypeError, type UnionItem, type UnionKind, type UnionSet, type UnionToIntersection, type UniqueConstraints, type UniqueQueryTypeOrExpression, type UniqueTableDataItem, UnknownColumn, UnsafeSqlExpression, type UpdateArg, type UpdateCtxCollect, type UpdateData, type UpdateQueryDataItem, type UpdateQueryDataObject, type UpdateSelf, type UpdatedAtDataInjector, type UpsertData, type UpsertResult, type UpsertThis, VarCharColumn, VirtualColumn, Where, type WhereArg, type WhereArgs, type WhereInArg, type WhereInColumn, type WhereInItem, type WhereInValues, type WhereItem, type WhereJsonPathEqualsItem, type WhereNotArgs, type WhereOnItem, type WhereOnJoinItem, type WhereQueryBuilder, type WhereSearchItem, type WindowDeclaration, type WindowItem, type WithConfig, type WithConfigs, type WithDataItem, type WithDataItems, type WithItems, type WrapQueryArg, XMLColumn, _addToHookSelect, _addToHookSelectWithTable, _appendQuery, _applyRelationAliases, _checkIfAliased, _clone, _copyQueryAliasToQuery, _createDbSqlMethod, _getQueryAliasOrName, _getQueryAs, _getQueryFreeAlias, _getQueryOuterAliases, _hookSelectColumns, _initQueryBuilder, _join, _joinLateral, _joinLateralProcessArg, _joinReturningArgs, _orCreate, _prependWith, _queryAfterSaveCommit, _queryAll, _queryChangeCounter, _queryCreate, _queryCreateForEachFrom, _queryCreateMany, _queryCreateManyFrom, _queryCreateOneFrom, _queryDefaults, _queryDelete, _queryExec, _queryFindBy, _queryFindByOptional, _queryHookAfterCreate, _queryHookAfterCreateCommit, _queryHookAfterDelete, _queryHookAfterDeleteCommit, _queryHookAfterQuery, _queryHookAfterSave, _queryHookAfterUpdate, _queryHookAfterUpdateCommit, _queryHookBeforeCreate, _queryHookBeforeDelete, _queryHookBeforeQuery, _queryHookBeforeSave, _queryHookBeforeUpdate, _queryInsert, _queryInsertForEachFrom, _queryInsertMany, _queryInsertManyFrom, _queryInsertOneFrom, _queryJoinOn, _queryJoinOnJsonPathEquals, _queryJoinOrOn, _queryOr, _queryOrNot, _queryRows, _querySelect, _querySelectAll, _queryTake, _queryTakeOptional, _queryUpdate, _queryUpdateOrThrow, _queryUpsert, _queryWhere, _queryWhereExists, _queryWhereIn, _queryWhereNot, _queryWhereNotExists, _queryWhereNotOneOf, _queryWhereNotSql, _queryWhereOneOf, _queryWhereSql, _runAfterCommitHooks, _setQueryAlias, _setQueryAs, _setSubQueryAliases, _with, addCode, addColumnParserToQuery, addParserForRawExpression, addParserForSelectItem, addQueryOn, addTopCte, addTopCteSql, addValue, addWithToSql, anyShape, applyBatchTransforms, applyComputedColumns, applyMixins, applyTransforms, arrayDataToCode, arrayMethodNames, assignDbDataToColumn, backtickQuote, callWithThis, checkIfASimpleQuery, cloneQueryBaseUnscoped, codeToString, colors, columnCheckToCode, columnCode, columnDefaultArgumentToCode, columnErrorMessagesToCode, columnExcludesToCode, columnForeignKeysToCode, columnIndexesToCode, columnMethodsToCode, columnsShapeToCode, commitSql, composeCteSingleSql, constraintInnerToCode, constraintToCode, consumeColumnName, countSelect, createCtx, createDbWithAdapter, createSelect, cteToSql, cteToSqlGiveAs, ctesToSql, dateDataToCode, dateMethodNames, deepCompare, defaultSchemaConfig, emptyArray, emptyObject, escapeForLog, escapeForMigration, escapeString, excludeInnerToCode, excludeToCode, exhaustive, extendQuery, filterResult, finalizeNestedHookSelect, foreignKeyArgumentToCode, getCallerFilePath, getClonedQueryData, getColumnBaseType, getColumnTypes, getDefaultLanguage, getDefaultNowFn, getFreeAlias, getFreeSetAlias, getFromSelectColumns, getFullColumnTable, getImportPath, getPrimaryKeys, getQueryAs, getQuerySchema, getSearchLang, getSearchText, getShapeFromSelect, getSqlText, getStackTrace, getThen, getTopCteSize, handleManyData, handleOneData, handleResult, havingToSql, identityToCode, indexInnerToCode, indexToCode, insert, isDefaultTimeStamp, isExpression, isInUserTransaction, isIterable, isObjectEmpty, isQuery, isQueryReturnsAll, isRawSQL, isRelationQuery, isTemplateLiteralArgs, joinSubQuery, joinTruthy, logColors, logParamToLogObject, makeColumnNullable, makeColumnTypes, makeColumnsByType, makeFnExpression, makeInsertSql, makeReturningSql, makeRowToJson, makeSql, moveMutativeQueryToCte, newDelayedRelationSelect, noop, numberDataToCode, numberMethodNames, objectHasValues, omit, orderByToSql, parseRecord, parseTableData, parseTableDataInput, pathToLog, performQuery, pick, pluralize, postgisTypmodToSql, prepareOpArg, prepareSubQueryForSql, primaryKeyInnerToCode, processComputedBatches, processComputedResult, processJoinItem, processSelectArg, pushColumnData, pushHavingSql, pushJoinSql, pushOrNewArray, pushOrNewArrayToObjectImmutable, pushOrderBySql, pushQueryArrayImmutable, pushQueryOn, pushQueryOnForOuter, pushQueryOrOn, pushQueryValueImmutable, pushTableDataCode, pushUnionSql, pushWhereStatementSql, pushWhereToSql, queryColumnNameToKey, queryFrom, queryFromSql, queryMethodByReturnType, queryTypeWithLimitOne, queryWrap, quoteFromWithSchema, quoteObjectKey, quoteSchemaAndTable, quoteTableWithSchema, raw, rawSqlToCode, referencesArgsToCode, requirePrimaryKeys, requireQueryAs, requireTableOrStringFrom, resetDefaultNowFn, resolveSubQueryCallback, returnArg, rollbackSql, saveAliasedShape, searchSourcesToSql, selectAllSql, selectToSql, selectToSqlList, setColumnData, setColumnDefaultParse, setColumnEncode, setColumnParse, setColumnParseNull, setConnectRetryConfig, setCurrentColumnName, setDataValue, setDb, setDefaultLanguage, setDefaultNowFn, setDelayedRelation, setFreeAlias, setFreeTopCteAs, setMoveMutativeQueryToCte, setObjectValueImmutable, setParserForSelectedString, setPrepareSubQueryForSql, setQueryObjectValueImmutable, setQueryOperators, setRawSqlPrepareSubQueryForSql, setSqlCtxSelectList, setTopCteSize, singleQuote, singleQuoteArray, snakeCaseKey, spreadObjectValues, sqlFn, sqlQueryArgsToExpression, stringDataToCode, stringMethodNames, tableDataMethods, templateLiteralSQLToCode, templateLiteralToSQL, testTransaction, throwIfJoinLateral, throwIfNoWhere, throwOnReadOnly, timestampHelpers, toArray, toCamelCase, toPascalCase, toSnakeCase, whereToSql, windowToSql, wrapAdapterFnWithConnectRetry };
|
|
11107
|
+
export { type AdapterBase, type AdapterConfigBase, type AdapterConfigConnectRetry, type AdapterTransactionOptions, type AddQueryDefaults, type AdditionalDateData, type AdditionalNumberData, type AdditionalStringData, AfterCommitError, type AfterCommitErrorFulfilledResult, type AfterCommitErrorHandler, type AfterCommitErrorRejectedResult, type AfterCommitErrorResult, type AfterCommitHook, type AfterCommitStandaloneHook, type AfterHook, type AggregateOptions, type ArgWithBeforeAndBeforeSet, ArrayColumn, type ArrayColumnValue, type ArrayData, type ArrayMethodsData, type ArrayMethodsDataForBaseColumn, type AsFn, type AsQueryArg, type AsyncState, type AsyncTransactionState, type BaseNumberData, type BatchSql, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BoxColumn, ByteaColumn, type ChangeCountArg, CidrColumn, CircleColumn, CitextColumn, type Code, type Codes, Column, type ColumnFromDbParams, ColumnRefExpression, type ColumnSchemaConfig, type ColumnSchemaGetterColumns, type ColumnSchemaGetterTableClass, type ColumnToCodeCtx, type ColumnTypeSchemaArg, type ColumnsByType, ColumnsShape, ComputedColumn, type ComputedColumns, type ComputedColumnsFromOptions, type ComputedMethods, type ComputedOptionsConfig, type ComputedOptionsFactory, type CreateBelongsToData, type CreateColumn, type CreateCtx, type CreateData, type CreateFromMethodNames, type CreateManyFromMethodNames, type CreateManyMethodsNames, type CreateMethodsNames, type CreateRelationsData, type CreateRelationsDataOmittingFKeys, type CreateResult, type CreateSelf, type CteArgsOptions, type CteHooks, type CteItem, type CteOptions, CteQuery, type CteQueryBuilder, type CteRecursiveOptions, type CteResult, type CteSqlResult, type CteTableHook, type CteTableHooks, CustomTypeColumn, DateBaseColumn, DateColumn, type DateColumnData, type DateColumnInput, DateTimeBaseClass, DateTimeTzBaseClass, Db, type DbDomainArg, type DbDomainArgRecord, type DbExtension, type DbOptions, type DbOptionsWithAdapter, type DbResult, type DbSharedOptions, type DbSqlMethod, type DbSqlQuery, type DbStructureDomainsMap, type DbTableConstructor, type DbTableOptionScopes, type DbTableOptions, DecimalColumn, type DecimalColumnData, type DefaultColumnTypes, type DefaultSchemaConfig, type DelayedRelationSelect, type DeleteArgs, type DeleteMethodsNames, type DeleteResult, DomainColumn, DoublePrecisionColumn, DynamicRawSQL, type DynamicSQLArg, type EmptyObject, type EmptyTuple, EnumColumn, Expression, type ExpressionChain, type ExpressionData, type ExpressionOutput, ExpressionTypeMethod, FnExpression, type FnExpressionArgs, type FnExpressionArgsPairs, type FnExpressionArgsValue, type FnUnknownToUnknown, type FromArg, FromMethods, type FromQuerySelf, type FromResult, type GeneratorIgnore, type GroupArgs, type HandleResult, type HasBeforeAndBeforeSet, type HasCteHooks, type HasHookSelect, type HasTableHook, type HavingItem, type HookAction, type HookSelect, type HookSelectArg, type HookSelectValue, type IdentityColumn, InetColumn, type InsertQueryDataObjectValues, IntegerBaseColumn, IntegerColumn, IntervalColumn, type IsQueries, type IsQuery, type IsSubQuery, type IsolationLevel, JSONColumn, JSONTextColumn, type JoinArgToQuery, type JoinArgs, type JoinCallback, type JoinFirstArg, type JoinItem, type JoinItemArgs, type JoinLateralResult, type JoinQueryBuilder, type JoinQueryMethod, type JoinResult, type JoinResultFromArgs, type JoinResultRequireMain, type JoinResultSelectable, type JoinValueDedupItem, type JoinedParsers, type JoinedShapes, LimitedTextBaseColumn, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, type MapTableScopesOption, type MaybeArray, type MaybePromise, type MergeQuery, type MergeQueryArg, MergeQueryMethods, MoneyColumn, MoreThanOneRowError, type MoveMutativeQueryToCte, type NoPrimaryKeyOption, type NonUniqDataItem, NotFoundError, NumberAsStringBaseColumn, NumberBaseColumn, type NumberColumnData, type NumericColumns, type OnConflictMerge, OnConflictQueryBuilder, type OnConflictSet, type OnConflictTarget, OnMethods, type Operator, type OperatorToSQL, Operators, type OperatorsAny, type OperatorsArray, type OperatorsBoolean, type OperatorsDate, type OperatorsJson, type OperatorsNumber, type OperatorsOrdinalText, type OperatorsText, type OperatorsTime, type OrCreateArg, OrExpression, type OrExpressionArg, OrchidOrmError, OrchidOrmInternalError, type OrderArg, type OrderItem, type OrderTsQueryConfig, type Over, PathColumn, type PickQueryAs, type PickQueryBaseQuery, type PickQueryColumTypes, type PickQueryDataShapeAndJoinedShapes, type PickQueryDataShapeAndJoinedShapesAndAliases, type PickQueryDefaultSelect, type PickQueryDefaults, type PickQueryHasSelect, type PickQueryHasSelectHasWhereResultReturnType, type PickQueryHasSelectResult, type PickQueryHasSelectResultReturnType, type PickQueryHasSelectResultShapeAs, type PickQueryHasWhere, type PickQueryInputType, type PickQueryInternal, type PickQueryIsSubQuery, type PickQueryMetaSelectableResultRelationsWindowsColumnTypes, type PickQueryMetaSelectableResultRelationsWithDataReturnTypeShapeAs, type PickQueryQ, type PickQueryQAndBaseQuery, type PickQueryQAndInternal, type PickQueryRelationQueries, type PickQueryRelations, type PickQueryRelationsWithData, type PickQueryResult, type PickQueryResultAs, type PickQueryResultColumnTypes, type PickQueryResultRelationsWithDataReturnTypeShape, type PickQueryResultReturnType, type PickQueryResultReturnTypeUniqueColumns, type PickQueryResultUniqueColumns, type PickQueryReturnType, type PickQueryScopes, type PickQuerySelectable, type PickQuerySelectableColumnTypes, type PickQuerySelectableRelations, type PickQuerySelectableRelationsResultReturnType, type PickQuerySelectableResult, type PickQuerySelectableResultAs, type PickQuerySelectableResultInputTypeAs, type PickQuerySelectableResultRelationsWindows, type PickQuerySelectableResultRelationsWithDataReturnType, type PickQuerySelectableResultRelationsWithDataReturnTypeShapeAs, type PickQuerySelectableResultReturnType, type PickQuerySelectableResultWindows, type PickQuerySelectableReturnType, type PickQuerySelectableShape, type PickQuerySelectableShapeAs, type PickQuerySelectableShapeRelationsReturnTypeIsSubQuery, type PickQuerySelectableShapeRelationsWithData, type PickQuerySelectableShapeRelationsWithDataAs, type PickQuerySelectableShapeRelationsWithDataAsResultReturnType, type PickQueryShape, type PickQueryShapeAs, type PickQueryShapeResultReturnTypeSinglePrimaryKey, type PickQueryShapeResultSinglePrimaryKey, type PickQueryShapeSinglePrimaryKey, type PickQuerySinglePrimaryKey, type PickQueryTable, type PickQueryTableMetaShapeTableAs, type PickQueryThen, type PickQueryTsQuery, type PickQueryUniqueProperties, type PickQueryWindows, type PickQueryWithData, type PickQueryWithDataColumnTypes, PointColumn, PolygonColumn, PostgisGeographyPointColumn, type PostgisPoint, type PrepareSubQueryForSql, type PrepareSubQueryForSqlArg, type Query, type QueryAfterHook, type QueryArraysResult, QueryAsMethods, type QueryBatchResult, type QueryBeforeActionHook, type QueryBeforeHook, type QueryBuilder, type QueryCatch, type QueryCatchers, QueryClone, type QueryComputedArg, QueryCreate, QueryCreateFrom, type QueryData, type QueryDataAliases, type QueryDataFromItem, type QueryDataJoinTo, type QueryDataScopes, type QueryDataSources, type QueryDataTransform, type QueryDataUnion, QueryDelete, QueryError, type QueryErrorName, QueryExpressions, QueryGet, type QueryHasSelect, type QueryHasWhere, type QueryHelperResult, QueryHookUtils, QueryHooks, type QueryIfResultThen, type QueryInternal, type QueryInternalColumnNameToKey, QueryJoin, QueryLog, type QueryLogObject, type QueryLogOptions, type QueryLogger, type QueryManyTake, type QueryManyTakeOptional, QueryMethods, QueryOrCreate, type QueryOrExpression, type QueryOrExpressionBooleanOrNullResult, type QueryResult, type QueryResultRow, type QueryReturnType, type QueryReturnTypeAll, type QueryReturnTypeOptional, type QuerySchema, QueryScope, type QueryScopeData, type QueryScopes, type QuerySelectable, type QuerySourceItem, QuerySql, type QueryTake, type QueryTakeOptional, type QueryThen, type QueryThenByQuery, type QueryThenByReturnType, type QueryThenShallowSimplify, type QueryThenShallowSimplifyArr, type QueryThenShallowSimplifyOptional, QueryTransaction, QueryTransform, type QueryType, QueryUpdate, QueryUpsert, QueryWithSchema, QueryWrap, type RawSQLValues, RawSql, type RawSqlBase, RealColumn, type RecordBoolean, type RecordKeyTrue, type RecordOfColumnsShapeBase, type RecordOptionalString, type RecordString, type RecordUnknown, RefExpression, type RelationConfigBase, type RelationConfigDataForCreate, type RelationConfigQuery, type RelationJoinQuery, type RelationsBase, type ReturnsQueryOrExpression, type RunAfterQuery, type RuntimeComputedQueryColumn, type SQLArgs, type SQLQueryArgs, type ScopeArgumentQuery, type SearchWeight, type SearchWeightRecord, Select, type SelectArg, type SelectArgs, type SelectAs, type SelectAsArg, type SelectAsFnArg, type SelectAsValue, type SelectItem, type SelectSelf, type SelectSubQueryResult, type SelectableFromShape, type SelectableOfType, type SelectableOrExpression, type SelectableOrExpressionOfType, type SelectableOrExpressions, SerialColumn, type SerialColumnData, type SetQueryResult, type SetQueryReturnsAll, type SetQueryReturnsAllResult, type SetQueryReturnsColumn, type SetQueryReturnsColumnOptional, type SetQueryReturnsColumnOrThrow, type SetQueryReturnsColumnResult, type SetQueryReturnsOne, type SetQueryReturnsOneResult, type SetQueryReturnsPluck, type SetQueryReturnsPluckColumnResult, type SetQueryReturnsRowCount, type SetQueryReturnsRowCountMany, type SetQueryReturnsRows, type SetQueryReturnsValueOptional, type SetQueryReturnsValueOrThrow, type SetQueryReturnsVoid, type SetQueryTableAlias, type SetValueQueryReturnsPluckColumn, type SetValueQueryReturnsValueOrThrow, type ShallowSimplify, type ShapeColumnPrimaryKeys, type ShapeUniqueColumns, type SimpleJoinItemNonSubQueryArgs, type SingleSql, type SingleSqlItem, SmallIntColumn, SmallSerialColumn, type SortDir, type Sql, type SqlCommonOptions, type SqlFn, SqlRefExpression, type StaticSQLArgs, type StorageOptions, StringColumn$1 as StringColumn, type StringData, type SubQueryForSql, TableData, type TableDataFn, type TableDataInput, type TableDataItem, type TableDataItemsUniqueColumnTuples, type TableDataItemsUniqueColumns, type TableDataItemsUniqueConstraints, type TableDataMethods, type TableHook, type TemplateLiteralArgs, TextBaseColumn, TextColumn, type TextColumnData, Then, TimeColumn, type TimeInterval, TimestampColumn, type TimestampHelpers, TimestampTZColumn, type Timestamps, type TopCTE, type TransactionAdapterBase, type TransactionAfterCommitHook, type TransactionOptions, TsQueryColumn, TsVectorColumn, UUIDColumn, UnhandledTypeError, type UnionItem, type UnionKind, type UnionSet, type UnionToIntersection, type UniqueConstraints, type UniqueQueryTypeOrExpression, type UniqueTableDataItem, UnknownColumn, UnsafeSqlExpression, type UpdateArg, type UpdateCtxCollect, type UpdateData, type UpdateQueryDataItem, type UpdateQueryDataObject, type UpdateSelf, type UpdatedAtDataInjector, type UpsertData, type UpsertResult, type UpsertThis, VarCharColumn, VirtualColumn, Where, type WhereArg, type WhereArgs, type WhereInArg, type WhereInColumn, type WhereInItem, type WhereInValues, type WhereItem, type WhereJsonPathEqualsItem, type WhereNotArgs, type WhereOnItem, type WhereOnJoinItem, type WhereQueryBuilder, type WhereSearchItem, type WindowDeclaration, type WindowItem, type WithConfig, type WithConfigs, type WithDataItem, type WithDataItems, type WithItems, type WrapQueryArg, XMLColumn, _addToHookSelect, _addToHookSelectWithTable, _appendQuery, _applyRelationAliases, _checkIfAliased, _clone, _copyQueryAliasToQuery, _createDbSqlMethod, _getQueryAliasOrName, _getQueryAs, _getQueryFreeAlias, _getQueryOuterAliases, _hookSelectColumns, _initQueryBuilder, _join, _joinLateral, _joinLateralProcessArg, _joinReturningArgs, _orCreate, _prependWith, _queryAfterSaveCommit, _queryAll, _queryChangeCounter, _queryCreate, _queryCreateForEachFrom, _queryCreateMany, _queryCreateManyFrom, _queryCreateOneFrom, _queryDefaults, _queryDelete, _queryExec, _queryFindBy, _queryFindByOptional, _queryHookAfterCreate, _queryHookAfterCreateCommit, _queryHookAfterDelete, _queryHookAfterDeleteCommit, _queryHookAfterQuery, _queryHookAfterSave, _queryHookAfterUpdate, _queryHookAfterUpdateCommit, _queryHookBeforeCreate, _queryHookBeforeDelete, _queryHookBeforeQuery, _queryHookBeforeSave, _queryHookBeforeUpdate, _queryInsert, _queryInsertForEachFrom, _queryInsertMany, _queryInsertManyFrom, _queryInsertOneFrom, _queryJoinOn, _queryJoinOnJsonPathEquals, _queryJoinOrOn, _queryOr, _queryOrNot, _queryRows, _querySelect, _querySelectAll, _queryTake, _queryTakeOptional, _queryUpdate, _queryUpdateOrThrow, _queryUpsert, _queryWhere, _queryWhereExists, _queryWhereIn, _queryWhereNot, _queryWhereNotExists, _queryWhereNotOneOf, _queryWhereNotSql, _queryWhereOneOf, _queryWhereSql, _runAfterCommitHooks, _setQueryAlias, _setQueryAs, _setSubQueryAliases, _with, addCode, addColumnParserToQuery, addParserForRawExpression, addParserForSelectItem, addQueryOn, addTopCte, addTopCteSql, addValue, addWithToSql, anyShape, applyBatchTransforms, applyComputedColumns, applyMixins, applyTransforms, arrayDataToCode, arrayMethodNames, assignDbDataToColumn, backtickQuote, callWithThis, checkIfASimpleQuery, cloneQueryBaseUnscoped, codeToString, colors, columnCheckToCode, columnCode, columnDefaultArgumentToCode, columnErrorMessagesToCode, columnExcludesToCode, columnForeignKeysToCode, columnIndexesToCode, columnMethodsToCode, columnsShapeToCode, commitSql, composeCteSingleSql, constraintInnerToCode, constraintToCode, consumeColumnName, countSelect, createCtx, createDbWithAdapter, createSelect, cteToSql, cteToSqlGiveAs, ctesToSql, dateDataToCode, dateMethodNames, deepCompare, defaultSchemaConfig, emptyArray, emptyObject, escapeForLog, escapeForMigration, escapeString, excludeInnerToCode, excludeToCode, exhaustive, extendQuery, filterResult, finalizeNestedHookSelect, foreignKeyArgumentToCode, getCallerFilePath, getClonedQueryData, getColumnBaseType, getColumnTypes, getDefaultLanguage, getDefaultNowFn, getFreeAlias, getFreeSetAlias, getFromSelectColumns, getFullColumnTable, getImportPath, getPrimaryKeys, getQueryAs, getQuerySchema, getSearchLang, getSearchText, getShapeFromSelect, getSqlText, getStackTrace, getThen, getTopCteSize, handleManyData, handleOneData, handleResult, havingToSql, identityToCode, indexInnerToCode, indexToCode, insert, isDefaultTimeStamp, isExpression, isInUserTransaction, isIterable, isObjectEmpty, isQuery, isQueryReturnsAll, isRawSQL, isRelationQuery, isTemplateLiteralArgs, joinSubQuery, joinTruthy, logColors, logParamToLogObject, makeColumnNullable, makeColumnTypes, makeColumnsByType, makeFnExpression, makeInsertSql, makeReturningSql, makeRowToJson, makeSql, moveMutativeQueryToCte, newDelayedRelationSelect, noop, numberDataToCode, numberMethodNames, objectHasValues, omit, orderByToSql, parseRecord, parseTableData, parseTableDataInput, pathToLog, performQuery, pick, pluralize, postgisTypmodToSql, prepareOpArg, prepareSubQueryForSql, primaryKeyInnerToCode, processComputedBatches, processComputedResult, processJoinItem, processSelectArg, pushColumnData, pushHavingSql, pushJoinSql, pushOrNewArray, pushOrNewArrayToObjectImmutable, pushOrderBySql, pushQueryArrayImmutable, pushQueryOn, pushQueryOnForOuter, pushQueryOrOn, pushQueryValueImmutable, pushTableDataCode, pushUnionSql, pushWhereStatementSql, pushWhereToSql, queryColumnNameToKey, queryFrom, queryFromSql, queryMethodByReturnType, queryTypeWithLimitOne, queryWrap, quoteFromWithSchema, quoteObjectKey, quoteSchemaAndTable, quoteTableWithSchema, raw, rawSqlToCode, referencesArgsToCode, requirePrimaryKeys, requireQueryAs, requireTableOrStringFrom, resetDefaultNowFn, resolveSubQueryCallback, returnArg, rollbackSql, saveAliasedShape, searchSourcesToSql, selectAllSql, selectToSql, selectToSqlList, setColumnData, setColumnDefaultParse, setColumnEncode, setColumnParse, setColumnParseNull, setConnectRetryConfig, setCurrentColumnName, setDataValue, setDb, setDefaultLanguage, setDefaultNowFn, setDelayedRelation, setFreeAlias, setFreeTopCteAs, setMoveMutativeQueryToCte, setObjectValueImmutable, setParserForSelectedString, setPrepareSubQueryForSql, setQueryObjectValueImmutable, setQueryOperators, setRawSqlPrepareSubQueryForSql, setSqlCtxSelectList, setTopCteSize, singleQuote, singleQuoteArray, snakeCaseKey, spreadObjectValues, sqlFn, sqlQueryArgsToExpression, stringDataToCode, stringMethodNames, tableDataMethods, templateLiteralSQLToCode, templateLiteralToSQL, testTransaction, throwIfJoinLateral, throwIfNoWhere, throwOnReadOnly, timestampHelpers, toArray, toCamelCase, toPascalCase, toSnakeCase, whereToSql, windowToSql, wrapAdapterFnWithConnectRetry };
|
package/dist/index.js
CHANGED
|
@@ -3526,17 +3526,19 @@ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot
|
|
|
3526
3526
|
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
3527
3527
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
3528
3528
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
|
3529
|
-
var _query, _query2;
|
|
3529
|
+
var _query, _query2, _columnsCache;
|
|
3530
3530
|
class OrchidOrmError extends Error {
|
|
3531
3531
|
}
|
|
3532
3532
|
class NotFoundError extends OrchidOrmError {
|
|
3533
3533
|
constructor(query, message = "Record is not found") {
|
|
3534
3534
|
super(message);
|
|
3535
3535
|
// `#query` is private to prevent it from serializing to not cause problems to test runner reports
|
|
3536
|
+
// it is exposed with `getQuery` method which prevents this problem from both Vitest and Jest.
|
|
3537
|
+
// Exposing it with `get query()` still leaves the issue in Vitest.
|
|
3536
3538
|
__privateAdd(this, _query);
|
|
3537
3539
|
__privateSet(this, _query, query);
|
|
3538
3540
|
}
|
|
3539
|
-
|
|
3541
|
+
getQuery() {
|
|
3540
3542
|
return __privateGet(this, _query);
|
|
3541
3543
|
}
|
|
3542
3544
|
}
|
|
@@ -3546,34 +3548,41 @@ class OrchidOrmInternalError extends Error {
|
|
|
3546
3548
|
super(message);
|
|
3547
3549
|
this.data = data;
|
|
3548
3550
|
// `#query` is private to prevent it from serializing to not cause problems to test runner reports
|
|
3551
|
+
// it is exposed with `getQuery` method which prevents this problem from both Vitest and Jest.
|
|
3552
|
+
// Exposing it with `get query()` still leaves the issue in Vitest.
|
|
3549
3553
|
__privateAdd(this, _query2);
|
|
3550
3554
|
__privateSet(this, _query2, query);
|
|
3551
3555
|
}
|
|
3552
|
-
|
|
3556
|
+
getQuery() {
|
|
3553
3557
|
return __privateGet(this, _query2);
|
|
3554
3558
|
}
|
|
3555
3559
|
}
|
|
3556
3560
|
_query2 = new WeakMap();
|
|
3557
3561
|
class QueryError extends OrchidOrmInternalError {
|
|
3562
|
+
constructor() {
|
|
3563
|
+
super(...arguments);
|
|
3564
|
+
__privateAdd(this, _columnsCache);
|
|
3565
|
+
}
|
|
3558
3566
|
get isUnique() {
|
|
3559
3567
|
return this.code === "23505";
|
|
3560
3568
|
}
|
|
3561
3569
|
get columns() {
|
|
3562
|
-
if (this
|
|
3570
|
+
if (__privateGet(this, _columnsCache)) return __privateGet(this, _columnsCache);
|
|
3563
3571
|
const columns = {};
|
|
3564
3572
|
if (this.detail) {
|
|
3565
3573
|
const list = this.detail.match(/\((.*)\)=/)?.[1];
|
|
3566
3574
|
if (list) {
|
|
3567
3575
|
list.split(", ").forEach((item) => {
|
|
3568
3576
|
const column = item.startsWith('"') ? item.slice(1, -1) : item;
|
|
3569
|
-
const key = queryColumnNameToKey(this.
|
|
3577
|
+
const key = queryColumnNameToKey(this.getQuery(), column) ?? column;
|
|
3570
3578
|
columns[key] = true;
|
|
3571
3579
|
});
|
|
3572
3580
|
}
|
|
3573
3581
|
}
|
|
3574
|
-
return this
|
|
3582
|
+
return __privateSet(this, _columnsCache, columns);
|
|
3575
3583
|
}
|
|
3576
3584
|
}
|
|
3585
|
+
_columnsCache = new WeakMap();
|
|
3577
3586
|
class MoreThanOneRowError extends OrchidOrmInternalError {
|
|
3578
3587
|
constructor(query, message) {
|
|
3579
3588
|
super(query, message);
|
|
@@ -4080,25 +4089,29 @@ class QueryTransaction {
|
|
|
4080
4089
|
};
|
|
4081
4090
|
const transactionAdapter = state?.transactionAdapter;
|
|
4082
4091
|
if (!state || !transactionAdapter) {
|
|
4083
|
-
let
|
|
4092
|
+
let transactionOptions;
|
|
4084
4093
|
if (options.level) {
|
|
4085
|
-
|
|
4094
|
+
transactionOptions = {
|
|
4095
|
+
options: `ISOLATION LEVEL ${options.level}`
|
|
4096
|
+
};
|
|
4086
4097
|
}
|
|
4087
4098
|
if (options.readOnly !== void 0) {
|
|
4088
4099
|
const add = `READ ${options.readOnly ? "ONLY" : "WRITE"}`;
|
|
4089
|
-
|
|
4090
|
-
|
|
4100
|
+
const opts2 = transactionOptions ?? (transactionOptions = {});
|
|
4101
|
+
if (opts2.options) opts2.options += " " + add;
|
|
4102
|
+
else opts2.options = add;
|
|
4091
4103
|
}
|
|
4092
4104
|
if (options.deferrable !== void 0) {
|
|
4093
4105
|
const add = `${options.deferrable ? "" : "NOT "}DEFERRABLE`;
|
|
4094
|
-
|
|
4095
|
-
|
|
4106
|
+
const opts2 = transactionOptions ?? (transactionOptions = {});
|
|
4107
|
+
if (opts2.options) opts2.options += " " + add;
|
|
4108
|
+
else opts2.options = add;
|
|
4096
4109
|
}
|
|
4097
4110
|
if (log) {
|
|
4098
|
-
sql.text =
|
|
4111
|
+
sql.text = transactionOptions?.options ? `BEGIN ${transactionOptions.options}` : "BEGIN";
|
|
4099
4112
|
logData = log.beforeQuery(sql);
|
|
4100
4113
|
}
|
|
4101
|
-
const result = await this.q.adapter.transaction(
|
|
4114
|
+
const result = await this.q.adapter.transaction(callback, transactionOptions).catch((err) => {
|
|
4102
4115
|
if (log) log.afterQuery(rollbackSql, logData);
|
|
4103
4116
|
throw err;
|
|
4104
4117
|
});
|
|
@@ -5117,7 +5130,7 @@ const then = async (q, adapter, state, beforeHooks, afterHooks, afterSaveHooks,
|
|
|
5117
5130
|
} else {
|
|
5118
5131
|
const { batch } = sql;
|
|
5119
5132
|
if (log) logData = log.beforeQuery(beginSql);
|
|
5120
|
-
await adapter.transaction(
|
|
5133
|
+
await adapter.transaction(async () => {
|
|
5121
5134
|
if (log) log.afterQuery(beginSql, logData);
|
|
5122
5135
|
const res = await queryBatch(batch);
|
|
5123
5136
|
if (log) logData = log.beforeQuery(commitSql);
|