@drawbridge/mongodb 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +5 -10
- package/dist/index.d.ts +5 -10
- package/dist/index.js +4 -10
- package/dist/index.mjs +4 -10
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -423,22 +423,17 @@ module.exports = ({
|
|
|
423
423
|
|
|
424
424
|
transaction : async ( callback ) => {
|
|
425
425
|
|
|
426
|
+
const session = client.startSession();
|
|
427
|
+
|
|
426
428
|
try {
|
|
427
429
|
|
|
428
|
-
const result = await
|
|
429
|
-
( resolve, reject ) => client.withSession(
|
|
430
|
-
async ( session ) => session.withTransaction(
|
|
431
|
-
async ( session ) => resolve( await callback( session ) ),
|
|
432
|
-
null
|
|
433
|
-
).catch( reject )
|
|
434
|
-
).catch( reject )
|
|
435
|
-
);
|
|
430
|
+
const result = await session.withTransaction( async () => callback( session ) );
|
|
436
431
|
|
|
437
432
|
return result;
|
|
438
433
|
|
|
439
|
-
}
|
|
434
|
+
} finally {
|
|
440
435
|
|
|
441
|
-
|
|
436
|
+
await session.endSession();
|
|
442
437
|
|
|
443
438
|
}
|
|
444
439
|
|
package/dist/index.d.ts
CHANGED
|
@@ -423,22 +423,17 @@ module.exports = ({
|
|
|
423
423
|
|
|
424
424
|
transaction : async ( callback ) => {
|
|
425
425
|
|
|
426
|
+
const session = client.startSession();
|
|
427
|
+
|
|
426
428
|
try {
|
|
427
429
|
|
|
428
|
-
const result = await
|
|
429
|
-
( resolve, reject ) => client.withSession(
|
|
430
|
-
async ( session ) => session.withTransaction(
|
|
431
|
-
async ( session ) => resolve( await callback( session ) ),
|
|
432
|
-
null
|
|
433
|
-
).catch( reject )
|
|
434
|
-
).catch( reject )
|
|
435
|
-
);
|
|
430
|
+
const result = await session.withTransaction( async () => callback( session ) );
|
|
436
431
|
|
|
437
432
|
return result;
|
|
438
433
|
|
|
439
|
-
}
|
|
434
|
+
} finally {
|
|
440
435
|
|
|
441
|
-
|
|
436
|
+
await session.endSession();
|
|
442
437
|
|
|
443
438
|
}
|
|
444
439
|
|
package/dist/index.js
CHANGED
|
@@ -306,18 +306,12 @@ module.exports = ({
|
|
|
306
306
|
}
|
|
307
307
|
},
|
|
308
308
|
transaction: async (callback) => {
|
|
309
|
+
const session = client.startSession();
|
|
309
310
|
try {
|
|
310
|
-
const result = await
|
|
311
|
-
(resolve, reject) => client.withSession(
|
|
312
|
-
async (session) => session.withTransaction(
|
|
313
|
-
async (session2) => resolve(await callback(session2)),
|
|
314
|
-
null
|
|
315
|
-
).catch(reject)
|
|
316
|
-
).catch(reject)
|
|
317
|
-
);
|
|
311
|
+
const result = await session.withTransaction(async () => callback(session));
|
|
318
312
|
return result;
|
|
319
|
-
}
|
|
320
|
-
|
|
313
|
+
} finally {
|
|
314
|
+
await session.endSession();
|
|
321
315
|
}
|
|
322
316
|
},
|
|
323
317
|
update: async ({
|
package/dist/index.mjs
CHANGED
|
@@ -319,18 +319,12 @@ var require_index = __commonJS({
|
|
|
319
319
|
}
|
|
320
320
|
},
|
|
321
321
|
transaction: async (callback) => {
|
|
322
|
+
const session = client.startSession();
|
|
322
323
|
try {
|
|
323
|
-
const result = await
|
|
324
|
-
(resolve, reject) => client.withSession(
|
|
325
|
-
async (session) => session.withTransaction(
|
|
326
|
-
async (session2) => resolve(await callback(session2)),
|
|
327
|
-
null
|
|
328
|
-
).catch(reject)
|
|
329
|
-
).catch(reject)
|
|
330
|
-
);
|
|
324
|
+
const result = await session.withTransaction(async () => callback(session));
|
|
331
325
|
return result;
|
|
332
|
-
}
|
|
333
|
-
|
|
326
|
+
} finally {
|
|
327
|
+
await session.endSession();
|
|
334
328
|
}
|
|
335
329
|
},
|
|
336
330
|
update: async ({
|