@resolveio/server-lib 6.4.23 → 7.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.
Files changed (68) hide show
  1. package/collections/counter.collection.d.ts +0 -2
  2. package/collections/counter.collection.js +0 -14
  3. package/collections/counter.collection.js.map +1 -1
  4. package/collections/file.collection.d.ts +0 -2
  5. package/collections/file.collection.js +0 -14
  6. package/collections/file.collection.js.map +1 -1
  7. package/collections/user.collection.d.ts +0 -1
  8. package/collections/user.collection.js +0 -4
  9. package/collections/user.collection.js.map +1 -1
  10. package/fixtures/cron-jobs.js +0 -17
  11. package/fixtures/cron-jobs.js.map +1 -1
  12. package/http/auth.js +176 -20
  13. package/http/auth.js.map +1 -1
  14. package/http/home.js +37 -0
  15. package/http/home.js.map +1 -1
  16. package/index.d.ts +1 -4
  17. package/index.js +22 -71
  18. package/index.js.map +1 -1
  19. package/managers/method.manager.d.ts +0 -1
  20. package/managers/method.manager.js +2 -28
  21. package/managers/method.manager.js.map +1 -1
  22. package/managers/subscription.manager.d.ts +0 -3
  23. package/managers/subscription.manager.js +19 -142
  24. package/managers/subscription.manager.js.map +1 -1
  25. package/methods/cron-jobs.js +0 -68
  26. package/methods/cron-jobs.js.map +1 -1
  27. package/methods/support.d.ts +2 -0
  28. package/methods/support.js +439 -0
  29. package/methods/support.js.map +1 -0
  30. package/package.json +1 -1
  31. package/publications/files.js +0 -31
  32. package/publications/files.js.map +1 -1
  33. package/server-app.d.ts +0 -4
  34. package/server-app.js +11 -71
  35. package/server-app.js.map +1 -1
  36. package/client-server-app.d.ts +0 -1
  37. package/client-server-app.js +0 -48
  38. package/client-server-app.js.map +0 -1
  39. package/collections/billing-logged-in-users.collection.d.ts +0 -7
  40. package/collections/billing-logged-in-users.collection.js +0 -75
  41. package/collections/billing-logged-in-users.collection.js.map +0 -1
  42. package/collections/support-ticket.collection.d.ts +0 -7
  43. package/collections/support-ticket.collection.js +0 -226
  44. package/collections/support-ticket.collection.js.map +0 -1
  45. package/managers/support.manager.d.ts +0 -22
  46. package/managers/support.manager.js +0 -329
  47. package/managers/support.manager.js.map +0 -1
  48. package/models/support-method.model.d.ts +0 -9
  49. package/models/support-method.model.js +0 -4
  50. package/models/support-method.model.js.map +0 -1
  51. package/publications/billing-logged-in-users.d.ts +0 -1
  52. package/publications/billing-logged-in-users.js +0 -65
  53. package/publications/billing-logged-in-users.js.map +0 -1
  54. package/publications/support-tickets.d.ts +0 -1
  55. package/publications/support-tickets.js +0 -203
  56. package/publications/support-tickets.js.map +0 -1
  57. package/support-methods/aws.d.ts +0 -2
  58. package/support-methods/aws.js +0 -279
  59. package/support-methods/aws.js.map +0 -1
  60. package/support-methods/collections.d.ts +0 -2
  61. package/support-methods/collections.js +0 -475
  62. package/support-methods/collections.js.map +0 -1
  63. package/support-methods/counters.d.ts +0 -2
  64. package/support-methods/counters.js +0 -192
  65. package/support-methods/counters.js.map +0 -1
  66. package/support-methods/support.d.ts +0 -2
  67. package/support-methods/support.js +0 -282
  68. package/support-methods/support.js.map +0 -1
@@ -0,0 +1,2 @@
1
+ import { MethodManager } from '../managers/method.manager';
2
+ export declare function loadSupportMethods(methodManager: MethodManager): void;
@@ -0,0 +1,439 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var simpl_schema_1 = require("simpl-schema");
4
+ var request = require("request");
5
+ function loadSupportMethods(methodManager) {
6
+ methodManager.methods({
7
+ supportCreateBillingUser: {
8
+ check: new simpl_schema_1.default({
9
+ user: {
10
+ type: Object,
11
+ blackbox: true
12
+ }
13
+ }),
14
+ function: function (user) {
15
+ return new Promise(function (resolve, reject) {
16
+ request({
17
+ method: 'POST',
18
+ url: 'https://resolveio.com/api/support/billing-user',
19
+ headers: {
20
+ 'Content-Type': 'application/json; charset=UTF-8'
21
+ },
22
+ json: user
23
+ }, (function (error, response, body) {
24
+ if (!error && body && !body.error) {
25
+ resolve(body.result);
26
+ }
27
+ else {
28
+ reject(error || body.result);
29
+ }
30
+ }));
31
+ });
32
+ }
33
+ },
34
+ supportGetSupportTicketWithId: {
35
+ check: new simpl_schema_1.default({
36
+ id_support_ticket: {
37
+ type: String
38
+ }
39
+ }),
40
+ function: function (user) {
41
+ return new Promise(function (resolve, reject) {
42
+ request({
43
+ method: 'POST',
44
+ url: 'https://resolveio.com/api/support/supportTicketWithId',
45
+ headers: {
46
+ 'Content-Type': 'application/json; charset=UTF-8'
47
+ },
48
+ json: user
49
+ }, (function (error, response, body) {
50
+ if (!error && body && !body.error) {
51
+ resolve(body.result);
52
+ }
53
+ else {
54
+ reject(error || body.result);
55
+ }
56
+ }));
57
+ });
58
+ }
59
+ },
60
+ supportInsertSupportTicket: {
61
+ skipValidation: true,
62
+ function: function (supportTicket) {
63
+ return new Promise(function (resolve, reject) {
64
+ request({
65
+ method: 'POST',
66
+ url: 'https://resolveio.com/api/support/supportInsertTicket',
67
+ headers: {
68
+ 'Content-Type': 'application/json; charset=UTF-8'
69
+ },
70
+ json: supportTicket
71
+ }, (function (error, response, body) {
72
+ if (!error && body && !body.error) {
73
+ resolve(body.result);
74
+ }
75
+ else {
76
+ reject(error || body.result);
77
+ }
78
+ }));
79
+ });
80
+ }
81
+ },
82
+ supportUpdateSupportTicket: {
83
+ skipValidation: true,
84
+ function: function (supportTicket) {
85
+ return new Promise(function (resolve, reject) {
86
+ request({
87
+ method: 'POST',
88
+ url: 'https://resolveio.com/api/support/supportUpdateTicket',
89
+ headers: {
90
+ 'Content-Type': 'application/json; charset=UTF-8'
91
+ },
92
+ json: supportTicket
93
+ }, (function (error, response, body) {
94
+ if (!error && body && !body.error) {
95
+ resolve(body.result);
96
+ }
97
+ else {
98
+ reject(error || body.result);
99
+ }
100
+ }));
101
+ });
102
+ }
103
+ },
104
+ supportDeleteSupportTicket: {
105
+ skipValidation: true,
106
+ function: function (supportTicket) {
107
+ return new Promise(function (resolve, reject) {
108
+ request({
109
+ method: 'POST',
110
+ url: 'https://resolveio.com/api/support/supportUpdateTicket',
111
+ headers: {
112
+ 'Content-Type': 'application/json; charset=UTF-8'
113
+ },
114
+ json: supportTicket
115
+ }, (function (error, response, body) {
116
+ if (!error && body && !body.error) {
117
+ resolve(body.result);
118
+ }
119
+ else {
120
+ reject(error || body.result);
121
+ }
122
+ }));
123
+ });
124
+ }
125
+ },
126
+ supportticketsWithOptions: {
127
+ check: new simpl_schema_1.default({
128
+ options: {
129
+ type: Object
130
+ },
131
+ 'options.limit': {
132
+ type: Number
133
+ },
134
+ 'options.skip': {
135
+ type: Number
136
+ },
137
+ 'options.sort': {
138
+ type: Object,
139
+ blackbox: true
140
+ },
141
+ 'options.fields': {
142
+ type: Object,
143
+ blackbox: true
144
+ },
145
+ searchString: {
146
+ type: String
147
+ },
148
+ filters: {
149
+ type: Array
150
+ },
151
+ 'filters.$': {
152
+ type: Object,
153
+ blackbox: true
154
+ }
155
+ }),
156
+ function: function (options, searchString, filters) {
157
+ return new Promise(function (resolve, reject) {
158
+ request({
159
+ method: 'POST',
160
+ url: 'https://resolveio.com/api/support/supportticketsWithOptions',
161
+ headers: {
162
+ 'Content-Type': 'application/json; charset=UTF-8'
163
+ },
164
+ json: [options, searchString, filters]
165
+ }, (function (error, response, body) {
166
+ if (!error && body && !body.error) {
167
+ resolve(body.result);
168
+ }
169
+ else {
170
+ reject(error || body.result);
171
+ }
172
+ }));
173
+ });
174
+ }
175
+ },
176
+ supportticketCount: {
177
+ check: new simpl_schema_1.default({
178
+ searchString: {
179
+ type: String
180
+ },
181
+ filters: {
182
+ type: Array
183
+ },
184
+ 'filters.$': {
185
+ type: Object,
186
+ blackbox: true
187
+ }
188
+ }),
189
+ function: function (searchString, filters) {
190
+ return new Promise(function (resolve, reject) {
191
+ request({
192
+ method: 'POST',
193
+ url: 'https://resolveio.com/api/support/supportCountTickets',
194
+ headers: {
195
+ 'Content-Type': 'application/json; charset=UTF-8'
196
+ },
197
+ json: [searchString, filters]
198
+ }, (function (error, response, body) {
199
+ if (!error && body && !body.error) {
200
+ resolve(body.result);
201
+ }
202
+ else {
203
+ reject(error || body.result);
204
+ }
205
+ }));
206
+ });
207
+ }
208
+ }
209
+ // sendSupportTicketEmail: {
210
+ // check: new SimpleSchema({
211
+ // supportTicket: {
212
+ // type: Object,
213
+ // blackbox: true
214
+ // },
215
+ // id_files: {
216
+ // type: Array,
217
+ // optional: true
218
+ // },
219
+ // 'id_files.$': {
220
+ // type: String
221
+ // }
222
+ // }),
223
+ // function: function(supportTicket: SupportTicketModel, id_files?: string[]) {
224
+ // return new Promise(async (resolve, reject) => {
225
+ // if (id_files && id_files.length) {
226
+ // let files = await Files.find({
227
+ // _id: {$in: id_files}
228
+ // });
229
+ // this.callMethodInternal.call(this, 'getSignedUrls', files.map(a => a.key), 900, (err, res) => {
230
+ // if (res) {
231
+ // this.readFile('email-templates/support-ticket.html').then(async html => {
232
+ // let template = handlebars.compile(html);
233
+ // handlebars.registerHelper('greaterThan', (a, b) => {
234
+ // return a > b;
235
+ // });
236
+ // handlebars.registerHelper('equals', (a, b) => {
237
+ // return a === b;
238
+ // });
239
+ // let filesAttached = [];
240
+ // let fileCnt = 0;
241
+ // res.forEach(url => {
242
+ // filesAttached.push({filename: files[fileCnt].name, path: url});
243
+ // fileCnt++;
244
+ // });
245
+ // this.readImage('images/ResolveIO.png').then(logoData => {
246
+ // supportTicket['logo'] = 'data:image/png;base64,' + logoData;
247
+ // if (supportTicket.client_user && supportTicket.client_user.email) {
248
+ // supportTicket['user'] = supportTicket.client_user.user;
249
+ // supportTicket['fileAttached'] = filesAttached;
250
+ // this.sendEmail(
251
+ // supportTicket.client_user.email,
252
+ // 'ResolveIO - ' + supportTicket.support_ticket_number_string + ' Priority: ' + supportTicket.priority,
253
+ // '',
254
+ // template(supportTicket),
255
+ // filesAttached
256
+ // );
257
+ // }
258
+ // }, err => {
259
+ // console.log(err);
260
+ // });
261
+ // resolve(true);
262
+ // }, err => {
263
+ // console.log(err);
264
+ // });
265
+ // resolve(true);
266
+ // }
267
+ // else {
268
+ // this.callMethodInternal.call(this, 'insertErrorLog', 'supportTicketsmethod - getsignedurl', [
269
+ // files.map(a => a.key), err
270
+ // ]);
271
+ // reject(err);
272
+ // }
273
+ // });
274
+ // }
275
+ // else {
276
+ // this.readFile('email-templates/support-ticket.html').then(async html => {
277
+ // let template = handlebars.compile(html);
278
+ // handlebars.registerHelper('greaterThan', (a, b) => {
279
+ // return a > b;
280
+ // });
281
+ // handlebars.registerHelper('equals', (a, b) => {
282
+ // return a === b;
283
+ // });
284
+ // this.readImage('images/ResolveIO.png').then(logoData => {
285
+ // supportTicket['logo'] = 'data:image/png;base64,' + logoData;
286
+ // if (supportTicket.client_user && supportTicket.client_user.email) {
287
+ // supportTicket['user'] = supportTicket.client_user.user;
288
+ // this.sendEmail(
289
+ // supportTicket.client_user.email,
290
+ // 'ResolveIO - ' + supportTicket.support_ticket_number_string + ' Priority: ' + supportTicket.priority,
291
+ // '',
292
+ // template(supportTicket),
293
+ // null
294
+ // );
295
+ // }
296
+ // }, err => {
297
+ // console.log(err);
298
+ // });
299
+ // resolve(true);
300
+ // }, err => {
301
+ // console.log(err);
302
+ // });
303
+ // resolve(true);
304
+ // }
305
+ // });
306
+ // }
307
+ // },
308
+ // sendSupportTicketModifiedEmail: {
309
+ // check: new SimpleSchema({
310
+ // supportTicket: {
311
+ // type: Object,
312
+ // blackbox: true
313
+ // },
314
+ // id_files: {
315
+ // type: Array
316
+ // },
317
+ // 'id_files.$': {
318
+ // type: String
319
+ // }
320
+ // }),
321
+ // function: function(supportTicket: SupportTicketModel, id_files: string[]) {
322
+ // return new Promise(async (resolve, reject) => {
323
+ // let files = await Files.find({
324
+ // _id: {$in: id_files}
325
+ // });
326
+ // this.callMethodInternal.call(this, 'getSignedUrls', files.map(a => a.key), 900, (err, res) => {
327
+ // if (res) {
328
+ // this.readFile('email-templates/support-ticket-modified.html').then(async html => {
329
+ // let template = handlebars.compile(html);
330
+ // handlebars.registerHelper('greaterThan', (a, b) => {
331
+ // return a > b;
332
+ // });
333
+ // handlebars.registerHelper('equals', (a, b) => {
334
+ // return a === b;
335
+ // });
336
+ // let filesAttached = [];
337
+ // let fileCnt = 0;
338
+ // res.forEach(url => {
339
+ // filesAttached.push({filename: files[fileCnt].name, path: url});
340
+ // fileCnt++;
341
+ // });
342
+ // this.readImage('images/ResolveIO.png').then(logoData => {
343
+ // supportTicket['logo'] = 'data:image/png;base64,' + logoData;
344
+ // supportTicket.current_watchers.forEach(user => {
345
+ // supportTicket['user'] = user.user;
346
+ // supportTicket['fileAttached'] = filesAttached;
347
+ // this.sendEmail(
348
+ // user.email,
349
+ // 'ResolveIO - a ticket has been modified: ' + supportTicket.support_ticket_number_string + ' Priority: ' + supportTicket.priority,
350
+ // '',
351
+ // template(supportTicket),
352
+ // filesAttached
353
+ // );
354
+ // });
355
+ // if (supportTicket.client_user && supportTicket.client_user.email) {
356
+ // supportTicket['user'] = supportTicket.client_user.user;
357
+ // supportTicket['fileAttached'] = filesAttached;
358
+ // this.sendEmail(
359
+ // supportTicket.client_user.email,
360
+ // 'ResolveIO - ' + supportTicket.support_ticket_number_string + ' Priority: ' + supportTicket.priority,
361
+ // '',
362
+ // template(supportTicket),
363
+ // filesAttached
364
+ // );
365
+ // }
366
+ // }, err => {
367
+ // console.log(err);
368
+ // });
369
+ // resolve(true);
370
+ // }, err => {
371
+ // console.log(err);
372
+ // });
373
+ // resolve(true);
374
+ // }
375
+ // else {
376
+ // this.callMethodInternal.call(this, 'insertErrorLog', 'supportTicketsmethod - getsignedurl', [
377
+ // files.map(a => a.key), err
378
+ // ]);
379
+ // reject(err);
380
+ // }
381
+ // });
382
+ // });
383
+ // }
384
+ // },
385
+ // sendSupportTicketDeletedEmail: {
386
+ // check: new SimpleSchema({
387
+ // supportTicket: {
388
+ // type: Object,
389
+ // blackbox: true
390
+ // }
391
+ // }),
392
+ // function: function(supportTicket: SupportTicketModel) {
393
+ // return new Promise(async (resolve, reject) => {
394
+ // this.callMethodInternal.call(this, 'getSignedUrls', [], 900, (err, res) => {
395
+ // if (res) {
396
+ // this.readFile('email-templates/support-ticket-deleted.html').then(async html => {
397
+ // let template = handlebars.compile(html);
398
+ // handlebars.registerHelper('greaterThan', (a, b) => {
399
+ // return a > b;
400
+ // });
401
+ // handlebars.registerHelper('equals', (a, b) => {
402
+ // return a === b;
403
+ // });
404
+ // if (supportTicket.client_user && supportTicket.client_user.email) {
405
+ // this.sendEmail(
406
+ // supportTicket.client_user.email,
407
+ // 'ResolveIO - ' + supportTicket.support_ticket_number_string + ' Priority: ' + supportTicket.priority,
408
+ // '',
409
+ // template(supportTicket),
410
+ // []
411
+ // );
412
+ // }
413
+ // }, err => {
414
+ // console.log(err);
415
+ // });
416
+ // resolve(true);
417
+ // }
418
+ // else {
419
+ // this.callMethodInternal.call(this, 'insertErrorLog', 'supportTicketsmethod - getsignedurl', [
420
+ // [], err
421
+ // ]);
422
+ // reject(err);
423
+ // }
424
+ // });
425
+ // });
426
+ // }
427
+ // }
428
+ });
429
+ }
430
+ exports.loadSupportMethods = loadSupportMethods;
431
+ function randomString(length, chars) {
432
+ var result = '';
433
+ for (var i = length; i > 0; --i) {
434
+ result += chars[Math.floor(Math.random() * chars.length)];
435
+ }
436
+ return result;
437
+ }
438
+
439
+ //# sourceMappingURL=support.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/methods/support.ts"],"names":[],"mappings":";;AAAA,6CAAwC;AAGxC,iCAAmC;AAEnC,SAAgB,kBAAkB,CAAC,aAA4B;IAC9D,aAAa,CAAC,OAAO,CAAC;QACf,wBAAwB,EAAE;YACzB,KAAK,EAAE,IAAI,sBAAY,CAAC;gBAC7B,IAAI,EAAE;oBACL,IAAI,EAAE,MAAM;oBACZ,QAAQ,EAAE,IAAI;iBACd;aACQ,CAAC;YACF,QAAQ,EAAE,UAAS,IAAI;gBACnB,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;oBAC/B,OAAO,CAAC;wBACJ,MAAM,EAAE,MAAM;wBACd,GAAG,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QACR,KAAK;QACL,KAAK;QACL,mCAAmC;QACnC,6BAA6B;QAC7B,qBAAqB;QACrB,mBAAmB;QACnB,oBAAoB;QACpB,MAAM;QACN,OAAO;QACP,2DAA2D;QAC3D,oDAAoD;QACpD,kFAAkF;QAClF,iBAAiB;QACjB,yFAAyF;QACzF,iDAAiD;QAEjD,6DAA6D;QAC7D,uBAAuB;QACvB,YAAY;QAEZ,wDAAwD;QACxD,yBAAyB;QACzB,YAAY;QAEZ,4EAA4E;QAC5E,yBAAyB;QACzB,4CAA4C;QAC5C,iHAAiH;QACjH,eAAe;QACf,mCAAmC;QACnC,aAAa;QACb,YAAY;QACZ,UAAU;QACV,mBAAmB;QACnB,0BAA0B;QAC1B,WAAW;QAEX,sBAAsB;QACtB,QAAQ;QACR,aAAa;QACb,qGAAqG;QACrG,gBAAgB;QAChB,WAAW;QACX,oBAAoB;QACpB,QAAQ;QACR,SAAS;QACT,QAAQ;QACR,KAAK;QACL,IAAI;KACJ,CAAC,CAAC;AACJ,CAAC;AA/cD,gDA+cC;AAED,SAAS,YAAY,CAAC,MAAM,EAAE,KAAK;IAClC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,IAAI,CAAC,GAAG,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;KAAE;IAC/F,OAAO,MAAM,CAAC;AACf,CAAC","file":"support.js","sourcesContent":["import SimpleSchema from 'simpl-schema';\nimport * as handlebars from 'handlebars';\nimport { MethodManager } from '../managers/method.manager';\nimport * as request from 'request';\n\nexport function loadSupportMethods(methodManager: MethodManager) {\n\tmethodManager.methods({\n supportCreateBillingUser: {\n \tcheck: new SimpleSchema({\n\t\t\t\tuser: {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t}\n }),\n function: function(user) {\n return new Promise((resolve, reject) => {\n request({\n method: 'POST',\n url: 'https://resolveio.com/api/support/billing-user',\n headers: {\n 'Content-Type': 'application/json; charset=UTF-8'\n },\n json: user\n }, ((error, response, body) => {\n if (!error && body && !body.error) {\n resolve(body.result);\n }\n else {\n reject(error || body.result);\n }\n\t\t\t\t\t}));\n });\n }\n\t\t},\n\t\tsupportGetSupportTicketWithId: {\n \tcheck: new SimpleSchema({\n\t\t\t\tid_support_ticket: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n }),\n function: function(user) {\n return new Promise((resolve, reject) => {\n request({\n method: 'POST',\n url: 'https://resolveio.com/api/support/supportTicketWithId',\n headers: {\n 'Content-Type': 'application/json; charset=UTF-8'\n },\n json: user\n }, ((error, response, body) => {\n if (!error && body && !body.error) {\n resolve(body.result);\n }\n else {\n reject(error || body.result);\n }\n\t\t\t\t\t}));\n });\n }\n\t\t},\n\t\tsupportInsertSupportTicket: {\n \tskipValidation: true,\n function: function(supportTicket) {\n return new Promise((resolve, reject) => {\n request({\n method: 'POST',\n url: 'https://resolveio.com/api/support/supportInsertTicket',\n headers: {\n 'Content-Type': 'application/json; charset=UTF-8'\n },\n json: supportTicket\n }, ((error, response, body) => {\n if (!error && body && !body.error) {\n resolve(body.result);\n }\n else {\n reject(error || body.result);\n }\n\t\t\t\t\t}));\n });\n }\n\t\t},\n\t\tsupportUpdateSupportTicket: {\n\t\t\tskipValidation: true,\n function: function(supportTicket) {\n return new Promise((resolve, reject) => {\n request({\n method: 'POST',\n url: 'https://resolveio.com/api/support/supportUpdateTicket',\n headers: {\n 'Content-Type': 'application/json; charset=UTF-8'\n },\n json: supportTicket\n }, ((error, response, body) => {\n if (!error && body && !body.error) {\n resolve(body.result);\n }\n else {\n reject(error || body.result);\n }\n\t\t\t\t\t}));\n });\n }\n\t\t},\n\t\tsupportDeleteSupportTicket: {\n\t\t\tskipValidation: true,\n function: function(supportTicket) {\n return new Promise((resolve, reject) => {\n request({\n method: 'POST',\n url: 'https://resolveio.com/api/support/supportUpdateTicket',\n headers: {\n 'Content-Type': 'application/json; charset=UTF-8'\n },\n json: supportTicket\n }, ((error, response, body) => {\n if (!error && body && !body.error) {\n resolve(body.result);\n }\n else {\n reject(error || body.result);\n }\n\t\t\t\t\t}));\n });\n }\n\t\t},\n\t\tsupportticketsWithOptions: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\toptions: {\n\t\t\t\t\ttype: Object\n\t\t\t\t},\n\t\t\t\t'options.limit': {\n\t\t\t\t\ttype: Number\n\t\t\t\t},\n\t\t\t\t'options.skip': {\n\t\t\t\t\ttype: Number\n\t\t\t\t},\n\t\t\t\t'options.sort': {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t},\n\t\t\t\t'options.fields': {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t},\n\t\t\t\tsearchString: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tfilters: {\n\t\t\t\t\ttype: Array\n\t\t\t\t},\n\t\t\t\t'filters.$': {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t}\n }),\n function: function(options, searchString, filters) {\n return new Promise((resolve, reject) => {\n request({\n method: 'POST',\n url: 'https://resolveio.com/api/support/supportticketsWithOptions',\n headers: {\n 'Content-Type': 'application/json; charset=UTF-8'\n },\n json: [options, searchString, filters]\n }, ((error, response, body) => {\n if (!error && body && !body.error) {\n resolve(body.result);\n }\n else {\n reject(error || body.result);\n }\n\t\t\t\t\t}));\n });\n }\n\t\t},\n\t\tsupportticketCount: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tsearchString: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tfilters: {\n\t\t\t\t\ttype: Array\n\t\t\t\t},\n\t\t\t\t'filters.$': {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t}\n }),\n function: function(searchString, filters) {\n return new Promise((resolve, reject) => {\n request({\n method: 'POST',\n url: 'https://resolveio.com/api/support/supportCountTickets',\n headers: {\n 'Content-Type': 'application/json; charset=UTF-8'\n },\n json: [searchString, filters]\n }, ((error, response, body) => {\n if (!error && body && !body.error) {\n resolve(body.result);\n }\n else {\n reject(error || body.result);\n }\n\t\t\t\t\t}));\n });\n }\n\t\t}\n\t\t// sendSupportTicketEmail: {\n\t\t// \tcheck: new SimpleSchema({\n\t\t// \t\tsupportTicket: {\n\t\t// \t\t\ttype: Object,\n\t\t// \t\t\tblackbox: true\n\t\t// \t\t},\n\t\t// \t\tid_files: {\n\t\t// \t\t\ttype: Array,\n\t\t// \t\t\toptional: true\t\t\t\n\t\t// \t\t},\n\t\t// \t\t'id_files.$': {\n\t\t// \t\t\ttype: String\n\t\t// \t\t}\n\t\t// \t}),\n\t\t// \tfunction: function(supportTicket: SupportTicketModel, id_files?: string[]) {\n\t\t// \t\treturn new Promise(async (resolve, reject) => {\t\t\t\t\t\n\t\t// \t\t\tif (id_files && id_files.length) {\n\t\t// \t\t\t\tlet files = await Files.find({\n\t\t// \t\t\t\t\t_id: {$in: id_files}\n\t\t// \t\t\t\t});\n\n\t\t// \t\t\t\tthis.callMethodInternal.call(this, 'getSignedUrls', files.map(a => a.key), 900, (err, res) => {\n\t\t// \t\t\t\t\tif (res) {\n\t\t// \t\t\t\t\t\tthis.readFile('email-templates/support-ticket.html').then(async html => {\n\t\t// \t\t\t\t\t\t\tlet template = handlebars.compile(html);\n\t\n\t\t// \t\t\t\t\t\t\thandlebars.registerHelper('greaterThan', (a, b) => {\n\t\t// \t\t\t\t\t\t\t\treturn a > b;\n\t\t// \t\t\t\t\t\t\t});\n\t\n\t\t// \t\t\t\t\t\t\thandlebars.registerHelper('equals', (a, b) => {\n\t\t// \t\t\t\t\t\t\t\treturn a === b;\n\t\t// \t\t\t\t\t\t\t});\n\t\n\t\t// \t\t\t\t\t\t\tlet filesAttached = [];\n\t\n\t\t// \t\t\t\t\t\t\tlet fileCnt = 0;\n\t\t// \t\t\t\t\t\t\tres.forEach(url => {\n\t\t// \t\t\t\t\t\t\t\tfilesAttached.push({filename: files[fileCnt].name, path: url});\n\t\t// \t\t\t\t\t\t\t\tfileCnt++;\n\t\t// \t\t\t\t\t\t\t});\n\t\n\t\t// \t\t\t\t\t\t\tthis.readImage('images/ResolveIO.png').then(logoData => {\n\t\t// \t\t\t\t\t\t\t\tsupportTicket['logo'] = 'data:image/png;base64,' + logoData;\n\t\t\t\t\t\t\t\t\t\t\n\t\t// \t\t\t\t\t\t\t\tif (supportTicket.client_user && supportTicket.client_user.email) {\n\t\n\t\t// \t\t\t\t\t\t\t\t\tsupportTicket['user'] = supportTicket.client_user.user;\n\t\t// \t\t\t\t\t\t\t\t\tsupportTicket['fileAttached'] = filesAttached;\n\t\n\t\t// \t\t\t\t\t\t\t\t\tthis.sendEmail(\n\t\t// \t\t\t\t\t\t\t\t\t\tsupportTicket.client_user.email, \n\t\t// \t\t\t\t\t\t\t\t\t\t'ResolveIO - ' + supportTicket.support_ticket_number_string + ' Priority: ' + supportTicket.priority, \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\ttemplate(supportTicket),\n\t\t// \t\t\t\t\t\t\t\t\t\tfilesAttached\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}, err => {\n\t\t// \t\t\t\t\t\t\t\tconsole.log(err);\n\t\t// \t\t\t\t\t\t\t});\n\t\n\t\t// \t\t\t\t\t\t\tresolve(true);\n\t\t// \t\t\t\t\t\t}, err => {\n\t\t// \t\t\t\t\t\t\tconsole.log(err);\n\t\t// \t\t\t\t\t\t});\n\t\n\t\t// \t\t\t\t\t\tresolve(true);\n\t\t// \t\t\t\t\t}\n\t\t// \t\t\t\t\telse {\n\t\t// \t\t\t\t\t\tthis.callMethodInternal.call(this, 'insertErrorLog', 'supportTicketsmethod - getsignedurl', [\n\t\t// \t\t\t\t\t\t\tfiles.map(a => a.key), err\n\t\t// \t\t\t\t\t\t]);\n\t\t// \t\t\t\t\t\treject(err);\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\telse {\n\t\t// \t\t\t\tthis.readFile('email-templates/support-ticket.html').then(async html => {\n\t\t// \t\t\t\t\tlet template = handlebars.compile(html);\n\n\t\t// \t\t\t\t\thandlebars.registerHelper('greaterThan', (a, b) => {\n\t\t// \t\t\t\t\t\treturn a > b;\n\t\t// \t\t\t\t\t});\n\n\t\t// \t\t\t\t\thandlebars.registerHelper('equals', (a, b) => {\n\t\t// \t\t\t\t\t\treturn a === b;\n\t\t// \t\t\t\t\t});\n\n\t\t// \t\t\t\t\tthis.readImage('images/ResolveIO.png').then(logoData => {\n\t\t// \t\t\t\t\t\tsupportTicket['logo'] = 'data:image/png;base64,' + logoData;\n\t\t\t\t\t\t\t\t\n\t\t// \t\t\t\t\t\tif (supportTicket.client_user && supportTicket.client_user.email) {\n\n\t\t// \t\t\t\t\t\t\tsupportTicket['user'] = supportTicket.client_user.user;\n\n\t\t// \t\t\t\t\t\t\tthis.sendEmail(\n\t\t// \t\t\t\t\t\t\t\tsupportTicket.client_user.email, \n\t\t// \t\t\t\t\t\t\t\t'ResolveIO - ' + supportTicket.support_ticket_number_string + ' Priority: ' + supportTicket.priority, \n\t\t// \t\t\t\t\t\t\t\t'', \n\t\t// \t\t\t\t\t\t\t\ttemplate(supportTicket),\n\t\t// \t\t\t\t\t\t\t\tnull\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}, err => {\n\t\t// \t\t\t\t\t\tconsole.log(err);\n\t\t// \t\t\t\t\t});\n\n\t\t// \t\t\t\t\tresolve(true);\n\t\t// \t\t\t\t}, err => {\n\t\t// \t\t\t\t\tconsole.log(err);\n\t\t// \t\t\t\t});\n\n\t\t// \t\t\t\tresolve(true);\n\t\t// \t\t\t}\n\t\t// \t\t});\n\t\t// \t}\n\t\t// },\n\t\t// sendSupportTicketModifiedEmail: {\n\t\t// \tcheck: new SimpleSchema({\n\t\t// \t\tsupportTicket: {\n\t\t// \t\t\ttype: Object,\n\t\t// \t\t\tblackbox: true\n\t\t// \t\t},\n\t\t// \t\tid_files: {\n\t\t// \t\t\ttype: Array\t\t\t\t\t\n\t\t// \t\t},\n\t\t// \t\t'id_files.$': {\n\t\t// \t\t\ttype: String\n\t\t// \t\t}\n\t\t// \t}),\n\t\t// \tfunction: function(supportTicket: SupportTicketModel, id_files: string[]) {\n\t\t// \t\treturn new Promise(async (resolve, reject) => {\n\n\t\t// \t\t\tlet files = await Files.find({\n\t\t// \t\t\t\t_id: {$in: id_files}\n\t\t// \t\t\t});\n\n\t\t// \t\t\tthis.callMethodInternal.call(this, 'getSignedUrls', files.map(a => a.key), 900, (err, res) => {\n\t\t// \t\t\t\tif (res) {\n\t\t// \t\t\t\t\tthis.readFile('email-templates/support-ticket-modified.html').then(async html => {\n\t\t// \t\t\t\t\t\tlet template = handlebars.compile(html);\n\n\t\t// \t\t\t\t\t\thandlebars.registerHelper('greaterThan', (a, b) => {\n\t\t// \t\t\t\t\t\t\treturn a > b;\n\t\t// \t\t\t\t\t\t});\n\n\t\t// \t\t\t\t\t\thandlebars.registerHelper('equals', (a, b) => {\n\t\t// \t\t\t\t\t\t\treturn a === b;\n\t\t// \t\t\t\t\t\t});\n\n\t\t// \t\t\t\t\t\tlet filesAttached = [];\n\n\t\t// \t\t\t\t\t\tlet fileCnt = 0;\n\t\t// \t\t\t\t\t\tres.forEach(url => {\n\t\t// \t\t\t\t\t\t\tfilesAttached.push({filename: files[fileCnt].name, path: url});\n\t\t// \t\t\t\t\t\t\tfileCnt++;\n\t\t// \t\t\t\t\t\t});\n\n\t\t// \t\t\t\t\t\tthis.readImage('images/ResolveIO.png').then(logoData => {\n\t\t// \t\t\t\t\t\t\tsupportTicket['logo'] = 'data:image/png;base64,' + logoData;\n\t\t\t\t\t\t\t\t\n\t\t// \t\t\t\t\t\t\tsupportTicket.current_watchers.forEach(user => {\n\t\t\t\t\t\n\t\t// \t\t\t\t\t\t\t\tsupportTicket['user'] = user.user;\n\t\t// \t\t\t\t\t\t\t\tsupportTicket['fileAttached'] = filesAttached;\n\n\t\t// \t\t\t\t\t\t\t\tthis.sendEmail(\n\t\t// \t\t\t\t\t\t\t\t\tuser.email, \n\t\t// \t\t\t\t\t\t\t\t\t'ResolveIO - a ticket has been modified: ' + supportTicket.support_ticket_number_string + ' Priority: ' + supportTicket.priority, \n\t\t// \t\t\t\t\t\t\t\t\t'', \n\t\t// \t\t\t\t\t\t\t\t\ttemplate(supportTicket),\n\t\t// \t\t\t\t\t\t\t\t\tfilesAttached\n\t\t// \t\t\t\t\t\t\t\t);\n\t\t// \t\t\t\t\t\t\t});\n\n\t\t// \t\t\t\t\t\t\tif (supportTicket.client_user && supportTicket.client_user.email) {\n\n\t\t// \t\t\t\t\t\t\t\tsupportTicket['user'] = supportTicket.client_user.user;\n\t\t// \t\t\t\t\t\t\t\tsupportTicket['fileAttached'] = filesAttached;\n\n\t\t// \t\t\t\t\t\t\t\tthis.sendEmail(\n\t\t// \t\t\t\t\t\t\t\t\tsupportTicket.client_user.email, \n\t\t// \t\t\t\t\t\t\t\t\t'ResolveIO - ' + supportTicket.support_ticket_number_string + ' Priority: ' + supportTicket.priority, \n\t\t// \t\t\t\t\t\t\t\t\t'', \n\t\t// \t\t\t\t\t\t\t\t\ttemplate(supportTicket),\n\t\t// \t\t\t\t\t\t\t\t\tfilesAttached\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}, err => {\n\t\t// \t\t\t\t\t\t\tconsole.log(err);\n\t\t// \t\t\t\t\t\t});\n\t\t\n\t\t// \t\t\t\t\t\tresolve(true);\n\t\t\t\t\t\t\t\t\n\t\t// \t\t\t\t\t}, err => {\n\t\t// \t\t\t\t\t\tconsole.log(err);\n\t\t// \t\t\t\t\t});\n\n\t\t// \t\t\t\t\tresolve(true);\n\t\t// \t\t\t\t}\n\t\t// \t\t\t\telse {\n\t\t// \t\t\t\t\tthis.callMethodInternal.call(this, 'insertErrorLog', 'supportTicketsmethod - getsignedurl', [\n\t\t// \t\t\t\t\t\tfiles.map(a => a.key), err\n\t\t// \t\t\t\t\t]);\n\t\t// \t\t\t\t\treject(err);\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\t// sendSupportTicketDeletedEmail: {\n\t\t// \tcheck: new SimpleSchema({\n\t\t// \t\tsupportTicket: {\n\t\t// \t\t\ttype: Object,\n\t\t// \t\t\tblackbox: true\n\t\t// \t\t}\n\t\t// \t}),\n\t\t// \tfunction: function(supportTicket: SupportTicketModel) {\n\t\t// \t\treturn new Promise(async (resolve, reject) => {\n\t\t// \t\t\tthis.callMethodInternal.call(this, 'getSignedUrls', [], 900, (err, res) => {\n\t\t// \t\t\t\tif (res) {\n\t\t// \t\t\t\t\tthis.readFile('email-templates/support-ticket-deleted.html').then(async html => {\n\t\t// \t\t\t\t\t\tlet template = handlebars.compile(html);\n\n\t\t// \t\t\t\t\t\thandlebars.registerHelper('greaterThan', (a, b) => {\n\t\t// \t\t\t\t\t\t\treturn a > b;\n\t\t// \t\t\t\t\t\t});\n\n\t\t// \t\t\t\t\t\thandlebars.registerHelper('equals', (a, b) => {\n\t\t// \t\t\t\t\t\t\treturn a === b;\n\t\t// \t\t\t\t\t\t});\n\n\t\t// \t\t\t\t\t\tif (supportTicket.client_user && supportTicket.client_user.email) {\n\t\t// \t\t\t\t\t\t\tthis.sendEmail(\n\t\t// \t\t\t\t\t\t\t\tsupportTicket.client_user.email, \n\t\t// \t\t\t\t\t\t\t\t'ResolveIO - ' + supportTicket.support_ticket_number_string + ' Priority: ' + supportTicket.priority, \n\t\t// \t\t\t\t\t\t\t\t'', \n\t\t// \t\t\t\t\t\t\t\ttemplate(supportTicket),\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}, err => {\n\t\t// \t\t\t\t\t\tconsole.log(err);\n\t\t// \t\t\t\t\t});\n\n\t\t// \t\t\t\t\tresolve(true);\n\t\t// \t\t\t\t}\n\t\t// \t\t\t\telse {\n\t\t// \t\t\t\t\tthis.callMethodInternal.call(this, 'insertErrorLog', 'supportTicketsmethod - getsignedurl', [\n\t\t// \t\t\t\t\t\t[], err\n\t\t// \t\t\t\t\t]);\n\t\t// \t\t\t\t\treject(err);\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\nfunction randomString(length, chars) {\n\tlet result = '';\n\tfor (let i = length; i > 0; --i) { result += chars[Math.floor(Math.random() * chars.length)]; }\n\treturn result;\n}"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resolveio/server-lib",
3
- "version": "6.4.23",
3
+ "version": "7.0.1",
4
4
  "description": "",
5
5
  "main": "index.ts",
6
6
  "scripts": {
@@ -34,37 +34,6 @@ function loadFilePublications(subscriptionManager) {
34
34
  fetchFunction: function (document, id_files) {
35
35
  return id_files.includes(document._id);
36
36
  }
37
- },
38
- supportFileWithId: {
39
- function: function (id_file) {
40
- return file_collection_1.SupportFiles.findById(id_file).sort({ name: 1 }).exec();
41
- },
42
- check: new simpl_schema_1.default({
43
- id_file: {
44
- type: String
45
- }
46
- }),
47
- collections: ['files'],
48
- fetchFunction: function (document, id_file) {
49
- return document._id === id_file;
50
- }
51
- },
52
- supportFilesIn: {
53
- function: function (id_files) {
54
- return file_collection_1.SupportFiles.find({ _id: { $in: id_files } }).sort({ name: 1 }).exec();
55
- },
56
- check: new simpl_schema_1.default({
57
- id_files: {
58
- type: Array
59
- },
60
- 'id_files.$': {
61
- type: String
62
- }
63
- }),
64
- collections: ['files'],
65
- fetchFunction: function (document, id_files) {
66
- return id_files.includes(document._id);
67
- }
68
37
  }
69
38
  });
70
39
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/publications/files.ts"],"names":[],"mappings":";;AAAA,6CAAwC;AACxC,oEAAuE;AAIvE,SAAgB,oBAAoB,CAAC,mBAAwC;IAC5E,mBAAmB,CAAC,YAAY,CAAC;QAChC,UAAU,EAAE;YACX,QAAQ,EAAE,UAAC,OAAe;gBACzB,OAAO,uBAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,CAAC,EAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YACvD,CAAC;YACD,KAAK,EAAE,IAAI,sBAAY,CAAC;gBACvB,OAAO,EAAE;oBACR,IAAI,EAAE,MAAM;iBACZ;aACD,CAAC;YACF,WAAW,EAAE,CAAC,OAAO,CAAC;YACtB,aAAa,EAAE,UAAC,QAAkB,EAAE,OAAe;gBAClD,OAAO,QAAQ,CAAC,GAAG,KAAK,OAAO,CAAC;YACjC,CAAC;SACD;QACD,OAAO,EAAE;YACR,QAAQ,EAAE,UAAC,QAAkB;gBAC5B,OAAO,uBAAK,CAAC,IAAI,CAAC,EAAC,GAAG,EAAE,EAAC,GAAG,EAAE,QAAQ,EAAC,EAAC,CAAC,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,CAAC,EAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YAClE,CAAC;YACD,KAAK,EAAE,IAAI,sBAAY,CAAC;gBACvB,QAAQ,EAAE;oBACT,IAAI,EAAE,KAAK;iBACX;gBACD,YAAY,EAAE;oBACb,IAAI,EAAE,MAAM;iBACZ;aACD,CAAC;YACF,WAAW,EAAE,CAAC,OAAO,CAAC;YACtB,aAAa,EAAE,UAAC,QAAkB,EAAE,QAAkB;gBACrD,OAAO,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YACxC,CAAC;SACD;QACD,iBAAiB,EAAE;YAClB,QAAQ,EAAE,UAAC,OAAe;gBACzB,OAAO,8BAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,CAAC,EAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YAC9D,CAAC;YACD,KAAK,EAAE,IAAI,sBAAY,CAAC;gBACvB,OAAO,EAAE;oBACR,IAAI,EAAE,MAAM;iBACZ;aACD,CAAC;YACF,WAAW,EAAE,CAAC,OAAO,CAAC;YACtB,aAAa,EAAE,UAAC,QAAkB,EAAE,OAAe;gBAClD,OAAO,QAAQ,CAAC,GAAG,KAAK,OAAO,CAAC;YACjC,CAAC;SACD;QACD,cAAc,EAAE;YACf,QAAQ,EAAE,UAAC,QAAkB;gBAC5B,OAAO,8BAAY,CAAC,IAAI,CAAC,EAAC,GAAG,EAAE,EAAC,GAAG,EAAE,QAAQ,EAAC,EAAC,CAAC,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,CAAC,EAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YACzE,CAAC;YACD,KAAK,EAAE,IAAI,sBAAY,CAAC;gBACvB,QAAQ,EAAE;oBACT,IAAI,EAAE,KAAK;iBACX;gBACD,YAAY,EAAE;oBACb,IAAI,EAAE,MAAM;iBACZ;aACD,CAAC;YACF,WAAW,EAAE,CAAC,OAAO,CAAC;YACtB,aAAa,EAAE,UAAC,QAAkB,EAAE,QAAkB;gBACrD,OAAO,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YACxC,CAAC;SACD;KACD,CAAC,CAAC;AACJ,CAAC;AAjED,oDAiEC","file":"files.js","sourcesContent":["import SimpleSchema from 'simpl-schema';\nimport { Files, SupportFiles } from './../collections/file.collection';\nimport { SubscriptionManager } from '../managers/subscription.manager';\nimport { Document } from 'mongoose';\n\nexport function loadFilePublications(subscriptionManager: SubscriptionManager) {\n\tsubscriptionManager.publications({\n\t\tfileWithId: {\n\t\t\tfunction: (id_file: string) => {\n\t\t\t\treturn Files.findById(id_file).sort({name: 1}).exec();\n\t\t\t},\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tid_file: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t}),\n\t\t\tcollections: ['files'],\n\t\t\tfetchFunction: (document: Document, id_file: string) => {\n\t\t\t\treturn document._id === id_file;\n\t\t\t}\n\t\t},\n\t\tfilesIn: {\n\t\t\tfunction: (id_files: string[]) => {\n\t\t\t\treturn Files.find({_id: {$in: id_files}}).sort({name: 1}).exec();\n\t\t\t},\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tid_files: {\n\t\t\t\t\ttype: Array\n\t\t\t\t},\n\t\t\t\t'id_files.$': {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t}),\n\t\t\tcollections: ['files'],\n\t\t\tfetchFunction: (document: Document, id_files: string[]) => {\n\t\t\t\treturn id_files.includes(document._id);\n\t\t\t}\n\t\t},\n\t\tsupportFileWithId: {\n\t\t\tfunction: (id_file: string) => {\n\t\t\t\treturn SupportFiles.findById(id_file).sort({name: 1}).exec();\n\t\t\t},\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tid_file: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t}),\n\t\t\tcollections: ['files'],\n\t\t\tfetchFunction: (document: Document, id_file: string) => {\n\t\t\t\treturn document._id === id_file;\n\t\t\t}\n\t\t},\n\t\tsupportFilesIn: {\n\t\t\tfunction: (id_files: string[]) => {\n\t\t\t\treturn SupportFiles.find({_id: {$in: id_files}}).sort({name: 1}).exec();\n\t\t\t},\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tid_files: {\n\t\t\t\t\ttype: Array\n\t\t\t\t},\n\t\t\t\t'id_files.$': {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t}),\n\t\t\tcollections: ['files'],\n\t\t\tfetchFunction: (document: Document, id_files: string[]) => {\n\t\t\t\treturn id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","sourcesContent":["import SimpleSchema from 'simpl-schema';\nimport { Files } from './../collections/file.collection';\nimport { SubscriptionManager } from '../managers/subscription.manager';\nimport { Document } from 'mongoose';\n\nexport function loadFilePublications(subscriptionManager: SubscriptionManager) {\n\tsubscriptionManager.publications({\n\t\tfileWithId: {\n\t\t\tfunction: (id_file: string) => {\n\t\t\t\treturn Files.findById(id_file).sort({name: 1}).exec();\n\t\t\t},\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tid_file: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t}),\n\t\t\tcollections: ['files'],\n\t\t\tfetchFunction: (document: Document, id_file: string) => {\n\t\t\t\treturn document._id === id_file;\n\t\t\t}\n\t\t},\n\t\tfilesIn: {\n\t\t\tfunction: (id_files: string[]) => {\n\t\t\t\treturn Files.find({_id: {$in: id_files}}).sort({name: 1}).exec();\n\t\t\t},\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tid_files: {\n\t\t\t\t\ttype: Array\n\t\t\t\t},\n\t\t\t\t'id_files.$': {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t}),\n\t\t\tcollections: ['files'],\n\t\t\tfetchFunction: (document: Document, id_files: string[]) => {\n\t\t\t\treturn id_files.includes(document._id);\n\t\t\t}\n\t\t}\n\t});\n}"]}
package/server-app.d.ts CHANGED
@@ -5,7 +5,6 @@ import * as WebSocket from 'ws';
5
5
  import { CronManager } from './managers/cron.manager';
6
6
  import { MethodManager } from './managers/method.manager';
7
7
  import { SubscriptionManager } from './managers/subscription.manager';
8
- import { SupportManager } from './managers/support.manager';
9
8
  import { QueueMethodManager } from './managers/queue-method.manager';
10
9
  export default class ResolveIOMainServer {
11
10
  private _app;
@@ -18,12 +17,10 @@ export default class ResolveIOMainServer {
18
17
  private _msgQueueRunning;
19
18
  sesMail: boolean;
20
19
  private LOGGER;
21
- private _resolveioServer;
22
20
  private _subscriptionManager;
23
21
  private _methodManager;
24
22
  private _queueManager;
25
23
  private _cronManager;
26
- private _supportManager;
27
24
  constructor(mainServer: any, serverConfig: any, clientDir: any, sesMail: any);
28
25
  getWS(id_ws: string): any;
29
26
  getWSList(): any[];
@@ -33,7 +30,6 @@ export default class ResolveIOMainServer {
33
30
  getMethodManager(): MethodManager;
34
31
  getSubscriptionManager(): SubscriptionManager;
35
32
  getQueueManager(): QueueMethodManager;
36
- getSupportManager(): SupportManager;
37
33
  private createServer;
38
34
  private setUpMongoose;
39
35
  private setUpPassport;