@dnax/core 0.64.7 → 0.64.9
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/driver/mongo/rest.ts +14 -3
- package/package.json +1 -1
package/driver/mongo/rest.ts
CHANGED
|
@@ -2028,14 +2028,25 @@ class useRest {
|
|
|
2028
2028
|
await this.#session?.abortTransaction();
|
|
2029
2029
|
}
|
|
2030
2030
|
}
|
|
2031
|
-
|
|
2031
|
+
|
|
2032
|
+
async endSession() {
|
|
2033
|
+
if (this.#session) {
|
|
2034
|
+
await this.#session?.endSession();
|
|
2035
|
+
this.#session = null;
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2038
|
+
|
|
2039
|
+
async commitTransaction(options?: { closeSession?: boolean }) {
|
|
2032
2040
|
return new Promise(async (resolve, reject) => {
|
|
2033
2041
|
if (this.#session) {
|
|
2034
2042
|
await this.#session
|
|
2035
2043
|
?.commitTransaction()
|
|
2036
2044
|
.then((e) => {
|
|
2037
|
-
|
|
2038
|
-
|
|
2045
|
+
let endSession = options?.closeSession ?? true;
|
|
2046
|
+
if (endSession) {
|
|
2047
|
+
this.#session?.endSession();
|
|
2048
|
+
this.#session = null;
|
|
2049
|
+
}
|
|
2039
2050
|
resolve(true);
|
|
2040
2051
|
})
|
|
2041
2052
|
.catch((err) => {
|