@runnerpro/backend 1.5.16 → 1.6.1

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.
@@ -3,7 +3,7 @@ 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.getCountNotificaciones = exports.chatExposed = exports.chatApi = exports.chat = void 0;
6
+ exports.sendChatMessage = 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");
@@ -14,6 +14,8 @@ const exposed_1 = require("./exposed");
14
14
  Object.defineProperty(exports, "chatExposed", { enumerable: true, get: function () { return exposed_1.chatExposed; } });
15
15
  const getCountNotificaciones_1 = require("./utils/getCountNotificaciones");
16
16
  Object.defineProperty(exports, "getCountNotificaciones", { enumerable: true, get: function () { return getCountNotificaciones_1.getCountNotificaciones; } });
17
+ const sendChatMessage_1 = require("./utils/sendChatMessage");
18
+ Object.defineProperty(exports, "sendChatMessage", { enumerable: true, get: function () { return sendChatMessage_1.sendChatMessage; } });
17
19
  const chat = ({ server, app, verify_access_token, tokenExposed, backendExtremeUrl, frontendUrl, isClient }) => {
18
20
  // @ts-ignore
19
21
  const io = (0, socket_io_1.default)(server, {
@@ -0,0 +1,24 @@
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.sendChatMessage = void 0;
13
+ const index_1 = require("../../db/index");
14
+ const { getMessaging } = require('firebase-admin/messaging');
15
+ const sendChatMessage = ({ sendByClient, text, idClient, idSender, type, read, showClient, idWorkout, replyMessageId, textPreferredLanguage, preferredLanguage, fileMimetype, audioDuration, filePath, options, }) => __awaiter(void 0, void 0, void 0, function* () {
16
+ const { sendNotification, maskAsRead } = options;
17
+ const [cliente] = yield (0, index_1.query)('SELECT [PREFERRED LANGUAGE] FROM [CLIENTE] LIMIT 1');
18
+ const messaging = getMessaging();
19
+ return {
20
+ cliente,
21
+ messaging
22
+ };
23
+ });
24
+ exports.sendChatMessage = sendChatMessage;
package/lib/cjs/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDefaultWorkoutImage = exports.generateShareMap = exports.reduceSizeImage = exports.getLetter = exports.getNumberByLetter = exports.appendSheet = exports.writeSheet = exports.findCellByValue = exports.readSheet = exports.NOTION_DATABASES_ID = exports.notionEditPage = exports.notionAddPage = exports.notionGetDatabase = exports.notionGetUsers = exports.getCountNotificaciones = exports.chatExposed = exports.chatApi = exports.chat = exports.getExerciseTranslatedDescription = exports.useTranslation = exports.LANGUAGES = exports.translate = exports.CHANNEL_SLACK = exports.notifySlack = exports.fetchIA = exports.err = exports.sendMail = exports.pool = exports.toPgArray = exports.batchQuery = exports.query = exports.sleep = exports.sendNotification = void 0;
3
+ exports.getDefaultWorkoutImage = exports.generateShareMap = exports.reduceSizeImage = exports.getLetter = exports.getNumberByLetter = exports.appendSheet = exports.writeSheet = exports.findCellByValue = exports.readSheet = exports.NOTION_DATABASES_ID = exports.notionEditPage = exports.notionAddPage = exports.notionGetDatabase = exports.notionGetUsers = exports.sendChatMessage = exports.getCountNotificaciones = exports.chatExposed = exports.chatApi = exports.chat = exports.getExerciseTranslatedDescription = exports.useTranslation = exports.LANGUAGES = exports.translate = exports.CHANNEL_SLACK = exports.notifySlack = exports.fetchIA = exports.err = exports.sendMail = exports.pool = exports.toPgArray = 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");
@@ -29,6 +29,7 @@ Object.defineProperty(exports, "chat", { enumerable: true, get: function () { re
29
29
  Object.defineProperty(exports, "chatApi", { enumerable: true, get: function () { return chat_1.chatApi; } });
30
30
  Object.defineProperty(exports, "chatExposed", { enumerable: true, get: function () { return chat_1.chatExposed; } });
31
31
  Object.defineProperty(exports, "getCountNotificaciones", { enumerable: true, get: function () { return chat_1.getCountNotificaciones; } });
32
+ Object.defineProperty(exports, "sendChatMessage", { enumerable: true, get: function () { return chat_1.sendChatMessage; } });
32
33
  const notion_1 = require("./notion");
33
34
  Object.defineProperty(exports, "notionGetUsers", { enumerable: true, get: function () { return notion_1.notionGetUsers; } });
34
35
  Object.defineProperty(exports, "notionGetDatabase", { enumerable: true, get: function () { return notion_1.notionGetDatabase; } });
@@ -1,6 +1,7 @@
1
1
  import { chatApi } from './api';
2
2
  import { chatExposed } from './exposed';
3
3
  import { getCountNotificaciones } from './utils/getCountNotificaciones';
4
+ import { sendChatMessage } from './utils/sendChatMessage';
4
5
  declare const chat: ({ server, app, verify_access_token, tokenExposed, backendExtremeUrl, frontendUrl, isClient }: {
5
6
  server: any;
6
7
  app: any;
@@ -10,5 +11,5 @@ declare const chat: ({ server, app, verify_access_token, tokenExposed, backendEx
10
11
  frontendUrl: any;
11
12
  isClient: any;
12
13
  }) => void;
13
- export { chat, chatApi, chatExposed, getCountNotificaciones };
14
+ export { chat, chatApi, chatExposed, getCountNotificaciones, sendChatMessage };
14
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
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"}
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;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,QAAA,MAAM,IAAI;;;;;;;;UA8BT,CAAC;AAEF,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,eAAe,EAAE,CAAC"}
@@ -0,0 +1,22 @@
1
+ declare const sendChatMessage: ({ sendByClient, text, idClient, idSender, type, read, showClient, idWorkout, replyMessageId, textPreferredLanguage, preferredLanguage, fileMimetype, audioDuration, filePath, options, }: {
2
+ sendByClient: any;
3
+ text: any;
4
+ idClient: any;
5
+ idSender: any;
6
+ type: any;
7
+ read: any;
8
+ showClient: any;
9
+ idWorkout: any;
10
+ replyMessageId: any;
11
+ textPreferredLanguage: any;
12
+ preferredLanguage: any;
13
+ fileMimetype: any;
14
+ audioDuration: any;
15
+ filePath: any;
16
+ options: any;
17
+ }) => Promise<{
18
+ cliente: any;
19
+ messaging: any;
20
+ }>;
21
+ export { sendChatMessage };
22
+ //# sourceMappingURL=sendChatMessage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendChatMessage.d.ts","sourceRoot":"","sources":["../../../../../src/chat/utils/sendChatMessage.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;EA4BpB,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,CAAC"}
@@ -6,11 +6,11 @@ import { err } from './err';
6
6
  import { fetchIA } from './fetch/fetchIA';
7
7
  import { notifySlack, CHANNEL_SLACK } from './slack';
8
8
  import { translate, LANGUAGES, useTranslation, getExerciseTranslatedDescription } from './translation';
9
- import { chat, chatApi, chatExposed, getCountNotificaciones } from './chat';
9
+ import { chat, chatApi, chatExposed, getCountNotificaciones, sendChatMessage } from './chat';
10
10
  import { notionGetUsers, notionGetDatabase, notionAddPage, notionEditPage, NOTION_DATABASES_ID } from './notion';
11
11
  import { readSheet, findCellByValue, writeSheet, appendSheet, getNumberByLetter, getLetter } from './googleSheet';
12
12
  import { reduceSizeImage } from './image/reduceSizeImage';
13
13
  import { generateShareMap } from './image/generateShareMap';
14
14
  import { getDefaultWorkoutImage } from './image/getDefaultWorkoutImage';
15
- export { sendNotification, sleep, query, batchQuery, toPgArray, pool, sendMail, err, fetchIA, notifySlack, CHANNEL_SLACK, translate, LANGUAGES, useTranslation, getExerciseTranslatedDescription, chat, chatApi, chatExposed, getCountNotificaciones, notionGetUsers, notionGetDatabase, notionAddPage, notionEditPage, NOTION_DATABASES_ID, readSheet, findCellByValue, writeSheet, appendSheet, getNumberByLetter, getLetter, reduceSizeImage, generateShareMap, getDefaultWorkoutImage, };
15
+ export { sendNotification, sleep, query, batchQuery, toPgArray, pool, sendMail, err, fetchIA, notifySlack, CHANNEL_SLACK, translate, LANGUAGES, useTranslation, getExerciseTranslatedDescription, chat, chatApi, chatExposed, getCountNotificaciones, sendChatMessage, notionGetUsers, notionGetDatabase, notionAddPage, notionEditPage, NOTION_DATABASES_ID, readSheet, findCellByValue, writeSheet, appendSheet, getNumberByLetter, getLetter, reduceSizeImage, generateShareMap, getDefaultWorkout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BAAsB,EAAE,MAAM,gCAAgC,CAAC;AAExE,OAAO,EACL,gBAAgB,EAChB,KAAK,EACL,KAAK,EACL,UAAU,EACV,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,GAAG,EACH,OAAO,EACP,WAAW,EACX,aAAa,EACb,SAAS,EACT,SAAS,EACT,cAAc,EACd,gCAAgC,EAChC,IAAI,EACJ,OAAO,EACP,WAAW,EACX,sBAAsB,EACtB,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,SAAS,EACT,eAAe,EACf,UAAU,EACV,WAAW,EACX,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,sBAAsB,GACvB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runnerpro/backend",
3
- "version": "1.5.16",
3
+ "version": "1.6.1",
4
4
  "description": "A collection of common backend functions",
5
5
  "exports": {
6
6
  ".": "./lib/cjs/index.js"