@runnerpro/backend 1.1.2 → 1.1.4
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/index.js +2 -1
- package/lib/cjs/notion/index.js +36 -5
- package/lib/cjs/sendNotification/index.js +1 -1
- package/lib/cjs/types/index.d.ts +2 -2
- package/lib/cjs/types/index.d.ts.map +1 -1
- package/lib/cjs/types/notion/index.d.ts +3 -1
- package/lib/cjs/types/notion/index.d.ts.map +1 -1
- package/package.json +1 -1
package/lib/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NOTION_DATABASES_ID = exports.notionAddPage = exports.notionGetDatabase = exports.notionGetUsers = exports.getCountNotificaciones = exports.chatExposed = exports.chatApi = exports.chat = exports.getExerciseTranslatedDescription = 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.notionEditPage = exports.notionAddPage = exports.notionGetDatabase = exports.notionGetUsers = exports.getCountNotificaciones = exports.chatExposed = exports.chatApi = exports.chat = exports.getExerciseTranslatedDescription = 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");
|
|
@@ -28,4 +28,5 @@ const notion_1 = require("./notion");
|
|
|
28
28
|
Object.defineProperty(exports, "notionGetUsers", { enumerable: true, get: function () { return notion_1.notionGetUsers; } });
|
|
29
29
|
Object.defineProperty(exports, "notionGetDatabase", { enumerable: true, get: function () { return notion_1.notionGetDatabase; } });
|
|
30
30
|
Object.defineProperty(exports, "notionAddPage", { enumerable: true, get: function () { return notion_1.notionAddPage; } });
|
|
31
|
+
Object.defineProperty(exports, "notionEditPage", { enumerable: true, get: function () { return notion_1.notionEditPage; } });
|
|
31
32
|
Object.defineProperty(exports, "NOTION_DATABASES_ID", { enumerable: true, get: function () { return notion_1.NOTION_DATABASES_ID; } });
|
package/lib/cjs/notion/index.js
CHANGED
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.NOTION_DATABASES_ID = exports.notionAddPage = exports.notionGetDatabase = exports.notionGetUsers = void 0;
|
|
12
|
+
exports.NOTION_DATABASES_ID = exports.notionEditPage = exports.notionAddPage = exports.notionGetDatabase = exports.notionGetUsers = void 0;
|
|
13
13
|
const client_1 = require("@notionhq/client");
|
|
14
14
|
/*
|
|
15
15
|
Obtener ID de una BBDD de Notion
|
|
@@ -21,6 +21,7 @@ Obtener ID de una BBDD de Notion
|
|
|
21
21
|
const NOTION_DATABASES_ID = {
|
|
22
22
|
REGISTRADOS_PRUEBA_7_DIAS: '25732354-92bd-4bb5-8937-0ad583b795ab',
|
|
23
23
|
OBSERVAR_CLIENTE: '47fc4035-7028-41c2-8b81-8e91d44a989b',
|
|
24
|
+
BUSQUEDA_INFLUENCERS: 'a06bd20c-70b3-4962-a8b2-fb0e977e4530',
|
|
24
25
|
};
|
|
25
26
|
exports.NOTION_DATABASES_ID = NOTION_DATABASES_ID;
|
|
26
27
|
const getNotionDatabaseProperties = (databaseId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -44,9 +45,7 @@ const notionGetDatabase = (databaseId) => {
|
|
|
44
45
|
.then(({ results }) => results);
|
|
45
46
|
};
|
|
46
47
|
exports.notionGetDatabase = notionGetDatabase;
|
|
47
|
-
const
|
|
48
|
-
if (['DEV', 'SBX'].includes(process.env.NODE_ENV || ''))
|
|
49
|
-
return;
|
|
48
|
+
const parseValuesToProperties = (databaseId, values) => __awaiter(void 0, void 0, void 0, function* () {
|
|
50
49
|
const properties = yield getNotionDatabaseProperties(databaseId);
|
|
51
50
|
// Transform values into properties format
|
|
52
51
|
const propertiesValues = {};
|
|
@@ -82,11 +81,43 @@ const notionAddPage = (databaseId, values) => __awaiter(void 0, void 0, void 0,
|
|
|
82
81
|
};
|
|
83
82
|
}
|
|
84
83
|
});
|
|
84
|
+
return propertiesValues;
|
|
85
|
+
});
|
|
86
|
+
const notionAddPage = (databaseId, values) => __awaiter(void 0, void 0, void 0, function* () {
|
|
87
|
+
if (['DEV', 'SBX'].includes(process.env.NODE_ENV || ''))
|
|
88
|
+
return;
|
|
89
|
+
const properties = yield parseValuesToProperties(databaseId, values);
|
|
85
90
|
return notion.pages.create({
|
|
86
91
|
parent: {
|
|
87
92
|
database_id: databaseId,
|
|
88
93
|
},
|
|
89
|
-
properties
|
|
94
|
+
properties,
|
|
90
95
|
});
|
|
91
96
|
});
|
|
92
97
|
exports.notionAddPage = notionAddPage;
|
|
98
|
+
const notionEditPage = (databaseId, values, filter) => __awaiter(void 0, void 0, void 0, function* () {
|
|
99
|
+
if (['DEV', 'SBX'].includes(process.env.NODE_ENV || ''))
|
|
100
|
+
return;
|
|
101
|
+
const properties = yield parseValuesToProperties(databaseId, values);
|
|
102
|
+
// @ts-ignore
|
|
103
|
+
const pages = yield notion.databases.query({
|
|
104
|
+
database_id: databaseId,
|
|
105
|
+
filter: {
|
|
106
|
+
or: Object.keys(filter).map((key) => ({
|
|
107
|
+
property: key,
|
|
108
|
+
rich_text: {
|
|
109
|
+
equals: filter[key],
|
|
110
|
+
},
|
|
111
|
+
})),
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
if (pages.results.length === 0)
|
|
115
|
+
return -1;
|
|
116
|
+
const page = pages.results[0];
|
|
117
|
+
yield notion.pages.update({
|
|
118
|
+
page_id: page.id,
|
|
119
|
+
properties,
|
|
120
|
+
});
|
|
121
|
+
return 1;
|
|
122
|
+
});
|
|
123
|
+
exports.notionEditPage = notionEditPage;
|
package/lib/cjs/types/index.d.ts
CHANGED
|
@@ -6,6 +6,6 @@ import { err } from './err';
|
|
|
6
6
|
import { fetchIA } from './fetch/fetchIA';
|
|
7
7
|
import { translate, LANGUAGES, useTranslation, getExerciseTranslatedDescription } from './translation';
|
|
8
8
|
import { chat, chatApi, chatExposed, getCountNotificaciones } from './chat';
|
|
9
|
-
import { notionGetUsers, notionGetDatabase, notionAddPage, NOTION_DATABASES_ID } from './notion';
|
|
10
|
-
export { sendNotification, sleep, query, batchQuery, sendMail, err, fetchIA, translate, LANGUAGES, useTranslation, getExerciseTranslatedDescription, chat, chatApi, chatExposed, getCountNotificaciones, notionGetUsers, notionGetDatabase, notionAddPage, NOTION_DATABASES_ID, };
|
|
9
|
+
import { notionGetUsers, notionGetDatabase, notionAddPage, notionEditPage, NOTION_DATABASES_ID } from './notion';
|
|
10
|
+
export { sendNotification, sleep, query, batchQuery, sendMail, err, fetchIA, translate, LANGUAGES, useTranslation, getExerciseTranslatedDescription, chat, chatApi, chatExposed, getCountNotificaciones, notionGetUsers, notionGetDatabase, notionAddPage, notionEditPage, NOTION_DATABASES_ID, };
|
|
11
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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,9 +1,11 @@
|
|
|
1
1
|
declare const NOTION_DATABASES_ID: {
|
|
2
2
|
REGISTRADOS_PRUEBA_7_DIAS: string;
|
|
3
3
|
OBSERVAR_CLIENTE: string;
|
|
4
|
+
BUSQUEDA_INFLUENCERS: string;
|
|
4
5
|
};
|
|
5
6
|
declare const notionGetUsers: () => Promise<import("@notionhq/client/build/src/api-endpoints").ListUsersResponse>;
|
|
6
7
|
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)[]>;
|
|
7
8
|
declare const notionAddPage: (databaseId: any, values: any) => Promise<import("@notionhq/client/build/src/api-endpoints").CreatePageResponse>;
|
|
8
|
-
|
|
9
|
+
declare const notionEditPage: (databaseId: any, values: any, filter: any) => Promise<1 | -1>;
|
|
10
|
+
export { notionGetUsers, notionGetDatabase, notionAddPage, notionEditPage, NOTION_DATABASES_ID };
|
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/notion/index.ts"],"names":[],"mappings":"AASA,QAAA,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/notion/index.ts"],"names":[],"mappings":"AASA,QAAA,MAAM,mBAAmB;;;;CAIxB,CAAC;AAcF,QAAA,MAAM,cAAc,qFAEnB,CAAC;AAEF,QAAA,MAAM,iBAAiB,uVAMtB,CAAC;AAuCF,QAAA,MAAM,aAAa,kHAWlB,CAAC;AAEF,QAAA,MAAM,cAAc,gEA2BnB,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,aAAa,EAAE,cAAc,EAAE,mBAAmB,EAAE,CAAC"}
|