@resolveio/server-lib 9.10.2 → 10.0.0
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/collections/app-status.collection.js +11 -1
- package/collections/app-status.collection.js.map +1 -1
- package/collections/app-version.collection.js +11 -1
- package/collections/app-version.collection.js.map +1 -1
- package/collections/counter.collection.js +11 -1
- package/collections/counter.collection.js.map +1 -1
- package/collections/cron-job-history.collection.js +11 -1
- package/collections/cron-job-history.collection.js.map +1 -1
- package/collections/cron-job.collection.js +11 -1
- package/collections/cron-job.collection.js.map +1 -1
- package/collections/email-history.collection.js +11 -1
- package/collections/email-history.collection.js.map +1 -1
- package/collections/email-verified.collection.js +11 -1
- package/collections/email-verified.collection.js.map +1 -1
- package/collections/file.collection.js +11 -1
- package/collections/file.collection.js.map +1 -1
- package/collections/flag.collection.js +11 -1
- package/collections/flag.collection.js.map +1 -1
- package/collections/log-method-latency.collection.js +11 -1
- package/collections/log-method-latency.collection.js.map +1 -1
- package/collections/log-subscription.collection.js +11 -1
- package/collections/log-subscription.collection.js.map +1 -1
- package/collections/log.collection.js +11 -1
- package/collections/log.collection.js.map +1 -1
- package/collections/logged-in-users.collection.js +11 -1
- package/collections/logged-in-users.collection.js.map +1 -1
- package/collections/method-response.collection.js +11 -1
- package/collections/method-response.collection.js.map +1 -1
- package/collections/monitor-cpu.collection.js +24 -19
- package/collections/monitor-cpu.collection.js.map +1 -1
- package/collections/monitor-memory.collection.js +24 -18
- package/collections/monitor-memory.collection.js.map +1 -1
- package/collections/monitor-mongo.collection.js +24 -18
- package/collections/monitor-mongo.collection.js.map +1 -1
- package/collections/notification.collection.js +11 -1
- package/collections/notification.collection.js.map +1 -1
- package/collections/report-builder-dashboard-builder.collection.js +11 -1
- package/collections/report-builder-dashboard-builder.collection.js.map +1 -1
- package/collections/report-builder-library.collection.js +11 -1
- package/collections/report-builder-library.collection.js.map +1 -1
- package/collections/report-builder-report.collection.js +11 -1
- package/collections/report-builder-report.collection.js.map +1 -1
- package/collections/user-group.collection.js +11 -1
- package/collections/user-group.collection.js.map +1 -1
- package/collections/user-guide.collection.js +11 -1
- package/collections/user-guide.collection.js.map +1 -1
- package/collections/user.collection.js +11 -1
- package/collections/user.collection.js.map +1 -1
- package/managers/mongo.manager.d.ts +17 -3
- package/managers/mongo.manager.js +43 -26
- package/managers/mongo.manager.js.map +1 -1
- package/managers/monitor.manager.js +24 -89
- package/managers/monitor.manager.js.map +1 -1
- package/methods/monitor.js +1 -13
- package/methods/monitor.js.map +1 -1
- package/models/monitor-cpu.model.d.ts +5 -2
- package/models/monitor-cpu.model.js.map +1 -1
- package/models/monitor-memory.model.d.ts +5 -2
- package/models/monitor-memory.model.js.map +1 -1
- package/models/monitor-mongo.model.d.ts +5 -2
- package/models/monitor-mongo.model.js.map +1 -1
- package/package.json +1 -1
- package/public_api.d.ts +0 -4
- package/public_api.js +0 -4
- package/public_api.js.map +1 -1
- package/collections/monitor-https-inbound.collection.d.ts +0 -3
- package/collections/monitor-https-inbound.collection.js +0 -67
- package/collections/monitor-https-inbound.collection.js.map +0 -1
- package/collections/monitor-https-outbound.collection.d.ts +0 -3
- package/collections/monitor-https-outbound.collection.js +0 -75
- package/collections/monitor-https-outbound.collection.js.map +0 -1
- package/models/monitor-https-inbound.model.d.ts +0 -11
- package/models/monitor-https-inbound.model.js +0 -4
- package/models/monitor-https-inbound.model.js.map +0 -1
- package/models/monitor-https-outbound.model.d.ts +0 -12
- package/models/monitor-https-outbound.model.js +0 -4
- package/models/monitor-https-outbound.model.js.map +0 -1
|
@@ -62,6 +62,7 @@ var scmp = require('scmp');
|
|
|
62
62
|
var v8 = require('v8');
|
|
63
63
|
var MongoManager = /** @class */ (function () {
|
|
64
64
|
function MongoManager() {
|
|
65
|
+
var _this = this;
|
|
65
66
|
this._collections = [];
|
|
66
67
|
this._mongoQueue = [];
|
|
67
68
|
this._mongoQueueId = 0;
|
|
@@ -69,11 +70,21 @@ var MongoManager = /** @class */ (function () {
|
|
|
69
70
|
this._mongoQueueCacheId = 1;
|
|
70
71
|
this._heapStats = v8.getHeapStatistics();
|
|
71
72
|
this._heapLimit = 0;
|
|
73
|
+
this._serverCollections = [];
|
|
72
74
|
this._nodeCache = new NodeCache({ stdTTL: 0, checkperiod: 0 });
|
|
73
75
|
this._heapLimit = this._heapStats.heap_size_limit / 4;
|
|
76
|
+
index_1.ResolveIOServer.getMainDB().listCollections().toArray().then(function (collections) {
|
|
77
|
+
_this._serverCollections = collections.map(function (a) { return a.name; });
|
|
78
|
+
});
|
|
74
79
|
this.runQueue();
|
|
75
80
|
}
|
|
81
|
+
MongoManager.prototype.getServerCollections = function () {
|
|
82
|
+
return this._serverCollections;
|
|
83
|
+
};
|
|
76
84
|
MongoManager.prototype.registerCollection = function (collection) {
|
|
85
|
+
if (!this._serverCollections.includes(collection.collectionName)) {
|
|
86
|
+
index_1.ResolveIOServer.getMainDB().createCollection(collection.collectionName, collection.collectionOptions);
|
|
87
|
+
}
|
|
77
88
|
this._collections.push(collection);
|
|
78
89
|
};
|
|
79
90
|
MongoManager.prototype.collections = function () {
|
|
@@ -246,41 +257,46 @@ var MongoManager = /** @class */ (function () {
|
|
|
246
257
|
}());
|
|
247
258
|
exports.MongoManager = MongoManager;
|
|
248
259
|
var Model = /** @class */ (function () {
|
|
249
|
-
function Model(
|
|
250
|
-
if (useVersionCollection === void 0) { useVersionCollection = false; }
|
|
251
|
-
if (useReportBuilder === void 0) { useReportBuilder = true; }
|
|
252
|
-
if (reportBuilderLookupTables === void 0) { reportBuilderLookupTables = []; }
|
|
253
|
-
if (timestamps === void 0) { timestamps = true; }
|
|
254
|
-
if (createLogs === void 0) { createLogs = true; }
|
|
255
|
-
if (checkSchema === void 0) { checkSchema = true; }
|
|
260
|
+
function Model(options) {
|
|
256
261
|
this.collection_main = null;
|
|
257
262
|
this.collection_version = null;
|
|
258
|
-
if (collectionName === 'users') {
|
|
259
|
-
this.collection_main = new UserCollection(
|
|
263
|
+
if (options.collectionName === 'users') {
|
|
264
|
+
this.collection_main = new UserCollection(options);
|
|
260
265
|
}
|
|
261
266
|
else {
|
|
262
|
-
this.collection_main = new Collection(
|
|
267
|
+
this.collection_main = new Collection(options);
|
|
263
268
|
}
|
|
264
|
-
if (useVersionCollection) {
|
|
269
|
+
if (options.useVersionCollection) {
|
|
265
270
|
this.collection_main.useVersions = true;
|
|
266
|
-
var versionSchema = common_1.deepCopy(schema);
|
|
271
|
+
var versionSchema = common_1.deepCopy(options.schema);
|
|
267
272
|
versionSchema['_id'].type = 'Object';
|
|
268
273
|
versionSchema['_id'].blackbox = true;
|
|
269
|
-
|
|
270
|
-
|
|
274
|
+
var versionOptions = {
|
|
275
|
+
collectionName: options.collectionName + '.versions',
|
|
276
|
+
schema: versionSchema,
|
|
277
|
+
useVersionCollection: false,
|
|
278
|
+
useReportBuilder: false,
|
|
279
|
+
reportBuilderLookupTables: [],
|
|
280
|
+
timestamps: true,
|
|
281
|
+
createLogs: false,
|
|
282
|
+
checkSchema: false,
|
|
283
|
+
collectionOptions: null
|
|
284
|
+
};
|
|
285
|
+
if (options.collectionName === 'users') {
|
|
286
|
+
this.collection_version = new UserCollection(versionOptions);
|
|
271
287
|
}
|
|
272
288
|
else {
|
|
273
|
-
this.collection_version = new Collection(
|
|
289
|
+
this.collection_version = new Collection(versionOptions);
|
|
274
290
|
}
|
|
275
291
|
this.collection_version.createIndex({ '_id._id': 1, '_id.__v': 1 });
|
|
276
|
-
this.collection_main.versionCollection = collectionName + '.versions';
|
|
292
|
+
this.collection_main.versionCollection = options.collectionName + '.versions';
|
|
277
293
|
}
|
|
278
294
|
}
|
|
279
295
|
return Model;
|
|
280
296
|
}());
|
|
281
297
|
exports.Model = Model;
|
|
282
298
|
var Collection = /** @class */ (function () {
|
|
283
|
-
function Collection(
|
|
299
|
+
function Collection(options) {
|
|
284
300
|
var _this = this;
|
|
285
301
|
this.collectionName = '';
|
|
286
302
|
this.checkSchema = false;
|
|
@@ -291,19 +307,20 @@ var Collection = /** @class */ (function () {
|
|
|
291
307
|
this.versionCollection = '';
|
|
292
308
|
this.createLogs = true;
|
|
293
309
|
this.useRB = false;
|
|
294
|
-
this.collectionName = collectionName;
|
|
295
|
-
this.simplschema = new simpl_schema_1.default(schema);
|
|
296
|
-
this.timestamps = timestamps;
|
|
297
|
-
this.createLogs = createLogs;
|
|
298
|
-
this.checkSchema = checkSchema;
|
|
299
|
-
|
|
310
|
+
this.collectionName = options.collectionName;
|
|
311
|
+
this.simplschema = new simpl_schema_1.default(options.schema);
|
|
312
|
+
this.timestamps = options.timestamps;
|
|
313
|
+
this.createLogs = options.createLogs;
|
|
314
|
+
this.checkSchema = options.checkSchema;
|
|
315
|
+
this.collectionOptions = options.collectionOptions;
|
|
316
|
+
if (options.useReportBuilder) {
|
|
300
317
|
this.useRB = true;
|
|
301
|
-
var schemaCopy = common_1.deepCopy(schema);
|
|
302
|
-
var rbSchema = common_1.buildRbLookups(reportBuilderLookupTables, schemaCopy, []);
|
|
318
|
+
var schemaCopy = common_1.deepCopy(options.schema);
|
|
319
|
+
var rbSchema = common_1.buildRbLookups(options.reportBuilderLookupTables, schemaCopy, []);
|
|
303
320
|
this.rbSchema = common_1.buildRbSchema(rbSchema);
|
|
304
321
|
}
|
|
305
322
|
var interval = setInterval(function () {
|
|
306
|
-
if (index_1.ResolveIOServer && index_1.ResolveIOServer.getMainServer() && index_1.ResolveIOServer.getMongoManager()) {
|
|
323
|
+
if (index_1.ResolveIOServer && index_1.ResolveIOServer.getMainServer() && index_1.ResolveIOServer.getMongoManager() && index_1.ResolveIOServer.getMongoManager().getServerCollections().length) {
|
|
307
324
|
index_1.ResolveIOServer.getMongoManager().registerCollection(_this);
|
|
308
325
|
clearInterval(interval);
|
|
309
326
|
}
|