@resolveio/server-lib 12.0.32 → 12.0.33
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/managers/cron.manager.js.map +1 -1
- package/managers/mongo.manager.d.ts +5 -4
- package/managers/mongo.manager.js +43 -43
- package/managers/mongo.manager.js.map +1 -1
- package/models/collection-document.model.d.ts +2 -1
- package/models/collection-document.model.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/managers/cron.manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,0EAA8D;AAE9D,IAAI,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAG7C;IAKC,qBAAY,UAAU;QACrB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAE9B,IAAI,CAAC,YAAY,GAAG,IAAI,cAAc,EAAE,CAAC;QACzC,IAAI,CAAC,YAAY,EAAE,CAAC;IACrB,CAAC;IAEa,kCAAY,GAA1B;;;;;;4BACY,qBAAM,8BAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,EAAA;;wBAA9B,IAAI,GAAG,SAAuB;wBAElC,IAAI,CAAC,OAAO,CAAC,UAAA,GAAG;4BACf,KAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;wBACtB,CAAC,CAAC,CAAC;;;;;KACH;IAEO,sCAAgB,GAAxB,UAAyB,IAAkB;QAC1C,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5C,CAAC;IAEO,0CAAoB,GAA5B,UAA6B,SAAiB;QAC7C,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC5C,CAAC;IAEO,gCAAU,GAAlB,UAAmB,IAAkB;QAArC,iBAgCC;QA/BA,IAAI,IAAI,CAAC,OAAO,EAAE;YACjB,8BAAQ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../collections/cron-job.collection';\nimport ResolveIOMainServer from '../server-app';\nlet CronJobManager = require('../cron/cron');\nimport * as moment from 'moment';\n\nexport class CronManager {\n\n\tprivate _cronManager;\n\tprivate _mainServer: ResolveIOMainServer;\n\n\tconstructor(mainServer) {\n\t\tthis._mainServer = mainServer;\n\n\t\tthis._cronManager = new CronJobManager();\n\t\tthis.loadCronJobs();\n\t}\n\n\tprivate async loadCronJobs() {\n\t\tlet jobs = await CronJobs.find({});\n\n\t\tjobs.forEach(job => {\n\t\t\tthis.addCronJob(job);\n\t\t});\n\t}\n\n\tprivate doesCronJobExist(cron: CronJobModel) {\n\t\treturn this._cronManager.exists(cron.name);\n\t}\n\n\tprivate doesCronJobNameExist(cron_name: string) {\n\t\treturn this._cronManager.exists(cron_name);\n\t}\n\n\tprivate addCronJob(cron: CronJobModel) {\n\t\tif (cron.running) {\n\t\t\tCronJobs.updateOne({_id: cron._id}, {$set: {running: false}});\n\t\t}\n\t\t\n\t\tif (!this.doesCronJobExist(cron)) {\n\t\t\tif (cron.timezone) {\n\n\t\t\t}\n\t\t\telse {\n\t\t\t\tlet cronOptions = {\n\t\t\t\t\tstart: true,\n\t\t\t\t\t// onComplete: () => {\n\t\t\t\t\t// \tthis.runCronJobCompleted(cron);\n\t\t\t\t\t// },\n\t\t\t\t\t// timeZone: cron.timezone\n\t\t\t\t};\n\n\t\t\t\tif (cron.timezone) {\n\t\t\t\t\tcronOptions['timeZone'] = cron.timezone;\n\t\t\t\t}\n\n\t\t\t\tthis._cronManager.add(\n\t\t\t\t\tcron.name,\n\t\t\t\t\tcron.time_to_run,\n\t\t\t\t\t() => {\n\t\t\t\t\t\tthis.runCronJob(cron);\n\t\t\t\t\t},\n\t\t\t\t\tcronOptions\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate updateCronJob(cron: CronJobModel) {\n\t\tif (this.doesCronJobExist(cron)) {\n\t\t\tthis._cronManager.update(cron.name, cron.time_to_run);\n\t\t}\n\t}\n\n\tprivate removeCronJob(cron_name: string) {\n\t\tif (this.doesCronJobNameExist(cron_name)) {\n\t\t\tthis._cronManager.deleteJob(cron_name);\n\t\t}\n\t}\n\n\tprivate startCronJob(cron: CronJobModel) {\n\t\tif (this.doesCronJobExist(cron)) {\n\t\t\tthis._cronManager.start(cron.name);\n\t\t}\n\t}\n\n\tprivate stopCronJob(cron: CronJobModel) {\n\t\tif (this.doesCronJobExist(cron)) {\n\t\t\tthis._cronManager.start(cron.name);\n\t\t}\n\t}\n\n\tprivate stopAllCronJobs() {\n\t\tthis._cronManager.stopAll();\n\t}\n\n\tpublic async checkCronJobsForUpdates() {\n\t\tlet jobs = await CronJobs.find({});\n\n\t\t// Remove deleted cron jobs\n\t\tthis._cronManager.getJobs().forEach(cronJob => {\n\t\t\tif (jobs.map(a => a.name).indexOf(cronJob) === -1) {\n\t\t\t\tthis.removeCronJob(cronJob);\n\t\t\t}\n\t\t});\n\n\t\t// Add new cron jobs\n\t\tjobs.forEach(cronJob => {\n\t\t\tthis.addCronJob(cronJob);\n\t\t});\n\n\t\t// Update cronjobs\n\t\tjobs.forEach(cronJob => {\n\t\t\tthis.updateCronJob(cronJob);\n\t\t});\n\t}\n\n\tprivate runCronJob(cron: CronJobModel) {\n\t\tlet now = new Date();\n\n\t\tif (!cron.next_run || now.getTime() >= cron.next_run.getTime()) {\n\t\t\tCronJobs.findOneAndUpdate({\n\t\t\t\t$and: [\n\t\t\t\t\t{_id: cron._id},\n\t\t\t\t\t{running: false},\n\t\t\t\t\t{\n\t\t\t\t\t\t$or: [\n\t\t\t\t\t\t\t{next_run: {$exists: false}},\n\t\t\t\t\t\t\t{next_run: null},\n\t\t\t\t\t\t\t{next_run: {$lte: now}}\n\t\t\t\t\t\t]\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}, {$set: {running: true}}).then(async res => {\n\t\t\t\tif (res) {\n\t\t\t\t\tif (res.method_run_data) {\n\t\t\t\t\t\tawait this._mainServer.getMethodManager().callMethodCron(res.method_run, res.method_run_data);\t\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tawait this._mainServer.getMethodManager().callMethodCron(res.method_run);\n\t\t\t\t\t}\n\t\n\t\t\t\t\tif (res.method_complete) {\n\t\t\t\t\t\tif (res.method_complete_data) {\n\t\t\t\t\t\t\tawait this._mainServer.getMethodManager().callMethodCron(res.method_complete, res.method_complete_data);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tawait this._mainServer.getMethodManager().callMethodCron(res.method_complete);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (res.repeat) {\n\t\t\t\t\t\tlet nextDate = (<moment.Moment>this._cronManager.getJob(res.name).nextDates()).second(0).millisecond(0).toDate();\n\n\t\t\t\t\t\tCronJobs.updateOne({\n\t\t\t\t\t\t\t$and: [\n\t\t\t\t\t\t\t\t{_id: res._id},\n\t\t\t\t\t\t\t\t{running: true}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t}, {$set: {running: false, next_run: nextDate}});\n\t\t\t\t\t} \n\t\t\t\t\telse {\n\t\t\t\t\t\tCronJobs.deleteOne({_id: res._id});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}, () => {});\n\t\t}\n\t}\n}"]}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { AggregateOptions, AggregationCursor, BulkWriteOptions, ChangeStream, ChangeStreamOptions, CollStats, CollStatsOptions, CommandOperationOptions, CountDocumentsOptions, CreateCollectionOptions, CreateIndexesOptions, CursorStreamOptions, DeleteOptions, Filter, FindCursor, FindOneAndDeleteOptions, FindOneAndReplaceOptions, FindOneAndUpdateOptions, FindOptions, IndexDescription, IndexInformationOptions, InsertOneOptions, ListIndexesCursor, ListIndexesOptions, RenameOptions, ReplaceOptions, UpdateFilter, UpdateOptions } from 'mongodb';
|
|
3
3
|
import { LookupTables } from '../models/report-builder.model';
|
|
4
4
|
import { UserModel } from '../models/user.model';
|
|
5
|
+
import { CollectionDocument } from '../models/collection-document.model';
|
|
5
6
|
interface MongoQueueModel {
|
|
6
7
|
_id: number;
|
|
7
8
|
name_collection: string;
|
|
@@ -32,14 +33,14 @@ export declare class MongoManager {
|
|
|
32
33
|
constructor();
|
|
33
34
|
getServerCollections(): string[];
|
|
34
35
|
registerCollection(collection: Collection<any>): void;
|
|
35
|
-
collections(): Collection<
|
|
36
|
+
collections(): Collection<CollectionDocument>[];
|
|
36
37
|
collection(collectionName: string): Collection<any> | UserCollection<any>;
|
|
37
38
|
addToQueue(mongoQueue: MongoQueueModel): void;
|
|
38
39
|
private runQueue;
|
|
39
40
|
private addToCache;
|
|
40
41
|
invalidateQueryCache(collection: string): void;
|
|
41
42
|
}
|
|
42
|
-
export declare class Model<T> {
|
|
43
|
+
export declare class Model<T extends CollectionDocument> {
|
|
43
44
|
collection_main: Collection<T> | UserCollection<T>;
|
|
44
45
|
collection_version: Collection<T> | UserCollection<T>;
|
|
45
46
|
constructor(options: CollectionOptions);
|
|
@@ -55,7 +56,7 @@ export interface CollectionOptions {
|
|
|
55
56
|
checkSchema: boolean;
|
|
56
57
|
collectionOptions: CreateCollectionOptions;
|
|
57
58
|
}
|
|
58
|
-
export declare class Collection<T> {
|
|
59
|
+
export declare class Collection<T extends CollectionDocument> {
|
|
59
60
|
collectionName: string;
|
|
60
61
|
checkSchema: boolean;
|
|
61
62
|
simplschema: any;
|
|
@@ -103,7 +104,7 @@ export declare class Collection<T> {
|
|
|
103
104
|
watchCollection(pipeline?: any[], options?: ChangeStreamOptions): ChangeStream<T>;
|
|
104
105
|
watchCollectionWithAggregate(pipeline?: any[], options?: ChangeStreamOptions): ChangeStream<T>;
|
|
105
106
|
}
|
|
106
|
-
export declare class UserCollection<T> extends Collection<T> {
|
|
107
|
+
export declare class UserCollection<T extends CollectionDocument> extends Collection<T> {
|
|
107
108
|
authenticateStrategy(): (username: any, password: any, cb: any) => Promise<void>;
|
|
108
109
|
authenticate(user: UserModel, password: string): Promise<{
|
|
109
110
|
data: UserModel;
|
|
@@ -400,7 +400,7 @@ var Collection = /** @class */ (function () {
|
|
|
400
400
|
}
|
|
401
401
|
else {
|
|
402
402
|
var monitor_3 = new monitor_manager_1.MonitorMongo('aggregate', _this.collectionName, JSON.stringify([pipeline, options]));
|
|
403
|
-
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName).aggregate(pipeline, options).toArray().then(function (res) {
|
|
403
|
+
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName, _this.collectionOptions).aggregate(pipeline, options).toArray().then(function (res) {
|
|
404
404
|
monitor_3.finish();
|
|
405
405
|
resolve(res);
|
|
406
406
|
}, function (err) {
|
|
@@ -441,7 +441,7 @@ var Collection = /** @class */ (function () {
|
|
|
441
441
|
};
|
|
442
442
|
Collection.prototype.aggregateCursor = function (pipeline, options) {
|
|
443
443
|
var monitor = new monitor_manager_1.MonitorMongo('aggregateCursor', this.collectionName, JSON.stringify([pipeline, options]));
|
|
444
|
-
var cursor = index_1.ResolveIOServer.getMainDB().collection(this.collectionName).aggregate(pipeline, options);
|
|
444
|
+
var cursor = index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).aggregate(pipeline, options);
|
|
445
445
|
cursor.on('close', function (ev) {
|
|
446
446
|
monitor.finish();
|
|
447
447
|
return ev;
|
|
@@ -450,7 +450,7 @@ var Collection = /** @class */ (function () {
|
|
|
450
450
|
};
|
|
451
451
|
Collection.prototype.aggregateStream = function (pipeline, options, streamOptions) {
|
|
452
452
|
var monitor = new monitor_manager_1.MonitorMongo('aggregateStream', this.collectionName, JSON.stringify([pipeline, options, streamOptions]));
|
|
453
|
-
var stream = index_1.ResolveIOServer.getMainDB().collection(this.collectionName).aggregate(pipeline, options).stream(streamOptions);
|
|
453
|
+
var stream = index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).aggregate(pipeline, options).stream(streamOptions);
|
|
454
454
|
stream.on('end', function (ev) {
|
|
455
455
|
monitor.finish();
|
|
456
456
|
return ev;
|
|
@@ -462,7 +462,7 @@ var Collection = /** @class */ (function () {
|
|
|
462
462
|
if (filter === void 0) { filter = {}; }
|
|
463
463
|
return new Promise(function (resolve, reject) {
|
|
464
464
|
var monitor = new monitor_manager_1.MonitorMongo('countDocuments', _this.collectionName, JSON.stringify([filter, options]));
|
|
465
|
-
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName).countDocuments(filter, options).then(function (res) {
|
|
465
|
+
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName, _this.collectionOptions).countDocuments(filter, options).then(function (res) {
|
|
466
466
|
monitor.finish();
|
|
467
467
|
resolve(res);
|
|
468
468
|
}, function (err) {
|
|
@@ -483,9 +483,9 @@ var Collection = /** @class */ (function () {
|
|
|
483
483
|
Collection.prototype.createIndex = function (fieldOrSpec, options) {
|
|
484
484
|
var _this = this;
|
|
485
485
|
return new Promise(function (resolve, reject) {
|
|
486
|
-
if (index_1.ResolveIOServer.getMainDB().collection(_this.collectionName)) {
|
|
486
|
+
if (index_1.ResolveIOServer.getMainDB().collection(_this.collectionName, _this.collectionOptions)) {
|
|
487
487
|
var monitor_4 = new monitor_manager_1.MonitorMongo('createIndex', _this.collectionName, JSON.stringify([fieldOrSpec, options]));
|
|
488
|
-
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName).createIndex(fieldOrSpec, options).then(function (res) {
|
|
488
|
+
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName, _this.collectionOptions).createIndex(fieldOrSpec, options).then(function (res) {
|
|
489
489
|
monitor_4.finish();
|
|
490
490
|
resolve(res);
|
|
491
491
|
}, function (err) {
|
|
@@ -499,9 +499,9 @@ var Collection = /** @class */ (function () {
|
|
|
499
499
|
Collection.prototype.createIndexes = function (indexSpecs, options) {
|
|
500
500
|
var _this = this;
|
|
501
501
|
return new Promise(function (resolve, reject) {
|
|
502
|
-
if (index_1.ResolveIOServer.getMainDB().collection(_this.collectionName)) {
|
|
502
|
+
if (index_1.ResolveIOServer.getMainDB().collection(_this.collectionName, _this.collectionOptions)) {
|
|
503
503
|
var monitor_5 = new monitor_manager_1.MonitorMongo('createIndexes', _this.collectionName, JSON.stringify([indexSpecs, options]));
|
|
504
|
-
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName).createIndexes(indexSpecs, options).then(function (res) {
|
|
504
|
+
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName, _this.collectionOptions).createIndexes(indexSpecs, options).then(function (res) {
|
|
505
505
|
monitor_5.finish();
|
|
506
506
|
resolve(res);
|
|
507
507
|
}, function (err) {
|
|
@@ -550,7 +550,7 @@ var Collection = /** @class */ (function () {
|
|
|
550
550
|
_a.label = 2;
|
|
551
551
|
case 2:
|
|
552
552
|
monitor = new monitor_manager_1.MonitorMongo('deleteMany', this.collectionName, JSON.stringify([filter, options]));
|
|
553
|
-
index_1.ResolveIOServer.getMainDB().collection(this.collectionName).deleteMany(filter, options).then(function (res) {
|
|
553
|
+
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).deleteMany(filter, options).then(function (res) {
|
|
554
554
|
monitor.finish();
|
|
555
555
|
if (res.acknowledged) {
|
|
556
556
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
@@ -579,7 +579,7 @@ var Collection = /** @class */ (function () {
|
|
|
579
579
|
return __generator(this, function (_a) {
|
|
580
580
|
if (this.createLogs && !bypassLogs) {
|
|
581
581
|
monitor_6 = new monitor_manager_1.MonitorMongo('findOneAndDelete', this.collectionName, JSON.stringify([filter, options]));
|
|
582
|
-
index_1.ResolveIOServer.getMainDB().collection(this.collectionName).findOneAndDelete(filter, options).then(function (returnVal) { return __awaiter(_this, void 0, void 0, function () {
|
|
582
|
+
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).findOneAndDelete(filter, options).then(function (returnVal) { return __awaiter(_this, void 0, void 0, function () {
|
|
583
583
|
var doc, versionDoc;
|
|
584
584
|
return __generator(this, function (_a) {
|
|
585
585
|
monitor_6.finish();
|
|
@@ -621,7 +621,7 @@ var Collection = /** @class */ (function () {
|
|
|
621
621
|
}
|
|
622
622
|
else {
|
|
623
623
|
monitor_7 = new monitor_manager_1.MonitorMongo('deleteOne', this.collectionName, JSON.stringify([filter, options]));
|
|
624
|
-
index_1.ResolveIOServer.getMainDB().collection(this.collectionName).deleteOne(filter, options).then(function (res) {
|
|
624
|
+
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).deleteOne(filter, options).then(function (res) {
|
|
625
625
|
monitor_7.finish();
|
|
626
626
|
if (res.acknowledged) {
|
|
627
627
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
@@ -644,7 +644,7 @@ var Collection = /** @class */ (function () {
|
|
|
644
644
|
var _this = this;
|
|
645
645
|
return new Promise(function (resolve, reject) {
|
|
646
646
|
var monitor = new monitor_manager_1.MonitorMongo('distinct', _this.collectionName, JSON.stringify([key, filter, options]));
|
|
647
|
-
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName).distinct(key, filter, options).then(function (res) {
|
|
647
|
+
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName, _this.collectionOptions).distinct(key, filter, options).then(function (res) {
|
|
648
648
|
monitor.finish();
|
|
649
649
|
resolve(res);
|
|
650
650
|
}, function (err) {
|
|
@@ -658,7 +658,7 @@ var Collection = /** @class */ (function () {
|
|
|
658
658
|
var _this = this;
|
|
659
659
|
return new Promise(function (resolve, reject) {
|
|
660
660
|
var monitor = new monitor_manager_1.MonitorMongo('drop', _this.collectionName, JSON.stringify([options]));
|
|
661
|
-
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName).drop(options).then(function (res) {
|
|
661
|
+
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName, _this.collectionOptions).drop(options).then(function (res) {
|
|
662
662
|
monitor.finish();
|
|
663
663
|
resolve(res);
|
|
664
664
|
}, function (err) {
|
|
@@ -672,7 +672,7 @@ var Collection = /** @class */ (function () {
|
|
|
672
672
|
var _this = this;
|
|
673
673
|
return new Promise(function (resolve, reject) {
|
|
674
674
|
var monitor = new monitor_manager_1.MonitorMongo('dropIndex', _this.collectionName, JSON.stringify([indexName, options]));
|
|
675
|
-
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName).dropIndex(indexName, options).then(function (res) {
|
|
675
|
+
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName, _this.collectionOptions).dropIndex(indexName, options).then(function (res) {
|
|
676
676
|
monitor.finish();
|
|
677
677
|
resolve(res);
|
|
678
678
|
}, function (err) {
|
|
@@ -686,7 +686,7 @@ var Collection = /** @class */ (function () {
|
|
|
686
686
|
var _this = this;
|
|
687
687
|
return new Promise(function (resolve, reject) {
|
|
688
688
|
var monitor = new monitor_manager_1.MonitorMongo('dropIndexes', _this.collectionName, JSON.stringify([options]));
|
|
689
|
-
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName).dropIndexes(options).then(function (res) {
|
|
689
|
+
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName, _this.collectionOptions).dropIndexes(options).then(function (res) {
|
|
690
690
|
monitor.finish();
|
|
691
691
|
resolve(res);
|
|
692
692
|
}, function (err) {
|
|
@@ -729,7 +729,7 @@ var Collection = /** @class */ (function () {
|
|
|
729
729
|
}
|
|
730
730
|
else {
|
|
731
731
|
monitor_8 = new monitor_manager_1.MonitorMongo('find', this.collectionName, JSON.stringify([filter, options]));
|
|
732
|
-
index_1.ResolveIOServer.getMainDB().collection(this.collectionName).find(filter, options).toArray().then(function (res) {
|
|
732
|
+
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).find(filter, options).toArray().then(function (res) {
|
|
733
733
|
monitor_8.finish();
|
|
734
734
|
resolve(res);
|
|
735
735
|
}, function (err) {
|
|
@@ -746,7 +746,7 @@ var Collection = /** @class */ (function () {
|
|
|
746
746
|
var _this = this;
|
|
747
747
|
return new Promise(function (resolve, reject) {
|
|
748
748
|
var monitor = new monitor_manager_1.MonitorMongo('findById', _this.collectionName, JSON.stringify([{ _id: id }, options]));
|
|
749
|
-
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName).findOne({ _id: id }, options).then(function (res) {
|
|
749
|
+
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName, _this.collectionOptions).findOne({ _id: id }, options).then(function (res) {
|
|
750
750
|
monitor.finish();
|
|
751
751
|
resolve(res);
|
|
752
752
|
}, function (err) {
|
|
@@ -761,7 +761,7 @@ var Collection = /** @class */ (function () {
|
|
|
761
761
|
if (filter === void 0) { filter = {}; }
|
|
762
762
|
return new Promise(function (resolve, reject) {
|
|
763
763
|
var monitor = new monitor_manager_1.MonitorMongo('findCount', _this.collectionName, JSON.stringify([filter, options]));
|
|
764
|
-
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName).find(filter, options).count().then(function (res) {
|
|
764
|
+
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName, _this.collectionOptions).find(filter, options).count().then(function (res) {
|
|
765
765
|
monitor.finish();
|
|
766
766
|
resolve(res);
|
|
767
767
|
}, function (err) {
|
|
@@ -774,7 +774,7 @@ var Collection = /** @class */ (function () {
|
|
|
774
774
|
Collection.prototype.findCursor = function (filter, options) {
|
|
775
775
|
if (filter === void 0) { filter = {}; }
|
|
776
776
|
var monitor = new monitor_manager_1.MonitorMongo('findCursor', this.collectionName, JSON.stringify([filter, options]));
|
|
777
|
-
var cursor = index_1.ResolveIOServer.getMainDB().collection(this.collectionName).find(filter, options);
|
|
777
|
+
var cursor = index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).find(filter, options);
|
|
778
778
|
cursor.on('close', function (ev) {
|
|
779
779
|
monitor.finish();
|
|
780
780
|
return ev;
|
|
@@ -784,7 +784,7 @@ var Collection = /** @class */ (function () {
|
|
|
784
784
|
Collection.prototype.findStream = function (filter, options, streamOptions) {
|
|
785
785
|
if (filter === void 0) { filter = {}; }
|
|
786
786
|
var monitor = new monitor_manager_1.MonitorMongo('findStream', this.collectionName, JSON.stringify([filter, options, streamOptions]));
|
|
787
|
-
var stream = index_1.ResolveIOServer.getMainDB().collection(this.collectionName).find(filter, options).stream(streamOptions);
|
|
787
|
+
var stream = index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).find(filter, options).stream(streamOptions);
|
|
788
788
|
stream.on('end', function (ev) {
|
|
789
789
|
monitor.finish();
|
|
790
790
|
return ev;
|
|
@@ -821,7 +821,7 @@ var Collection = /** @class */ (function () {
|
|
|
821
821
|
}
|
|
822
822
|
else {
|
|
823
823
|
var monitor_9 = new monitor_manager_1.MonitorMongo('findOne', _this.collectionName, JSON.stringify([filter, options]));
|
|
824
|
-
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName).findOne(filter, options).then(function (res) {
|
|
824
|
+
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName, _this.collectionOptions).findOne(filter, options).then(function (res) {
|
|
825
825
|
monitor_9.finish();
|
|
826
826
|
resolve(res);
|
|
827
827
|
}, function (err) {
|
|
@@ -841,7 +841,7 @@ var Collection = /** @class */ (function () {
|
|
|
841
841
|
var _this = this;
|
|
842
842
|
return __generator(this, function (_a) {
|
|
843
843
|
monitor = new monitor_manager_1.MonitorMongo('findOneAndDelete', this.collectionName, JSON.stringify([filter, options]));
|
|
844
|
-
index_1.ResolveIOServer.getMainDB().collection(this.collectionName).findOneAndDelete(filter, options).then(function (res) {
|
|
844
|
+
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).findOneAndDelete(filter, options).then(function (res) {
|
|
845
845
|
monitor.finish();
|
|
846
846
|
var doc = res.value;
|
|
847
847
|
if (doc) {
|
|
@@ -914,7 +914,7 @@ var Collection = /** @class */ (function () {
|
|
|
914
914
|
}
|
|
915
915
|
}
|
|
916
916
|
monitor = new monitor_manager_1.MonitorMongo('findOneAndReplace', this.collectionName, JSON.stringify([filter, replacement, options]));
|
|
917
|
-
index_1.ResolveIOServer.getMainDB().collection(this.collectionName).findOneAndReplace(filter, replacement, options).then(function (res) {
|
|
917
|
+
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).findOneAndReplace(filter, replacement, options).then(function (res) {
|
|
918
918
|
monitor.finish();
|
|
919
919
|
var doc = res.value;
|
|
920
920
|
if (doc) {
|
|
@@ -1004,7 +1004,7 @@ var Collection = /** @class */ (function () {
|
|
|
1004
1004
|
}
|
|
1005
1005
|
}
|
|
1006
1006
|
monitor = new monitor_manager_1.MonitorMongo('findOneAndUpdate', this.collectionName, JSON.stringify([filter, update, options]));
|
|
1007
|
-
index_1.ResolveIOServer.getMainDB().collection(this.collectionName).findOneAndUpdate(filter, update, options).then(function (res) {
|
|
1007
|
+
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).findOneAndUpdate(filter, update, options).then(function (res) {
|
|
1008
1008
|
monitor.finish();
|
|
1009
1009
|
var doc = res.value;
|
|
1010
1010
|
if (doc) {
|
|
@@ -1046,7 +1046,7 @@ var Collection = /** @class */ (function () {
|
|
|
1046
1046
|
var _this = this;
|
|
1047
1047
|
return new Promise(function (resolve, reject) {
|
|
1048
1048
|
var monitor = new monitor_manager_1.MonitorMongo('indexes', _this.collectionName, JSON.stringify([options]));
|
|
1049
|
-
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName).indexes(options).then(function (res) {
|
|
1049
|
+
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName, _this.collectionOptions).indexes(options).then(function (res) {
|
|
1050
1050
|
monitor.finish();
|
|
1051
1051
|
resolve(res);
|
|
1052
1052
|
}, function (err) {
|
|
@@ -1060,7 +1060,7 @@ var Collection = /** @class */ (function () {
|
|
|
1060
1060
|
var _this = this;
|
|
1061
1061
|
return new Promise(function (resolve, reject) {
|
|
1062
1062
|
var monitor = new monitor_manager_1.MonitorMongo('indexExists', _this.collectionName, JSON.stringify([indexes, options]));
|
|
1063
|
-
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName).indexExists(indexes, options).then(function (res) {
|
|
1063
|
+
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName, _this.collectionOptions).indexExists(indexes, options).then(function (res) {
|
|
1064
1064
|
monitor.finish();
|
|
1065
1065
|
resolve(res);
|
|
1066
1066
|
}, function (err) {
|
|
@@ -1125,7 +1125,7 @@ var Collection = /** @class */ (function () {
|
|
|
1125
1125
|
}
|
|
1126
1126
|
if (validDocs.length) {
|
|
1127
1127
|
monitor_10 = new monitor_manager_1.MonitorMongo('insertMany', this.collectionName, JSON.stringify([validDocs, options]));
|
|
1128
|
-
index_1.ResolveIOServer.getMainDB().collection(this.collectionName).insertMany(validDocs, options).then(function (res) {
|
|
1128
|
+
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).insertMany(validDocs, options).then(function (res) {
|
|
1129
1129
|
monitor_10.finish();
|
|
1130
1130
|
if (res.acknowledged) {
|
|
1131
1131
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
@@ -1188,7 +1188,7 @@ var Collection = /** @class */ (function () {
|
|
|
1188
1188
|
doc['__v'] = 0;
|
|
1189
1189
|
}
|
|
1190
1190
|
monitor = new monitor_manager_1.MonitorMongo('insertOne', this.collectionName, JSON.stringify([doc, options]));
|
|
1191
|
-
index_1.ResolveIOServer.getMainDB().collection(this.collectionName).insertOne(doc, options).then(function (res) {
|
|
1191
|
+
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).insertOne(doc, options).then(function (res) {
|
|
1192
1192
|
monitor.finish();
|
|
1193
1193
|
if (res.acknowledged) {
|
|
1194
1194
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
@@ -1208,7 +1208,7 @@ var Collection = /** @class */ (function () {
|
|
|
1208
1208
|
};
|
|
1209
1209
|
Collection.prototype.listIndexes = function (options) {
|
|
1210
1210
|
var monitor = new monitor_manager_1.MonitorMongo('listIndexes', this.collectionName, JSON.stringify([options]));
|
|
1211
|
-
var cursor = index_1.ResolveIOServer.getMainDB().collection(this.collectionName).listIndexes(options);
|
|
1211
|
+
var cursor = index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).listIndexes(options);
|
|
1212
1212
|
cursor.on('close', function (ev) {
|
|
1213
1213
|
monitor.finish();
|
|
1214
1214
|
return ev;
|
|
@@ -1219,7 +1219,7 @@ var Collection = /** @class */ (function () {
|
|
|
1219
1219
|
var _this = this;
|
|
1220
1220
|
return new Promise(function (resolve, reject) {
|
|
1221
1221
|
var monitor = new monitor_manager_1.MonitorMongo('rename', _this.collectionName, JSON.stringify([newName, options]));
|
|
1222
|
-
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName).rename(newName, options).then(function (res) {
|
|
1222
|
+
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName, _this.collectionOptions).rename(newName, options).then(function (res) {
|
|
1223
1223
|
monitor.finish();
|
|
1224
1224
|
resolve(res);
|
|
1225
1225
|
}, function (err) {
|
|
@@ -1288,7 +1288,7 @@ var Collection = /** @class */ (function () {
|
|
|
1288
1288
|
});
|
|
1289
1289
|
}
|
|
1290
1290
|
monitor_11 = new monitor_manager_1.MonitorMongo('replaceOne', this.collectionName, JSON.stringify([filter, replacement, options]));
|
|
1291
|
-
index_1.ResolveIOServer.getMainDB().collection(this.collectionName).replaceOne(filter, replacement, options).then(function (res) {
|
|
1291
|
+
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).replaceOne(filter, replacement, options).then(function (res) {
|
|
1292
1292
|
monitor_11.finish();
|
|
1293
1293
|
if (res.acknowledged) {
|
|
1294
1294
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
@@ -1334,7 +1334,7 @@ var Collection = /** @class */ (function () {
|
|
|
1334
1334
|
});
|
|
1335
1335
|
}
|
|
1336
1336
|
monitor_12 = new monitor_manager_1.MonitorMongo('replaceOne', this.collectionName, JSON.stringify([filter, updatedDoc_1, options]));
|
|
1337
|
-
index_1.ResolveIOServer.getMainDB().collection(this.collectionName).replaceOne(filter, updatedDoc_1, options).then(function (res) {
|
|
1337
|
+
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).replaceOne(filter, updatedDoc_1, options).then(function (res) {
|
|
1338
1338
|
monitor_12.finish();
|
|
1339
1339
|
if (res.acknowledged) {
|
|
1340
1340
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
@@ -1378,7 +1378,7 @@ var Collection = /** @class */ (function () {
|
|
|
1378
1378
|
});
|
|
1379
1379
|
}
|
|
1380
1380
|
monitor_13 = new monitor_manager_1.MonitorMongo('replaceOne', this.collectionName, JSON.stringify([filter, replacement, options]));
|
|
1381
|
-
index_1.ResolveIOServer.getMainDB().collection(this.collectionName).replaceOne(filter, replacement, options).then(function (res) {
|
|
1381
|
+
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).replaceOne(filter, replacement, options).then(function (res) {
|
|
1382
1382
|
monitor_13.finish();
|
|
1383
1383
|
if (res.acknowledged) {
|
|
1384
1384
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
@@ -1416,7 +1416,7 @@ var Collection = /** @class */ (function () {
|
|
|
1416
1416
|
options.returnDocument = 'before';
|
|
1417
1417
|
}
|
|
1418
1418
|
monitor_14 = new monitor_manager_1.MonitorMongo('findOneAndReplace', this.collectionName, JSON.stringify([filter, replacement, options]));
|
|
1419
|
-
index_1.ResolveIOServer.getMainDB().collection(this.collectionName).findOneAndReplace(filter, replacement, options).then(function (res) {
|
|
1419
|
+
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).findOneAndReplace(filter, replacement, options).then(function (res) {
|
|
1420
1420
|
monitor_14.finish();
|
|
1421
1421
|
var doc = res.value;
|
|
1422
1422
|
if (doc) {
|
|
@@ -1457,7 +1457,7 @@ var Collection = /** @class */ (function () {
|
|
|
1457
1457
|
}
|
|
1458
1458
|
else {
|
|
1459
1459
|
monitor_15 = new monitor_manager_1.MonitorMongo('replaceOne', this.collectionName, JSON.stringify([filter, replacement, options]));
|
|
1460
|
-
index_1.ResolveIOServer.getMainDB().collection(this.collectionName).replaceOne(filter, replacement, options).then(function (res) {
|
|
1460
|
+
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).replaceOne(filter, replacement, options).then(function (res) {
|
|
1461
1461
|
monitor_15.finish();
|
|
1462
1462
|
if (res.acknowledged) {
|
|
1463
1463
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
@@ -1482,7 +1482,7 @@ var Collection = /** @class */ (function () {
|
|
|
1482
1482
|
var _this = this;
|
|
1483
1483
|
return new Promise(function (resolve, reject) {
|
|
1484
1484
|
var monitor = new monitor_manager_1.MonitorMongo('stats', _this.collectionName, JSON.stringify([options]));
|
|
1485
|
-
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName).stats(options).then(function (res) {
|
|
1485
|
+
index_1.ResolveIOServer.getMainDB().collection(_this.collectionName, _this.collectionOptions).stats(options).then(function (res) {
|
|
1486
1486
|
monitor.finish();
|
|
1487
1487
|
resolve(res);
|
|
1488
1488
|
}, function (err) {
|
|
@@ -1562,7 +1562,7 @@ var Collection = /** @class */ (function () {
|
|
|
1562
1562
|
_a.label = 2;
|
|
1563
1563
|
case 2:
|
|
1564
1564
|
monitor = new monitor_manager_1.MonitorMongo('updateMany', this.collectionName, JSON.stringify([filter, update, options]));
|
|
1565
|
-
index_1.ResolveIOServer.getMainDB().collection(this.collectionName).updateMany(filter, update, options).then(function (res) {
|
|
1565
|
+
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateMany(filter, update, options).then(function (res) {
|
|
1566
1566
|
monitor.finish();
|
|
1567
1567
|
if (res.acknowledged) {
|
|
1568
1568
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
@@ -1644,7 +1644,7 @@ var Collection = /** @class */ (function () {
|
|
|
1644
1644
|
}
|
|
1645
1645
|
}
|
|
1646
1646
|
monitor_16 = new monitor_manager_1.MonitorMongo('updateOne', this.collectionName, JSON.stringify([filter, update, options]));
|
|
1647
|
-
index_1.ResolveIOServer.getMainDB().collection(this.collectionName).updateOne(filter, update, options).then(function (res) {
|
|
1647
|
+
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(filter, update, options).then(function (res) {
|
|
1648
1648
|
monitor_16.finish();
|
|
1649
1649
|
if (res.acknowledged) {
|
|
1650
1650
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
@@ -1698,7 +1698,7 @@ var Collection = /** @class */ (function () {
|
|
|
1698
1698
|
});
|
|
1699
1699
|
}
|
|
1700
1700
|
monitor_17 = new monitor_manager_1.MonitorMongo('updateOne', this.collectionName, JSON.stringify([filter, update, options]));
|
|
1701
|
-
index_1.ResolveIOServer.getMainDB().collection(this.collectionName).updateOne(filter, update, options).then(function (res) {
|
|
1701
|
+
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(filter, update, options).then(function (res) {
|
|
1702
1702
|
monitor_17.finish();
|
|
1703
1703
|
if (res.acknowledged) {
|
|
1704
1704
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
@@ -1749,7 +1749,7 @@ var Collection = /** @class */ (function () {
|
|
|
1749
1749
|
options.returnDocument = 'before';
|
|
1750
1750
|
}
|
|
1751
1751
|
monitor_18 = new monitor_manager_1.MonitorMongo('findOneAndUpdate', this.collectionName, JSON.stringify([filter, update, options]));
|
|
1752
|
-
index_1.ResolveIOServer.getMainDB().collection(this.collectionName).findOneAndUpdate(filter, update, options).then(function (res) {
|
|
1752
|
+
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).findOneAndUpdate(filter, update, options).then(function (res) {
|
|
1753
1753
|
monitor_18.finish();
|
|
1754
1754
|
var doc = res.value;
|
|
1755
1755
|
if (doc) {
|
|
@@ -1794,7 +1794,7 @@ var Collection = /** @class */ (function () {
|
|
|
1794
1794
|
}
|
|
1795
1795
|
else {
|
|
1796
1796
|
monitor_19 = new monitor_manager_1.MonitorMongo('updateOne', this.collectionName, JSON.stringify([filter, update, options]));
|
|
1797
|
-
index_1.ResolveIOServer.getMainDB().collection(this.collectionName).updateOne(filter, update, options).then(function (res) {
|
|
1797
|
+
index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(filter, update, options).then(function (res) {
|
|
1798
1798
|
monitor_19.finish();
|
|
1799
1799
|
if (res.acknowledged) {
|
|
1800
1800
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
@@ -1818,7 +1818,7 @@ var Collection = /** @class */ (function () {
|
|
|
1818
1818
|
Collection.prototype.watchCollection = function (pipeline, options) {
|
|
1819
1819
|
var _this = this;
|
|
1820
1820
|
if (pipeline === void 0) { pipeline = []; }
|
|
1821
|
-
var stream = index_1.ResolveIOServer.getMainDB().collection(this.collectionName).watch(pipeline, options);
|
|
1821
|
+
var stream = index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).watch(pipeline, options);
|
|
1822
1822
|
stream.on('change', function (evData) {
|
|
1823
1823
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1824
1824
|
return evData;
|
|
@@ -1828,7 +1828,7 @@ var Collection = /** @class */ (function () {
|
|
|
1828
1828
|
Collection.prototype.watchCollectionWithAggregate = function (pipeline, options) {
|
|
1829
1829
|
var _this = this;
|
|
1830
1830
|
if (pipeline === void 0) { pipeline = []; }
|
|
1831
|
-
var stream = index_1.ResolveIOServer.getMainDB().collection(this.collectionName).watch(pipeline, options);
|
|
1831
|
+
var stream = index_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).watch(pipeline, options);
|
|
1832
1832
|
stream.on('change', function (evData) {
|
|
1833
1833
|
index_1.ResolveIOServer.getMongoManager().invalidateQueryCache(_this.collectionName);
|
|
1834
1834
|
return evData;
|