@tiledesk/tiledesk-server 2.3.29 → 2.3.30
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.
- package/CHANGELOG.md +15 -4
- package/app.js +5 -3
- package/package.json +1 -1
- package/routes/message.js +3 -1
- package/utils/promiseUtil.js +31 -0
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
|
2
|
-
#
|
2
|
+
# 2.3.32
|
3
|
+
- JSON_BODY_LIMIT increased to 500KB. Added JSON_BODY_LIMIT env variable
|
4
|
+
|
5
|
+
# 2.3.31
|
6
|
+
- save multiple messages fix with sequential promises
|
7
|
+
|
8
|
+
# 2.3.29
|
3
9
|
- UIDGenerator class replacement for request route
|
4
10
|
- Added hasRole cache for project_user
|
5
11
|
- Added index { id_project: 1, role: 1, status: 1, createdAt: 1 } for Project_user schema
|
@@ -9,9 +15,14 @@
|
|
9
15
|
- Log fix
|
10
16
|
- add fields reply and enabled to faq model
|
11
17
|
- field answer in faq model is no longer required
|
12
|
-
- add field public to faq_kb model
|
18
|
+
- add field public to faq_kb model
|
13
19
|
- when template is undefined the empty template is now created
|
14
|
-
-
|
20
|
+
- Add unit test for project and project_user
|
21
|
+
- Created new endpoint for creating new requests with unit test
|
22
|
+
- Created new endpoint for inserting multiple messages at once with unit test
|
23
|
+
- New validation for empty text for new message endpoint
|
24
|
+
- Added project_user_test route
|
25
|
+
- Unit test fix
|
15
26
|
|
16
27
|
# 2.3.28
|
17
28
|
- UIDGenerator renamed fix
|
@@ -29,7 +40,7 @@
|
|
29
40
|
|
30
41
|
# 2.3.24
|
31
42
|
- Increased cache TTL from: standardTTL from 120 to 300, longTTL from 1200 to 3600
|
32
|
-
- Added cache request.create.simple
|
43
|
+
- Added cache request.create.simple + cacheEnabler. name fix
|
33
44
|
- Disabled unapplicable cache for updateWaitingTimeByRequestId and find request by id REST API
|
34
45
|
- Updated dependency @tiledesk/tiledesk-tybot-connector to 0.1.14
|
35
46
|
- Restored populateMessageWithRequest. Bug with \agent command. Try to resolve performance with cache
|
package/app.js
CHANGED
@@ -148,7 +148,6 @@ geoService.listen();
|
|
148
148
|
|
149
149
|
|
150
150
|
|
151
|
-
|
152
151
|
var faqBotHandler = require('./services/faqBotHandler');
|
153
152
|
faqBotHandler.listen();
|
154
153
|
|
@@ -225,7 +224,10 @@ if (process.env.ENABLE_ALTERNATIVE_CORS_MIDDLEWARE === "true") {
|
|
225
224
|
|
226
225
|
// https://stackoverflow.com/questions/18710225/node-js-get-raw-request-body-using-express
|
227
226
|
|
228
|
-
|
227
|
+
const JSON_BODY_LIMIT = process.envJSON_BODY_LIMIT || '500KB';
|
228
|
+
winston.debug("JSON_BODY_LIMIT : " + JSON_BODY_LIMIT);
|
229
|
+
|
230
|
+
app.use(bodyParser.json({limit: JSON_BODY_LIMIT,
|
229
231
|
verify: function (req, res, buf) {
|
230
232
|
// var url = req.originalUrl;
|
231
233
|
// if (url.indexOf('/stripe/')) {
|
@@ -235,7 +237,7 @@ app.use(bodyParser.json({
|
|
235
237
|
}
|
236
238
|
}));
|
237
239
|
|
238
|
-
app.use(bodyParser.urlencoded({ extended: false }));
|
240
|
+
app.use(bodyParser.urlencoded({limit: JSON_BODY_LIMIT, extended: false }));
|
239
241
|
|
240
242
|
app.use(cookieParser());
|
241
243
|
app.use(express.static(path.join(__dirname, 'public')));
|
package/package.json
CHANGED
package/routes/message.js
CHANGED
@@ -21,6 +21,7 @@ const { check, validationResult } = require('express-validator');
|
|
21
21
|
|
22
22
|
var Project_user = require("../models/project_user");
|
23
23
|
var mongoose = require('mongoose');
|
24
|
+
var PromiseUtil = require("../utils/promiseUtil");
|
24
25
|
|
25
26
|
csv = require('csv-express');
|
26
27
|
csv.separator = ';';
|
@@ -406,7 +407,8 @@ async (req, res) => {
|
|
406
407
|
});
|
407
408
|
winston.debug('--- >promises', promises);
|
408
409
|
|
409
|
-
Promise.all(promises).then((values) => {
|
410
|
+
//Promise.all(promises).then((values) => {
|
411
|
+
PromiseUtil.doAllSequentually(promises).then((values) => {
|
410
412
|
winston.info('Inserted multiple messages with values: ', values);
|
411
413
|
return res.status(200).json(values);
|
412
414
|
}).catch((err) => {
|
@@ -0,0 +1,31 @@
|
|
1
|
+
class PromiseUtil {
|
2
|
+
|
3
|
+
async doAllSequentually(promises) {
|
4
|
+
// return new Promise(async function (resolve, reject) {
|
5
|
+
// console.log("promises",promises);
|
6
|
+
var values = [];
|
7
|
+
for (let i=0; i < promises.length; i++) {
|
8
|
+
// console.log("promises[i]",promises[i]);
|
9
|
+
|
10
|
+
// const val = await
|
11
|
+
var value = await promises[i]
|
12
|
+
// .then(function(value) {
|
13
|
+
// console.log("done promises[i]",value);
|
14
|
+
// values.push(value);
|
15
|
+
// console.log("values before",values);
|
16
|
+
// });
|
17
|
+
values.push(value);
|
18
|
+
};
|
19
|
+
|
20
|
+
console.log("values",values);
|
21
|
+
// return resolve(values);
|
22
|
+
|
23
|
+
// });
|
24
|
+
return values;
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
var promiseUtil = new PromiseUtil();
|
29
|
+
|
30
|
+
|
31
|
+
module.exports = promiseUtil;
|