@resolveio/server-lib 1.0.20 → 1.0.21
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.
|
@@ -19,6 +19,7 @@ export declare class MethodManager {
|
|
|
19
19
|
callMethodQueue(update: QueueMethodModel): void;
|
|
20
20
|
callMethod(ws: WebSocket, messageId: any, method: any, ...methodData: any[]): void;
|
|
21
21
|
callMethodInternal(method: any, ...methodData: any[]): Promise<any>;
|
|
22
|
+
callSupportMethodInternal(supportMethod: any, ...methodData: any[]): Promise<any>;
|
|
22
23
|
private sendWS;
|
|
23
24
|
sendEmail(sendTo: string, subject: string, text?: string, html?: string, attachments?: any[]): void;
|
|
24
25
|
getAWS(): aws.S3;
|
|
@@ -20,6 +20,7 @@ var mongoose_1 = require("mongoose");
|
|
|
20
20
|
var common_1 = require("../util/common");
|
|
21
21
|
var log_collection_1 = require("../collections/log.collection");
|
|
22
22
|
var cron_jobs_3 = require("../support-methods/cron-jobs");
|
|
23
|
+
var support_manager_1 = require("./support.manager");
|
|
23
24
|
var MethodManager = /** @class */ (function () {
|
|
24
25
|
function MethodManager(mainServer, serverConfig, clientDir) {
|
|
25
26
|
var _this = this;
|
|
@@ -474,6 +475,33 @@ var MethodManager = /** @class */ (function () {
|
|
|
474
475
|
}
|
|
475
476
|
return promise;
|
|
476
477
|
};
|
|
478
|
+
MethodManager.prototype.callSupportMethodInternal = function (supportMethod) {
|
|
479
|
+
var methodData = [];
|
|
480
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
481
|
+
methodData[_i - 1] = arguments[_i];
|
|
482
|
+
}
|
|
483
|
+
var _a;
|
|
484
|
+
var that = this;
|
|
485
|
+
if (!that.getMainServer().getSupportManager()._supportMethods[supportMethod]) {
|
|
486
|
+
console.log('No Support Method: ' + supportMethod);
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
if ((methodData.length > 1 || (methodData[0] && typeof (methodData[0]) !== 'function')) && !that.getMainServer().getSupportManager()._supportMethods[supportMethod].skipValidation) {
|
|
490
|
+
if (!that.getMainServer().getSupportManager()._supportMethods[supportMethod].check) {
|
|
491
|
+
console.error('No Check Function For Method ' + supportMethod);
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
else if (!that.getMainServer().getSupportManager()._supportMethods[supportMethod].check._schema) {
|
|
495
|
+
console.error('No Check Schema For Method ' + supportMethod);
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
var promise = (_a = that.getMainServer().getSupportManager()._supportMethods[supportMethod].function).call.apply(_a, [Object.assign({}, that, support_manager_1.SupportManager.prototype)].concat(methodData));
|
|
500
|
+
if (methodData[methodData.length - 1] && typeof (methodData[methodData.length - 1]) === 'function') {
|
|
501
|
+
promise.then(function (res) { return methodData[methodData.length - 1](null, res); }, function (err) { return methodData[methodData.length - 1](err, null); });
|
|
502
|
+
}
|
|
503
|
+
return promise;
|
|
504
|
+
};
|
|
477
505
|
MethodManager.prototype.sendWS = function (ws, method, methodData, data) {
|
|
478
506
|
this._sendQueue.splice(0, 0, {
|
|
479
507
|
id_ws: ws['id_socket'],
|