opensentinel 2.1.1 → 3.1.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 +354 -283
- package/dist/archiver-AVNBYCKQ.js +15340 -0
- package/dist/archiver-AVNBYCKQ.js.map +1 -0
- package/dist/audit-logger-OBPR7CRO.js +22 -0
- package/dist/auth-UOX5K2BE.js +18 -0
- package/dist/autonomy-ZXDBDQUJ.js +86 -0
- package/dist/autonomy-ZXDBDQUJ.js.map +1 -0
- package/dist/aws-s3-Q4LLZZPD.js +146 -0
- package/dist/aws-s3-Q4LLZZPD.js.map +1 -0
- package/dist/backup-restore-PZ7CYYB7.js +16 -0
- package/dist/blocks-R3PODY47.js +23 -0
- package/dist/bot-QRARP4UN.js +36 -0
- package/dist/brain-7XLLM3KC.js +56 -0
- package/dist/camera-monitor-M5CYKUU4.js +335 -0
- package/dist/camera-monitor-M5CYKUU4.js.map +1 -0
- package/dist/{charts-MMXM6BWW.js → charts-V7ARZNKF.js} +2 -2
- package/dist/chunk-22VGGA7S.js +330 -0
- package/dist/chunk-22VGGA7S.js.map +1 -0
- package/dist/chunk-35WYTA3C.js +382 -0
- package/dist/chunk-35WYTA3C.js.map +1 -0
- package/dist/chunk-3E2PSU2C.js +146 -0
- package/dist/chunk-3E2PSU2C.js.map +1 -0
- package/dist/{chunk-L3F43VPB.js → chunk-4GLYY4NN.js} +2 -2
- package/dist/{chunk-L3F43VPB.js.map → chunk-4GLYY4NN.js.map} +1 -1
- package/dist/{chunk-L3PDU3XN.js → chunk-4UOE5TUZ.js} +4 -4
- package/dist/{chunk-6SNHU3CY.js → chunk-66OJ3WB4.js} +2 -2
- package/dist/chunk-6KONMXQ6.js +297 -0
- package/dist/chunk-6KONMXQ6.js.map +1 -0
- package/dist/chunk-6PMVAAA7.js +196 -0
- package/dist/chunk-6PMVAAA7.js.map +1 -0
- package/dist/chunk-766ASQWE.js +32620 -0
- package/dist/chunk-766ASQWE.js.map +1 -0
- package/dist/chunk-7WQO5J2M.js +29 -0
- package/dist/chunk-7WQO5J2M.js.map +1 -0
- package/dist/chunk-APHSRMBS.js +148 -0
- package/dist/chunk-APHSRMBS.js.map +1 -0
- package/dist/{chunk-4LVWXUNC.js → chunk-AYUKPTSM.js} +57 -39
- package/dist/chunk-AYUKPTSM.js.map +1 -0
- package/dist/chunk-BIPYADGB.js +84 -0
- package/dist/chunk-BIPYADGB.js.map +1 -0
- package/dist/chunk-BRBWNV65.js +457 -0
- package/dist/chunk-BRBWNV65.js.map +1 -0
- package/dist/chunk-BXZ6EA52.js +382 -0
- package/dist/chunk-BXZ6EA52.js.map +1 -0
- package/dist/chunk-EVE7MIIY.js +290 -0
- package/dist/chunk-EVE7MIIY.js.map +1 -0
- package/dist/chunk-F3TTNID2.js +138 -0
- package/dist/chunk-F3TTNID2.js.map +1 -0
- package/dist/chunk-H5RQOFO2.js +190 -0
- package/dist/chunk-H5RQOFO2.js.map +1 -0
- package/dist/chunk-HN3F4WSW.js +145 -0
- package/dist/chunk-HN3F4WSW.js.map +1 -0
- package/dist/{chunk-6DRDKB45.js → chunk-I6BDYQIG.js} +20 -9
- package/dist/chunk-I6BDYQIG.js.map +1 -0
- package/dist/chunk-IZJMVV7O.js +347 -0
- package/dist/chunk-IZJMVV7O.js.map +1 -0
- package/dist/chunk-KM22GV7G.js +211 -0
- package/dist/chunk-KM22GV7G.js.map +1 -0
- package/dist/chunk-MGFBLVR7.js +103 -0
- package/dist/chunk-MGFBLVR7.js.map +1 -0
- package/dist/chunk-MQJ2ECQT.js +228 -0
- package/dist/chunk-MQJ2ECQT.js.map +1 -0
- package/dist/{chunk-F6QUZQGI.js → chunk-MXAPLSJ5.js} +2 -2
- package/dist/{chunk-GK3E2I7A.js → chunk-NHMBTUMW.js} +2 -2
- package/dist/chunk-NPRTSZIF.js +131 -0
- package/dist/chunk-NPRTSZIF.js.map +1 -0
- package/dist/chunk-O7IH7JTI.js +1898 -0
- package/dist/chunk-O7IH7JTI.js.map +1 -0
- package/dist/chunk-OCVQGBJK.js +293 -0
- package/dist/chunk-OCVQGBJK.js.map +1 -0
- package/dist/chunk-P6QINGFL.js +332 -0
- package/dist/chunk-P6QINGFL.js.map +1 -0
- package/dist/chunk-PHDZKPNE.js +91 -0
- package/dist/chunk-PHDZKPNE.js.map +1 -0
- package/dist/chunk-PLDDJCW6.js +49 -0
- package/dist/chunk-PTGTGXV2.js +164 -0
- package/dist/chunk-PTGTGXV2.js.map +1 -0
- package/dist/chunk-REMIY4U2.js +171 -0
- package/dist/chunk-REMIY4U2.js.map +1 -0
- package/dist/chunk-RZ4YESBG.js +141 -0
- package/dist/chunk-RZ4YESBG.js.map +1 -0
- package/dist/chunk-SAX5MHK4.js +111 -0
- package/dist/chunk-SAX5MHK4.js.map +1 -0
- package/dist/{chunk-GVJVEWHI.js → chunk-SJSUSJ47.js} +2 -2
- package/dist/chunk-SPPMCAKG.js +777 -0
- package/dist/chunk-SPPMCAKG.js.map +1 -0
- package/dist/chunk-SVAPX2XN.js +2441 -0
- package/dist/chunk-SVAPX2XN.js.map +1 -0
- package/dist/chunk-TVEWKIK3.js +452 -0
- package/dist/chunk-TVEWKIK3.js.map +1 -0
- package/dist/{chunk-HH2HBTQM.js → chunk-TYAGMJNV.js} +5 -5
- package/dist/{chunk-JXUP2X7V.js → chunk-VEHFVBLI.js} +2 -2
- package/dist/chunk-VNX5GMTN.js +128 -0
- package/dist/chunk-VNX5GMTN.js.map +1 -0
- package/dist/chunk-VRD5CYRL.js +1568 -0
- package/dist/chunk-VRD5CYRL.js.map +1 -0
- package/dist/chunk-WLUHNG6X.js +122 -0
- package/dist/chunk-WLUHNG6X.js.map +1 -0
- package/dist/chunk-WRAKK6K6.js +265 -0
- package/dist/chunk-WRAKK6K6.js.map +1 -0
- package/dist/chunk-XKYRH4FM.js +681 -0
- package/dist/chunk-XKYRH4FM.js.map +1 -0
- package/dist/{chunk-GUBEEYDW.js → chunk-XMCVRVTF.js} +2 -2
- package/dist/{chunk-GUBEEYDW.js.map → chunk-XMCVRVTF.js.map} +1 -1
- package/dist/chunk-ZLZKF2PM.js +310 -0
- package/dist/chunk-ZLZKF2PM.js.map +1 -0
- package/dist/cli.js +5 -1
- package/dist/cli.js.map +1 -1
- package/dist/client-ZQSFPMOB.js +21 -0
- package/dist/clipboard-manager-TEO2GEDN.js +24 -0
- package/dist/commands/setup.js +3 -3
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/start.js +3 -3
- package/dist/commands/status.js +2 -2
- package/dist/commands/stop.js +2 -2
- package/dist/commands/utils.js +2 -2
- package/dist/cron-explain-HHQKPD3M.js +16 -0
- package/dist/crypto-4AP47IKC.js +14 -0
- package/dist/crypto-4AP47IKC.js.map +1 -0
- package/dist/databases-37X4CI2Y.js +21 -0
- package/dist/databases-37X4CI2Y.js.map +1 -0
- package/dist/discord-B3HUPGQ6.js +70 -0
- package/dist/discord-B3HUPGQ6.js.map +1 -0
- package/dist/dist-UISMLMFN.js +21847 -0
- package/dist/dist-UISMLMFN.js.map +1 -0
- package/dist/email-K7LO2IPB.js +268 -0
- package/dist/email-K7LO2IPB.js.map +1 -0
- package/dist/enhanced-retrieval-DNLLEM4Z.js +753 -0
- package/dist/enhanced-retrieval-DNLLEM4Z.js.map +1 -0
- package/dist/enrichment-pipeline-MNHNW65K.js +13 -0
- package/dist/enrichment-pipeline-MNHNW65K.js.map +1 -0
- package/dist/entity-resolution-Y3IUWEAT.js +24 -0
- package/dist/entity-resolution-Y3IUWEAT.js.map +1 -0
- package/dist/env-IWXUVTCB.js +12 -0
- package/dist/env-IWXUVTCB.js.map +1 -0
- package/dist/google-workspace-DKWUVNGC.js +169 -0
- package/dist/google-workspace-DKWUVNGC.js.map +1 -0
- package/dist/hash-tool-ULQYD7B5.js +22 -0
- package/dist/hash-tool-ULQYD7B5.js.map +1 -0
- package/dist/heartbeat-monitor-GCISLXI3.js +22 -0
- package/dist/heartbeat-monitor-GCISLXI3.js.map +1 -0
- package/dist/image-generation-OSU7FP6F.js +486 -0
- package/dist/image-generation-OSU7FP6F.js.map +1 -0
- package/dist/imessage-NGA2XF2V.js +35 -0
- package/dist/imessage-NGA2XF2V.js.map +1 -0
- package/dist/inbox-summarizer-NRI4S7IF.js +47 -0
- package/dist/inbox-summarizer-NRI4S7IF.js.map +1 -0
- package/dist/incident-response-C5J7Q6DT.js +244 -0
- package/dist/incident-response-C5J7Q6DT.js.map +1 -0
- package/dist/inventory-manager-352OHXWD.js +24 -0
- package/dist/inventory-manager-352OHXWD.js.map +1 -0
- package/dist/jira-GSGDBMIG.js +199 -0
- package/dist/jira-GSGDBMIG.js.map +1 -0
- package/dist/json-tool-QE2SYHEG.js +26 -0
- package/dist/json-tool-QE2SYHEG.js.map +1 -0
- package/dist/key-rotation-DPHU4ZTB.js +18 -0
- package/dist/key-rotation-DPHU4ZTB.js.map +1 -0
- package/dist/lib.d.ts +603 -11
- package/dist/lib.js +161 -35
- package/dist/lib.js.map +1 -1
- package/dist/mailchimp-KKNF6QJ7.js +152 -0
- package/dist/mailchimp-KKNF6QJ7.js.map +1 -0
- package/dist/matrix-QVHG76I7.js +279 -0
- package/dist/matrix-QVHG76I7.js.map +1 -0
- package/dist/{mcp-LS7Q3Z5W.js → mcp-3JI6W7ZE.js} +3 -3
- package/dist/mcp-3JI6W7ZE.js.map +1 -0
- package/dist/microsoft365-UCBKJHNX.js +164 -0
- package/dist/microsoft365-UCBKJHNX.js.map +1 -0
- package/dist/ocr-AC7NPX33.js +22 -0
- package/dist/ocr-AC7NPX33.js.map +1 -0
- package/dist/ollama-BOAMSPLJ.js +8 -0
- package/dist/ollama-BOAMSPLJ.js.map +1 -0
- package/dist/pages-MI523RB7.js +26 -0
- package/dist/pages-MI523RB7.js.map +1 -0
- package/dist/pair-JDFTERIK.js +24 -0
- package/dist/pair-JDFTERIK.js.map +1 -0
- package/dist/pairing-IFQYCPNS.js +10 -0
- package/dist/pairing-IFQYCPNS.js.map +1 -0
- package/dist/pdf-ALQVOEJR.js +17 -0
- package/dist/pdf-ALQVOEJR.js.map +1 -0
- package/dist/presentations-DSV5IHG5.js +1002 -0
- package/dist/presentations-DSV5IHG5.js.map +1 -0
- package/dist/prometheus-JNT2BD4L.js +10 -0
- package/dist/prometheus-JNT2BD4L.js.map +1 -0
- package/dist/providers-J4LYPHDR.js +19 -0
- package/dist/providers-J4LYPHDR.js.map +1 -0
- package/dist/qr-code-WIX4PB4U.js +16 -0
- package/dist/qr-code-WIX4PB4U.js.map +1 -0
- package/dist/quickbooks-XB4NII2S.js +190 -0
- package/dist/quickbooks-XB4NII2S.js.map +1 -0
- package/dist/regex-tool-W4ABRKGK.js +24 -0
- package/dist/regex-tool-W4ABRKGK.js.map +1 -0
- package/dist/scheduler-VK4WFERV.js +63 -0
- package/dist/scheduler-VK4WFERV.js.map +1 -0
- package/dist/search-BCLBO5E3.js +25 -0
- package/dist/search-BCLBO5E3.js.map +1 -0
- package/dist/sendgrid-RNXCAFKM.js +152 -0
- package/dist/sendgrid-RNXCAFKM.js.map +1 -0
- package/dist/shopify-NCXYJB4R.js +171 -0
- package/dist/shopify-NCXYJB4R.js.map +1 -0
- package/dist/signal-6CGDFYL2.js +35 -0
- package/dist/signal-6CGDFYL2.js.map +1 -0
- package/dist/slack-IZQWIKOH.js +75 -0
- package/dist/slack-IZQWIKOH.js.map +1 -0
- package/dist/sms-M3JIOTCW.js +23 -0
- package/dist/sms-M3JIOTCW.js.map +1 -0
- package/dist/{src-K7GASHRH.js → src-VYUE6LRA.js} +138 -32
- package/dist/src-VYUE6LRA.js.map +1 -0
- package/dist/stocks-XXWBPOCU.js +14 -0
- package/dist/stocks-XXWBPOCU.js.map +1 -0
- package/dist/text-transform-6SGUA5Z4.js +22 -0
- package/dist/text-transform-6SGUA5Z4.js.map +1 -0
- package/dist/tools-2RLEI2N6.js +38 -0
- package/dist/tools-2RLEI2N6.js.map +1 -0
- package/dist/tunnel-IWMXUML4.js +301 -0
- package/dist/tunnel-IWMXUML4.js.map +1 -0
- package/dist/twilio-53GEW5JT.js +139 -0
- package/dist/twilio-53GEW5JT.js.map +1 -0
- package/dist/unit-converter-ZYXMEZOE.js +14 -0
- package/dist/unit-converter-ZYXMEZOE.js.map +1 -0
- package/dist/whatsapp-LFX6YKCM.js +35 -0
- package/dist/whatsapp-LFX6YKCM.js.map +1 -0
- package/dist/word-document-7B6SJMAY.js +902 -0
- package/dist/word-document-7B6SJMAY.js.map +1 -0
- package/dist/xero-QYO66D45.js +162 -0
- package/dist/xero-QYO66D45.js.map +1 -0
- package/dist/zapier-webhook-TBZ5YF2A.js +106 -0
- package/dist/zapier-webhook-TBZ5YF2A.js.map +1 -0
- package/drizzle/0002_mushy_master_mold.sql +140 -0
- package/drizzle/meta/0002_snapshot.json +3637 -0
- package/drizzle/meta/_journal.json +7 -0
- package/package.json +100 -98
- package/dist/bot-KJ26BG56.js +0 -15
- package/dist/chunk-4LVWXUNC.js.map +0 -1
- package/dist/chunk-4TG2IG5K.js +0 -5249
- package/dist/chunk-4TG2IG5K.js.map +0 -1
- package/dist/chunk-6DRDKB45.js.map +0 -1
- package/dist/chunk-CI6Q63MM.js +0 -1613
- package/dist/chunk-CI6Q63MM.js.map +0 -1
- package/dist/chunk-KHNYJY2Z.js +0 -178
- package/dist/chunk-KHNYJY2Z.js.map +0 -1
- package/dist/chunk-NSBPE2FW.js +0 -17
- package/dist/discord-ZOJFTVTB.js +0 -49
- package/dist/imessage-JFRB6EJ7.js +0 -14
- package/dist/scheduler-EZ7CZMCS.js +0 -42
- package/dist/signal-T3MCSULM.js +0 -14
- package/dist/slack-N2M4FHAJ.js +0 -54
- package/dist/src-K7GASHRH.js.map +0 -1
- package/dist/tools-24GZHYRF.js +0 -16
- package/dist/whatsapp-VCRUPAO5.js +0 -14
- /package/dist/{bot-KJ26BG56.js.map → audit-logger-OBPR7CRO.js.map} +0 -0
- /package/dist/{chunk-NSBPE2FW.js.map → auth-UOX5K2BE.js.map} +0 -0
- /package/dist/{discord-ZOJFTVTB.js.map → backup-restore-PZ7CYYB7.js.map} +0 -0
- /package/dist/{imessage-JFRB6EJ7.js.map → blocks-R3PODY47.js.map} +0 -0
- /package/dist/{mcp-LS7Q3Z5W.js.map → bot-QRARP4UN.js.map} +0 -0
- /package/dist/{scheduler-EZ7CZMCS.js.map → brain-7XLLM3KC.js.map} +0 -0
- /package/dist/{charts-MMXM6BWW.js.map → charts-V7ARZNKF.js.map} +0 -0
- /package/dist/{chunk-L3PDU3XN.js.map → chunk-4UOE5TUZ.js.map} +0 -0
- /package/dist/{chunk-6SNHU3CY.js.map → chunk-66OJ3WB4.js.map} +0 -0
- /package/dist/{chunk-F6QUZQGI.js.map → chunk-MXAPLSJ5.js.map} +0 -0
- /package/dist/{chunk-GK3E2I7A.js.map → chunk-NHMBTUMW.js.map} +0 -0
- /package/dist/{signal-T3MCSULM.js.map → chunk-PLDDJCW6.js.map} +0 -0
- /package/dist/{chunk-GVJVEWHI.js.map → chunk-SJSUSJ47.js.map} +0 -0
- /package/dist/{chunk-HH2HBTQM.js.map → chunk-TYAGMJNV.js.map} +0 -0
- /package/dist/{chunk-JXUP2X7V.js.map → chunk-VEHFVBLI.js.map} +0 -0
- /package/dist/{slack-N2M4FHAJ.js.map → client-ZQSFPMOB.js.map} +0 -0
- /package/dist/{tools-24GZHYRF.js.map → clipboard-manager-TEO2GEDN.js.map} +0 -0
- /package/dist/{whatsapp-VCRUPAO5.js.map → cron-explain-HHQKPD3M.js.map} +0 -0
|
@@ -0,0 +1,1568 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__commonJS,
|
|
3
|
+
__esm,
|
|
4
|
+
__export,
|
|
5
|
+
__toESM
|
|
6
|
+
} from "./chunk-PLDDJCW6.js";
|
|
7
|
+
|
|
8
|
+
// node_modules/@notionhq/client/build/src/utils.js
|
|
9
|
+
var require_utils = __commonJS({
|
|
10
|
+
"node_modules/@notionhq/client/build/src/utils.js"(exports) {
|
|
11
|
+
"use strict";
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.assertNever = assertNever;
|
|
14
|
+
exports.pick = pick;
|
|
15
|
+
exports.isObject = isObject;
|
|
16
|
+
function assertNever(value) {
|
|
17
|
+
throw new Error(`Unexpected value should never occur: ${value}`);
|
|
18
|
+
}
|
|
19
|
+
function pick(base, keys) {
|
|
20
|
+
const entries = keys.map((key) => [key, base === null || base === void 0 ? void 0 : base[key]]);
|
|
21
|
+
return Object.fromEntries(entries);
|
|
22
|
+
}
|
|
23
|
+
function isObject(o) {
|
|
24
|
+
return typeof o === "object" && o !== null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// node_modules/@notionhq/client/build/src/logging.js
|
|
30
|
+
var require_logging = __commonJS({
|
|
31
|
+
"node_modules/@notionhq/client/build/src/logging.js"(exports) {
|
|
32
|
+
"use strict";
|
|
33
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
+
exports.LogLevel = void 0;
|
|
35
|
+
exports.makeConsoleLogger = makeConsoleLogger;
|
|
36
|
+
exports.logLevelSeverity = logLevelSeverity;
|
|
37
|
+
var utils_1 = require_utils();
|
|
38
|
+
var LogLevel;
|
|
39
|
+
(function(LogLevel2) {
|
|
40
|
+
LogLevel2["DEBUG"] = "debug";
|
|
41
|
+
LogLevel2["INFO"] = "info";
|
|
42
|
+
LogLevel2["WARN"] = "warn";
|
|
43
|
+
LogLevel2["ERROR"] = "error";
|
|
44
|
+
})(LogLevel || (exports.LogLevel = LogLevel = {}));
|
|
45
|
+
function makeConsoleLogger(name) {
|
|
46
|
+
return (level, message, extraInfo) => {
|
|
47
|
+
console[level](`${name} ${level}:`, message, extraInfo);
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function logLevelSeverity(level) {
|
|
51
|
+
switch (level) {
|
|
52
|
+
case LogLevel.DEBUG:
|
|
53
|
+
return 20;
|
|
54
|
+
case LogLevel.INFO:
|
|
55
|
+
return 40;
|
|
56
|
+
case LogLevel.WARN:
|
|
57
|
+
return 60;
|
|
58
|
+
case LogLevel.ERROR:
|
|
59
|
+
return 80;
|
|
60
|
+
default:
|
|
61
|
+
return (0, utils_1.assertNever)(level);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// node_modules/@notionhq/client/build/src/errors.js
|
|
68
|
+
var require_errors = __commonJS({
|
|
69
|
+
"node_modules/@notionhq/client/build/src/errors.js"(exports) {
|
|
70
|
+
"use strict";
|
|
71
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
72
|
+
exports.APIResponseError = exports.UnknownHTTPResponseError = exports.InvalidPathParameterError = exports.RequestTimeoutError = exports.ClientErrorCode = exports.APIErrorCode = void 0;
|
|
73
|
+
exports.isNotionClientError = isNotionClientError;
|
|
74
|
+
exports.validateRequestPath = validateRequestPath;
|
|
75
|
+
exports.isHTTPResponseError = isHTTPResponseError;
|
|
76
|
+
exports.buildRequestError = buildRequestError;
|
|
77
|
+
var utils_1 = require_utils();
|
|
78
|
+
var APIErrorCode;
|
|
79
|
+
(function(APIErrorCode2) {
|
|
80
|
+
APIErrorCode2["Unauthorized"] = "unauthorized";
|
|
81
|
+
APIErrorCode2["RestrictedResource"] = "restricted_resource";
|
|
82
|
+
APIErrorCode2["ObjectNotFound"] = "object_not_found";
|
|
83
|
+
APIErrorCode2["RateLimited"] = "rate_limited";
|
|
84
|
+
APIErrorCode2["InvalidJSON"] = "invalid_json";
|
|
85
|
+
APIErrorCode2["InvalidRequestURL"] = "invalid_request_url";
|
|
86
|
+
APIErrorCode2["InvalidRequest"] = "invalid_request";
|
|
87
|
+
APIErrorCode2["ValidationError"] = "validation_error";
|
|
88
|
+
APIErrorCode2["ConflictError"] = "conflict_error";
|
|
89
|
+
APIErrorCode2["InternalServerError"] = "internal_server_error";
|
|
90
|
+
APIErrorCode2["ServiceUnavailable"] = "service_unavailable";
|
|
91
|
+
})(APIErrorCode || (exports.APIErrorCode = APIErrorCode = {}));
|
|
92
|
+
var ClientErrorCode;
|
|
93
|
+
(function(ClientErrorCode2) {
|
|
94
|
+
ClientErrorCode2["RequestTimeout"] = "notionhq_client_request_timeout";
|
|
95
|
+
ClientErrorCode2["ResponseError"] = "notionhq_client_response_error";
|
|
96
|
+
ClientErrorCode2["InvalidPathParameter"] = "notionhq_client_invalid_path_parameter";
|
|
97
|
+
})(ClientErrorCode || (exports.ClientErrorCode = ClientErrorCode = {}));
|
|
98
|
+
var NotionClientErrorBase = class extends Error {
|
|
99
|
+
};
|
|
100
|
+
function isNotionClientError(error) {
|
|
101
|
+
return (0, utils_1.isObject)(error) && error instanceof NotionClientErrorBase;
|
|
102
|
+
}
|
|
103
|
+
function isNotionClientErrorWithCode(error, codes) {
|
|
104
|
+
return isNotionClientError(error) && error.code in codes;
|
|
105
|
+
}
|
|
106
|
+
var RequestTimeoutError = class _RequestTimeoutError extends NotionClientErrorBase {
|
|
107
|
+
constructor(message = "Request to Notion API has timed out") {
|
|
108
|
+
super(message);
|
|
109
|
+
this.code = ClientErrorCode.RequestTimeout;
|
|
110
|
+
this.name = "RequestTimeoutError";
|
|
111
|
+
}
|
|
112
|
+
static isRequestTimeoutError(error) {
|
|
113
|
+
return isNotionClientErrorWithCode(error, {
|
|
114
|
+
[ClientErrorCode.RequestTimeout]: true
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
static rejectAfterTimeout(promise, timeoutMS) {
|
|
118
|
+
return new Promise((resolve, reject) => {
|
|
119
|
+
const timeoutId = setTimeout(() => {
|
|
120
|
+
reject(new _RequestTimeoutError());
|
|
121
|
+
}, timeoutMS);
|
|
122
|
+
promise.then(resolve).catch(reject).then(() => clearTimeout(timeoutId));
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
exports.RequestTimeoutError = RequestTimeoutError;
|
|
127
|
+
var InvalidPathParameterError = class extends NotionClientErrorBase {
|
|
128
|
+
constructor(message = "Path parameter contains invalid characters that could alter the request path") {
|
|
129
|
+
super(message);
|
|
130
|
+
this.code = ClientErrorCode.InvalidPathParameter;
|
|
131
|
+
this.name = "InvalidPathParameterError";
|
|
132
|
+
}
|
|
133
|
+
static isInvalidPathParameterError(error) {
|
|
134
|
+
return isNotionClientErrorWithCode(error, {
|
|
135
|
+
[ClientErrorCode.InvalidPathParameter]: true
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
exports.InvalidPathParameterError = InvalidPathParameterError;
|
|
140
|
+
function validateRequestPath(path) {
|
|
141
|
+
if (path.includes("..")) {
|
|
142
|
+
throw new InvalidPathParameterError(`Request path "${path}" contains path traversal sequence ".."`);
|
|
143
|
+
}
|
|
144
|
+
if (/%2e/i.test(path)) {
|
|
145
|
+
let decoded;
|
|
146
|
+
try {
|
|
147
|
+
decoded = decodeURIComponent(path);
|
|
148
|
+
} catch {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
if (decoded.includes("..")) {
|
|
152
|
+
throw new InvalidPathParameterError(`Request path "${path}" contains encoded path traversal sequence`);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
var HTTPResponseError = class extends NotionClientErrorBase {
|
|
157
|
+
constructor(args) {
|
|
158
|
+
super(args.message);
|
|
159
|
+
this.name = "HTTPResponseError";
|
|
160
|
+
const { code, status, headers, rawBodyText, additional_data, request_id } = args;
|
|
161
|
+
this.code = code;
|
|
162
|
+
this.status = status;
|
|
163
|
+
this.headers = headers;
|
|
164
|
+
this.body = rawBodyText;
|
|
165
|
+
this.additional_data = additional_data;
|
|
166
|
+
this.request_id = request_id;
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
var httpResponseErrorCodes = {
|
|
170
|
+
[ClientErrorCode.ResponseError]: true,
|
|
171
|
+
[APIErrorCode.Unauthorized]: true,
|
|
172
|
+
[APIErrorCode.RestrictedResource]: true,
|
|
173
|
+
[APIErrorCode.ObjectNotFound]: true,
|
|
174
|
+
[APIErrorCode.RateLimited]: true,
|
|
175
|
+
[APIErrorCode.InvalidJSON]: true,
|
|
176
|
+
[APIErrorCode.InvalidRequestURL]: true,
|
|
177
|
+
[APIErrorCode.InvalidRequest]: true,
|
|
178
|
+
[APIErrorCode.ValidationError]: true,
|
|
179
|
+
[APIErrorCode.ConflictError]: true,
|
|
180
|
+
[APIErrorCode.InternalServerError]: true,
|
|
181
|
+
[APIErrorCode.ServiceUnavailable]: true
|
|
182
|
+
};
|
|
183
|
+
function isHTTPResponseError(error) {
|
|
184
|
+
if (!isNotionClientErrorWithCode(error, httpResponseErrorCodes)) {
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
187
|
+
return true;
|
|
188
|
+
}
|
|
189
|
+
var UnknownHTTPResponseError = class extends HTTPResponseError {
|
|
190
|
+
constructor(args) {
|
|
191
|
+
var _a;
|
|
192
|
+
super({
|
|
193
|
+
...args,
|
|
194
|
+
code: ClientErrorCode.ResponseError,
|
|
195
|
+
message: (_a = args.message) !== null && _a !== void 0 ? _a : `Request to Notion API failed with status: ${args.status}`,
|
|
196
|
+
additional_data: void 0,
|
|
197
|
+
request_id: void 0
|
|
198
|
+
});
|
|
199
|
+
this.name = "UnknownHTTPResponseError";
|
|
200
|
+
}
|
|
201
|
+
static isUnknownHTTPResponseError(error) {
|
|
202
|
+
return isNotionClientErrorWithCode(error, {
|
|
203
|
+
[ClientErrorCode.ResponseError]: true
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
exports.UnknownHTTPResponseError = UnknownHTTPResponseError;
|
|
208
|
+
var apiErrorCodes = {
|
|
209
|
+
[APIErrorCode.Unauthorized]: true,
|
|
210
|
+
[APIErrorCode.RestrictedResource]: true,
|
|
211
|
+
[APIErrorCode.ObjectNotFound]: true,
|
|
212
|
+
[APIErrorCode.RateLimited]: true,
|
|
213
|
+
[APIErrorCode.InvalidJSON]: true,
|
|
214
|
+
[APIErrorCode.InvalidRequestURL]: true,
|
|
215
|
+
[APIErrorCode.InvalidRequest]: true,
|
|
216
|
+
[APIErrorCode.ValidationError]: true,
|
|
217
|
+
[APIErrorCode.ConflictError]: true,
|
|
218
|
+
[APIErrorCode.InternalServerError]: true,
|
|
219
|
+
[APIErrorCode.ServiceUnavailable]: true
|
|
220
|
+
};
|
|
221
|
+
var APIResponseError = class extends HTTPResponseError {
|
|
222
|
+
constructor() {
|
|
223
|
+
super(...arguments);
|
|
224
|
+
this.name = "APIResponseError";
|
|
225
|
+
}
|
|
226
|
+
static isAPIResponseError(error) {
|
|
227
|
+
return isNotionClientErrorWithCode(error, apiErrorCodes);
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
exports.APIResponseError = APIResponseError;
|
|
231
|
+
function buildRequestError(response, bodyText) {
|
|
232
|
+
const apiErrorResponseBody = parseAPIErrorResponseBody(bodyText);
|
|
233
|
+
if (apiErrorResponseBody !== void 0) {
|
|
234
|
+
return new APIResponseError({
|
|
235
|
+
code: apiErrorResponseBody.code,
|
|
236
|
+
message: apiErrorResponseBody.message,
|
|
237
|
+
headers: response.headers,
|
|
238
|
+
status: response.status,
|
|
239
|
+
rawBodyText: bodyText,
|
|
240
|
+
additional_data: apiErrorResponseBody.additional_data,
|
|
241
|
+
request_id: apiErrorResponseBody.request_id
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
return new UnknownHTTPResponseError({
|
|
245
|
+
message: void 0,
|
|
246
|
+
headers: response.headers,
|
|
247
|
+
status: response.status,
|
|
248
|
+
rawBodyText: bodyText
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
function parseAPIErrorResponseBody(body) {
|
|
252
|
+
if (typeof body !== "string") {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
let parsed;
|
|
256
|
+
try {
|
|
257
|
+
parsed = JSON.parse(body);
|
|
258
|
+
} catch (parseError) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
if (!(0, utils_1.isObject)(parsed) || typeof parsed["message"] !== "string" || !isAPIErrorCode(parsed["code"])) {
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
const additional_data = parsed["additional_data"];
|
|
265
|
+
const request_id = parsed["request_id"];
|
|
266
|
+
return {
|
|
267
|
+
...parsed,
|
|
268
|
+
code: parsed["code"],
|
|
269
|
+
message: parsed["message"],
|
|
270
|
+
additional_data,
|
|
271
|
+
request_id
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
function isAPIErrorCode(code) {
|
|
275
|
+
return typeof code === "string" && code in apiErrorCodes;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
// node_modules/@notionhq/client/build/src/api-endpoints.js
|
|
281
|
+
var require_api_endpoints = __commonJS({
|
|
282
|
+
"node_modules/@notionhq/client/build/src/api-endpoints.js"(exports) {
|
|
283
|
+
"use strict";
|
|
284
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
285
|
+
exports.movePage = exports.oauthIntrospect = exports.oauthRevoke = exports.oauthToken = exports.getFileUpload = exports.completeFileUpload = exports.sendFileUpload = exports.listFileUploads = exports.createFileUpload = exports.getComment = exports.listComments = exports.createComment = exports.search = exports.createDatabase = exports.updateDatabase = exports.getDatabase = exports.listDataSourceTemplates = exports.createDataSource = exports.queryDataSource = exports.updateDataSource = exports.getDataSource = exports.appendBlockChildren = exports.listBlockChildren = exports.deleteBlock = exports.updateBlock = exports.getBlock = exports.getPageProperty = exports.updatePage = exports.getPage = exports.createPage = exports.listUsers = exports.getUser = exports.getSelf = void 0;
|
|
286
|
+
exports.getSelf = {
|
|
287
|
+
method: "get",
|
|
288
|
+
pathParams: [],
|
|
289
|
+
queryParams: [],
|
|
290
|
+
bodyParams: [],
|
|
291
|
+
path: () => `users/me`
|
|
292
|
+
};
|
|
293
|
+
exports.getUser = {
|
|
294
|
+
method: "get",
|
|
295
|
+
pathParams: ["user_id"],
|
|
296
|
+
queryParams: [],
|
|
297
|
+
bodyParams: [],
|
|
298
|
+
path: (p) => `users/${p.user_id}`
|
|
299
|
+
};
|
|
300
|
+
exports.listUsers = {
|
|
301
|
+
method: "get",
|
|
302
|
+
pathParams: [],
|
|
303
|
+
queryParams: ["start_cursor", "page_size"],
|
|
304
|
+
bodyParams: [],
|
|
305
|
+
path: () => `users`
|
|
306
|
+
};
|
|
307
|
+
exports.createPage = {
|
|
308
|
+
method: "post",
|
|
309
|
+
pathParams: [],
|
|
310
|
+
queryParams: [],
|
|
311
|
+
bodyParams: [
|
|
312
|
+
"parent",
|
|
313
|
+
"properties",
|
|
314
|
+
"icon",
|
|
315
|
+
"cover",
|
|
316
|
+
"content",
|
|
317
|
+
"children",
|
|
318
|
+
"template",
|
|
319
|
+
"position"
|
|
320
|
+
],
|
|
321
|
+
path: () => `pages`
|
|
322
|
+
};
|
|
323
|
+
exports.getPage = {
|
|
324
|
+
method: "get",
|
|
325
|
+
pathParams: ["page_id"],
|
|
326
|
+
queryParams: ["filter_properties"],
|
|
327
|
+
bodyParams: [],
|
|
328
|
+
path: (p) => `pages/${p.page_id}`
|
|
329
|
+
};
|
|
330
|
+
exports.updatePage = {
|
|
331
|
+
method: "patch",
|
|
332
|
+
pathParams: ["page_id"],
|
|
333
|
+
queryParams: [],
|
|
334
|
+
bodyParams: [
|
|
335
|
+
"properties",
|
|
336
|
+
"icon",
|
|
337
|
+
"cover",
|
|
338
|
+
"is_locked",
|
|
339
|
+
"template",
|
|
340
|
+
"erase_content",
|
|
341
|
+
"archived",
|
|
342
|
+
"in_trash"
|
|
343
|
+
],
|
|
344
|
+
path: (p) => `pages/${p.page_id}`
|
|
345
|
+
};
|
|
346
|
+
exports.getPageProperty = {
|
|
347
|
+
method: "get",
|
|
348
|
+
pathParams: ["page_id", "property_id"],
|
|
349
|
+
queryParams: ["start_cursor", "page_size"],
|
|
350
|
+
bodyParams: [],
|
|
351
|
+
path: (p) => `pages/${p.page_id}/properties/${p.property_id}`
|
|
352
|
+
};
|
|
353
|
+
exports.getBlock = {
|
|
354
|
+
method: "get",
|
|
355
|
+
pathParams: ["block_id"],
|
|
356
|
+
queryParams: [],
|
|
357
|
+
bodyParams: [],
|
|
358
|
+
path: (p) => `blocks/${p.block_id}`
|
|
359
|
+
};
|
|
360
|
+
exports.updateBlock = {
|
|
361
|
+
method: "patch",
|
|
362
|
+
pathParams: ["block_id"],
|
|
363
|
+
queryParams: [],
|
|
364
|
+
bodyParams: [
|
|
365
|
+
"embed",
|
|
366
|
+
"type",
|
|
367
|
+
"archived",
|
|
368
|
+
"in_trash",
|
|
369
|
+
"bookmark",
|
|
370
|
+
"image",
|
|
371
|
+
"video",
|
|
372
|
+
"pdf",
|
|
373
|
+
"file",
|
|
374
|
+
"audio",
|
|
375
|
+
"code",
|
|
376
|
+
"equation",
|
|
377
|
+
"divider",
|
|
378
|
+
"breadcrumb",
|
|
379
|
+
"table_of_contents",
|
|
380
|
+
"link_to_page",
|
|
381
|
+
"table_row",
|
|
382
|
+
"heading_1",
|
|
383
|
+
"heading_2",
|
|
384
|
+
"heading_3",
|
|
385
|
+
"paragraph",
|
|
386
|
+
"bulleted_list_item",
|
|
387
|
+
"numbered_list_item",
|
|
388
|
+
"quote",
|
|
389
|
+
"to_do",
|
|
390
|
+
"toggle",
|
|
391
|
+
"template",
|
|
392
|
+
"callout",
|
|
393
|
+
"synced_block",
|
|
394
|
+
"table",
|
|
395
|
+
"column"
|
|
396
|
+
],
|
|
397
|
+
path: (p) => `blocks/${p.block_id}`
|
|
398
|
+
};
|
|
399
|
+
exports.deleteBlock = {
|
|
400
|
+
method: "delete",
|
|
401
|
+
pathParams: ["block_id"],
|
|
402
|
+
queryParams: [],
|
|
403
|
+
bodyParams: [],
|
|
404
|
+
path: (p) => `blocks/${p.block_id}`
|
|
405
|
+
};
|
|
406
|
+
exports.listBlockChildren = {
|
|
407
|
+
method: "get",
|
|
408
|
+
pathParams: ["block_id"],
|
|
409
|
+
queryParams: ["start_cursor", "page_size"],
|
|
410
|
+
bodyParams: [],
|
|
411
|
+
path: (p) => `blocks/${p.block_id}/children`
|
|
412
|
+
};
|
|
413
|
+
exports.appendBlockChildren = {
|
|
414
|
+
method: "patch",
|
|
415
|
+
pathParams: ["block_id"],
|
|
416
|
+
queryParams: [],
|
|
417
|
+
bodyParams: ["children", "after", "position"],
|
|
418
|
+
path: (p) => `blocks/${p.block_id}/children`
|
|
419
|
+
};
|
|
420
|
+
exports.getDataSource = {
|
|
421
|
+
method: "get",
|
|
422
|
+
pathParams: ["data_source_id"],
|
|
423
|
+
queryParams: [],
|
|
424
|
+
bodyParams: [],
|
|
425
|
+
path: (p) => `data_sources/${p.data_source_id}`
|
|
426
|
+
};
|
|
427
|
+
exports.updateDataSource = {
|
|
428
|
+
method: "patch",
|
|
429
|
+
pathParams: ["data_source_id"],
|
|
430
|
+
queryParams: [],
|
|
431
|
+
bodyParams: ["title", "icon", "properties", "in_trash", "archived", "parent"],
|
|
432
|
+
path: (p) => `data_sources/${p.data_source_id}`
|
|
433
|
+
};
|
|
434
|
+
exports.queryDataSource = {
|
|
435
|
+
method: "post",
|
|
436
|
+
pathParams: ["data_source_id"],
|
|
437
|
+
queryParams: ["filter_properties"],
|
|
438
|
+
bodyParams: [
|
|
439
|
+
"sorts",
|
|
440
|
+
"filter",
|
|
441
|
+
"start_cursor",
|
|
442
|
+
"page_size",
|
|
443
|
+
"archived",
|
|
444
|
+
"in_trash",
|
|
445
|
+
"result_type"
|
|
446
|
+
],
|
|
447
|
+
path: (p) => `data_sources/${p.data_source_id}/query`
|
|
448
|
+
};
|
|
449
|
+
exports.createDataSource = {
|
|
450
|
+
method: "post",
|
|
451
|
+
pathParams: [],
|
|
452
|
+
queryParams: [],
|
|
453
|
+
bodyParams: ["parent", "properties", "title", "icon"],
|
|
454
|
+
path: () => `data_sources`
|
|
455
|
+
};
|
|
456
|
+
exports.listDataSourceTemplates = {
|
|
457
|
+
method: "get",
|
|
458
|
+
pathParams: ["data_source_id"],
|
|
459
|
+
queryParams: ["name", "start_cursor", "page_size"],
|
|
460
|
+
bodyParams: [],
|
|
461
|
+
path: (p) => `data_sources/${p.data_source_id}/templates`
|
|
462
|
+
};
|
|
463
|
+
exports.getDatabase = {
|
|
464
|
+
method: "get",
|
|
465
|
+
pathParams: ["database_id"],
|
|
466
|
+
queryParams: [],
|
|
467
|
+
bodyParams: [],
|
|
468
|
+
path: (p) => `databases/${p.database_id}`
|
|
469
|
+
};
|
|
470
|
+
exports.updateDatabase = {
|
|
471
|
+
method: "patch",
|
|
472
|
+
pathParams: ["database_id"],
|
|
473
|
+
queryParams: [],
|
|
474
|
+
bodyParams: [
|
|
475
|
+
"parent",
|
|
476
|
+
"title",
|
|
477
|
+
"description",
|
|
478
|
+
"is_inline",
|
|
479
|
+
"icon",
|
|
480
|
+
"cover",
|
|
481
|
+
"in_trash",
|
|
482
|
+
"is_locked"
|
|
483
|
+
],
|
|
484
|
+
path: (p) => `databases/${p.database_id}`
|
|
485
|
+
};
|
|
486
|
+
exports.createDatabase = {
|
|
487
|
+
method: "post",
|
|
488
|
+
pathParams: [],
|
|
489
|
+
queryParams: [],
|
|
490
|
+
bodyParams: [
|
|
491
|
+
"parent",
|
|
492
|
+
"title",
|
|
493
|
+
"description",
|
|
494
|
+
"is_inline",
|
|
495
|
+
"initial_data_source",
|
|
496
|
+
"icon",
|
|
497
|
+
"cover"
|
|
498
|
+
],
|
|
499
|
+
path: () => `databases`
|
|
500
|
+
};
|
|
501
|
+
exports.search = {
|
|
502
|
+
method: "post",
|
|
503
|
+
pathParams: [],
|
|
504
|
+
queryParams: [],
|
|
505
|
+
bodyParams: ["sort", "query", "start_cursor", "page_size", "filter"],
|
|
506
|
+
path: () => `search`
|
|
507
|
+
};
|
|
508
|
+
exports.createComment = {
|
|
509
|
+
method: "post",
|
|
510
|
+
pathParams: [],
|
|
511
|
+
queryParams: [],
|
|
512
|
+
bodyParams: [
|
|
513
|
+
"rich_text",
|
|
514
|
+
"attachments",
|
|
515
|
+
"display_name",
|
|
516
|
+
"parent",
|
|
517
|
+
"discussion_id"
|
|
518
|
+
],
|
|
519
|
+
path: () => `comments`
|
|
520
|
+
};
|
|
521
|
+
exports.listComments = {
|
|
522
|
+
method: "get",
|
|
523
|
+
pathParams: [],
|
|
524
|
+
queryParams: ["block_id", "start_cursor", "page_size"],
|
|
525
|
+
bodyParams: [],
|
|
526
|
+
path: () => `comments`
|
|
527
|
+
};
|
|
528
|
+
exports.getComment = {
|
|
529
|
+
method: "get",
|
|
530
|
+
pathParams: ["comment_id"],
|
|
531
|
+
queryParams: [],
|
|
532
|
+
bodyParams: [],
|
|
533
|
+
path: (p) => `comments/${p.comment_id}`
|
|
534
|
+
};
|
|
535
|
+
exports.createFileUpload = {
|
|
536
|
+
method: "post",
|
|
537
|
+
pathParams: [],
|
|
538
|
+
queryParams: [],
|
|
539
|
+
bodyParams: [
|
|
540
|
+
"mode",
|
|
541
|
+
"filename",
|
|
542
|
+
"content_type",
|
|
543
|
+
"number_of_parts",
|
|
544
|
+
"external_url"
|
|
545
|
+
],
|
|
546
|
+
path: () => `file_uploads`
|
|
547
|
+
};
|
|
548
|
+
exports.listFileUploads = {
|
|
549
|
+
method: "get",
|
|
550
|
+
pathParams: [],
|
|
551
|
+
queryParams: ["status", "start_cursor", "page_size"],
|
|
552
|
+
bodyParams: [],
|
|
553
|
+
path: () => `file_uploads`
|
|
554
|
+
};
|
|
555
|
+
exports.sendFileUpload = {
|
|
556
|
+
method: "post",
|
|
557
|
+
pathParams: ["file_upload_id"],
|
|
558
|
+
queryParams: [],
|
|
559
|
+
bodyParams: [],
|
|
560
|
+
formDataParams: ["file", "part_number"],
|
|
561
|
+
path: (p) => `file_uploads/${p.file_upload_id}/send`
|
|
562
|
+
};
|
|
563
|
+
exports.completeFileUpload = {
|
|
564
|
+
method: "post",
|
|
565
|
+
pathParams: ["file_upload_id"],
|
|
566
|
+
queryParams: [],
|
|
567
|
+
bodyParams: [],
|
|
568
|
+
path: (p) => `file_uploads/${p.file_upload_id}/complete`
|
|
569
|
+
};
|
|
570
|
+
exports.getFileUpload = {
|
|
571
|
+
method: "get",
|
|
572
|
+
pathParams: ["file_upload_id"],
|
|
573
|
+
queryParams: [],
|
|
574
|
+
bodyParams: [],
|
|
575
|
+
path: (p) => `file_uploads/${p.file_upload_id}`
|
|
576
|
+
};
|
|
577
|
+
exports.oauthToken = {
|
|
578
|
+
method: "post",
|
|
579
|
+
pathParams: [],
|
|
580
|
+
queryParams: [],
|
|
581
|
+
bodyParams: [
|
|
582
|
+
"grant_type",
|
|
583
|
+
"code",
|
|
584
|
+
"redirect_uri",
|
|
585
|
+
"external_account",
|
|
586
|
+
"refresh_token"
|
|
587
|
+
],
|
|
588
|
+
path: () => `oauth/token`
|
|
589
|
+
};
|
|
590
|
+
exports.oauthRevoke = {
|
|
591
|
+
method: "post",
|
|
592
|
+
pathParams: [],
|
|
593
|
+
queryParams: [],
|
|
594
|
+
bodyParams: ["token"],
|
|
595
|
+
path: () => `oauth/revoke`
|
|
596
|
+
};
|
|
597
|
+
exports.oauthIntrospect = {
|
|
598
|
+
method: "post",
|
|
599
|
+
pathParams: [],
|
|
600
|
+
queryParams: [],
|
|
601
|
+
bodyParams: ["token"],
|
|
602
|
+
path: () => `oauth/introspect`
|
|
603
|
+
};
|
|
604
|
+
exports.movePage = {
|
|
605
|
+
method: "post",
|
|
606
|
+
pathParams: ["page_id"],
|
|
607
|
+
queryParams: [],
|
|
608
|
+
bodyParams: ["parent"],
|
|
609
|
+
path: (p) => `pages/${p.page_id}/move`
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
});
|
|
613
|
+
|
|
614
|
+
// node_modules/@notionhq/client/build/package.json
|
|
615
|
+
var require_package = __commonJS({
|
|
616
|
+
"node_modules/@notionhq/client/build/package.json"(exports, module) {
|
|
617
|
+
module.exports = {
|
|
618
|
+
name: "@notionhq/client",
|
|
619
|
+
version: "5.9.0",
|
|
620
|
+
description: "A simple and easy to use client for the Notion API",
|
|
621
|
+
engines: {
|
|
622
|
+
node: ">=18"
|
|
623
|
+
},
|
|
624
|
+
homepage: "https://developers.notion.com/docs/getting-started",
|
|
625
|
+
bugs: {
|
|
626
|
+
url: "https://github.com/makenotion/notion-sdk-js/issues"
|
|
627
|
+
},
|
|
628
|
+
repository: {
|
|
629
|
+
type: "git",
|
|
630
|
+
url: "https://github.com/makenotion/notion-sdk-js/"
|
|
631
|
+
},
|
|
632
|
+
keywords: [
|
|
633
|
+
"notion",
|
|
634
|
+
"notionapi",
|
|
635
|
+
"rest",
|
|
636
|
+
"notion-api"
|
|
637
|
+
],
|
|
638
|
+
main: "./build/src",
|
|
639
|
+
types: "./build/src/index.d.ts",
|
|
640
|
+
scripts: {
|
|
641
|
+
prepare: "husky && npm run build",
|
|
642
|
+
prepublishOnly: "npm run checkLoggedIn && npm run lint && npm run test",
|
|
643
|
+
build: "tsc",
|
|
644
|
+
prettier: "prettier --write .",
|
|
645
|
+
lint: "prettier --check . && eslint . --ext .ts && cspell '**/*' ",
|
|
646
|
+
test: "jest ./test",
|
|
647
|
+
"check-links": "git ls-files | grep md$ | xargs -n 1 markdown-link-check",
|
|
648
|
+
prebuild: "npm run clean",
|
|
649
|
+
clean: "rm -rf ./build",
|
|
650
|
+
checkLoggedIn: "./scripts/verifyLoggedIn.sh"
|
|
651
|
+
},
|
|
652
|
+
"lint-staged": {
|
|
653
|
+
"*.{ts,js,json,md}": "prettier --write",
|
|
654
|
+
"*.ts": "eslint --fix"
|
|
655
|
+
},
|
|
656
|
+
author: "",
|
|
657
|
+
license: "MIT",
|
|
658
|
+
files: [
|
|
659
|
+
"build/package.json",
|
|
660
|
+
"build/src/**"
|
|
661
|
+
],
|
|
662
|
+
devDependencies: {
|
|
663
|
+
"@types/jest": "28.1.4",
|
|
664
|
+
"@typescript-eslint/eslint-plugin": "5.39.0",
|
|
665
|
+
"@typescript-eslint/parser": "5.39.0",
|
|
666
|
+
cspell: "5.4.1",
|
|
667
|
+
eslint: "7.24.0",
|
|
668
|
+
husky: "^9.1.7",
|
|
669
|
+
jest: "28.1.2",
|
|
670
|
+
"lint-staged": "^16.2.6",
|
|
671
|
+
"markdown-link-check": "3.13.7",
|
|
672
|
+
prettier: "2.8.8",
|
|
673
|
+
"ts-jest": "28.0.5",
|
|
674
|
+
typescript: "5.9.2"
|
|
675
|
+
}
|
|
676
|
+
};
|
|
677
|
+
}
|
|
678
|
+
});
|
|
679
|
+
|
|
680
|
+
// node_modules/@notionhq/client/build/src/Client.js
|
|
681
|
+
var require_Client = __commonJS({
|
|
682
|
+
"node_modules/@notionhq/client/build/src/Client.js"(exports) {
|
|
683
|
+
"use strict";
|
|
684
|
+
var __classPrivateFieldSet = exports && exports.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
|
|
685
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
686
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
687
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
688
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
689
|
+
};
|
|
690
|
+
var __classPrivateFieldGet = exports && exports.__classPrivateFieldGet || function(receiver, state, kind, f) {
|
|
691
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
692
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
693
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
694
|
+
};
|
|
695
|
+
var _Client_auth;
|
|
696
|
+
var _Client_logLevel;
|
|
697
|
+
var _Client_logger;
|
|
698
|
+
var _Client_prefixUrl;
|
|
699
|
+
var _Client_timeoutMs;
|
|
700
|
+
var _Client_notionVersion;
|
|
701
|
+
var _Client_fetch;
|
|
702
|
+
var _Client_agent;
|
|
703
|
+
var _Client_userAgent;
|
|
704
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
705
|
+
var logging_1 = require_logging();
|
|
706
|
+
var errors_1 = require_errors();
|
|
707
|
+
var utils_1 = require_utils();
|
|
708
|
+
var api_endpoints_1 = require_api_endpoints();
|
|
709
|
+
var package_json_1 = require_package();
|
|
710
|
+
var Client2 = class _Client {
|
|
711
|
+
constructor(options) {
|
|
712
|
+
var _a, _b, _c, _d, _e, _f;
|
|
713
|
+
_Client_auth.set(this, void 0);
|
|
714
|
+
_Client_logLevel.set(this, void 0);
|
|
715
|
+
_Client_logger.set(this, void 0);
|
|
716
|
+
_Client_prefixUrl.set(this, void 0);
|
|
717
|
+
_Client_timeoutMs.set(this, void 0);
|
|
718
|
+
_Client_notionVersion.set(this, void 0);
|
|
719
|
+
_Client_fetch.set(this, void 0);
|
|
720
|
+
_Client_agent.set(this, void 0);
|
|
721
|
+
_Client_userAgent.set(this, void 0);
|
|
722
|
+
this.blocks = {
|
|
723
|
+
/**
|
|
724
|
+
* Retrieve block
|
|
725
|
+
*/
|
|
726
|
+
retrieve: (args) => {
|
|
727
|
+
return this.request({
|
|
728
|
+
path: api_endpoints_1.getBlock.path(args),
|
|
729
|
+
method: api_endpoints_1.getBlock.method,
|
|
730
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.getBlock.queryParams),
|
|
731
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.getBlock.bodyParams),
|
|
732
|
+
auth: args === null || args === void 0 ? void 0 : args.auth
|
|
733
|
+
});
|
|
734
|
+
},
|
|
735
|
+
/**
|
|
736
|
+
* Update block
|
|
737
|
+
*/
|
|
738
|
+
update: (args) => {
|
|
739
|
+
return this.request({
|
|
740
|
+
path: api_endpoints_1.updateBlock.path(args),
|
|
741
|
+
method: api_endpoints_1.updateBlock.method,
|
|
742
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.updateBlock.queryParams),
|
|
743
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.updateBlock.bodyParams),
|
|
744
|
+
auth: args === null || args === void 0 ? void 0 : args.auth
|
|
745
|
+
});
|
|
746
|
+
},
|
|
747
|
+
/**
|
|
748
|
+
* Delete block
|
|
749
|
+
*/
|
|
750
|
+
delete: (args) => {
|
|
751
|
+
return this.request({
|
|
752
|
+
path: api_endpoints_1.deleteBlock.path(args),
|
|
753
|
+
method: api_endpoints_1.deleteBlock.method,
|
|
754
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.deleteBlock.queryParams),
|
|
755
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.deleteBlock.bodyParams),
|
|
756
|
+
auth: args === null || args === void 0 ? void 0 : args.auth
|
|
757
|
+
});
|
|
758
|
+
},
|
|
759
|
+
children: {
|
|
760
|
+
/**
|
|
761
|
+
* Append block children
|
|
762
|
+
*/
|
|
763
|
+
append: (args) => {
|
|
764
|
+
return this.request({
|
|
765
|
+
path: api_endpoints_1.appendBlockChildren.path(args),
|
|
766
|
+
method: api_endpoints_1.appendBlockChildren.method,
|
|
767
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.appendBlockChildren.queryParams),
|
|
768
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.appendBlockChildren.bodyParams),
|
|
769
|
+
auth: args === null || args === void 0 ? void 0 : args.auth
|
|
770
|
+
});
|
|
771
|
+
},
|
|
772
|
+
/**
|
|
773
|
+
* Retrieve block children
|
|
774
|
+
*/
|
|
775
|
+
list: (args) => {
|
|
776
|
+
return this.request({
|
|
777
|
+
path: api_endpoints_1.listBlockChildren.path(args),
|
|
778
|
+
method: api_endpoints_1.listBlockChildren.method,
|
|
779
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.listBlockChildren.queryParams),
|
|
780
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.listBlockChildren.bodyParams),
|
|
781
|
+
auth: args === null || args === void 0 ? void 0 : args.auth
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
};
|
|
786
|
+
this.databases = {
|
|
787
|
+
/**
|
|
788
|
+
* Retrieve a database
|
|
789
|
+
*/
|
|
790
|
+
retrieve: (args) => {
|
|
791
|
+
return this.request({
|
|
792
|
+
path: api_endpoints_1.getDatabase.path(args),
|
|
793
|
+
method: api_endpoints_1.getDatabase.method,
|
|
794
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.getDatabase.queryParams),
|
|
795
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.getDatabase.bodyParams),
|
|
796
|
+
auth: args === null || args === void 0 ? void 0 : args.auth
|
|
797
|
+
});
|
|
798
|
+
},
|
|
799
|
+
/**
|
|
800
|
+
* Create a database
|
|
801
|
+
*/
|
|
802
|
+
create: (args) => {
|
|
803
|
+
return this.request({
|
|
804
|
+
path: api_endpoints_1.createDatabase.path(),
|
|
805
|
+
method: api_endpoints_1.createDatabase.method,
|
|
806
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.createDatabase.queryParams),
|
|
807
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.createDatabase.bodyParams),
|
|
808
|
+
auth: args === null || args === void 0 ? void 0 : args.auth
|
|
809
|
+
});
|
|
810
|
+
},
|
|
811
|
+
/**
|
|
812
|
+
* Update a database
|
|
813
|
+
*/
|
|
814
|
+
update: (args) => {
|
|
815
|
+
return this.request({
|
|
816
|
+
path: api_endpoints_1.updateDatabase.path(args),
|
|
817
|
+
method: api_endpoints_1.updateDatabase.method,
|
|
818
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.updateDatabase.queryParams),
|
|
819
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.updateDatabase.bodyParams),
|
|
820
|
+
auth: args === null || args === void 0 ? void 0 : args.auth
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
};
|
|
824
|
+
this.dataSources = {
|
|
825
|
+
/**
|
|
826
|
+
* Retrieve a data source
|
|
827
|
+
*/
|
|
828
|
+
retrieve: (args) => {
|
|
829
|
+
return this.request({
|
|
830
|
+
path: api_endpoints_1.getDataSource.path(args),
|
|
831
|
+
method: api_endpoints_1.getDataSource.method,
|
|
832
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.getDataSource.queryParams),
|
|
833
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.getDataSource.bodyParams),
|
|
834
|
+
auth: args === null || args === void 0 ? void 0 : args.auth
|
|
835
|
+
});
|
|
836
|
+
},
|
|
837
|
+
/**
|
|
838
|
+
* Query a data source
|
|
839
|
+
*/
|
|
840
|
+
query: (args) => {
|
|
841
|
+
return this.request({
|
|
842
|
+
path: api_endpoints_1.queryDataSource.path(args),
|
|
843
|
+
method: api_endpoints_1.queryDataSource.method,
|
|
844
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.queryDataSource.queryParams),
|
|
845
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.queryDataSource.bodyParams),
|
|
846
|
+
auth: args === null || args === void 0 ? void 0 : args.auth
|
|
847
|
+
});
|
|
848
|
+
},
|
|
849
|
+
/**
|
|
850
|
+
* Create a data source
|
|
851
|
+
*/
|
|
852
|
+
create: (args) => {
|
|
853
|
+
return this.request({
|
|
854
|
+
path: api_endpoints_1.createDataSource.path(),
|
|
855
|
+
method: api_endpoints_1.createDataSource.method,
|
|
856
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.createDataSource.queryParams),
|
|
857
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.createDataSource.bodyParams),
|
|
858
|
+
auth: args === null || args === void 0 ? void 0 : args.auth
|
|
859
|
+
});
|
|
860
|
+
},
|
|
861
|
+
/**
|
|
862
|
+
* Update a data source
|
|
863
|
+
*/
|
|
864
|
+
update: (args) => {
|
|
865
|
+
return this.request({
|
|
866
|
+
path: api_endpoints_1.updateDataSource.path(args),
|
|
867
|
+
method: api_endpoints_1.updateDataSource.method,
|
|
868
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.updateDataSource.queryParams),
|
|
869
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.updateDataSource.bodyParams),
|
|
870
|
+
auth: args === null || args === void 0 ? void 0 : args.auth
|
|
871
|
+
});
|
|
872
|
+
},
|
|
873
|
+
/**
|
|
874
|
+
* List page templates that are available for a data source
|
|
875
|
+
*/
|
|
876
|
+
listTemplates: (args) => {
|
|
877
|
+
return this.request({
|
|
878
|
+
path: api_endpoints_1.listDataSourceTemplates.path(args),
|
|
879
|
+
method: api_endpoints_1.listDataSourceTemplates.method,
|
|
880
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.listDataSourceTemplates.queryParams),
|
|
881
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.listDataSourceTemplates.bodyParams),
|
|
882
|
+
auth: args === null || args === void 0 ? void 0 : args.auth
|
|
883
|
+
});
|
|
884
|
+
}
|
|
885
|
+
};
|
|
886
|
+
this.pages = {
|
|
887
|
+
/**
|
|
888
|
+
* Create a page
|
|
889
|
+
*/
|
|
890
|
+
create: (args) => {
|
|
891
|
+
return this.request({
|
|
892
|
+
path: api_endpoints_1.createPage.path(),
|
|
893
|
+
method: api_endpoints_1.createPage.method,
|
|
894
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.createPage.queryParams),
|
|
895
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.createPage.bodyParams),
|
|
896
|
+
auth: args === null || args === void 0 ? void 0 : args.auth
|
|
897
|
+
});
|
|
898
|
+
},
|
|
899
|
+
/**
|
|
900
|
+
* Retrieve a page
|
|
901
|
+
*/
|
|
902
|
+
retrieve: (args) => {
|
|
903
|
+
return this.request({
|
|
904
|
+
path: api_endpoints_1.getPage.path(args),
|
|
905
|
+
method: api_endpoints_1.getPage.method,
|
|
906
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.getPage.queryParams),
|
|
907
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.getPage.bodyParams),
|
|
908
|
+
auth: args === null || args === void 0 ? void 0 : args.auth
|
|
909
|
+
});
|
|
910
|
+
},
|
|
911
|
+
/**
|
|
912
|
+
* Update page properties
|
|
913
|
+
*/
|
|
914
|
+
update: (args) => {
|
|
915
|
+
return this.request({
|
|
916
|
+
path: api_endpoints_1.updatePage.path(args),
|
|
917
|
+
method: api_endpoints_1.updatePage.method,
|
|
918
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.updatePage.queryParams),
|
|
919
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.updatePage.bodyParams),
|
|
920
|
+
auth: args === null || args === void 0 ? void 0 : args.auth
|
|
921
|
+
});
|
|
922
|
+
},
|
|
923
|
+
/**
|
|
924
|
+
* Move a page
|
|
925
|
+
*/
|
|
926
|
+
move: (args) => {
|
|
927
|
+
return this.request({
|
|
928
|
+
path: api_endpoints_1.movePage.path(args),
|
|
929
|
+
method: api_endpoints_1.movePage.method,
|
|
930
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.movePage.queryParams),
|
|
931
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.movePage.bodyParams),
|
|
932
|
+
auth: args === null || args === void 0 ? void 0 : args.auth
|
|
933
|
+
});
|
|
934
|
+
},
|
|
935
|
+
properties: {
|
|
936
|
+
/**
|
|
937
|
+
* Retrieve page property
|
|
938
|
+
*/
|
|
939
|
+
retrieve: (args) => {
|
|
940
|
+
return this.request({
|
|
941
|
+
path: api_endpoints_1.getPageProperty.path(args),
|
|
942
|
+
method: api_endpoints_1.getPageProperty.method,
|
|
943
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.getPageProperty.queryParams),
|
|
944
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.getPageProperty.bodyParams),
|
|
945
|
+
auth: args === null || args === void 0 ? void 0 : args.auth
|
|
946
|
+
});
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
};
|
|
950
|
+
this.users = {
|
|
951
|
+
/**
|
|
952
|
+
* Retrieve a user
|
|
953
|
+
*/
|
|
954
|
+
retrieve: (args) => {
|
|
955
|
+
return this.request({
|
|
956
|
+
path: api_endpoints_1.getUser.path(args),
|
|
957
|
+
method: api_endpoints_1.getUser.method,
|
|
958
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.getUser.queryParams),
|
|
959
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.getUser.bodyParams),
|
|
960
|
+
auth: args === null || args === void 0 ? void 0 : args.auth
|
|
961
|
+
});
|
|
962
|
+
},
|
|
963
|
+
/**
|
|
964
|
+
* List all users
|
|
965
|
+
*/
|
|
966
|
+
list: (args) => {
|
|
967
|
+
return this.request({
|
|
968
|
+
path: api_endpoints_1.listUsers.path(),
|
|
969
|
+
method: api_endpoints_1.listUsers.method,
|
|
970
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.listUsers.queryParams),
|
|
971
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.listUsers.bodyParams),
|
|
972
|
+
auth: args === null || args === void 0 ? void 0 : args.auth
|
|
973
|
+
});
|
|
974
|
+
},
|
|
975
|
+
/**
|
|
976
|
+
* Get details about bot
|
|
977
|
+
*/
|
|
978
|
+
me: (args) => {
|
|
979
|
+
return this.request({
|
|
980
|
+
path: api_endpoints_1.getSelf.path(),
|
|
981
|
+
method: api_endpoints_1.getSelf.method,
|
|
982
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.getSelf.queryParams),
|
|
983
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.getSelf.bodyParams),
|
|
984
|
+
auth: args === null || args === void 0 ? void 0 : args.auth
|
|
985
|
+
});
|
|
986
|
+
}
|
|
987
|
+
};
|
|
988
|
+
this.comments = {
|
|
989
|
+
/**
|
|
990
|
+
* Create a comment
|
|
991
|
+
*/
|
|
992
|
+
create: (args) => {
|
|
993
|
+
return this.request({
|
|
994
|
+
path: api_endpoints_1.createComment.path(),
|
|
995
|
+
method: api_endpoints_1.createComment.method,
|
|
996
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.createComment.queryParams),
|
|
997
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.createComment.bodyParams),
|
|
998
|
+
auth: args === null || args === void 0 ? void 0 : args.auth
|
|
999
|
+
});
|
|
1000
|
+
},
|
|
1001
|
+
/**
|
|
1002
|
+
* List comments
|
|
1003
|
+
*/
|
|
1004
|
+
list: (args) => {
|
|
1005
|
+
return this.request({
|
|
1006
|
+
path: api_endpoints_1.listComments.path(),
|
|
1007
|
+
method: api_endpoints_1.listComments.method,
|
|
1008
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.listComments.queryParams),
|
|
1009
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.listComments.bodyParams),
|
|
1010
|
+
auth: args === null || args === void 0 ? void 0 : args.auth
|
|
1011
|
+
});
|
|
1012
|
+
},
|
|
1013
|
+
/**
|
|
1014
|
+
* Retrieve a comment
|
|
1015
|
+
*/
|
|
1016
|
+
retrieve: (args) => {
|
|
1017
|
+
return this.request({
|
|
1018
|
+
path: api_endpoints_1.getComment.path(args),
|
|
1019
|
+
method: api_endpoints_1.getComment.method,
|
|
1020
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.getComment.queryParams),
|
|
1021
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.getComment.bodyParams),
|
|
1022
|
+
auth: args === null || args === void 0 ? void 0 : args.auth
|
|
1023
|
+
});
|
|
1024
|
+
}
|
|
1025
|
+
};
|
|
1026
|
+
this.fileUploads = {
|
|
1027
|
+
/**
|
|
1028
|
+
* Create a file upload
|
|
1029
|
+
*/
|
|
1030
|
+
create: (args) => {
|
|
1031
|
+
return this.request({
|
|
1032
|
+
path: api_endpoints_1.createFileUpload.path(),
|
|
1033
|
+
method: api_endpoints_1.createFileUpload.method,
|
|
1034
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.createFileUpload.queryParams),
|
|
1035
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.createFileUpload.bodyParams),
|
|
1036
|
+
auth: args === null || args === void 0 ? void 0 : args.auth
|
|
1037
|
+
});
|
|
1038
|
+
},
|
|
1039
|
+
/**
|
|
1040
|
+
* Retrieve a file upload
|
|
1041
|
+
*/
|
|
1042
|
+
retrieve: (args) => {
|
|
1043
|
+
return this.request({
|
|
1044
|
+
path: api_endpoints_1.getFileUpload.path(args),
|
|
1045
|
+
method: api_endpoints_1.getFileUpload.method,
|
|
1046
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.getFileUpload.queryParams),
|
|
1047
|
+
auth: args === null || args === void 0 ? void 0 : args.auth
|
|
1048
|
+
});
|
|
1049
|
+
},
|
|
1050
|
+
/**
|
|
1051
|
+
* List file uploads
|
|
1052
|
+
*/
|
|
1053
|
+
list: (args) => {
|
|
1054
|
+
return this.request({
|
|
1055
|
+
path: api_endpoints_1.listFileUploads.path(),
|
|
1056
|
+
method: api_endpoints_1.listFileUploads.method,
|
|
1057
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.listFileUploads.queryParams),
|
|
1058
|
+
auth: args === null || args === void 0 ? void 0 : args.auth
|
|
1059
|
+
});
|
|
1060
|
+
},
|
|
1061
|
+
/**
|
|
1062
|
+
* Send a file upload
|
|
1063
|
+
*
|
|
1064
|
+
* Requires a `file_upload_id`, obtained from the `id` of the Create File
|
|
1065
|
+
* Upload API response.
|
|
1066
|
+
*
|
|
1067
|
+
* The `file` parameter contains the raw file contents or Blob/File object
|
|
1068
|
+
* under `file.data`, and an optional `file.filename` string.
|
|
1069
|
+
*
|
|
1070
|
+
* Supply a stringified `part_number` parameter when using file uploads
|
|
1071
|
+
* in multi-part mode.
|
|
1072
|
+
*
|
|
1073
|
+
* This endpoint sends HTTP multipart/form-data instead of JSON parameters.
|
|
1074
|
+
*/
|
|
1075
|
+
send: (args) => {
|
|
1076
|
+
return this.request({
|
|
1077
|
+
path: api_endpoints_1.sendFileUpload.path(args),
|
|
1078
|
+
method: api_endpoints_1.sendFileUpload.method,
|
|
1079
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.sendFileUpload.queryParams),
|
|
1080
|
+
formDataParams: (0, utils_1.pick)(args, api_endpoints_1.sendFileUpload.formDataParams),
|
|
1081
|
+
auth: args === null || args === void 0 ? void 0 : args.auth
|
|
1082
|
+
});
|
|
1083
|
+
},
|
|
1084
|
+
/**
|
|
1085
|
+
* Complete a file upload
|
|
1086
|
+
*/
|
|
1087
|
+
complete: (args) => {
|
|
1088
|
+
return this.request({
|
|
1089
|
+
path: api_endpoints_1.completeFileUpload.path(args),
|
|
1090
|
+
method: api_endpoints_1.completeFileUpload.method,
|
|
1091
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.completeFileUpload.queryParams),
|
|
1092
|
+
auth: args === null || args === void 0 ? void 0 : args.auth
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1095
|
+
};
|
|
1096
|
+
this.search = (args) => {
|
|
1097
|
+
return this.request({
|
|
1098
|
+
path: api_endpoints_1.search.path(),
|
|
1099
|
+
method: api_endpoints_1.search.method,
|
|
1100
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.search.queryParams),
|
|
1101
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.search.bodyParams),
|
|
1102
|
+
auth: args === null || args === void 0 ? void 0 : args.auth
|
|
1103
|
+
});
|
|
1104
|
+
};
|
|
1105
|
+
this.oauth = {
|
|
1106
|
+
/**
|
|
1107
|
+
* Get token
|
|
1108
|
+
*/
|
|
1109
|
+
token: (args) => {
|
|
1110
|
+
return this.request({
|
|
1111
|
+
path: api_endpoints_1.oauthToken.path(),
|
|
1112
|
+
method: api_endpoints_1.oauthToken.method,
|
|
1113
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.oauthToken.queryParams),
|
|
1114
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.oauthToken.bodyParams),
|
|
1115
|
+
auth: {
|
|
1116
|
+
client_id: args.client_id,
|
|
1117
|
+
client_secret: args.client_secret
|
|
1118
|
+
}
|
|
1119
|
+
});
|
|
1120
|
+
},
|
|
1121
|
+
/**
|
|
1122
|
+
* Introspect token
|
|
1123
|
+
*/
|
|
1124
|
+
introspect: (args) => {
|
|
1125
|
+
return this.request({
|
|
1126
|
+
path: api_endpoints_1.oauthIntrospect.path(),
|
|
1127
|
+
method: api_endpoints_1.oauthIntrospect.method,
|
|
1128
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.oauthIntrospect.queryParams),
|
|
1129
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.oauthIntrospect.bodyParams),
|
|
1130
|
+
auth: {
|
|
1131
|
+
client_id: args.client_id,
|
|
1132
|
+
client_secret: args.client_secret
|
|
1133
|
+
}
|
|
1134
|
+
});
|
|
1135
|
+
},
|
|
1136
|
+
/**
|
|
1137
|
+
* Revoke token
|
|
1138
|
+
*/
|
|
1139
|
+
revoke: (args) => {
|
|
1140
|
+
return this.request({
|
|
1141
|
+
path: api_endpoints_1.oauthRevoke.path(),
|
|
1142
|
+
method: api_endpoints_1.oauthRevoke.method,
|
|
1143
|
+
query: (0, utils_1.pick)(args, api_endpoints_1.oauthRevoke.queryParams),
|
|
1144
|
+
body: (0, utils_1.pick)(args, api_endpoints_1.oauthRevoke.bodyParams),
|
|
1145
|
+
auth: {
|
|
1146
|
+
client_id: args.client_id,
|
|
1147
|
+
client_secret: args.client_secret
|
|
1148
|
+
}
|
|
1149
|
+
});
|
|
1150
|
+
}
|
|
1151
|
+
};
|
|
1152
|
+
__classPrivateFieldSet(this, _Client_auth, options === null || options === void 0 ? void 0 : options.auth, "f");
|
|
1153
|
+
__classPrivateFieldSet(this, _Client_logLevel, (_a = options === null || options === void 0 ? void 0 : options.logLevel) !== null && _a !== void 0 ? _a : logging_1.LogLevel.WARN, "f");
|
|
1154
|
+
__classPrivateFieldSet(this, _Client_logger, (_b = options === null || options === void 0 ? void 0 : options.logger) !== null && _b !== void 0 ? _b : (0, logging_1.makeConsoleLogger)(package_json_1.name), "f");
|
|
1155
|
+
__classPrivateFieldSet(this, _Client_prefixUrl, `${(_c = options === null || options === void 0 ? void 0 : options.baseUrl) !== null && _c !== void 0 ? _c : "https://api.notion.com"}/v1/`, "f");
|
|
1156
|
+
__classPrivateFieldSet(this, _Client_timeoutMs, (_d = options === null || options === void 0 ? void 0 : options.timeoutMs) !== null && _d !== void 0 ? _d : 6e4, "f");
|
|
1157
|
+
__classPrivateFieldSet(this, _Client_notionVersion, (_e = options === null || options === void 0 ? void 0 : options.notionVersion) !== null && _e !== void 0 ? _e : _Client.defaultNotionVersion, "f");
|
|
1158
|
+
__classPrivateFieldSet(this, _Client_fetch, (_f = options === null || options === void 0 ? void 0 : options.fetch) !== null && _f !== void 0 ? _f : fetch, "f");
|
|
1159
|
+
__classPrivateFieldSet(this, _Client_agent, options === null || options === void 0 ? void 0 : options.agent, "f");
|
|
1160
|
+
__classPrivateFieldSet(this, _Client_userAgent, `notionhq-client/${package_json_1.version}`, "f");
|
|
1161
|
+
}
|
|
1162
|
+
/**
|
|
1163
|
+
* Sends a request.
|
|
1164
|
+
*/
|
|
1165
|
+
async request(args) {
|
|
1166
|
+
const { path, method, query, body, formDataParams, auth } = args;
|
|
1167
|
+
(0, errors_1.validateRequestPath)(path);
|
|
1168
|
+
this.log(logging_1.LogLevel.INFO, "request start", { method, path });
|
|
1169
|
+
const bodyAsJsonString = !body || Object.entries(body).length === 0 ? void 0 : JSON.stringify(body);
|
|
1170
|
+
const url = new URL(`${__classPrivateFieldGet(this, _Client_prefixUrl, "f")}${path}`);
|
|
1171
|
+
if (query) {
|
|
1172
|
+
for (const [key, value] of Object.entries(query)) {
|
|
1173
|
+
if (value !== void 0) {
|
|
1174
|
+
if (Array.isArray(value)) {
|
|
1175
|
+
for (const val of value) {
|
|
1176
|
+
url.searchParams.append(key, decodeURIComponent(val));
|
|
1177
|
+
}
|
|
1178
|
+
} else {
|
|
1179
|
+
url.searchParams.append(key, String(value));
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
let authorizationHeader;
|
|
1185
|
+
if (typeof auth === "object") {
|
|
1186
|
+
const unencodedCredential = `${auth.client_id}:${auth.client_secret}`;
|
|
1187
|
+
const encodedCredential = Buffer.from(unencodedCredential).toString("base64");
|
|
1188
|
+
authorizationHeader = { authorization: `Basic ${encodedCredential}` };
|
|
1189
|
+
} else {
|
|
1190
|
+
authorizationHeader = this.authAsHeaders(auth);
|
|
1191
|
+
}
|
|
1192
|
+
const headers = {
|
|
1193
|
+
// Request-level custom additional headers can be provided, but
|
|
1194
|
+
// don't allow them to override all other headers, e.g. the
|
|
1195
|
+
// standard user agent.
|
|
1196
|
+
...args.headers,
|
|
1197
|
+
...authorizationHeader,
|
|
1198
|
+
"Notion-Version": __classPrivateFieldGet(this, _Client_notionVersion, "f"),
|
|
1199
|
+
"user-agent": __classPrivateFieldGet(this, _Client_userAgent, "f")
|
|
1200
|
+
};
|
|
1201
|
+
if (bodyAsJsonString !== void 0) {
|
|
1202
|
+
headers["content-type"] = "application/json";
|
|
1203
|
+
}
|
|
1204
|
+
let formData;
|
|
1205
|
+
if (formDataParams) {
|
|
1206
|
+
delete headers["content-type"];
|
|
1207
|
+
formData = new FormData();
|
|
1208
|
+
for (const [key, value] of Object.entries(formDataParams)) {
|
|
1209
|
+
if (typeof value === "string") {
|
|
1210
|
+
formData.append(key, value);
|
|
1211
|
+
} else if (typeof value === "object") {
|
|
1212
|
+
formData.append(key, typeof value.data === "object" ? value.data : new Blob([value.data]), value.filename);
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
try {
|
|
1217
|
+
const response = await errors_1.RequestTimeoutError.rejectAfterTimeout(__classPrivateFieldGet(this, _Client_fetch, "f").call(this, url.toString(), {
|
|
1218
|
+
method: method.toUpperCase(),
|
|
1219
|
+
headers,
|
|
1220
|
+
body: bodyAsJsonString !== null && bodyAsJsonString !== void 0 ? bodyAsJsonString : formData,
|
|
1221
|
+
agent: __classPrivateFieldGet(this, _Client_agent, "f")
|
|
1222
|
+
}), __classPrivateFieldGet(this, _Client_timeoutMs, "f"));
|
|
1223
|
+
const responseText = await response.text();
|
|
1224
|
+
if (!response.ok) {
|
|
1225
|
+
throw (0, errors_1.buildRequestError)(response, responseText);
|
|
1226
|
+
}
|
|
1227
|
+
const responseJson = JSON.parse(responseText);
|
|
1228
|
+
this.log(logging_1.LogLevel.INFO, "request success", {
|
|
1229
|
+
method,
|
|
1230
|
+
path,
|
|
1231
|
+
..."request_id" in responseJson && responseJson.request_id ? { requestId: responseJson.request_id } : {}
|
|
1232
|
+
});
|
|
1233
|
+
return responseJson;
|
|
1234
|
+
} catch (error) {
|
|
1235
|
+
if (!(0, errors_1.isNotionClientError)(error)) {
|
|
1236
|
+
throw error;
|
|
1237
|
+
}
|
|
1238
|
+
this.log(logging_1.LogLevel.WARN, "request fail", {
|
|
1239
|
+
code: error.code,
|
|
1240
|
+
message: error.message,
|
|
1241
|
+
..."request_id" in error && error.request_id ? { requestId: error.request_id } : {}
|
|
1242
|
+
});
|
|
1243
|
+
if ((0, errors_1.isHTTPResponseError)(error)) {
|
|
1244
|
+
this.log(logging_1.LogLevel.DEBUG, "failed response body", {
|
|
1245
|
+
body: error.body
|
|
1246
|
+
});
|
|
1247
|
+
}
|
|
1248
|
+
throw error;
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
/**
|
|
1252
|
+
* Emits a log message to the console.
|
|
1253
|
+
*
|
|
1254
|
+
* @param level The level for this message
|
|
1255
|
+
* @param args Arguments to send to the console
|
|
1256
|
+
*/
|
|
1257
|
+
log(level, message, extraInfo) {
|
|
1258
|
+
if ((0, logging_1.logLevelSeverity)(level) >= (0, logging_1.logLevelSeverity)(__classPrivateFieldGet(this, _Client_logLevel, "f"))) {
|
|
1259
|
+
__classPrivateFieldGet(this, _Client_logger, "f").call(this, level, message, extraInfo);
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
/**
|
|
1263
|
+
* Transforms an API key or access token into a headers object suitable for an HTTP request.
|
|
1264
|
+
*
|
|
1265
|
+
* This method uses the instance's value as the default when the input is undefined. If neither are defined, it returns
|
|
1266
|
+
* an empty object
|
|
1267
|
+
*
|
|
1268
|
+
* @param auth API key or access token
|
|
1269
|
+
* @returns headers key-value object
|
|
1270
|
+
*/
|
|
1271
|
+
authAsHeaders(auth) {
|
|
1272
|
+
const headers = {};
|
|
1273
|
+
const authHeaderValue = auth !== null && auth !== void 0 ? auth : __classPrivateFieldGet(this, _Client_auth, "f");
|
|
1274
|
+
if (authHeaderValue !== void 0) {
|
|
1275
|
+
headers["authorization"] = `Bearer ${authHeaderValue}`;
|
|
1276
|
+
}
|
|
1277
|
+
return headers;
|
|
1278
|
+
}
|
|
1279
|
+
};
|
|
1280
|
+
_Client_auth = /* @__PURE__ */ new WeakMap(), _Client_logLevel = /* @__PURE__ */ new WeakMap(), _Client_logger = /* @__PURE__ */ new WeakMap(), _Client_prefixUrl = /* @__PURE__ */ new WeakMap(), _Client_timeoutMs = /* @__PURE__ */ new WeakMap(), _Client_notionVersion = /* @__PURE__ */ new WeakMap(), _Client_fetch = /* @__PURE__ */ new WeakMap(), _Client_agent = /* @__PURE__ */ new WeakMap(), _Client_userAgent = /* @__PURE__ */ new WeakMap();
|
|
1281
|
+
Client2.defaultNotionVersion = "2025-09-03";
|
|
1282
|
+
exports.default = Client2;
|
|
1283
|
+
}
|
|
1284
|
+
});
|
|
1285
|
+
|
|
1286
|
+
// node_modules/@notionhq/client/build/src/helpers.js
|
|
1287
|
+
var require_helpers = __commonJS({
|
|
1288
|
+
"node_modules/@notionhq/client/build/src/helpers.js"(exports) {
|
|
1289
|
+
"use strict";
|
|
1290
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1291
|
+
exports.iteratePaginatedAPI = iteratePaginatedAPI;
|
|
1292
|
+
exports.collectPaginatedAPI = collectPaginatedAPI;
|
|
1293
|
+
exports.iterateDataSourceTemplates = iterateDataSourceTemplates;
|
|
1294
|
+
exports.collectDataSourceTemplates = collectDataSourceTemplates;
|
|
1295
|
+
exports.isFullBlock = isFullBlock;
|
|
1296
|
+
exports.isFullPage = isFullPage;
|
|
1297
|
+
exports.isFullDataSource = isFullDataSource;
|
|
1298
|
+
exports.isFullDatabase = isFullDatabase;
|
|
1299
|
+
exports.isFullPageOrDataSource = isFullPageOrDataSource;
|
|
1300
|
+
exports.isFullUser = isFullUser;
|
|
1301
|
+
exports.isFullComment = isFullComment;
|
|
1302
|
+
exports.isTextRichTextItemResponse = isTextRichTextItemResponse;
|
|
1303
|
+
exports.isEquationRichTextItemResponse = isEquationRichTextItemResponse;
|
|
1304
|
+
exports.isMentionRichTextItemResponse = isMentionRichTextItemResponse;
|
|
1305
|
+
exports.extractNotionId = extractNotionId;
|
|
1306
|
+
exports.extractDatabaseId = extractDatabaseId;
|
|
1307
|
+
exports.extractPageId = extractPageId;
|
|
1308
|
+
exports.extractBlockId = extractBlockId;
|
|
1309
|
+
async function* iteratePaginatedAPI(listFn, firstPageArgs) {
|
|
1310
|
+
let nextCursor = firstPageArgs.start_cursor;
|
|
1311
|
+
do {
|
|
1312
|
+
const response = await listFn({
|
|
1313
|
+
...firstPageArgs,
|
|
1314
|
+
start_cursor: nextCursor
|
|
1315
|
+
});
|
|
1316
|
+
yield* response.results;
|
|
1317
|
+
nextCursor = response.next_cursor;
|
|
1318
|
+
} while (nextCursor);
|
|
1319
|
+
}
|
|
1320
|
+
async function collectPaginatedAPI(listFn, firstPageArgs) {
|
|
1321
|
+
const results = [];
|
|
1322
|
+
for await (const item of iteratePaginatedAPI(listFn, firstPageArgs)) {
|
|
1323
|
+
results.push(item);
|
|
1324
|
+
}
|
|
1325
|
+
return results;
|
|
1326
|
+
}
|
|
1327
|
+
async function* iterateDataSourceTemplates(client, args) {
|
|
1328
|
+
let nextCursor = args.start_cursor;
|
|
1329
|
+
do {
|
|
1330
|
+
const response = await client.dataSources.listTemplates({
|
|
1331
|
+
...args,
|
|
1332
|
+
start_cursor: nextCursor
|
|
1333
|
+
});
|
|
1334
|
+
yield* response.templates;
|
|
1335
|
+
nextCursor = response.next_cursor;
|
|
1336
|
+
} while (nextCursor);
|
|
1337
|
+
}
|
|
1338
|
+
async function collectDataSourceTemplates(client, args) {
|
|
1339
|
+
const results = [];
|
|
1340
|
+
for await (const template of iterateDataSourceTemplates(client, args)) {
|
|
1341
|
+
results.push(template);
|
|
1342
|
+
}
|
|
1343
|
+
return results;
|
|
1344
|
+
}
|
|
1345
|
+
function isFullBlock(response) {
|
|
1346
|
+
return response.object === "block" && "type" in response;
|
|
1347
|
+
}
|
|
1348
|
+
function isFullPage(response) {
|
|
1349
|
+
return response.object === "page" && "url" in response;
|
|
1350
|
+
}
|
|
1351
|
+
function isFullDataSource(response) {
|
|
1352
|
+
return response.object === "data_source";
|
|
1353
|
+
}
|
|
1354
|
+
function isFullDatabase(response) {
|
|
1355
|
+
return response.object === "database";
|
|
1356
|
+
}
|
|
1357
|
+
function isFullPageOrDataSource(response) {
|
|
1358
|
+
if (response.object === "data_source") {
|
|
1359
|
+
return isFullDataSource(response);
|
|
1360
|
+
} else {
|
|
1361
|
+
return isFullPage(response);
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
function isFullUser(response) {
|
|
1365
|
+
return "type" in response;
|
|
1366
|
+
}
|
|
1367
|
+
function isFullComment(response) {
|
|
1368
|
+
return "created_by" in response;
|
|
1369
|
+
}
|
|
1370
|
+
function isTextRichTextItemResponse(richText) {
|
|
1371
|
+
return richText.type === "text";
|
|
1372
|
+
}
|
|
1373
|
+
function isEquationRichTextItemResponse(richText) {
|
|
1374
|
+
return richText.type === "equation";
|
|
1375
|
+
}
|
|
1376
|
+
function isMentionRichTextItemResponse(richText) {
|
|
1377
|
+
return richText.type === "mention";
|
|
1378
|
+
}
|
|
1379
|
+
function extractNotionId(urlOrId) {
|
|
1380
|
+
if (!urlOrId || typeof urlOrId !== "string") {
|
|
1381
|
+
return null;
|
|
1382
|
+
}
|
|
1383
|
+
const trimmed = urlOrId.trim();
|
|
1384
|
+
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
1385
|
+
if (uuidRegex.test(trimmed)) {
|
|
1386
|
+
return trimmed.toLowerCase();
|
|
1387
|
+
}
|
|
1388
|
+
const compactUuidRegex = /^[0-9a-f]{32}$/i;
|
|
1389
|
+
if (compactUuidRegex.test(trimmed)) {
|
|
1390
|
+
return formatUuid(trimmed);
|
|
1391
|
+
}
|
|
1392
|
+
const pathMatch = trimmed.match(/\/[^/?#]*-([0-9a-f]{32})(?:[/?#]|$)/i);
|
|
1393
|
+
if (pathMatch && pathMatch[1]) {
|
|
1394
|
+
return formatUuid(pathMatch[1]);
|
|
1395
|
+
}
|
|
1396
|
+
const queryMatch = trimmed.match(/[?&](?:p|page_id|database_id)=([0-9a-f]{32})/i);
|
|
1397
|
+
if (queryMatch && queryMatch[1]) {
|
|
1398
|
+
return formatUuid(queryMatch[1]);
|
|
1399
|
+
}
|
|
1400
|
+
const anyMatch = trimmed.match(/([0-9a-f]{32})/i);
|
|
1401
|
+
if (anyMatch && anyMatch[1]) {
|
|
1402
|
+
return formatUuid(anyMatch[1]);
|
|
1403
|
+
}
|
|
1404
|
+
return null;
|
|
1405
|
+
}
|
|
1406
|
+
function formatUuid(compactId) {
|
|
1407
|
+
const clean = compactId.toLowerCase();
|
|
1408
|
+
return `${clean.slice(0, 8)}-${clean.slice(8, 12)}-${clean.slice(12, 16)}-${clean.slice(16, 20)}-${clean.slice(20, 32)}`;
|
|
1409
|
+
}
|
|
1410
|
+
function extractDatabaseId(databaseUrl) {
|
|
1411
|
+
return extractNotionId(databaseUrl);
|
|
1412
|
+
}
|
|
1413
|
+
function extractPageId(pageUrl) {
|
|
1414
|
+
return extractNotionId(pageUrl);
|
|
1415
|
+
}
|
|
1416
|
+
function extractBlockId(urlWithBlock) {
|
|
1417
|
+
if (!urlWithBlock || typeof urlWithBlock !== "string") {
|
|
1418
|
+
return null;
|
|
1419
|
+
}
|
|
1420
|
+
const blockMatch = urlWithBlock.match(/#(?:block-)?([0-9a-f]{32})/i);
|
|
1421
|
+
if (blockMatch && blockMatch[1]) {
|
|
1422
|
+
return formatUuid(blockMatch[1]);
|
|
1423
|
+
}
|
|
1424
|
+
return null;
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
});
|
|
1428
|
+
|
|
1429
|
+
// node_modules/@notionhq/client/build/src/index.js
|
|
1430
|
+
var require_src = __commonJS({
|
|
1431
|
+
"node_modules/@notionhq/client/build/src/index.js"(exports) {
|
|
1432
|
+
"use strict";
|
|
1433
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1434
|
+
exports.extractBlockId = exports.extractPageId = exports.extractDatabaseId = exports.extractNotionId = exports.isFullPageOrDataSource = exports.isFullComment = exports.isFullUser = exports.isFullPage = exports.isFullDatabase = exports.isFullDataSource = exports.isFullBlock = exports.iterateDataSourceTemplates = exports.collectDataSourceTemplates = exports.iteratePaginatedAPI = exports.collectPaginatedAPI = exports.isNotionClientError = exports.InvalidPathParameterError = exports.RequestTimeoutError = exports.UnknownHTTPResponseError = exports.APIResponseError = exports.ClientErrorCode = exports.APIErrorCode = exports.LogLevel = exports.Client = void 0;
|
|
1435
|
+
var Client_1 = require_Client();
|
|
1436
|
+
Object.defineProperty(exports, "Client", { enumerable: true, get: function() {
|
|
1437
|
+
return Client_1.default;
|
|
1438
|
+
} });
|
|
1439
|
+
var logging_1 = require_logging();
|
|
1440
|
+
Object.defineProperty(exports, "LogLevel", { enumerable: true, get: function() {
|
|
1441
|
+
return logging_1.LogLevel;
|
|
1442
|
+
} });
|
|
1443
|
+
var errors_1 = require_errors();
|
|
1444
|
+
Object.defineProperty(exports, "APIErrorCode", { enumerable: true, get: function() {
|
|
1445
|
+
return errors_1.APIErrorCode;
|
|
1446
|
+
} });
|
|
1447
|
+
Object.defineProperty(exports, "ClientErrorCode", { enumerable: true, get: function() {
|
|
1448
|
+
return errors_1.ClientErrorCode;
|
|
1449
|
+
} });
|
|
1450
|
+
Object.defineProperty(exports, "APIResponseError", { enumerable: true, get: function() {
|
|
1451
|
+
return errors_1.APIResponseError;
|
|
1452
|
+
} });
|
|
1453
|
+
Object.defineProperty(exports, "UnknownHTTPResponseError", { enumerable: true, get: function() {
|
|
1454
|
+
return errors_1.UnknownHTTPResponseError;
|
|
1455
|
+
} });
|
|
1456
|
+
Object.defineProperty(exports, "RequestTimeoutError", { enumerable: true, get: function() {
|
|
1457
|
+
return errors_1.RequestTimeoutError;
|
|
1458
|
+
} });
|
|
1459
|
+
Object.defineProperty(exports, "InvalidPathParameterError", { enumerable: true, get: function() {
|
|
1460
|
+
return errors_1.InvalidPathParameterError;
|
|
1461
|
+
} });
|
|
1462
|
+
Object.defineProperty(exports, "isNotionClientError", { enumerable: true, get: function() {
|
|
1463
|
+
return errors_1.isNotionClientError;
|
|
1464
|
+
} });
|
|
1465
|
+
var helpers_1 = require_helpers();
|
|
1466
|
+
Object.defineProperty(exports, "collectPaginatedAPI", { enumerable: true, get: function() {
|
|
1467
|
+
return helpers_1.collectPaginatedAPI;
|
|
1468
|
+
} });
|
|
1469
|
+
Object.defineProperty(exports, "iteratePaginatedAPI", { enumerable: true, get: function() {
|
|
1470
|
+
return helpers_1.iteratePaginatedAPI;
|
|
1471
|
+
} });
|
|
1472
|
+
Object.defineProperty(exports, "collectDataSourceTemplates", { enumerable: true, get: function() {
|
|
1473
|
+
return helpers_1.collectDataSourceTemplates;
|
|
1474
|
+
} });
|
|
1475
|
+
Object.defineProperty(exports, "iterateDataSourceTemplates", { enumerable: true, get: function() {
|
|
1476
|
+
return helpers_1.iterateDataSourceTemplates;
|
|
1477
|
+
} });
|
|
1478
|
+
Object.defineProperty(exports, "isFullBlock", { enumerable: true, get: function() {
|
|
1479
|
+
return helpers_1.isFullBlock;
|
|
1480
|
+
} });
|
|
1481
|
+
Object.defineProperty(exports, "isFullDataSource", { enumerable: true, get: function() {
|
|
1482
|
+
return helpers_1.isFullDataSource;
|
|
1483
|
+
} });
|
|
1484
|
+
Object.defineProperty(exports, "isFullDatabase", { enumerable: true, get: function() {
|
|
1485
|
+
return helpers_1.isFullDatabase;
|
|
1486
|
+
} });
|
|
1487
|
+
Object.defineProperty(exports, "isFullPage", { enumerable: true, get: function() {
|
|
1488
|
+
return helpers_1.isFullPage;
|
|
1489
|
+
} });
|
|
1490
|
+
Object.defineProperty(exports, "isFullUser", { enumerable: true, get: function() {
|
|
1491
|
+
return helpers_1.isFullUser;
|
|
1492
|
+
} });
|
|
1493
|
+
Object.defineProperty(exports, "isFullComment", { enumerable: true, get: function() {
|
|
1494
|
+
return helpers_1.isFullComment;
|
|
1495
|
+
} });
|
|
1496
|
+
Object.defineProperty(exports, "isFullPageOrDataSource", { enumerable: true, get: function() {
|
|
1497
|
+
return helpers_1.isFullPageOrDataSource;
|
|
1498
|
+
} });
|
|
1499
|
+
Object.defineProperty(exports, "extractNotionId", { enumerable: true, get: function() {
|
|
1500
|
+
return helpers_1.extractNotionId;
|
|
1501
|
+
} });
|
|
1502
|
+
Object.defineProperty(exports, "extractDatabaseId", { enumerable: true, get: function() {
|
|
1503
|
+
return helpers_1.extractDatabaseId;
|
|
1504
|
+
} });
|
|
1505
|
+
Object.defineProperty(exports, "extractPageId", { enumerable: true, get: function() {
|
|
1506
|
+
return helpers_1.extractPageId;
|
|
1507
|
+
} });
|
|
1508
|
+
Object.defineProperty(exports, "extractBlockId", { enumerable: true, get: function() {
|
|
1509
|
+
return helpers_1.extractBlockId;
|
|
1510
|
+
} });
|
|
1511
|
+
}
|
|
1512
|
+
});
|
|
1513
|
+
|
|
1514
|
+
// src/integrations/notion/client.ts
|
|
1515
|
+
var client_exports = {};
|
|
1516
|
+
__export(client_exports, {
|
|
1517
|
+
Client: () => import_client.Client,
|
|
1518
|
+
getNotionClient: () => getNotionClient,
|
|
1519
|
+
getRootPageId: () => getRootPageId,
|
|
1520
|
+
initNotionClient: () => initNotionClient,
|
|
1521
|
+
isNotionInitialized: () => isNotionInitialized,
|
|
1522
|
+
resetNotionClient: () => resetNotionClient
|
|
1523
|
+
});
|
|
1524
|
+
function initNotionClient(config) {
|
|
1525
|
+
notionClient = new import_client.Client({
|
|
1526
|
+
auth: config.apiKey
|
|
1527
|
+
});
|
|
1528
|
+
rootPageId = config.rootPageId || null;
|
|
1529
|
+
return notionClient;
|
|
1530
|
+
}
|
|
1531
|
+
function getNotionClient() {
|
|
1532
|
+
if (!notionClient) {
|
|
1533
|
+
throw new Error(
|
|
1534
|
+
"Notion client not initialized. Call initNotionClient() first."
|
|
1535
|
+
);
|
|
1536
|
+
}
|
|
1537
|
+
return notionClient;
|
|
1538
|
+
}
|
|
1539
|
+
function getRootPageId() {
|
|
1540
|
+
return rootPageId;
|
|
1541
|
+
}
|
|
1542
|
+
function isNotionInitialized() {
|
|
1543
|
+
return notionClient !== null;
|
|
1544
|
+
}
|
|
1545
|
+
function resetNotionClient() {
|
|
1546
|
+
notionClient = null;
|
|
1547
|
+
rootPageId = null;
|
|
1548
|
+
}
|
|
1549
|
+
var import_client, notionClient, rootPageId;
|
|
1550
|
+
var init_client = __esm({
|
|
1551
|
+
"src/integrations/notion/client.ts"() {
|
|
1552
|
+
import_client = __toESM(require_src(), 1);
|
|
1553
|
+
notionClient = null;
|
|
1554
|
+
rootPageId = null;
|
|
1555
|
+
}
|
|
1556
|
+
});
|
|
1557
|
+
|
|
1558
|
+
export {
|
|
1559
|
+
import_client,
|
|
1560
|
+
initNotionClient,
|
|
1561
|
+
getNotionClient,
|
|
1562
|
+
getRootPageId,
|
|
1563
|
+
isNotionInitialized,
|
|
1564
|
+
resetNotionClient,
|
|
1565
|
+
client_exports,
|
|
1566
|
+
init_client
|
|
1567
|
+
};
|
|
1568
|
+
//# sourceMappingURL=chunk-VRD5CYRL.js.map
|