@resolveio/server-lib 1.0.15 → 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'],
|
package/package.json
CHANGED
|
@@ -36,7 +36,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
};
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
38
|
var simpl_schema_1 = require("simpl-schema");
|
|
39
|
-
var support_ticket_collection_1 = require("../collections/support-ticket.collection");
|
|
40
39
|
var file_collection_1 = require("../collections/file.collection");
|
|
41
40
|
var handlebars = require("handlebars");
|
|
42
41
|
var user_collection_1 = require("../collections/user.collection");
|
|
@@ -46,7 +45,8 @@ function loadSupportMethods(supportManager) {
|
|
|
46
45
|
sendSupportTicketEmail: {
|
|
47
46
|
check: new simpl_schema_1.default({
|
|
48
47
|
supportTicket: {
|
|
49
|
-
type:
|
|
48
|
+
type: Object,
|
|
49
|
+
blackbox: true
|
|
50
50
|
},
|
|
51
51
|
id_files: {
|
|
52
52
|
type: Array
|
|
@@ -135,7 +135,8 @@ function loadSupportMethods(supportManager) {
|
|
|
135
135
|
sendSupportTicketModifiedEmail: {
|
|
136
136
|
check: new simpl_schema_1.default({
|
|
137
137
|
supportTicket: {
|
|
138
|
-
type:
|
|
138
|
+
type: Object,
|
|
139
|
+
blackbox: true
|
|
139
140
|
},
|
|
140
141
|
id_files: {
|
|
141
142
|
type: Array
|
|
@@ -210,7 +211,8 @@ function loadSupportMethods(supportManager) {
|
|
|
210
211
|
sendSupportTicketDeletedEmail: {
|
|
211
212
|
check: new simpl_schema_1.default({
|
|
212
213
|
supportTicket: {
|
|
213
|
-
type:
|
|
214
|
+
type: Object,
|
|
215
|
+
blackbox: true
|
|
214
216
|
}
|
|
215
217
|
}),
|
|
216
218
|
function: function (supportTicket) {
|