@resolveio/server-lib 9.8.12 → 9.8.13

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.
@@ -51,7 +51,7 @@ export declare class Collection<T> {
51
51
  createLogs: boolean;
52
52
  useRB: boolean;
53
53
  constructor(collectionName: string, schema: object, useReportBuilder: any, reportBuilderLookupTables: LookupTables[], timestamps: any, createLogs: any, checkSchema: any);
54
- aggregate(pipeline: object[], options?: AggregateOptions, allowLogs?: boolean): Promise<any[]>;
54
+ aggregate(pipeline: object[], options?: AggregateOptions, skipCache?: boolean): Promise<any[]>;
55
55
  aggregateCount(pipeline: object[], options?: AggregateOptions): Promise<number>;
56
56
  aggregateCursor(pipeline: object[], options?: AggregateOptions): import("mongodb").AggregationCursor<import("bson").Document>;
57
57
  aggregateStream(pipeline: object[], options?: AggregateOptions): import("stream").Readable;
@@ -65,12 +65,12 @@ export declare class Collection<T> {
65
65
  drop(options?: CommandOperationOptions): Promise<boolean>;
66
66
  dropIndex(indexName: string, options?: CommandOperationOptions): Promise<import("bson").Document>;
67
67
  dropIndexes(options?: CommandOperationOptions): Promise<import("bson").Document>;
68
- find(filter?: Filter<T>, options?: FindOptions<T>, bypassLogs?: boolean): Promise<T[]>;
68
+ find(filter?: Filter<T>, options?: FindOptions<T>, skipCache?: boolean): Promise<T[]>;
69
69
  findById(id: string, options?: FindOptions<T>): Promise<T>;
70
70
  findCount(filter?: Filter<T>, options?: FindOptions<T>, bypassLogs?: boolean): Promise<Number>;
71
71
  findCursor(filter?: Filter<T>, options?: FindOptions<T>): import("mongodb").FindCursor<import("bson").Document>;
72
72
  findStream(filter?: Filter<T>, options?: FindOptions<T>, streamOptions?: CursorStreamOptions): import("stream").Readable;
73
- findOne(filter?: Filter<T>, options?: FindOptions<T>, bypassLogs?: boolean): Promise<T>;
73
+ findOne(filter?: Filter<T>, options?: FindOptions<T>, skipCache?: boolean): Promise<T>;
74
74
  findOneAndDelete(filter?: Filter<T>, options?: FindOneAndDeleteOptions, bypassLogs?: boolean): Promise<T>;
75
75
  findOneAndReplace(filter: Filter<T>, replacement: T, options?: FindOneAndReplaceOptions, bypassLogs?: boolean, bypassCheckSchema?: boolean): Promise<T>;
76
76
  findOneAndUpdate(filter: Filter<T>, update: any, options?: FindOneAndUpdateOptions, bypassLogs?: boolean, bypassCheckSchema?: boolean): Promise<T>;
@@ -280,23 +280,11 @@ var Collection = /** @class */ (function () {
280
280
  }
281
281
  }, 1);
282
282
  }
283
- Collection.prototype.aggregate = function (pipeline, options, allowLogs) {
283
+ Collection.prototype.aggregate = function (pipeline, options, skipCache) {
284
284
  var _this = this;
285
- if (allowLogs === void 0) { allowLogs = false; }
285
+ if (skipCache === void 0) { skipCache = false; }
286
286
  return new Promise(function (resolve, reject) {
287
- if (_this.createLogs && allowLogs) {
288
- // Logs.insertOne({
289
- // _id: objectIdHexString(),
290
- // type: 'query',
291
- // collection: this.collectionName,
292
- // id_document: '',
293
- // payload: JSON.stringify([pipeline, options], null, 2),
294
- // method: 'aggregate',
295
- // id_user: '',
296
- // user: '',
297
- // messageId: 0,
298
- // route: ''
299
- // });
287
+ if (!skipCache) {
300
288
  index_1.ResolveIOServer.getMongoManager().addToQueue({
301
289
  _id: 0,
302
290
  name_collection: _this.collectionName,
@@ -305,20 +293,6 @@ var Collection = /** @class */ (function () {
305
293
  data_function: [pipeline, options],
306
294
  data_function_addt: [],
307
295
  cbs: [function (err, res, cached) {
308
- if (_this.createLogs && allowLogs) {
309
- // Logs.insertOne({
310
- // _id: objectIdHexString(),
311
- // type: 'queryResponse',
312
- // collection: this.collectionName,
313
- // id_document: '',
314
- // payload: getBinarySize(JSON.stringify(['Is Cached: ' + cached, err, res])) < 200000 ? JSON.stringify(['Is Cached: ' + cached, err, res], null, 2) : 'Too Big',
315
- // method: 'aggregate',
316
- // id_user: '',
317
- // user: '',
318
- // messageId: 0,
319
- // route: ''
320
- // });
321
- }
322
296
  if (err) {
323
297
  reject(err);
324
298
  }
@@ -522,26 +496,13 @@ var Collection = /** @class */ (function () {
522
496
  Collection.prototype.dropIndexes = function (options) {
523
497
  return index_1.ResolveIOServer.getMainDB().collection(this.collectionName).dropIndexes(options);
524
498
  };
525
- Collection.prototype.find = function (filter, options, bypassLogs) {
499
+ Collection.prototype.find = function (filter, options, skipCache) {
526
500
  var _this = this;
527
501
  if (filter === void 0) { filter = {}; }
528
- if (bypassLogs === void 0) { bypassLogs = false; }
502
+ if (skipCache === void 0) { skipCache = false; }
529
503
  return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
530
- var _this = this;
531
504
  return __generator(this, function (_a) {
532
- if (this.createLogs && !bypassLogs) {
533
- // Logs.insertOne({
534
- // _id: objectIdHexString(),
535
- // type: 'query',
536
- // collection: this.collectionName,
537
- // id_document: '',
538
- // payload: JSON.stringify([filter, options], null, 2),
539
- // method: 'find',
540
- // id_user: '',
541
- // user: '',
542
- // messageId: 0,
543
- // route: ''
544
- // });
505
+ if (!skipCache) {
545
506
  index_1.ResolveIOServer.getMongoManager().addToQueue({
546
507
  _id: 0,
547
508
  name_collection: this.collectionName,
@@ -550,20 +511,6 @@ var Collection = /** @class */ (function () {
550
511
  data_function: [filter, options],
551
512
  data_function_addt: [],
552
513
  cbs: [function (err, res, cached) {
553
- if (_this.createLogs && !bypassLogs) {
554
- // Logs.insertOne({
555
- // _id: objectIdHexString(),
556
- // type: 'queryResponse',
557
- // collection: this.collectionName,
558
- // id_document: '',
559
- // payload: getBinarySize(JSON.stringify(['Is Cached: ' + cached, err, res])) < 200000 ? JSON.stringify(['Is Cached: ' + cached, err, res], null, 2) : 'Too Big',
560
- // method: 'find',
561
- // id_user: '',
562
- // user: '',
563
- // messageId: 0,
564
- // route: ''
565
- // });
566
- }
567
514
  if (err) {
568
515
  reject(err);
569
516
  }
@@ -593,20 +540,6 @@ var Collection = /** @class */ (function () {
593
540
  Collection.prototype.findCount = function (filter, options, bypassLogs) {
594
541
  if (filter === void 0) { filter = {}; }
595
542
  if (bypassLogs === void 0) { bypassLogs = false; }
596
- if (this.createLogs && !bypassLogs) {
597
- // Logs.insertOne({
598
- // _id: objectIdHexString(),
599
- // type: 'query',
600
- // collection: this.collectionName,
601
- // id_document: '',
602
- // payload: JSON.stringify([filter, options], null, 2),
603
- // method: 'findCount',
604
- // id_user: '',
605
- // user: '',
606
- // messageId: 0,
607
- // route: ''
608
- // });
609
- }
610
543
  return index_1.ResolveIOServer.getMainDB().collection(this.collectionName).find(filter, options).count();
611
544
  };
612
545
  Collection.prototype.findCursor = function (filter, options) {
@@ -617,24 +550,12 @@ var Collection = /** @class */ (function () {
617
550
  if (filter === void 0) { filter = {}; }
618
551
  return index_1.ResolveIOServer.getMainDB().collection(this.collectionName).find(filter, options).stream(streamOptions);
619
552
  };
620
- Collection.prototype.findOne = function (filter, options, bypassLogs) {
553
+ Collection.prototype.findOne = function (filter, options, skipCache) {
621
554
  var _this = this;
622
555
  if (filter === void 0) { filter = {}; }
623
- if (bypassLogs === void 0) { bypassLogs = false; }
556
+ if (skipCache === void 0) { skipCache = false; }
624
557
  return new Promise(function (resolve, reject) {
625
- if (_this.createLogs && !bypassLogs) {
626
- // Logs.insertOne({
627
- // _id: objectIdHexString(),
628
- // type: 'query',
629
- // collection: this.collectionName,
630
- // id_document: '',
631
- // payload: JSON.stringify([filter, options], null, 2),
632
- // method: 'findOne',
633
- // id_user: '',
634
- // user: '',
635
- // messageId: 0,
636
- // route: ''
637
- // });
558
+ if (!skipCache) {
638
559
  index_1.ResolveIOServer.getMongoManager().addToQueue({
639
560
  _id: 0,
640
561
  name_collection: _this.collectionName,
@@ -649,20 +570,6 @@ var Collection = /** @class */ (function () {
649
570
  else {
650
571
  resolve(res);
651
572
  }
652
- if (_this.createLogs && !bypassLogs) {
653
- // Logs.insertOne({
654
- // _id: objectIdHexString(),
655
- // type: 'queryResponse',
656
- // collection: this.collectionName,
657
- // id_document: '',
658
- // payload: getBinarySize(JSON.stringify(['Is Cached: ' + cached, err, res])) < 200000 ? JSON.stringify(['Is Cached: ' + cached, err, res], null, 2) : 'Too Big',
659
- // method: 'findOne',
660
- // id_user: '',
661
- // user: '',
662
- // messageId: 0,
663
- // route: ''
664
- // });
665
- }
666
573
  }],
667
574
  cbs_next: [],
668
575
  running: false,