core-services-sdk 1.2.2 → 1.2.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/index.js +3 -0
- package/package.json +1 -1
- package/src/index.js +1 -1
- package/src/mongodb/index.js +3 -1
package/index.js
ADDED
package/package.json
CHANGED
package/src/index.js
CHANGED
package/src/mongodb/index.js
CHANGED
|
@@ -48,15 +48,17 @@ export const initializeMongoDb = async ({ config, collectionNames = {} }) => {
|
|
|
48
48
|
|
|
49
49
|
const withTransaction = async (action) => {
|
|
50
50
|
const session = client.startSession()
|
|
51
|
+
let actionResponse
|
|
51
52
|
try {
|
|
52
53
|
session.startTransaction()
|
|
53
|
-
await action({ session })
|
|
54
|
+
actionResponse = await action({ session })
|
|
54
55
|
await session.commitTransaction()
|
|
55
56
|
} catch (error) {
|
|
56
57
|
await session.abortTransaction()
|
|
57
58
|
throw error
|
|
58
59
|
} finally {
|
|
59
60
|
await session.endSession()
|
|
61
|
+
return actionResponse
|
|
60
62
|
}
|
|
61
63
|
}
|
|
62
64
|
|