@resolveio/server-lib 22.2.28 → 22.2.29

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.
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
14
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
15
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -39,6 +50,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
50
  exports.loadSupportMethods = loadSupportMethods;
40
51
  var axios_1 = require("axios");
41
52
  var simpl_schema_1 = require("simpl-schema");
53
+ var SUPPORT_INTERNAL_MESSAGE_PATTERN = /\b(codex|openai|ai dashboard|ai assistant|workflow update|build plan|pull request|confidence gate|dependency follow-up|thread key|workspace cleanup|support automation)\b/i;
54
+ var SUPPORT_INTERNAL_SOURCE_PATTERN = /\b(support_automation|codex|openai|ai(?:[_ -]?assistant|[_ -]?dashboard)?)\b/i;
42
55
  function loadSupportMethods(methodManager) {
43
56
  methodManager.methods({
44
57
  supportCreateBillingUser: {
@@ -84,7 +97,7 @@ function loadSupportMethods(methodManager) {
84
97
  return [4 /*yield*/, axios_1.default.post('https://backend.resolveio.com/api/support/supportTicketWithId', { id_support_ticket: id_support_ticket })];
85
98
  case 1:
86
99
  body = _a.sent();
87
- return [2 /*return*/, body.data.result];
100
+ return [2 /*return*/, sanitizeSupportTicketForClientView(body.data.result)];
88
101
  case 2:
89
102
  error_1 = _a.sent();
90
103
  error_1.message = "Error in Support Get Support Ticket With Id: ".concat(error_1.message);
@@ -122,12 +135,13 @@ function loadSupportMethods(methodManager) {
122
135
  skipValidation: true,
123
136
  function: function (supportTicket) {
124
137
  return __awaiter(this, void 0, void 0, function () {
125
- var body, error_3;
138
+ var safePayload, body, error_3;
126
139
  return __generator(this, function (_a) {
127
140
  switch (_a.label) {
128
141
  case 0:
129
142
  _a.trys.push([0, 2, , 3]);
130
- return [4 /*yield*/, axios_1.default.post('https://backend.resolveio.com/api/support/supportUpdateTicket', supportTicket)];
143
+ safePayload = sanitizeSupportTicketUpdatePayload(supportTicket);
144
+ return [4 /*yield*/, axios_1.default.post('https://backend.resolveio.com/api/support/supportUpdateTicket', safePayload)];
131
145
  case 1:
132
146
  body = _a.sent();
133
147
  return [2 /*return*/, body.data.result];
@@ -173,7 +187,7 @@ function loadSupportMethods(methodManager) {
173
187
  }),
174
188
  function: function (options, searchString, filters) {
175
189
  return __awaiter(this, void 0, void 0, function () {
176
- var body, error_4;
190
+ var body, results, error_4;
177
191
  return __generator(this, function (_a) {
178
192
  switch (_a.label) {
179
193
  case 0:
@@ -181,7 +195,8 @@ function loadSupportMethods(methodManager) {
181
195
  return [4 /*yield*/, axios_1.default.post('https://backend.resolveio.com/api/support/supportticketsWithOptions', [options, searchString, filters])];
182
196
  case 1:
183
197
  body = _a.sent();
184
- return [2 /*return*/, body.data.result];
198
+ results = Array.isArray(body.data.result) ? body.data.result : [];
199
+ return [2 /*return*/, results.map(function (ticket) { return sanitizeSupportTicketForClientView(ticket); })];
185
200
  case 2:
186
201
  error_4 = _a.sent();
187
202
  error_4.message = "Error in Support Tickets With Options: ".concat(error_4.message);
@@ -228,5 +243,71 @@ function loadSupportMethods(methodManager) {
228
243
  }
229
244
  });
230
245
  }
246
+ function isInternalSupportMessage(message) {
247
+ if (!message || typeof message !== 'object') {
248
+ return false;
249
+ }
250
+ if (message.internal === true) {
251
+ return true;
252
+ }
253
+ var visibility = String(message.visibility || '').trim().toLowerCase();
254
+ if (visibility === 'internal') {
255
+ return true;
256
+ }
257
+ var badge = String(message.badge || '').trim().toLowerCase();
258
+ if (badge.includes('internal')) {
259
+ return true;
260
+ }
261
+ var source = String(message.source || '').trim();
262
+ if (source && SUPPORT_INTERNAL_SOURCE_PATTERN.test(source)) {
263
+ return true;
264
+ }
265
+ var text = [
266
+ String(message.type || ''),
267
+ String(message.user || ''),
268
+ String(message.message || '')
269
+ ].join(' ');
270
+ return SUPPORT_INTERNAL_MESSAGE_PATTERN.test(text);
271
+ }
272
+ function stripSupportMessageInternalMetadata(message) {
273
+ var next = __assign({}, (message || {}));
274
+ delete next.internal;
275
+ delete next.visibility;
276
+ delete next.badge;
277
+ delete next.source;
278
+ return next;
279
+ }
280
+ function sanitizeSupportTicketForClientView(ticket) {
281
+ if (!ticket || typeof ticket !== 'object') {
282
+ return ticket;
283
+ }
284
+ var next = __assign({}, ticket);
285
+ next.messages = Array.isArray(ticket.messages)
286
+ ? ticket.messages
287
+ .filter(function (message) { return !isInternalSupportMessage(message); })
288
+ .map(function (message) { return stripSupportMessageInternalMetadata(message); })
289
+ : [];
290
+ next.notes = [];
291
+ delete next.automation;
292
+ delete next.ai_recommendations;
293
+ delete next.source;
294
+ return next;
295
+ }
296
+ function sanitizeSupportTicketUpdatePayload(ticket) {
297
+ if (!ticket || typeof ticket !== 'object') {
298
+ return ticket;
299
+ }
300
+ var next = __assign({}, ticket);
301
+ next.messages = Array.isArray(ticket.messages)
302
+ ? ticket.messages
303
+ .filter(function (message) { return !isInternalSupportMessage(message); })
304
+ .map(function (message) { return stripSupportMessageInternalMetadata(message); })
305
+ : [];
306
+ next.notes = [];
307
+ delete next.automation;
308
+ delete next.ai_recommendations;
309
+ delete next.source;
310
+ return next;
311
+ }
231
312
 
232
313
  //# sourceMappingURL=support.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/methods/support.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,gDAqIC;AAzID,+BAA0B;AAC1B,6CAAwC;AAGxC,SAAgB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AAC;gCAC1E,MAAM,OAAK,CAAC;;;;;aAEnB;SACV;QACD,kBAAkB,EAAE;YACnB,KAAK,EAAE,IAAI,sBAAY,CAAC;gBACvB,YAAY,EAAE;oBACb,IAAI,EAAE,MAAM;iBACZ;gBACD,OAAO,EAAE;oBACR,IAAI,EAAE,KAAK;iBACX;gBACD,WAAW,EAAE;oBACZ,IAAI,EAAE,MAAM;oBACZ,QAAQ,EAAE,IAAI;iBACd;aACQ,CAAC;YACF,QAAQ,EAAE,UAAe,YAAY,EAAE,OAAO;;;;;;;gCAE3B,qBAAM,eAAK,CAAC,IAAI,CAAC,+DAA+D,EAAE,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,EAAA;;gCAAjH,IAAI,GAAG,SAA0G;gCAErH,sBAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAC;;;gCAGxB,OAAK,CAAC,OAAO,GAAG,yCAAkC,OAAK,CAAC,OAAO,CAAE,CAAC;gCAClE,MAAM,OAAK,CAAC;;;;;aAEnB;SACV;KACD,CAAC,CAAC;AACJ,CAAC","file":"support.js","sourcesContent":["import axios from 'axios';\nimport SimpleSchema from 'simpl-schema';\nimport { MethodManager } from '../managers/method.manager';\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: async function(user) {\n try {\n let body = await axios.post('https://backend.resolveio.com/api/support/billing-user', user);\n return body.data.result;\n }\n catch {\n return false;\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: async function(id_support_ticket) {\n try {\n let body = await axios.post('https://backend.resolveio.com/api/support/supportTicketWithId', {id_support_ticket: id_support_ticket});\n\n return body.data.result;\n }\n catch(error) {\n error.message = `Error in Support Get Support Ticket With Id: ${error.message}`;\n throw error;\n }\n }\n\t\t},\n\t\tsupportInsertSupportTicket: {\n \tskipValidation: true,\n function: async function(supportTicket) {\n try {\n let body = await axios.post('https://backend.resolveio.com/api/support/supportInsertTicket', supportTicket);\n\n return body.data.result;\n }\n catch(error) {\n error.message = `Error in Support Insert Support Ticket: ${error.message}`;\n throw error;\n }\n }\n\t\t},\n\t\tsupportUpdateSupportTicket: {\n\t\t\tskipValidation: true,\n function: async function(supportTicket) {\n try {\n let body = await axios.post('https://backend.resolveio.com/api/support/supportUpdateTicket', supportTicket);\n\n return body.data.result;\n }\n catch(error) {\n error.message = `Error in Support Update Support Ticket: ${error.message}`;\n throw error;\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: async function(options, searchString, filters) {\n try {\n let body = await axios.post('https://backend.resolveio.com/api/support/supportticketsWithOptions', [options, searchString, filters]);\n\n return body.data.result;\n }\n catch(error) {\n error.message = `Error in Support Tickets With Options: ${error.message}`;\n throw error;\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: async function(searchString, filters) {\n try {\n let body = await axios.post('https://backend.resolveio.com/api/support/supportCountTickets', [searchString, filters]);\n\n return body.data.result;\n }\n catch(error) {\n error.message = `Error in Support Ticket Count: ${error.message}`;\n throw error;\n }\n }\n\t\t}\n\t});\n}"]}
1
+ {"version":3,"sources":["../../src/methods/support.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,gDAqIC;AA3ID,+BAA0B;AAC1B,6CAAwC;AAExC,IAAM,gCAAgC,GAAG,4KAA4K,CAAC;AACtN,IAAM,+BAA+B,GAAG,+EAA+E,CAAC;AAExH,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,UAAe,IAAI;;;;;;;gCAEV,qBAAM,eAAK,CAAC,IAAI,CAAC,wDAAwD,EAAE,IAAI,CAAC,EAAA;;gCAAvF,IAAI,GAAG,SAAgF;gCAC3F,sBAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAC;;;gCAGxB,sBAAO,KAAK,EAAC;;;;;aAEpB;SACV;QACD,6BAA6B,EAAE;YACxB,KAAK,EAAE,IAAI,sBAAY,CAAC;gBAC7B,iBAAiB,EAAE;oBAClB,IAAI,EAAE,MAAM;iBACZ;aACQ,CAAC;YACF,QAAQ,EAAE,UAAe,iBAAiB;;;;;;;gCAEvB,qBAAM,eAAK,CAAC,IAAI,CAAC,+DAA+D,EAA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MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC3C,OAAO,MAAM,CAAC;IACf,CAAC;IACD,IAAM,IAAI,gBAA6B,MAAM,CAAE,CAAC;IAChD,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC;QAC7C,CAAC,CAAC,MAAM,CAAC,QAAQ;aACf,MAAM,CAAC,UAAC,OAAY,IAAK,OAAA,CAAC,wBAAwB,CAAC,OAAO,CAAC,EAAlC,CAAkC,CAAC;aAC5D,GAAG,CAAC,UAAC,OAAY,IAAK,OAAA,mCAAmC,CAAC,OAAO,CAAC,EAA5C,CAA4C,CAAC;QACrE,CAAC,CAAC,EAAE,CAAC;IACN,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IACvB,OAAO,IAAI,CAAC,kBAAkB,CAAC;IAC/B,OAAO,IAAI,CAAC,MAAM,CAAC;IACnB,OAAO,IAAI,CAAC;AACb,CAAC","file":"support.js","sourcesContent":["import axios from 'axios';\nimport SimpleSchema from 'simpl-schema';\nimport { MethodManager } from '../managers/method.manager';\nconst SUPPORT_INTERNAL_MESSAGE_PATTERN = /\\b(codex|openai|ai dashboard|ai assistant|workflow update|build plan|pull request|confidence gate|dependency follow-up|thread key|workspace cleanup|support automation)\\b/i;\nconst SUPPORT_INTERNAL_SOURCE_PATTERN = /\\b(support_automation|codex|openai|ai(?:[_ -]?assistant|[_ -]?dashboard)?)\\b/i;\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: async function(user) {\n try {\n let body = await axios.post('https://backend.resolveio.com/api/support/billing-user', user);\n return body.data.result;\n }\n catch {\n return false;\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: async function(id_support_ticket) {\n try {\n let body = await axios.post('https://backend.resolveio.com/api/support/supportTicketWithId', {id_support_ticket: id_support_ticket});\n return sanitizeSupportTicketForClientView(body.data.result);\n }\n catch(error) {\n error.message = `Error in Support Get Support Ticket With Id: ${error.message}`;\n throw error;\n }\n }\n\t\t},\n\t\tsupportInsertSupportTicket: {\n \tskipValidation: true,\n function: async function(supportTicket) {\n try {\n let body = await axios.post('https://backend.resolveio.com/api/support/supportInsertTicket', supportTicket);\n\n return body.data.result;\n }\n catch(error) {\n error.message = `Error in Support Insert Support Ticket: ${error.message}`;\n throw error;\n }\n }\n\t\t},\n\t\tsupportUpdateSupportTicket: {\n\t\t\tskipValidation: true,\n function: async function(supportTicket) {\n try {\n const safePayload = sanitizeSupportTicketUpdatePayload(supportTicket);\n let body = await axios.post('https://backend.resolveio.com/api/support/supportUpdateTicket', safePayload);\n\n return body.data.result;\n }\n catch(error) {\n error.message = `Error in Support Update Support Ticket: ${error.message}`;\n throw error;\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: async function(options, searchString, filters) {\n try {\n let body = await axios.post('https://backend.resolveio.com/api/support/supportticketsWithOptions', [options, searchString, filters]);\n const results = Array.isArray(body.data.result) ? body.data.result : [];\n return results.map((ticket: any) => sanitizeSupportTicketForClientView(ticket));\n }\n catch(error) {\n error.message = `Error in Support Tickets With Options: ${error.message}`;\n throw error;\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: async function(searchString, filters) {\n try {\n let body = await axios.post('https://backend.resolveio.com/api/support/supportCountTickets', [searchString, filters]);\n\n return body.data.result;\n }\n catch(error) {\n error.message = `Error in Support Ticket Count: ${error.message}`;\n throw error;\n }\n }\n\t\t}\n\t});\n}\n\nfunction isInternalSupportMessage(message: any): boolean {\n\tif (!message || typeof message !== 'object') {\n\t\treturn false;\n\t}\n\tif (message.internal === true) {\n\t\treturn true;\n\t}\n\tconst visibility = String(message.visibility || '').trim().toLowerCase();\n\tif (visibility === 'internal') {\n\t\treturn true;\n\t}\n\tconst badge = String(message.badge || '').trim().toLowerCase();\n\tif (badge.includes('internal')) {\n\t\treturn true;\n\t}\n\tconst source = String(message.source || '').trim();\n\tif (source && SUPPORT_INTERNAL_SOURCE_PATTERN.test(source)) {\n\t\treturn true;\n\t}\n\tconst text = [\n\t\tString(message.type || ''),\n\t\tString(message.user || ''),\n\t\tString(message.message || '')\n\t].join(' ');\n\treturn SUPPORT_INTERNAL_MESSAGE_PATTERN.test(text);\n}\n\nfunction stripSupportMessageInternalMetadata(message: any): Record<string, any> {\n\tconst next: Record<string, any> = { ...(message || {}) };\n\tdelete next.internal;\n\tdelete next.visibility;\n\tdelete next.badge;\n\tdelete next.source;\n\treturn next;\n}\n\nfunction sanitizeSupportTicketForClientView(ticket: any): any {\n\tif (!ticket || typeof ticket !== 'object') {\n\t\treturn ticket;\n\t}\n\tconst next: Record<string, any> = { ...ticket };\n\tnext.messages = Array.isArray(ticket.messages)\n\t\t? ticket.messages\n\t\t\t.filter((message: any) => !isInternalSupportMessage(message))\n\t\t\t.map((message: any) => stripSupportMessageInternalMetadata(message))\n\t\t: [];\n\tnext.notes = [];\n\tdelete next.automation;\n\tdelete next.ai_recommendations;\n\tdelete next.source;\n\treturn next;\n}\n\nfunction sanitizeSupportTicketUpdatePayload(ticket: any): any {\n\tif (!ticket || typeof ticket !== 'object') {\n\t\treturn ticket;\n\t}\n\tconst next: Record<string, any> = { ...ticket };\n\tnext.messages = Array.isArray(ticket.messages)\n\t\t? ticket.messages\n\t\t\t.filter((message: any) => !isInternalSupportMessage(message))\n\t\t\t.map((message: any) => stripSupportMessageInternalMetadata(message))\n\t\t: [];\n\tnext.notes = [];\n\tdelete next.automation;\n\tdelete next.ai_recommendations;\n\tdelete next.source;\n\treturn next;\n}\n"]}
@@ -53,6 +53,10 @@ export interface SupportTicketMessageModel {
53
53
  user: string;
54
54
  date: Date;
55
55
  type: SupportTicketMessageType;
56
+ internal?: boolean;
57
+ visibility?: 'public' | 'internal';
58
+ badge?: string;
59
+ source?: string;
56
60
  }
57
61
  type SupportTicketMessageType = 'ResolveIO' | 'Client';
58
62
  export interface SupportTicketWatchersModel {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/models/support-ticket.model.ts"],"names":[],"mappings":"","file":"support-ticket.model.js","sourcesContent":["import { CollectionDocument } from './collection-document.model';\n\nexport interface SupportTicketModel extends CollectionDocument {\n\ttype: SupportTicketType;\n\tpriority: SupportTicketPriority;\n\tissue: string;\n\tai_recommendations?: SupportTicketAiRecommendationsModel;\n\tsupport_ticket_number: number;\n\tsupport_ticket_number_string: string;\n\tstatus: SupportTicketStatus;\n\tsubstatus: SupportTicketSubstatus;\n\tclient: string;\n\tid_client: string;\n\tmessages: SupportTicketMessageModel[];\n\tdate_created: Date;\n\tdate_created_string: string;\n\tid_user_created: string;\n\tuser_created: string;\n\tbillable: boolean;\n\tdate_investigation?: Date;\n\tdate_closed?: Date;\n\tfiles: string[];\n\tcurrent_watchers: SupportTicketWatchersModel[];\n\tclient_user: SupportTicketClientUserModel;\n\tusers_assigned: SupportTicketUserAssignedModel[];\n\testimated_billable_hours?: number;\n\tbillable_hours?: number;\n\tbill_description: string;\n\ttasks: SupportTicketTaskModel[];\n\tnotes: SupportTicketNoteModel[];\n\tdifficulty: number;\n}\n\nexport interface SupportTicketAiRecommendationsModel {\n\tsource?: string;\n\thidden_from_client?: boolean;\n\tcreated_at?: Date;\n\tsource_message_id?: string;\n\tsummary?: string;\n\tinternal_recommendations?: string;\n\tcode_change_recommendations?: string;\n}\n\nexport interface SupportTicketClientUserModel {\n\tid_user: string;\n\tuser: string;\n\temail: string;\n}\n\nexport type SupportTicketPriority = 'High' | 'Low';\n\nexport type SupportTicketSubstatus = 'New' | 'Work In Progress' | 'Idle' | 'Awaiting Customer Interaction';\nexport type SupportTicketType = 'System Impairment' | 'Request New Feature' | 'General Inquery';\ntype SupportTicketStatus = 'Opened' | 'Resolved';\n\nexport interface SupportTicketMessageModel {\n\tmessage: string;\n\tid_user: string;\n\tuser: string;\n\tdate: Date;\n\ttype: SupportTicketMessageType;\n}\n\ntype SupportTicketMessageType = 'ResolveIO' | 'Client';\n\nexport interface SupportTicketWatchersModel {\n\tuser: string;\n\tid_user: string;\n\temail: string;\n}\n\nexport interface SupportTicketTaskModel {\n\tdescription: string;\n\tcompleted: boolean;\n\tid_user?: string;\n\tuser?: string;\n\tdate_created: Date;\n\tdate_completed?: Date;\n}\n\nexport interface SupportTicketNoteModel {\n\tdescription: string;\n\tid_user: string;\n\tuser: string;\n\tdate_created: Date;\n}\n\nexport interface SupportTicketUserAssignedModel {\n\tid_user: string;\n\tuser: string;\n\tdate_created: Date;\n} \n"]}
1
+ {"version":3,"sources":["../../src/models/support-ticket.model.ts"],"names":[],"mappings":"","file":"support-ticket.model.js","sourcesContent":["import { CollectionDocument } from './collection-document.model';\n\nexport interface SupportTicketModel extends CollectionDocument {\n\ttype: SupportTicketType;\n\tpriority: SupportTicketPriority;\n\tissue: string;\n\tai_recommendations?: SupportTicketAiRecommendationsModel;\n\tsupport_ticket_number: number;\n\tsupport_ticket_number_string: string;\n\tstatus: SupportTicketStatus;\n\tsubstatus: SupportTicketSubstatus;\n\tclient: string;\n\tid_client: string;\n\tmessages: SupportTicketMessageModel[];\n\tdate_created: Date;\n\tdate_created_string: string;\n\tid_user_created: string;\n\tuser_created: string;\n\tbillable: boolean;\n\tdate_investigation?: Date;\n\tdate_closed?: Date;\n\tfiles: string[];\n\tcurrent_watchers: SupportTicketWatchersModel[];\n\tclient_user: SupportTicketClientUserModel;\n\tusers_assigned: SupportTicketUserAssignedModel[];\n\testimated_billable_hours?: number;\n\tbillable_hours?: number;\n\tbill_description: string;\n\ttasks: SupportTicketTaskModel[];\n\tnotes: SupportTicketNoteModel[];\n\tdifficulty: number;\n}\n\nexport interface SupportTicketAiRecommendationsModel {\n\tsource?: string;\n\thidden_from_client?: boolean;\n\tcreated_at?: Date;\n\tsource_message_id?: string;\n\tsummary?: string;\n\tinternal_recommendations?: string;\n\tcode_change_recommendations?: string;\n}\n\nexport interface SupportTicketClientUserModel {\n\tid_user: string;\n\tuser: string;\n\temail: string;\n}\n\nexport type SupportTicketPriority = 'High' | 'Low';\n\nexport type SupportTicketSubstatus = 'New' | 'Work In Progress' | 'Idle' | 'Awaiting Customer Interaction';\nexport type SupportTicketType = 'System Impairment' | 'Request New Feature' | 'General Inquery';\ntype SupportTicketStatus = 'Opened' | 'Resolved';\n\nexport interface SupportTicketMessageModel {\n\tmessage: string;\n\tid_user: string;\n\tuser: string;\n\tdate: Date;\n\ttype: SupportTicketMessageType;\n\tinternal?: boolean;\n\tvisibility?: 'public' | 'internal';\n\tbadge?: string;\n\tsource?: string;\n}\n\ntype SupportTicketMessageType = 'ResolveIO' | 'Client';\n\nexport interface SupportTicketWatchersModel {\n\tuser: string;\n\tid_user: string;\n\temail: string;\n}\n\nexport interface SupportTicketTaskModel {\n\tdescription: string;\n\tcompleted: boolean;\n\tid_user?: string;\n\tuser?: string;\n\tdate_created: Date;\n\tdate_completed?: Date;\n}\n\nexport interface SupportTicketNoteModel {\n\tdescription: string;\n\tid_user: string;\n\tuser: string;\n\tdate_created: Date;\n}\n\nexport interface SupportTicketUserAssignedModel {\n\tid_user: string;\n\tuser: string;\n\tdate_created: Date;\n} \n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resolveio/server-lib",
3
- "version": "22.2.28",
3
+ "version": "22.2.29",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "package": "./build_package.sh",