c2-mongoose 2.1.265 → 2.1.267
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/C2Flow.d.ts +1 -0
- package/dist/flow/C2Flow.js +20 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -1
- package/package.json +1 -1
- package/src/flow/C2Flow.ts +12 -0
- package/src/index.ts +2 -1
package/dist/flow/C2Flow.d.ts
CHANGED
|
@@ -11,5 +11,6 @@ declare class C2Flow<D> {
|
|
|
11
11
|
updateMany(searcher: SearchFlow, data: D, options: Options): Promise<any>;
|
|
12
12
|
deleteById(_id: Types.ObjectId, options: Partial<Options>): Promise<void>;
|
|
13
13
|
deleteByModel(searcher: SearchFlow, options: Partial<Options>): Promise<void>;
|
|
14
|
+
deleteByFilters(filters: any, options: Partial<Options>): Promise<void>;
|
|
14
15
|
}
|
|
15
16
|
export default C2Flow;
|
package/dist/flow/C2Flow.js
CHANGED
|
@@ -224,6 +224,26 @@ var C2Flow = /** @class */ (function () {
|
|
|
224
224
|
});
|
|
225
225
|
});
|
|
226
226
|
};
|
|
227
|
+
C2Flow.prototype.deleteByFilters = function (filters, options) {
|
|
228
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
229
|
+
var dataAfter, log;
|
|
230
|
+
return __generator(this, function (_a) {
|
|
231
|
+
switch (_a.label) {
|
|
232
|
+
case 0: return [4 /*yield*/, this.repository.deleteMany(filters).session(options.session)];
|
|
233
|
+
case 1:
|
|
234
|
+
dataAfter = _a.sent();
|
|
235
|
+
if (options.logger === false) {
|
|
236
|
+
return [2 /*return*/];
|
|
237
|
+
}
|
|
238
|
+
log = BuildLogFlowItem_1.default.build(options, __assign(__assign({}, filters), dataAfter), Logger_1.TypeOfOperation.DELETE, this.repository);
|
|
239
|
+
return [4 /*yield*/, global.LoggerRepository.create([log], { session: options.session })];
|
|
240
|
+
case 2:
|
|
241
|
+
_a.sent();
|
|
242
|
+
return [2 /*return*/];
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
});
|
|
246
|
+
};
|
|
227
247
|
return C2Flow;
|
|
228
248
|
}());
|
|
229
249
|
exports.default = C2Flow;
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import AddStagePaginationFlowItem from "./flow/item/AddStagePaginationFlowItem";
|
|
|
6
6
|
import AddStageSortFlowItem from "./flow/item/AddStageSortFlowItem";
|
|
7
7
|
import BuildPipelineToCountJoinFlowItem from "./flow/item/BuildPipelineToCountJoinFlowItem";
|
|
8
8
|
import BuildPipelineToJoinFlowItem from "./flow/item/BuildPipelineToJoinFlowItem";
|
|
9
|
+
import BuildPopulateSingleFlowItem from "./flow/item/BuildPopulateSingleFlowItem";
|
|
9
10
|
import BuildSelectSingleFlowItem from "./flow/item/BuildSelectSingleFlowItem";
|
|
10
11
|
import ConvertToSearchResponseFlowItem from "./flow/item/ConvertToSearchResponseFlowItem";
|
|
11
12
|
import { IFacet } from "./model/Facet";
|
|
@@ -13,4 +14,4 @@ import { ILogger, LoggerModel, LoggerSearch, TypeOfOperation } from "./model/Log
|
|
|
13
14
|
import { Options } from "./types/Options";
|
|
14
15
|
import { Pagination, SearchResponse } from "./types/SearchResponse";
|
|
15
16
|
import { initialize } from "./utils/Utils";
|
|
16
|
-
export {
|
|
17
|
+
export { AddStagePaginationFlowItem, AddStageSortFlowItem, BuildPipelineToCountJoinFlowItem, BuildPipelineToJoinFlowItem, BuildPopulateSingleFlowItem, BuildSelectSingleFlowItem, C2Flow, ConvertToSearchResponseFlowItem, CrudFlow, IFacet, ILogger, LoggerModel, LoggerSearch, Options, Pagination, SearchFlow, SearchResponse, SearcherFlow, TypeOfOperation, initialize };
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.initialize = exports.TypeOfOperation = exports.SearchFlow = exports.LoggerSearch = exports.LoggerModel = exports.CrudFlow = exports.ConvertToSearchResponseFlowItem = exports.C2Flow = exports.
|
|
6
|
+
exports.initialize = exports.TypeOfOperation = exports.SearcherFlow = exports.SearchFlow = exports.LoggerSearch = exports.LoggerModel = exports.CrudFlow = exports.ConvertToSearchResponseFlowItem = exports.C2Flow = exports.BuildSelectSingleFlowItem = exports.BuildPopulateSingleFlowItem = exports.BuildPipelineToJoinFlowItem = exports.BuildPipelineToCountJoinFlowItem = exports.AddStageSortFlowItem = exports.AddStagePaginationFlowItem = void 0;
|
|
7
7
|
var C2Flow_1 = __importDefault(require("./flow/C2Flow"));
|
|
8
8
|
exports.C2Flow = C2Flow_1.default;
|
|
9
9
|
var CrudFlow_1 = __importDefault(require("./flow/CrudFlow"));
|
|
@@ -20,6 +20,8 @@ var BuildPipelineToCountJoinFlowItem_1 = __importDefault(require("./flow/item/Bu
|
|
|
20
20
|
exports.BuildPipelineToCountJoinFlowItem = BuildPipelineToCountJoinFlowItem_1.default;
|
|
21
21
|
var BuildPipelineToJoinFlowItem_1 = __importDefault(require("./flow/item/BuildPipelineToJoinFlowItem"));
|
|
22
22
|
exports.BuildPipelineToJoinFlowItem = BuildPipelineToJoinFlowItem_1.default;
|
|
23
|
+
var BuildPopulateSingleFlowItem_1 = __importDefault(require("./flow/item/BuildPopulateSingleFlowItem"));
|
|
24
|
+
exports.BuildPopulateSingleFlowItem = BuildPopulateSingleFlowItem_1.default;
|
|
23
25
|
var BuildSelectSingleFlowItem_1 = __importDefault(require("./flow/item/BuildSelectSingleFlowItem"));
|
|
24
26
|
exports.BuildSelectSingleFlowItem = BuildSelectSingleFlowItem_1.default;
|
|
25
27
|
var ConvertToSearchResponseFlowItem_1 = __importDefault(require("./flow/item/ConvertToSearchResponseFlowItem"));
|
package/package.json
CHANGED
package/src/flow/C2Flow.ts
CHANGED
|
@@ -128,6 +128,18 @@ class C2Flow<D> {
|
|
|
128
128
|
let log: Partial<ILogger> = BuildLogFlowItem.build(options, { ...searcher.filters, ...dataAfter }, TypeOfOperation.DELETE, this.repository)
|
|
129
129
|
await (global as any).LoggerRepository.create([log], { session: options.session })
|
|
130
130
|
}
|
|
131
|
+
|
|
132
|
+
public async deleteByFilters(filters: any, options: Partial<Options>) {
|
|
133
|
+
|
|
134
|
+
let dataAfter = await this.repository.deleteMany(filters).session(options.session!)
|
|
135
|
+
|
|
136
|
+
if (options.logger === false) {
|
|
137
|
+
return
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
let log: Partial<ILogger> = BuildLogFlowItem.build(options, { ...filters, ...dataAfter }, TypeOfOperation.DELETE, this.repository)
|
|
141
|
+
await (global as any).LoggerRepository.create([log], { session: options.session })
|
|
142
|
+
}
|
|
131
143
|
}
|
|
132
144
|
|
|
133
145
|
export default C2Flow
|
package/src/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ import AddStagePaginationFlowItem from "./flow/item/AddStagePaginationFlowItem"
|
|
|
6
6
|
import AddStageSortFlowItem from "./flow/item/AddStageSortFlowItem"
|
|
7
7
|
import BuildPipelineToCountJoinFlowItem from "./flow/item/BuildPipelineToCountJoinFlowItem"
|
|
8
8
|
import BuildPipelineToJoinFlowItem from "./flow/item/BuildPipelineToJoinFlowItem"
|
|
9
|
+
import BuildPopulateSingleFlowItem from "./flow/item/BuildPopulateSingleFlowItem"
|
|
9
10
|
import BuildSelectSingleFlowItem from "./flow/item/BuildSelectSingleFlowItem"
|
|
10
11
|
import ConvertToSearchResponseFlowItem from "./flow/item/ConvertToSearchResponseFlowItem"
|
|
11
12
|
import { IFacet } from "./model/Facet"
|
|
@@ -16,5 +17,5 @@ import { initialize } from "./utils/Utils"
|
|
|
16
17
|
|
|
17
18
|
(global as any).LoggerRepository = undefined
|
|
18
19
|
|
|
19
|
-
export {
|
|
20
|
+
export { AddStagePaginationFlowItem, AddStageSortFlowItem, BuildPipelineToCountJoinFlowItem, BuildPipelineToJoinFlowItem, BuildPopulateSingleFlowItem, BuildSelectSingleFlowItem, C2Flow, ConvertToSearchResponseFlowItem, CrudFlow, IFacet, ILogger, LoggerModel, LoggerSearch, Options, Pagination, SearchFlow, SearchResponse, SearcherFlow, TypeOfOperation, initialize }
|
|
20
21
|
|