@resolveio/server-lib 20.12.50 → 20.12.52
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/mongo.manager.d.ts +1 -0
- package/managers/mongo.manager.js +37 -9
- package/managers/mongo.manager.js.map +1 -1
- package/managers/subscription.manager.d.ts +17 -0
- package/managers/subscription.manager.js +353 -46
- package/managers/subscription.manager.js.map +1 -1
- package/methods/report-builder.js +5 -1
- package/methods/report-builder.js.map +1 -1
- package/package.json +1 -1
|
@@ -115,6 +115,7 @@ export declare class MongoManager {
|
|
|
115
115
|
private getFromCache;
|
|
116
116
|
private addToCache;
|
|
117
117
|
invalidateQueryCache(collection: string): void;
|
|
118
|
+
clearQueryCache(reason?: string): void;
|
|
118
119
|
private setupChangeStream;
|
|
119
120
|
private teardownChangeStream;
|
|
120
121
|
private handleChangeStreamFailure;
|
|
@@ -836,6 +836,34 @@ var MongoManager = /** @class */ (function () {
|
|
|
836
836
|
}
|
|
837
837
|
this._cacheMap = this._cacheMap.filter(function (a) { return !a.collections.includes(collection); });
|
|
838
838
|
};
|
|
839
|
+
MongoManager.prototype.clearQueryCache = function (reason) {
|
|
840
|
+
var e_5, _a;
|
|
841
|
+
if (resolveio_server_app_1.ResolveIOServer.getMainServer().getSubscriptionManager() && resolveio_server_app_1.ResolveIOServer.getMainServer().getSubscriptionManager().getEnableDebug()) {
|
|
842
|
+
console.log(new Date(), 'Mongo Clear Cache', reason || '');
|
|
843
|
+
}
|
|
844
|
+
try {
|
|
845
|
+
this._nodeCache.flushAll();
|
|
846
|
+
}
|
|
847
|
+
catch (_b) {
|
|
848
|
+
// ignore flush errors
|
|
849
|
+
}
|
|
850
|
+
this._cacheMap = [];
|
|
851
|
+
try {
|
|
852
|
+
// Mark all in-flight ops invalidated so they don't repopulate cache with stale data.
|
|
853
|
+
// eslint-disable-next-line no-unused-vars
|
|
854
|
+
for (var _c = __values(this._operationInProgress.entries()), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
855
|
+
var _e = __read(_d.value, 2), key = _e[0], operation = _e[1];
|
|
856
|
+
operation.invalidatedDuringExecution = true;
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
860
|
+
finally {
|
|
861
|
+
try {
|
|
862
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
863
|
+
}
|
|
864
|
+
finally { if (e_5) throw e_5.error; }
|
|
865
|
+
}
|
|
866
|
+
};
|
|
839
867
|
MongoManager.prototype.setupChangeStream = function () {
|
|
840
868
|
return __awaiter(this, void 0, void 0, function () {
|
|
841
869
|
var client, watchDatabases, pipeline, changeStream;
|
|
@@ -1288,7 +1316,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1288
1316
|
MongoManagerCollection.prototype.bulkWrite = function (operations_1, options_1) {
|
|
1289
1317
|
return __awaiter(this, arguments, void 0, function (operations, options, bypassCheckSchema, bypassLogs, bypassVersions, bypassSession) {
|
|
1290
1318
|
var BATCH_SIZE, opIndex, mongoSession, _a, session, safeOptions, batchOps, logs, versionOps, batchOps_1, batchOps_1_1, op, opType, doc, validationContext, isValid, affectedDocs, versionFilters, versionInserts, _b, _c, monitor, err_9, bwOptions, affectedDocIds, pipeline, oldVersions, _d;
|
|
1291
|
-
var
|
|
1319
|
+
var e_6, _e;
|
|
1292
1320
|
if (bypassCheckSchema === void 0) { bypassCheckSchema = false; }
|
|
1293
1321
|
if (bypassLogs === void 0) { bypassLogs = false; }
|
|
1294
1322
|
if (bypassVersions === void 0) { bypassVersions = false; }
|
|
@@ -1318,7 +1346,7 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1318
1346
|
logs = [];
|
|
1319
1347
|
versionOps = [];
|
|
1320
1348
|
try {
|
|
1321
|
-
for (batchOps_1 = (
|
|
1349
|
+
for (batchOps_1 = (e_6 = void 0, __values(batchOps)), batchOps_1_1 = batchOps_1.next(); !batchOps_1_1.done; batchOps_1_1 = batchOps_1.next()) {
|
|
1322
1350
|
op = batchOps_1_1.value;
|
|
1323
1351
|
opType = Object.keys(op)[0];
|
|
1324
1352
|
doc = op[opType];
|
|
@@ -1489,12 +1517,12 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
1489
1517
|
}
|
|
1490
1518
|
}
|
|
1491
1519
|
}
|
|
1492
|
-
catch (
|
|
1520
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
1493
1521
|
finally {
|
|
1494
1522
|
try {
|
|
1495
1523
|
if (batchOps_1_1 && !batchOps_1_1.done && (_e = batchOps_1.return)) _e.call(batchOps_1);
|
|
1496
1524
|
}
|
|
1497
|
-
finally { if (
|
|
1525
|
+
finally { if (e_6) throw e_6.error; }
|
|
1498
1526
|
}
|
|
1499
1527
|
affectedDocs = [];
|
|
1500
1528
|
if (!(!bypassVersions && this.useVersions && versionOps.length > 0)) return [3 /*break*/, 10];
|
|
@@ -2911,8 +2939,8 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
2911
2939
|
};
|
|
2912
2940
|
MongoManagerCollection.prototype.insertMany = function (docs_1, options_1) {
|
|
2913
2941
|
return __awaiter(this, arguments, void 0, function (docs, options, bypassLogs, bypassCheckSchema, bypassMonitor, bypassSession) {
|
|
2914
|
-
var validationResults, docs_2, docs_2_1, doc, validation, isValid,
|
|
2915
|
-
var
|
|
2942
|
+
var validationResults, docs_2, docs_2_1, doc, validation, isValid, e_7_1, validDocs, mongoSession, _a, session, safeOptions, i, doc, date, monitor, err_27;
|
|
2943
|
+
var e_7, _b;
|
|
2916
2944
|
if (bypassLogs === void 0) { bypassLogs = false; }
|
|
2917
2945
|
if (bypassCheckSchema === void 0) { bypassCheckSchema = false; }
|
|
2918
2946
|
if (bypassMonitor === void 0) { bypassMonitor = false; }
|
|
@@ -2950,14 +2978,14 @@ var MongoManagerCollection = /** @class */ (function () {
|
|
|
2950
2978
|
return [3 /*break*/, 2];
|
|
2951
2979
|
case 6: return [3 /*break*/, 9];
|
|
2952
2980
|
case 7:
|
|
2953
|
-
|
|
2954
|
-
|
|
2981
|
+
e_7_1 = _c.sent();
|
|
2982
|
+
e_7 = { error: e_7_1 };
|
|
2955
2983
|
return [3 /*break*/, 9];
|
|
2956
2984
|
case 8:
|
|
2957
2985
|
try {
|
|
2958
2986
|
if (docs_2_1 && !docs_2_1.done && (_b = docs_2.return)) _b.call(docs_2);
|
|
2959
2987
|
}
|
|
2960
|
-
finally { if (
|
|
2988
|
+
finally { if (e_7) throw e_7.error; }
|
|
2961
2989
|
return [7 /*endfinally*/];
|
|
2962
2990
|
case 9:
|
|
2963
2991
|
validDocs = this.checkSchema ? docs.filter(function (a, idx) { return validationResults[idx]; }) : docs;
|