c2-mongoose 2.1.8 → 2.1.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/dist/flow/CrudFlow.d.ts +2 -2
- package/dist/flow/CrudFlow.js +2 -2
- package/package.json +1 -1
- package/src/flow/CrudFlow.ts +3 -3
package/dist/flow/CrudFlow.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import mongoose from "mongoose";
|
|
1
|
+
import mongoose, { ClientSession } from "mongoose";
|
|
2
2
|
import { SearchResponse } from "../types/SearchResponse";
|
|
3
3
|
import SearchFlow from "./SearchFlow";
|
|
4
4
|
declare class CrudFlow<D> {
|
|
@@ -12,6 +12,6 @@ declare class CrudFlow<D> {
|
|
|
12
12
|
update(id: string, data: D, session?: any): Promise<D>;
|
|
13
13
|
find(): Promise<SearchResponse<D>>;
|
|
14
14
|
getOne(model: D, params?: any): Promise<D>;
|
|
15
|
-
get(id: string, pop?: string, sel?: string): Promise<D>;
|
|
15
|
+
get(id: string, pop?: string, sel?: string, session?: ClientSession): Promise<D>;
|
|
16
16
|
}
|
|
17
17
|
export default CrudFlow;
|
package/dist/flow/CrudFlow.js
CHANGED
|
@@ -119,14 +119,14 @@ var CrudFlow = /** @class */ (function () {
|
|
|
119
119
|
});
|
|
120
120
|
});
|
|
121
121
|
};
|
|
122
|
-
CrudFlow.prototype.get = function (id, pop, sel) {
|
|
122
|
+
CrudFlow.prototype.get = function (id, pop, sel, session) {
|
|
123
123
|
if (pop === void 0) { pop = ""; }
|
|
124
124
|
if (sel === void 0) { sel = ""; }
|
|
125
125
|
return __awaiter(this, void 0, void 0, function () {
|
|
126
126
|
var data;
|
|
127
127
|
return __generator(this, function (_a) {
|
|
128
128
|
switch (_a.label) {
|
|
129
|
-
case 0: return [4 /*yield*/, this.repository.findById(id).populate(pop).select(sel)];
|
|
129
|
+
case 0: return [4 /*yield*/, this.repository.findById(id).populate(pop).select(sel).session(session)];
|
|
130
130
|
case 1:
|
|
131
131
|
data = _a.sent();
|
|
132
132
|
return [2 /*return*/, data];
|
package/package.json
CHANGED
package/src/flow/CrudFlow.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import mongoose from "mongoose"
|
|
1
|
+
import mongoose, { ClientSession } from "mongoose"
|
|
2
2
|
import { SearchResponse } from "../types/SearchResponse"
|
|
3
3
|
import SearchFlow from "./SearchFlow"
|
|
4
4
|
|
|
@@ -42,8 +42,8 @@ class CrudFlow<D> {
|
|
|
42
42
|
return data as D
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
public async get(id: string, pop = "", sel = ""): Promise<D> {
|
|
46
|
-
const data = await this.repository.findById(id).populate(pop).select(sel)
|
|
45
|
+
public async get(id: string, pop = "", sel = "", session?: ClientSession): Promise<D> {
|
|
46
|
+
const data = await this.repository.findById(id).populate(pop).select(sel).session(session!)
|
|
47
47
|
return data as D
|
|
48
48
|
}
|
|
49
49
|
}
|