@runnerpro/backend 1.1.6 → 1.1.8
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/lib/cjs/chat/api/conversation.js +12 -12
- package/lib/cjs/chat/api/listConversations.js +1 -1
- package/lib/cjs/chat/exposed/conversation.js +1 -1
- package/lib/cjs/chat/index.js +1 -1
- package/lib/cjs/err/index.js +3 -3
- package/lib/cjs/fetch/fetchIA.js +1 -1
- package/lib/cjs/types/err/index.d.ts +1 -1
- package/lib/cjs/types/err/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -43,14 +43,14 @@ const conversationRoute = (_a) => {
|
|
|
43
43
|
files: 1,
|
|
44
44
|
},
|
|
45
45
|
});
|
|
46
|
-
router.get('/conversation', (req, res) => getConversation(req, res, params).catch((error) => (0, index_1.err)(req, res, error)));
|
|
47
|
-
router.get('/conversation/suggestion', (req, res) => getConversationSuggestion(req, res).catch((error) => (0, index_1.err)(req, res, error)));
|
|
48
|
-
router.get('/conversation/image/:id', (req, res) => getConversationImage(req, res, params).catch((error) => (0, index_1.err)(req, res, error)));
|
|
49
|
-
router.get('/conversation/file/:id', (req, res) => getConversationFile(req, res, params).catch((error) => (0, index_1.err)(req, res, error)));
|
|
50
|
-
router.post('/conversation/send', (req, res) => sendMessage(req, res, params).catch((error) => (0, index_1.err)(req, res, error)));
|
|
51
|
-
router.post('/conversation/send-file', uploadFile.single('file'), (req, res) => sendFile(req, res, params).catch((error) => (0, index_1.err)(req, res, error)));
|
|
52
|
-
router.post('/conversation/read', (req, res) => readMessage(req, res, params).catch((error) => (0, index_1.err)(req, res, error)));
|
|
53
|
-
router.post('/conversation/read-feelings', (req, res) => readFeelings(req, res, params).catch((error) => (0, index_1.err)(req, res, error)));
|
|
46
|
+
router.get('/conversation', (req, res, next) => getConversation(req, res, params).catch((error) => (0, index_1.err)(req, res, error, next)));
|
|
47
|
+
router.get('/conversation/suggestion', (req, res, next) => getConversationSuggestion(req, res, next).catch((error) => (0, index_1.err)(req, res, error, next)));
|
|
48
|
+
router.get('/conversation/image/:id', (req, res, next) => getConversationImage(req, res, params).catch((error) => (0, index_1.err)(req, res, error, next)));
|
|
49
|
+
router.get('/conversation/file/:id', (req, res, next) => getConversationFile(req, res, params).catch((error) => (0, index_1.err)(req, res, error, next)));
|
|
50
|
+
router.post('/conversation/send', (req, res, next) => sendMessage(req, res, params).catch((error) => (0, index_1.err)(req, res, error, next)));
|
|
51
|
+
router.post('/conversation/send-file', uploadFile.single('file'), (req, res, next) => sendFile(req, res, params, next).catch((error) => (0, index_1.err)(req, res, error, next)));
|
|
52
|
+
router.post('/conversation/read', (req, res, next) => readMessage(req, res, params).catch((error) => (0, index_1.err)(req, res, error, next)));
|
|
53
|
+
router.post('/conversation/read-feelings', (req, res, next) => readFeelings(req, res, params).catch((error) => (0, index_1.err)(req, res, error, next)));
|
|
54
54
|
};
|
|
55
55
|
exports.conversationRoute = conversationRoute;
|
|
56
56
|
const getConversation = (req, res, { query, isClient }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -127,7 +127,7 @@ const getChatFile = ({ query, bucket, id, isClient, userid }) => __awaiter(void
|
|
|
127
127
|
return null;
|
|
128
128
|
}
|
|
129
129
|
});
|
|
130
|
-
const getConversationSuggestion = (req, res) => __awaiter(void 0, void 0, void 0, function* () {
|
|
130
|
+
const getConversationSuggestion = (req, res, next) => __awaiter(void 0, void 0, void 0, function* () {
|
|
131
131
|
let result;
|
|
132
132
|
try {
|
|
133
133
|
result = yield axios_1.default
|
|
@@ -141,7 +141,7 @@ const getConversationSuggestion = (req, res) => __awaiter(void 0, void 0, void 0
|
|
|
141
141
|
.then((response) => response.data);
|
|
142
142
|
}
|
|
143
143
|
catch (e) {
|
|
144
|
-
(0, index_1.err)(null, null, e);
|
|
144
|
+
(0, index_1.err)(null, null, e, next);
|
|
145
145
|
result = { error: 'Ha habido un error con el servidor' };
|
|
146
146
|
}
|
|
147
147
|
finally {
|
|
@@ -196,7 +196,7 @@ const getPreferredLanguageForChat = ({ text, idCliente, isClient, query }) => __
|
|
|
196
196
|
preferredLanguage: preferredLanguage,
|
|
197
197
|
};
|
|
198
198
|
});
|
|
199
|
-
const sendFile = (req, res, { sendNotification, firebaseMessaging, query, isClient, bucket }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
199
|
+
const sendFile = (req, res, { sendNotification, firebaseMessaging, query, isClient, bucket }, next) => __awaiter(void 0, void 0, void 0, function* () {
|
|
200
200
|
const { idCliente, type, duration } = req.body;
|
|
201
201
|
const { userid } = req.session;
|
|
202
202
|
const [{ id: idFile }] = yield query('INSERT INTO [CHAT MESSAGE] ([ID CLIENTE], [ID SENDER], [TEXT], [MIMETYPE], [DURATION], [TYPE]) VALUES (?, ?, ?, ?, ?, ?) RETURNING [ID]', [isClient ? userid : idCliente, userid, req.file.originalname, req.file.mimetype, duration || null, type || 2]);
|
|
@@ -211,7 +211,7 @@ const sendFile = (req, res, { sendNotification, firebaseMessaging, query, isClie
|
|
|
211
211
|
files.push({ data: fileDataOriented, id: `${idFile}-original` });
|
|
212
212
|
}
|
|
213
213
|
catch (error) {
|
|
214
|
-
(0, index_1.err)(null, null, error);
|
|
214
|
+
(0, index_1.err)(null, null, error, next);
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
else {
|
|
@@ -23,7 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
23
23
|
exports.listConversationsRoute = void 0;
|
|
24
24
|
const listConversationsRoute = (_a) => {
|
|
25
25
|
var { router, err } = _a, params = __rest(_a, ["router", "err"]);
|
|
26
|
-
router.get('/list', (req, res) => getList(req, res, params).catch((error) => err(req, res, error)));
|
|
26
|
+
router.get('/list', (req, res, next) => getList(req, res, params).catch((error) => err(req, res, error, next)));
|
|
27
27
|
};
|
|
28
28
|
exports.listConversationsRoute = listConversationsRoute;
|
|
29
29
|
const getList = (req, res, { query, isClient }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -24,7 +24,7 @@ exports.conversationRoute = void 0;
|
|
|
24
24
|
const getRoom_1 = require("../utils/getRoom");
|
|
25
25
|
const conversationRoute = (_a) => {
|
|
26
26
|
var { router, err } = _a, params = __rest(_a, ["router", "err"]);
|
|
27
|
-
router.post('/conversation/socket', (req, res) => socketConversation(req, res, params).catch((error) => err(req, res, error)));
|
|
27
|
+
router.post('/conversation/socket', (req, res, next) => socketConversation(req, res, params).catch((error) => err(req, res, error, next)));
|
|
28
28
|
};
|
|
29
29
|
exports.conversationRoute = conversationRoute;
|
|
30
30
|
const socketConversation = (req, res, { isClient }) => __awaiter(void 0, void 0, void 0, function* () {
|
package/lib/cjs/chat/index.js
CHANGED
|
@@ -40,7 +40,7 @@ const chat = ({ server, app, verify_access_token, tokenExposed, backendExtremeUr
|
|
|
40
40
|
token: tokenExposed,
|
|
41
41
|
},
|
|
42
42
|
})
|
|
43
|
-
.catch((error) => (0, index_1.err)(null, null, error));
|
|
43
|
+
.catch((error) => (0, index_1.err)(null, null, error, null));
|
|
44
44
|
});
|
|
45
45
|
});
|
|
46
46
|
};
|
package/lib/cjs/err/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.err = void 0;
|
|
4
|
-
const err = (req, res, error) => {
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const err = (req, res, error, next) => {
|
|
5
|
+
if (next)
|
|
6
|
+
next(error);
|
|
7
7
|
};
|
|
8
8
|
exports.err = err;
|
package/lib/cjs/fetch/fetchIA.js
CHANGED
|
@@ -69,5 +69,5 @@ function catchAxios(error, bypassStatus, url) {
|
|
|
69
69
|
var _a, _b;
|
|
70
70
|
if (bypassStatus)
|
|
71
71
|
return error.response;
|
|
72
|
-
(0, index_1.err)(url, (_a = error.response) === null || _a === void 0 ? void 0 : _a.status, (_b = error.response) === null || _b === void 0 ? void 0 : _b.data);
|
|
72
|
+
(0, index_1.err)(url, (_a = error.response) === null || _a === void 0 ? void 0 : _a.status, (_b = error.response) === null || _b === void 0 ? void 0 : _b.data, null);
|
|
73
73
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/err/index.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,GAAG,QAAS,GAAG,OAAO,GAAG,SAAS,GAAG,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/err/index.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,GAAG,QAAS,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,SAErD,CAAC;AAEF,OAAO,EAAE,GAAG,EAAE,CAAC"}
|