@resolveio/server-lib 1.0.16 → 1.0.17
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.
|
@@ -12,6 +12,7 @@ export declare class SupportManager {
|
|
|
12
12
|
getMainServer(): ResolveIOMainServer;
|
|
13
13
|
supportMethods(supportMethod: SupportMethodModel): void;
|
|
14
14
|
callSupportMethod(ws: WebSocket, messageId: any, supportMethod: any, ...methodData: any[]): void;
|
|
15
|
+
callMethodInternal(supportMethod: any, ...methodData: any[]): Promise<any>;
|
|
15
16
|
private sendWS;
|
|
16
17
|
sendEmail(sendTo: string, subject: string, text?: string, html?: string, attachments?: any[]): void;
|
|
17
18
|
}
|
|
@@ -180,6 +180,33 @@ var SupportManager = /** @class */ (function () {
|
|
|
180
180
|
_this.sendWS(ws, supportMethod, methodData, serverRes);
|
|
181
181
|
});
|
|
182
182
|
};
|
|
183
|
+
SupportManager.prototype.callMethodInternal = function (supportMethod) {
|
|
184
|
+
var methodData = [];
|
|
185
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
186
|
+
methodData[_i - 1] = arguments[_i];
|
|
187
|
+
}
|
|
188
|
+
var _a;
|
|
189
|
+
var that = this;
|
|
190
|
+
if (!that._supportMethods[supportMethod]) {
|
|
191
|
+
console.log('No Support Method: ' + supportMethod);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
if ((methodData.length > 1 || (methodData[0] && typeof (methodData[0]) !== 'function')) && !that._supportMethods[supportMethod].skipValidation) {
|
|
195
|
+
if (!that._supportMethods[supportMethod].check) {
|
|
196
|
+
console.error('No Check Function For Method ' + supportMethod);
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
else if (!that._supportMethods[supportMethod].check._schema) {
|
|
200
|
+
console.error('No Check Schema For Method ' + supportMethod);
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
var promise = (_a = that._supportMethods[supportMethod].function).call.apply(_a, [Object.assign({}, that, SupportManager.prototype)].concat(methodData));
|
|
205
|
+
if (methodData[methodData.length - 1] && typeof (methodData[methodData.length - 1]) === 'function') {
|
|
206
|
+
promise.then(function (res) { return methodData[methodData.length - 1](null, res); }, function (err) { return methodData[methodData.length - 1](err, null); });
|
|
207
|
+
}
|
|
208
|
+
return promise;
|
|
209
|
+
};
|
|
183
210
|
SupportManager.prototype.sendWS = function (ws, method, methodData, data) {
|
|
184
211
|
this._sendQueue.splice(0, 0, {
|
|
185
212
|
id_ws: ws['id_socket'],
|