@tiledesk/tiledesk-server 2.10.14 → 2.10.16

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 (50) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/app.js +2 -1
  3. package/models/request.js +8 -0
  4. package/package.json +4 -3
  5. package/pubmodules/activities/test/activityRoute.js +6 -2
  6. package/pubmodules/events/test/eventRoute.js +7 -3
  7. package/pubmodules/pubModulesManager.js +24 -0
  8. package/pubmodules/voice-twilio/index.js +6 -0
  9. package/pubmodules/voice-twilio/listener.js +59 -0
  10. package/routes/campaigns.js +1 -1
  11. package/routes/files.js +6 -4
  12. package/routes/images.js +0 -2
  13. package/routes/kb.js +7 -1
  14. package/routes/request.js +10 -0
  15. package/routes/users.js +2 -2
  16. package/services/fileGridFsService.js +12 -10
  17. package/services/requestService.js +2 -1
  18. package/test/app-test.js +36 -1
  19. package/test/authentication.js +662 -796
  20. package/test/authenticationJwt.js +213 -315
  21. package/test/authorization.js +53 -72
  22. package/test/campaignsRoute.js +42 -47
  23. package/test/cannedRoute.js +30 -16
  24. package/test/departmentService.js +222 -274
  25. package/test/example.json +31 -1
  26. package/test/faqRoute.js +713 -622
  27. package/test/faqService.js +124 -159
  28. package/test/faqkbRoute.js +128 -100
  29. package/test/fileRoute.js +50 -46
  30. package/test/imageRoute.js +263 -254
  31. package/test/jwtRoute.js +128 -153
  32. package/test/kbRoute.js +40 -17
  33. package/test/kbsettingsRoute.js +78 -54
  34. package/test/keysRoute.js +6 -7
  35. package/test/labelRoute.js +591 -696
  36. package/test/labelService.js +40 -47
  37. package/test/leadService.js +100 -115
  38. package/test/logsRoute.js +13 -7
  39. package/test/messageRootRoute.js +112 -102
  40. package/test/messageRoute.js +1171 -1419
  41. package/test/messageService.js +41 -43
  42. package/test/openaiRoute.js +5 -1
  43. package/test/projectRoute.js +23 -4
  44. package/test/projectService.js +3 -1
  45. package/test/quoteManager.js +36 -13
  46. package/test/requestRoute.js +103 -72
  47. package/test/requestService.js +51 -51
  48. package/test/userRoute.js +37 -8
  49. package/test/userService.js +34 -31
  50. package/utils/promiseUtil.js +1 -1
@@ -38,7 +38,10 @@ describe('KbSettingsRoute', () => {
38
38
  .auth(email, pwd)
39
39
  .send({}) // can be empty
40
40
  .end((err, res) => {
41
+
42
+ if (err) { console.error("err: ", err); }
41
43
  if (log) { console.log("create kbsettings res.body: ", res.body); }
44
+
42
45
  res.should.have.status(200);
43
46
  res.body.should.be.a('object');
44
47
  expect(res.body.id_project).to.equal(savedProject._id.toString());
@@ -47,7 +50,10 @@ describe('KbSettingsRoute', () => {
47
50
  .get('/' + savedProject._id + "/kbsettings")
48
51
  .auth(email, pwd)
49
52
  .end((err, res) => {
53
+
54
+ if (err) { console.error("err: ", err); }
50
55
  if (log) { console.log("get kbsettings res.body: ", res.body); }
56
+
51
57
  res.should.have.status(200);
52
58
  res.body.should.be.a('object');
53
59
  expect(res.body.id_project).to.equal(savedProject._id.toString())
@@ -77,7 +83,10 @@ describe('KbSettingsRoute', () => {
77
83
  .get('/' + savedProject._id + "/kbsettings")
78
84
  .auth(email, pwd)
79
85
  .end((err, res) => {
86
+
87
+ if (err) { console.error("err: ", err); }
80
88
  if (log) { console.log("get kbsettings res.body: ", res.body); }
89
+
81
90
  res.should.have.status(200);
82
91
  res.body.should.be.a('object');
83
92
  expect(res.body.id_project).to.equal(savedProject._id.toString())
@@ -106,7 +115,10 @@ describe('KbSettingsRoute', () => {
106
115
  .auth(email, pwd)
107
116
  .send({}) // can be empty
108
117
  .end((err, res) => {
118
+
119
+ if (err) { console.error("err: ", err); }
109
120
  if (log) { console.log("create kbsettings res.body: ", res.body); }
121
+
110
122
  res.should.have.status(200);
111
123
  res.body.should.be.a('object');
112
124
  expect(res.body.id_project).to.equal(savedProject._id.toString());
@@ -118,7 +130,10 @@ describe('KbSettingsRoute', () => {
118
130
  .auth(email, pwd)
119
131
  .send({ name: "exampleurl.com/kb/", url: "https://exampleurl.com/kb/" })
120
132
  .end((err, res) => {
133
+
134
+ if (err) { console.error("err: ", err); }
121
135
  if (log) { console.log("add kb to kb settings res.body: ", res.body); }
136
+
122
137
  res.should.have.status(200);
123
138
  res.body.should.be.a('object');
124
139
  //expect(res.body.kbs).to.have.length(1)
@@ -128,7 +143,10 @@ describe('KbSettingsRoute', () => {
128
143
  .auth(email, pwd)
129
144
  .send({ name: "secondurl.com/support/", url: "https://secondurl.com/support/" })
130
145
  .end((err, res) => {
146
+
147
+ if (err) { console.error("err: ", err); }
131
148
  if (log) { console.log("add kb to kb settings res.body: ", res.body); }
149
+
132
150
  res.should.have.status(200);
133
151
  res.body.should.be.a('object');
134
152
  //expect(res.body.kbs).to.have.length(2)
@@ -157,7 +175,10 @@ describe('KbSettingsRoute', () => {
157
175
  .auth(email, pwd)
158
176
  .send({}) // can be empty
159
177
  .end((err, res) => {
178
+
179
+ if (err) { console.error("err: ", err); }
160
180
  if (log) { console.log("create kbsettings res.body: ", res.body); }
181
+
161
182
  res.should.have.status(200);
162
183
  res.body.should.be.a('object');
163
184
 
@@ -166,7 +187,10 @@ describe('KbSettingsRoute', () => {
166
187
  .auth(email, pwd)
167
188
  .send({ gptkey: "sk-12345678" })
168
189
  .end((err, res) => {
190
+
191
+ if (err) { console.error("err: ", err); }
169
192
  if (log) { console.log("add kb to kb settings res.body: ", res.body); }
193
+
170
194
  res.should.have.status(200);
171
195
  res.body.should.be.a('object');
172
196
 
@@ -180,69 +204,69 @@ describe('KbSettingsRoute', () => {
180
204
 
181
205
  });
182
206
 
183
- it('deleteKbFromList', (done) => {
207
+ // it('deleteKbFromList', (done) => {
184
208
 
185
- var email = "test-signup-" + Date.now() + "@email.com";
186
- var pwd = "pwd";
187
-
188
- userService.signup(email, pwd, "Test Firstname", "Test lastname").then(function (savedUser) {
189
- projectService.create("test-faqkb-create", savedUser._id).then(function (savedProject) {
209
+ // var email = "test-signup-" + Date.now() + "@email.com";
210
+ // var pwd = "pwd";
190
211
 
191
- chai.request(server)
192
- .post('/' + savedProject._id + '/kbsettings')
193
- .auth(email, pwd)
194
- .send({}) // can be empty
195
- .end((err, res) => {
196
- if (log) { console.log("create kbsettings res.body: ", res.body); }
197
- res.should.have.status(200);
198
- res.body.should.be.a('object');
199
- expect(res.body.id_project).to.equal(savedProject._id.toString());
212
+ // userService.signup(email, pwd, "Test Firstname", "Test lastname").then(function (savedUser) {
213
+ // projectService.create("test-faqkb-create", savedUser._id).then(function (savedProject) {
200
214
 
201
- let settings_id = res.body._id;
215
+ // chai.request(server)
216
+ // .post('/' + savedProject._id + '/kbsettings')
217
+ // .auth(email, pwd)
218
+ // .send({}) // can be empty
219
+ // .end((err, res) => {
220
+ // if (log) { console.log("create kbsettings res.body: ", res.body); }
221
+ // res.should.have.status(200);
222
+ // res.body.should.be.a('object');
223
+ // expect(res.body.id_project).to.equal(savedProject._id.toString());
202
224
 
203
- chai.request(server)
204
- .post('/' + savedProject._id + "/kbsettings/" + settings_id)
205
- .auth(email, pwd)
206
- .send({ name: "exampleurl.com/kb/", url: "https://exampleurl.com/kb/" })
207
- .end((err, res) => {
208
- if (log) { console.log("add kb to kb settings res.body: ", res.body); }
209
- res.should.have.status(200);
210
- res.body.should.be.a('object');
211
- //expect(res.body.kbs).to.have.length(1)
225
+ // let settings_id = res.body._id;
212
226
 
213
- let kb_to_delete_id = res.body._id;
227
+ // chai.request(server)
228
+ // .post('/' + savedProject._id + "/kbsettings/" + settings_id)
229
+ // .auth(email, pwd)
230
+ // .send({ name: "exampleurl.com/kb/", url: "https://exampleurl.com/kb/" })
231
+ // .end((err, res) => {
232
+ // if (log) { console.log("add kb to kb settings res.body: ", res.body); }
233
+ // res.should.have.status(200);
234
+ // res.body.should.be.a('object');
235
+ // //expect(res.body.kbs).to.have.length(1)
214
236
 
215
- chai.request(server)
216
- .post('/' + savedProject._id + "/kbsettings/" + settings_id)
217
- .auth(email, pwd)
218
- .send({ name: "secondurl.com/support/", url: "https://secondurl.com/support/" })
219
- .end((err, res) => {
220
- if (log) { console.log("add kb to kb settings res.body: ", res.body); }
221
- res.should.have.status(200);
222
- res.body.should.be.a('object');
223
- //expect(res.body.kbs).to.have.length(2)
237
+ // let kb_to_delete_id = res.body._id;
224
238
 
225
- chai.request(server)
226
- .delete('/' + savedProject._id + "/kbsettings/" + settings_id + "/" + kb_to_delete_id)
227
- .auth(email, pwd)
228
- .end((err, res) => {
229
- if (log) { console.log("delete kb res.body: ", res.body); };
230
- res.should.have.status(200);
231
- res.body.should.be.a('object');
232
- expect(res.body.kbs).to.have.length(1)
233
- expect(res.body.kbs[0].name).to.equal("secondurl.com/support/");
234
- expect(res.body.kbs[0].url).to.equal("https://secondurl.com/support/");
235
-
236
- done();
237
- })
238
- })
239
+ // chai.request(server)
240
+ // .post('/' + savedProject._id + "/kbsettings/" + settings_id)
241
+ // .auth(email, pwd)
242
+ // .send({ name: "secondurl.com/support/", url: "https://secondurl.com/support/" })
243
+ // .end((err, res) => {
244
+ // if (log) { console.log("add kb to kb settings res.body: ", res.body); }
245
+ // res.should.have.status(200);
246
+ // res.body.should.be.a('object');
247
+ // //expect(res.body.kbs).to.have.length(2)
248
+
249
+ // chai.request(server)
250
+ // .delete('/' + savedProject._id + "/kbsettings/" + settings_id + "/" + kb_to_delete_id)
251
+ // .auth(email, pwd)
252
+ // .end((err, res) => {
253
+ // if (log) { console.log("delete kb res.body: ", res.body); };
254
+ // res.should.have.status(200);
255
+ // res.body.should.be.a('object');
256
+ // expect(res.body.kbs).to.have.length(1)
257
+ // expect(res.body.kbs[0].name).to.equal("secondurl.com/support/");
258
+ // expect(res.body.kbs[0].url).to.equal("https://secondurl.com/support/");
259
+
260
+ // done();
261
+ // })
262
+ // })
239
263
 
240
- })
241
- })
242
- });
243
- });
264
+ // })
265
+ // })
266
+ // });
267
+ // });
244
268
 
245
- });
269
+ // });
246
270
 
247
271
 
248
272
 
package/test/keysRoute.js CHANGED
@@ -11,6 +11,8 @@ let chaiHttp = require('chai-http');
11
11
  let server = require('../app');
12
12
  let should = chai.should();
13
13
 
14
+ let log = false;
15
+
14
16
  // chai.config.includeStack = true;
15
17
 
16
18
  var expect = chai.expect;
@@ -22,13 +24,8 @@ describe('KeysRoute', () => {
22
24
 
23
25
  describe('/generate', () => {
24
26
 
25
-
26
-
27
27
  it('generate', (done) => {
28
28
 
29
-
30
- // this.timeout();
31
-
32
29
  var email = "test-signup-" + Date.now() + "@email.com";
33
30
  var pwd = "pwd";
34
31
 
@@ -39,8 +36,10 @@ describe('KeysRoute', () => {
39
36
  .auth(email, pwd)
40
37
  .send()
41
38
  .end((err, res) => {
42
- //console.log("res", res);
43
- console.log("res.body", res.body);
39
+
40
+ if (err) { console.error("err: ", err); }
41
+ if (log) { console.log("res.body", res.body); }
42
+
44
43
  res.should.have.status(200);
45
44
  res.body.should.be.a('object');
46
45
  expect(res.body.jwtSecret).to.not.equal(null);