@runnerpro/backend 1.5.7 → 1.5.9

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.
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.sendNotification = void 0;
16
16
  const node_apn_1 = __importDefault(require("@parse/node-apn"));
17
17
  const index_1 = require("../db/index");
18
+ const sendMail_1 = require("../sendMail");
18
19
  const sendNotification = ({ firebaseMessaging, idCliente, title, body, url }) => __awaiter(void 0, void 0, void 0, function* () {
19
20
  const devices = yield (0, index_1.query)('SELECT [SUBSCRIPTION], [TYPE] FROM [PUSH MANAGER] WHERE [ID CLIENTE] = ?', [idCliente]);
20
21
  for (const device of devices) {
@@ -53,7 +54,26 @@ function notificationIOS(msg, token) {
53
54
  body: msg.body,
54
55
  };
55
56
  note.topic = 'ios.runnerpro.cliente';
56
- apnProvider.send(note, token);
57
+ note.pushType = 'alert';
58
+ note.priority = 10;
59
+ try {
60
+ const result = yield apnProvider.send(note, token);
61
+ (0, sendMail_1.sendMail)({
62
+ to: ['david.jimenez@runnerpro.app'],
63
+ subject: 'Notificación APN enviada',
64
+ title: 'Notificación APN enviada',
65
+ body: JSON.stringify(result),
66
+ });
67
+ }
68
+ catch (error) {
69
+ (0, sendMail_1.sendMail)({
70
+ to: ['david.jimenez@runnerpro.app'],
71
+ subject: 'Error enviando notificación APN',
72
+ title: 'Error enviando notificación APN',
73
+ body: JSON.stringify(error),
74
+ });
75
+ }
76
+ apnProvider.shutdown();
57
77
  });
58
78
  }
59
79
  function notificationWEB(firebaseMessaging, msg, token) {
@@ -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;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED,QAAA,MAAM,gBAAgB,uDAA8D,YAAY,kBAwB/F,CAAC;AA4CF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/sendNotification/index.ts"],"names":[],"mappings":"AAIA,UAAU,YAAY;IACpB,iBAAiB,EAAE,GAAG,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED,QAAA,MAAM,gBAAgB,uDAA8D,YAAY,kBAwB/F,CAAC;AA+DF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runnerpro/backend",
3
- "version": "1.5.7",
3
+ "version": "1.5.9",
4
4
  "description": "A collection of common backend functions",
5
5
  "exports": {
6
6
  ".": "./lib/cjs/index.js"