@resolveio/server-lib 20.11.10 → 20.11.11

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.
@@ -480,7 +480,7 @@ var MongoManager = /** @class */ (function () {
480
480
  _b.label = 1;
481
481
  case 1:
482
482
  _b.trys.push([1, 3, 4, 6]);
483
- return [4 /*yield*/, collection.findOne(filter, options)];
483
+ return [4 /*yield*/, collection.findOne(filter, options || undefined)];
484
484
  case 2:
485
485
  result = _b.sent();
486
486
  return [3 /*break*/, 6];
@@ -639,7 +639,7 @@ var MongoManager = /** @class */ (function () {
639
639
  _b.label = 1;
640
640
  case 1:
641
641
  _b.trys.push([1, 3, 4, 6]);
642
- return [4 /*yield*/, collection.countDocuments(filter, options)];
642
+ return [4 /*yield*/, collection.countDocuments(filter, options || undefined)];
643
643
  case 2:
644
644
  result = _b.sent();
645
645
  return [3 /*break*/, 6];
@@ -1076,7 +1076,7 @@ var MongoManagerCollection = /** @class */ (function () {
1076
1076
  }
1077
1077
  }
1078
1078
  if (!(!skipCache && !this.skipCache)) return [3 /*break*/, 1];
1079
- return [2 /*return*/, resolveio_server_app_1.ResolveIOServer.getMongoManager().aggregate(this.collectionName, pipeline, options)];
1079
+ return [2 /*return*/, resolveio_server_app_1.ResolveIOServer.getMongoManager().aggregate(this.collectionName, pipeline, options || undefined)];
1080
1080
  case 1:
1081
1081
  _a = options || {}, session = _a.session, safeOptions = __rest(_a, ["session"]);
1082
1082
  monitor = monitor_manager_1.MonitorMongo.create('aggregate', this.collectionName, JSON.stringify([pipeline, safeOptions]));
@@ -1171,7 +1171,7 @@ var MongoManagerCollection = /** @class */ (function () {
1171
1171
  // eslint-disable-next-line no-unused-vars
1172
1172
  var _a = options || {}, session = _a.session, safeOptions = __rest(_a, ["session"]);
1173
1173
  var monitor = monitor_manager_1.MonitorMongo.create('aggregateCursor', this.collectionName, JSON.stringify([pipeline, safeOptions]));
1174
- var cursor = resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).aggregate(pipeline, options);
1174
+ var cursor = resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).aggregate(pipeline, options || undefined);
1175
1175
  cursor.on('close', function (ev) { return __awaiter(_this, void 0, void 0, function () {
1176
1176
  return __generator(this, function (_a) {
1177
1177
  switch (_a.label) {
@@ -1460,7 +1460,7 @@ var MongoManagerCollection = /** @class */ (function () {
1460
1460
  _f.label = 11;
1461
1461
  case 11:
1462
1462
  _f.trys.push([11, 13, 14, 16]);
1463
- return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName).bulkWrite(batchOps, options)];
1463
+ return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName).bulkWrite(batchOps, options || undefined)];
1464
1464
  case 12:
1465
1465
  _f.sent();
1466
1466
  return [3 /*break*/, 16];
@@ -1634,7 +1634,7 @@ var MongoManagerCollection = /** @class */ (function () {
1634
1634
  if (indexExists) {
1635
1635
  return [2 /*return*/, 'Index already exists']; // Skip creation if index exists
1636
1636
  }
1637
- return [2 /*return*/, dbCollection.createIndex(fieldOrSpec, options)];
1637
+ return [2 /*return*/, dbCollection.createIndex(fieldOrSpec, options || undefined)];
1638
1638
  case 2:
1639
1639
  _a = _b.sent();
1640
1640
  return [3 /*break*/, 3];
@@ -1663,7 +1663,7 @@ var MongoManagerCollection = /** @class */ (function () {
1663
1663
  if (indexesToCreate.length === 0) {
1664
1664
  return [2 /*return*/, ['All indexes already exist']];
1665
1665
  }
1666
- return [2 /*return*/, dbCollection.createIndexes(indexSpecs, options)];
1666
+ return [2 /*return*/, dbCollection.createIndexes(indexSpecs, options || undefined)];
1667
1667
  case 2:
1668
1668
  _a = _b.sent();
1669
1669
  return [3 /*break*/, 3];
@@ -1761,7 +1761,7 @@ var MongoManagerCollection = /** @class */ (function () {
1761
1761
  _c.label = 12;
1762
1762
  case 12:
1763
1763
  _c.trys.push([12, 14, 15, 17]);
1764
- return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).deleteMany(filter, options)];
1764
+ return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).deleteMany(filter, options || undefined)];
1765
1765
  case 13:
1766
1766
  res = _c.sent();
1767
1767
  if (!this.skipCache) {
@@ -1811,10 +1811,10 @@ var MongoManagerCollection = /** @class */ (function () {
1811
1811
  _c.label = 1;
1812
1812
  case 1:
1813
1813
  _c.trys.push([1, 13, 14, 16]);
1814
- return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).deleteOne(filter, options)];
1814
+ return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).deleteOne(filter, options || undefined)];
1815
1815
  case 2:
1816
1816
  res = _c.sent();
1817
- return [4 /*yield*/, this.findOne(filter, options)];
1817
+ return [4 /*yield*/, this.findOne(filter, options || undefined)];
1818
1818
  case 3:
1819
1819
  doc = _c.sent();
1820
1820
  if (!doc) return [3 /*break*/, 12];
@@ -1897,7 +1897,7 @@ var MongoManagerCollection = /** @class */ (function () {
1897
1897
  _c.label = 18;
1898
1898
  case 18:
1899
1899
  _c.trys.push([18, 20, 21, 23]);
1900
- return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).deleteOne(filter, options)];
1900
+ return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).deleteOne(filter, options || undefined)];
1901
1901
  case 19:
1902
1902
  res = _c.sent();
1903
1903
  if (!this.skipCache) {
@@ -1946,7 +1946,7 @@ var MongoManagerCollection = /** @class */ (function () {
1946
1946
  _b.label = 1;
1947
1947
  case 1:
1948
1948
  _b.trys.push([1, 3, 4, 6]);
1949
- return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).distinct(key, filter, options)];
1949
+ return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).distinct(key, filter, options || undefined)];
1950
1950
  case 2:
1951
1951
  res = _b.sent();
1952
1952
  return [2 /*return*/, res];
@@ -2038,7 +2038,7 @@ var MongoManagerCollection = /** @class */ (function () {
2038
2038
  _b.label = 1;
2039
2039
  case 1:
2040
2040
  _b.trys.push([1, 3, 4, 6]);
2041
- return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).dropIndex(indexName, options)];
2041
+ return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).dropIndex(indexName, options || undefined)];
2042
2042
  case 2:
2043
2043
  res = _b.sent();
2044
2044
  return [2 /*return*/, res];
@@ -2129,7 +2129,7 @@ var MongoManagerCollection = /** @class */ (function () {
2129
2129
  }
2130
2130
  _a = options || {}, session = _a.session, safeOptions = __rest(_a, ["session"]);
2131
2131
  if (!(!skipCache && !this.skipCache)) return [3 /*break*/, 1];
2132
- return [2 /*return*/, resolveio_server_app_1.ResolveIOServer.getMongoManager().find(this.collectionName, filter, options)];
2132
+ return [2 /*return*/, resolveio_server_app_1.ResolveIOServer.getMongoManager().find(this.collectionName, filter, options || undefined)];
2133
2133
  case 1:
2134
2134
  monitor = monitor_manager_1.MonitorMongo.create('find', this.collectionName, JSON.stringify([filter, safeOptions]));
2135
2135
  _b.label = 2;
@@ -2180,13 +2180,13 @@ var MongoManagerCollection = /** @class */ (function () {
2180
2180
  }
2181
2181
  _a = options || {}, session = _a.session, safeOptions = __rest(_a, ["session"]);
2182
2182
  if (!(!skipCache && !this.skipCache)) return [3 /*break*/, 1];
2183
- return [2 /*return*/, resolveio_server_app_1.ResolveIOServer.getMongoManager().findOne(this.collectionName, { _id: id }, options)];
2183
+ return [2 /*return*/, resolveio_server_app_1.ResolveIOServer.getMongoManager().findOne(this.collectionName, { _id: id }, options || undefined)];
2184
2184
  case 1:
2185
2185
  monitor = monitor_manager_1.MonitorMongo.create('findById', this.collectionName, JSON.stringify([{ _id: id }, safeOptions]));
2186
2186
  _b.label = 2;
2187
2187
  case 2:
2188
2188
  _b.trys.push([2, 4, 5, 7]);
2189
- return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).findOne({ _id: id }, options)];
2189
+ return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).findOne({ _id: id }, options || undefined)];
2190
2190
  case 3:
2191
2191
  res = _b.sent();
2192
2192
  (0, subscription_dependency_context_1.recordDependencyResult)(this.collectionName, res, { filter: { _id: id }, meta: buildQueryMetaFromFindOptions(safeOptions) });
@@ -2274,7 +2274,7 @@ var MongoManagerCollection = /** @class */ (function () {
2274
2274
  // eslint-disable-next-line no-unused-vars
2275
2275
  var _a = options || {}, session = _a.session, safeOptions = __rest(_a, ["session"]);
2276
2276
  var monitor = monitor_manager_1.MonitorMongo.create('findCursor', this.collectionName, JSON.stringify([filter, safeOptions]));
2277
- var cursor = resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).find(filter, options);
2277
+ var cursor = resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).find(filter, options || undefined);
2278
2278
  cursor.on('close', function (ev) { return __awaiter(_this, void 0, void 0, function () {
2279
2279
  return __generator(this, function (_a) {
2280
2280
  switch (_a.label) {
@@ -2337,14 +2337,14 @@ var MongoManagerCollection = /** @class */ (function () {
2337
2337
  }
2338
2338
  }
2339
2339
  if (!(!skipCache && !this.skipCache)) return [3 /*break*/, 1];
2340
- return [2 /*return*/, resolveio_server_app_1.ResolveIOServer.getMongoManager().findOne(this.collectionName, filter, options)];
2340
+ return [2 /*return*/, resolveio_server_app_1.ResolveIOServer.getMongoManager().findOne(this.collectionName, filter, options || undefined)];
2341
2341
  case 1:
2342
2342
  _a = options || {}, session = _a.session, safeOptions = __rest(_a, ["session"]);
2343
2343
  monitor = monitor_manager_1.MonitorMongo.create('findOne', this.collectionName, JSON.stringify([filter, safeOptions]));
2344
2344
  _b.label = 2;
2345
2345
  case 2:
2346
2346
  _b.trys.push([2, 4, 5, 7]);
2347
- return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).findOne(filter, options)];
2347
+ return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).findOne(filter, options || undefined)];
2348
2348
  case 3:
2349
2349
  res = _b.sent();
2350
2350
  (0, subscription_dependency_context_1.recordDependencyResult)(this.collectionName, res, { filter: filter });
@@ -2791,7 +2791,7 @@ var MongoManagerCollection = /** @class */ (function () {
2791
2791
  _b.label = 1;
2792
2792
  case 1:
2793
2793
  _b.trys.push([1, 3, 4, 6]);
2794
- return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).indexExists(indexes, options)];
2794
+ return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).indexExists(indexes, options || undefined)];
2795
2795
  case 2:
2796
2796
  res = _b.sent();
2797
2797
  return [2 /*return*/, res];
@@ -2944,7 +2944,7 @@ var MongoManagerCollection = /** @class */ (function () {
2944
2944
  _c.label = 15;
2945
2945
  case 15:
2946
2946
  _c.trys.push([15, 17, 18, 19]);
2947
- return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).insertMany(validDocs, options)];
2947
+ return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).insertMany(validDocs, options || undefined)];
2948
2948
  case 16:
2949
2949
  _c.sent();
2950
2950
  if (!this.skipCache) {
@@ -3056,7 +3056,7 @@ var MongoManagerCollection = /** @class */ (function () {
3056
3056
  _b.label = 6;
3057
3057
  case 6:
3058
3058
  _b.trys.push([6, 8, 9, 11]);
3059
- return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).insertOne(doc, options)];
3059
+ return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).insertOne(doc, options || undefined)];
3060
3060
  case 7:
3061
3061
  _b.sent();
3062
3062
  if (!this.skipCache) {
@@ -3133,7 +3133,7 @@ var MongoManagerCollection = /** @class */ (function () {
3133
3133
  _b.label = 1;
3134
3134
  case 1:
3135
3135
  _b.trys.push([1, 3, 4, 6]);
3136
- return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).rename(newName, options)];
3136
+ return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).rename(newName, options || undefined)];
3137
3137
  case 2:
3138
3138
  res = _b.sent();
3139
3139
  return [2 /*return*/, res];
@@ -3474,7 +3474,7 @@ var MongoManagerCollection = /** @class */ (function () {
3474
3474
  return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).replaceOne(filter, replacement, options)];
3475
3475
  case 47:
3476
3476
  res = _d.sent();
3477
- return [4 /*yield*/, this.findOne(filter, options)];
3477
+ return [4 /*yield*/, this.findOne(filter, options || undefined)];
3478
3478
  case 48:
3479
3479
  doc_1 = _d.sent();
3480
3480
  if (!doc_1) return [3 /*break*/, 52];
@@ -3914,7 +3914,7 @@ var MongoManagerCollection = /** @class */ (function () {
3914
3914
  _c.label = 12;
3915
3915
  case 12:
3916
3916
  _c.trys.push([12, 14, 15, 17]);
3917
- return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(filter, update, options)];
3917
+ return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(filter, update, options || undefined)];
3918
3918
  case 13:
3919
3919
  res = _c.sent();
3920
3920
  if (!this.skipCache) {
@@ -4002,7 +4002,7 @@ var MongoManagerCollection = /** @class */ (function () {
4002
4002
  _c.label = 22;
4003
4003
  case 22:
4004
4004
  _c.trys.push([22, 24, 25, 27]);
4005
- return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(filter, update, options)];
4005
+ return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(filter, update, options || undefined)];
4006
4006
  case 23:
4007
4007
  res = _c.sent();
4008
4008
  if (!this.skipCache) {
@@ -4067,10 +4067,10 @@ var MongoManagerCollection = /** @class */ (function () {
4067
4067
  _c.label = 31;
4068
4068
  case 31:
4069
4069
  _c.trys.push([31, 42, 43, 45]);
4070
- return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(filter, update, options)];
4070
+ return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(filter, update, options || undefined)];
4071
4071
  case 32:
4072
4072
  res = _c.sent();
4073
- return [4 /*yield*/, this.findOne(filter, options)];
4073
+ return [4 /*yield*/, this.findOne(filter, options || undefined)];
4074
4074
  case 33:
4075
4075
  doc = _c.sent();
4076
4076
  if (!doc) return [3 /*break*/, 37];
@@ -4173,7 +4173,7 @@ var MongoManagerCollection = /** @class */ (function () {
4173
4173
  _c.label = 47;
4174
4174
  case 47:
4175
4175
  _c.trys.push([47, 49, 50, 52]);
4176
- return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(filter, update, options)];
4176
+ return [4 /*yield*/, resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).updateOne(filter, update, options || undefined)];
4177
4177
  case 48:
4178
4178
  res = _c.sent();
4179
4179
  if (!this.skipCache) {
@@ -4211,7 +4211,7 @@ var MongoManagerCollection = /** @class */ (function () {
4211
4211
  options.session = session;
4212
4212
  }
4213
4213
  }
4214
- var stream = resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).watch(pipeline, options);
4214
+ var stream = resolveio_server_app_1.ResolveIOServer.getMainDB().collection(this.collectionName, this.collectionOptions).watch(pipeline, options || undefined);
4215
4215
  return stream;
4216
4216
  };
4217
4217
  return MongoManagerCollection;