orchid-orm 1.35.14 → 1.35.16
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 +14 -4
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -176,12 +176,15 @@ interface BelongsToInfo<Name extends string, FK extends string, Required, Q exte
|
|
|
176
176
|
};
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
declare function transaction<
|
|
179
|
+
declare function transaction<Result>(this: {
|
|
180
180
|
$queryBuilder: Db;
|
|
181
|
-
},
|
|
182
|
-
declare function transaction<
|
|
181
|
+
}, fn: () => Promise<Result>): Promise<Result>;
|
|
182
|
+
declare function transaction<Result>(this: {
|
|
183
183
|
$queryBuilder: Db;
|
|
184
|
-
},
|
|
184
|
+
}, options: IsolationLevel | TransactionOptions, fn: () => Promise<Result>): Promise<Result>;
|
|
185
|
+
declare function ensureTransaction<Result>(this: {
|
|
186
|
+
$queryBuilder: Db;
|
|
187
|
+
}, cb: () => Promise<Result>): Promise<Result>;
|
|
185
188
|
|
|
186
189
|
interface FromQuery extends Query {
|
|
187
190
|
returnType: 'all';
|
|
@@ -189,7 +192,14 @@ interface FromQuery extends Query {
|
|
|
189
192
|
type OrchidORM<T extends TableClasses = TableClasses> = {
|
|
190
193
|
[K in keyof T]: ORMTableInputToQueryBuilder<InstanceType<T[K]>>;
|
|
191
194
|
} & {
|
|
195
|
+
/**
|
|
196
|
+
* @see import('pqb').Transaction.prototype.transaction
|
|
197
|
+
*/
|
|
192
198
|
$transaction: typeof transaction;
|
|
199
|
+
/**
|
|
200
|
+
* @see import('pqb').Transaction.prototype.ensureTransaction
|
|
201
|
+
*/
|
|
202
|
+
$ensureTransaction: typeof ensureTransaction;
|
|
193
203
|
$adapter: Adapter;
|
|
194
204
|
$queryBuilder: Db;
|
|
195
205
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1809,6 +1809,9 @@ function transaction(fnOrOptions, fn) {
|
|
|
1809
1809
|
fn
|
|
1810
1810
|
);
|
|
1811
1811
|
}
|
|
1812
|
+
function ensureTransaction(cb) {
|
|
1813
|
+
return this.$queryBuilder.ensureTransaction(cb);
|
|
1814
|
+
}
|
|
1812
1815
|
|
|
1813
1816
|
var __defProp$1 = Object.defineProperty;
|
|
1814
1817
|
var __defProps = Object.defineProperties;
|
|
@@ -1880,6 +1883,7 @@ const orchidORM = (_a, tables) => {
|
|
|
1880
1883
|
}
|
|
1881
1884
|
const result = {
|
|
1882
1885
|
$transaction: transaction,
|
|
1886
|
+
$ensureTransaction: ensureTransaction,
|
|
1883
1887
|
$adapter: adapter,
|
|
1884
1888
|
$queryBuilder: qb,
|
|
1885
1889
|
$query: (...args) => qb.query(...args),
|