@runnerpro/backend 1.5.13 → 1.5.15

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.
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.toPgArray = exports.batchQuery = exports.query = void 0;
15
+ exports.pool = exports.toPgArray = exports.batchQuery = exports.query = void 0;
16
16
  const pg_1 = __importDefault(require("pg"));
17
17
  const { Pool } = pg_1.default;
18
18
  const pool = new Pool({
@@ -22,6 +22,7 @@ const pool = new Pool({
22
22
  host: process.env.DB_HOST,
23
23
  port: 5432,
24
24
  });
25
+ exports.pool = pool;
25
26
  const query = (queryText, values = []) => __awaiter(void 0, void 0, void 0, function* () {
26
27
  const client = yield pool.connect();
27
28
  const text = getParseQuery(queryText, values);
@@ -11,7 +11,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.sendNotification = void 0;
13
13
  const index_1 = require("../db/index");
14
- const sendMail_1 = require("../sendMail");
15
14
  const sendNotification = ({ firebaseMessaging, idCliente, title, body }) => __awaiter(void 0, void 0, void 0, function* () {
16
15
  const devices = yield (0, index_1.query)('SELECT [SUBSCRIPTION], [TYPE] FROM [PUSH MANAGER] WHERE [ID CLIENTE] = ?', [idCliente]);
17
16
  for (const device of devices) {
@@ -31,14 +30,6 @@ function notificationWEB(firebaseMessaging, msg, token) {
31
30
  token,
32
31
  notification: msg,
33
32
  data: msg,
34
- })
35
- .then((response) => {
36
- (0, sendMail_1.sendMail)({
37
- to: ['david.jimenez@runnerpro.app'],
38
- subject: 'Notificación APN enviada',
39
- title: 'Notificación APN enviada ' + token,
40
- body: JSON.stringify(response),
41
- });
42
33
  })
43
34
  .catch((error) => {
44
35
  if (error.errorInfo.code === 'messaging/registration-token-not-registered') {
@@ -47,12 +38,6 @@ function notificationWEB(firebaseMessaging, msg, token) {
47
38
  // [idCliente, subscription]
48
39
  // );
49
40
  }
50
- (0, sendMail_1.sendMail)({
51
- to: ['david.jimenez@runnerpro.app'],
52
- subject: 'Error enviando notificación APN',
53
- title: 'Error enviando notificación APN ' + token,
54
- body: JSON.stringify(error),
55
- });
56
41
  });
57
42
  });
58
43
  }
@@ -1,5 +1,7 @@
1
+ import postgresql from 'pg';
2
+ declare const pool: postgresql.Pool;
1
3
  declare const query: (queryText: string, values?: (string | number | boolean)[]) => Promise<any>;
2
4
  declare const toPgArray: (arr: string[]) => string;
3
5
  declare const batchQuery: (queries: any, length?: number) => Promise<void>;
4
- export { query, batchQuery, toPgArray };
6
+ export { query, batchQuery, toPgArray, pool };
5
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/db/index.ts"],"names":[],"mappings":"AAYA,QAAA,MAAM,KAAK,cAAqB,MAAM,WAAU,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,iBAsB5E,CAAC;AAEF,QAAA,MAAM,SAAS,QAAS,MAAM,EAAE,WAM/B,CAAC;AA+BF,QAAA,MAAM,UAAU,YAAmB,GAAG,mCAUrC,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/db/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,IAAI,CAAC;AAI5B,QAAA,MAAM,IAAI,iBAMR,CAAC;AAEH,QAAA,MAAM,KAAK,cAAqB,MAAM,WAAU,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,iBAsB5E,CAAC;AAEF,QAAA,MAAM,SAAS,QAAS,MAAM,EAAE,WAM/B,CAAC;AA+BF,QAAA,MAAM,UAAU,YAAmB,GAAG,mCAUrC,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/sendNotification/index.ts"],"names":[],"mappings":"AAGA,UAAU,YAAY;IACpB,iBAAiB,EAAE,GAAG,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,QAAA,MAAM,gBAAgB,kDAAyD,YAAY,kBAa1F,CAAC;AAmCF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/sendNotification/index.ts"],"names":[],"mappings":"AAEA,UAAU,YAAY;IACpB,iBAAiB,EAAE,GAAG,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,QAAA,MAAM,gBAAgB,kDAAyD,YAAY,kBAa1F,CAAC;AAqBF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runnerpro/backend",
3
- "version": "1.5.13",
3
+ "version": "1.5.15",
4
4
  "description": "A collection of common backend functions",
5
5
  "exports": {
6
6
  ".": "./lib/cjs/index.js"