@runnerpro/backend 1.0.24 → 1.0.26
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/index.js +6 -1
- package/lib/cjs/notion/index.js +84 -0
- package/lib/cjs/sendMail/index.js +9 -9
- package/lib/cjs/types/chat/api/conversation.d.ts.map +1 -1
- package/lib/cjs/types/index.d.ts +2 -1
- package/lib/cjs/types/index.d.ts.map +1 -1
- package/lib/cjs/types/notion/index.d.ts +8 -0
- package/lib/cjs/types/notion/index.d.ts.map +1 -0
- package/package.json +4 -3
|
@@ -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/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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;
|
|
3
|
+
exports.NOTION_DATABASES_ID = exports.notionAddPage = exports.notionGetDatabase = exports.notionGetUsers = 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");
|
|
@@ -23,3 +23,8 @@ Object.defineProperty(exports, "chat", { enumerable: true, get: function () { re
|
|
|
23
23
|
Object.defineProperty(exports, "chatApi", { enumerable: true, get: function () { return chat_1.chatApi; } });
|
|
24
24
|
Object.defineProperty(exports, "chatExposed", { enumerable: true, get: function () { return chat_1.chatExposed; } });
|
|
25
25
|
Object.defineProperty(exports, "getCountNotificaciones", { enumerable: true, get: function () { return chat_1.getCountNotificaciones; } });
|
|
26
|
+
const notion_1 = require("./notion");
|
|
27
|
+
Object.defineProperty(exports, "notionGetUsers", { enumerable: true, get: function () { return notion_1.notionGetUsers; } });
|
|
28
|
+
Object.defineProperty(exports, "notionGetDatabase", { enumerable: true, get: function () { return notion_1.notionGetDatabase; } });
|
|
29
|
+
Object.defineProperty(exports, "notionAddPage", { enumerable: true, get: function () { return notion_1.notionAddPage; } });
|
|
30
|
+
Object.defineProperty(exports, "NOTION_DATABASES_ID", { enumerable: true, get: function () { return notion_1.NOTION_DATABASES_ID; } });
|
|
@@ -0,0 +1,84 @@
|
|
|
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.NOTION_DATABASES_ID = exports.notionAddPage = exports.notionGetDatabase = exports.notionGetUsers = void 0;
|
|
13
|
+
const client_1 = require("@notionhq/client");
|
|
14
|
+
const NOTION_DATABASES_ID = {
|
|
15
|
+
REGISTRADOS_PRUEBA_7_DIAS: '25732354-92bd-4bb5-8937-0ad583b795ab',
|
|
16
|
+
};
|
|
17
|
+
exports.NOTION_DATABASES_ID = NOTION_DATABASES_ID;
|
|
18
|
+
const getNotionDatabaseProperties = (databaseId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
|
+
const database = yield notion.databases.retrieve({
|
|
20
|
+
database_id: databaseId,
|
|
21
|
+
});
|
|
22
|
+
return database.properties;
|
|
23
|
+
});
|
|
24
|
+
const notion = new client_1.Client({
|
|
25
|
+
auth: process.env.NOTION_API_KEY,
|
|
26
|
+
});
|
|
27
|
+
const notionGetUsers = () => {
|
|
28
|
+
return notion.users.list({});
|
|
29
|
+
};
|
|
30
|
+
exports.notionGetUsers = notionGetUsers;
|
|
31
|
+
const notionGetDatabase = (databaseId) => {
|
|
32
|
+
return notion.databases
|
|
33
|
+
.query({
|
|
34
|
+
database_id: databaseId,
|
|
35
|
+
})
|
|
36
|
+
.then(({ results }) => results);
|
|
37
|
+
};
|
|
38
|
+
exports.notionGetDatabase = notionGetDatabase;
|
|
39
|
+
const notionAddPage = (databaseId, values) => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
+
const properties = yield getNotionDatabaseProperties(databaseId);
|
|
41
|
+
console.log(properties);
|
|
42
|
+
// Transform values into properties format
|
|
43
|
+
const propertiesValues = {};
|
|
44
|
+
Object.keys(values).forEach((key) => {
|
|
45
|
+
if (properties[key].type === 'title') {
|
|
46
|
+
propertiesValues[key] = {
|
|
47
|
+
title: [
|
|
48
|
+
{
|
|
49
|
+
text: {
|
|
50
|
+
content: values[key],
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
else if (properties[key].type === 'select') {
|
|
57
|
+
propertiesValues[key] = {
|
|
58
|
+
select: {
|
|
59
|
+
name: values[key],
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
else if (properties[key].type === 'date') {
|
|
64
|
+
propertiesValues[key] = {
|
|
65
|
+
date: {
|
|
66
|
+
start: values[key],
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
propertiesValues[key] = {
|
|
72
|
+
[properties[key].type]: values[key],
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
console.log(propertiesValues);
|
|
77
|
+
return notion.pages.create({
|
|
78
|
+
parent: {
|
|
79
|
+
database_id: databaseId,
|
|
80
|
+
},
|
|
81
|
+
properties: propertiesValues,
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
exports.notionAddPage = notionAddPage;
|
|
@@ -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"}
|
package/lib/cjs/types/index.d.ts
CHANGED
|
@@ -6,5 +6,6 @@ import { err } from './err';
|
|
|
6
6
|
import { fetchIA } from './fetch/fetchIA';
|
|
7
7
|
import { translate, LANGUAGES, useTranslation } from './translation';
|
|
8
8
|
import { chat, chatApi, chatExposed, getCountNotificaciones } from './chat';
|
|
9
|
-
|
|
9
|
+
import { notionGetUsers, notionGetDatabase, notionAddPage, NOTION_DATABASES_ID } from './notion';
|
|
10
|
+
export { sendNotification, sleep, query, batchQuery, sendMail, err, fetchIA, translate, LANGUAGES, useTranslation, chat, chatApi, chatExposed, getCountNotificaciones, notionGetUsers, notionGetDatabase, notionAddPage, NOTION_DATABASES_ID, };
|
|
10
11
|
//# 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,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC;
|
|
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;AAC5E,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEjG,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,EACtB,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,mBAAmB,GACpB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare const NOTION_DATABASES_ID: {
|
|
2
|
+
REGISTRADOS_PRUEBA_7_DIAS: string;
|
|
3
|
+
};
|
|
4
|
+
declare const notionGetUsers: () => Promise<import("@notionhq/client/build/src/api-endpoints").ListUsersResponse>;
|
|
5
|
+
declare const notionGetDatabase: (databaseId: any) => Promise<(import("@notionhq/client/build/src/api-endpoints").PartialDatabaseObjectResponse | import("@notionhq/client/build/src/api-endpoints").DatabaseObjectResponse | import("@notionhq/client/build/src/api-endpoints").PageObjectResponse | import("@notionhq/client/build/src/api-endpoints").PartialPageObjectResponse)[]>;
|
|
6
|
+
declare const notionAddPage: (databaseId: any, values: any) => Promise<import("@notionhq/client/build/src/api-endpoints").CreatePageResponse>;
|
|
7
|
+
export { notionGetUsers, notionGetDatabase, notionAddPage, NOTION_DATABASES_ID };
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/notion/index.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,mBAAmB;;CAExB,CAAC;AAcF,QAAA,MAAM,cAAc,qFAEnB,CAAC;AAEF,QAAA,MAAM,iBAAiB,uVAMtB,CAAC;AAEF,QAAA,MAAM,aAAa,kHA2ClB,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,aAAa,EAAE,mBAAmB,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runnerpro/backend",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.26",
|
|
4
4
|
"description": "A collection of common backend functions",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./lib/cjs/index.js"
|
|
@@ -56,12 +56,13 @@
|
|
|
56
56
|
"@parse/node-apn": "6.0.1",
|
|
57
57
|
"@runnerpro/common": "^1.2.10",
|
|
58
58
|
"axios": "^1.6.7",
|
|
59
|
+
"jimp": "^0.22.10",
|
|
59
60
|
"nodemailer": "6.9.9",
|
|
60
|
-
"pg": "8.11.3"
|
|
61
|
-
"jimp": "^0.22.10"
|
|
61
|
+
"pg": "8.11.3"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@google-cloud/translate": "^8.3.0",
|
|
65
|
+
"@notionhq/client": "^2.2.15",
|
|
65
66
|
"exifr": "^7.1.3",
|
|
66
67
|
"image-size": "^1.0.2",
|
|
67
68
|
"multer": "^1.4.5-lts.1",
|