@resolveio/server-lib 4.0.6 → 4.0.7

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.
package/index.d.ts CHANGED
@@ -8,7 +8,7 @@ export declare class ResolveIOServer {
8
8
  private static _clientDir;
9
9
  private static _dontRunSupport;
10
10
  constructor(serverConfig: any, client: string, clientDir: any, _dontRunSupport?: any);
11
- static connectAndRun(): Promise<{}>;
11
+ static connectAndRun(): Promise<unknown>;
12
12
  static getClientName(): string;
13
13
  static getMainServer(): ResolveIOMainServer;
14
14
  static getMainDB(): any;
@@ -157,38 +157,38 @@ var CronManager = /** @class */ (function () {
157
157
  switch (_a.label) {
158
158
  case 0:
159
159
  if (!res) return [3 /*break*/, 9];
160
- if (!cron.method_run_data) return [3 /*break*/, 2];
161
- return [4 /*yield*/, this._mainServer.getMethodManager().callMethodCron(cron.method_run, cron.method_run_data)];
160
+ if (!res.method_run_data) return [3 /*break*/, 2];
161
+ return [4 /*yield*/, this._mainServer.getMethodManager().callMethodCron(res.method_run, res.method_run_data)];
162
162
  case 1:
163
163
  _a.sent();
164
164
  return [3 /*break*/, 4];
165
- case 2: return [4 /*yield*/, this._mainServer.getMethodManager().callMethodCron(cron.method_run)];
165
+ case 2: return [4 /*yield*/, this._mainServer.getMethodManager().callMethodCron(res.method_run)];
166
166
  case 3:
167
167
  _a.sent();
168
168
  _a.label = 4;
169
169
  case 4:
170
- if (!cron.method_complete) return [3 /*break*/, 8];
171
- if (!cron.method_complete_data) return [3 /*break*/, 6];
172
- return [4 /*yield*/, this._mainServer.getMethodManager().callMethodCron(cron.method_complete, cron.method_complete_data)];
170
+ if (!res.method_complete) return [3 /*break*/, 8];
171
+ if (!res.method_complete_data) return [3 /*break*/, 6];
172
+ return [4 /*yield*/, this._mainServer.getMethodManager().callMethodCron(res.method_complete, res.method_complete_data)];
173
173
  case 5:
174
174
  _a.sent();
175
175
  return [3 /*break*/, 8];
176
- case 6: return [4 /*yield*/, this._mainServer.getMethodManager().callMethodCron(cron.method_complete)];
176
+ case 6: return [4 /*yield*/, this._mainServer.getMethodManager().callMethodCron(res.method_complete)];
177
177
  case 7:
178
178
  _a.sent();
179
179
  _a.label = 8;
180
180
  case 8:
181
- if (cron.repeat) {
182
- nextDate = (this._cronManager.getJob(cron.name).nextDates().toDate()).setSeconds(0, 0);
181
+ if (res.repeat) {
182
+ nextDate = (this._cronManager.getJob(res.name).nextDates().toDate()).setSeconds(0, 0);
183
183
  cron_job_collection_1.CronJobs.updateOne({
184
184
  $and: [
185
- { _id: cron._id },
185
+ { _id: res._id },
186
186
  { running: true }
187
187
  ]
188
188
  }, { $set: { running: false, next_run: nextDate } }).exec();
189
189
  }
190
190
  else {
191
- cron_job_collection_1.CronJobs.deleteOne({ _id: cron._id }).exec();
191
+ cron_job_collection_1.CronJobs.deleteOne({ _id: res._id }).exec();
192
192
  }
193
193
  _a.label = 9;
194
194
  case 9: return [2 /*return*/];
@@ -16,13 +16,13 @@ export declare class MethodManager {
16
16
  getMainServer(): ResolveIOMainServer;
17
17
  methods(method: MethodModel): void;
18
18
  callMethodCron(method: string, ...methodData: any[]): void;
19
- callMethodQueue(update: QueueMethodModel): Promise<{}>;
19
+ callMethodQueue(update: QueueMethodModel): Promise<unknown>;
20
20
  callMethod(ws: WebSocket, messageDate: Date, messageId: number, method: string, ...methodData: any[]): void;
21
21
  callMethodInternal(method: any, ...methodData: any[]): Promise<any>;
22
22
  callSupportMethodInternal(supportMethod: any, ...methodData: any[]): Promise<any>;
23
23
  private sendWS;
24
24
  sendEmail(sendTo: string, subject: string, text?: string, html?: string, attachments?: any[], send_from?: string): void;
25
25
  getAWS(): aws.S3;
26
- readFile(fileName: any): Promise<{}>;
27
- readImage(fileName: any): Promise<{}>;
26
+ readFile(fileName: any): Promise<unknown>;
27
+ readImage(fileName: any): Promise<unknown>;
28
28
  }
@@ -361,8 +361,8 @@ var MethodManager = /** @class */ (function () {
361
361
  };
362
362
  // Call/run method (Emit on Socket)
363
363
  MethodManager.prototype.callMethod = function (ws, messageDate, messageId, method) {
364
- var _this = this;
365
364
  var _a;
365
+ var _this = this;
366
366
  var methodData = [];
367
367
  for (var _i = 4; _i < arguments.length; _i++) {
368
368
  methodData[_i - 4] = arguments[_i];
@@ -137,7 +137,8 @@ var SubscriptionManager = /** @class */ (function () {
137
137
  subscriptionData[_i - 3] = arguments[_i];
138
138
  }
139
139
  return __awaiter(this, void 0, void 0, function () {
140
- var _a, that, pub, valObj, valKeys, rootKeys, i, sub, _b, newActiveSub, begDate, endDate, billUser;
140
+ var that, pub, valObj, valKeys, rootKeys, i, sub, _a, newActiveSub, begDate, endDate, billUser;
141
+ var _b;
141
142
  return __generator(this, function (_c) {
142
143
  switch (_c.label) {
143
144
  case 0:
@@ -202,10 +203,10 @@ var SubscriptionManager = /** @class */ (function () {
202
203
  // Send pub data to client who just subscribed only, don't want to send to existing clients since nothing has changed
203
204
  that.sendPubDataOnce(ws, messageId, sub);
204
205
  if (!(that._publications[sub.publication].preFunction && !sub.preSubscriptionData)) return [3 /*break*/, 3];
205
- _b = sub;
206
- return [4 /*yield*/, (_a = that._publications[sub.publication]).preFunction.apply(_a, sub.subscriptionData)];
206
+ _a = sub;
207
+ return [4 /*yield*/, (_b = that._publications[sub.publication]).preFunction.apply(_b, sub.subscriptionData)];
207
208
  case 2:
208
- _b.preSubscriptionData = _c.sent();
209
+ _a.preSubscriptionData = _c.sent();
209
210
  _c.label = 3;
210
211
  case 3:
211
212
  newActiveSub = new active_subscription_collection_1.ActiveSubscriptions({
@@ -553,7 +554,8 @@ var SubscriptionManager = /** @class */ (function () {
553
554
  if (noFetchFunction === void 0) { noFetchFunction = false; }
554
555
  var that = this;
555
556
  that._subscriptions.filter(function (a) { return a.collections.includes(collection); }).forEach(function (sub) { return __awaiter(_this, void 0, void 0, function () {
556
- var _a, _b, schemaErrors, _c, _d;
557
+ var schemaErrors, _a, _b;
558
+ var _c, _d;
557
559
  return __generator(this, function (_e) {
558
560
  switch (_e.label) {
559
561
  case 0:
@@ -573,18 +575,18 @@ var SubscriptionManager = /** @class */ (function () {
573
575
  if (!sub.preSubscriptionData) return [3 /*break*/, 4];
574
576
  if (!that._publications[sub.publication].fetchFunction(document, sub.preSubscriptionData)) return [3 /*break*/, 4];
575
577
  that.sendPubData(sub);
576
- _c = sub;
577
- return [4 /*yield*/, (_a = that._publications[sub.publication]).preFunction.apply(_a, sub.subscriptionData)];
578
+ _a = sub;
579
+ return [4 /*yield*/, (_c = that._publications[sub.publication]).preFunction.apply(_c, sub.subscriptionData)];
578
580
  case 3:
579
- _c.preSubscriptionData = _e.sent();
581
+ _a.preSubscriptionData = _e.sent();
580
582
  return [2 /*return*/];
581
583
  case 4:
582
584
  if (!that._publications[sub.publication].preFunction) return [3 /*break*/, 7];
583
585
  if (!!noFetchFunction) return [3 /*break*/, 6];
584
- _d = sub;
586
+ _b = sub;
585
587
  return [4 /*yield*/, that._publications[sub.publication].preFunction(sub.subscriptionData)];
586
588
  case 5:
587
- _d.preSubscriptionData = _e.sent();
589
+ _b.preSubscriptionData = _e.sent();
588
590
  if (that._publications[sub.publication].fetchFunction(document, sub.preSubscriptionData)) {
589
591
  that.sendPubData(sub);
590
592
  }
@@ -617,7 +619,7 @@ var SubscriptionManager = /** @class */ (function () {
617
619
  else {
618
620
  if (that._publications[sub.publication].fetchFunction) {
619
621
  if (!noFetchFunction) {
620
- if ((_b = that._publications[sub.publication]).fetchFunction.apply(_b, [document].concat(sub.subscriptionData))) {
622
+ if ((_d = that._publications[sub.publication]).fetchFunction.apply(_d, [document].concat(sub.subscriptionData))) {
621
623
  that.sendPubData(sub);
622
624
  }
623
625
  }
@@ -636,7 +638,8 @@ var SubscriptionManager = /** @class */ (function () {
636
638
  var _this = this;
637
639
  var that = this;
638
640
  that._subscriptions.filter(function (a) { return a.collections.includes(collection); }).forEach(function (sub) { return __awaiter(_this, void 0, void 0, function () {
639
- var _a, _b, _c, schemaErrors, _d, _e;
641
+ var schemaErrors, _a, _b;
642
+ var _c, _d, _e;
640
643
  return __generator(this, function (_f) {
641
644
  switch (_f.label) {
642
645
  case 0:
@@ -656,17 +659,17 @@ var SubscriptionManager = /** @class */ (function () {
656
659
  if (!sub.preSubscriptionData) return [3 /*break*/, 4];
657
660
  if (!that._publications[sub.publication].fetchFunction(document, sub.preSubscriptionData)) return [3 /*break*/, 4];
658
661
  that.sendPubData(sub);
659
- _d = sub;
660
- return [4 /*yield*/, (_a = that._publications[sub.publication]).preFunction.apply(_a, sub.subscriptionData)];
662
+ _a = sub;
663
+ return [4 /*yield*/, (_c = that._publications[sub.publication]).preFunction.apply(_c, sub.subscriptionData)];
661
664
  case 3:
662
- _d.preSubscriptionData = _f.sent();
665
+ _a.preSubscriptionData = _f.sent();
663
666
  return [2 /*return*/];
664
667
  case 4:
665
668
  if (!that._publications[sub.publication].preFunction) return [3 /*break*/, 6];
666
- _e = sub;
667
- return [4 /*yield*/, (_b = that._publications[sub.publication]).preFunction.apply(_b, sub.subscriptionData)];
669
+ _b = sub;
670
+ return [4 /*yield*/, (_d = that._publications[sub.publication]).preFunction.apply(_d, sub.subscriptionData)];
668
671
  case 5:
669
- _e.preSubscriptionData = _f.sent();
672
+ _b.preSubscriptionData = _f.sent();
670
673
  if (that._publications[sub.publication].fetchFunction(document, sub.preSubscriptionData)) {
671
674
  that.sendPubData(sub);
672
675
  }
@@ -695,7 +698,7 @@ var SubscriptionManager = /** @class */ (function () {
695
698
  }
696
699
  else {
697
700
  if (that._publications[sub.publication].fetchFunction) {
698
- if ((_c = that._publications[sub.publication]).fetchFunction.apply(_c, [document].concat(sub.subscriptionData))) {
701
+ if ((_e = that._publications[sub.publication]).fetchFunction.apply(_e, [document].concat(sub.subscriptionData))) {
699
702
  that.sendPubData(sub);
700
703
  }
701
704
  }
@@ -712,7 +715,8 @@ var SubscriptionManager = /** @class */ (function () {
712
715
  // Fetch pub once, send to all clients linked to this pub
713
716
  SubscriptionManager.prototype.sendPubDataOnce = function (ws, messageId, subscription) {
714
717
  return __awaiter(this, void 0, void 0, function () {
715
- var _a, _b, that;
718
+ var that;
719
+ var _a, _b;
716
720
  var _this = this;
717
721
  return __generator(this, function (_c) {
718
722
  that = this;
@@ -757,7 +761,8 @@ var SubscriptionManager = /** @class */ (function () {
757
761
  // Fetch pub once, send to all clients linked to this pub
758
762
  SubscriptionManager.prototype.sendPubData = function (subscription) {
759
763
  return __awaiter(this, void 0, void 0, function () {
760
- var _a, that;
764
+ var that;
765
+ var _a;
761
766
  var _this = this;
762
767
  return __generator(this, function (_b) {
763
768
  that = this;
@@ -17,6 +17,6 @@ export declare class SupportManager {
17
17
  callMethodInternal(method: any, ...methodData: any[]): Promise<any>;
18
18
  private sendWS;
19
19
  sendEmail(sendTo: string, subject: string, text?: string, html?: string, attachments?: any[]): void;
20
- readFile(fileName: any): Promise<{}>;
21
- readImage(fileName: any): Promise<{}>;
20
+ readFile(fileName: any): Promise<unknown>;
21
+ readImage(fileName: any): Promise<unknown>;
22
22
  }
@@ -102,8 +102,8 @@ var SupportManager = /** @class */ (function () {
102
102
  };
103
103
  // Call/run method (Emit on Socket)
104
104
  SupportManager.prototype.callSupportMethod = function (ws, messageId, supportMethod) {
105
- var _this = this;
106
105
  var _a;
106
+ var _this = this;
107
107
  var methodData = [];
108
108
  for (var _i = 3; _i < arguments.length; _i++) {
109
109
  methodData[_i - 3] = arguments[_i];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resolveio/server-lib",
3
- "version": "4.0.6",
3
+ "version": "4.0.7",
4
4
  "description": "",
5
5
  "main": "index.ts",
6
6
  "scripts": {
package/server-app.js CHANGED
@@ -251,7 +251,8 @@ var ResolveIOMainServer = /** @class */ (function () {
251
251
  }, 10000);
252
252
  // On data received (message)
253
253
  ws.on('message', function (message) { return __awaiter(_this, void 0, void 0, function () {
254
- var _a, _b, socketData, data, messageDate, messageId, type, subType, pub;
254
+ var socketData, data, messageDate, messageId, type, subType, pub;
255
+ var _a, _b;
255
256
  var _this = this;
256
257
  return __generator(this, function (_c) {
257
258
  socketData = JSON.parse(message, common_1.dateReviver);
@@ -326,7 +327,8 @@ var ResolveIOMainServer = /** @class */ (function () {
326
327
  if (!!this._msgQueueRunning) return [3 /*break*/, 5];
327
328
  this._msgQueueRunning = true;
328
329
  _loop_1 = function (i) {
329
- var _a, _b, msg, data, ws, messageDate, messageId, type, method, serverRes, query, methodCall, supportMethod, serverRes;
330
+ var msg, data, ws, messageDate, messageId, type, method, serverRes, query, methodCall, supportMethod, serverRes;
331
+ var _a, _b;
330
332
  return __generator(this, function (_c) {
331
333
  switch (_c.label) {
332
334
  case 0: