@runnerpro/backend 1.0.23 → 1.0.25
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 +1 -0
- package/lib/cjs/chat/index.js +7 -1
- package/lib/cjs/chat/utils/getCountNotificaciones.js +35 -0
- package/lib/cjs/index.js +4 -5
- package/lib/cjs/sendMail/index.js +9 -9
- package/lib/cjs/types/chat/api/conversation.d.ts.map +1 -1
- package/lib/cjs/types/chat/index.d.ts +4 -1
- package/lib/cjs/types/chat/index.d.ts.map +1 -1
- package/lib/cjs/types/chat/utils/getCountNotificaciones.d.ts +7 -0
- package/lib/cjs/types/chat/utils/getCountNotificaciones.d.ts.map +1 -0
- package/lib/cjs/types/index.d.ts +2 -4
- package/lib/cjs/types/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -244,6 +244,7 @@ const markReadMessage = ({ isClient, query, idCliente }) => __awaiter(void 0, vo
|
|
|
244
244
|
const resizeImage = (data, filePath, mimetype) => __awaiter(void 0, void 0, void 0, function* () {
|
|
245
245
|
if (mimetype.includes('webp'))
|
|
246
246
|
return data;
|
|
247
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
247
248
|
const sizeOf = (0, util_1.promisify)(require('image-size'));
|
|
248
249
|
const dimensions = yield sizeOf(filePath);
|
|
249
250
|
const imageWidth = dimensions.width;
|
package/lib/cjs/chat/index.js
CHANGED
|
@@ -3,11 +3,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.chat = void 0;
|
|
6
|
+
exports.getCountNotificaciones = exports.chatExposed = exports.chatApi = exports.chat = void 0;
|
|
7
7
|
const socket_io_1 = __importDefault(require("socket.io"));
|
|
8
8
|
const axios_1 = __importDefault(require("axios"));
|
|
9
9
|
const getRoom_1 = require("./utils/getRoom");
|
|
10
10
|
const index_1 = require("../index");
|
|
11
|
+
const api_1 = require("./api");
|
|
12
|
+
Object.defineProperty(exports, "chatApi", { enumerable: true, get: function () { return api_1.chatApi; } });
|
|
13
|
+
const exposed_1 = require("./exposed");
|
|
14
|
+
Object.defineProperty(exports, "chatExposed", { enumerable: true, get: function () { return exposed_1.chatExposed; } });
|
|
15
|
+
const getCountNotificaciones_1 = require("./utils/getCountNotificaciones");
|
|
16
|
+
Object.defineProperty(exports, "getCountNotificaciones", { enumerable: true, get: function () { return getCountNotificaciones_1.getCountNotificaciones; } });
|
|
11
17
|
const chat = ({ server, app, verify_access_token, tokenExposed, backendExtremeUrl, frontendUrl, isClient }) => {
|
|
12
18
|
// @ts-ignore
|
|
13
19
|
const io = (0, socket_io_1.default)(server, {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getCountNotificaciones = void 0;
|
|
13
|
+
const getCountNotificaciones = ({ query, isClient, idClient }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
+
if (isClient) {
|
|
15
|
+
const [{ chat }] = yield query(`
|
|
16
|
+
SELECT COUNT([ID]) AS [CHAT]
|
|
17
|
+
FROM [CHAT MESSAGE]
|
|
18
|
+
WHERE [ID CLIENTE] = ? AND [READ] = FALSE AND [ID SENDER] != [ID CLIENTE]
|
|
19
|
+
`, [idClient]);
|
|
20
|
+
return chat;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
const [{ chat }] = yield query(`
|
|
24
|
+
SELECT COUNT([C].[ID]) AS [CHAT]
|
|
25
|
+
FROM [CLIENTE] AS [C]
|
|
26
|
+
LEFT JOIN (
|
|
27
|
+
SELECT *, ROW_NUMBER() OVER (PARTITION BY [ID CLIENTE] ORDER BY [DATE] DESC) AS [ROW]
|
|
28
|
+
FROM [CHAT MESSAGE]
|
|
29
|
+
) AS [CM] ON [CM].[ID CLIENTE] = [C].[ID] AND [CM].[ROW] = 1
|
|
30
|
+
WHERE [CM].[READ] = FALSE AND [CM].[ID SENDER] = [CM].[ID CLIENTE]
|
|
31
|
+
`);
|
|
32
|
+
return chat;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
exports.getCountNotificaciones = getCountNotificaciones;
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.chatExposed = exports.chatApi = exports.chat = exports.useTranslation = exports.LANGUAGES = exports.translate = exports.fetchIA = exports.err = exports.sendMail = exports.batchQuery = exports.query = exports.sleep = exports.sendNotification = void 0;
|
|
3
|
+
exports.getCountNotificaciones = exports.chatExposed = exports.chatApi = exports.chat = exports.useTranslation = exports.LANGUAGES = exports.translate = exports.fetchIA = exports.err = exports.sendMail = exports.batchQuery = exports.query = exports.sleep = exports.sendNotification = void 0;
|
|
4
4
|
const sendNotification_1 = require("./sendNotification");
|
|
5
5
|
Object.defineProperty(exports, "sendNotification", { enumerable: true, get: function () { return sendNotification_1.sendNotification; } });
|
|
6
6
|
const sleep_1 = require("./sleep");
|
|
@@ -20,7 +20,6 @@ Object.defineProperty(exports, "LANGUAGES", { enumerable: true, get: function ()
|
|
|
20
20
|
Object.defineProperty(exports, "useTranslation", { enumerable: true, get: function () { return translation_1.useTranslation; } });
|
|
21
21
|
const chat_1 = require("./chat");
|
|
22
22
|
Object.defineProperty(exports, "chat", { enumerable: true, get: function () { return chat_1.chat; } });
|
|
23
|
-
|
|
24
|
-
Object.defineProperty(exports, "
|
|
25
|
-
|
|
26
|
-
Object.defineProperty(exports, "chatExposed", { enumerable: true, get: function () { return exposed_1.chatExposed; } });
|
|
23
|
+
Object.defineProperty(exports, "chatApi", { enumerable: true, get: function () { return chat_1.chatApi; } });
|
|
24
|
+
Object.defineProperty(exports, "chatExposed", { enumerable: true, get: function () { return chat_1.chatExposed; } });
|
|
25
|
+
Object.defineProperty(exports, "getCountNotificaciones", { enumerable: true, get: function () { return chat_1.getCountNotificaciones; } });
|
|
@@ -59,12 +59,12 @@ function getBodyHTML(title, body, link) {
|
|
|
59
59
|
.button {
|
|
60
60
|
display: inline-block;
|
|
61
61
|
padding: 12px 26px;
|
|
62
|
-
font-size:
|
|
62
|
+
font-size: 17px;
|
|
63
63
|
text-align: center;
|
|
64
64
|
text-decoration: none;
|
|
65
65
|
background-color: #ea5b1b;
|
|
66
66
|
color: #ffffff !important;
|
|
67
|
-
margin:
|
|
67
|
+
margin: 40px 0 20px 0;
|
|
68
68
|
font-family: 'Sofia Sans', 'Roboto', sans-serif;
|
|
69
69
|
font-weight: bold;
|
|
70
70
|
border-radius: 4px;
|
|
@@ -72,22 +72,22 @@ function getBodyHTML(title, body, link) {
|
|
|
72
72
|
}
|
|
73
73
|
</style>
|
|
74
74
|
</head>
|
|
75
|
-
<body style="background: #f0f0f0;">
|
|
76
|
-
<table role="presentation" style="width:100%;border-collapse:collapse;border:0;border-spacing:0;background:#f0f0f0
|
|
75
|
+
<body style="background: #f0f0f0; padding: 0 0 40px 0">
|
|
76
|
+
<table role="presentation" style="width:100%;border-collapse:collapse;border:0;border-spacing:0;background:#f0f0f0">
|
|
77
77
|
<tr>
|
|
78
78
|
<td align="center" style="padding:0;">
|
|
79
79
|
<table role="presentation" style="width:100%;border-collapse:collapse;border-spacing:0;text-align:left;">
|
|
80
80
|
<tr>
|
|
81
|
-
<td align="center" style="padding:0;background:#ea5b1b;">
|
|
82
|
-
<img src="cid:logo" alt="" width="
|
|
81
|
+
<td align="center" style="padding:5px 0 0 0;background:#ea5b1b;">
|
|
82
|
+
<img src="cid:logo" alt="" width="220" style="height:auto;display:block;">
|
|
83
83
|
</td>
|
|
84
84
|
</tr>
|
|
85
85
|
<tr>
|
|
86
|
-
<td style="padding:20px
|
|
87
|
-
<h1 style="font-size:
|
|
86
|
+
<td style="padding:20px 24px 0px 24px; max-width: 600px" align="center">
|
|
87
|
+
<h1 style="font-size:22px;text-align:center;margin:16px 0 6px 0;font-family:'Sofia Sans', 'Roboto', sans-serif;font-style: italic">
|
|
88
88
|
${title || ''}
|
|
89
89
|
</h1>
|
|
90
|
-
<p style="margin:0 0 12px 0;font-size:
|
|
90
|
+
<p style="text-align:left;margin:0 0 12px 0;font-size:15px;line-height:24px;font-family:'Sofia Sans', 'Roboto', sans-serif;">
|
|
91
91
|
${body.split('\n').join('<br>')}
|
|
92
92
|
</p>
|
|
93
93
|
${link
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../../src/chat/api/conversation.ts"],"names":[],"mappings":"AAWA,QAAA,MAAM,iBAAiB,0BAA2B,GAAG,SAiBpD,CAAC;
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../../src/chat/api/conversation.ts"],"names":[],"mappings":"AAWA,QAAA,MAAM,iBAAiB,0BAA2B,GAAG,SAiBpD,CAAC;AAmQF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { chatApi } from './api';
|
|
2
|
+
import { chatExposed } from './exposed';
|
|
3
|
+
import { getCountNotificaciones } from './utils/getCountNotificaciones';
|
|
1
4
|
declare const chat: ({ server, app, verify_access_token, tokenExposed, backendExtremeUrl, frontendUrl, isClient }: {
|
|
2
5
|
server: any;
|
|
3
6
|
app: any;
|
|
@@ -7,5 +10,5 @@ declare const chat: ({ server, app, verify_access_token, tokenExposed, backendEx
|
|
|
7
10
|
frontendUrl: any;
|
|
8
11
|
isClient: any;
|
|
9
12
|
}) => void;
|
|
10
|
-
export { chat };
|
|
13
|
+
export { chat, chatApi, chatExposed, getCountNotificaciones };
|
|
11
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/chat/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/chat/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAExE,QAAA,MAAM,IAAI;;;;;;;;UA8BT,CAAC;AAEF,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCountNotificaciones.d.ts","sourceRoot":"","sources":["../../../../../src/chat/utils/getCountNotificaciones.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,sBAAsB;;;;kBAuB3B,CAAC;AAEF,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
|
package/lib/cjs/types/index.d.ts
CHANGED
|
@@ -5,8 +5,6 @@ import { sendMail } from './sendMail';
|
|
|
5
5
|
import { err } from './err';
|
|
6
6
|
import { fetchIA } from './fetch/fetchIA';
|
|
7
7
|
import { translate, LANGUAGES, useTranslation } from './translation';
|
|
8
|
-
import { chat } from './chat';
|
|
9
|
-
|
|
10
|
-
import { chatExposed } from './chat/exposed';
|
|
11
|
-
export { sendNotification, sleep, query, batchQuery, sendMail, err, fetchIA, translate, LANGUAGES, useTranslation, chat, chatApi, chatExposed };
|
|
8
|
+
import { chat, chatApi, chatExposed, getCountNotificaciones } from './chat';
|
|
9
|
+
export { sendNotification, sleep, query, batchQuery, sendMail, err, fetchIA, translate, LANGUAGES, useTranslation, chat, chatApi, chatExposed, getCountNotificaciones, };
|
|
12
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AAE5E,OAAO,EACL,gBAAgB,EAChB,KAAK,EACL,KAAK,EACL,UAAU,EACV,QAAQ,EACR,GAAG,EACH,OAAO,EACP,SAAS,EACT,SAAS,EACT,cAAc,EACd,IAAI,EACJ,OAAO,EACP,WAAW,EACX,sBAAsB,GACvB,CAAC"}
|