@resolveio/server-lib 9.0.14 → 9.0.16

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.
@@ -4,7 +4,6 @@ exports.loadCollectionMethods = void 0;
4
4
  var common_1 = require("../util/common");
5
5
  var simpl_schema_1 = require("simpl-schema");
6
6
  var pagination_model_1 = require("../models/pagination.model");
7
- var log_collection_1 = require("../collections/log.collection");
8
7
  var index_1 = require("../index");
9
8
  var mongo_manager_1 = require("../managers/mongo.manager");
10
9
  function loadCollectionMethods(methodManager) {
@@ -120,34 +119,6 @@ function loadCollectionMethods(methodManager) {
120
119
  reject('Schema Errors');
121
120
  }
122
121
  else {
123
- if (common_1.getBinarySize(JSON.stringify(document)) < 200000) {
124
- log_collection_1.Logs.create({
125
- _id: mongo_manager_1.objectIdHexString(),
126
- date: new Date(),
127
- type: 'info',
128
- title: 'Insert Document',
129
- message: 'User: ' + _this.user + ', Collection Type: ' + collection,
130
- payload: JSON.stringify(document, null, 2),
131
- method: 'insertDocument',
132
- user: _this.user,
133
- messageId: '',
134
- route: ''
135
- });
136
- }
137
- else {
138
- log_collection_1.Logs.create({
139
- _id: mongo_manager_1.objectIdHexString(),
140
- date: new Date(),
141
- type: 'info',
142
- title: 'Insert Document',
143
- message: 'User: ' + _this.user + ', Collection Type: ' + collection,
144
- payload: 'Too Big',
145
- method: 'insertDocument',
146
- user: _this.user,
147
- messageId: '',
148
- route: ''
149
- });
150
- }
151
122
  var id_1 = mongo_manager_1.objectIdHexString();
152
123
  document['_id'] = id_1;
153
124
  document['__v'] = 0;
@@ -197,34 +168,6 @@ function loadCollectionMethods(methodManager) {
197
168
  reject('Schema Errors');
198
169
  }
199
170
  else {
200
- if (common_1.getBinarySize(JSON.stringify(document_1)) < 200000) {
201
- log_collection_1.Logs.create({
202
- _id: mongo_manager_1.objectIdHexString(),
203
- date: new Date(),
204
- type: 'info',
205
- title: 'Insert Document',
206
- message: 'User: ' + _this.user + ', Collection Type: ' + collection,
207
- payload: JSON.stringify(document_1, null, 2),
208
- method: 'insertDocument',
209
- user: _this.user,
210
- messageId: '',
211
- route: ''
212
- });
213
- }
214
- else {
215
- log_collection_1.Logs.create({
216
- _id: mongo_manager_1.objectIdHexString(),
217
- date: new Date(),
218
- type: 'info',
219
- title: 'Insert Document',
220
- message: 'User: ' + _this.user + ', Collection Type: ' + collection,
221
- payload: 'Too Big',
222
- method: 'insertDocument',
223
- user: _this.user,
224
- messageId: '',
225
- route: ''
226
- });
227
- }
228
171
  var id_2 = mongo_manager_1.objectIdHexString();
229
172
  document_1['_id'] = id_2;
230
173
  document_1['__v'] = 0;
@@ -321,34 +264,6 @@ function loadCollectionMethods(methodManager) {
321
264
  console.log(err);
322
265
  });
323
266
  });
324
- if (common_1.getBinarySize(JSON.stringify(f_document)) < 200000) {
325
- log_collection_1.Logs.create({
326
- _id: mongo_manager_1.objectIdHexString(),
327
- date: new Date(),
328
- type: 'info',
329
- title: 'Update Document',
330
- message: 'User: ' + _this.user + ', Collection Type: ' + collection,
331
- payload: JSON.stringify(f_document, null, 2),
332
- method: 'updateDocument',
333
- user: _this.user,
334
- messageId: '',
335
- route: ''
336
- });
337
- }
338
- else {
339
- log_collection_1.Logs.create({
340
- _id: mongo_manager_1.objectIdHexString(),
341
- date: new Date(),
342
- type: 'info',
343
- title: 'Update Document',
344
- message: 'User: ' + _this.user + ', Collection Type: ' + collection,
345
- payload: 'Too Big',
346
- method: 'updateDocument',
347
- user: _this.user,
348
- messageId: '',
349
- route: ''
350
- });
351
- }
352
267
  }
353
268
  }
354
269
  else {
@@ -497,34 +412,6 @@ function loadCollectionMethods(methodManager) {
497
412
  console.log(err);
498
413
  });
499
414
  });
500
- if (common_1.getBinarySize(JSON.stringify(updateParams)) < 200000) {
501
- log_collection_1.Logs.create({
502
- _id: mongo_manager_1.objectIdHexString(),
503
- date: new Date(),
504
- type: 'info',
505
- title: 'Update Document Props',
506
- message: 'User: ' + _this.user + ', Collection Type: ' + collection + ', Id: ' + doc_id + ', ' + 'Version: ' + doc__v,
507
- payload: JSON.stringify(updateParams, null, 2),
508
- method: 'updateDocumentProps',
509
- user: _this.user,
510
- messageId: '',
511
- route: ''
512
- });
513
- }
514
- else {
515
- log_collection_1.Logs.create({
516
- _id: mongo_manager_1.objectIdHexString(),
517
- date: new Date(),
518
- type: 'info',
519
- title: 'Update Document Props',
520
- message: 'User: ' + _this.user + ', Collection Type: ' + collection + ', Id: ' + doc_id + ', ' + 'Version: ' + doc__v,
521
- payload: 'Too Big',
522
- method: 'updateDocumentProps',
523
- user: _this.user,
524
- messageId: '',
525
- route: ''
526
- });
527
- }
528
415
  }
529
416
  }
530
417
  else {
@@ -658,34 +545,6 @@ function loadCollectionMethods(methodManager) {
658
545
  console.log(err);
659
546
  });
660
547
  });
661
- if (common_1.getBinarySize(JSON.stringify(f_document)) < 200000) {
662
- log_collection_1.Logs.create({
663
- _id: mongo_manager_1.objectIdHexString(),
664
- date: new Date(),
665
- type: 'info',
666
- title: 'Update Document',
667
- message: 'User: ' + _this.user + ', Collection Type: ' + collection,
668
- payload: JSON.stringify(f_document, null, 2),
669
- method: 'updateDocumentOffline',
670
- user: _this.user,
671
- messageId: '',
672
- route: ''
673
- });
674
- }
675
- else {
676
- log_collection_1.Logs.create({
677
- _id: mongo_manager_1.objectIdHexString(),
678
- date: new Date(),
679
- type: 'info',
680
- title: 'Update Document',
681
- message: 'User: ' + _this.user + ', Collection Type: ' + collection,
682
- payload: 'Too Big',
683
- method: 'updateDocumentOffline',
684
- user: _this.user,
685
- messageId: '',
686
- route: ''
687
- });
688
- }
689
548
  }
690
549
  }
691
550
  else {
@@ -829,34 +688,6 @@ function loadCollectionMethods(methodManager) {
829
688
  console.log(err);
830
689
  });
831
690
  });
832
- if (common_1.getBinarySize(JSON.stringify(updateParams)) < 200000) {
833
- log_collection_1.Logs.create({
834
- _id: mongo_manager_1.objectIdHexString(),
835
- date: new Date(),
836
- type: 'info',
837
- title: 'Update Document Props',
838
- message: 'User: ' + _this.user + ', Collection Type: ' + collection + ', Id: ' + doc_id + ', ' + 'Version: ' + doc__v,
839
- payload: JSON.stringify(updateParams, null, 2),
840
- method: 'updateDocumentPropsOffline',
841
- user: _this.user,
842
- messageId: '',
843
- route: ''
844
- });
845
- }
846
- else {
847
- log_collection_1.Logs.create({
848
- _id: mongo_manager_1.objectIdHexString(),
849
- date: new Date(),
850
- type: 'info',
851
- title: 'Update Document Props',
852
- message: 'User: ' + _this.user + ', Collection Type: ' + collection + ', Id: ' + doc_id + ', ' + 'Version: ' + doc__v,
853
- payload: 'Too Big',
854
- method: 'updateDocumentPropsOffline',
855
- user: _this.user,
856
- messageId: '',
857
- route: ''
858
- });
859
- }
860
691
  }
861
692
  }
862
693
  else {
@@ -916,24 +747,11 @@ function loadCollectionMethods(methodManager) {
916
747
  }
917
748
  }),
918
749
  function: function (collection, doc_id) {
919
- var _this = this;
920
750
  return new Promise(function (resolve, reject) {
921
751
  if (!index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection)) {
922
752
  reject('Invalid collection');
923
753
  }
924
754
  else {
925
- log_collection_1.Logs.create({
926
- _id: mongo_manager_1.objectIdHexString(),
927
- date: new Date(),
928
- type: 'info',
929
- title: 'Remove Document',
930
- message: 'User: ' + _this.user + ', Collection Type: ' + collection,
931
- payload: JSON.stringify({ _id: doc_id }, null, 2),
932
- method: 'removeDocument',
933
- user: _this.user,
934
- messageId: '',
935
- route: ''
936
- });
937
755
  index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection).deleteOne({ _id: doc_id }).then(function (res) {
938
756
  resolve(res.result.ok);
939
757
  }, function (err) {
@@ -954,24 +772,11 @@ function loadCollectionMethods(methodManager) {
954
772
  }
955
773
  }),
956
774
  function: function (collection, query) {
957
- var _this = this;
958
775
  return new Promise(function (resolve, reject) {
959
776
  if (!index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection)) {
960
777
  reject('Invalid collection');
961
778
  }
962
779
  else {
963
- log_collection_1.Logs.create({
964
- _id: mongo_manager_1.objectIdHexString(),
965
- date: new Date(),
966
- type: 'info',
967
- title: 'Remove Document (Query)',
968
- message: 'User: ' + _this.user + ', Collection Type: ' + collection,
969
- payload: JSON.stringify({ _id: query }, null, 2),
970
- method: 'removeDocumentWithQuery',
971
- user: _this.user,
972
- messageId: '',
973
- route: ''
974
- });
975
780
  index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection).deleteOne(query).then(function (res) {
976
781
  resolve(res.result.ok);
977
782
  }, function (err) {
@@ -992,24 +797,11 @@ function loadCollectionMethods(methodManager) {
992
797
  }
993
798
  }),
994
799
  function: function (collection, query) {
995
- var _this = this;
996
800
  return new Promise(function (resolve, reject) {
997
801
  if (!index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection)) {
998
802
  reject('Invalid collection');
999
803
  }
1000
804
  else {
1001
- log_collection_1.Logs.create({
1002
- _id: mongo_manager_1.objectIdHexString(),
1003
- date: new Date(),
1004
- type: 'info',
1005
- title: 'Remove Documents (Query)',
1006
- message: 'User: ' + _this.user + ', Collection Type: ' + collection,
1007
- payload: JSON.stringify({ _id: query }, null, 2),
1008
- method: 'removeDocumentsWithQuery',
1009
- user: _this.user,
1010
- messageId: '',
1011
- route: ''
1012
- });
1013
805
  index_1.ResolveIOServer.getMainServer().getMongoServer().collection(collection).deleteMany(query).then(function (res) {
1014
806
  resolve(res.result.ok);
1015
807
  }, function (err) {