@resolveio/server-lib 11.0.0 → 11.0.1

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.
@@ -37,17 +37,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  var serverConfig = require('./settings.json');
40
- var monitorAgent = null;
41
- // if (serverConfig['ROOT_URL'] !== 'http://localhost:4200') {
42
- // let appmetrics = require('appmetrics');
43
- // appmetrics.configure({
44
- // mqtt: 'off',
45
- // // profiling: 'on'
46
- // });
47
- // monitorAgent = appmetrics.monitor();
48
- // }
49
40
  var index_1 = require("./index");
50
- new index_1.ResolveIOServer(monitorAgent, serverConfig, [], 'ResolveIO Server Library', __dirname);
41
+ new index_1.ResolveIOServer(serverConfig, [], 'ResolveIO Server Library', __dirname);
51
42
  index_1.ResolveIOServer.connectAndRun().then(function () { return __awaiter(void 0, void 0, void 0, function () {
52
43
  return __generator(this, function (_a) {
53
44
  return [2 /*return*/];
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/client-server-app.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAI,YAAY,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAC9C,IAAI,YAAY,GAAG,IAAI,CAAC;AACxB,8DAA8D;AAC9D,2CAA2C;AAC3C,0BAA0B;AAC1B,iBAAiB;AACjB,uBAAuB;AACvB,OAAO;AACP,wCAAwC;AACxC,IAAI;AAEJ,iCAA0C;AAE1C,IAAI,uBAAe,CAAC,YAAY,EAAE,YAAY,EAAE,EAAE,EAAE,0BAA0B,EAAE,SAAS,CAAC,CAAC;AAC3F,uBAAe,CAAC,aAAa,EAAE,CAAC,IAAI,CAAC;;;;KAEpC,CAAC,CAAC","file":"client-server-app.js","sourcesContent":["let serverConfig = require('./settings.json');\nlet monitorAgent = null;\n// if (serverConfig['ROOT_URL'] !== 'http://localhost:4200') {\n// \tlet appmetrics = require('appmetrics');\n// \tappmetrics.configure({\n// \t\tmqtt: 'off',\n// \t\t// profiling: 'on'\n// \t});\n// \tmonitorAgent = appmetrics.monitor();\n// }\n\nimport { ResolveIOServer } from './index';\n\nnew ResolveIOServer(monitorAgent, serverConfig, [], 'ResolveIO Server Library', __dirname);\nResolveIOServer.connectAndRun().then(async () => {\n\t\n});"]}
1
+ {"version":3,"sources":["../../src/client-server-app.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAI,YAAY,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAC9C,iCAA0C;AAE1C,IAAI,uBAAe,CAAC,YAAY,EAAE,EAAE,EAAE,0BAA0B,EAAE,SAAS,CAAC,CAAC;AAC7E,uBAAe,CAAC,aAAa,EAAE,CAAC,IAAI,CAAC;;;;KAEpC,CAAC,CAAC","file":"client-server-app.js","sourcesContent":["let serverConfig = require('./settings.json');\nimport { ResolveIOServer } from './index';\n\nnew ResolveIOServer(serverConfig, [], 'ResolveIO Server Library', __dirname);\nResolveIOServer.connectAndRun().then(async () => {\n\t\n});"]}
package/index.d.ts CHANGED
@@ -2,7 +2,6 @@ import { Db, MongoClient } from 'mongodb';
2
2
  import { MongoManager } from './managers/mongo.manager';
3
3
  import ResolveIOMainServer from './server-app';
4
4
  export declare class ResolveIOServer {
5
- private static _monitorAgent;
6
5
  private static _serverConfig;
7
6
  private static _clientRoutes;
8
7
  private static _mongoConnection;
@@ -13,7 +12,7 @@ export declare class ResolveIOServer {
13
12
  private static _clientDir;
14
13
  private static _sesMail;
15
14
  private static _standardProgram;
16
- constructor(monitoring: any, serverConfig: any, clientRoutes: string[], client: string, clientDir: any, sesMail?: boolean, standardProgram?: boolean);
15
+ constructor(serverConfig: any, clientRoutes: string[], client: string, clientDir: any, sesMail?: boolean, standardProgram?: boolean);
17
16
  static connectAndRun(): Promise<unknown>;
18
17
  static getClientName(): string;
19
18
  static getMainServer(): ResolveIOMainServer;
package/index.js CHANGED
@@ -50,10 +50,9 @@ exports.ResolveIOServer = void 0;
50
50
  var mongodb_1 = require("mongodb");
51
51
  var mongo_manager_1 = require("./managers/mongo.manager");
52
52
  var ResolveIOServer = /** @class */ (function () {
53
- function ResolveIOServer(monitoring, serverConfig, clientRoutes, client, clientDir, sesMail, standardProgram) {
53
+ function ResolveIOServer(serverConfig, clientRoutes, client, clientDir, sesMail, standardProgram) {
54
54
  if (sesMail === void 0) { sesMail = true; }
55
55
  if (standardProgram === void 0) { standardProgram = false; }
56
- ResolveIOServer._monitorAgent = monitoring;
57
56
  ResolveIOServer._serverConfig = serverConfig;
58
57
  ResolveIOServer._clientRoutes = clientRoutes;
59
58
  ResolveIOServer._client = client;
@@ -75,7 +74,7 @@ var ResolveIOServer = /** @class */ (function () {
75
74
  case 0: return [4 /*yield*/, Promise.resolve().then(function () { return require('./server-app'); })];
76
75
  case 1:
77
76
  serverApp = (_a.sent()).default;
78
- ResolveIOServer._mainServer = new serverApp(this, ResolveIOServer._monitorAgent, ResolveIOServer._serverConfig, ResolveIOServer._clientRoutes, this._clientDir, this._sesMail, this._standardProgram);
77
+ ResolveIOServer._mainServer = new serverApp(this, ResolveIOServer._serverConfig, ResolveIOServer._clientRoutes, this._clientDir, this._sesMail, this._standardProgram);
79
78
  resolve(true);
80
79
  return [2 /*return*/];
81
80
  }
@@ -103,7 +102,6 @@ var ResolveIOServer = /** @class */ (function () {
103
102
  ResolveIOServer.getMongoManager = function () {
104
103
  return ResolveIOServer._mongoManager;
105
104
  };
106
- ResolveIOServer._monitorAgent = null;
107
105
  ResolveIOServer._serverConfig = null;
108
106
  ResolveIOServer._clientRoutes = [];
109
107
  ResolveIOServer._mongoConnection = null;
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAA0C;A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C,CAAC;;;;qBACd,EAAE,CAAC,CAAC,CAAC;YACP,CAAC,EAAE,UAAA,GAAG;gBACL,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,EAAE,6BAA6B,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;gBACvF,MAAM,EAAE,CAAC;gBACT,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACjB,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC;IAEa,6BAAa,GAA3B;QACC,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;IAEa,6BAAa,GAA3B;QACC,OAAO,eAAe,CAAC,WAAW,CAAC;IACpC,CAAC;IAEa,kCAAkB,GAAhC;QACC,OAAO,eAAe,CAAC,gBAAgB,CAAC;IACzC,CAAC;IAEa,yBAAS,GAAvB;QACC,OAAO,eAAe,CAAC,OAAO,CAAC;IAChC,CAAC;IAEa,+BAAe,GAA7B;QACC,OAAO,eAAe,CAAC,aAAa,CAAC;IACtC,CAAC;IA7Dc,6BAAa,GAAG,IAAI,CAAC;IACrB,6BAAa,GAAG,IAAI,CAAC;IACrB,6BAAa,GAAG,EAAE,CAAC;IACnB,gCAAgB,GAAgB,IAAI,CAAC;IACrC,uBAAO,GAAO,IAAI,CAAC;IACnB,2BAAW,GAAwB,IAAI,CAAC;IACxC,6BAAa,GAAiB,IAAI,CAAC;IACnC,uBAAO,GAAG,EAAE,CAAC;IACb,0BAAU,GAAG,EAAE,CAAC;IAChB,wBAAQ,GAAG,IAAI,CAAC;IAChB,gCAAgB,GAAG,KAAK,CAAC;IAoDzC,sBAAC;CA/DD,AA+DC,IAAA;AA/DY,0CAAe;AAiE5B,+CAA6B","file":"index.js","sourcesContent":["import { Db, MongoClient } from 'mongodb';\nimport { MongoManager } from './managers/mongo.manager';\nimport ResolveIOMainServer from './server-app';\n\nexport class ResolveIOServer {\n\tprivate static _monitorAgent = null;\n\tprivate static _serverConfig = null;\n\tprivate static _clientRoutes = [];\n\tprivate static _mongoConnection: MongoClient = null;\n\tprivate static _mainDB: Db = null;\n\tprivate static _mainServer: ResolveIOMainServer = null;\n\tprivate static _mongoManager: MongoManager = null;\n\tprivate static _client = '';\n\tprivate static _clientDir = '';\n\tprivate static _sesMail = true;\n\tprivate static _standardProgram = false;\n\n\tconstructor(monitoring, serverConfig, clientRoutes: string[], client: string, clientDir, sesMail = true, standardProgram = false) {\n\t\tResolveIOServer._monitorAgent = monitoring;\n\t\tResolveIOServer._serverConfig = serverConfig;\n\t\tResolveIOServer._clientRoutes = clientRoutes;\n\t\tResolveIOServer._client = client;\n\t\tResolveIOServer._clientDir = clientDir;\n\t\tResolveIOServer._sesMail = sesMail;\n\t\tResolveIOServer._standardProgram = standardProgram;\n\t}\n\n\tpublic static connectAndRun() {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tMongoClient.connect(ResolveIOServer._serverConfig['MONGO_URL']).then(dbConnection => {\n\t\t\t\tResolveIOServer._mongoConnection = dbConnection;\n\t\t\t\tResolveIOServer._mainDB = dbConnection.db(ResolveIOServer._serverConfig['DATABASE']);\n\t\t\t\tResolveIOServer._mongoManager = new MongoManager();\n\t\t\t\t\n\t\t\t\tsetTimeout(async () => {\n\t\t\t\t\tlet serverApp = (await import('./server-app')).default;\n\t\t\t\t\tResolveIOServer._mainServer = new serverApp(this, ResolveIOServer._monitorAgent, ResolveIOServer._serverConfig, ResolveIOServer._clientRoutes, this._clientDir, this._sesMail, this._standardProgram);\n\n\t\t\t\t\tresolve(true);\n\t\t\t\t}, 1);\n\t\t\t}, err => {\n\t\t\t\tconsole.error(new Date(), 'MONGO CLIENT CONNECT FAILED', JSON.stringify(err, null, 2));\n\t\t\t\treject();\n\t\t\t\tprocess.exit(1);\n\t\t\t});\n\t\t});\n\t}\n\n\tpublic static getClientName() {\n\t\treturn this._client;\n\t}\n\n\tpublic static getMainServer() {\n\t\treturn ResolveIOServer._mainServer;\n\t}\n\n\tpublic static getMongoConnection() {\n\t\treturn ResolveIOServer._mongoConnection;\n\t}\n\n\tpublic static getMainDB() {\n\t\treturn ResolveIOServer._mainDB;\n\t}\n\n\tpublic static getMongoManager() {\n\t\treturn ResolveIOServer._mongoManager;\n\t}\n}\n\nexport * from './public_api';"]}
1
+ {"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAA0C;AAC1C,0DAAwD;AAGxD;IAYC,yBAAY,YAAY,EAAE,YAAsB,EAAE,MAAc,EAAE,SAAS,EAAE,OAAc,EAAE,eAAuB;QAAvC,wBAAA,EAAA,cAAc;QAAE,gCAAA,EAAA,uBAAuB;QACnH,eAAe,CAAC,aAAa,GAAG,YAAY,CAAC;QAC7C,eAAe,CAAC,aAAa,GAAG,YAAY,CAAC;QAC7C,eAAe,CAAC,OAAO,GAAG,MAAM,CAAC;QACjC,eAAe,CAAC,UAAU,GAAG,SAAS,CAAC;QACvC,eAAe,CAAC,QAAQ,GAAG,OAAO,CAAC;QACnC,eAAe,CAAC,gBAAgB,GAAG,eAAe,CAAC;IACpD,CAAC;IAEa,6BAAa,GAA3B;QAAA,iBAmBC;QAlBA,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;YAClC,qBAAW,CAAC,OAAO,CAAC,eAAe,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,UAAA,YAAY;gBAChF,eAAe,CAAC,gBAAgB,GAAG,YAAY,CAAC;gBAChD,eAAe,CAAC,OAAO,GAAG,YAAY,CAAC,EAAE,CAAC,eAAe,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC;gBACrF,eAAe,CAAC,aAAa,GAAG,IAAI,4BAAY,EAAE,CAAC;gBAEnD,UAAU,CAAC;;;;oCACO,yEAAa,cAAc,OAAC;;gCAAzC,SAAS,GAAG,CAAC,SAA4B,CA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KAAK,CAAC;IAmDzC,sBAAC;CA7DD,AA6DC,IAAA;AA7DY,0CAAe;AA+D5B,+CAA6B","file":"index.js","sourcesContent":["import { Db, MongoClient } from 'mongodb';\nimport { MongoManager } from './managers/mongo.manager';\nimport ResolveIOMainServer from './server-app';\n\nexport class ResolveIOServer {\n\tprivate static _serverConfig = null;\n\tprivate static _clientRoutes = [];\n\tprivate static _mongoConnection: MongoClient = null;\n\tprivate static _mainDB: Db = null;\n\tprivate static _mainServer: ResolveIOMainServer = null;\n\tprivate static _mongoManager: MongoManager = null;\n\tprivate static _client = '';\n\tprivate static _clientDir = '';\n\tprivate static _sesMail = true;\n\tprivate static _standardProgram = false;\n\n\tconstructor(serverConfig, clientRoutes: string[], client: string, clientDir, sesMail = true, standardProgram = false) {\n\t\tResolveIOServer._serverConfig = serverConfig;\n\t\tResolveIOServer._clientRoutes = clientRoutes;\n\t\tResolveIOServer._client = client;\n\t\tResolveIOServer._clientDir = clientDir;\n\t\tResolveIOServer._sesMail = sesMail;\n\t\tResolveIOServer._standardProgram = standardProgram;\n\t}\n\n\tpublic static connectAndRun() {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tMongoClient.connect(ResolveIOServer._serverConfig['MONGO_URL']).then(dbConnection => {\n\t\t\t\tResolveIOServer._mongoConnection = dbConnection;\n\t\t\t\tResolveIOServer._mainDB = dbConnection.db(ResolveIOServer._serverConfig['DATABASE']);\n\t\t\t\tResolveIOServer._mongoManager = new MongoManager();\n\t\t\t\t\n\t\t\t\tsetTimeout(async () => {\n\t\t\t\t\tlet serverApp = (await import('./server-app')).default;\n\t\t\t\t\tResolveIOServer._mainServer = new serverApp(this, ResolveIOServer._serverConfig, ResolveIOServer._clientRoutes, this._clientDir, this._sesMail, this._standardProgram);\n\n\t\t\t\t\tresolve(true);\n\t\t\t\t}, 1);\n\t\t\t}, err => {\n\t\t\t\tconsole.error(new Date(), 'MONGO CLIENT CONNECT FAILED', JSON.stringify(err, null, 2));\n\t\t\t\treject();\n\t\t\t\tprocess.exit(1);\n\t\t\t});\n\t\t});\n\t}\n\n\tpublic static getClientName() {\n\t\treturn this._client;\n\t}\n\n\tpublic static getMainServer() {\n\t\treturn ResolveIOServer._mainServer;\n\t}\n\n\tpublic static getMongoConnection() {\n\t\treturn ResolveIOServer._mongoConnection;\n\t}\n\n\tpublic static getMainDB() {\n\t\treturn ResolveIOServer._mainDB;\n\t}\n\n\tpublic static getMongoManager() {\n\t\treturn ResolveIOServer._mongoManager;\n\t}\n}\n\nexport * from './public_api';"]}
@@ -70,7 +70,6 @@ var monitor_1 = require("../methods/monitor");
70
70
  var email_history_collection_1 = require("../collections/email-history.collection");
71
71
  var mongo_manager_1 = require("./mongo.manager");
72
72
  var monitor_manager_1 = require("./monitor.manager");
73
- var Verifier = require('email-verifier');
74
73
  var MethodManager = /** @class */ (function () {
75
74
  function MethodManager(mainServer, serverConfig, clientDir) {
76
75
  var _this = this;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/managers/method.manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,sDAA+D;AAE/D,wCAAiD;AACjD,gDAAyD;AACzD,sCAAgD;AAChD,sCAAgD;AAChD,wDAAkE;AAClE,2BAA6B;AAC7B,uBAAyB;AACzB,uCAAyC;AAEzC,6BAA+B;AAC/B,gDAAyD;AACzD,yCAAkD;AAClD,mDAA2D;AAC3D,kDAA0D;AAC1D,0CAAmD;AACnD,wFAA4E;AAC5E,yCAA+C;AAC/C,gEAAqD;AAErD,8FAAkF;AAClF,+BAAiC;AACjC,4DAAqE;AACrE,8CAAwD;AACxD,8CAAwD;AACxD,oFAAyE;AACzE,iDAAoD;AACpD,qDAAoD;AAEpD,IAAM,QAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAE3C;IAaC,uBAAY,UAAU,EAAE,YAAY,EAAE,SAAS;QAA/C,iBA2NC;QArOM,aAAQ,GAAgB,EAAE,CAAC;Q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C;yBACZ;6BACI;4BACJ,OAAO,CAAC,GAAG,CAAC,CAAC;yBACb;oBACF,CAAC,CAAC,CAAC;iBACH;aACD;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;IACF,oBAAC;AAAD,CA5mBA,AA4mBC,IAAA;AA5mBY,sCAAa","file":"method.manager.js","sourcesContent":["import { ServerResponseModel } from '../models/server-response.model';\nimport { loadCollectionMethods } from '../methods/collections';\nimport { MethodModel } from '../models/method.model';\nimport { loadLogMethods } from '../methods/logs';\nimport { loadCounterMethods } from '../methods/counters';\nimport { loadPDFMethods } from '../methods/pdf';\nimport { loadAWSMethods } from '../methods/aws';\nimport { loadCloudConvertMethods } from '../methods/cloudconvert';\nimport * as path from 'path';\nimport * as fs from 'fs';\nimport * as nodemailer from 'nodemailer';\nimport * as imap from 'imap';\nimport * as aws from 'aws-sdk';\nimport { loadAccountMethods } from '../methods/accounts';\nimport { loadServerInit } from '../fixtures/init';\nimport { loadServerCronJobs } from '../fixtures/cron-jobs';\nimport { loadCronJobMethods } from '../methods/cron-jobs';\nimport { loadFlagMethods } from '../methods/flags';\nimport { MethodResponses } from '../collections/method-response.collection';\nimport { getBinarySize } from '../util/common';\nimport { Logs } from '../collections/log.collection';\nimport ResolveIOMainServer from '../server-app';\nimport { LogMethodLatencies } from '../collections/log-method-latency.collection';\nimport * as moment from 'moment';\nimport { loadReportBuilderMethods } from '../methods/report-builder';\nimport { loadSupportMethods } from '../methods/support';\nimport { loadMonitorMethods } from '../methods/monitor';\nimport { EmailHistories } from '../collections/email-history.collection';\nimport { objectIdHexString } from './mongo.manager';\nimport { MonitorFunction } from './monitor.manager';\n\nconst Verifier = require('email-verifier');\n\nexport class MethodManager {\n\n\tprivate _mainServer: ResolveIOMainServer;\n\tpublic _methods: MethodModel = {};\n\tprivate _mailer: nodemailer.Transporter;\n\tprivate _imap: imap;\n\tprivate _aws: aws.S3;\n\tprivate serverConfig;\n\tprivate clientDir;\n\n\tprivate _sendQueue = [];\n\tprivate _runningQueue = false;\n\n\tconstructor(mainServer, serverConfig, clientDir) {\n\t\tthis._mainServer = mainServer;\n\t\tthis.serverConfig = serverConfig;\n\t\tthis.clientDir = clientDir;\n\n\t\t// Fixtures\n\t\tloadServerInit();\n\t\tloadServerCronJobs();\n\n\t\t// Methods\n\t\tloadAccountMethods(this);\n\t\tloadAWSMethods(this);\n\t\tloadCloudConvertMethods(this);\n\t\tloadCollectionMethods(this);\n\t\tloadCounterMethods(this);\n\t\tloadLogMethods(this);\n\t\tloadPDFMethods(this);\n\t\tloadCronJobMethods(this);\n\t\tloadFlagMethods(this);\n\t\tloadReportBuilderMethods(this);\n\t\tloadSupportMethods(this);\n\t\tloadMonitorMethods(this);\n\n\t\tif (mainServer.sesMail) {\n\t\t\tthis._mailer = nodemailer.createTransport({\n\t\t\t\tSES: new aws.SES({\n\t\t\t\t\tapiVersion: '2010-12-01',\n\t\t\t\t\taccessKeyId: serverConfig.AWSACCESSKEYID,\n\t\t\t\t\tsecretAccessKey: serverConfig.AWSSECRETACCESSKEY,\n\t\t\t\t\tregion: serverConfig.AWSSES_REGION\n\t\t\t\t})\n\t\t\t});\n\t\t}\n\t\telse {\n\t\t\tthis._mailer = nodemailer.createTransport({\n\t\t\t\thost: this.serverConfig['MAIL_HOST'], // 'smtp.office365.com', // Office 365 server\n\t\t\t\tport: this.serverConfig['MAIL_PORT'], //587, // secure SMTP\n\t\t\t\tsecure: false, // false for TLS - as a boolean not string - but the default is false so just remove this completely\n\t\t\t\tauth: {\n\t\t\t\t\tuser: this.serverConfig['MAIL_USERNAME'],\n\t\t\t\t\tpass: this.serverConfig['MAIL_PASSWORD']\n\t\t\t\t},\n\t\t\t\ttls: {\n\t\t\t\t\tciphers: 'SSLv3'\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\t// this._imap = new imap({\n\t\t// \tuser: this.serverConfig['ORDERS_EMAIL'],\n\t\t// \tpassword: this.serverConfig['ORDERS_PASSWORD'],\n\t\t// \thost: this.serverConfig['ORDERS_HOST'],\n\t\t// \tport: this.serverConfig['ORDERS_PORT'],\n\t\t// \ttls: this.serverConfig['ORDERS_TLS']\n\t\t// });\n\n\t\t// let that = this;\n\n\t\t// let chemicalNames = await Chemicals.find({}).select('description');\n\t\t// let jobNames = await Jobs.find({status: 'Active'}).select('well');\n\n\t\t// console.log(jobNames.map(a => a.well));\n\n\t\t// this._imap.once('ready', () => {\n\t\t// \tthis._imap.openBox('INBOX', true, function(err, box) {\n\t\t// \t\tif (err) {\n\t\t// \t\t\tthrow err;\n\t\t// \t\t}\n\n\t\t// \t\tthat._imap.search([ 'NEW' ], function(err, results) {\n\n\t\t// \t\t\tconsole.log(err, results);\n\n\t\t// \t\t\tif (err || !results.length) {\n\t\t// \t\t\t\treturn that._imap.end();\n\t\t// \t\t\t}\n\n\t\t// \t\t\tlet f = that._imap.fetch(results[0], { bodies: ['HEADER.FIELDS (FROM)', 'TEXT'] });\n\t\t// \t\t\tf.on('message', function(msg, seqno) {\n\t\t// \t\t\t\t// console.log('Message #%d', seqno);\n\t\t// \t\t\t\tlet prefix = '(#' + seqno + ') ';\n\t\t// \t\t\t\tmsg.on('body', function(stream, info) {\n\t\t// \t\t\t\t\tlet buffer = '', count = 0;\n\t\t// \t\t\t\t\tstream.on('data', function(chunk) {\n\t\t// \t\t\t\t\t\tcount += chunk.length;\n\t\t// \t\t\t\t\t\tbuffer += chunk.toString('utf8');\n\t\t// \t\t\t\t\t});\n\t\t// \t\t\t\t\tstream.once('end', function() {\n\t\t// \t\t\t\t\t\tif (info.which === 'TEXT') {\n\t\t// \t\t\t\t\t\t\t// console.log(buffer);\n\t\t// \t\t\t\t\t\t\t// console.log(typeof(buffer));\n\t\t// \t\t\t\t\t\t\tlet lines = buffer.split('\\r\\n');\n\t\t// \t\t\t\t\t\t\t// console.log(lines);\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t// \t\t\t\t\t\t\t// let i = 0;\n\t\t// \t\t\t\t\t\t\t// lines.forEach(line => {\n\n\t\t// \t\t\t\t\t\t\t// \tlet date: Date;\n\t\t// \t\t\t\t\t\t\t// \tlet dateString;\n\n\t\t// \t\t\t\t\t\t\t// \tif (line.includes('From')) {\n\t\t// \t\t\t\t\t\t\t// \t\tconsole.log(line);\n\t\t// \t\t\t\t\t\t\t// \t}\n\t\t// \t\t\t\t\t\t\t// \tif (!line.includes('class=3D') && !line.includes('style=3D')) {\n\t\t// \t\t\t\t\t\t\t// \t\tif (line.includes('Well') || line.includes('Well Name') || line.includes('Job') || line.includes('Pad')) {\n\t\t// \t\t\t\t\t\t\t// \t\t\tlet best = stringSimilarity.findBestMatch(line, jobNames.map(a => a.well)).bestMatch;\n\t\n\t\t// \t\t\t\t\t\t\t// \t\t\tif (best && best.rating > 0.5) {\n\t\t// \t\t\t\t\t\t\t// \t\t\t\tconsole.log('Well', line);\n\t\t// \t\t\t\t\t\t\t// \t\t\t}\n\t\t// \t\t\t\t\t\t\t// \t\t}\n\t\t// \t\t\t\t\t\t\t// \t\tif (line.includes('Product') || line.includes('Chemical')) {\n\t\t// \t\t\t\t\t\t\t// \t\t\tlet best = stringSimilarity.findBestMatch(line, chemicalNames.map(a => a.description)).bestMatch;\n\t\n\t\t// \t\t\t\t\t\t\t// \t\t\tif (best && best.rating > 0.5) {\n\t\t// \t\t\t\t\t\t\t// \t\t\t\tconsole.log('Chemical', line);\n\t\t// \t\t\t\t\t\t\t// \t\t\t}\n\t\t// \t\t\t\t\t\t\t// \t\t}\n\t\t// \t\t\t\t\t\t\t// \t\tif (line.includes('Quantity') || line.includes('Qty') || line.includes('Amount')) {\n\t\t// \t\t\t\t\t\t\t// \t\t\tconsole.log('Qty', line);\n\t\t// \t\t\t\t\t\t\t// \t\t}\n\t\t// \t\t\t\t\t\t\t// \t\tif (line.includes('Date')) {\n\t\t// \t\t\t\t\t\t\t// \t\t\tconsole.log('Date', line);\n\t\t// \t\t\t\t\t\t\t// \t\t\tconsole.log(moment(Date.parse(line)));\n\t\t// \t\t\t\t\t\t\t// \t\t\tdate = moment(Date.parse(line)).toDate();\n\t\t// \t\t\t\t\t\t\t// \t\t\tdateString = line;\n\t\t// \t\t\t\t\t\t\t// \t\t}\n\t\t// \t\t\t\t\t\t\t// \t\tif (line.includes('Time')) {\n\t\t// \t\t\t\t\t\t\t// \t\t\tconsole.log('Time', line);\n\t\t// \t\t\t\t\t\t\t// \t\t\tconsole.log(moment(Date.parse(line)));\n\t\t// \t\t\t\t\t\t\t// \t\t\tconsole.log(moment(date.setTime(Date.parse(line))));\n\t\t// \t\t\t\t\t\t\t// \t\t}\n\t\t// \t\t\t\t\t\t\t// \t}\n\t\t// \t\t\t\t\t\t\t// });\n\t\t// \t\t\t\t\t\t}\n\t\t// \t\t\t\t\t});\n\t\t// \t\t\t\t});\n\t\t\t\t\t\n\t\t// \t\t\t\tmsg.once('attributes', function(attrs) {\n\t\t// \t\t\t\t\tconsole.log(prefix + 'Attributes: %s', inspect(attrs, false, 8));\n\t\t// \t\t\t\t});\n\n\t\t// \t\t\t\tmsg.once('end', function() {\n\t\t// \t\t\t\t\tconsole.log(prefix + 'Finished');\n\t\t// \t\t\t\t});\n\t\t// \t\t\t});\n\t\t\t\t\t\n\t\t// \t\t\tf.once('error', function(error) {\n\t\t// \t\t\t\tconsole.log('Fetch error: ' + error);\n\t\t// \t\t\t});\n\n\t\t// \t\t\tf.once('end', function() {\n\t\t// \t\t\t\tconsole.log('Done fetching all messages!');\n\t\t// \t\t\t\tthat._imap.end();\n\t\t// \t\t\t});\n\t\t// \t\t});\n\t\t// \t});\n\t\t// });\n\n\t\t// this._imap.connect();\n\n\t\tthis._aws = new aws.S3({\n\t\t\taccessKeyId: serverConfig.AWSACCESSKEYID,\n\t\t\tsecretAccessKey: serverConfig.AWSSECRETACCESSKEY,\n\t\t\tregion: serverConfig.AWSREGION\n\t\t});\n\n\t\tsetInterval(() => {\n\t\t\tif (!this._runningQueue) {\n\t\t\t\tif (this._sendQueue.length) {\n\t\t\t\t\tthis._runningQueue = true;\n\t\t\t\t\tfor (let i = this._sendQueue.length - 1; i >= 0; i--) {\n\t\t\t\t\t\tlet ws = this._mainServer.getWS(this._sendQueue[i].id_ws);\n\t\t\t\t\t\tif (ws && ws.readyState === ws.OPEN) {\n\t\t\t\t\t\t\tif (ws.bufferedAmount < 20480) {\n\t\t\t\t\t\t\t\tlet sendItem = this._sendQueue.pop();\n\t\t\t\t\t\t\t\tws.send(JSON.stringify(sendItem.data), (error) => {\n\t\t\t\t\t\t\t\t\tif (error) {\n\t\t\t\t\t\t\t\t\t\tconsole.log('Error on WS: ', error);\n\t\t\t\t\t\t\t\t\t\tthis._mainServer.unsubscribeWS(ws);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\tif (sendItem.method !== 'reportBuilderGetResults' && sendItem.method !== 'reportBuilderGetDistinctValue' && sendItem.method !== 'reportBuilderBuildTree' && sendItem.method !== 'generatePDF' && sendItem.method !== 'getWOOfflineData' && sendItem.method !== 'countQuery' && sendItem.method !== 'countWithQuery' && sendItem.method !== 'countCollectionWithQuery' && sendItem.method !== 'find' && sendItem.method !== 'findOne' && sendItem.method !== 'findWithOptions' && sendItem.method !== 'setWSAppVersion' && sendItem.method !== 'uploadFileAndSave' && sendItem.method !== 'getDrivers') {\n\t\t\t\t\t\t\t\t\tLogs.insertOne({\n\t\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\t\ttype: 'client-response',\n\t\t\t\t\t\t\t\t\t\tcollection: '',\n\t\t\t\t\t\t\t\t\t\tid_document: '',\n\t\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([sendItem.methodData, sendItem.data])) < 200000 ? JSON.stringify([sendItem.methodData, sendItem.data], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\t\t\tmethod: sendItem.method,\n\t\t\t\t\t\t\t\t\t\tid_user: ws['id_user'] || '',\n\t\t\t\t\t\t\t\t\t\tuser: ws['user'] || '',\n\t\t\t\t\t\t\t\t\t\tmessageId: sendItem.data.messageId,\n\t\t\t\t\t\t\t\t\t\troute: ''\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tMethodResponses.create({\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\t\t\t\tid_user: ws['id_user'] || '',\n\t\t\t\t\t\t\t\t\tmessage_id: sendItem.data.messageId,\n\t\t\t\t\t\t\t\t\tresponse: getBinarySize(JSON.stringify(sendItem.data)) < 200000 ? sendItem.data : {error: 'Too Big'},\n\t\t\t\t\t\t\t\t\tmethod: sendItem.method,\n\t\t\t\t\t\t\t\t\tdate: sendItem.date\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tthis._sendQueue.splice(i, 1);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._runningQueue = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}, 1);\n\t}\n\n\tpublic getMainServer() {\n\t\treturn this._mainServer;\n\t}\n\n\t// Add methods to private methods object\n\tpublic methods(method: MethodModel) {\n\t\tthis._methods = Object.assign(this._methods, method);\n\t}\n\n\tpublic callMethodCron(method: string, ...methodData: any[]) {\n\t\tlet that = this;\n\n\t\tif (!that._methods[method]) {\n\t\t\tconsole.log('No Method: ' + method);\n\n\t\t\tthat.sendEmail('dev@resolveio.com', 'SERVER - Error Detected - ' + that.serverConfig['CLIENT_NAME'], 'No Method: ' + method);\n\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif ((methodData.length > 1 || methodData[0]) && !that._methods[method].skipValidation) {\n\t\t\tif (!that._methods[method].check) {\n\t\t\t\tconsole.error(new Date(), 'No Check Function For Method ' + method);\n\n\t\t\t\tthat.sendEmail('dev@resolveio.com', 'SERVER - Error Detected - ' + that.serverConfig['CLIENT_NAME'], 'No Check Function For Method ' + method);\n\t\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse if (!that._methods[method].check._schema) {\n\t\t\t\tconsole.error(new Date(), 'No Check Schema For Method ' + method);\n\n\t\t\t\tthat.sendEmail('dev@resolveio.com', 'SERVER - Error Detected - ' + that.serverConfig['CLIENT_NAME'], 'No Check Function For Method ' + method);\n\t\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tlet valObj = {};\n\t\t\t\tlet valKeys = Object.keys(that._methods[method].check._schema);\n\n\t\t\t\tlet rootKeys = valKeys.filter(a => !a.includes('.'));\n\t\t\t\t\n\t\t\t\tfor (let i = 0; i < methodData.length; i++) {\n\t\t\t\t\tvalObj[rootKeys[i]] = methodData[i];\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tthat._methods[method].check.validate(valObj);\n\t\t\t\t}\n\t\t\t\tcatch (errors) {\n\t\t\t\t\tif (errors) {\n\t\t\t\t\t\tconsole.error(new Date(), 'Error in Method Check (' + method + ')', errors);\n\n\t\t\t\t\t\tthat.sendEmail('dev@resolveio.com', 'SERVER - Error Detected - ' + that.serverConfig['CLIENT_NAME'], 'Match Error On Method ' + method + '\\n\\nData Being Checked\\n' + JSON.stringify(valObj, null, 2) + '\\n\\nErrors\\n' + JSON.stringify(errors, null, 2));\n\t\t\t\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tlet monitor = new MonitorFunction('Cron Method', method, '', methodData);\n\t\tlet promise = that._methods[method].function.call(Object.assign({}, that, MethodManager.prototype, {id_user: '', user: '', id_ws: ''}), ...methodData)\n\t\t.then(res => {\n\t\t\tmonitor.finish();\n\t\t\treturn res;\n\t\t}, methodErrs => {\n\t\t\tmonitor.finish();\n\t\t\tthat.sendEmail('dev@resolveio.com', 'SERVER - Error Detected - ' + that.serverConfig['CLIENT_NAME'], 'Error Detected During Method ' + method + ' - (callMethodCron)\\n\\nData \\n' + JSON.stringify(methodData, null, 2) + '\\n\\nErrors\\n' + JSON.stringify(methodErrs, null, 2));\n\t\t\treturn methodErrs;\n\t\t});\n\n\t\treturn promise;\n\t}\n\n\t// Call/run method (Emit on Socket)\n\tpublic callMethod(id_methodLatency: string, ws: WebSocket, messageDate: Date, messageId: number, method: string, ...methodData: any[]) {\n\t\tlet that = this;\n\n\t\tif (!that._methods[method]) {\n\t\t\tconsole.log('No Method: ' + method);\n\n\t\t\tthat.sendEmail('dev@resolveio.com', 'SERVER - Error Detected - ' + that.serverConfig['CLIENT_NAME'], 'No Method: ' + method);\n\t\t\t\n\t\t\tlet serverRes: ServerResponseModel = {\n\t\t\t\tmessageId: messageId,\n\t\t\t\thasError: true,\n\t\t\t\tdata: 'Internal Error'\n\t\t\t};\n\n\t\t\tthis.sendWS(ws, messageDate, method, methodData, serverRes);\n\n\t\t\tif (id_methodLatency) {\n\t\t\t\tLogMethodLatencies.deleteOne({_id: id_methodLatency});\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tif ((methodData.length > 1 || methodData[0]) && !that._methods[method].skipValidation) {\n\t\t\tif (!that._methods[method].check) {\n\t\t\t\tconsole.error(new Date(), 'No Check Function For Method ' + method);\n\n\t\t\t\tthat.sendEmail('dev@resolveio.com', 'SERVER - Error Detected - ' + that.serverConfig['CLIENT_NAME'], 'No Check Function For Method ' + method);\n\t\t\t\t\n\t\t\t\tlet serverRes: ServerResponseModel = {\n\t\t\t\t\tmessageId: messageId,\n\t\t\t\t\thasError: true,\n\t\t\t\t\tdata: 'Internal Error'\n\t\t\t\t};\n\t\n\t\t\t\tthis.sendWS(ws, messageDate, method, methodData, serverRes);\n\n\t\t\t\tif (id_methodLatency) {\n\t\t\t\t\tLogMethodLatencies.deleteOne({_id: id_methodLatency});\n\t\t\t\t}\n\t\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse if (!that._methods[method].check._schema) {\n\t\t\t\tconsole.error(new Date(), 'No Check Schema For Method ' + method);\n\n\t\t\t\tthat.sendEmail('dev@resolveio.com', 'SERVER - Error Detected - ' + that.serverConfig['CLIENT_NAME'], 'No Check Function For Method ' + method);\n\t\t\t\t\n\t\t\t\tlet serverRes: ServerResponseModel = {\n\t\t\t\t\tmessageId: messageId,\n\t\t\t\t\thasError: true,\n\t\t\t\t\tdata: 'Internal Error'\n\t\t\t\t};\n\n\t\t\t\tif (id_methodLatency) {\n\t\t\t\t\tLogMethodLatencies.deleteOne({_id: id_methodLatency});\n\t\t\t\t}\n\t\n\t\t\t\tthis.sendWS(ws, messageDate, method, methodData, serverRes);\n\t\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tlet valObj = {};\n\t\t\t\tlet valKeys = Object.keys(that._methods[method].check._schema);\n\n\t\t\t\tlet rootKeys = valKeys.filter(a => !a.includes('.'));\n\t\t\t\t\n\t\t\t\tfor (let i = 0; i < methodData.length; i++) {\n\t\t\t\t\tvalObj[rootKeys[i]] = methodData[i];\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tthat._methods[method].check.validate(valObj);\n\t\t\t\t}\n\t\t\t\tcatch (errors) {\n\t\t\t\t\tif (errors) {\n\t\t\t\t\t\tconsole.error(new Date(), 'Error in Method Check (' + method + ')', errors);\n\n\t\t\t\t\t\tthat.sendEmail('dev@resolveio.com', 'SERVER - Error Detected - ' + that.serverConfig['CLIENT_NAME'], 'Match Error On Method ' + method + '\\n\\nData Being Checked\\n' + JSON.stringify(valObj, null, 2) + '\\n\\nErrors\\n' + JSON.stringify(errors, null, 2));\n\t\t\t\t\t\t\n\t\t\t\t\t\tlet serverRes: ServerResponseModel = {\n\t\t\t\t\t\t\tmessageId: messageId,\n\t\t\t\t\t\t\thasError: true,\n\t\t\t\t\t\t\tdata: 'Internal Error'\n\t\t\t\t\t\t};\n\t\t\t\t\t\t\n\t\t\t\t\t\tthis.sendWS(ws, messageDate, method, methodData, serverRes);\n\n\t\t\t\t\t\tif (id_methodLatency) {\n\t\t\t\t\t\t\tLogMethodLatencies.deleteOne({_id: id_methodLatency});\n\t\t\t\t\t\t}\n\t\t\t\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tlet monitor = new MonitorFunction('Method', method, ws['user'], methodData);\n\t\tthat._methods[method].function.call(Object.assign({}, that, MethodManager.prototype, {id_user: ws['id_user'], user: ws['user'], id_ws: ws['id_socket']}), ...methodData)\n\t\t.then(async (res) => {\n\t\t\tmonitor.finish();\n\n\t\t\tlet serverRes: ServerResponseModel = {\n\t\t\t\tmessageId: messageId,\n\t\t\t\thasError: false,\n\t\t\t\tdata: res\n\t\t\t};\n\n\t\t\tthis.sendWS(ws, messageDate, method, methodData, serverRes);\n\n\t\t\tif (id_methodLatency) {\n\t\t\t\tlet latency = await LogMethodLatencies.findById(id_methodLatency);\n\n\t\t\t\tif (latency) {\n\t\t\t\t\tLogMethodLatencies.updateOne({_id: id_methodLatency}, {$set: {date_end: new Date(), latency_ms: moment().diff(moment(latency.date_start), 'milliseconds', true)}});\n\t\t\t\t}\n\t\t\t}\n\t\t}, err => {\n\t\t\tmonitor.finish();\n\t\t\tlet serverRes: ServerResponseModel = {\n\t\t\t\tmessageId: messageId,\n\t\t\t\thasError: true,\n\t\t\t\tdata: err\n\t\t\t};\n\n\t\t\tthis.sendWS(ws, messageDate, method, methodData, serverRes);\n\n\t\t\tif (id_methodLatency) {\n\t\t\t\tLogMethodLatencies.deleteOne({_id: id_methodLatency});\n\t\t\t}\n\n\t\t\tthat.sendEmail('dev@resolveio.com', 'SERVER - Error Detected - ' + that.serverConfig['CLIENT_NAME'], 'Error Detected During Method ' + method + ' - (callMethod)\\n\\nData \\n' + JSON.stringify(methodData, null, 2) + '\\n\\nErrors\\n' + JSON.stringify(err, null, 2));\n\t\t});\n\t}\n\n\t// Call/run method internal (No Emit on Socket)\n\tpublic callMethodInternal(method, ...methodData: any[]): Promise<any> {\n\t\tlet that = this;\n\n\t\tif (!that._methods[method]) {\n\t\t\tconsole.log('No Method: ' + method);\n\t\t\treturn null;\n\t\t}\n\n\t\tif ((methodData.length > 1 || (methodData[0] && typeof(methodData[0]) !== 'function')) && !that._methods[method].skipValidation) {\n\t\t\tif (!that._methods[method].check) {\n\t\t\t\tconsole.error(new Date(), 'No Check Function For Method ' + method);\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\telse if (!that._methods[method].check._schema) {\n\t\t\t\tconsole.error(new Date(), 'No Check Schema For Method ' + method);\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\n\t\tif (method !== 'insertSubscriptionLog' && method !== 'getDataURIfromURL') {\n\t\t\tLogs.insertOne({\n\t\t\t\t_id: objectIdHexString(),\n\t\t\t\ttype: 'callMethodInternal',\n\t\t\t\tcollection: '',\n\t\t\t\tid_document: '',\n\t\t\t\tpayload: getBinarySize(JSON.stringify([methodData])) < 200000 ? JSON.stringify([methodData], null, 2) : 'Too Big',\n\t\t\t\tmethod: method,\n\t\t\t\tid_user: this['id_user'] || '',\n\t\t\t\tuser: this['user'] || '',\n\t\t\t\tmessageId: 0,\n\t\t\t\troute: ''\n\t\t\t});\n\t\t}\n\n\t\tlet monitor = new MonitorFunction('Internal Method', method, this['id_user'] || '', methodData);\n\t\tlet promise = that._methods[method].function.call(Object.assign({}, that, MethodManager.prototype), ...methodData)\n\t\t.then(res => {\n\t\t\tmonitor.finish();\n\t\t\treturn res;\n\t\t}, methodErrs => {\n\t\t\tmonitor.finish();\n\t\t\tthat.sendEmail('dev@resolveio.com', 'SERVER - Error Detected - ' + that.serverConfig['CLIENT_NAME'], 'Error Detected During Method ' + method + ' - (callMethodInternal)\\n\\nData \\n' + JSON.stringify(methodData, null, 2) + '\\n\\nErrors\\n' + JSON.stringify(methodErrs, null, 2));\n\t\t\treturn methodErrs;\n\t\t});\n\n\t\tif (methodData[methodData.length - 1] && typeof(methodData[methodData.length - 1]) === 'function') {\n\t\t\tpromise.then(res => methodData[methodData.length - 1](null, res), err => methodData[methodData.length - 1](err, null));\n\t\t}\n\t\t\n\t\treturn promise;\n\t}\n\n\tprivate sendWS(ws: WebSocket, messageDate: Date, method: string, methodData: any[], data: ServerResponseModel) {\n\t\tthis._sendQueue.splice(0, 0, {\n\t\t\tid_ws: ws['id_socket'],\n\t\t\tmethod: method,\n\t\t\tmethodData: methodData,\n\t\t\tdata: data,\n\t\t\tdate: messageDate\n\t\t});\n\t}\n\n\tpublic sendEmail(sendTo: string, subject: string, text?: string, html?: string, attachments?: any[], send_from?: string) {\n\t\treturn new Promise(async (resolve, reject) => {\n\t\t\tif ((this.serverConfig['ROOT_URL'].match(new RegExp(/https\\:\\/\\/dev\\./)) || this.serverConfig['ROOT_URL'].match(new RegExp(/https\\:\\/\\/www\\.dev\\./)) || this.serverConfig['ROOT_URL'] === 'http://localhost:4200') && !sendTo.match(new RegExp(/\\@resolveio\\.com/))) {\n\t\t\t\tsendTo = 'dev@resolveio.com';\n\t\t\t}\n\n\t\t\tif (sendTo) {\n\t\t\t\tif (this.serverConfig['ROOT_URL'] !== 'http://localhost:4200') {\n\t\t\t\t\tthis._mailer.sendMail({\n\t\t\t\t\t\treplyTo: undefined,\n\t\t\t\t\t\tfrom: send_from ? send_from : this.serverConfig.MAIL_FROM,\n\t\t\t\t\t\tto: sendTo,\n\t\t\t\t\t\tsubject: (this.serverConfig['ROOT_URL'].match(new RegExp(/https\\:\\/\\/dev\\./)) || this.serverConfig['ROOT_URL'].match(new RegExp(/https\\:\\/\\/www\\.dev\\./)) ? '(DEV SERVER) - ' : '') + subject,\n\t\t\t\t\t\ttext: text,\n\t\t\t\t\t\thtml: html,\n\t\t\t\t\t\tattachments: attachments\n\t\t\t\t\t}, (err, info) => {\n\t\t\t\t\t\tif (err) {\n\t\t\t\t\t\t\tconsole.log(err);\n\n\t\t\t\t\t\t\tEmailHistories.create({\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\t\t\tdate: new Date(),\n\t\t\t\t\t\t\t\tid_user: this['id_user'] || '',\n\t\t\t\t\t\t\t\tuser: this['user'] || '',\n\t\t\t\t\t\t\t\temail: sendTo,\n\t\t\t\t\t\t\t\tsuccess: false,\n\t\t\t\t\t\t\t\tverified: false\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tEmailHistories.create({\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\t\t\tdate: new Date(),\n\t\t\t\t\t\t\t\tid_user: this['id_user'] || '',\n\t\t\t\t\t\t\t\tuser: this['user'] || '',\n\t\t\t\t\t\t\t\temail: sendTo,\n\t\t\t\t\t\t\t\tsuccess: true,\n\t\t\t\t\t\t\t\tverified: false\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tconsole.log('Send email', sendTo, subject, text, html, attachments, send_from);\n\t\t\t\t}\n\n\t\t\t\tresolve(true);\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic getAWS(): aws.S3 {\n\t\treturn this._aws;\n\t}\n\n\tpublic readFile(fileName) {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tif (fs.existsSync(path.join(__dirname, ('../private/' + fileName)))) {\n\t\t\t\tfs.readFile(path.join(__dirname, ('../private/' + fileName)), 'utf-8', (err, res) => { \n\t\t\t\t\tif (err) {\n\t\t\t\t\t\treject(err);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tresolve(res);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (fs.existsSync(path.join(this.clientDir, ('./private/' + fileName)))) {\n\t\t\t\t\tfs.readFile(path.join(this.clientDir, ('./private/' + fileName)), 'utf-8', (err, res) => { \n\t\t\t\t\t\tif (err) {\n\t\t\t\t\t\t\treject(err);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tresolve(res);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic readImage(fileName) {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tif (fs.existsSync(path.join(__dirname, ('../private/' + fileName)))) {\n\t\t\t\tfs.readFile(path.join(__dirname, ('../private/' + fileName)), 'base64', (err, res) => { \n\t\t\t\t\tif (err) {\n\t\t\t\t\t\treject(err);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tresolve(res);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (fs.existsSync(path.join(this.clientDir, ('./private/' + fileName)))) {\n\t\t\t\t\tfs.readFile(path.join(this.clientDir, ('./private/' + fileName)), 'base64', (err, res) => { \n\t\t\t\t\t\tif (err) {\n\t\t\t\t\t\t\treject(err);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tresolve(res);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}"]}
1
+ {"version":3,"sources":["../../src/managers/method.manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,sDAA+D;AAE/D,wCAAiD;AACjD,gDAAyD;AACzD,sCAAgD;AAChD,sCAAgD;AAChD,wDAAkE;AAClE,2BAA6B;AAC7B,uBAAyB;AACzB,uCAAyC;AAEzC,6BAA+B;AAC/B,gDAAyD;AACzD,yCAAkD;AAClD,mDAA2D;AAC3D,kDAA0D;AAC1D,0CAAmD;AACnD,wFAA4E;AAC5E,yCAA+C;AAC/C,gEAAqD;AAErD,8FAAkF;AAClF,+BAAiC;AACjC,4DAAqE;AACrE,8CAAwD;AACxD,8CAAwD;AACxD,oFAAyE;AAC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AAG,QAAQ,CAAC,CAAC,EAAE,QAAQ,EAAE,UAAC,GAAG,EAAE,GAAG;wBACpF,IAAI,GAAG,EAAE;4BACR,MAAM,CAAC,GAAG,CAAC,CAAC;yBACZ;6BACI;4BACJ,OAAO,CAAC,GAAG,CAAC,CAAC;yBACb;oBACF,CAAC,CAAC,CAAC;iBACH;aACD;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;IACF,oBAAC;AAAD,CA5mBA,AA4mBC,IAAA;AA5mBY,sCAAa","file":"method.manager.js","sourcesContent":["import { ServerResponseModel } from '../models/server-response.model';\nimport { loadCollectionMethods } from '../methods/collections';\nimport { MethodModel } from '../models/method.model';\nimport { loadLogMethods } from '../methods/logs';\nimport { loadCounterMethods } from '../methods/counters';\nimport { loadPDFMethods } from '../methods/pdf';\nimport { loadAWSMethods } from '../methods/aws';\nimport { loadCloudConvertMethods } from '../methods/cloudconvert';\nimport * as path from 'path';\nimport * as fs from 'fs';\nimport * as nodemailer from 'nodemailer';\nimport * as imap from 'imap';\nimport * as aws from 'aws-sdk';\nimport { loadAccountMethods } from '../methods/accounts';\nimport { loadServerInit } from '../fixtures/init';\nimport { loadServerCronJobs } from '../fixtures/cron-jobs';\nimport { loadCronJobMethods } from '../methods/cron-jobs';\nimport { loadFlagMethods } from '../methods/flags';\nimport { MethodResponses } from '../collections/method-response.collection';\nimport { getBinarySize } from '../util/common';\nimport { Logs } from '../collections/log.collection';\nimport ResolveIOMainServer from '../server-app';\nimport { LogMethodLatencies } from '../collections/log-method-latency.collection';\nimport * as moment from 'moment';\nimport { loadReportBuilderMethods } from '../methods/report-builder';\nimport { loadSupportMethods } from '../methods/support';\nimport { loadMonitorMethods } from '../methods/monitor';\nimport { EmailHistories } from '../collections/email-history.collection';\nimport { objectIdHexString } from './mongo.manager';\nimport { MonitorFunction } from './monitor.manager';\n\nexport class MethodManager {\n\n\tprivate _mainServer: ResolveIOMainServer;\n\tpublic _methods: MethodModel = {};\n\tprivate _mailer: nodemailer.Transporter;\n\tprivate _imap: imap;\n\tprivate _aws: aws.S3;\n\tprivate serverConfig;\n\tprivate clientDir;\n\n\tprivate _sendQueue = [];\n\tprivate _runningQueue = false;\n\n\tconstructor(mainServer, serverConfig, clientDir) {\n\t\tthis._mainServer = mainServer;\n\t\tthis.serverConfig = serverConfig;\n\t\tthis.clientDir = clientDir;\n\n\t\t// Fixtures\n\t\tloadServerInit();\n\t\tloadServerCronJobs();\n\n\t\t// Methods\n\t\tloadAccountMethods(this);\n\t\tloadAWSMethods(this);\n\t\tloadCloudConvertMethods(this);\n\t\tloadCollectionMethods(this);\n\t\tloadCounterMethods(this);\n\t\tloadLogMethods(this);\n\t\tloadPDFMethods(this);\n\t\tloadCronJobMethods(this);\n\t\tloadFlagMethods(this);\n\t\tloadReportBuilderMethods(this);\n\t\tloadSupportMethods(this);\n\t\tloadMonitorMethods(this);\n\n\t\tif (mainServer.sesMail) {\n\t\t\tthis._mailer = nodemailer.createTransport({\n\t\t\t\tSES: new aws.SES({\n\t\t\t\t\tapiVersion: '2010-12-01',\n\t\t\t\t\taccessKeyId: serverConfig.AWSACCESSKEYID,\n\t\t\t\t\tsecretAccessKey: serverConfig.AWSSECRETACCESSKEY,\n\t\t\t\t\tregion: serverConfig.AWSSES_REGION\n\t\t\t\t})\n\t\t\t});\n\t\t}\n\t\telse {\n\t\t\tthis._mailer = nodemailer.createTransport({\n\t\t\t\thost: this.serverConfig['MAIL_HOST'], // 'smtp.office365.com', // Office 365 server\n\t\t\t\tport: this.serverConfig['MAIL_PORT'], //587, // secure SMTP\n\t\t\t\tsecure: false, // false for TLS - as a boolean not string - but the default is false so just remove this completely\n\t\t\t\tauth: {\n\t\t\t\t\tuser: this.serverConfig['MAIL_USERNAME'],\n\t\t\t\t\tpass: this.serverConfig['MAIL_PASSWORD']\n\t\t\t\t},\n\t\t\t\ttls: {\n\t\t\t\t\tciphers: 'SSLv3'\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\t// this._imap = new imap({\n\t\t// \tuser: this.serverConfig['ORDERS_EMAIL'],\n\t\t// \tpassword: this.serverConfig['ORDERS_PASSWORD'],\n\t\t// \thost: this.serverConfig['ORDERS_HOST'],\n\t\t// \tport: this.serverConfig['ORDERS_PORT'],\n\t\t// \ttls: this.serverConfig['ORDERS_TLS']\n\t\t// });\n\n\t\t// let that = this;\n\n\t\t// let chemicalNames = await Chemicals.find({}).select('description');\n\t\t// let jobNames = await Jobs.find({status: 'Active'}).select('well');\n\n\t\t// console.log(jobNames.map(a => a.well));\n\n\t\t// this._imap.once('ready', () => {\n\t\t// \tthis._imap.openBox('INBOX', true, function(err, box) {\n\t\t// \t\tif (err) {\n\t\t// \t\t\tthrow err;\n\t\t// \t\t}\n\n\t\t// \t\tthat._imap.search([ 'NEW' ], function(err, results) {\n\n\t\t// \t\t\tconsole.log(err, results);\n\n\t\t// \t\t\tif (err || !results.length) {\n\t\t// \t\t\t\treturn that._imap.end();\n\t\t// \t\t\t}\n\n\t\t// \t\t\tlet f = that._imap.fetch(results[0], { bodies: ['HEADER.FIELDS (FROM)', 'TEXT'] });\n\t\t// \t\t\tf.on('message', function(msg, seqno) {\n\t\t// \t\t\t\t// console.log('Message #%d', seqno);\n\t\t// \t\t\t\tlet prefix = '(#' + seqno + ') ';\n\t\t// \t\t\t\tmsg.on('body', function(stream, info) {\n\t\t// \t\t\t\t\tlet buffer = '', count = 0;\n\t\t// \t\t\t\t\tstream.on('data', function(chunk) {\n\t\t// \t\t\t\t\t\tcount += chunk.length;\n\t\t// \t\t\t\t\t\tbuffer += chunk.toString('utf8');\n\t\t// \t\t\t\t\t});\n\t\t// \t\t\t\t\tstream.once('end', function() {\n\t\t// \t\t\t\t\t\tif (info.which === 'TEXT') {\n\t\t// \t\t\t\t\t\t\t// console.log(buffer);\n\t\t// \t\t\t\t\t\t\t// console.log(typeof(buffer));\n\t\t// \t\t\t\t\t\t\tlet lines = buffer.split('\\r\\n');\n\t\t// \t\t\t\t\t\t\t// console.log(lines);\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t// \t\t\t\t\t\t\t// let i = 0;\n\t\t// \t\t\t\t\t\t\t// lines.forEach(line => {\n\n\t\t// \t\t\t\t\t\t\t// \tlet date: Date;\n\t\t// \t\t\t\t\t\t\t// \tlet dateString;\n\n\t\t// \t\t\t\t\t\t\t// \tif (line.includes('From')) {\n\t\t// \t\t\t\t\t\t\t// \t\tconsole.log(line);\n\t\t// \t\t\t\t\t\t\t// \t}\n\t\t// \t\t\t\t\t\t\t// \tif (!line.includes('class=3D') && !line.includes('style=3D')) {\n\t\t// \t\t\t\t\t\t\t// \t\tif (line.includes('Well') || line.includes('Well Name') || line.includes('Job') || line.includes('Pad')) {\n\t\t// \t\t\t\t\t\t\t// \t\t\tlet best = stringSimilarity.findBestMatch(line, jobNames.map(a => a.well)).bestMatch;\n\t\n\t\t// \t\t\t\t\t\t\t// \t\t\tif (best && best.rating > 0.5) {\n\t\t// \t\t\t\t\t\t\t// \t\t\t\tconsole.log('Well', line);\n\t\t// \t\t\t\t\t\t\t// \t\t\t}\n\t\t// \t\t\t\t\t\t\t// \t\t}\n\t\t// \t\t\t\t\t\t\t// \t\tif (line.includes('Product') || line.includes('Chemical')) {\n\t\t// \t\t\t\t\t\t\t// \t\t\tlet best = stringSimilarity.findBestMatch(line, chemicalNames.map(a => a.description)).bestMatch;\n\t\n\t\t// \t\t\t\t\t\t\t// \t\t\tif (best && best.rating > 0.5) {\n\t\t// \t\t\t\t\t\t\t// \t\t\t\tconsole.log('Chemical', line);\n\t\t// \t\t\t\t\t\t\t// \t\t\t}\n\t\t// \t\t\t\t\t\t\t// \t\t}\n\t\t// \t\t\t\t\t\t\t// \t\tif (line.includes('Quantity') || line.includes('Qty') || line.includes('Amount')) {\n\t\t// \t\t\t\t\t\t\t// \t\t\tconsole.log('Qty', line);\n\t\t// \t\t\t\t\t\t\t// \t\t}\n\t\t// \t\t\t\t\t\t\t// \t\tif (line.includes('Date')) {\n\t\t// \t\t\t\t\t\t\t// \t\t\tconsole.log('Date', line);\n\t\t// \t\t\t\t\t\t\t// \t\t\tconsole.log(moment(Date.parse(line)));\n\t\t// \t\t\t\t\t\t\t// \t\t\tdate = moment(Date.parse(line)).toDate();\n\t\t// \t\t\t\t\t\t\t// \t\t\tdateString = line;\n\t\t// \t\t\t\t\t\t\t// \t\t}\n\t\t// \t\t\t\t\t\t\t// \t\tif (line.includes('Time')) {\n\t\t// \t\t\t\t\t\t\t// \t\t\tconsole.log('Time', line);\n\t\t// \t\t\t\t\t\t\t// \t\t\tconsole.log(moment(Date.parse(line)));\n\t\t// \t\t\t\t\t\t\t// \t\t\tconsole.log(moment(date.setTime(Date.parse(line))));\n\t\t// \t\t\t\t\t\t\t// \t\t}\n\t\t// \t\t\t\t\t\t\t// \t}\n\t\t// \t\t\t\t\t\t\t// });\n\t\t// \t\t\t\t\t\t}\n\t\t// \t\t\t\t\t});\n\t\t// \t\t\t\t});\n\t\t\t\t\t\n\t\t// \t\t\t\tmsg.once('attributes', function(attrs) {\n\t\t// \t\t\t\t\tconsole.log(prefix + 'Attributes: %s', inspect(attrs, false, 8));\n\t\t// \t\t\t\t});\n\n\t\t// \t\t\t\tmsg.once('end', function() {\n\t\t// \t\t\t\t\tconsole.log(prefix + 'Finished');\n\t\t// \t\t\t\t});\n\t\t// \t\t\t});\n\t\t\t\t\t\n\t\t// \t\t\tf.once('error', function(error) {\n\t\t// \t\t\t\tconsole.log('Fetch error: ' + error);\n\t\t// \t\t\t});\n\n\t\t// \t\t\tf.once('end', function() {\n\t\t// \t\t\t\tconsole.log('Done fetching all messages!');\n\t\t// \t\t\t\tthat._imap.end();\n\t\t// \t\t\t});\n\t\t// \t\t});\n\t\t// \t});\n\t\t// });\n\n\t\t// this._imap.connect();\n\n\t\tthis._aws = new aws.S3({\n\t\t\taccessKeyId: serverConfig.AWSACCESSKEYID,\n\t\t\tsecretAccessKey: serverConfig.AWSSECRETACCESSKEY,\n\t\t\tregion: serverConfig.AWSREGION\n\t\t});\n\n\t\tsetInterval(() => {\n\t\t\tif (!this._runningQueue) {\n\t\t\t\tif (this._sendQueue.length) {\n\t\t\t\t\tthis._runningQueue = true;\n\t\t\t\t\tfor (let i = this._sendQueue.length - 1; i >= 0; i--) {\n\t\t\t\t\t\tlet ws = this._mainServer.getWS(this._sendQueue[i].id_ws);\n\t\t\t\t\t\tif (ws && ws.readyState === ws.OPEN) {\n\t\t\t\t\t\t\tif (ws.bufferedAmount < 20480) {\n\t\t\t\t\t\t\t\tlet sendItem = this._sendQueue.pop();\n\t\t\t\t\t\t\t\tws.send(JSON.stringify(sendItem.data), (error) => {\n\t\t\t\t\t\t\t\t\tif (error) {\n\t\t\t\t\t\t\t\t\t\tconsole.log('Error on WS: ', error);\n\t\t\t\t\t\t\t\t\t\tthis._mainServer.unsubscribeWS(ws);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\tif (sendItem.method !== 'reportBuilderGetResults' && sendItem.method !== 'reportBuilderGetDistinctValue' && sendItem.method !== 'reportBuilderBuildTree' && sendItem.method !== 'generatePDF' && sendItem.method !== 'getWOOfflineData' && sendItem.method !== 'countQuery' && sendItem.method !== 'countWithQuery' && sendItem.method !== 'countCollectionWithQuery' && sendItem.method !== 'find' && sendItem.method !== 'findOne' && sendItem.method !== 'findWithOptions' && sendItem.method !== 'setWSAppVersion' && sendItem.method !== 'uploadFileAndSave' && sendItem.method !== 'getDrivers') {\n\t\t\t\t\t\t\t\t\tLogs.insertOne({\n\t\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\t\ttype: 'client-response',\n\t\t\t\t\t\t\t\t\t\tcollection: '',\n\t\t\t\t\t\t\t\t\t\tid_document: '',\n\t\t\t\t\t\t\t\t\t\tpayload: getBinarySize(JSON.stringify([sendItem.methodData, sendItem.data])) < 200000 ? JSON.stringify([sendItem.methodData, sendItem.data], null, 2) : 'Too Big',\n\t\t\t\t\t\t\t\t\t\tmethod: sendItem.method,\n\t\t\t\t\t\t\t\t\t\tid_user: ws['id_user'] || '',\n\t\t\t\t\t\t\t\t\t\tuser: ws['user'] || '',\n\t\t\t\t\t\t\t\t\t\tmessageId: sendItem.data.messageId,\n\t\t\t\t\t\t\t\t\t\troute: ''\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tMethodResponses.create({\n\t\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\t\t\t\tid_user: ws['id_user'] || '',\n\t\t\t\t\t\t\t\t\tmessage_id: sendItem.data.messageId,\n\t\t\t\t\t\t\t\t\tresponse: getBinarySize(JSON.stringify(sendItem.data)) < 200000 ? sendItem.data : {error: 'Too Big'},\n\t\t\t\t\t\t\t\t\tmethod: sendItem.method,\n\t\t\t\t\t\t\t\t\tdate: sendItem.date\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tthis._sendQueue.splice(i, 1);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._runningQueue = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}, 1);\n\t}\n\n\tpublic getMainServer() {\n\t\treturn this._mainServer;\n\t}\n\n\t// Add methods to private methods object\n\tpublic methods(method: MethodModel) {\n\t\tthis._methods = Object.assign(this._methods, method);\n\t}\n\n\tpublic callMethodCron(method: string, ...methodData: any[]) {\n\t\tlet that = this;\n\n\t\tif (!that._methods[method]) {\n\t\t\tconsole.log('No Method: ' + method);\n\n\t\t\tthat.sendEmail('dev@resolveio.com', 'SERVER - Error Detected - ' + that.serverConfig['CLIENT_NAME'], 'No Method: ' + method);\n\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif ((methodData.length > 1 || methodData[0]) && !that._methods[method].skipValidation) {\n\t\t\tif (!that._methods[method].check) {\n\t\t\t\tconsole.error(new Date(), 'No Check Function For Method ' + method);\n\n\t\t\t\tthat.sendEmail('dev@resolveio.com', 'SERVER - Error Detected - ' + that.serverConfig['CLIENT_NAME'], 'No Check Function For Method ' + method);\n\t\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse if (!that._methods[method].check._schema) {\n\t\t\t\tconsole.error(new Date(), 'No Check Schema For Method ' + method);\n\n\t\t\t\tthat.sendEmail('dev@resolveio.com', 'SERVER - Error Detected - ' + that.serverConfig['CLIENT_NAME'], 'No Check Function For Method ' + method);\n\t\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tlet valObj = {};\n\t\t\t\tlet valKeys = Object.keys(that._methods[method].check._schema);\n\n\t\t\t\tlet rootKeys = valKeys.filter(a => !a.includes('.'));\n\t\t\t\t\n\t\t\t\tfor (let i = 0; i < methodData.length; i++) {\n\t\t\t\t\tvalObj[rootKeys[i]] = methodData[i];\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tthat._methods[method].check.validate(valObj);\n\t\t\t\t}\n\t\t\t\tcatch (errors) {\n\t\t\t\t\tif (errors) {\n\t\t\t\t\t\tconsole.error(new Date(), 'Error in Method Check (' + method + ')', errors);\n\n\t\t\t\t\t\tthat.sendEmail('dev@resolveio.com', 'SERVER - Error Detected - ' + that.serverConfig['CLIENT_NAME'], 'Match Error On Method ' + method + '\\n\\nData Being Checked\\n' + JSON.stringify(valObj, null, 2) + '\\n\\nErrors\\n' + JSON.stringify(errors, null, 2));\n\t\t\t\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tlet monitor = new MonitorFunction('Cron Method', method, '', methodData);\n\t\tlet promise = that._methods[method].function.call(Object.assign({}, that, MethodManager.prototype, {id_user: '', user: '', id_ws: ''}), ...methodData)\n\t\t.then(res => {\n\t\t\tmonitor.finish();\n\t\t\treturn res;\n\t\t}, methodErrs => {\n\t\t\tmonitor.finish();\n\t\t\tthat.sendEmail('dev@resolveio.com', 'SERVER - Error Detected - ' + that.serverConfig['CLIENT_NAME'], 'Error Detected During Method ' + method + ' - (callMethodCron)\\n\\nData \\n' + JSON.stringify(methodData, null, 2) + '\\n\\nErrors\\n' + JSON.stringify(methodErrs, null, 2));\n\t\t\treturn methodErrs;\n\t\t});\n\n\t\treturn promise;\n\t}\n\n\t// Call/run method (Emit on Socket)\n\tpublic callMethod(id_methodLatency: string, ws: WebSocket, messageDate: Date, messageId: number, method: string, ...methodData: any[]) {\n\t\tlet that = this;\n\n\t\tif (!that._methods[method]) {\n\t\t\tconsole.log('No Method: ' + method);\n\n\t\t\tthat.sendEmail('dev@resolveio.com', 'SERVER - Error Detected - ' + that.serverConfig['CLIENT_NAME'], 'No Method: ' + method);\n\t\t\t\n\t\t\tlet serverRes: ServerResponseModel = {\n\t\t\t\tmessageId: messageId,\n\t\t\t\thasError: true,\n\t\t\t\tdata: 'Internal Error'\n\t\t\t};\n\n\t\t\tthis.sendWS(ws, messageDate, method, methodData, serverRes);\n\n\t\t\tif (id_methodLatency) {\n\t\t\t\tLogMethodLatencies.deleteOne({_id: id_methodLatency});\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tif ((methodData.length > 1 || methodData[0]) && !that._methods[method].skipValidation) {\n\t\t\tif (!that._methods[method].check) {\n\t\t\t\tconsole.error(new Date(), 'No Check Function For Method ' + method);\n\n\t\t\t\tthat.sendEmail('dev@resolveio.com', 'SERVER - Error Detected - ' + that.serverConfig['CLIENT_NAME'], 'No Check Function For Method ' + method);\n\t\t\t\t\n\t\t\t\tlet serverRes: ServerResponseModel = {\n\t\t\t\t\tmessageId: messageId,\n\t\t\t\t\thasError: true,\n\t\t\t\t\tdata: 'Internal Error'\n\t\t\t\t};\n\t\n\t\t\t\tthis.sendWS(ws, messageDate, method, methodData, serverRes);\n\n\t\t\t\tif (id_methodLatency) {\n\t\t\t\t\tLogMethodLatencies.deleteOne({_id: id_methodLatency});\n\t\t\t\t}\n\t\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse if (!that._methods[method].check._schema) {\n\t\t\t\tconsole.error(new Date(), 'No Check Schema For Method ' + method);\n\n\t\t\t\tthat.sendEmail('dev@resolveio.com', 'SERVER - Error Detected - ' + that.serverConfig['CLIENT_NAME'], 'No Check Function For Method ' + method);\n\t\t\t\t\n\t\t\t\tlet serverRes: ServerResponseModel = {\n\t\t\t\t\tmessageId: messageId,\n\t\t\t\t\thasError: true,\n\t\t\t\t\tdata: 'Internal Error'\n\t\t\t\t};\n\n\t\t\t\tif (id_methodLatency) {\n\t\t\t\t\tLogMethodLatencies.deleteOne({_id: id_methodLatency});\n\t\t\t\t}\n\t\n\t\t\t\tthis.sendWS(ws, messageDate, method, methodData, serverRes);\n\t\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tlet valObj = {};\n\t\t\t\tlet valKeys = Object.keys(that._methods[method].check._schema);\n\n\t\t\t\tlet rootKeys = valKeys.filter(a => !a.includes('.'));\n\t\t\t\t\n\t\t\t\tfor (let i = 0; i < methodData.length; i++) {\n\t\t\t\t\tvalObj[rootKeys[i]] = methodData[i];\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tthat._methods[method].check.validate(valObj);\n\t\t\t\t}\n\t\t\t\tcatch (errors) {\n\t\t\t\t\tif (errors) {\n\t\t\t\t\t\tconsole.error(new Date(), 'Error in Method Check (' + method + ')', errors);\n\n\t\t\t\t\t\tthat.sendEmail('dev@resolveio.com', 'SERVER - Error Detected - ' + that.serverConfig['CLIENT_NAME'], 'Match Error On Method ' + method + '\\n\\nData Being Checked\\n' + JSON.stringify(valObj, null, 2) + '\\n\\nErrors\\n' + JSON.stringify(errors, null, 2));\n\t\t\t\t\t\t\n\t\t\t\t\t\tlet serverRes: ServerResponseModel = {\n\t\t\t\t\t\t\tmessageId: messageId,\n\t\t\t\t\t\t\thasError: true,\n\t\t\t\t\t\t\tdata: 'Internal Error'\n\t\t\t\t\t\t};\n\t\t\t\t\t\t\n\t\t\t\t\t\tthis.sendWS(ws, messageDate, method, methodData, serverRes);\n\n\t\t\t\t\t\tif (id_methodLatency) {\n\t\t\t\t\t\t\tLogMethodLatencies.deleteOne({_id: id_methodLatency});\n\t\t\t\t\t\t}\n\t\t\t\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tlet monitor = new MonitorFunction('Method', method, ws['user'], methodData);\n\t\tthat._methods[method].function.call(Object.assign({}, that, MethodManager.prototype, {id_user: ws['id_user'], user: ws['user'], id_ws: ws['id_socket']}), ...methodData)\n\t\t.then(async (res) => {\n\t\t\tmonitor.finish();\n\n\t\t\tlet serverRes: ServerResponseModel = {\n\t\t\t\tmessageId: messageId,\n\t\t\t\thasError: false,\n\t\t\t\tdata: res\n\t\t\t};\n\n\t\t\tthis.sendWS(ws, messageDate, method, methodData, serverRes);\n\n\t\t\tif (id_methodLatency) {\n\t\t\t\tlet latency = await LogMethodLatencies.findById(id_methodLatency);\n\n\t\t\t\tif (latency) {\n\t\t\t\t\tLogMethodLatencies.updateOne({_id: id_methodLatency}, {$set: {date_end: new Date(), latency_ms: moment().diff(moment(latency.date_start), 'milliseconds', true)}});\n\t\t\t\t}\n\t\t\t}\n\t\t}, err => {\n\t\t\tmonitor.finish();\n\t\t\tlet serverRes: ServerResponseModel = {\n\t\t\t\tmessageId: messageId,\n\t\t\t\thasError: true,\n\t\t\t\tdata: err\n\t\t\t};\n\n\t\t\tthis.sendWS(ws, messageDate, method, methodData, serverRes);\n\n\t\t\tif (id_methodLatency) {\n\t\t\t\tLogMethodLatencies.deleteOne({_id: id_methodLatency});\n\t\t\t}\n\n\t\t\tthat.sendEmail('dev@resolveio.com', 'SERVER - Error Detected - ' + that.serverConfig['CLIENT_NAME'], 'Error Detected During Method ' + method + ' - (callMethod)\\n\\nData \\n' + JSON.stringify(methodData, null, 2) + '\\n\\nErrors\\n' + JSON.stringify(err, null, 2));\n\t\t});\n\t}\n\n\t// Call/run method internal (No Emit on Socket)\n\tpublic callMethodInternal(method, ...methodData: any[]): Promise<any> {\n\t\tlet that = this;\n\n\t\tif (!that._methods[method]) {\n\t\t\tconsole.log('No Method: ' + method);\n\t\t\treturn null;\n\t\t}\n\n\t\tif ((methodData.length > 1 || (methodData[0] && typeof(methodData[0]) !== 'function')) && !that._methods[method].skipValidation) {\n\t\t\tif (!that._methods[method].check) {\n\t\t\t\tconsole.error(new Date(), 'No Check Function For Method ' + method);\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\telse if (!that._methods[method].check._schema) {\n\t\t\t\tconsole.error(new Date(), 'No Check Schema For Method ' + method);\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\n\t\tif (method !== 'insertSubscriptionLog' && method !== 'getDataURIfromURL') {\n\t\t\tLogs.insertOne({\n\t\t\t\t_id: objectIdHexString(),\n\t\t\t\ttype: 'callMethodInternal',\n\t\t\t\tcollection: '',\n\t\t\t\tid_document: '',\n\t\t\t\tpayload: getBinarySize(JSON.stringify([methodData])) < 200000 ? JSON.stringify([methodData], null, 2) : 'Too Big',\n\t\t\t\tmethod: method,\n\t\t\t\tid_user: this['id_user'] || '',\n\t\t\t\tuser: this['user'] || '',\n\t\t\t\tmessageId: 0,\n\t\t\t\troute: ''\n\t\t\t});\n\t\t}\n\n\t\tlet monitor = new MonitorFunction('Internal Method', method, this['id_user'] || '', methodData);\n\t\tlet promise = that._methods[method].function.call(Object.assign({}, that, MethodManager.prototype), ...methodData)\n\t\t.then(res => {\n\t\t\tmonitor.finish();\n\t\t\treturn res;\n\t\t}, methodErrs => {\n\t\t\tmonitor.finish();\n\t\t\tthat.sendEmail('dev@resolveio.com', 'SERVER - Error Detected - ' + that.serverConfig['CLIENT_NAME'], 'Error Detected During Method ' + method + ' - (callMethodInternal)\\n\\nData \\n' + JSON.stringify(methodData, null, 2) + '\\n\\nErrors\\n' + JSON.stringify(methodErrs, null, 2));\n\t\t\treturn methodErrs;\n\t\t});\n\n\t\tif (methodData[methodData.length - 1] && typeof(methodData[methodData.length - 1]) === 'function') {\n\t\t\tpromise.then(res => methodData[methodData.length - 1](null, res), err => methodData[methodData.length - 1](err, null));\n\t\t}\n\t\t\n\t\treturn promise;\n\t}\n\n\tprivate sendWS(ws: WebSocket, messageDate: Date, method: string, methodData: any[], data: ServerResponseModel) {\n\t\tthis._sendQueue.splice(0, 0, {\n\t\t\tid_ws: ws['id_socket'],\n\t\t\tmethod: method,\n\t\t\tmethodData: methodData,\n\t\t\tdata: data,\n\t\t\tdate: messageDate\n\t\t});\n\t}\n\n\tpublic sendEmail(sendTo: string, subject: string, text?: string, html?: string, attachments?: any[], send_from?: string) {\n\t\treturn new Promise(async (resolve, reject) => {\n\t\t\tif ((this.serverConfig['ROOT_URL'].match(new RegExp(/https\\:\\/\\/dev\\./)) || this.serverConfig['ROOT_URL'].match(new RegExp(/https\\:\\/\\/www\\.dev\\./)) || this.serverConfig['ROOT_URL'] === 'http://localhost:4200') && !sendTo.match(new RegExp(/\\@resolveio\\.com/))) {\n\t\t\t\tsendTo = 'dev@resolveio.com';\n\t\t\t}\n\n\t\t\tif (sendTo) {\n\t\t\t\tif (this.serverConfig['ROOT_URL'] !== 'http://localhost:4200') {\n\t\t\t\t\tthis._mailer.sendMail({\n\t\t\t\t\t\treplyTo: undefined,\n\t\t\t\t\t\tfrom: send_from ? send_from : this.serverConfig.MAIL_FROM,\n\t\t\t\t\t\tto: sendTo,\n\t\t\t\t\t\tsubject: (this.serverConfig['ROOT_URL'].match(new RegExp(/https\\:\\/\\/dev\\./)) || this.serverConfig['ROOT_URL'].match(new RegExp(/https\\:\\/\\/www\\.dev\\./)) ? '(DEV SERVER) - ' : '') + subject,\n\t\t\t\t\t\ttext: text,\n\t\t\t\t\t\thtml: html,\n\t\t\t\t\t\tattachments: attachments\n\t\t\t\t\t}, (err, info) => {\n\t\t\t\t\t\tif (err) {\n\t\t\t\t\t\t\tconsole.log(err);\n\n\t\t\t\t\t\t\tEmailHistories.create({\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\t\t\tdate: new Date(),\n\t\t\t\t\t\t\t\tid_user: this['id_user'] || '',\n\t\t\t\t\t\t\t\tuser: this['user'] || '',\n\t\t\t\t\t\t\t\temail: sendTo,\n\t\t\t\t\t\t\t\tsuccess: false,\n\t\t\t\t\t\t\t\tverified: false\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tEmailHistories.create({\n\t\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\t\t\tdate: new Date(),\n\t\t\t\t\t\t\t\tid_user: this['id_user'] || '',\n\t\t\t\t\t\t\t\tuser: this['user'] || '',\n\t\t\t\t\t\t\t\temail: sendTo,\n\t\t\t\t\t\t\t\tsuccess: true,\n\t\t\t\t\t\t\t\tverified: false\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tconsole.log('Send email', sendTo, subject, text, html, attachments, send_from);\n\t\t\t\t}\n\n\t\t\t\tresolve(true);\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic getAWS(): aws.S3 {\n\t\treturn this._aws;\n\t}\n\n\tpublic readFile(fileName) {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tif (fs.existsSync(path.join(__dirname, ('../private/' + fileName)))) {\n\t\t\t\tfs.readFile(path.join(__dirname, ('../private/' + fileName)), 'utf-8', (err, res) => { \n\t\t\t\t\tif (err) {\n\t\t\t\t\t\treject(err);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tresolve(res);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (fs.existsSync(path.join(this.clientDir, ('./private/' + fileName)))) {\n\t\t\t\t\tfs.readFile(path.join(this.clientDir, ('./private/' + fileName)), 'utf-8', (err, res) => { \n\t\t\t\t\t\tif (err) {\n\t\t\t\t\t\t\treject(err);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tresolve(res);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic readImage(fileName) {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tif (fs.existsSync(path.join(__dirname, ('../private/' + fileName)))) {\n\t\t\t\tfs.readFile(path.join(__dirname, ('../private/' + fileName)), 'base64', (err, res) => { \n\t\t\t\t\tif (err) {\n\t\t\t\t\t\treject(err);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tresolve(res);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (fs.existsSync(path.join(this.clientDir, ('./private/' + fileName)))) {\n\t\t\t\t\tfs.readFile(path.join(this.clientDir, ('./private/' + fileName)), 'base64', (err, res) => { \n\t\t\t\t\t\tif (err) {\n\t\t\t\t\t\t\treject(err);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tresolve(res);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}"]}
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { AggregateOptions, BulkWriteOptions, ChangeStream, ChangeStreamOptions, ClientSession, CommandOperationOptions, CountDocumentsOptions, CreateCollectionOptions, CreateIndexesOptions, CursorStreamOptions, DeleteOptions, Filter, FindOneAndDeleteOptions, FindOneAndReplaceOptions, FindOneAndUpdateOptions, FindOptions, IndexDescription, InsertOneOptions, ListIndexesOptions, RenameOptions, ReplaceOptions, UpdateFilter, UpdateOptions } from 'mongodb';
2
+ import { AggregateOptions, AggregationCursor, BulkWriteOptions, ChangeStream, ChangeStreamOptions, CollStatsOptions, CommandOperationOptions, CountDocumentsOptions, CreateCollectionOptions, CreateIndexesOptions, CursorStreamOptions, DeleteOptions, Filter, FindOneAndDeleteOptions, FindOneAndReplaceOptions, FindOneAndUpdateOptions, FindOptions, IndexDescription, IndexInformationOptions, InsertOneOptions, ListIndexesOptions, RenameOptions, ReplaceOptions, UpdateFilter, UpdateOptions } from 'mongodb';
3
3
  import { LookupTables } from '../models/report-builder.model';
4
4
  import { UserModel } from '../models/user.model';
5
5
  interface MongoQueueModel {
@@ -66,18 +66,18 @@ export declare class Collection<T> {
66
66
  constructor(options: CollectionOptions);
67
67
  aggregate(pipeline: object[], options?: AggregateOptions, skipCache?: boolean): Promise<any[]>;
68
68
  aggregateCount(pipeline: object[], options?: AggregateOptions): Promise<number>;
69
- aggregateCursor(pipeline: object[], options?: AggregateOptions): import("mongodb").AggregationCursor<import("bson").Document>;
70
- aggregateStream(pipeline: object[], options?: AggregateOptions): import("stream").Readable;
71
- countDocuments(filter?: Filter<T>, options?: CountDocumentsOptions): Promise<number>;
69
+ aggregateCursor(pipeline: object[], options?: AggregateOptions): AggregationCursor;
70
+ aggregateStream(pipeline: object[], options?: AggregateOptions, streamOptions?: CursorStreamOptions): import("stream").Readable;
71
+ countDocuments(filter?: Filter<T>, options?: CountDocumentsOptions): Promise<unknown>;
72
72
  create(f_docs: T | T[], options?: InsertOneOptions | BulkWriteOptions): Promise<T | T[]>;
73
73
  createIndex(fieldOrSpec: any, options?: CreateIndexesOptions): Promise<unknown>;
74
- createIndexes(indexSpecs: IndexDescription[], options?: CreateIndexesOptions): Promise<string[]>;
74
+ createIndexes(indexSpecs: IndexDescription[], options?: CreateIndexesOptions): Promise<unknown>;
75
75
  deleteMany(filter?: Filter<T>, options?: DeleteOptions, bypassLogs?: boolean): Promise<unknown>;
76
76
  deleteOne(filter?: Filter<T>, options?: FindOneAndDeleteOptions, bypassLogs?: boolean): Promise<unknown>;
77
77
  distinct(key: string, filter?: Filter<T>, options?: CommandOperationOptions): Promise<T[]>;
78
- drop(options?: CommandOperationOptions): Promise<boolean>;
79
- dropIndex(indexName: string, options?: CommandOperationOptions): Promise<import("bson").Document>;
80
- dropIndexes(options?: CommandOperationOptions): Promise<import("bson").Document>;
78
+ drop(options?: CommandOperationOptions): Promise<unknown>;
79
+ dropIndex(indexName: string, options?: CommandOperationOptions): Promise<unknown>;
80
+ dropIndexes(options?: CommandOperationOptions): Promise<unknown>;
81
81
  find(filter?: Filter<T>, options?: FindOptions<T>, skipCache?: boolean): Promise<T[]>;
82
82
  findById(id: string, options?: FindOptions<T>): Promise<T>;
83
83
  findCount(filter?: Filter<T>, options?: FindOptions<T>): Promise<Number>;
@@ -87,21 +87,14 @@ export declare class Collection<T> {
87
87
  findOneAndDelete(filter?: Filter<T>, options?: FindOneAndDeleteOptions, bypassLogs?: boolean): Promise<T>;
88
88
  findOneAndReplace(filter: Filter<T>, replacement: T, options?: FindOneAndReplaceOptions, bypassLogs?: boolean, bypassCheckSchema?: boolean): Promise<T>;
89
89
  findOneAndUpdate(filter: Filter<T>, update: any, options?: FindOneAndUpdateOptions, bypassLogs?: boolean, bypassCheckSchema?: boolean): Promise<T>;
90
- indexes(options?: {
91
- session: ClientSession;
92
- }): Promise<import("bson").Document[]>;
93
- indexExists(indexes: string | string[], options?: {
94
- session: ClientSession;
95
- }): Promise<boolean>;
90
+ indexes(options: IndexInformationOptions): Promise<unknown>;
91
+ indexExists(indexes: string | string[], options?: IndexInformationOptions): Promise<unknown>;
96
92
  insertMany(docs: T[], options?: BulkWriteOptions, bypassLogs?: boolean, bypassCheckSchema?: boolean): Promise<T[]>;
97
93
  insertOne(doc: T, options?: InsertOneOptions, bypassLogs?: boolean, bypassCheckSchema?: boolean): Promise<T>;
98
94
  listIndexes(options?: ListIndexesOptions): import("mongodb").ListIndexesCursor;
99
- rename(newName: string, options?: RenameOptions): Promise<import("mongodb").Collection<import("bson").Document>>;
95
+ rename(newName: string, options?: RenameOptions): Promise<unknown>;
100
96
  replaceOne(filter: Filter<T>, replacement: T, options?: ReplaceOptions, bypassLogs?: boolean, bypassCheckSchema?: boolean, doc?: T): Promise<number>;
101
- stats(options?: {
102
- scale: number;
103
- session?: ClientSession;
104
- }): Promise<import("mongodb").CollStats>;
97
+ stats(options?: CollStatsOptions): Promise<unknown>;
105
98
  updateMany(filter: Filter<T>, update: UpdateFilter<T>, options?: UpdateOptions, bypassLogs?: boolean, bypassCheckSchema?: boolean, bypassVersions?: boolean): Promise<number>;
106
99
  updateOne(filter: Filter<T>, update: UpdateFilter<T>, options?: UpdateOptions, bypassLogs?: boolean, bypassCheckSchema?: boolean): Promise<number>;
107
100
  watchCollection(pipeline?: any[], options?: ChangeStreamOptions): ChangeStream<T>;