@resolveio/server-lib 1.0.0-rc8 → 1.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.
Files changed (39) hide show
  1. package/collections/active-subscription.collection.js +2 -2
  2. package/collections/app-status.collection.js +2 -2
  3. package/collections/app-version.collection.js +2 -2
  4. package/collections/counter.collection.js +8 -8
  5. package/collections/cron-job-history.collection.js +2 -2
  6. package/collections/cron-job.collection.js +2 -2
  7. package/collections/file.collection.js +8 -8
  8. package/collections/flag.collection.js +2 -2
  9. package/collections/log.collection.js +2 -2
  10. package/collections/logged-in-users.collection.js +2 -2
  11. package/collections/method-call.collection.js +1 -1
  12. package/collections/method-response.collection.js +1 -1
  13. package/collections/queue-flag.collection.js +2 -2
  14. package/collections/queue-method.collection.js +2 -2
  15. package/collections/queue-response.collection.js +2 -2
  16. package/collections/support-ticket.collection.js +5 -5
  17. package/collections/user.collection.js +2 -2
  18. package/http/auth.d.ts +1 -1
  19. package/http/auth.js +3 -3
  20. package/index.d.ts +6 -44
  21. package/index.js +61 -60
  22. package/managers/method.manager.d.ts +3 -2
  23. package/managers/method.manager.js +50 -19
  24. package/managers/subscription.manager.js +8 -8
  25. package/managers/support.manager.d.ts +1 -1
  26. package/managers/support.manager.js +1 -1
  27. package/methods/accounts.js +2 -2
  28. package/methods/aws.js +23 -1
  29. package/methods/collections.js +41 -41
  30. package/methods/counters.js +2 -299
  31. package/methods/logs.js +1 -1
  32. package/models/notification.model.d.ts +5 -0
  33. package/models/notification.model.js +2 -0
  34. package/package.json +2 -2
  35. package/publications/support-tickets.js +2 -2
  36. package/server-app.d.ts +3 -2
  37. package/server-app.js +46 -3
  38. package/support-methods/collections.js +25 -25
  39. package/support-methods/counters.js +3 -3
@@ -88,304 +88,7 @@ function loadCounterMethods(methodManager) {
88
88
  }
89
89
  }),
90
90
  function: function (collectionType, query) {
91
- return __1.default.getMainDB().model(collectionType).collection.countDocuments(query);
92
- }
93
- },
94
- countQuery: {
95
- skipQueue: true,
96
- check: new simpl_schema_1.default({
97
- collectionType: {
98
- type: String
99
- },
100
- search: {
101
- type: String,
102
- optional: true
103
- },
104
- filters: simpl_schema_1.default.oneOf({
105
- type: Array,
106
- optional: true
107
- }, {
108
- type: Object,
109
- blackbox: true,
110
- optional: true
111
- }),
112
- 'filters.$': {
113
- type: Object,
114
- optional: true,
115
- blackbox: true
116
- },
117
- subType: {
118
- type: String,
119
- optional: true
120
- }
121
- }),
122
- function: function (collectionType, search, filters) {
123
- if (search === void 0) { search = ''; }
124
- if (filters === void 0) { filters = []; }
125
- var query = {};
126
- if (!search && (!filters || !filters.length)) {
127
- query = {};
128
- }
129
- else {
130
- if (filters && filters.length) {
131
- query['$and'] = [];
132
- filters.forEach(function (filter) {
133
- var _a;
134
- if (filters.filter(function (a) { return a.prop === 'job'; }).length) {
135
- if (filters.filter(function (a) { return a.prop === 'job'; })[0].data) {
136
- query['$and'].push({
137
- $or: [
138
- { type: 'request' },
139
- { type: 'initIso' },
140
- { type: 'return' },
141
- { type: 'returnIso' },
142
- { type: 'transferOut' },
143
- { type: 'transferIn' }
144
- ]
145
- });
146
- }
147
- else {
148
- query['$and'].push({
149
- $or: [
150
- { type: 'Customer Pickup' },
151
- { type: 'Direct Sale' },
152
- { type: 'Third Party' },
153
- { type: 'Sale Return' },
154
- { type: 'transferYard' }
155
- ]
156
- });
157
- }
158
- filters.splice(filters.map(function (a) { return a.prop; }).indexOf('job'), 1);
159
- }
160
- else {
161
- query['$and'].push((_a = {}, _a[filter['prop']] = filter['data'], _a));
162
- }
163
- });
164
- }
165
- if (search && collectionType === 'jobs') {
166
- var searchRegEx = { '$regex': '.*' + (search || '') + '.*', '$options': 'i' };
167
- if (query['$and']) {
168
- query['$and'].push({
169
- $or: [
170
- {
171
- status: searchRegEx
172
- },
173
- {
174
- operator: searchRegEx
175
- },
176
- {
177
- pumping_company: searchRegEx
178
- },
179
- {
180
- afe: searchRegEx
181
- },
182
- {
183
- po: searchRegEx
184
- },
185
- {
186
- county: searchRegEx
187
- },
188
- {
189
- state: searchRegEx
190
- },
191
- {
192
- well: searchRegEx
193
- }
194
- ]
195
- });
196
- }
197
- else {
198
- query = {
199
- $or: [
200
- {
201
- status: searchRegEx
202
- },
203
- {
204
- operator: searchRegEx
205
- },
206
- {
207
- pumping_company: searchRegEx
208
- },
209
- {
210
- afe: searchRegEx
211
- },
212
- {
213
- po: searchRegEx
214
- },
215
- {
216
- county: searchRegEx
217
- },
218
- {
219
- state: searchRegEx
220
- },
221
- {
222
- well: searchRegEx
223
- }
224
- ]
225
- };
226
- }
227
- }
228
- else if (search && collectionType === 'chemicals') {
229
- var searchRegEx = { '$regex': '.*' + (search || '') + '.*', '$options': 'i' };
230
- if (query['$and']) {
231
- query['$and'].push({
232
- $or: [
233
- {
234
- chemical_category: searchRegEx
235
- },
236
- {
237
- container: searchRegEx
238
- },
239
- {
240
- type: searchRegEx
241
- },
242
- {
243
- description: searchRegEx
244
- },
245
- {
246
- quantity_string: searchRegEx
247
- },
248
- {
249
- unit: searchRegEx
250
- },
251
- {
252
- min_stock_string: searchRegEx
253
- },
254
- {
255
- max_stock_string: searchRegEx
256
- }
257
- ]
258
- });
259
- }
260
- else {
261
- query = {
262
- $or: [
263
- {
264
- chemical_category: searchRegEx
265
- },
266
- {
267
- container: searchRegEx
268
- },
269
- {
270
- type: searchRegEx
271
- },
272
- {
273
- description: searchRegEx
274
- },
275
- {
276
- quantity_string: searchRegEx
277
- },
278
- {
279
- unit: searchRegEx
280
- },
281
- {
282
- min_stock_string: searchRegEx
283
- },
284
- {
285
- max_stock_string: searchRegEx
286
- }
287
- ]
288
- };
289
- }
290
- }
291
- else if (search && collectionType === 'bols') {
292
- var searchRegEx = { '$regex': '.*' + (search || '') + '.*', '$options': 'i' };
293
- if (query['$and']) {
294
- query['$and'].push({
295
- $or: [
296
- {
297
- date_string: searchRegEx
298
- },
299
- {
300
- bol_string: searchRegEx
301
- },
302
- {
303
- chemical: searchRegEx
304
- },
305
- {
306
- locTo: searchRegEx
307
- },
308
- {
309
- locFrom: searchRegEx
310
- },
311
- {
312
- quantity_string: searchRegEx
313
- },
314
- {
315
- file_status: searchRegEx
316
- }
317
- ]
318
- });
319
- }
320
- else {
321
- query = {
322
- $or: [
323
- {
324
- date_string: searchRegEx
325
- },
326
- {
327
- bol_string: searchRegEx
328
- },
329
- {
330
- chemical: searchRegEx
331
- },
332
- {
333
- locTo: searchRegEx
334
- },
335
- {
336
- locFrom: searchRegEx
337
- },
338
- {
339
- quantity_string: searchRegEx
340
- },
341
- {
342
- file_status: searchRegEx
343
- }
344
- ]
345
- };
346
- }
347
- }
348
- else if (search && collectionType === 'isotanks') {
349
- var searchRegEx = { '$regex': '.*' + (search || '') + '.*', '$options': 'i' };
350
- if (query['$and']) {
351
- query['$and'].push({
352
- $or: [
353
- {
354
- tank_number: searchRegEx
355
- },
356
- {
357
- quantity_string: searchRegEx
358
- },
359
- {
360
- current_location: searchRegEx
361
- },
362
- {
363
- current_chemical: searchRegEx
364
- }
365
- ]
366
- });
367
- }
368
- else {
369
- query = {
370
- $or: [
371
- {
372
- tank_number: searchRegEx
373
- },
374
- {
375
- quantity_string: searchRegEx
376
- },
377
- {
378
- current_location: searchRegEx
379
- },
380
- {
381
- current_chemical: searchRegEx
382
- }
383
- ]
384
- };
385
- }
386
- }
387
- }
388
- return __1.default.getMainDB().model(collectionType).collection.countDocuments(query);
91
+ return __1.ResolveIOServer.getMainDB().model(collectionType).collection.countDocuments(query);
389
92
  }
390
93
  },
391
94
  countCollection: {
@@ -396,7 +99,7 @@ function loadCounterMethods(methodManager) {
396
99
  }
397
100
  }),
398
101
  function: function (collectionType) {
399
- return __1.default.getMainDB().model(collectionType).collection.countDocuments();
102
+ return __1.ResolveIOServer.getMainDB().model(collectionType).collection.countDocuments();
400
103
  }
401
104
  }
402
105
  });
package/methods/logs.js CHANGED
@@ -8,7 +8,7 @@ function loadLogMethods(methodManager) {
8
8
  insertErrorLog: {
9
9
  skipQueue: true,
10
10
  function: function (message, data) {
11
- this.sendEmail('dev@resolveio.com', 'Error Detected - ' + index_1.default.getClientName(), this.user + '\n' + message + '\n' + JSON.stringify(data, null, 2));
11
+ this.sendEmail('dev@resolveio.com', 'Error Detected - ' + index_1.ResolveIOServer.getClientName(), this.user + '\n' + message + '\n' + JSON.stringify(data, null, 2));
12
12
  return log_collection_1.Logs.create({
13
13
  _id: mongoose_1.Types.ObjectId().toHexString(),
14
14
  __v: 0,
@@ -0,0 +1,5 @@
1
+ import { CollectionDocument } from './collection-document.model';
2
+ export interface NotificationModel extends CollectionDocument {
3
+ name: string;
4
+ }
5
+ //# sourceMappingURL=notification.model.d.ts.map
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@resolveio/server-lib",
3
- "version": "1.0.0-rc8",
3
+ "version": "1.0.0",
4
4
  "description": "",
5
5
  "main": "index.ts",
6
6
  "scripts": {
7
- "package": "npm pack ./dist",
7
+ "package": "npm run build-prod && npm pack ./dist",
8
8
  "start": "node_modules/.bin/forever -c node --max-old-space-size=800 index.js",
9
9
  "server": "node_modules/gulp/bin/gulp.js mongo-start && node_modules/gulp/bin/gulp.js",
10
10
  "postserver": "node_modules/gulp/bin/gulp.js mongo-stop",
@@ -9,11 +9,11 @@ function loadSupportTicketPublications(subscriptionManager) {
9
9
  subscriptionManager.publications({
10
10
  supporttickets: {
11
11
  function: function () {
12
- return support_ticket_collection_1.SupportTickets.find({ client: index_1.default.getClientName() }).sort({ type: 1 }).exec();
12
+ return support_ticket_collection_1.SupportTickets.find({ client: index_1.ResolveIOServer.getClientName() }).sort({ type: 1 }).exec();
13
13
  },
14
14
  collections: ['support-tickets'],
15
15
  fetchFunction: function (document) {
16
- return document['client'] === index_1.default.getClientName() ? true : false;
16
+ return document['client'] === index_1.ResolveIOServer.getClientName() ? true : false;
17
17
  }
18
18
  },
19
19
  supportticketWithId: {
package/server-app.d.ts CHANGED
@@ -4,19 +4,20 @@ import { MethodManager } from './managers/method.manager';
4
4
  import { SubscriptionManager } from './managers/subscription.manager';
5
5
  import { SupportManager } from './managers/support.manager';
6
6
  import { QueueMethodManager } from './managers/queue-method.manager';
7
- export declare class ResolveIOMainServer {
7
+ export default class ResolveIOMainServer {
8
8
  private _app;
9
9
  private _server;
10
10
  private _port;
11
11
  private _wss;
12
12
  private _serverConfig;
13
+ private _clientDir;
13
14
  private _resolveioServer;
14
15
  private _subscriptionManager;
15
16
  private _methodManager;
16
17
  private _queueManager;
17
18
  private _cronManager;
18
19
  private _supportManager;
19
- constructor(mainServer: any, serverConfig: any);
20
+ constructor(mainServer: any, serverConfig: any, clientDir: any);
20
21
  getWS(id_ws: string): any;
21
22
  getWSList(): any[];
22
23
  getCronManager(): CronManager;
package/server-app.js CHANGED
@@ -59,9 +59,10 @@ var subscription_manager_1 = require("./managers/subscription.manager");
59
59
  var support_manager_1 = require("./managers/support.manager");
60
60
  var queue_method_manager_1 = require("./managers/queue-method.manager");
61
61
  var ResolveIOMainServer = /** @class */ (function () {
62
- function ResolveIOMainServer(mainServer, serverConfig) {
62
+ function ResolveIOMainServer(mainServer, serverConfig, clientDir) {
63
63
  this._resolveioServer = mainServer;
64
64
  this._serverConfig = serverConfig;
65
+ this._clientDir = clientDir;
65
66
  // process.on('unhandledException').
66
67
  // Start express app
67
68
  this._app = express();
@@ -204,7 +205,7 @@ var ResolveIOMainServer = /** @class */ (function () {
204
205
  };
205
206
  // Start Managers
206
207
  this._subscriptionManager = new subscription_manager_1.SubscriptionManager(this, this._wss, this._serverConfig);
207
- this._methodManager = new method_manager_1.MethodManager(this, this._serverConfig);
208
+ this._methodManager = new method_manager_1.MethodManager(this, this._serverConfig, this._clientDir);
208
209
  this._supportManager = new support_manager_1.SupportManager(this, this._serverConfig);
209
210
  this._cronManager = new cron_manager_1.CronManager(this);
210
211
  this._queueManager = new queue_method_manager_1.QueueMethodManager(this);
@@ -595,4 +596,46 @@ var ResolveIOMainServer = /** @class */ (function () {
595
596
  };
596
597
  return ResolveIOMainServer;
597
598
  }());
598
- exports.ResolveIOMainServer = ResolveIOMainServer;
599
+ exports.default = ResolveIOMainServer;
600
+ // export * from './collections/active-subscription.collection';
601
+ // export * from './collections/app-status.collection';
602
+ // export * from './collections/app-version.collection';
603
+ // export * from './collections/counter.collection';
604
+ // export * from './collections/cron-job-history.collection';
605
+ // export * from './collections/cron-job.collection';
606
+ // export * from './collections/file.collection';
607
+ // export * from './collections/flag.collection';
608
+ // export * from './collections/log.collection';
609
+ // export * from './collections/logged-in-users.collection';
610
+ // export * from './collections/method-call.collection';
611
+ // export * from './collections/method-response.collection';
612
+ // export * from './collections/queue-flag.collection';
613
+ // export * from './collections/queue-method.collection';
614
+ // export * from './collections/queue-response.collection';
615
+ // export * from './collections/support-ticket.collection';
616
+ // export * from './collections/user.collection';
617
+ // export * from './managers/cron.manager';
618
+ // export * from './managers/method.manager';
619
+ // export * from './managers/queue-method.manager';
620
+ // export * from './managers/subscription.manager';
621
+ // export * from './managers/support.manager';
622
+ // export * from './models/active-subscription.model';
623
+ // export * from './models/app-status.model';
624
+ // export * from './models/app-version.model';
625
+ // export * from './models/collection-document.model';
626
+ // export * from './models/counter.model';
627
+ // // export * from './models/cron-job-history.model';
628
+ // export * from './models/cron-job.model';
629
+ // export * from './models/dialog.model';
630
+ // export * from './models/file.model';
631
+ // export * from './models/flag.model';
632
+ // export * from './models/log.model';
633
+ // export * from './models/method.model';
634
+ // export * from './models/pagination.model';
635
+ // export * from './models/permission.model';
636
+ // export * from './models/select-data-label.model';
637
+ // export * from './models/server-response.model';
638
+ // export * from './models/support-method.model';
639
+ // export * from './models/support-ticket.model';
640
+ // export * from './models/user.model';
641
+ // export * from './util/common';
@@ -19,7 +19,7 @@ function loadSupportCollectionMethods(supportManager) {
19
19
  }
20
20
  }),
21
21
  function: function (collection, query) {
22
- return __1.default.getSupportDB().model(collection).findOne(query).exec();
22
+ return __1.ResolveIOServer.getSupportDB().model(collection).findOne(query).exec();
23
23
  }
24
24
  },
25
25
  find: {
@@ -39,7 +39,7 @@ function loadSupportCollectionMethods(supportManager) {
39
39
  }),
40
40
  function: function (collection, query, sortQuery) {
41
41
  if (sortQuery === void 0) { sortQuery = {}; }
42
- return __1.default.getSupportDB().model(collection).find(query).sort(sortQuery).exec();
42
+ return __1.ResolveIOServer.getSupportDB().model(collection).find(query).sort(sortQuery).exec();
43
43
  }
44
44
  },
45
45
  findWithOptions: {
@@ -56,7 +56,7 @@ function loadSupportCollectionMethods(supportManager) {
56
56
  }
57
57
  }),
58
58
  function: function (collection, query, options) {
59
- return __1.default.getSupportDB().model(collection).find(query).sort(options.sort).limit(options.limit).skip(options.skip).select(options.fields).exec();
59
+ return __1.ResolveIOServer.getSupportDB().model(collection).find(query).sort(options.sort).limit(options.limit).skip(options.skip).select(options.fields).exec();
60
60
  }
61
61
  },
62
62
  // Insert 1 document
@@ -77,7 +77,7 @@ function loadSupportCollectionMethods(supportManager) {
77
77
  return new Promise(function (resolve, reject) {
78
78
  var schemaErrors = null;
79
79
  try {
80
- __1.default.getSupportDB().model(collection)['simplschema'].validate(document);
80
+ __1.ResolveIOServer.getSupportDB().model(collection)['simplschema'].validate(document);
81
81
  }
82
82
  catch (errors) {
83
83
  schemaErrors = errors;
@@ -117,7 +117,7 @@ function loadSupportCollectionMethods(supportManager) {
117
117
  var id_1 = mongoose_1.Types.ObjectId().toHexString();
118
118
  document._id = id_1;
119
119
  document.__v = 0;
120
- __1.default.getSupportDB().model(collection).create(document).then(function () { return resolve(id_1); }, function (err) { return reject(err); });
120
+ __1.ResolveIOServer.getSupportDB().model(collection).create(document).then(function () { return resolve(id_1); }, function (err) { return reject(err); });
121
121
  }
122
122
  });
123
123
  }
@@ -139,7 +139,7 @@ function loadSupportCollectionMethods(supportManager) {
139
139
  function: function (collection, f_document) {
140
140
  var _this = this;
141
141
  return new Promise(function (resolve, reject) {
142
- __1.default.getSupportDB().model(collection).findOne({ _id: f_document._id }).lean().exec(function (errDoc, currDoc) {
142
+ __1.ResolveIOServer.getSupportDB().model(collection).findOne({ _id: f_document._id }).lean().exec(function (errDoc, currDoc) {
143
143
  if (currDoc) {
144
144
  if (currDoc.__v === f_document.__v) {
145
145
  var versionDoc = common_1.deepCopy(currDoc);
@@ -149,7 +149,7 @@ function loadSupportCollectionMethods(supportManager) {
149
149
  };
150
150
  var schemaErrors = null;
151
151
  try {
152
- __1.default.getSupportDB().model(collection)['simplschema'].validate(f_document);
152
+ __1.ResolveIOServer.getSupportDB().model(collection)['simplschema'].validate(f_document);
153
153
  }
154
154
  catch (errors) {
155
155
  schemaErrors = errors;
@@ -160,8 +160,8 @@ function loadSupportCollectionMethods(supportManager) {
160
160
  reject('Schema Errors');
161
161
  }
162
162
  else {
163
- __1.default.getSupportDB().model(__1.default.getSupportDB().model(collection)['versionCollection']).create(versionDoc).then(function (doc) {
164
- __1.default.getSupportDB().model(__1.default.getSupportDB().model(collection)['versionCollection']).deleteMany({
163
+ __1.ResolveIOServer.getSupportDB().model(__1.ResolveIOServer.getSupportDB().model(collection)['versionCollection']).create(versionDoc).then(function (doc) {
164
+ __1.ResolveIOServer.getSupportDB().model(__1.ResolveIOServer.getSupportDB().model(collection)['versionCollection']).deleteMany({
165
165
  $and: [
166
166
  { '_id._id': currDoc._id },
167
167
  { '_id.__v': { $lte: currDoc.__v - 4 } }
@@ -172,7 +172,7 @@ function loadSupportCollectionMethods(supportManager) {
172
172
  });
173
173
  var updates = common_1.getMongoUpdates(currDoc, f_document, true);
174
174
  if (updates) {
175
- __1.default.getSupportDB().model(collection).updateOne({ _id: f_document._id }, updates, { strict: false }).exec().then(function (res) {
175
+ __1.ResolveIOServer.getSupportDB().model(collection).updateOne({ _id: f_document._id }, updates, { strict: false }).exec().then(function (res) {
176
176
  resolve(res.nModified);
177
177
  }, function (err) { return reject(err); });
178
178
  }
@@ -209,7 +209,7 @@ function loadSupportCollectionMethods(supportManager) {
209
209
  }
210
210
  else {
211
211
  console.log('invalid version - ' + collection, currDoc.__v, f_document.__v);
212
- __1.default.getSupportDB().model(__1.default.getSupportDB().model(collection)['versionCollection']).findOne({
212
+ __1.ResolveIOServer.getSupportDB().model(__1.ResolveIOServer.getSupportDB().model(collection)['versionCollection']).findOne({
213
213
  $and: [
214
214
  { '_id._id': currDoc._id },
215
215
  { '_id.__v': f_document.__v }
@@ -225,9 +225,9 @@ function loadSupportCollectionMethods(supportManager) {
225
225
  var updatedDoc = common_1.getMongoMergeUpdatedDoc(f_document, currDoc, oldDoc);
226
226
  updatedDoc._id = newCurrDocId;
227
227
  updatedDoc.__v++;
228
- __1.default.getSupportDB().model(collection).replaceOne({ _id: newCurrDocId }, updatedDoc).exec().then(function (res) {
229
- __1.default.getSupportDB().model(__1.default.getSupportDB().model(collection)['versionCollection']).create(versionDoc_1).then(function (doc) {
230
- __1.default.getSupportDB().model(__1.default.getSupportDB().model(collection)['versionCollection']).deleteMany({
228
+ __1.ResolveIOServer.getSupportDB().model(collection).replaceOne({ _id: newCurrDocId }, updatedDoc).exec().then(function (res) {
229
+ __1.ResolveIOServer.getSupportDB().model(__1.ResolveIOServer.getSupportDB().model(collection)['versionCollection']).create(versionDoc_1).then(function (doc) {
230
+ __1.ResolveIOServer.getSupportDB().model(__1.ResolveIOServer.getSupportDB().model(collection)['versionCollection']).deleteMany({
231
231
  $and: [
232
232
  { '_id._id': versionDoc_1._id._id },
233
233
  { '_id.__v': { $lte: versionDoc_1._id.__v - 4 } }
@@ -276,7 +276,7 @@ function loadSupportCollectionMethods(supportManager) {
276
276
  function: function (collection, doc_id, updateParams, doc__v) {
277
277
  var _this = this;
278
278
  return new Promise(function (resolve, reject) {
279
- __1.default.getSupportDB().model(collection).findOne({ _id: doc_id }).lean().exec(function (errDoc, currDoc) {
279
+ __1.ResolveIOServer.getSupportDB().model(collection).findOne({ _id: doc_id }).lean().exec(function (errDoc, currDoc) {
280
280
  if (currDoc) {
281
281
  var modifiedDoc_1 = common_1.deepCopy(currDoc);
282
282
  updateParams.forEach(function (data) {
@@ -290,7 +290,7 @@ function loadSupportCollectionMethods(supportManager) {
290
290
  };
291
291
  var schemaErrors = null;
292
292
  try {
293
- __1.default.getSupportDB().model(collection)['simplschema'].validate(modifiedDoc_1);
293
+ __1.ResolveIOServer.getSupportDB().model(collection)['simplschema'].validate(modifiedDoc_1);
294
294
  }
295
295
  catch (errors) {
296
296
  schemaErrors = errors;
@@ -301,8 +301,8 @@ function loadSupportCollectionMethods(supportManager) {
301
301
  reject('Schema Errors');
302
302
  }
303
303
  else {
304
- __1.default.getSupportDB().model(__1.default.getSupportDB().model(collection)['versionCollection']).create(versionDoc).then(function (doc) {
305
- __1.default.getSupportDB().model(__1.default.getSupportDB().model(collection)['versionCollection']).deleteMany({
304
+ __1.ResolveIOServer.getSupportDB().model(__1.ResolveIOServer.getSupportDB().model(collection)['versionCollection']).create(versionDoc).then(function (doc) {
305
+ __1.ResolveIOServer.getSupportDB().model(__1.ResolveIOServer.getSupportDB().model(collection)['versionCollection']).deleteMany({
306
306
  $and: [
307
307
  { '_id._id': currDoc._id },
308
308
  { '_id.__v': { $lte: currDoc.__v - 4 } }
@@ -313,7 +313,7 @@ function loadSupportCollectionMethods(supportManager) {
313
313
  });
314
314
  var updates = common_1.getMongoUpdates(currDoc, modifiedDoc_1, true);
315
315
  if (updates) {
316
- __1.default.getSupportDB().model(collection).updateOne({ _id: modifiedDoc_1._id }, updates, { strict: false }).exec().then(function (res) {
316
+ __1.ResolveIOServer.getSupportDB().model(collection).updateOne({ _id: modifiedDoc_1._id }, updates, { strict: false }).exec().then(function (res) {
317
317
  resolve(res.ok);
318
318
  }, function (err) { return reject(err); });
319
319
  }
@@ -350,7 +350,7 @@ function loadSupportCollectionMethods(supportManager) {
350
350
  }
351
351
  else {
352
352
  console.log('invalid version - ' + collection, currDoc.__v, doc__v);
353
- __1.default.getSupportDB().model(__1.default.getSupportDB().model(collection)['versionCollection']).findOne({
353
+ __1.ResolveIOServer.getSupportDB().model(__1.ResolveIOServer.getSupportDB().model(collection)['versionCollection']).findOne({
354
354
  $and: [
355
355
  { '_id._id': currDoc._id },
356
356
  { '_id.__v': doc__v }
@@ -366,9 +366,9 @@ function loadSupportCollectionMethods(supportManager) {
366
366
  var updatedDoc = common_1.getMongoMergeUpdatedDoc(modifiedDoc_1, currDoc, oldDoc);
367
367
  updatedDoc._id = newCurrDocId;
368
368
  updatedDoc.__v++;
369
- __1.default.getSupportDB().model(collection).replaceOne({ _id: newCurrDocId }, updatedDoc).exec().then(function (res) {
370
- __1.default.getSupportDB().model(__1.default.getSupportDB().model(collection)['versionCollection']).create(versionDoc_2).then(function (doc) {
371
- __1.default.getSupportDB().model(__1.default.getSupportDB().model(collection)['versionCollection']).deleteMany({
369
+ __1.ResolveIOServer.getSupportDB().model(collection).replaceOne({ _id: newCurrDocId }, updatedDoc).exec().then(function (res) {
370
+ __1.ResolveIOServer.getSupportDB().model(__1.ResolveIOServer.getSupportDB().model(collection)['versionCollection']).create(versionDoc_2).then(function (doc) {
371
+ __1.ResolveIOServer.getSupportDB().model(__1.ResolveIOServer.getSupportDB().model(collection)['versionCollection']).deleteMany({
372
372
  $and: [
373
373
  { '_id._id': versionDoc_2._id._id },
374
374
  { '_id.__v': { $lte: versionDoc_2._id.__v - 4 } }
@@ -420,7 +420,7 @@ function loadSupportCollectionMethods(supportManager) {
420
420
  user: _this.user,
421
421
  messageId: ''
422
422
  });
423
- __1.default.getSupportDB().model(collection).deleteOne({ _id: doc_id }).exec(function (err, res) {
423
+ __1.ResolveIOServer.getSupportDB().model(collection).deleteOne({ _id: doc_id }).exec(function (err, res) {
424
424
  if (err) {
425
425
  reject(err);
426
426
  }
@@ -455,7 +455,7 @@ function loadSupportCollectionMethods(supportManager) {
455
455
  user: _this.user,
456
456
  messageId: ''
457
457
  });
458
- __1.default.getSupportDB().model(collection).deleteOne(query).exec(function (err, res) {
458
+ __1.ResolveIOServer.getSupportDB().model(collection).deleteOne(query).exec(function (err, res) {
459
459
  if (err) {
460
460
  reject(err);
461
461
  }