@runnerpro/backend 0.0.2 → 1.0.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.
- package/README.md +60 -7
- package/lib/cjs/db/index.js +81 -0
- package/lib/cjs/index.js +8 -3
- package/lib/cjs/sendMail/index.js +115 -0
- package/lib/cjs/sendNotification/index.js +70 -0
- package/lib/cjs/types/db/index.d.ts +4 -0
- package/lib/cjs/types/db/index.d.ts.map +1 -0
- package/lib/cjs/types/index.d.ts +4 -2
- package/lib/cjs/types/index.d.ts.map +1 -1
- package/lib/cjs/types/sendMail/index.d.ts +19 -0
- package/lib/cjs/types/sendMail/index.d.ts.map +1 -0
- package/lib/cjs/types/sendNotification/index.d.ts +9 -0
- package/lib/cjs/types/sendNotification/index.d.ts.map +1 -0
- package/lib/cjs/types/sleep/index.d.ts +1 -1
- package/lib/cjs/types/sleep/index.d.ts.map +1 -1
- package/package.json +17 -23
- package/LICENSE +0 -21
- package/lib/cjs/HelloWorld/index.js +0 -8
- package/lib/cjs/types/HelloWorld/index.d.ts +0 -2
- package/lib/cjs/types/HelloWorld/index.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,15 +1,68 @@
|
|
|
1
1
|
# modern-npm-package
|
|
2
2
|
|
|
3
|
-
An npm
|
|
3
|
+
An npm packages for common backend logic between client and dashboard app.
|
|
4
4
|
|
|
5
5
|
## Get Started
|
|
6
6
|
|
|
7
|
-
1. Run `npm install`
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
1. Run `npm install @runnerpro/backend`
|
|
8
|
+
|
|
9
|
+
## Functions
|
|
10
|
+
|
|
11
|
+
### query
|
|
12
|
+
|
|
13
|
+
Connection with the PostgresSQL database
|
|
14
|
+
|
|
15
|
+
- <b>Param</b>: string with PostgreSQL query
|
|
16
|
+
- <b>Param</b>: array of values
|
|
17
|
+
- <b>Return</b>: promise of array of values (each item is a row of the table)
|
|
18
|
+
|
|
19
|
+
### batchQuery
|
|
20
|
+
|
|
21
|
+
Connection with PostgreSQL database in batches. Use for faster query execution when we need to execute many queries.
|
|
22
|
+
|
|
23
|
+
- <b>Param</b>: Array of queries
|
|
24
|
+
- query: string with PostgreSQL query
|
|
25
|
+
- values: array of values
|
|
26
|
+
- <b>Param?</b>: length of promises wait together. Default 5
|
|
27
|
+
- <b>Return</b>: promise (without values)
|
|
28
|
+
|
|
29
|
+
### sendMail
|
|
30
|
+
|
|
31
|
+
Send mail with company logo and template
|
|
32
|
+
|
|
33
|
+
- <b>Param</b>: { subject, title, body, to, link?, attachments?, bcc? }
|
|
34
|
+
|
|
35
|
+
- subject: title of the mail
|
|
36
|
+
- body: text inside card
|
|
37
|
+
- to: array of mails. In DEV and SBX the value is taken from .env GMAIL_EMAIL_USER
|
|
38
|
+
- link: button to redirect to the app. { text: text inside button, url: path (after runnerpro.com) }
|
|
39
|
+
- attachments: array of files to attach. { filename: name and extension of file, path: path of file, cid?: identifier to insert inside the body (`<img src="cid:__cid__" />`) }
|
|
40
|
+
- bcc: array of mails to send via bcc
|
|
41
|
+
|
|
42
|
+
- <b>Return</b>: promise (without values)
|
|
43
|
+
|
|
44
|
+
### sendNotification
|
|
45
|
+
|
|
46
|
+
Send web or native notification to client: TODO
|
|
47
|
+
|
|
48
|
+
- <b>Param</b>: Array of queries { query: string with PostgreSQL query, values: array of values }
|
|
49
|
+
- <b>Param?</b>: length of promises wait together. Default 5
|
|
50
|
+
- <b>Return</b>: promise (without values)
|
|
51
|
+
|
|
52
|
+
### sleep
|
|
53
|
+
|
|
54
|
+
Wait X miliseconds to execute next line
|
|
55
|
+
|
|
56
|
+
- <b>Param</b>: number of miliseconds of the promise
|
|
57
|
+
- <b>Return</b>: promise (without values)
|
|
58
|
+
|
|
59
|
+
## Deploy new version
|
|
60
|
+
|
|
61
|
+
1. Create a folder with the name of functionality and index.ts inside. Write the function and export it.
|
|
62
|
+
2. In main index.ts (the one inside src), import and export it
|
|
63
|
+
3. Change the version number of the package ([using this convenction](https://docs.npmjs.com/about-semantic-versioning))
|
|
64
|
+
4. Run `npm login`
|
|
65
|
+
5. Run `npm run publish`
|
|
13
66
|
|
|
14
67
|
### Testing
|
|
15
68
|
|
|
@@ -0,0 +1,81 @@
|
|
|
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.batchQuery = exports.query = void 0;
|
|
13
|
+
const postgresql = require('pg');
|
|
14
|
+
const { Pool } = postgresql;
|
|
15
|
+
const pool = new Pool({
|
|
16
|
+
user: process.env.DB_USER,
|
|
17
|
+
database: process.env.DB_NAME,
|
|
18
|
+
password: process.env.DB_PASSWORD,
|
|
19
|
+
host: process.env.DB_HOST,
|
|
20
|
+
port: 5432,
|
|
21
|
+
});
|
|
22
|
+
const query = (query, values = []) => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
|
+
const client = yield pool.connect();
|
|
24
|
+
const text = getParseQuery(query, values);
|
|
25
|
+
const result = yield client.query({
|
|
26
|
+
rowMode: 'json',
|
|
27
|
+
text,
|
|
28
|
+
values: values.flat(),
|
|
29
|
+
});
|
|
30
|
+
client.release();
|
|
31
|
+
return (result.rows || []).map((row) => {
|
|
32
|
+
const json = Object.keys(row);
|
|
33
|
+
const aux = {};
|
|
34
|
+
json.forEach((key) => {
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
aux[camelize(key)] = row[key];
|
|
37
|
+
});
|
|
38
|
+
return aux;
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
exports.query = query;
|
|
42
|
+
function getParseQuery(query, values) {
|
|
43
|
+
query = query.split('[').join('"').split(']').join('"');
|
|
44
|
+
const splitted = query.split('?');
|
|
45
|
+
let count = 1;
|
|
46
|
+
return splitted.reduce((acc, chunk, i) => {
|
|
47
|
+
if (!(values[i] instanceof Array)) {
|
|
48
|
+
const text = `${acc}${chunk}${i + 1 === splitted.length ? '' : `$${count}`}`;
|
|
49
|
+
count++;
|
|
50
|
+
return text;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
const aux = [];
|
|
54
|
+
values[i].forEach(() => {
|
|
55
|
+
aux.push(`$${count}`);
|
|
56
|
+
count++;
|
|
57
|
+
});
|
|
58
|
+
return `${acc}${chunk}${i + 1 === splitted.length ? '' : aux.join(',')}`;
|
|
59
|
+
}
|
|
60
|
+
}, '');
|
|
61
|
+
}
|
|
62
|
+
function camelize(str) {
|
|
63
|
+
return str
|
|
64
|
+
.toLowerCase()
|
|
65
|
+
.replace(/(?:^\w|[A-Z]|\b\w)/g, function (word, index) {
|
|
66
|
+
return index === 0 ? word.toLowerCase() : word.toUpperCase();
|
|
67
|
+
})
|
|
68
|
+
.replace(/\s+/g, '');
|
|
69
|
+
}
|
|
70
|
+
const batchQuery = (queries, length = 5) => __awaiter(void 0, void 0, void 0, function* () {
|
|
71
|
+
let promises = [];
|
|
72
|
+
for (const q of queries) {
|
|
73
|
+
promises.push(query(q.query, q.values));
|
|
74
|
+
if (promises.length === length) {
|
|
75
|
+
yield Promise.all(promises);
|
|
76
|
+
promises = [];
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
yield Promise.all(promises);
|
|
80
|
+
});
|
|
81
|
+
exports.batchQuery = batchQuery;
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sleep = exports.
|
|
4
|
-
const
|
|
5
|
-
Object.defineProperty(exports, "
|
|
3
|
+
exports.sendMail = exports.batchQuery = exports.query = exports.sleep = exports.sendNotification = void 0;
|
|
4
|
+
const sendNotification_1 = require("./sendNotification");
|
|
5
|
+
Object.defineProperty(exports, "sendNotification", { enumerable: true, get: function () { return sendNotification_1.sendNotification; } });
|
|
6
6
|
const sleep_1 = require("./sleep");
|
|
7
7
|
Object.defineProperty(exports, "sleep", { enumerable: true, get: function () { return sleep_1.sleep; } });
|
|
8
|
+
const db_1 = require("./db");
|
|
9
|
+
Object.defineProperty(exports, "query", { enumerable: true, get: function () { return db_1.query; } });
|
|
10
|
+
Object.defineProperty(exports, "batchQuery", { enumerable: true, get: function () { return db_1.batchQuery; } });
|
|
11
|
+
const sendMail_1 = require("./sendMail");
|
|
12
|
+
Object.defineProperty(exports, "sendMail", { enumerable: true, get: function () { return sendMail_1.sendMail; } });
|
|
@@ -0,0 +1,115 @@
|
|
|
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.sendMail = void 0;
|
|
13
|
+
const nodemailer = require('nodemailer');
|
|
14
|
+
const path = require('path');
|
|
15
|
+
const transporter = nodemailer.createTransport({
|
|
16
|
+
service: 'gmail',
|
|
17
|
+
auth: {
|
|
18
|
+
user: process.env.GMAIL_EMAIL_USER,
|
|
19
|
+
pass: process.env.GMAIL_EMAIL_PWD,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
const sendMail = ({ subject, title, body, to, link, attachments, bcc, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
|
+
const bodyHTML = getBodyHTML(title, body, link);
|
|
24
|
+
return transporter.sendMail({
|
|
25
|
+
from: process.env.GMAIL_EMAIL_USER,
|
|
26
|
+
to: process.env.NODE_ENV === 'PROD'
|
|
27
|
+
? to.map((correo) => correo).join(',')
|
|
28
|
+
: process.env.GMAIL_EMAIL_USER,
|
|
29
|
+
bcc: process.env.NODE_ENV === 'PROD' && bcc
|
|
30
|
+
? bcc.map((correo) => correo).join(',')
|
|
31
|
+
: '',
|
|
32
|
+
subject,
|
|
33
|
+
text: body + (link ? link.url : ''),
|
|
34
|
+
html: bodyHTML,
|
|
35
|
+
attachments: [
|
|
36
|
+
...(attachments || []),
|
|
37
|
+
{
|
|
38
|
+
filename: 'logo-large.png',
|
|
39
|
+
path: path.join(__dirname, '../../../static/logo-large.png'),
|
|
40
|
+
cid: 'logo',
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
exports.sendMail = sendMail;
|
|
46
|
+
function getBodyHTML(title, body, link) {
|
|
47
|
+
return `
|
|
48
|
+
<html lang="es">
|
|
49
|
+
<head>
|
|
50
|
+
<meta charset="UTF-8">
|
|
51
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
52
|
+
<title>Correo con estilo</title>
|
|
53
|
+
<style>
|
|
54
|
+
/* Estilos generales */
|
|
55
|
+
body {
|
|
56
|
+
margin: 0;
|
|
57
|
+
padding: 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* Estilos específicos del botón */
|
|
61
|
+
.button {
|
|
62
|
+
display: inline-block;
|
|
63
|
+
padding: 12px 26px;
|
|
64
|
+
font-size: 18px;
|
|
65
|
+
text-align: center;
|
|
66
|
+
text-decoration: none;
|
|
67
|
+
background-color: #ea5b1b;
|
|
68
|
+
color: #ffffff !important;
|
|
69
|
+
margin: 20px 0 40px 0;
|
|
70
|
+
font-family: 'Sofia Sans', 'Roboto', sans-serif;
|
|
71
|
+
font-weight: bold;
|
|
72
|
+
border-radius: 4px;
|
|
73
|
+
border: 2px solid #ea5b1b;
|
|
74
|
+
}
|
|
75
|
+
</style>
|
|
76
|
+
</head>
|
|
77
|
+
<body style="background: #f0f0f0;">
|
|
78
|
+
<table role="presentation" style="width:100%;border-collapse:collapse;border:0;border-spacing:0;background:#f0f0f0;">
|
|
79
|
+
<tr>
|
|
80
|
+
<td align="center" style="padding:0;">
|
|
81
|
+
<table role="presentation" style="width:100%;border-collapse:collapse;border-spacing:0;text-align:left;">
|
|
82
|
+
<tr>
|
|
83
|
+
<td align="center" style="padding:0;background:#ea5b1b;">
|
|
84
|
+
<img src="cid:logo" alt="" width="300" style="height:auto;display:block;">
|
|
85
|
+
</td>
|
|
86
|
+
</tr>
|
|
87
|
+
<tr>
|
|
88
|
+
<td style="padding:20px 30px 0px 30px; max-width: 600px" align="center">
|
|
89
|
+
<h1 style="font-size:28px;text-align:center;margin:0 0 20px 0;font-family:'Sofia Sans', 'Roboto', sans-serif;">
|
|
90
|
+
${title || ''}
|
|
91
|
+
</h1>
|
|
92
|
+
<p style="margin:0 0 12px 0;font-size:16px;line-height:24px;font-family:'Sofia Sans', 'Roboto', sans-serif;">
|
|
93
|
+
${body.split('\n').join('<br>')}
|
|
94
|
+
</p>
|
|
95
|
+
${link
|
|
96
|
+
? `
|
|
97
|
+
<table role="presentation" style="width:100%;border-collapse:collapse;border:0;border-spacing:0;background:#f0f0f0;">
|
|
98
|
+
<tr>
|
|
99
|
+
<td align="center" style="padding:0;">
|
|
100
|
+
<a href="${process.env.FRONTEND_URL}${link.url}" class="button" style="color:white">${link.text}</a>
|
|
101
|
+
</td>
|
|
102
|
+
</tr>
|
|
103
|
+
</table>
|
|
104
|
+
`
|
|
105
|
+
: ''}
|
|
106
|
+
</td>
|
|
107
|
+
</tr>
|
|
108
|
+
</table>
|
|
109
|
+
</td>
|
|
110
|
+
</tr>
|
|
111
|
+
</table>
|
|
112
|
+
</body>
|
|
113
|
+
</html>
|
|
114
|
+
`;
|
|
115
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
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.sendNotification = void 0;
|
|
13
|
+
const apn = require('@parse/node-apn');
|
|
14
|
+
const { getMessaging } = require('firebase-admin/messaging');
|
|
15
|
+
const { query } = require('../db');
|
|
16
|
+
const sendNotification = ({ idCliente, title, body, url, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
+
const messaging = getMessaging();
|
|
18
|
+
const devices = yield query('SELECT [SUBSCRIPTION], [TYPE] FROM [PUSH MANAGER] WHERE [ID CLIENTE] = ?', [idCliente]);
|
|
19
|
+
for (const device of devices) {
|
|
20
|
+
if (device.type === 'IOS') {
|
|
21
|
+
notificationIOS({
|
|
22
|
+
title,
|
|
23
|
+
body,
|
|
24
|
+
}, device.subscription);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
notificationWEB(messaging, {
|
|
28
|
+
title,
|
|
29
|
+
body,
|
|
30
|
+
url: process.env.FRONTEND_URL + url,
|
|
31
|
+
}, device.subscription);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
exports.sendNotification = sendNotification;
|
|
36
|
+
function notificationIOS(msg, token) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
var options = {
|
|
39
|
+
token: {
|
|
40
|
+
key: 'env/apple_notification.p8',
|
|
41
|
+
keyId: 'B7CYLPUCAM',
|
|
42
|
+
teamId: 'UA78D3SXQG',
|
|
43
|
+
},
|
|
44
|
+
production: true,
|
|
45
|
+
};
|
|
46
|
+
var apnProvider = new apn.Provider(options);
|
|
47
|
+
var note = new apn.Notification();
|
|
48
|
+
note.expiry = Math.floor(Date.now() / 1000) + 3600 * 24; // Expires 24 hour from now.
|
|
49
|
+
note.alert = { title: 'RunnerPro', subtitle: msg.title, body: msg.body };
|
|
50
|
+
note.topic = 'ios.runnerpro.cliente';
|
|
51
|
+
apnProvider.send(note, token);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function notificationWEB(messaging, msg, token) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
messaging
|
|
57
|
+
.send({
|
|
58
|
+
token,
|
|
59
|
+
data: msg,
|
|
60
|
+
})
|
|
61
|
+
.catch((error) => {
|
|
62
|
+
if (error.errorInfo.code === 'messaging/registration-token-not-registered') {
|
|
63
|
+
// query(
|
|
64
|
+
// 'DELETE FROM [PUSH MANAGER] WHERE [ID CLIENTE] = ? AND [SUBSCRIPTION] = ?',
|
|
65
|
+
// [idCliente, subscription]
|
|
66
|
+
// );
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/db/index.ts"],"names":[],"mappings":"AAYA,QAAA,MAAM,KAAK,UACF,MAAM,WACL,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,iBAoBtC,CAAC;AAiCF,QAAA,MAAM,UAAU,YAAmB,GAAG,mCAUrC,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC"}
|
package/lib/cjs/types/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { sendNotification } from './sendNotification';
|
|
2
2
|
import { sleep } from './sleep';
|
|
3
|
-
|
|
3
|
+
import { query, batchQuery } from './db';
|
|
4
|
+
import { sendMail } from './sendMail';
|
|
5
|
+
export { sendNotification, sleep, query, batchQuery, sendMail };
|
|
4
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,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;AAEtC,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
interface Mail {
|
|
2
|
+
subject: string;
|
|
3
|
+
title: string;
|
|
4
|
+
body: string;
|
|
5
|
+
to: string[];
|
|
6
|
+
link?: {
|
|
7
|
+
url: string;
|
|
8
|
+
text: string;
|
|
9
|
+
};
|
|
10
|
+
attachments?: {
|
|
11
|
+
filename: string;
|
|
12
|
+
path: string;
|
|
13
|
+
cid?: string;
|
|
14
|
+
}[];
|
|
15
|
+
bcc?: string[];
|
|
16
|
+
}
|
|
17
|
+
declare const sendMail: ({ subject, title, body, to, link, attachments, bcc, }: Mail) => Promise<any>;
|
|
18
|
+
export { sendMail };
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/sendMail/index.ts"],"names":[],"mappings":"AAWA,UAAU,IAAI;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,EAAE,CAAC;IACb,IAAI,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACrC,WAAW,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACjE,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,QAAA,MAAM,QAAQ,0DAQX,IAAI,iBAwBN,CAAC;AA+EF,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface Notification {
|
|
2
|
+
idCliente: number;
|
|
3
|
+
title: string;
|
|
4
|
+
body: string;
|
|
5
|
+
url: string;
|
|
6
|
+
}
|
|
7
|
+
declare const sendNotification: ({ idCliente, title, body, url, }: Notification) => Promise<void>;
|
|
8
|
+
export { sendNotification };
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/sendNotification/index.ts"],"names":[],"mappings":"AAIA,UAAU,YAAY;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED,QAAA,MAAM,gBAAgB,qCAKnB,YAAY,kBA4Bd,CAAC;AA+CF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/sleep/index.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,KAAK,OAAQ,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/sleep/index.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,KAAK,OAAQ,MAAM,KAAG,QAAQ,IAAI,CAIvC,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runnerpro/backend",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "A collection of common backend functions",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./lib/cjs/index.js"
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"build": "npm run clean && tsc -p ./configs/tsconfig.cjs.json",
|
|
16
16
|
"test": "mocha",
|
|
17
17
|
"publish": "npm run build && npm publish",
|
|
18
|
+
"deploy": "npm run build && npm publish",
|
|
18
19
|
"semantic-release": "semantic-release"
|
|
19
20
|
},
|
|
20
21
|
"release": {
|
|
@@ -29,29 +30,22 @@
|
|
|
29
30
|
"type": "git",
|
|
30
31
|
"url": "https://gitlab.com/runner-pro/runnerpro-backend.git"
|
|
31
32
|
},
|
|
32
|
-
"keywords": [
|
|
33
|
-
"npm",
|
|
34
|
-
"javascript",
|
|
35
|
-
"typescript",
|
|
36
|
-
"cjs",
|
|
37
|
-
"nodejs",
|
|
38
|
-
"commonjs",
|
|
39
|
-
"ecmascript",
|
|
40
|
-
"beginner",
|
|
41
|
-
"example",
|
|
42
|
-
"demonstration"
|
|
43
|
-
],
|
|
44
33
|
"author": "Runner Pro",
|
|
45
34
|
"license": "MIT",
|
|
46
35
|
"devDependencies": {
|
|
47
|
-
"@types/chai": "
|
|
48
|
-
"@types/mocha": "
|
|
49
|
-
"chai": "
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
36
|
+
"@types/chai": "4.3.3",
|
|
37
|
+
"@types/mocha": "9.1.1",
|
|
38
|
+
"chai": "4.3.6",
|
|
39
|
+
"mocha": "10.0.0",
|
|
40
|
+
"semantic-release": "19.0.3",
|
|
41
|
+
"ts-node": "10.9.1",
|
|
42
|
+
"typescript": "4.7.4"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"@parse/node-apn": "6.0.1",
|
|
46
|
+
"firebase-admin": "11.10.1",
|
|
47
|
+
"nodemailer": "6.9.9",
|
|
48
|
+
"pg": "8.11.3"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {}
|
|
57
51
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 Snyk Labs
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/HelloWorld/index.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,WAGzB"}
|