@wirecat/notion-cli 0.0.0-stage → 0.2.0

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.
Files changed (262) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/LICENSE +204 -0
  3. package/README.md +42 -2
  4. package/contracts/wirecat.json +1964 -0
  5. package/dist/bin/notion.d.ts +3 -0
  6. package/dist/bin/notion.d.ts.map +1 -0
  7. package/dist/bin/notion.js +40 -0
  8. package/dist/bin/notion.js.map +1 -0
  9. package/dist/bundle/all-profiles-JGYLQZ5C.js +278 -0
  10. package/dist/bundle/anthropic-S2VSMIKQ.js +91 -0
  11. package/dist/bundle/app-server-SASYDBCA.js +240 -0
  12. package/dist/bundle/bun-LU5LP3JI.js +169 -0
  13. package/dist/bundle/bun-sqlite-JBSINB4O.js +76 -0
  14. package/dist/bundle/chunk-22QQUKWA.js +53 -0
  15. package/dist/bundle/chunk-2F4QQ7WB.js +73 -0
  16. package/dist/bundle/chunk-2F6VO5HA.js +73 -0
  17. package/dist/bundle/chunk-2LWO3PDX.js +726 -0
  18. package/dist/bundle/chunk-3AL7QUS3.js +2778 -0
  19. package/dist/bundle/chunk-3Z4YTSRY.js +731 -0
  20. package/dist/bundle/chunk-4HWJOU7N.js +38 -0
  21. package/dist/bundle/chunk-4IPURN72.js +1221 -0
  22. package/dist/bundle/chunk-4ZTVJHWU.js +206 -0
  23. package/dist/bundle/chunk-5D4AEUVA.js +24783 -0
  24. package/dist/bundle/chunk-5IYKVRH2.js +44811 -0
  25. package/dist/bundle/chunk-5NFK5EM2.js +362 -0
  26. package/dist/bundle/chunk-5QIQEUOG.js +188 -0
  27. package/dist/bundle/chunk-5RDNBG7D.js +72 -0
  28. package/dist/bundle/chunk-5RSC54NA.js +1328 -0
  29. package/dist/bundle/chunk-6EVKHZKN.js +158 -0
  30. package/dist/bundle/chunk-6RA3EABS.js +4012 -0
  31. package/dist/bundle/chunk-AOCUKEAX.js +131 -0
  32. package/dist/bundle/chunk-B26TQZKZ.js +217 -0
  33. package/dist/bundle/chunk-B7ON6KPT.js +1197 -0
  34. package/dist/bundle/chunk-BNPTZ5ZB.js +161 -0
  35. package/dist/bundle/chunk-D72URWJE.js +532 -0
  36. package/dist/bundle/chunk-D7QSEEYW.js +274 -0
  37. package/dist/bundle/chunk-DFDN6AUB.js +21 -0
  38. package/dist/bundle/chunk-DH5PRHT4.js +392 -0
  39. package/dist/bundle/chunk-EH6ZEJGT.js +932 -0
  40. package/dist/bundle/chunk-EUIVXFLJ.js +259 -0
  41. package/dist/bundle/chunk-FPY6EJ7B.js +9568 -0
  42. package/dist/bundle/chunk-FT3LN3HP.js +6848 -0
  43. package/dist/bundle/chunk-FWVBPRL4.js +4436 -0
  44. package/dist/bundle/chunk-FXEJY4OL.js +12538 -0
  45. package/dist/bundle/chunk-G3EZFRSS.js +1297 -0
  46. package/dist/bundle/chunk-GZOUFX3C.js +230 -0
  47. package/dist/bundle/chunk-HL52XXZX.js +78 -0
  48. package/dist/bundle/chunk-KCLOUUYF.js +100 -0
  49. package/dist/bundle/chunk-KFVDL2QS.js +146 -0
  50. package/dist/bundle/chunk-KGERXYTV.js +24 -0
  51. package/dist/bundle/chunk-KM6WHPHI.js +288 -0
  52. package/dist/bundle/chunk-LAYPFBOM.js +95 -0
  53. package/dist/bundle/chunk-LLG2POQ7.js +170 -0
  54. package/dist/bundle/chunk-M3KB25D3.js +1392 -0
  55. package/dist/bundle/chunk-M7S2NDWB.js +76 -0
  56. package/dist/bundle/chunk-MGUEZYFA.js +5546 -0
  57. package/dist/bundle/chunk-MY742GAD.js +1977 -0
  58. package/dist/bundle/chunk-MZU2YFBZ.js +823 -0
  59. package/dist/bundle/chunk-NOQ7B5N7.js +58 -0
  60. package/dist/bundle/chunk-NQWV4WQO.js +300 -0
  61. package/dist/bundle/chunk-ODBZNSZ6.js +1028 -0
  62. package/dist/bundle/chunk-OTV53F34.js +370 -0
  63. package/dist/bundle/chunk-P7CUM5IB.js +18 -0
  64. package/dist/bundle/chunk-RV64YUQX.js +185 -0
  65. package/dist/bundle/chunk-SHJQ6JKG.js +106 -0
  66. package/dist/bundle/chunk-SWAOWNKW.js +52 -0
  67. package/dist/bundle/chunk-SZOVLP44.js +29 -0
  68. package/dist/bundle/chunk-TPX2M45D.js +385 -0
  69. package/dist/bundle/chunk-TSDBSIFM.js +66 -0
  70. package/dist/bundle/chunk-VBHETQVV.js +64146 -0
  71. package/dist/bundle/chunk-VCIALTEM.js +3139 -0
  72. package/dist/bundle/chunk-VKE77B3F.js +2 -0
  73. package/dist/bundle/chunk-WCSOH4JS.js +142 -0
  74. package/dist/bundle/chunk-WF4D56CA.js +54 -0
  75. package/dist/bundle/chunk-WJHZMR2W.js +335 -0
  76. package/dist/bundle/chunk-X4TIMMKJ.js +16 -0
  77. package/dist/bundle/chunk-XF26XKTS.js +82 -0
  78. package/dist/bundle/chunk-XFLCVHSQ.js +50 -0
  79. package/dist/bundle/chunk-XQUUANA2.js +24600 -0
  80. package/dist/bundle/chunk-XYIT2XB3.js +1372 -0
  81. package/dist/bundle/chunk-Y5E2WNWB.js +35 -0
  82. package/dist/bundle/chunk-YMYUBZWT.js +1068 -0
  83. package/dist/bundle/chunk-YNTLT3Z3.js +2310 -0
  84. package/dist/bundle/chunk-YVI5SQPY.js +46 -0
  85. package/dist/bundle/chunk-Z56QFOBR.js +63 -0
  86. package/dist/bundle/chunk-ZKAEZXUP.js +787 -0
  87. package/dist/bundle/chunk-ZVVMGPBJ.js +50 -0
  88. package/dist/bundle/chunk-ZZ32DXTH.js +23 -0
  89. package/dist/bundle/command-contract-JS5V27NX.js +38 -0
  90. package/dist/bundle/command-server-entry-UFSG7KRO.js +167 -0
  91. package/dist/bundle/decode-7LLWTSPT.js +297 -0
  92. package/dist/bundle/definitions-M3U4UYHN.js +45607 -0
  93. package/dist/bundle/dispatch-2GY6JIJH.js +411 -0
  94. package/dist/bundle/dist-ILNOLGYN.js +7577 -0
  95. package/dist/bundle/echarts-BXX4OQWC.js +42501 -0
  96. package/dist/bundle/embed-JXFNBTKH.js +38 -0
  97. package/dist/bundle/embedder-57YZ44KO.js +111 -0
  98. package/dist/bundle/failure-MYT4HPE3.js +25 -0
  99. package/dist/bundle/first-run-3PF7T74J.js +29 -0
  100. package/dist/bundle/first-screen-7BEROEQR.js +36 -0
  101. package/dist/bundle/instructions-2VECIDXF.js +11 -0
  102. package/dist/bundle/mcp-O6ACR2DX.js +167 -0
  103. package/dist/bundle/mdast-util-from-markdown-R66F4HZA.js +1958 -0
  104. package/dist/bundle/mdast-util-gfm-LN2ELINH.js +2699 -0
  105. package/dist/bundle/meeting-combined-PPUQ3KBR.js +24 -0
  106. package/dist/bundle/meeting-model-ZNMYKMCD.js +26 -0
  107. package/dist/bundle/meeting-semantic-ETN3A4BJ.js +22 -0
  108. package/dist/bundle/micromark-extension-gfm-5X7YT43T.js +1838 -0
  109. package/dist/bundle/node-KM3CUABH.js +2340 -0
  110. package/dist/bundle/node-MPEQSFI3.js +176 -0
  111. package/dist/bundle/node-TLZSIHIJ.js +21 -0
  112. package/dist/bundle/node-sqlite-WA32MYSJ.js +74 -0
  113. package/dist/bundle/notion.js +185 -0
  114. package/dist/bundle/oauth-IAFZG3IR.js +20 -0
  115. package/dist/bundle/open-M3JQUC5G.js +23 -0
  116. package/dist/bundle/openai-HXUEHUSD.js +240 -0
  117. package/dist/bundle/process-F6TKXWWA.js +91 -0
  118. package/dist/bundle/program-Y7JAB6TG.js +33219 -0
  119. package/dist/bundle/prompt-IMUQLZD2.js +17 -0
  120. package/dist/bundle/recognize-2MZAYHAA.js +26 -0
  121. package/dist/bundle/remote-OV4LB6VR.js +32 -0
  122. package/dist/bundle/rerank-ZIULUS34.js +52 -0
  123. package/dist/bundle/schemas-DIVZS6TU.js +12214 -0
  124. package/dist/bundle/serve-YU7QBP6L.js +199 -0
  125. package/dist/bundle/server-FKQET4ZO.js +71 -0
  126. package/dist/bundle/server-LGMNONSB.js +202 -0
  127. package/dist/bundle/services-5WY4DCPJ.js +581 -0
  128. package/dist/bundle/sqlite-runtime-5MXZDETH.js +20 -0
  129. package/dist/bundle/state-LWMZH2KI.js +36 -0
  130. package/dist/bundle/store-EPZYV4VW.js +168 -0
  131. package/dist/bundle/store-QE6FEIZD.js +286 -0
  132. package/dist/bundle/store-maintenance-command-ZUUUFCHL.js +62 -0
  133. package/dist/commands/api.d.ts +4 -0
  134. package/dist/commands/api.d.ts.map +1 -0
  135. package/dist/commands/api.js +140 -0
  136. package/dist/commands/api.js.map +1 -0
  137. package/dist/commands/databases.d.ts +3 -0
  138. package/dist/commands/databases.d.ts.map +1 -0
  139. package/dist/commands/databases.js +65 -0
  140. package/dist/commands/databases.js.map +1 -0
  141. package/dist/commands/documents.d.ts +4 -0
  142. package/dist/commands/documents.d.ts.map +1 -0
  143. package/dist/commands/documents.js +41 -0
  144. package/dist/commands/documents.js.map +1 -0
  145. package/dist/commands/library.d.ts +10 -0
  146. package/dist/commands/library.d.ts.map +1 -0
  147. package/dist/commands/library.js +468 -0
  148. package/dist/commands/library.js.map +1 -0
  149. package/dist/commands/session.d.ts +3 -0
  150. package/dist/commands/session.d.ts.map +1 -0
  151. package/dist/commands/session.js +105 -0
  152. package/dist/commands/session.js.map +1 -0
  153. package/dist/config.d.ts +5 -0
  154. package/dist/config.d.ts.map +1 -0
  155. package/dist/config.js +13 -0
  156. package/dist/config.js.map +1 -0
  157. package/dist/context.d.ts +51 -0
  158. package/dist/context.d.ts.map +1 -0
  159. package/dist/context.js +67 -0
  160. package/dist/context.js.map +1 -0
  161. package/dist/generated/definitions.d.ts +3 -0
  162. package/dist/generated/definitions.d.ts.map +1 -0
  163. package/dist/generated/definitions.js +45603 -0
  164. package/dist/generated/definitions.js.map +1 -0
  165. package/dist/generated/manifest.d.ts +3 -0
  166. package/dist/generated/manifest.d.ts.map +1 -0
  167. package/dist/generated/manifest.js +2089 -0
  168. package/dist/generated/manifest.js.map +1 -0
  169. package/dist/generated/metadata.d.ts +6 -0
  170. package/dist/generated/metadata.d.ts.map +1 -0
  171. package/dist/generated/metadata.js +24 -0
  172. package/dist/generated/metadata.js.map +1 -0
  173. package/dist/generated/schemas.d.ts +1223 -0
  174. package/dist/generated/schemas.d.ts.map +1 -0
  175. package/dist/generated/schemas.js +11557 -0
  176. package/dist/generated/schemas.js.map +1 -0
  177. package/dist/generated/types.d.ts +11120 -0
  178. package/dist/generated/types.d.ts.map +1 -0
  179. package/dist/generated/types.js +5 -0
  180. package/dist/generated/types.js.map +1 -0
  181. package/dist/identity.d.ts +7 -0
  182. package/dist/identity.d.ts.map +1 -0
  183. package/dist/identity.js +30 -0
  184. package/dist/identity.js.map +1 -0
  185. package/dist/index.d.ts +3 -0
  186. package/dist/index.d.ts.map +1 -0
  187. package/dist/index.js +3 -0
  188. package/dist/index.js.map +1 -0
  189. package/dist/knowledge.d.ts +27 -0
  190. package/dist/knowledge.d.ts.map +1 -0
  191. package/dist/knowledge.js +87 -0
  192. package/dist/knowledge.js.map +1 -0
  193. package/dist/library.d.ts +44 -0
  194. package/dist/library.d.ts.map +1 -0
  195. package/dist/library.js +149 -0
  196. package/dist/library.js.map +1 -0
  197. package/dist/notion/client.d.ts +45 -0
  198. package/dist/notion/client.d.ts.map +1 -0
  199. package/dist/notion/client.js +121 -0
  200. package/dist/notion/client.js.map +1 -0
  201. package/dist/notion/errors.d.ts +24 -0
  202. package/dist/notion/errors.d.ts.map +1 -0
  203. package/dist/notion/errors.js +127 -0
  204. package/dist/notion/errors.js.map +1 -0
  205. package/dist/notion/ids.d.ts +7 -0
  206. package/dist/notion/ids.d.ts.map +1 -0
  207. package/dist/notion/ids.js +37 -0
  208. package/dist/notion/ids.js.map +1 -0
  209. package/dist/notion/links.d.ts +6 -0
  210. package/dist/notion/links.d.ts.map +1 -0
  211. package/dist/notion/links.js +22 -0
  212. package/dist/notion/links.js.map +1 -0
  213. package/dist/notion/notion.d.ts +95 -0
  214. package/dist/notion/notion.d.ts.map +1 -0
  215. package/dist/notion/notion.js +269 -0
  216. package/dist/notion/notion.js.map +1 -0
  217. package/dist/notion/port.d.ts +13 -0
  218. package/dist/notion/port.d.ts.map +1 -0
  219. package/dist/notion/port.js +60 -0
  220. package/dist/notion/port.js.map +1 -0
  221. package/dist/notion/read-posts.d.ts +36 -0
  222. package/dist/notion/read-posts.d.ts.map +1 -0
  223. package/dist/notion/read-posts.js +24 -0
  224. package/dist/notion/read-posts.js.map +1 -0
  225. package/dist/notion/reads.d.ts +331 -0
  226. package/dist/notion/reads.d.ts.map +1 -0
  227. package/dist/notion/reads.js +18 -0
  228. package/dist/notion/reads.js.map +1 -0
  229. package/dist/program.d.ts +6 -0
  230. package/dist/program.d.ts.map +1 -0
  231. package/dist/program.js +62 -0
  232. package/dist/program.js.map +1 -0
  233. package/dist/sync/cursor.d.ts +135 -0
  234. package/dist/sync/cursor.d.ts.map +1 -0
  235. package/dist/sync/cursor.js +113 -0
  236. package/dist/sync/cursor.js.map +1 -0
  237. package/dist/sync/files.d.ts +77 -0
  238. package/dist/sync/files.d.ts.map +1 -0
  239. package/dist/sync/files.js +12 -0
  240. package/dist/sync/files.js.map +1 -0
  241. package/dist/sync/front-matter.d.ts +10 -0
  242. package/dist/sync/front-matter.d.ts.map +1 -0
  243. package/dist/sync/front-matter.js +114 -0
  244. package/dist/sync/front-matter.js.map +1 -0
  245. package/dist/sync/markdown.d.ts +11 -0
  246. package/dist/sync/markdown.d.ts.map +1 -0
  247. package/dist/sync/markdown.js +42 -0
  248. package/dist/sync/markdown.js.map +1 -0
  249. package/dist/sync/source.d.ts +11 -0
  250. package/dist/sync/source.d.ts.map +1 -0
  251. package/dist/sync/source.js +995 -0
  252. package/dist/sync/source.js.map +1 -0
  253. package/dist/version.d.ts +2 -0
  254. package/dist/version.d.ts.map +1 -0
  255. package/dist/version.js +2 -0
  256. package/dist/version.js.map +1 -0
  257. package/dist/wcat.d.ts +3 -0
  258. package/dist/wcat.d.ts.map +1 -0
  259. package/dist/wcat.js +4 -0
  260. package/dist/wcat.js.map +1 -0
  261. package/package.json +85 -4
  262. package/skills/notion-cli/SKILL.md +45 -0
@@ -0,0 +1,3139 @@
1
+ import { createRequire as __bundleRequire } from "node:module";
2
+ const require = __bundleRequire(import.meta.url);
3
+ import {
4
+ providerWaitMs,
5
+ statusToCode
6
+ } from "./chunk-NQWV4WQO.js";
7
+ import {
8
+ defineReasons
9
+ } from "./chunk-4IPURN72.js";
10
+ import {
11
+ CliError,
12
+ isCliError
13
+ } from "./chunk-5RDNBG7D.js";
14
+ import {
15
+ __commonJS,
16
+ __name,
17
+ __toESM
18
+ } from "./chunk-ZVVMGPBJ.js";
19
+
20
+ // node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints/agent-skills.js
21
+ var require_agent_skills = __commonJS({
22
+ "node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints/agent-skills.js"(exports) {
23
+ "use strict";
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.uploadSkill = exports.getSkillDirectory = exports.getPluginDirectory = exports.listSkillsPlugins = void 0;
26
+ exports.listSkillsPlugins = {
27
+ method: "get",
28
+ pathParams: [],
29
+ queryParams: ["page_size", "start_cursor"],
30
+ bodyParams: [],
31
+ path: /* @__PURE__ */ __name(() => `ai/plugins`, "path")
32
+ };
33
+ exports.getPluginDirectory = {
34
+ method: "get",
35
+ pathParams: ["id"],
36
+ queryParams: [],
37
+ bodyParams: [],
38
+ path: /* @__PURE__ */ __name((p) => `ai/plugins/${p.id}`, "path")
39
+ };
40
+ exports.getSkillDirectory = {
41
+ method: "get",
42
+ pathParams: ["id"],
43
+ queryParams: [],
44
+ bodyParams: [],
45
+ path: /* @__PURE__ */ __name((p) => `ai/skills/${p.id}`, "path")
46
+ };
47
+ exports.uploadSkill = {
48
+ method: "post",
49
+ pathParams: ["id"],
50
+ queryParams: [],
51
+ bodyParams: [],
52
+ formDataParams: ["file"],
53
+ path: /* @__PURE__ */ __name((p) => `ai/skills/${p.id}/upload`, "path")
54
+ };
55
+ }
56
+ });
57
+
58
+ // node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints/agents.js
59
+ var require_agents = __commonJS({
60
+ "node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints/agents.js"(exports) {
61
+ "use strict";
62
+ Object.defineProperty(exports, "__esModule", { value: true });
63
+ exports.startExternalAgentStubSession = exports.sendExternalAgentStubSessionMessage = exports.queryThreads = exports.queryThreadMessages = exports.listThreads = exports.sendThreadMessage = exports.listThreadMessages = exports.listExternalAgentStubSessionEvents = exports.listAgents = exports.updateExternalAgentStubVault = exports.deleteExternalAgentStubVault = exports.createExternalAgentStubVault = exports.continueThread = exports.chatWithAgent = exports.cancelSession = exports.querySessionEvents = exports.querySessions = exports.retrieveSession = exports.updateSession = exports.agentBatch = exports.updateAgentCreditLimit = exports.updateAgentStatus = exports.getInsights = exports.deleteAgent = exports.getAgent = exports.queryAgents = exports.updateSessionStream = void 0;
64
+ exports.updateSessionStream = {
65
+ method: "post",
66
+ pathParams: [],
67
+ queryParams: [],
68
+ bodyParams: [
69
+ "message",
70
+ "agent_id",
71
+ "session_id",
72
+ "attachments",
73
+ "metadata",
74
+ "prompt_context",
75
+ "actions",
76
+ "continue_from"
77
+ ],
78
+ headers: { Accept: "text/event-stream" },
79
+ path: /* @__PURE__ */ __name(() => `sessions`, "path")
80
+ };
81
+ exports.queryAgents = {
82
+ method: "post",
83
+ pathParams: [],
84
+ queryParams: [],
85
+ bodyParams: [
86
+ "query",
87
+ "filter",
88
+ "sorts",
89
+ "start_cursor",
90
+ "page_size",
91
+ "verbose",
92
+ "include_deleted"
93
+ ],
94
+ path: /* @__PURE__ */ __name(() => `agents/query`, "path")
95
+ };
96
+ exports.getAgent = {
97
+ method: "get",
98
+ pathParams: ["agent_id"],
99
+ queryParams: ["verbose"],
100
+ bodyParams: [],
101
+ path: /* @__PURE__ */ __name((p) => `agents/${p.agent_id}`, "path")
102
+ };
103
+ exports.deleteAgent = {
104
+ method: "delete",
105
+ pathParams: ["agent_id"],
106
+ queryParams: [],
107
+ bodyParams: [],
108
+ path: /* @__PURE__ */ __name((p) => `agents/${p.agent_id}`, "path")
109
+ };
110
+ exports.getInsights = {
111
+ method: "get",
112
+ pathParams: ["agent_id"],
113
+ queryParams: ["start_time", "end_time"],
114
+ bodyParams: [],
115
+ path: /* @__PURE__ */ __name((p) => `agents/${p.agent_id}/insights`, "path")
116
+ };
117
+ exports.updateAgentStatus = {
118
+ method: "patch",
119
+ pathParams: ["agent_id"],
120
+ queryParams: [],
121
+ bodyParams: ["status"],
122
+ path: /* @__PURE__ */ __name((p) => `agents/${p.agent_id}/status`, "path")
123
+ };
124
+ exports.updateAgentCreditLimit = {
125
+ method: "patch",
126
+ pathParams: ["agent_id"],
127
+ queryParams: [],
128
+ bodyParams: ["credit_limit"],
129
+ path: /* @__PURE__ */ __name((p) => `agents/${p.agent_id}/credit_limit`, "path")
130
+ };
131
+ exports.agentBatch = {
132
+ method: "post",
133
+ pathParams: [],
134
+ queryParams: [],
135
+ bodyParams: ["operations"],
136
+ path: /* @__PURE__ */ __name(() => `agents/batch`, "path")
137
+ };
138
+ exports.updateSession = {
139
+ method: "post",
140
+ pathParams: [],
141
+ queryParams: [],
142
+ bodyParams: [
143
+ "message",
144
+ "agent_id",
145
+ "session_id",
146
+ "attachments",
147
+ "metadata",
148
+ "prompt_context",
149
+ "actions",
150
+ "continue_from"
151
+ ],
152
+ path: /* @__PURE__ */ __name(() => `sessions`, "path")
153
+ };
154
+ exports.retrieveSession = {
155
+ method: "get",
156
+ pathParams: ["session_id"],
157
+ queryParams: [],
158
+ bodyParams: [],
159
+ path: /* @__PURE__ */ __name((p) => `sessions/${p.session_id}`, "path")
160
+ };
161
+ exports.querySessions = {
162
+ method: "post",
163
+ pathParams: [],
164
+ queryParams: [],
165
+ bodyParams: ["query", "filter", "sorts", "start_cursor", "page_size"],
166
+ path: /* @__PURE__ */ __name(() => `sessions/query`, "path")
167
+ };
168
+ exports.querySessionEvents = {
169
+ method: "post",
170
+ pathParams: ["session_id"],
171
+ queryParams: [],
172
+ bodyParams: ["filter", "sorts", "start_cursor", "page_size"],
173
+ path: /* @__PURE__ */ __name((p) => `sessions/${p.session_id}/events/query`, "path")
174
+ };
175
+ exports.cancelSession = {
176
+ method: "post",
177
+ pathParams: ["session_id"],
178
+ queryParams: [],
179
+ bodyParams: ["event_id"],
180
+ path: /* @__PURE__ */ __name((p) => `sessions/${p.session_id}/cancel`, "path")
181
+ };
182
+ exports.chatWithAgent = {
183
+ method: "post",
184
+ pathParams: ["agent_id"],
185
+ queryParams: ["verbose"],
186
+ bodyParams: [
187
+ "message",
188
+ "attachments",
189
+ "metadata",
190
+ "prompt_context",
191
+ "thread_id"
192
+ ],
193
+ path: /* @__PURE__ */ __name((p) => `agents/${p.agent_id}/chat`, "path")
194
+ };
195
+ exports.continueThread = {
196
+ method: "post",
197
+ pathParams: ["thread_id"],
198
+ queryParams: [],
199
+ bodyParams: ["action_id", "option_id", "input"],
200
+ path: /* @__PURE__ */ __name((p) => `threads/${p.thread_id}/continue`, "path")
201
+ };
202
+ exports.createExternalAgentStubVault = {
203
+ method: "post",
204
+ pathParams: ["agent_id"],
205
+ queryParams: [],
206
+ bodyParams: ["name", "credential", "target"],
207
+ path: /* @__PURE__ */ __name((p) => `external_agent_stub/${p.agent_id}/vaults`, "path")
208
+ };
209
+ exports.deleteExternalAgentStubVault = {
210
+ method: "delete",
211
+ pathParams: ["agent_id", "vault_id"],
212
+ queryParams: [],
213
+ bodyParams: [],
214
+ path: /* @__PURE__ */ __name((p) => `external_agent_stub/${p.agent_id}/vaults/${p.vault_id}`, "path")
215
+ };
216
+ exports.updateExternalAgentStubVault = {
217
+ method: "patch",
218
+ pathParams: ["agent_id", "vault_id"],
219
+ queryParams: [],
220
+ bodyParams: ["expected_version", "credential"],
221
+ path: /* @__PURE__ */ __name((p) => `external_agent_stub/${p.agent_id}/vaults/${p.vault_id}`, "path")
222
+ };
223
+ exports.listAgents = {
224
+ method: "get",
225
+ pathParams: [],
226
+ queryParams: [
227
+ "name",
228
+ "agent_type",
229
+ "agent_ids",
230
+ "created_by",
231
+ "start_cursor",
232
+ "page_size",
233
+ "verbose"
234
+ ],
235
+ bodyParams: [],
236
+ path: /* @__PURE__ */ __name(() => `agents`, "path")
237
+ };
238
+ exports.listExternalAgentStubSessionEvents = {
239
+ method: "get",
240
+ pathParams: ["agent_id", "session_id"],
241
+ queryParams: ["cursor"],
242
+ bodyParams: [],
243
+ path: /* @__PURE__ */ __name((p) => `external_agent_stub/${p.agent_id}/sessions/${p.session_id}/events`, "path")
244
+ };
245
+ exports.listThreadMessages = {
246
+ method: "get",
247
+ pathParams: ["thread_id"],
248
+ queryParams: ["verbose", "role", "start_cursor", "page_size"],
249
+ bodyParams: [],
250
+ path: /* @__PURE__ */ __name((p) => `threads/${p.thread_id}/messages`, "path")
251
+ };
252
+ exports.sendThreadMessage = {
253
+ method: "post",
254
+ pathParams: ["thread_id"],
255
+ queryParams: [],
256
+ bodyParams: ["message", "attachments", "metadata", "prompt_context"],
257
+ path: /* @__PURE__ */ __name((p) => `threads/${p.thread_id}/messages`, "path")
258
+ };
259
+ exports.listThreads = {
260
+ method: "get",
261
+ pathParams: ["agent_id"],
262
+ queryParams: [
263
+ "id",
264
+ "title",
265
+ "status",
266
+ "activity",
267
+ "created_by",
268
+ "last_used_by",
269
+ "sort_by",
270
+ "sort_direction",
271
+ "start_cursor",
272
+ "page_size"
273
+ ],
274
+ bodyParams: [],
275
+ path: /* @__PURE__ */ __name((p) => `agents/${p.agent_id}/threads`, "path")
276
+ };
277
+ exports.queryThreadMessages = {
278
+ method: "post",
279
+ pathParams: ["thread_id"],
280
+ queryParams: [],
281
+ bodyParams: ["verbose", "start_cursor", "page_size"],
282
+ path: /* @__PURE__ */ __name((p) => `threads/${p.thread_id}/messages/query`, "path")
283
+ };
284
+ exports.queryThreads = {
285
+ method: "post",
286
+ pathParams: ["agent_id"],
287
+ queryParams: [],
288
+ bodyParams: ["query", "filter", "sorts", "start_cursor", "page_size"],
289
+ path: /* @__PURE__ */ __name((p) => `agents/${p.agent_id}/threads/query`, "path")
290
+ };
291
+ exports.sendExternalAgentStubSessionMessage = {
292
+ method: "post",
293
+ pathParams: ["agent_id", "session_id"],
294
+ queryParams: [],
295
+ bodyParams: ["message", "client_message_id"],
296
+ path: /* @__PURE__ */ __name((p) => `external_agent_stub/${p.agent_id}/sessions/${p.session_id}/messages`, "path")
297
+ };
298
+ exports.startExternalAgentStubSession = {
299
+ method: "post",
300
+ pathParams: ["agent_id"],
301
+ queryParams: [],
302
+ bodyParams: [
303
+ "spec_version",
304
+ "client_reference_id",
305
+ "configs",
306
+ "model",
307
+ "cwd",
308
+ "locale",
309
+ "system_prompt"
310
+ ],
311
+ path: /* @__PURE__ */ __name((p) => `external_agent_stub/${p.agent_id}/sessions`, "path")
312
+ };
313
+ }
314
+ });
315
+
316
+ // node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints/async-tasks.js
317
+ var require_async_tasks = __commonJS({
318
+ "node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints/async-tasks.js"(exports) {
319
+ "use strict";
320
+ Object.defineProperty(exports, "__esModule", { value: true });
321
+ exports.getAsyncTask = void 0;
322
+ exports.getAsyncTask = {
323
+ method: "get",
324
+ pathParams: ["task_id"],
325
+ queryParams: [],
326
+ bodyParams: [],
327
+ path: /* @__PURE__ */ __name((p) => `async_tasks/${p.task_id}`, "path")
328
+ };
329
+ }
330
+ });
331
+
332
+ // node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints/blocks.js
333
+ var require_blocks = __commonJS({
334
+ "node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints/blocks.js"(exports) {
335
+ "use strict";
336
+ Object.defineProperty(exports, "__esModule", { value: true });
337
+ exports.appendBlockChildren = exports.listBlockChildren = exports.deleteBlock = exports.updateBlock = exports.getBlock = void 0;
338
+ exports.getBlock = {
339
+ method: "get",
340
+ pathParams: ["block_id"],
341
+ queryParams: [],
342
+ bodyParams: [],
343
+ path: /* @__PURE__ */ __name((p) => `blocks/${p.block_id}`, "path")
344
+ };
345
+ exports.updateBlock = {
346
+ method: "patch",
347
+ pathParams: ["block_id"],
348
+ queryParams: [],
349
+ bodyParams: [
350
+ "archived",
351
+ "embed",
352
+ "type",
353
+ "in_trash",
354
+ "bookmark",
355
+ "image",
356
+ "video",
357
+ "pdf",
358
+ "file",
359
+ "audio",
360
+ "code",
361
+ "equation",
362
+ "divider",
363
+ "breadcrumb",
364
+ "tab",
365
+ "table_of_contents",
366
+ "link_to_page",
367
+ "table_row",
368
+ "heading_1",
369
+ "heading_2",
370
+ "heading_3",
371
+ "heading_4",
372
+ "paragraph",
373
+ "bulleted_list_item",
374
+ "numbered_list_item",
375
+ "quote",
376
+ "to_do",
377
+ "toggle",
378
+ "template",
379
+ "callout",
380
+ "synced_block",
381
+ "table",
382
+ "column"
383
+ ],
384
+ path: /* @__PURE__ */ __name((p) => `blocks/${p.block_id}`, "path")
385
+ };
386
+ exports.deleteBlock = {
387
+ method: "delete",
388
+ pathParams: ["block_id"],
389
+ queryParams: [],
390
+ bodyParams: [],
391
+ path: /* @__PURE__ */ __name((p) => `blocks/${p.block_id}`, "path")
392
+ };
393
+ exports.listBlockChildren = {
394
+ method: "get",
395
+ pathParams: ["block_id"],
396
+ queryParams: ["start_cursor", "page_size"],
397
+ bodyParams: [],
398
+ path: /* @__PURE__ */ __name((p) => `blocks/${p.block_id}/children`, "path")
399
+ };
400
+ exports.appendBlockChildren = {
401
+ method: "patch",
402
+ pathParams: ["block_id"],
403
+ queryParams: [],
404
+ bodyParams: ["after", "children", "position", "notifications"],
405
+ path: /* @__PURE__ */ __name((p) => `blocks/${p.block_id}/children`, "path")
406
+ };
407
+ }
408
+ });
409
+
410
+ // node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints/comments.js
411
+ var require_comments = __commonJS({
412
+ "node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints/comments.js"(exports) {
413
+ "use strict";
414
+ Object.defineProperty(exports, "__esModule", { value: true });
415
+ exports.deleteComment = exports.updateComment = exports.getComment = exports.listComments = exports.createComment = void 0;
416
+ exports.createComment = {
417
+ method: "post",
418
+ pathParams: [],
419
+ queryParams: [],
420
+ bodyParams: [
421
+ "attachments",
422
+ "display_name",
423
+ "markdown_version",
424
+ "parent",
425
+ "rich_text",
426
+ "markdown",
427
+ "discussion_id"
428
+ ],
429
+ path: /* @__PURE__ */ __name(() => `comments`, "path")
430
+ };
431
+ exports.listComments = {
432
+ method: "get",
433
+ pathParams: [],
434
+ queryParams: ["block_id", "start_cursor", "page_size"],
435
+ bodyParams: [],
436
+ path: /* @__PURE__ */ __name(() => `comments`, "path")
437
+ };
438
+ exports.getComment = {
439
+ method: "get",
440
+ pathParams: ["comment_id"],
441
+ queryParams: [],
442
+ bodyParams: [],
443
+ path: /* @__PURE__ */ __name((p) => `comments/${p.comment_id}`, "path")
444
+ };
445
+ exports.updateComment = {
446
+ method: "patch",
447
+ pathParams: ["comment_id"],
448
+ queryParams: [],
449
+ bodyParams: ["markdown_version", "rich_text", "markdown"],
450
+ path: /* @__PURE__ */ __name((p) => `comments/${p.comment_id}`, "path")
451
+ };
452
+ exports.deleteComment = {
453
+ method: "delete",
454
+ pathParams: ["comment_id"],
455
+ queryParams: [],
456
+ bodyParams: [],
457
+ path: /* @__PURE__ */ __name((p) => `comments/${p.comment_id}`, "path")
458
+ };
459
+ }
460
+ });
461
+
462
+ // node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints/common.js
463
+ var require_common = __commonJS({
464
+ "node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints/common.js"(exports) {
465
+ "use strict";
466
+ Object.defineProperty(exports, "__esModule", { value: true });
467
+ }
468
+ });
469
+
470
+ // node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints/custom-emojis.js
471
+ var require_custom_emojis = __commonJS({
472
+ "node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints/custom-emojis.js"(exports) {
473
+ "use strict";
474
+ Object.defineProperty(exports, "__esModule", { value: true });
475
+ exports.listCustomEmojis = void 0;
476
+ exports.listCustomEmojis = {
477
+ method: "get",
478
+ pathParams: [],
479
+ queryParams: ["start_cursor", "page_size", "name"],
480
+ bodyParams: [],
481
+ path: /* @__PURE__ */ __name(() => `custom_emojis`, "path")
482
+ };
483
+ }
484
+ });
485
+
486
+ // node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints/data-sources.js
487
+ var require_data_sources = __commonJS({
488
+ "node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints/data-sources.js"(exports) {
489
+ "use strict";
490
+ Object.defineProperty(exports, "__esModule", { value: true });
491
+ exports.listDataSourceTemplates = exports.createDataSource = exports.queryDataSource = exports.updateDataSource = exports.getDataSource = void 0;
492
+ exports.getDataSource = {
493
+ method: "get",
494
+ pathParams: ["data_source_id"],
495
+ queryParams: [],
496
+ bodyParams: [],
497
+ path: /* @__PURE__ */ __name((p) => `data_sources/${p.data_source_id}`, "path")
498
+ };
499
+ exports.updateDataSource = {
500
+ method: "patch",
501
+ pathParams: ["data_source_id"],
502
+ queryParams: [],
503
+ bodyParams: ["archived", "title", "icon", "properties", "in_trash", "parent"],
504
+ path: /* @__PURE__ */ __name((p) => `data_sources/${p.data_source_id}`, "path")
505
+ };
506
+ exports.queryDataSource = {
507
+ method: "post",
508
+ pathParams: ["data_source_id"],
509
+ queryParams: ["filter_properties"],
510
+ bodyParams: [
511
+ "in_trash",
512
+ "archived",
513
+ "sorts",
514
+ "filter",
515
+ "start_cursor",
516
+ "page_size",
517
+ "is_archived",
518
+ "result_type"
519
+ ],
520
+ path: /* @__PURE__ */ __name((p) => `data_sources/${p.data_source_id}/query`, "path")
521
+ };
522
+ exports.createDataSource = {
523
+ method: "post",
524
+ pathParams: [],
525
+ queryParams: [],
526
+ bodyParams: ["parent", "properties", "title", "icon"],
527
+ path: /* @__PURE__ */ __name(() => `data_sources`, "path")
528
+ };
529
+ exports.listDataSourceTemplates = {
530
+ method: "get",
531
+ pathParams: ["data_source_id"],
532
+ queryParams: ["name", "start_cursor", "page_size"],
533
+ bodyParams: [],
534
+ path: /* @__PURE__ */ __name((p) => `data_sources/${p.data_source_id}/templates`, "path")
535
+ };
536
+ }
537
+ });
538
+
539
+ // node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints/databases.js
540
+ var require_databases = __commonJS({
541
+ "node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints/databases.js"(exports) {
542
+ "use strict";
543
+ Object.defineProperty(exports, "__esModule", { value: true });
544
+ exports.createDatabase = exports.updateDatabase = exports.getDatabase = void 0;
545
+ exports.getDatabase = {
546
+ method: "get",
547
+ pathParams: ["database_id"],
548
+ queryParams: [],
549
+ bodyParams: [],
550
+ path: /* @__PURE__ */ __name((p) => `databases/${p.database_id}`, "path")
551
+ };
552
+ exports.updateDatabase = {
553
+ method: "patch",
554
+ pathParams: ["database_id"],
555
+ queryParams: [],
556
+ bodyParams: [
557
+ "parent",
558
+ "title",
559
+ "description",
560
+ "is_inline",
561
+ "icon",
562
+ "cover",
563
+ "in_trash",
564
+ "is_locked",
565
+ "show_data_source_title"
566
+ ],
567
+ path: /* @__PURE__ */ __name((p) => `databases/${p.database_id}`, "path")
568
+ };
569
+ exports.createDatabase = {
570
+ method: "post",
571
+ pathParams: [],
572
+ queryParams: [],
573
+ bodyParams: [
574
+ "parent",
575
+ "title",
576
+ "description",
577
+ "is_inline",
578
+ "initial_data_source",
579
+ "database_type",
580
+ "icon",
581
+ "cover",
582
+ "show_data_source_title"
583
+ ],
584
+ path: /* @__PURE__ */ __name(() => `databases`, "path")
585
+ };
586
+ }
587
+ });
588
+
589
+ // node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints/file-uploads.js
590
+ var require_file_uploads = __commonJS({
591
+ "node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints/file-uploads.js"(exports) {
592
+ "use strict";
593
+ Object.defineProperty(exports, "__esModule", { value: true });
594
+ exports.getFileUpload = exports.completeFileUpload = exports.sendFileUpload = exports.listFileUploads = exports.createFileUpload = void 0;
595
+ exports.createFileUpload = {
596
+ method: "post",
597
+ pathParams: [],
598
+ queryParams: [],
599
+ bodyParams: [
600
+ "mode",
601
+ "filename",
602
+ "content_type",
603
+ "number_of_parts",
604
+ "external_url"
605
+ ],
606
+ path: /* @__PURE__ */ __name(() => `file_uploads`, "path")
607
+ };
608
+ exports.listFileUploads = {
609
+ method: "get",
610
+ pathParams: [],
611
+ queryParams: ["status", "start_cursor", "page_size"],
612
+ bodyParams: [],
613
+ path: /* @__PURE__ */ __name(() => `file_uploads`, "path")
614
+ };
615
+ exports.sendFileUpload = {
616
+ method: "post",
617
+ pathParams: ["file_upload_id"],
618
+ queryParams: [],
619
+ bodyParams: [],
620
+ formDataParams: ["file", "part_number"],
621
+ path: /* @__PURE__ */ __name((p) => `file_uploads/${p.file_upload_id}/send`, "path")
622
+ };
623
+ exports.completeFileUpload = {
624
+ method: "post",
625
+ pathParams: ["file_upload_id"],
626
+ queryParams: [],
627
+ bodyParams: [],
628
+ path: /* @__PURE__ */ __name((p) => `file_uploads/${p.file_upload_id}/complete`, "path")
629
+ };
630
+ exports.getFileUpload = {
631
+ method: "get",
632
+ pathParams: ["file_upload_id"],
633
+ queryParams: [],
634
+ bodyParams: [],
635
+ path: /* @__PURE__ */ __name((p) => `file_uploads/${p.file_upload_id}`, "path")
636
+ };
637
+ }
638
+ });
639
+
640
+ // node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints/meeting-notes.js
641
+ var require_meeting_notes = __commonJS({
642
+ "node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints/meeting-notes.js"(exports) {
643
+ "use strict";
644
+ Object.defineProperty(exports, "__esModule", { value: true });
645
+ exports.queryMeetingNotes = exports.createMeetingNote = void 0;
646
+ exports.createMeetingNote = {
647
+ method: "post",
648
+ pathParams: [],
649
+ queryParams: [],
650
+ bodyParams: ["title", "language", "options", "source", "parent"],
651
+ path: /* @__PURE__ */ __name(() => `blocks/meeting_notes`, "path")
652
+ };
653
+ exports.queryMeetingNotes = {
654
+ method: "post",
655
+ pathParams: [],
656
+ queryParams: [],
657
+ bodyParams: ["filter", "sort", "limit"],
658
+ path: /* @__PURE__ */ __name(() => `blocks/meeting_notes/query`, "path")
659
+ };
660
+ }
661
+ });
662
+
663
+ // node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints/oauth.js
664
+ var require_oauth = __commonJS({
665
+ "node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints/oauth.js"(exports) {
666
+ "use strict";
667
+ Object.defineProperty(exports, "__esModule", { value: true });
668
+ exports.oauthIntrospect = exports.oauthRevoke = exports.oauthToken = void 0;
669
+ exports.oauthToken = {
670
+ method: "post",
671
+ pathParams: [],
672
+ queryParams: [],
673
+ bodyParams: [
674
+ "grant_type",
675
+ "code",
676
+ "redirect_uri",
677
+ "external_account",
678
+ "refresh_token"
679
+ ],
680
+ path: /* @__PURE__ */ __name(() => `oauth/token`, "path")
681
+ };
682
+ exports.oauthRevoke = {
683
+ method: "post",
684
+ pathParams: [],
685
+ queryParams: [],
686
+ bodyParams: ["token"],
687
+ path: /* @__PURE__ */ __name(() => `oauth/revoke`, "path")
688
+ };
689
+ exports.oauthIntrospect = {
690
+ method: "post",
691
+ pathParams: [],
692
+ queryParams: [],
693
+ bodyParams: ["token"],
694
+ path: /* @__PURE__ */ __name(() => `oauth/introspect`, "path")
695
+ };
696
+ }
697
+ });
698
+
699
+ // node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints/pages.js
700
+ var require_pages = __commonJS({
701
+ "node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints/pages.js"(exports) {
702
+ "use strict";
703
+ Object.defineProperty(exports, "__esModule", { value: true });
704
+ exports.updatePageMarkdown = exports.getPageMarkdown = exports.getPageProperty = exports.movePage = exports.updatePage = exports.getPage = exports.createPage = void 0;
705
+ exports.createPage = {
706
+ method: "post",
707
+ pathParams: [],
708
+ queryParams: ["filter_properties"],
709
+ bodyParams: [
710
+ "parent",
711
+ "properties",
712
+ "icon",
713
+ "cover",
714
+ "content",
715
+ "children",
716
+ "markdown",
717
+ "allow_async",
718
+ "markdown_version",
719
+ "template",
720
+ "position",
721
+ "notifications"
722
+ ],
723
+ path: /* @__PURE__ */ __name(() => `pages`, "path")
724
+ };
725
+ exports.getPage = {
726
+ method: "get",
727
+ pathParams: ["page_id"],
728
+ queryParams: ["filter_properties"],
729
+ bodyParams: [],
730
+ path: /* @__PURE__ */ __name((p) => `pages/${p.page_id}`, "path")
731
+ };
732
+ exports.updatePage = {
733
+ method: "patch",
734
+ pathParams: ["page_id"],
735
+ queryParams: ["filter_properties"],
736
+ bodyParams: [
737
+ "archived",
738
+ "properties",
739
+ "icon",
740
+ "cover",
741
+ "is_locked",
742
+ "template",
743
+ "erase_content",
744
+ "notifications",
745
+ "in_trash",
746
+ "is_archived"
747
+ ],
748
+ path: /* @__PURE__ */ __name((p) => `pages/${p.page_id}`, "path")
749
+ };
750
+ exports.movePage = {
751
+ method: "post",
752
+ pathParams: ["page_id"],
753
+ queryParams: [],
754
+ bodyParams: ["parent"],
755
+ path: /* @__PURE__ */ __name((p) => `pages/${p.page_id}/move`, "path")
756
+ };
757
+ exports.getPageProperty = {
758
+ method: "get",
759
+ pathParams: ["page_id", "property_id"],
760
+ queryParams: ["start_cursor", "page_size"],
761
+ bodyParams: [],
762
+ path: /* @__PURE__ */ __name((p) => `pages/${p.page_id}/properties/${p.property_id}`, "path")
763
+ };
764
+ exports.getPageMarkdown = {
765
+ method: "get",
766
+ pathParams: ["page_id"],
767
+ queryParams: ["include_transcript", "markdown_version"],
768
+ bodyParams: [],
769
+ path: /* @__PURE__ */ __name((p) => `pages/${p.page_id}/markdown`, "path")
770
+ };
771
+ exports.updatePageMarkdown = {
772
+ method: "patch",
773
+ pathParams: ["page_id"],
774
+ queryParams: [],
775
+ bodyParams: [
776
+ "allow_async",
777
+ "markdown_version",
778
+ "type",
779
+ "insert_content",
780
+ "replace_content_range",
781
+ "update_content",
782
+ "replace_content"
783
+ ],
784
+ path: /* @__PURE__ */ __name((p) => `pages/${p.page_id}/markdown`, "path")
785
+ };
786
+ }
787
+ });
788
+
789
+ // node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints/search.js
790
+ var require_search = __commonJS({
791
+ "node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints/search.js"(exports) {
792
+ "use strict";
793
+ Object.defineProperty(exports, "__esModule", { value: true });
794
+ exports.search = void 0;
795
+ exports.search = {
796
+ method: "post",
797
+ pathParams: [],
798
+ queryParams: ["filter_properties"],
799
+ bodyParams: ["sort", "query", "start_cursor", "page_size", "filter"],
800
+ path: /* @__PURE__ */ __name(() => `search`, "path")
801
+ };
802
+ }
803
+ });
804
+
805
+ // node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints/users.js
806
+ var require_users = __commonJS({
807
+ "node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints/users.js"(exports) {
808
+ "use strict";
809
+ Object.defineProperty(exports, "__esModule", { value: true });
810
+ exports.listUsers = exports.getUser = exports.getSelf = void 0;
811
+ exports.getSelf = {
812
+ method: "get",
813
+ pathParams: [],
814
+ queryParams: [],
815
+ bodyParams: [],
816
+ path: /* @__PURE__ */ __name(() => `users/me`, "path")
817
+ };
818
+ exports.getUser = {
819
+ method: "get",
820
+ pathParams: ["user_id"],
821
+ queryParams: [],
822
+ bodyParams: [],
823
+ path: /* @__PURE__ */ __name((p) => `users/${p.user_id}`, "path")
824
+ };
825
+ exports.listUsers = {
826
+ method: "get",
827
+ pathParams: [],
828
+ queryParams: ["start_cursor", "page_size"],
829
+ bodyParams: [],
830
+ path: /* @__PURE__ */ __name(() => `users`, "path")
831
+ };
832
+ }
833
+ });
834
+
835
+ // node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints/views.js
836
+ var require_views = __commonJS({
837
+ "node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints/views.js"(exports) {
838
+ "use strict";
839
+ Object.defineProperty(exports, "__esModule", { value: true });
840
+ exports.deleteViewQuery = exports.getViewQueryResults = exports.createViewQuery = exports.deleteView = exports.updateView = exports.getView = exports.createView = exports.listDatabaseViews = void 0;
841
+ exports.listDatabaseViews = {
842
+ method: "get",
843
+ pathParams: [],
844
+ queryParams: ["database_id", "data_source_id", "start_cursor", "page_size"],
845
+ bodyParams: [],
846
+ path: /* @__PURE__ */ __name(() => `views`, "path")
847
+ };
848
+ exports.createView = {
849
+ method: "post",
850
+ pathParams: [],
851
+ queryParams: [],
852
+ bodyParams: [],
853
+ path: /* @__PURE__ */ __name(() => `views`, "path")
854
+ };
855
+ exports.getView = {
856
+ method: "get",
857
+ pathParams: ["view_id"],
858
+ queryParams: [],
859
+ bodyParams: [],
860
+ path: /* @__PURE__ */ __name((p) => `views/${p.view_id}`, "path")
861
+ };
862
+ exports.updateView = {
863
+ method: "patch",
864
+ pathParams: ["view_id"],
865
+ queryParams: [],
866
+ bodyParams: [],
867
+ path: /* @__PURE__ */ __name((p) => `views/${p.view_id}`, "path")
868
+ };
869
+ exports.deleteView = {
870
+ method: "delete",
871
+ pathParams: ["view_id"],
872
+ queryParams: [],
873
+ bodyParams: [],
874
+ path: /* @__PURE__ */ __name((p) => `views/${p.view_id}`, "path")
875
+ };
876
+ exports.createViewQuery = {
877
+ method: "post",
878
+ pathParams: ["view_id"],
879
+ queryParams: [],
880
+ bodyParams: [],
881
+ path: /* @__PURE__ */ __name((p) => `views/${p.view_id}/queries`, "path")
882
+ };
883
+ exports.getViewQueryResults = {
884
+ method: "get",
885
+ pathParams: ["view_id", "query_id"],
886
+ queryParams: ["start_cursor", "page_size"],
887
+ bodyParams: [],
888
+ path: /* @__PURE__ */ __name((p) => `views/${p.view_id}/queries/${p.query_id}`, "path")
889
+ };
890
+ exports.deleteViewQuery = {
891
+ method: "delete",
892
+ pathParams: ["view_id", "query_id"],
893
+ queryParams: [],
894
+ bodyParams: [],
895
+ path: /* @__PURE__ */ __name((p) => `views/${p.view_id}/queries/${p.query_id}`, "path")
896
+ };
897
+ }
898
+ });
899
+
900
+ // node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints/webhooks.js
901
+ var require_webhooks = __commonJS({
902
+ "node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints/webhooks.js"(exports) {
903
+ "use strict";
904
+ Object.defineProperty(exports, "__esModule", { value: true });
905
+ }
906
+ });
907
+
908
+ // node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints.js
909
+ var require_api_endpoints = __commonJS({
910
+ "node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoints.js"(exports) {
911
+ "use strict";
912
+ var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
913
+ if (k2 === void 0) k2 = k;
914
+ var desc = Object.getOwnPropertyDescriptor(m, k);
915
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
916
+ desc = { enumerable: true, get: /* @__PURE__ */ __name(function() {
917
+ return m[k];
918
+ }, "get") };
919
+ }
920
+ Object.defineProperty(o, k2, desc);
921
+ }) : (function(o, m, k, k2) {
922
+ if (k2 === void 0) k2 = k;
923
+ o[k2] = m[k];
924
+ }));
925
+ var __exportStar = exports && exports.__exportStar || function(m, exports2) {
926
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
927
+ };
928
+ Object.defineProperty(exports, "__esModule", { value: true });
929
+ __exportStar(require_agent_skills(), exports);
930
+ __exportStar(require_agents(), exports);
931
+ __exportStar(require_async_tasks(), exports);
932
+ __exportStar(require_blocks(), exports);
933
+ __exportStar(require_comments(), exports);
934
+ __exportStar(require_common(), exports);
935
+ __exportStar(require_custom_emojis(), exports);
936
+ __exportStar(require_data_sources(), exports);
937
+ __exportStar(require_databases(), exports);
938
+ __exportStar(require_file_uploads(), exports);
939
+ __exportStar(require_meeting_notes(), exports);
940
+ __exportStar(require_oauth(), exports);
941
+ __exportStar(require_pages(), exports);
942
+ __exportStar(require_search(), exports);
943
+ __exportStar(require_users(), exports);
944
+ __exportStar(require_views(), exports);
945
+ __exportStar(require_webhooks(), exports);
946
+ }
947
+ });
948
+
949
+ // node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/utils.js
950
+ var require_utils = __commonJS({
951
+ "node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/utils.js"(exports) {
952
+ "use strict";
953
+ Object.defineProperty(exports, "__esModule", { value: true });
954
+ exports.assertNever = assertNever;
955
+ exports.pick = pick;
956
+ exports.isObject = isObject;
957
+ exports.getEndpointRequestOptions = getEndpointRequestOptions;
958
+ exports.getUnknownParams = getUnknownParams;
959
+ function assertNever(value) {
960
+ throw new Error(`Unexpected value should never occur: ${value}`);
961
+ }
962
+ __name(assertNever, "assertNever");
963
+ function pick(base, keys) {
964
+ const entries = keys.map((key) => [key, base === null || base === void 0 ? void 0 : base[key]]);
965
+ return Object.fromEntries(entries);
966
+ }
967
+ __name(pick, "pick");
968
+ function isObject(o) {
969
+ return typeof o === "object" && o !== null;
970
+ }
971
+ __name(isObject, "isObject");
972
+ function getEndpointRequestOptions(args, endpointHeaders) {
973
+ var _a;
974
+ const headers = ((_a = args === null || args === void 0 ? void 0 : args.betas) === null || _a === void 0 ? void 0 : _a.length) ? { ...endpointHeaders, "Notion-Beta": args.betas.join(", ") } : endpointHeaders;
975
+ return { auth: args === null || args === void 0 ? void 0 : args.auth, ...headers && { headers } };
976
+ }
977
+ __name(getEndpointRequestOptions, "getEndpointRequestOptions");
978
+ function getUnknownParams(args, endpoint) {
979
+ var _a;
980
+ const knownKeys = /* @__PURE__ */ new Set([
981
+ ...endpoint.pathParams,
982
+ ...endpoint.queryParams,
983
+ ...endpoint.bodyParams,
984
+ ...(_a = endpoint.formDataParams) !== null && _a !== void 0 ? _a : [],
985
+ "auth",
986
+ "betas"
987
+ ]);
988
+ return Object.keys(args).filter((k) => !knownKeys.has(k));
989
+ }
990
+ __name(getUnknownParams, "getUnknownParams");
991
+ }
992
+ });
993
+
994
+ // node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoint-methods.js
995
+ var require_api_endpoint_methods = __commonJS({
996
+ "node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/api-endpoint-methods.js"(exports) {
997
+ "use strict";
998
+ var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
999
+ if (k2 === void 0) k2 = k;
1000
+ var desc = Object.getOwnPropertyDescriptor(m, k);
1001
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
1002
+ desc = { enumerable: true, get: /* @__PURE__ */ __name(function() {
1003
+ return m[k];
1004
+ }, "get") };
1005
+ }
1006
+ Object.defineProperty(o, k2, desc);
1007
+ }) : (function(o, m, k, k2) {
1008
+ if (k2 === void 0) k2 = k;
1009
+ o[k2] = m[k];
1010
+ }));
1011
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
1012
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
1013
+ }) : function(o, v) {
1014
+ o["default"] = v;
1015
+ });
1016
+ var __importStar = exports && exports.__importStar || /* @__PURE__ */ (function() {
1017
+ var ownKeys = /* @__PURE__ */ __name(function(o) {
1018
+ ownKeys = Object.getOwnPropertyNames || function(o2) {
1019
+ var ar = [];
1020
+ for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
1021
+ return ar;
1022
+ };
1023
+ return ownKeys(o);
1024
+ }, "ownKeys");
1025
+ return function(mod) {
1026
+ if (mod && mod.__esModule) return mod;
1027
+ var result = {};
1028
+ if (mod != null) {
1029
+ for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
1030
+ }
1031
+ __setModuleDefault(result, mod);
1032
+ return result;
1033
+ };
1034
+ })();
1035
+ Object.defineProperty(exports, "__esModule", { value: true });
1036
+ exports.createEndpointMethods = createEndpointMethods;
1037
+ var endpoints = __importStar(require_api_endpoints());
1038
+ var utils_1 = require_utils();
1039
+ function createEndpointMethods(client) {
1040
+ function method(definition, query) {
1041
+ return (args) => {
1042
+ client.warnUnknownParams(args, definition);
1043
+ return client.request({
1044
+ path: definition.path(args),
1045
+ method: definition.method,
1046
+ query: query(args),
1047
+ body: (0, utils_1.pick)(args, definition.bodyParams),
1048
+ ...(0, utils_1.getEndpointRequestOptions)(args, definition.headers)
1049
+ });
1050
+ };
1051
+ }
1052
+ __name(method, "method");
1053
+ function optionalMethod(definition, query) {
1054
+ return (args) => {
1055
+ const requestArgs = args !== null && args !== void 0 ? args : {};
1056
+ client.warnUnknownParams(requestArgs, definition);
1057
+ return client.request({
1058
+ path: definition.path(),
1059
+ method: definition.method,
1060
+ query: query(requestArgs),
1061
+ body: (0, utils_1.pick)(requestArgs, definition.bodyParams),
1062
+ ...(0, utils_1.getEndpointRequestOptions)(requestArgs, definition.headers)
1063
+ });
1064
+ };
1065
+ }
1066
+ __name(optionalMethod, "optionalMethod");
1067
+ return {
1068
+ users: {
1069
+ /** Retrieve your token's bot user */
1070
+ me: optionalMethod(endpoints.getSelf, (args) => (0, utils_1.pick)(args, endpoints.getSelf.queryParams)),
1071
+ /** Retrieve a user */
1072
+ retrieve: method(endpoints.getUser, (args) => (0, utils_1.pick)(args, endpoints.getUser.queryParams)),
1073
+ /** List all users */
1074
+ list: optionalMethod(endpoints.listUsers, (args) => (0, utils_1.pick)(args, endpoints.listUsers.queryParams))
1075
+ },
1076
+ pages: {
1077
+ /** Create a page */
1078
+ create: method(endpoints.createPage, (args) => (0, utils_1.pick)(args, endpoints.createPage.queryParams)),
1079
+ /** Retrieve a page */
1080
+ retrieve: method(endpoints.getPage, (args) => (0, utils_1.pick)(args, endpoints.getPage.queryParams)),
1081
+ /** Update page */
1082
+ update: method(endpoints.updatePage, (args) => (0, utils_1.pick)(args, endpoints.updatePage.queryParams)),
1083
+ /** Move a page */
1084
+ move: method(endpoints.movePage, (args) => (0, utils_1.pick)(args, endpoints.movePage.queryParams)),
1085
+ properties: {
1086
+ /** Retrieve a page property item */
1087
+ retrieve: method(endpoints.getPageProperty, (args) => (0, utils_1.pick)(args, endpoints.getPageProperty.queryParams))
1088
+ }
1089
+ },
1090
+ asyncTasks: {
1091
+ /** Retrieve an async task */
1092
+ retrieve: method(endpoints.getAsyncTask, (args) => (0, utils_1.pick)(args, endpoints.getAsyncTask.queryParams))
1093
+ },
1094
+ blocks: {
1095
+ /** Retrieve a block */
1096
+ retrieve: method(endpoints.getBlock, (args) => (0, utils_1.pick)(args, endpoints.getBlock.queryParams)),
1097
+ /** Update a block */
1098
+ update: method(endpoints.updateBlock, (args) => (0, utils_1.pick)(args, endpoints.updateBlock.queryParams)),
1099
+ /** Delete a block */
1100
+ delete: method(endpoints.deleteBlock, (args) => (0, utils_1.pick)(args, endpoints.deleteBlock.queryParams)),
1101
+ children: {
1102
+ /** Retrieve block children */
1103
+ list: method(endpoints.listBlockChildren, (args) => (0, utils_1.pick)(args, endpoints.listBlockChildren.queryParams)),
1104
+ /** Append block children */
1105
+ append: method(endpoints.appendBlockChildren, (args) => (0, utils_1.pick)(args, endpoints.appendBlockChildren.queryParams))
1106
+ },
1107
+ meetingNotes: {
1108
+ /** Create a meeting note */
1109
+ create: method(endpoints.createMeetingNote, (args) => (0, utils_1.pick)(args, endpoints.createMeetingNote.queryParams))
1110
+ }
1111
+ },
1112
+ dataSources: {
1113
+ /** Retrieve a data source */
1114
+ retrieve: method(endpoints.getDataSource, (args) => (0, utils_1.pick)(args, endpoints.getDataSource.queryParams)),
1115
+ /** Update a data source */
1116
+ update: method(endpoints.updateDataSource, (args) => (0, utils_1.pick)(args, endpoints.updateDataSource.queryParams)),
1117
+ /** Query a data source */
1118
+ query: method(endpoints.queryDataSource, (args) => (0, utils_1.pick)(args, endpoints.queryDataSource.queryParams)),
1119
+ /** Create a data source */
1120
+ create: method(endpoints.createDataSource, (args) => (0, utils_1.pick)(args, endpoints.createDataSource.queryParams)),
1121
+ /** List templates in a data source */
1122
+ listTemplates: method(endpoints.listDataSourceTemplates, (args) => (0, utils_1.pick)(args, endpoints.listDataSourceTemplates.queryParams))
1123
+ },
1124
+ databases: {
1125
+ /** Retrieve a database */
1126
+ retrieve: method(endpoints.getDatabase, (args) => (0, utils_1.pick)(args, endpoints.getDatabase.queryParams)),
1127
+ /** Update a database */
1128
+ update: method(endpoints.updateDatabase, (args) => (0, utils_1.pick)(args, endpoints.updateDatabase.queryParams)),
1129
+ /** Create a database */
1130
+ create: method(endpoints.createDatabase, (args) => (0, utils_1.pick)(args, endpoints.createDatabase.queryParams))
1131
+ },
1132
+ /** Search by title */
1133
+ search: optionalMethod(endpoints.search, (args) => (0, utils_1.pick)(args, endpoints.search.queryParams)),
1134
+ comments: {
1135
+ /** Create a comment */
1136
+ create: method(endpoints.createComment, (args) => (0, utils_1.pick)(args, endpoints.createComment.queryParams)),
1137
+ /** List comments */
1138
+ list: method(endpoints.listComments, (args) => (0, utils_1.pick)(args, endpoints.listComments.queryParams)),
1139
+ /** Retrieve a comment */
1140
+ retrieve: method(endpoints.getComment, (args) => (0, utils_1.pick)(args, endpoints.getComment.queryParams)),
1141
+ /** Update a comment */
1142
+ update: method(endpoints.updateComment, (args) => (0, utils_1.pick)(args, endpoints.updateComment.queryParams)),
1143
+ /** Delete a comment */
1144
+ delete: method(endpoints.deleteComment, (args) => (0, utils_1.pick)(args, endpoints.deleteComment.queryParams))
1145
+ },
1146
+ fileUploads: {
1147
+ /** Create a file upload */
1148
+ create: optionalMethod(endpoints.createFileUpload, (args) => (0, utils_1.pick)(args, endpoints.createFileUpload.queryParams))
1149
+ },
1150
+ views: {
1151
+ /** List views */
1152
+ list: optionalMethod(endpoints.listDatabaseViews, (args) => (0, utils_1.pick)(args, endpoints.listDatabaseViews.queryParams)),
1153
+ /** Retrieve a view */
1154
+ retrieve: method(endpoints.getView, (args) => (0, utils_1.pick)(args, endpoints.getView.queryParams)),
1155
+ /** Delete a view */
1156
+ delete: method(endpoints.deleteView, (args) => (0, utils_1.pick)(args, endpoints.deleteView.queryParams)),
1157
+ queries: {
1158
+ /** Get view query results */
1159
+ results: method(endpoints.getViewQueryResults, (args) => (0, utils_1.pick)(args, endpoints.getViewQueryResults.queryParams)),
1160
+ /** Delete a view query */
1161
+ delete: method(endpoints.deleteViewQuery, (args) => (0, utils_1.pick)(args, endpoints.deleteViewQuery.queryParams))
1162
+ }
1163
+ },
1164
+ agents: {
1165
+ /** Query agents */
1166
+ query: optionalMethod(endpoints.queryAgents, (args) => (0, utils_1.pick)(args, endpoints.queryAgents.queryParams)),
1167
+ /** Get agent */
1168
+ retrieve: method(endpoints.getAgent, (args) => (0, utils_1.pick)(args, endpoints.getAgent.queryParams)),
1169
+ /** Delete agent */
1170
+ delete: method(endpoints.deleteAgent, (args) => (0, utils_1.pick)(args, endpoints.deleteAgent.queryParams)),
1171
+ /** Get agent insights */
1172
+ retrieveInsights: method(endpoints.getInsights, (args) => (0, utils_1.pick)(args, endpoints.getInsights.queryParams)),
1173
+ /** Update agent status */
1174
+ updateStatus: method(endpoints.updateAgentStatus, (args) => (0, utils_1.pick)(args, endpoints.updateAgentStatus.queryParams)),
1175
+ /** Update agent credit limit */
1176
+ updateCreditLimit: method(endpoints.updateAgentCreditLimit, (args) => (0, utils_1.pick)(args, endpoints.updateAgentCreditLimit.queryParams)),
1177
+ /** Apply many agent operations */
1178
+ batch: method(endpoints.agentBatch, (args) => (0, utils_1.pick)(args, endpoints.agentBatch.queryParams))
1179
+ },
1180
+ plugins: {
1181
+ /** List skills plugins */
1182
+ list: optionalMethod(endpoints.listSkillsPlugins, (args) => (0, utils_1.pick)(args, endpoints.listSkillsPlugins.queryParams)),
1183
+ /** Get a plugin directory */
1184
+ retrieve: method(endpoints.getPluginDirectory, (args) => (0, utils_1.pick)(args, endpoints.getPluginDirectory.queryParams))
1185
+ },
1186
+ skills: {
1187
+ /** Get a skill directory */
1188
+ retrieve: method(endpoints.getSkillDirectory, (args) => (0, utils_1.pick)(args, endpoints.getSkillDirectory.queryParams))
1189
+ },
1190
+ sessions: {
1191
+ /** Update a session */
1192
+ update: method(endpoints.updateSession, (args) => (0, utils_1.pick)(args, endpoints.updateSession.queryParams)),
1193
+ /** Retrieve a session */
1194
+ retrieve: method(endpoints.retrieveSession, (args) => (0, utils_1.pick)(args, endpoints.retrieveSession.queryParams)),
1195
+ /** Query sessions */
1196
+ query: optionalMethod(endpoints.querySessions, (args) => (0, utils_1.pick)(args, endpoints.querySessions.queryParams)),
1197
+ /** Query session events */
1198
+ queryEvents: method(endpoints.querySessionEvents, (args) => (0, utils_1.pick)(args, endpoints.querySessionEvents.queryParams)),
1199
+ /** Cancel a session */
1200
+ cancel: method(endpoints.cancelSession, (args) => (0, utils_1.pick)(args, endpoints.cancelSession.queryParams))
1201
+ }
1202
+ };
1203
+ }
1204
+ __name(createEndpointMethods, "createEndpointMethods");
1205
+ }
1206
+ });
1207
+
1208
+ // node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/logging.js
1209
+ var require_logging = __commonJS({
1210
+ "node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/logging.js"(exports) {
1211
+ "use strict";
1212
+ Object.defineProperty(exports, "__esModule", { value: true });
1213
+ exports.LogLevel = void 0;
1214
+ exports.makeConsoleLogger = makeConsoleLogger;
1215
+ exports.logLevelSeverity = logLevelSeverity;
1216
+ var utils_1 = require_utils();
1217
+ var LogLevel;
1218
+ (function(LogLevel2) {
1219
+ LogLevel2["DEBUG"] = "debug";
1220
+ LogLevel2["INFO"] = "info";
1221
+ LogLevel2["WARN"] = "warn";
1222
+ LogLevel2["ERROR"] = "error";
1223
+ })(LogLevel || (exports.LogLevel = LogLevel = {}));
1224
+ function makeConsoleLogger(name) {
1225
+ return (level, message, extraInfo) => {
1226
+ console[level](`${name} ${level}:`, message, extraInfo);
1227
+ };
1228
+ }
1229
+ __name(makeConsoleLogger, "makeConsoleLogger");
1230
+ function logLevelSeverity(level) {
1231
+ switch (level) {
1232
+ case LogLevel.DEBUG:
1233
+ return 20;
1234
+ case LogLevel.INFO:
1235
+ return 40;
1236
+ case LogLevel.WARN:
1237
+ return 60;
1238
+ case LogLevel.ERROR:
1239
+ return 80;
1240
+ default:
1241
+ return (0, utils_1.assertNever)(level);
1242
+ }
1243
+ }
1244
+ __name(logLevelSeverity, "logLevelSeverity");
1245
+ }
1246
+ });
1247
+
1248
+ // node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/errors.js
1249
+ var require_errors = __commonJS({
1250
+ "node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/errors.js"(exports) {
1251
+ "use strict";
1252
+ Object.defineProperty(exports, "__esModule", { value: true });
1253
+ exports.APIResponseError = exports.UnknownHTTPResponseError = exports.BrowserTokenNotAllowedError = exports.InvalidPathParameterError = exports.RequestTimeoutError = exports.ClientErrorCode = exports.APIErrorCode = void 0;
1254
+ exports.isNotionClientError = isNotionClientError;
1255
+ exports.validateRequestPath = validateRequestPath;
1256
+ exports.getResponseHeader = getResponseHeader;
1257
+ exports.isHTTPResponseError = isHTTPResponseError2;
1258
+ exports.buildRequestError = buildRequestError;
1259
+ var utils_1 = require_utils();
1260
+ var APIErrorCode;
1261
+ (function(APIErrorCode2) {
1262
+ APIErrorCode2["Unauthorized"] = "unauthorized";
1263
+ APIErrorCode2["RestrictedResource"] = "restricted_resource";
1264
+ APIErrorCode2["ObjectNotFound"] = "object_not_found";
1265
+ APIErrorCode2["RateLimited"] = "rate_limited";
1266
+ APIErrorCode2["InvalidJSON"] = "invalid_json";
1267
+ APIErrorCode2["InvalidRequestURL"] = "invalid_request_url";
1268
+ APIErrorCode2["InvalidRequest"] = "invalid_request";
1269
+ APIErrorCode2["InvalidBeta"] = "invalid_beta";
1270
+ APIErrorCode2["ValidationError"] = "validation_error";
1271
+ APIErrorCode2["ConflictError"] = "conflict_error";
1272
+ APIErrorCode2["InternalServerError"] = "internal_server_error";
1273
+ APIErrorCode2["ServiceOverload"] = "service_overload";
1274
+ APIErrorCode2["ServiceUnavailable"] = "service_unavailable";
1275
+ APIErrorCode2["GatewayTimeout"] = "gateway_timeout";
1276
+ })(APIErrorCode || (exports.APIErrorCode = APIErrorCode = {}));
1277
+ var ClientErrorCode;
1278
+ (function(ClientErrorCode2) {
1279
+ ClientErrorCode2["RequestTimeout"] = "notionhq_client_request_timeout";
1280
+ ClientErrorCode2["ResponseError"] = "notionhq_client_response_error";
1281
+ ClientErrorCode2["InvalidPathParameter"] = "notionhq_client_invalid_path_parameter";
1282
+ })(ClientErrorCode || (exports.ClientErrorCode = ClientErrorCode = {}));
1283
+ var NotionClientErrorBase = class extends Error {
1284
+ static {
1285
+ __name(this, "NotionClientErrorBase");
1286
+ }
1287
+ };
1288
+ function isNotionClientError(error) {
1289
+ return (0, utils_1.isObject)(error) && error instanceof NotionClientErrorBase;
1290
+ }
1291
+ __name(isNotionClientError, "isNotionClientError");
1292
+ function isNotionClientErrorWithCode(error, codes) {
1293
+ return isNotionClientError(error) && error.code in codes;
1294
+ }
1295
+ __name(isNotionClientErrorWithCode, "isNotionClientErrorWithCode");
1296
+ var RequestTimeoutError2 = class _RequestTimeoutError extends NotionClientErrorBase {
1297
+ static {
1298
+ __name(this, "RequestTimeoutError");
1299
+ }
1300
+ constructor(message = "Request to Notion API has timed out") {
1301
+ super(message);
1302
+ this.code = ClientErrorCode.RequestTimeout;
1303
+ this.name = "RequestTimeoutError";
1304
+ }
1305
+ static isRequestTimeoutError(error) {
1306
+ return isNotionClientErrorWithCode(error, {
1307
+ [ClientErrorCode.RequestTimeout]: true
1308
+ });
1309
+ }
1310
+ static rejectAfterTimeout(promise, timeoutMS) {
1311
+ return new Promise((resolve, reject) => {
1312
+ const timeoutId = setTimeout(() => {
1313
+ reject(new _RequestTimeoutError());
1314
+ }, timeoutMS);
1315
+ promise.then(resolve).catch(reject).then(() => clearTimeout(timeoutId));
1316
+ });
1317
+ }
1318
+ };
1319
+ exports.RequestTimeoutError = RequestTimeoutError2;
1320
+ var InvalidPathParameterError = class extends NotionClientErrorBase {
1321
+ static {
1322
+ __name(this, "InvalidPathParameterError");
1323
+ }
1324
+ constructor(message = "Path parameter contains invalid characters that could alter the request path") {
1325
+ super(message);
1326
+ this.code = ClientErrorCode.InvalidPathParameter;
1327
+ this.name = "InvalidPathParameterError";
1328
+ }
1329
+ static isInvalidPathParameterError(error) {
1330
+ return isNotionClientErrorWithCode(error, {
1331
+ [ClientErrorCode.InvalidPathParameter]: true
1332
+ });
1333
+ }
1334
+ };
1335
+ exports.InvalidPathParameterError = InvalidPathParameterError;
1336
+ var BrowserTokenNotAllowedError = class extends Error {
1337
+ static {
1338
+ __name(this, "BrowserTokenNotAllowedError");
1339
+ }
1340
+ constructor(message = "It looks like you're running in a browser. Using a Notion token here is blocked by default: anyone who can load the page can read the token and act as your connection. Keep the token on a server instead. If only you can open this page and you accept the risk, pass `dangerouslyAllowBrowser: true` to the Client. See https://developers.notion.com/guides/get-started/handling-api-keys#calling-the-api-from-a-browser") {
1341
+ super(message);
1342
+ this.name = "BrowserTokenNotAllowedError";
1343
+ }
1344
+ };
1345
+ exports.BrowserTokenNotAllowedError = BrowserTokenNotAllowedError;
1346
+ function validateRequestPath(path) {
1347
+ if (path.includes("..")) {
1348
+ throw new InvalidPathParameterError(`Request path "${path}" contains path traversal sequence ".."`);
1349
+ }
1350
+ if (/%2e/i.test(path)) {
1351
+ let decoded;
1352
+ try {
1353
+ decoded = decodeURIComponent(path);
1354
+ } catch {
1355
+ return;
1356
+ }
1357
+ if (decoded.includes("..")) {
1358
+ throw new InvalidPathParameterError(`Request path "${path}" contains encoded path traversal sequence`);
1359
+ }
1360
+ }
1361
+ }
1362
+ __name(validateRequestPath, "validateRequestPath");
1363
+ function getResponseHeader(headers, name) {
1364
+ if (!(0, utils_1.isObject)(headers)) {
1365
+ return void 0;
1366
+ }
1367
+ const get = headers["get"];
1368
+ if (typeof get === "function") {
1369
+ const value = get.call(headers, name);
1370
+ return typeof value === "string" ? value : void 0;
1371
+ }
1372
+ const lowerName = name.toLowerCase();
1373
+ for (const [key, value] of Object.entries(headers)) {
1374
+ if (key.toLowerCase() !== lowerName) {
1375
+ continue;
1376
+ }
1377
+ if (typeof value === "string") {
1378
+ return value;
1379
+ }
1380
+ if (Array.isArray(value) && typeof value[0] === "string") {
1381
+ return value[0];
1382
+ }
1383
+ }
1384
+ return void 0;
1385
+ }
1386
+ __name(getResponseHeader, "getResponseHeader");
1387
+ var HTTPResponseError = class extends NotionClientErrorBase {
1388
+ static {
1389
+ __name(this, "HTTPResponseError");
1390
+ }
1391
+ constructor(args) {
1392
+ super(args.message);
1393
+ this.name = "HTTPResponseError";
1394
+ const { code, status, headers, rawBodyText, additional_data, request_id } = args;
1395
+ this.code = code;
1396
+ this.status = status;
1397
+ this.headers = headers;
1398
+ this.body = rawBodyText;
1399
+ this.additional_data = additional_data;
1400
+ this.request_id = request_id !== null && request_id !== void 0 ? request_id : getResponseHeader(headers, "x-notion-request-id");
1401
+ this.ray_id = getResponseHeader(headers, "cf-ray");
1402
+ }
1403
+ };
1404
+ var httpResponseErrorCodes = {
1405
+ [ClientErrorCode.ResponseError]: true,
1406
+ [APIErrorCode.Unauthorized]: true,
1407
+ [APIErrorCode.RestrictedResource]: true,
1408
+ [APIErrorCode.ObjectNotFound]: true,
1409
+ [APIErrorCode.RateLimited]: true,
1410
+ [APIErrorCode.InvalidJSON]: true,
1411
+ [APIErrorCode.InvalidRequestURL]: true,
1412
+ [APIErrorCode.InvalidRequest]: true,
1413
+ [APIErrorCode.InvalidBeta]: true,
1414
+ [APIErrorCode.ValidationError]: true,
1415
+ [APIErrorCode.ConflictError]: true,
1416
+ [APIErrorCode.InternalServerError]: true,
1417
+ [APIErrorCode.ServiceOverload]: true,
1418
+ [APIErrorCode.ServiceUnavailable]: true,
1419
+ [APIErrorCode.GatewayTimeout]: true
1420
+ };
1421
+ function isHTTPResponseError2(error) {
1422
+ if (!isNotionClientErrorWithCode(error, httpResponseErrorCodes)) {
1423
+ return false;
1424
+ }
1425
+ return true;
1426
+ }
1427
+ __name(isHTTPResponseError2, "isHTTPResponseError");
1428
+ var UnknownHTTPResponseError = class extends HTTPResponseError {
1429
+ static {
1430
+ __name(this, "UnknownHTTPResponseError");
1431
+ }
1432
+ constructor(args) {
1433
+ var _a;
1434
+ const ray_id = getResponseHeader(args.headers, "cf-ray");
1435
+ const request_id = getResponseHeader(args.headers, "x-notion-request-id");
1436
+ super({
1437
+ ...args,
1438
+ code: ClientErrorCode.ResponseError,
1439
+ message: (_a = args.message) !== null && _a !== void 0 ? _a : buildUnknownResponseMessage({
1440
+ status: args.status,
1441
+ contentType: getResponseHeader(args.headers, "content-type"),
1442
+ ray_id,
1443
+ request_id
1444
+ }),
1445
+ additional_data: void 0,
1446
+ request_id
1447
+ });
1448
+ this.name = "UnknownHTTPResponseError";
1449
+ }
1450
+ static isUnknownHTTPResponseError(error) {
1451
+ return isNotionClientErrorWithCode(error, {
1452
+ [ClientErrorCode.ResponseError]: true
1453
+ });
1454
+ }
1455
+ };
1456
+ exports.UnknownHTTPResponseError = UnknownHTTPResponseError;
1457
+ var apiErrorCodes = {
1458
+ [APIErrorCode.Unauthorized]: true,
1459
+ [APIErrorCode.RestrictedResource]: true,
1460
+ [APIErrorCode.ObjectNotFound]: true,
1461
+ [APIErrorCode.RateLimited]: true,
1462
+ [APIErrorCode.InvalidJSON]: true,
1463
+ [APIErrorCode.InvalidRequestURL]: true,
1464
+ [APIErrorCode.InvalidRequest]: true,
1465
+ [APIErrorCode.InvalidBeta]: true,
1466
+ [APIErrorCode.ValidationError]: true,
1467
+ [APIErrorCode.ConflictError]: true,
1468
+ [APIErrorCode.InternalServerError]: true,
1469
+ [APIErrorCode.ServiceOverload]: true,
1470
+ [APIErrorCode.ServiceUnavailable]: true,
1471
+ [APIErrorCode.GatewayTimeout]: true
1472
+ };
1473
+ var APIResponseError2 = class extends HTTPResponseError {
1474
+ static {
1475
+ __name(this, "APIResponseError");
1476
+ }
1477
+ constructor() {
1478
+ super(...arguments);
1479
+ this.name = "APIResponseError";
1480
+ }
1481
+ static isAPIResponseError(error) {
1482
+ return isNotionClientErrorWithCode(error, apiErrorCodes);
1483
+ }
1484
+ };
1485
+ exports.APIResponseError = APIResponseError2;
1486
+ function buildRequestError(response, bodyText) {
1487
+ const apiErrorResponseBody = parseAPIErrorResponseBody(bodyText);
1488
+ if (apiErrorResponseBody !== void 0) {
1489
+ return new APIResponseError2({
1490
+ code: apiErrorResponseBody.code,
1491
+ message: apiErrorResponseBody.message,
1492
+ headers: response.headers,
1493
+ status: response.status,
1494
+ rawBodyText: bodyText,
1495
+ additional_data: apiErrorResponseBody.additional_data,
1496
+ request_id: apiErrorResponseBody.request_id
1497
+ });
1498
+ }
1499
+ return new UnknownHTTPResponseError({
1500
+ message: void 0,
1501
+ headers: response.headers,
1502
+ status: response.status,
1503
+ rawBodyText: bodyText
1504
+ });
1505
+ }
1506
+ __name(buildRequestError, "buildRequestError");
1507
+ function buildUnknownResponseMessage(args) {
1508
+ const { status, contentType, ray_id, request_id } = args;
1509
+ const base = `Request to Notion API failed with status: ${status}`;
1510
+ if (ray_id === void 0 || request_id !== void 0) {
1511
+ return base;
1512
+ }
1513
+ const contentTypeNote = contentType !== void 0 ? ` (content-type: ${contentType})` : "";
1514
+ const blockedRequestNote = status === 403 ? " This may mean the request was blocked by a network security rule." : "";
1515
+ return `${base}. The response was returned by Notion's edge proxy before reaching the Notion API${contentTypeNote}.${blockedRequestNote} Cloudflare Ray ID: ${ray_id}. Include this ID when contacting Notion support.`;
1516
+ }
1517
+ __name(buildUnknownResponseMessage, "buildUnknownResponseMessage");
1518
+ function parseAPIErrorResponseBody(body) {
1519
+ if (typeof body !== "string") {
1520
+ return;
1521
+ }
1522
+ let parsed;
1523
+ try {
1524
+ parsed = JSON.parse(body);
1525
+ } catch (parseError) {
1526
+ return;
1527
+ }
1528
+ if (!(0, utils_1.isObject)(parsed) || typeof parsed["message"] !== "string" || !isAPIErrorCode(parsed["code"])) {
1529
+ return;
1530
+ }
1531
+ const additional_data = parsed["additional_data"];
1532
+ const request_id = parsed["request_id"];
1533
+ return {
1534
+ ...parsed,
1535
+ code: parsed["code"],
1536
+ message: parsed["message"],
1537
+ additional_data,
1538
+ request_id
1539
+ };
1540
+ }
1541
+ __name(parseAPIErrorResponseBody, "parseAPIErrorResponseBody");
1542
+ function isAPIErrorCode(code) {
1543
+ return typeof code === "string" && code in apiErrorCodes;
1544
+ }
1545
+ __name(isAPIErrorCode, "isAPIErrorCode");
1546
+ }
1547
+ });
1548
+
1549
+ // node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/constants.js
1550
+ var require_constants = __commonJS({
1551
+ "node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/constants.js"(exports) {
1552
+ "use strict";
1553
+ Object.defineProperty(exports, "__esModule", { value: true });
1554
+ exports.MIN_VIEW_COLUMN_WIDTH = exports.DEFAULT_MAX_RETRY_DELAY_MS = exports.DEFAULT_INITIAL_RETRY_DELAY_MS = exports.DEFAULT_MAX_RETRIES = exports.DEFAULT_TIMEOUT_MS = exports.DEFAULT_BASE_URL = void 0;
1555
+ exports.DEFAULT_BASE_URL = "https://api.notion.com";
1556
+ exports.DEFAULT_TIMEOUT_MS = 6e4;
1557
+ exports.DEFAULT_MAX_RETRIES = 2;
1558
+ exports.DEFAULT_INITIAL_RETRY_DELAY_MS = 1e3;
1559
+ exports.DEFAULT_MAX_RETRY_DELAY_MS = 6e4;
1560
+ exports.MIN_VIEW_COLUMN_WIDTH = 32;
1561
+ }
1562
+ });
1563
+
1564
+ // node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/package.json
1565
+ var require_package = __commonJS({
1566
+ "node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/package.json"(exports, module) {
1567
+ module.exports = {
1568
+ name: "@notionhq/client",
1569
+ version: "5.31.1",
1570
+ description: "A simple and easy to use client for the Notion API",
1571
+ engines: {
1572
+ node: ">=22"
1573
+ },
1574
+ devEngines: {
1575
+ packageManager: {
1576
+ name: "npm",
1577
+ version: ">=11.10.0"
1578
+ }
1579
+ },
1580
+ homepage: "https://developers.notion.com/docs/getting-started",
1581
+ bugs: {
1582
+ url: "https://github.com/makenotion/notion-sdk-js/issues"
1583
+ },
1584
+ repository: {
1585
+ type: "git",
1586
+ url: "https://github.com/makenotion/notion-sdk-js/"
1587
+ },
1588
+ keywords: [
1589
+ "notion",
1590
+ "notionapi",
1591
+ "rest",
1592
+ "notion-api"
1593
+ ],
1594
+ main: "./build/src",
1595
+ types: "./build/src/index.d.ts",
1596
+ scripts: {
1597
+ prepare: "husky && npm run build",
1598
+ prepublishOnly: "npm run checkLoggedIn && npm run lint && npm run test",
1599
+ build: "tsc",
1600
+ prettier: "prettier --write .",
1601
+ lint: "prettier --check . && eslint . --ext .ts,.js && cspell '**/*'",
1602
+ test: "jest ./test",
1603
+ "check:compatibility": "node build/test/checkCompatibility.js",
1604
+ "check-links": "bash scripts/check-links.sh",
1605
+ prebuild: "npm run clean",
1606
+ clean: "rm -rf ./build",
1607
+ checkLoggedIn: "./scripts/verifyLoggedIn.sh"
1608
+ },
1609
+ "lint-staged": {
1610
+ "*.{ts,js,json,md}": "prettier --write",
1611
+ "*.{ts,js}": "eslint --fix"
1612
+ },
1613
+ author: "",
1614
+ license: "MIT",
1615
+ files: [
1616
+ "build/package.json",
1617
+ "build/src/**"
1618
+ ],
1619
+ devDependencies: {
1620
+ "@eslint/js": "10.0.1",
1621
+ "@types/jest": "30.0.0",
1622
+ "@typescript-eslint/eslint-plugin": "8.72.1",
1623
+ "@typescript-eslint/parser": "8.72.1",
1624
+ cspell: "10.4.0",
1625
+ eslint: "10.13.0",
1626
+ globals: "17.13.0",
1627
+ husky: "9.1.7",
1628
+ jest: "30.5.2",
1629
+ "lint-staged": "17.6.0",
1630
+ prettier: "3.9.10",
1631
+ "ts-jest": "29.4.15",
1632
+ typescript: "6.0.3"
1633
+ }
1634
+ };
1635
+ }
1636
+ });
1637
+
1638
+ // node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/Client.js
1639
+ var require_Client = __commonJS({
1640
+ "node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/Client.js"(exports) {
1641
+ "use strict";
1642
+ var __classPrivateFieldSet = exports && exports.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
1643
+ if (kind === "m") throw new TypeError("Private method is not writable");
1644
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
1645
+ 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");
1646
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
1647
+ };
1648
+ var __classPrivateFieldGet = exports && exports.__classPrivateFieldGet || function(receiver, state, kind, f) {
1649
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
1650
+ 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");
1651
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
1652
+ };
1653
+ var _Client_endpointMethods;
1654
+ var _Client_auth;
1655
+ var _Client_logLevel;
1656
+ var _Client_logger;
1657
+ var _Client_prefixUrl;
1658
+ var _Client_timeoutMs;
1659
+ var _Client_notionVersion;
1660
+ var _Client_fetch;
1661
+ var _Client_agent;
1662
+ var _Client_userAgent;
1663
+ var _Client_maxRetries;
1664
+ var _Client_initialRetryDelayMs;
1665
+ var _Client_maxRetryDelayMs;
1666
+ var _Client_dangerouslyAllowBrowser;
1667
+ Object.defineProperty(exports, "__esModule", { value: true });
1668
+ var api_endpoint_methods_1 = require_api_endpoint_methods();
1669
+ var logging_1 = require_logging();
1670
+ var errors_1 = require_errors();
1671
+ var utils_1 = require_utils();
1672
+ var constants_1 = require_constants();
1673
+ var api_endpoints_1 = require_api_endpoints();
1674
+ var meeting_notes_1 = require_meeting_notes();
1675
+ var package_json_1 = require_package();
1676
+ var START_CURSOR_PARAM_NAME = "start_cursor";
1677
+ function isBrowserEnvironment() {
1678
+ var _a;
1679
+ const browserGlobals = globalThis;
1680
+ if (((_a = browserGlobals.window) === null || _a === void 0 ? void 0 : _a.document) !== void 0) {
1681
+ return true;
1682
+ }
1683
+ const workerGlobalScope = browserGlobals.WorkerGlobalScope;
1684
+ return typeof workerGlobalScope === "function" && globalThis instanceof workerGlobalScope && typeof browserGlobals.importScripts === "function";
1685
+ }
1686
+ __name(isBrowserEnvironment, "isBrowserEnvironment");
1687
+ var Client = class _Client {
1688
+ static {
1689
+ __name(this, "Client");
1690
+ }
1691
+ constructor(options) {
1692
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
1693
+ _Client_endpointMethods.set(this, (0, api_endpoint_methods_1.createEndpointMethods)({
1694
+ request: /* @__PURE__ */ __name((args) => this.request(args), "request"),
1695
+ warnUnknownParams: /* @__PURE__ */ __name((args, endpoint) => this.warnUnknownParams(args, endpoint), "warnUnknownParams")
1696
+ }));
1697
+ _Client_auth.set(this, void 0);
1698
+ _Client_logLevel.set(this, void 0);
1699
+ _Client_logger.set(this, void 0);
1700
+ _Client_prefixUrl.set(this, void 0);
1701
+ _Client_timeoutMs.set(this, void 0);
1702
+ _Client_notionVersion.set(this, void 0);
1703
+ _Client_fetch.set(this, void 0);
1704
+ _Client_agent.set(this, void 0);
1705
+ _Client_userAgent.set(this, void 0);
1706
+ _Client_maxRetries.set(this, void 0);
1707
+ _Client_initialRetryDelayMs.set(this, void 0);
1708
+ _Client_maxRetryDelayMs.set(this, void 0);
1709
+ _Client_dangerouslyAllowBrowser.set(this, void 0);
1710
+ this.plugins = {
1711
+ list: __classPrivateFieldGet(this, _Client_endpointMethods, "f").plugins.list,
1712
+ retrieve: /* @__PURE__ */ __name((args) => __classPrivateFieldGet(this, _Client_endpointMethods, "f").plugins.retrieve({
1713
+ ...args,
1714
+ // Plugin IDs can be tag IDs containing URL delimiters, not just UUIDs.
1715
+ id: encodeURIComponent(args.id)
1716
+ }), "retrieve")
1717
+ };
1718
+ this.skills = __classPrivateFieldGet(this, _Client_endpointMethods, "f").skills;
1719
+ this.agents = __classPrivateFieldGet(this, _Client_endpointMethods, "f").agents;
1720
+ this.sessions = {
1721
+ /**
1722
+ * Retrieve a session
1723
+ */
1724
+ retrieve: __classPrivateFieldGet(this, _Client_endpointMethods, "f").sessions.retrieve,
1725
+ /**
1726
+ * Update a session
1727
+ */
1728
+ update: __classPrivateFieldGet(this, _Client_endpointMethods, "f").sessions.update,
1729
+ /**
1730
+ * Open a session stream
1731
+ */
1732
+ stream: /* @__PURE__ */ __name((args) => {
1733
+ this.warnUnknownParams(args, api_endpoints_1.updateSessionStream);
1734
+ return this.streamRequest({
1735
+ path: api_endpoints_1.updateSessionStream.path(),
1736
+ method: api_endpoints_1.updateSessionStream.method,
1737
+ query: (0, utils_1.pick)(args, api_endpoints_1.updateSessionStream.queryParams),
1738
+ body: (0, utils_1.pick)(args, api_endpoints_1.updateSessionStream.bodyParams),
1739
+ ...(0, utils_1.getEndpointRequestOptions)(args, api_endpoints_1.updateSessionStream.headers)
1740
+ }, parseSessionStreamEvent);
1741
+ }, "stream"),
1742
+ /**
1743
+ * Cancel a session
1744
+ */
1745
+ cancel: __classPrivateFieldGet(this, _Client_endpointMethods, "f").sessions.cancel,
1746
+ /**
1747
+ * Query sessions
1748
+ */
1749
+ query: __classPrivateFieldGet(this, _Client_endpointMethods, "f").sessions.query,
1750
+ /**
1751
+ * Query session events
1752
+ */
1753
+ queryEvents: __classPrivateFieldGet(this, _Client_endpointMethods, "f").sessions.queryEvents
1754
+ };
1755
+ this.asyncTasks = __classPrivateFieldGet(this, _Client_endpointMethods, "f").asyncTasks;
1756
+ this.blocks = {
1757
+ /**
1758
+ * Retrieve block
1759
+ */
1760
+ retrieve: __classPrivateFieldGet(this, _Client_endpointMethods, "f").blocks.retrieve,
1761
+ /**
1762
+ * Update block
1763
+ */
1764
+ update: __classPrivateFieldGet(this, _Client_endpointMethods, "f").blocks.update,
1765
+ /**
1766
+ * Delete block
1767
+ */
1768
+ delete: __classPrivateFieldGet(this, _Client_endpointMethods, "f").blocks.delete,
1769
+ children: __classPrivateFieldGet(this, _Client_endpointMethods, "f").blocks.children,
1770
+ meetingNotes: {
1771
+ /**
1772
+ * Create a meeting note
1773
+ */
1774
+ create: __classPrivateFieldGet(this, _Client_endpointMethods, "f").blocks.meetingNotes.create,
1775
+ /**
1776
+ * Query meeting notes
1777
+ */
1778
+ query: /* @__PURE__ */ __name((args) => {
1779
+ return this.request({
1780
+ path: meeting_notes_1.queryMeetingNotes.path(),
1781
+ method: meeting_notes_1.queryMeetingNotes.method,
1782
+ query: (0, utils_1.pick)(args, meeting_notes_1.queryMeetingNotes.queryParams),
1783
+ body: (0, utils_1.pick)(args, meeting_notes_1.queryMeetingNotes.bodyParams),
1784
+ ...(0, utils_1.getEndpointRequestOptions)(args)
1785
+ });
1786
+ }, "query")
1787
+ }
1788
+ };
1789
+ this.databases = __classPrivateFieldGet(this, _Client_endpointMethods, "f").databases;
1790
+ this.dataSources = __classPrivateFieldGet(this, _Client_endpointMethods, "f").dataSources;
1791
+ this.pages = {
1792
+ /**
1793
+ * Create a page
1794
+ */
1795
+ create: __classPrivateFieldGet(this, _Client_endpointMethods, "f").pages.create,
1796
+ /**
1797
+ * Retrieve a page
1798
+ */
1799
+ retrieve: __classPrivateFieldGet(this, _Client_endpointMethods, "f").pages.retrieve,
1800
+ /**
1801
+ * Update page properties
1802
+ */
1803
+ update: __classPrivateFieldGet(this, _Client_endpointMethods, "f").pages.update,
1804
+ /**
1805
+ * Move a page
1806
+ */
1807
+ move: __classPrivateFieldGet(this, _Client_endpointMethods, "f").pages.move,
1808
+ /**
1809
+ * Retrieve a page as markdown
1810
+ */
1811
+ retrieveMarkdown: /* @__PURE__ */ __name((args) => {
1812
+ return this.request({
1813
+ path: api_endpoints_1.getPageMarkdown.path(args),
1814
+ method: api_endpoints_1.getPageMarkdown.method,
1815
+ query: (0, utils_1.pick)(args, api_endpoints_1.getPageMarkdown.queryParams),
1816
+ body: (0, utils_1.pick)(args, api_endpoints_1.getPageMarkdown.bodyParams),
1817
+ ...(0, utils_1.getEndpointRequestOptions)(args)
1818
+ });
1819
+ }, "retrieveMarkdown"),
1820
+ /**
1821
+ * Update a page's content as markdown
1822
+ */
1823
+ updateMarkdown: /* @__PURE__ */ __name((args) => {
1824
+ return this.request({
1825
+ path: api_endpoints_1.updatePageMarkdown.path(args),
1826
+ method: api_endpoints_1.updatePageMarkdown.method,
1827
+ query: (0, utils_1.pick)(args, api_endpoints_1.updatePageMarkdown.queryParams),
1828
+ body: (0, utils_1.pick)(args, api_endpoints_1.updatePageMarkdown.bodyParams),
1829
+ ...(0, utils_1.getEndpointRequestOptions)(args)
1830
+ });
1831
+ }, "updateMarkdown"),
1832
+ properties: __classPrivateFieldGet(this, _Client_endpointMethods, "f").pages.properties
1833
+ };
1834
+ this.users = __classPrivateFieldGet(this, _Client_endpointMethods, "f").users;
1835
+ this.customEmojis = {
1836
+ /**
1837
+ * List custom emojis
1838
+ */
1839
+ list: /* @__PURE__ */ __name((args) => {
1840
+ this.warnUnknownParams(args !== null && args !== void 0 ? args : {}, api_endpoints_1.listCustomEmojis);
1841
+ return this.request({
1842
+ path: api_endpoints_1.listCustomEmojis.path(),
1843
+ method: api_endpoints_1.listCustomEmojis.method,
1844
+ query: (0, utils_1.pick)(args !== null && args !== void 0 ? args : {}, api_endpoints_1.listCustomEmojis.queryParams),
1845
+ body: (0, utils_1.pick)(args !== null && args !== void 0 ? args : {}, api_endpoints_1.listCustomEmojis.bodyParams),
1846
+ ...(0, utils_1.getEndpointRequestOptions)(args)
1847
+ });
1848
+ }, "list")
1849
+ };
1850
+ this.comments = __classPrivateFieldGet(this, _Client_endpointMethods, "f").comments;
1851
+ this.fileUploads = {
1852
+ /**
1853
+ * Create a file upload
1854
+ */
1855
+ create: __classPrivateFieldGet(this, _Client_endpointMethods, "f").fileUploads.create,
1856
+ /**
1857
+ * Retrieve a file upload
1858
+ */
1859
+ retrieve: /* @__PURE__ */ __name((args) => {
1860
+ this.warnUnknownParams(args, api_endpoints_1.getFileUpload);
1861
+ return this.request({
1862
+ path: api_endpoints_1.getFileUpload.path(args),
1863
+ method: api_endpoints_1.getFileUpload.method,
1864
+ query: (0, utils_1.pick)(args, api_endpoints_1.getFileUpload.queryParams),
1865
+ ...(0, utils_1.getEndpointRequestOptions)(args)
1866
+ });
1867
+ }, "retrieve"),
1868
+ /**
1869
+ * List file uploads
1870
+ */
1871
+ list: /* @__PURE__ */ __name((args) => {
1872
+ this.warnUnknownParams(args, api_endpoints_1.listFileUploads);
1873
+ return this.request({
1874
+ path: api_endpoints_1.listFileUploads.path(),
1875
+ method: api_endpoints_1.listFileUploads.method,
1876
+ query: (0, utils_1.pick)(args, api_endpoints_1.listFileUploads.queryParams),
1877
+ ...(0, utils_1.getEndpointRequestOptions)(args)
1878
+ });
1879
+ }, "list"),
1880
+ /**
1881
+ * Send a file upload
1882
+ *
1883
+ * Requires a `file_upload_id`, obtained from the `id` of the Create File
1884
+ * Upload API response.
1885
+ *
1886
+ * The `file` parameter contains the raw file contents or Blob/File object
1887
+ * under `file.data`, and an optional `file.filename` string.
1888
+ *
1889
+ * Supply a stringified `part_number` parameter when using file uploads
1890
+ * in multi-part mode.
1891
+ *
1892
+ * This endpoint sends HTTP multipart/form-data instead of JSON parameters.
1893
+ */
1894
+ send: /* @__PURE__ */ __name((args) => {
1895
+ this.warnUnknownParams(args, api_endpoints_1.sendFileUpload);
1896
+ return this.request({
1897
+ path: api_endpoints_1.sendFileUpload.path(args),
1898
+ method: api_endpoints_1.sendFileUpload.method,
1899
+ query: (0, utils_1.pick)(args, api_endpoints_1.sendFileUpload.queryParams),
1900
+ formDataParams: (0, utils_1.pick)(args, api_endpoints_1.sendFileUpload.formDataParams),
1901
+ ...(0, utils_1.getEndpointRequestOptions)(args)
1902
+ });
1903
+ }, "send"),
1904
+ /**
1905
+ * Complete a file upload
1906
+ */
1907
+ complete: /* @__PURE__ */ __name((args) => {
1908
+ this.warnUnknownParams(args, api_endpoints_1.completeFileUpload);
1909
+ return this.request({
1910
+ path: api_endpoints_1.completeFileUpload.path(args),
1911
+ method: api_endpoints_1.completeFileUpload.method,
1912
+ query: (0, utils_1.pick)(args, api_endpoints_1.completeFileUpload.queryParams),
1913
+ ...(0, utils_1.getEndpointRequestOptions)(args)
1914
+ });
1915
+ }, "complete")
1916
+ };
1917
+ this.views = {
1918
+ /**
1919
+ * Create a view
1920
+ */
1921
+ create: /* @__PURE__ */ __name((args) => {
1922
+ return this.request({
1923
+ path: api_endpoints_1.createView.path(),
1924
+ method: api_endpoints_1.createView.method,
1925
+ query: (0, utils_1.pick)(args, api_endpoints_1.createView.queryParams),
1926
+ body: (0, utils_1.pick)(args, [
1927
+ "data_source_id",
1928
+ "name",
1929
+ "type",
1930
+ "database_id",
1931
+ "view_id",
1932
+ "filter",
1933
+ "sorts",
1934
+ "quick_filters",
1935
+ "create_database",
1936
+ "configuration",
1937
+ "position",
1938
+ "placement"
1939
+ ]),
1940
+ ...(0, utils_1.getEndpointRequestOptions)(args)
1941
+ });
1942
+ }, "create"),
1943
+ /**
1944
+ * Retrieve a view
1945
+ */
1946
+ retrieve: __classPrivateFieldGet(this, _Client_endpointMethods, "f").views.retrieve,
1947
+ /**
1948
+ * Update a view
1949
+ */
1950
+ update: /* @__PURE__ */ __name((args) => {
1951
+ return this.request({
1952
+ path: api_endpoints_1.updateView.path(args),
1953
+ method: api_endpoints_1.updateView.method,
1954
+ query: (0, utils_1.pick)(args, api_endpoints_1.updateView.queryParams),
1955
+ body: (0, utils_1.pick)(args, [
1956
+ "name",
1957
+ "filter",
1958
+ "sorts",
1959
+ "quick_filters",
1960
+ "configuration"
1961
+ ]),
1962
+ ...(0, utils_1.getEndpointRequestOptions)(args)
1963
+ });
1964
+ }, "update"),
1965
+ /**
1966
+ * Delete a view
1967
+ */
1968
+ delete: __classPrivateFieldGet(this, _Client_endpointMethods, "f").views.delete,
1969
+ /**
1970
+ * List views for a database
1971
+ */
1972
+ list: __classPrivateFieldGet(this, _Client_endpointMethods, "f").views.list,
1973
+ queries: {
1974
+ /**
1975
+ * Create a view query
1976
+ */
1977
+ create: /* @__PURE__ */ __name((args) => {
1978
+ return this.request({
1979
+ path: api_endpoints_1.createViewQuery.path(args),
1980
+ method: api_endpoints_1.createViewQuery.method,
1981
+ query: (0, utils_1.pick)(args, api_endpoints_1.createViewQuery.queryParams),
1982
+ body: (0, utils_1.pick)(args, ["page_size"]),
1983
+ ...(0, utils_1.getEndpointRequestOptions)(args)
1984
+ });
1985
+ }, "create"),
1986
+ /**
1987
+ * Get view query results
1988
+ */
1989
+ results: __classPrivateFieldGet(this, _Client_endpointMethods, "f").views.queries.results,
1990
+ /**
1991
+ * Delete a view query
1992
+ */
1993
+ delete: __classPrivateFieldGet(this, _Client_endpointMethods, "f").views.queries.delete
1994
+ }
1995
+ };
1996
+ this.search = __classPrivateFieldGet(this, _Client_endpointMethods, "f").search;
1997
+ this.oauth = {
1998
+ /**
1999
+ * Get token
2000
+ */
2001
+ token: /* @__PURE__ */ __name((args) => {
2002
+ return this.request({
2003
+ path: api_endpoints_1.oauthToken.path(),
2004
+ method: api_endpoints_1.oauthToken.method,
2005
+ query: (0, utils_1.pick)(args, api_endpoints_1.oauthToken.queryParams),
2006
+ body: (0, utils_1.pick)(args, api_endpoints_1.oauthToken.bodyParams),
2007
+ ...getOAuthRequestOptions(args)
2008
+ });
2009
+ }, "token"),
2010
+ /**
2011
+ * Introspect token
2012
+ */
2013
+ introspect: /* @__PURE__ */ __name((args) => {
2014
+ return this.request({
2015
+ path: api_endpoints_1.oauthIntrospect.path(),
2016
+ method: api_endpoints_1.oauthIntrospect.method,
2017
+ query: (0, utils_1.pick)(args, api_endpoints_1.oauthIntrospect.queryParams),
2018
+ body: (0, utils_1.pick)(args, api_endpoints_1.oauthIntrospect.bodyParams),
2019
+ ...getOAuthRequestOptions(args)
2020
+ });
2021
+ }, "introspect"),
2022
+ /**
2023
+ * Revoke token
2024
+ */
2025
+ revoke: /* @__PURE__ */ __name((args) => {
2026
+ return this.request({
2027
+ path: api_endpoints_1.oauthRevoke.path(),
2028
+ method: api_endpoints_1.oauthRevoke.method,
2029
+ query: (0, utils_1.pick)(args, api_endpoints_1.oauthRevoke.queryParams),
2030
+ body: (0, utils_1.pick)(args, api_endpoints_1.oauthRevoke.bodyParams),
2031
+ ...getOAuthRequestOptions(args)
2032
+ });
2033
+ }, "revoke")
2034
+ };
2035
+ __classPrivateFieldSet(this, _Client_auth, options === null || options === void 0 ? void 0 : options.auth, "f");
2036
+ __classPrivateFieldSet(this, _Client_logLevel, (_a = options === null || options === void 0 ? void 0 : options.logLevel) !== null && _a !== void 0 ? _a : logging_1.LogLevel.WARN, "f");
2037
+ __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");
2038
+ __classPrivateFieldSet(this, _Client_prefixUrl, `${(_c = options === null || options === void 0 ? void 0 : options.baseUrl) !== null && _c !== void 0 ? _c : constants_1.DEFAULT_BASE_URL}/v1/`, "f");
2039
+ __classPrivateFieldSet(this, _Client_timeoutMs, (_d = options === null || options === void 0 ? void 0 : options.timeoutMs) !== null && _d !== void 0 ? _d : constants_1.DEFAULT_TIMEOUT_MS, "f");
2040
+ __classPrivateFieldSet(this, _Client_notionVersion, (_e = options === null || options === void 0 ? void 0 : options.notionVersion) !== null && _e !== void 0 ? _e : _Client.defaultNotionVersion, "f");
2041
+ __classPrivateFieldSet(this, _Client_fetch, (_f = options === null || options === void 0 ? void 0 : options.fetch) !== null && _f !== void 0 ? _f : fetch.bind(globalThis), "f");
2042
+ __classPrivateFieldSet(this, _Client_agent, options === null || options === void 0 ? void 0 : options.agent, "f");
2043
+ __classPrivateFieldSet(this, _Client_userAgent, `notionhq-client/${package_json_1.version}`, "f");
2044
+ if ((options === null || options === void 0 ? void 0 : options.retry) === false) {
2045
+ __classPrivateFieldSet(this, _Client_maxRetries, 0, "f");
2046
+ __classPrivateFieldSet(this, _Client_initialRetryDelayMs, 0, "f");
2047
+ __classPrivateFieldSet(this, _Client_maxRetryDelayMs, 0, "f");
2048
+ } else {
2049
+ __classPrivateFieldSet(this, _Client_maxRetries, (_h = (_g = options === null || options === void 0 ? void 0 : options.retry) === null || _g === void 0 ? void 0 : _g.maxRetries) !== null && _h !== void 0 ? _h : constants_1.DEFAULT_MAX_RETRIES, "f");
2050
+ __classPrivateFieldSet(this, _Client_initialRetryDelayMs, (_k = (_j = options === null || options === void 0 ? void 0 : options.retry) === null || _j === void 0 ? void 0 : _j.initialRetryDelayMs) !== null && _k !== void 0 ? _k : constants_1.DEFAULT_INITIAL_RETRY_DELAY_MS, "f");
2051
+ __classPrivateFieldSet(this, _Client_maxRetryDelayMs, (_m = (_l = options === null || options === void 0 ? void 0 : options.retry) === null || _l === void 0 ? void 0 : _l.maxRetryDelayMs) !== null && _m !== void 0 ? _m : constants_1.DEFAULT_MAX_RETRY_DELAY_MS, "f");
2052
+ }
2053
+ __classPrivateFieldSet(this, _Client_dangerouslyAllowBrowser, (_o = options === null || options === void 0 ? void 0 : options.dangerouslyAllowBrowser) !== null && _o !== void 0 ? _o : false, "f");
2054
+ if ((options === null || options === void 0 ? void 0 : options.auth) !== void 0) {
2055
+ this.assertTokenAllowedHere();
2056
+ }
2057
+ }
2058
+ /**
2059
+ * Sends a request.
2060
+ */
2061
+ async request(args) {
2062
+ const { path, method, query, body, formDataParams, auth } = args;
2063
+ (0, errors_1.validateRequestPath)(path);
2064
+ this.log(logging_1.LogLevel.INFO, "request start", { method, path });
2065
+ const url = this.buildRequestUrl(path, query);
2066
+ const bodyAsJsonString = this.serializeBody(body);
2067
+ const headers = this.buildRequestHeaders(args.headers, auth, bodyAsJsonString);
2068
+ const formData = this.buildFormData(formDataParams, headers);
2069
+ return this.executeWithRetry({
2070
+ url,
2071
+ method,
2072
+ path,
2073
+ headers,
2074
+ body: bodyAsJsonString !== null && bodyAsJsonString !== void 0 ? bodyAsJsonString : formData
2075
+ }, (request) => this.executeSingleRequest(request));
2076
+ }
2077
+ /**
2078
+ * Opens an SSE response and yields each parsed event as it arrives.
2079
+ */
2080
+ async *streamRequest(args, parseEvent) {
2081
+ var _a;
2082
+ const { path, method, query, body, auth } = args;
2083
+ (0, errors_1.validateRequestPath)(path);
2084
+ this.log(logging_1.LogLevel.INFO, "stream request start", { method, path });
2085
+ const url = this.buildRequestUrl(path, query);
2086
+ const bodyAsJsonString = this.serializeBody(body);
2087
+ const headers = this.buildRequestHeaders(args.headers, auth, bodyAsJsonString);
2088
+ const response = await this.executeWithRetry({
2089
+ url,
2090
+ method,
2091
+ path,
2092
+ headers,
2093
+ body: bodyAsJsonString
2094
+ }, (request) => this.executeSingleStreamRequest(request));
2095
+ this.log(logging_1.LogLevel.INFO, "stream request opened", { method, path });
2096
+ if (response.body === void 0 || response.body === null) {
2097
+ for (const frame of takeSseFrames({
2098
+ content: await response.text(),
2099
+ complete: true
2100
+ }).frames) {
2101
+ yield parseEvent(frame);
2102
+ }
2103
+ return;
2104
+ }
2105
+ const reader = response.body.getReader();
2106
+ const decoder = new TextDecoder();
2107
+ let remaining = "";
2108
+ let complete = false;
2109
+ try {
2110
+ while (!complete) {
2111
+ const { done, value } = await reader.read();
2112
+ if (done) {
2113
+ complete = true;
2114
+ continue;
2115
+ }
2116
+ if (value === void 0) {
2117
+ throw new Error("SSE response body ended without a data chunk.");
2118
+ }
2119
+ const frames = takeSseFrames({
2120
+ content: `${remaining}${decoder.decode(value, { stream: true })}`,
2121
+ complete: false
2122
+ });
2123
+ remaining = frames.remaining;
2124
+ for (const frame of frames.frames) {
2125
+ yield parseEvent(frame);
2126
+ }
2127
+ }
2128
+ for (const frame of takeSseFrames({
2129
+ content: `${remaining}${decoder.decode()}`,
2130
+ complete: true
2131
+ }).frames) {
2132
+ yield parseEvent(frame);
2133
+ }
2134
+ } finally {
2135
+ try {
2136
+ if (!complete) {
2137
+ await ((_a = reader.cancel) === null || _a === void 0 ? void 0 : _a.call(reader));
2138
+ }
2139
+ } finally {
2140
+ reader.releaseLock();
2141
+ }
2142
+ }
2143
+ }
2144
+ /**
2145
+ * Builds the full URL with query parameters.
2146
+ */
2147
+ buildRequestUrl(path, query) {
2148
+ const url = new URL(`${__classPrivateFieldGet(this, _Client_prefixUrl, "f")}${path}`);
2149
+ if (query) {
2150
+ for (const [key, value] of Object.entries(query)) {
2151
+ if (value !== void 0 && value !== null) {
2152
+ if (Array.isArray(value)) {
2153
+ for (const val of value) {
2154
+ url.searchParams.append(key, decodeURIComponent(val));
2155
+ }
2156
+ } else {
2157
+ url.searchParams.append(key, String(value));
2158
+ }
2159
+ }
2160
+ }
2161
+ }
2162
+ return url;
2163
+ }
2164
+ /**
2165
+ * Serializes the request body to JSON string if non-empty.
2166
+ */
2167
+ serializeBody(body) {
2168
+ if (!body) {
2169
+ return void 0;
2170
+ }
2171
+ const serializedBody = { ...body };
2172
+ if (serializedBody[START_CURSOR_PARAM_NAME] === null) {
2173
+ delete serializedBody[START_CURSOR_PARAM_NAME];
2174
+ }
2175
+ if (Object.entries(serializedBody).length === 0) {
2176
+ return void 0;
2177
+ }
2178
+ return JSON.stringify(serializedBody);
2179
+ }
2180
+ /**
2181
+ * Builds the request headers including auth and content-type.
2182
+ */
2183
+ buildRequestHeaders(customHeaders, auth, bodyAsJsonString) {
2184
+ const authorizationHeader = this.buildAuthHeader(auth);
2185
+ const headers = {
2186
+ ...customHeaders,
2187
+ ...authorizationHeader,
2188
+ "Notion-Version": __classPrivateFieldGet(this, _Client_notionVersion, "f")
2189
+ };
2190
+ if (!isBrowserEnvironment()) {
2191
+ headers["user-agent"] = __classPrivateFieldGet(this, _Client_userAgent, "f");
2192
+ }
2193
+ if (bodyAsJsonString !== void 0) {
2194
+ headers["content-type"] = "application/json";
2195
+ }
2196
+ return headers;
2197
+ }
2198
+ /**
2199
+ * Builds the authorization header based on auth type.
2200
+ */
2201
+ buildAuthHeader(auth) {
2202
+ if (auth !== void 0) {
2203
+ this.assertTokenAllowedHere();
2204
+ }
2205
+ if (typeof auth === "object") {
2206
+ const unencodedCredential = `${auth.client_id}:${auth.client_secret}`;
2207
+ const encodedCredential = Buffer.from(unencodedCredential).toString("base64");
2208
+ return { authorization: `Basic ${encodedCredential}` };
2209
+ }
2210
+ return this.authAsHeaders(auth);
2211
+ }
2212
+ /**
2213
+ * Builds FormData from form parameters if provided.
2214
+ * Also removes content-type header to let fetch set the boundary.
2215
+ */
2216
+ buildFormData(formDataParams, headers) {
2217
+ if (!formDataParams) {
2218
+ return void 0;
2219
+ }
2220
+ delete headers["content-type"];
2221
+ const formData = new FormData();
2222
+ for (const [key, value] of Object.entries(formDataParams)) {
2223
+ if (typeof value === "string") {
2224
+ formData.append(key, value);
2225
+ } else if (typeof value === "object") {
2226
+ formData.append(key, typeof value.data === "object" ? value.data : new Blob([value.data]), value.filename);
2227
+ }
2228
+ }
2229
+ return formData;
2230
+ }
2231
+ /**
2232
+ * Executes the request with retry logic.
2233
+ */
2234
+ async executeWithRetry(args, execute) {
2235
+ const { url, method, path, headers, body } = args;
2236
+ let attempt = 0;
2237
+ while (true) {
2238
+ try {
2239
+ return await execute({
2240
+ url,
2241
+ method,
2242
+ path,
2243
+ headers,
2244
+ body
2245
+ });
2246
+ } catch (error) {
2247
+ if (!(0, errors_1.isNotionClientError)(error)) {
2248
+ throw error;
2249
+ }
2250
+ this.logRequestError(error, attempt);
2251
+ if (attempt < __classPrivateFieldGet(this, _Client_maxRetries, "f") && this.canRetry(error, method)) {
2252
+ const delayMs = this.calculateRetryDelay(error, attempt);
2253
+ this.log(logging_1.LogLevel.INFO, "retrying request", {
2254
+ method,
2255
+ path,
2256
+ attempt: attempt + 1,
2257
+ delayMs
2258
+ });
2259
+ await this.sleep(delayMs);
2260
+ attempt++;
2261
+ continue;
2262
+ }
2263
+ throw error;
2264
+ }
2265
+ }
2266
+ }
2267
+ /**
2268
+ * Executes a single HTTP request (no retry).
2269
+ */
2270
+ async executeSingleRequest(args) {
2271
+ const { url, method, path, headers, body } = args;
2272
+ const response = await errors_1.RequestTimeoutError.rejectAfterTimeout(__classPrivateFieldGet(this, _Client_fetch, "f").call(this, url.toString(), {
2273
+ method: method.toUpperCase(),
2274
+ headers,
2275
+ body,
2276
+ agent: __classPrivateFieldGet(this, _Client_agent, "f")
2277
+ }), __classPrivateFieldGet(this, _Client_timeoutMs, "f"));
2278
+ const responseText = await response.text();
2279
+ if (!response.ok) {
2280
+ throw (0, errors_1.buildRequestError)(response, responseText);
2281
+ }
2282
+ const responseJson = JSON.parse(responseText);
2283
+ this.log(logging_1.LogLevel.INFO, "request success", {
2284
+ method,
2285
+ path,
2286
+ ...this.extractRequestId(responseJson)
2287
+ });
2288
+ return responseJson;
2289
+ }
2290
+ /**
2291
+ * Opens an SSE response without consuming its body. Retry orchestration is
2292
+ * shared with JSON requests so only the initial, retryable HTTP failures are
2293
+ * retried; once a stream has opened, its events are never replayed.
2294
+ */
2295
+ async executeSingleStreamRequest(args) {
2296
+ const { url, method, body } = args;
2297
+ const response = await errors_1.RequestTimeoutError.rejectAfterTimeout(__classPrivateFieldGet(this, _Client_fetch, "f").call(this, url.toString(), {
2298
+ method: method.toUpperCase(),
2299
+ headers: args.headers,
2300
+ body,
2301
+ agent: __classPrivateFieldGet(this, _Client_agent, "f")
2302
+ }), __classPrivateFieldGet(this, _Client_timeoutMs, "f"));
2303
+ if (!response.ok) {
2304
+ throw (0, errors_1.buildRequestError)(response, await response.text());
2305
+ }
2306
+ return response;
2307
+ }
2308
+ /**
2309
+ * Logs a request error with appropriate detail level.
2310
+ */
2311
+ logRequestError(error, attempt) {
2312
+ this.log(logging_1.LogLevel.WARN, "request fail", {
2313
+ code: error.code,
2314
+ message: error.message,
2315
+ attempt,
2316
+ ...this.extractRequestId(error)
2317
+ });
2318
+ if ((0, errors_1.isHTTPResponseError)(error)) {
2319
+ this.log(logging_1.LogLevel.DEBUG, "failed response body", {
2320
+ body: error.body
2321
+ });
2322
+ }
2323
+ }
2324
+ /**
2325
+ * Extracts request_id from an object if present.
2326
+ */
2327
+ extractRequestId(obj) {
2328
+ if (obj && typeof obj === "object" && "request_id" in obj && typeof obj.request_id === "string") {
2329
+ return { requestId: obj.request_id };
2330
+ }
2331
+ return {};
2332
+ }
2333
+ /**
2334
+ * Determines if an error can be retried based on its error code and method.
2335
+ * Rate limits (429) and service overloads (529) are always retryable since
2336
+ * the server explicitly asks us to retry. Server errors (500, 503) are only
2337
+ * retried for idempotent methods (GET, DELETE) to avoid duplicate side
2338
+ * effects.
2339
+ */
2340
+ canRetry(error, method) {
2341
+ if (!errors_1.APIResponseError.isAPIResponseError(error)) {
2342
+ return false;
2343
+ }
2344
+ if (error.code === errors_1.APIErrorCode.RateLimited || error.code === errors_1.APIErrorCode.ServiceOverload) {
2345
+ return true;
2346
+ }
2347
+ const isIdempotent = method === "get" || method === "delete";
2348
+ if (isIdempotent) {
2349
+ return error.code === errors_1.APIErrorCode.InternalServerError || error.code === errors_1.APIErrorCode.ServiceUnavailable;
2350
+ }
2351
+ return false;
2352
+ }
2353
+ /**
2354
+ * Calculates the delay before the next retry attempt.
2355
+ * Uses retry-after header if present, otherwise exponential back-off with
2356
+ * jitter.
2357
+ */
2358
+ calculateRetryDelay(error, attempt) {
2359
+ if (errors_1.APIResponseError.isAPIResponseError(error)) {
2360
+ const retryAfterMs = this.parseRetryAfterHeader(error.headers);
2361
+ if (retryAfterMs !== void 0) {
2362
+ return Math.min(retryAfterMs, __classPrivateFieldGet(this, _Client_maxRetryDelayMs, "f"));
2363
+ }
2364
+ }
2365
+ const baseDelay = __classPrivateFieldGet(this, _Client_initialRetryDelayMs, "f") * Math.pow(2, attempt);
2366
+ const jitter = Math.random();
2367
+ return Math.min(baseDelay * jitter + baseDelay / 2, __classPrivateFieldGet(this, _Client_maxRetryDelayMs, "f"));
2368
+ }
2369
+ /**
2370
+ * Parses the retry-after header value.
2371
+ * Supports both delta-seconds (e.g., "120") and HTTP-date formats.
2372
+ * Returns the delay in milliseconds, or undefined if not present or invalid.
2373
+ */
2374
+ parseRetryAfterHeader(headers) {
2375
+ const retryAfterValue = (0, errors_1.getResponseHeader)(headers, "retry-after");
2376
+ if (!retryAfterValue) {
2377
+ return void 0;
2378
+ }
2379
+ const seconds = parseInt(retryAfterValue, 10);
2380
+ if (!isNaN(seconds) && seconds >= 0) {
2381
+ return seconds * 1e3;
2382
+ }
2383
+ const date = Date.parse(retryAfterValue);
2384
+ if (!isNaN(date)) {
2385
+ const delayMs = date - Date.now();
2386
+ return delayMs > 0 ? delayMs : 0;
2387
+ }
2388
+ return void 0;
2389
+ }
2390
+ sleep(ms) {
2391
+ return new Promise((resolve) => setTimeout(resolve, ms));
2392
+ }
2393
+ /**
2394
+ * Logs a warning when the caller passes parameters that are not recognized
2395
+ * by the endpoint definition. This helps catch typos and renamed parameters
2396
+ * (e.g. `archived` vs `in_trash` for `databases.update`) that would
2397
+ * otherwise be silently dropped by `pick()`.
2398
+ */
2399
+ warnUnknownParams(args, endpoint) {
2400
+ var _a;
2401
+ if (!args || typeof args !== "object") {
2402
+ return;
2403
+ }
2404
+ const unknownKeys = (0, utils_1.getUnknownParams)(args, endpoint);
2405
+ if (unknownKeys.length > 0) {
2406
+ this.log(logging_1.LogLevel.WARN, "unknown parameters were ignored", {
2407
+ unknownParams: unknownKeys,
2408
+ knownParams: [
2409
+ ...endpoint.pathParams,
2410
+ ...endpoint.queryParams,
2411
+ ...endpoint.bodyParams,
2412
+ ...(_a = endpoint.formDataParams) !== null && _a !== void 0 ? _a : []
2413
+ ]
2414
+ });
2415
+ }
2416
+ }
2417
+ /**
2418
+ * Emits a log message to the console.
2419
+ *
2420
+ * @param level The level for this message
2421
+ * @param args Arguments to send to the console
2422
+ */
2423
+ log(level, message, extraInfo) {
2424
+ if ((0, logging_1.logLevelSeverity)(level) >= (0, logging_1.logLevelSeverity)(__classPrivateFieldGet(this, _Client_logLevel, "f"))) {
2425
+ __classPrivateFieldGet(this, _Client_logger, "f").call(this, level, message, extraInfo);
2426
+ }
2427
+ }
2428
+ /**
2429
+ * Blocks a token or client secret inside a browser unless the caller opted
2430
+ * in. Covers both the constructor `auth` and per-request `auth`, since a
2431
+ * page that asks the visitor to type a token usually uses the latter. A
2432
+ * client without a token stays usable, for example behind a proxy that
2433
+ * adds the token on a server.
2434
+ */
2435
+ assertTokenAllowedHere() {
2436
+ if (__classPrivateFieldGet(this, _Client_dangerouslyAllowBrowser, "f") || !isBrowserEnvironment()) {
2437
+ return;
2438
+ }
2439
+ throw new errors_1.BrowserTokenNotAllowedError();
2440
+ }
2441
+ /**
2442
+ * Transforms an API key or access token into a headers object suitable for an HTTP request.
2443
+ *
2444
+ * This method uses the instance's value as the default when the input is undefined. If neither are defined, it returns
2445
+ * an empty object
2446
+ *
2447
+ * @param auth API key or access token
2448
+ * @returns headers key-value object
2449
+ */
2450
+ authAsHeaders(auth) {
2451
+ const headers = {};
2452
+ const authHeaderValue = auth !== null && auth !== void 0 ? auth : __classPrivateFieldGet(this, _Client_auth, "f");
2453
+ if (authHeaderValue !== void 0) {
2454
+ headers["authorization"] = `Bearer ${authHeaderValue}`;
2455
+ }
2456
+ return headers;
2457
+ }
2458
+ };
2459
+ _Client_endpointMethods = /* @__PURE__ */ new WeakMap(), _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(), _Client_maxRetries = /* @__PURE__ */ new WeakMap(), _Client_initialRetryDelayMs = /* @__PURE__ */ new WeakMap(), _Client_maxRetryDelayMs = /* @__PURE__ */ new WeakMap(), _Client_dangerouslyAllowBrowser = /* @__PURE__ */ new WeakMap();
2460
+ Client.defaultNotionVersion = "2025-09-03";
2461
+ exports.default = Client;
2462
+ var sessionStreamEventTypes = /* @__PURE__ */ new Set([
2463
+ "session.snapshot",
2464
+ "event.provisional",
2465
+ "event.committed",
2466
+ "stream.timeout",
2467
+ "stream.end",
2468
+ "stream.error"
2469
+ ]);
2470
+ function takeSseFrames(args) {
2471
+ const frames = [];
2472
+ let remaining = args.content.replace(/\r\n/g, "\n");
2473
+ let boundary = remaining.indexOf("\n\n");
2474
+ while (boundary !== -1) {
2475
+ const frame = parseSseFrame(remaining.slice(0, boundary));
2476
+ if (frame !== void 0) {
2477
+ frames.push(frame);
2478
+ }
2479
+ remaining = remaining.slice(boundary + 2);
2480
+ boundary = remaining.indexOf("\n\n");
2481
+ }
2482
+ if (args.complete && remaining !== "") {
2483
+ const frame = parseSseFrame(remaining);
2484
+ if (frame !== void 0) {
2485
+ frames.push(frame);
2486
+ }
2487
+ remaining = "";
2488
+ }
2489
+ return { frames, remaining };
2490
+ }
2491
+ __name(takeSseFrames, "takeSseFrames");
2492
+ function parseSseFrame(content) {
2493
+ let eventName;
2494
+ const dataLines = [];
2495
+ for (const line of content.split("\n")) {
2496
+ if (line.startsWith(":")) {
2497
+ continue;
2498
+ }
2499
+ const colonIndex = line.indexOf(":");
2500
+ if (colonIndex === -1) {
2501
+ continue;
2502
+ }
2503
+ const field = line.slice(0, colonIndex);
2504
+ const valueStart = line.charAt(colonIndex + 1) === " " ? colonIndex + 2 : colonIndex + 1;
2505
+ const value = line.slice(valueStart);
2506
+ if (field === "event") {
2507
+ eventName = value;
2508
+ } else if (field === "data") {
2509
+ dataLines.push(value);
2510
+ }
2511
+ }
2512
+ if (dataLines.length === 0) {
2513
+ return void 0;
2514
+ }
2515
+ if (eventName === void 0) {
2516
+ throw new Error("Session stream event is missing its SSE event name.");
2517
+ }
2518
+ return { eventName, data: dataLines.join("\n") };
2519
+ }
2520
+ __name(parseSseFrame, "parseSseFrame");
2521
+ function parseSessionStreamEvent(frame) {
2522
+ const event = JSON.parse(frame.data);
2523
+ if (typeof event !== "object" || event === null || !sessionStreamEventTypes.has(event.type) || event.type !== frame.eventName) {
2524
+ throw new Error("Session stream event does not match its SSE event name.");
2525
+ }
2526
+ return event;
2527
+ }
2528
+ __name(parseSessionStreamEvent, "parseSessionStreamEvent");
2529
+ function getOAuthRequestOptions(args) {
2530
+ return {
2531
+ ...(0, utils_1.getEndpointRequestOptions)(args),
2532
+ auth: { client_id: args.client_id, client_secret: args.client_secret }
2533
+ };
2534
+ }
2535
+ __name(getOAuthRequestOptions, "getOAuthRequestOptions");
2536
+ }
2537
+ });
2538
+
2539
+ // node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/helpers.js
2540
+ var require_helpers = __commonJS({
2541
+ "node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/helpers.js"(exports) {
2542
+ "use strict";
2543
+ Object.defineProperty(exports, "__esModule", { value: true });
2544
+ exports.iteratePaginatedAPI = iteratePaginatedAPI;
2545
+ exports.collectPaginatedAPI = collectPaginatedAPI;
2546
+ exports.iterateDataSourceTemplates = iterateDataSourceTemplates;
2547
+ exports.collectDataSourceTemplates = collectDataSourceTemplates;
2548
+ exports.iterateAllDataSourceRows = iterateAllDataSourceRows;
2549
+ exports.collectAllDataSourceRows = collectAllDataSourceRows;
2550
+ exports.isFullBlock = isFullBlock;
2551
+ exports.isFullPage = isFullPage;
2552
+ exports.isFullDataSource = isFullDataSource;
2553
+ exports.isFullDatabase = isFullDatabase;
2554
+ exports.isFullPageOrDataSource = isFullPageOrDataSource;
2555
+ exports.isFullUser = isFullUser;
2556
+ exports.isFullComment = isFullComment;
2557
+ exports.isFullView = isFullView;
2558
+ exports.isTextRichTextItemResponse = isTextRichTextItemResponse;
2559
+ exports.isEquationRichTextItemResponse = isEquationRichTextItemResponse;
2560
+ exports.isMentionRichTextItemResponse = isMentionRichTextItemResponse;
2561
+ exports.extractNotionId = extractNotionId;
2562
+ exports.extractDatabaseId = extractDatabaseId;
2563
+ exports.extractPageId = extractPageId;
2564
+ exports.extractBlockId = extractBlockId;
2565
+ async function* iteratePaginatedAPI(listFn, firstPageArgs) {
2566
+ let nextCursor = firstPageArgs.start_cursor;
2567
+ do {
2568
+ const response = await listFn({
2569
+ ...firstPageArgs,
2570
+ start_cursor: nextCursor
2571
+ });
2572
+ yield* response.results;
2573
+ nextCursor = response.next_cursor;
2574
+ } while (nextCursor);
2575
+ }
2576
+ __name(iteratePaginatedAPI, "iteratePaginatedAPI");
2577
+ async function collectPaginatedAPI(listFn, firstPageArgs) {
2578
+ const results = [];
2579
+ for await (const item of iteratePaginatedAPI(listFn, firstPageArgs)) {
2580
+ results.push(item);
2581
+ }
2582
+ return results;
2583
+ }
2584
+ __name(collectPaginatedAPI, "collectPaginatedAPI");
2585
+ async function* iterateDataSourceTemplates(client, args) {
2586
+ let nextCursor = args.start_cursor;
2587
+ do {
2588
+ const response = await client.dataSources.listTemplates({
2589
+ ...args,
2590
+ start_cursor: nextCursor
2591
+ });
2592
+ yield* response.templates;
2593
+ nextCursor = response.next_cursor;
2594
+ } while (nextCursor);
2595
+ }
2596
+ __name(iterateDataSourceTemplates, "iterateDataSourceTemplates");
2597
+ async function collectDataSourceTemplates(client, args) {
2598
+ const results = [];
2599
+ for await (const template of iterateDataSourceTemplates(client, args)) {
2600
+ results.push(template);
2601
+ }
2602
+ return results;
2603
+ }
2604
+ __name(collectDataSourceTemplates, "collectDataSourceTemplates");
2605
+ async function* iterateAllDataSourceRows(client, args) {
2606
+ var _a, _b;
2607
+ const seenRowIds = /* @__PURE__ */ new Set();
2608
+ let windowStart = void 0;
2609
+ for (; ; ) {
2610
+ let limitReached = false;
2611
+ let lastCreatedTime = void 0;
2612
+ let cursor = void 0;
2613
+ do {
2614
+ const response = await client.dataSources.query({
2615
+ ...args,
2616
+ sorts: [{ timestamp: "created_time", direction: "ascending" }],
2617
+ filter: createdTimeLowerBound(args.filter, windowStart),
2618
+ start_cursor: cursor
2619
+ });
2620
+ for (const row of response.results) {
2621
+ if (isFullPageOrDataSource(row)) {
2622
+ lastCreatedTime = row.created_time;
2623
+ }
2624
+ if (!seenRowIds.has(row.id)) {
2625
+ seenRowIds.add(row.id);
2626
+ yield row;
2627
+ }
2628
+ }
2629
+ if (((_a = response.request_status) === null || _a === void 0 ? void 0 : _a.type) === "incomplete") {
2630
+ limitReached = true;
2631
+ }
2632
+ cursor = (_b = response.next_cursor) !== null && _b !== void 0 ? _b : void 0;
2633
+ } while (cursor);
2634
+ if (!limitReached) {
2635
+ return;
2636
+ }
2637
+ if (lastCreatedTime === void 0 || lastCreatedTime === windowStart) {
2638
+ throw new Error(`iterateAllDataSourceRows cannot make progress: the per-query result limit was reached but the created_time window could not advance past ${String(lastCreatedTime)}. More rows share this timestamp than the limit allows. Add a filter to narrow the query.`);
2639
+ }
2640
+ windowStart = lastCreatedTime;
2641
+ }
2642
+ }
2643
+ __name(iterateAllDataSourceRows, "iterateAllDataSourceRows");
2644
+ async function collectAllDataSourceRows(client, args) {
2645
+ const rows = [];
2646
+ for await (const row of iterateAllDataSourceRows(client, args)) {
2647
+ rows.push(row);
2648
+ }
2649
+ return rows;
2650
+ }
2651
+ __name(collectAllDataSourceRows, "collectAllDataSourceRows");
2652
+ function createdTimeLowerBound(filter, windowStart) {
2653
+ if (windowStart === void 0) {
2654
+ return filter;
2655
+ }
2656
+ const bound = {
2657
+ timestamp: "created_time",
2658
+ created_time: { on_or_after: windowStart }
2659
+ };
2660
+ if (filter === void 0) {
2661
+ return bound;
2662
+ }
2663
+ if ("and" in filter) {
2664
+ return { and: [...filter.and, bound] };
2665
+ }
2666
+ return { and: [filter, bound] };
2667
+ }
2668
+ __name(createdTimeLowerBound, "createdTimeLowerBound");
2669
+ function isFullBlock(response) {
2670
+ return response.object === "block" && "type" in response;
2671
+ }
2672
+ __name(isFullBlock, "isFullBlock");
2673
+ function isFullPage(response) {
2674
+ return response.object === "page" && "url" in response;
2675
+ }
2676
+ __name(isFullPage, "isFullPage");
2677
+ function isFullDataSource(response) {
2678
+ return response.object === "data_source" && "title" in response;
2679
+ }
2680
+ __name(isFullDataSource, "isFullDataSource");
2681
+ function isFullDatabase(response) {
2682
+ return response.object === "database" && "title" in response;
2683
+ }
2684
+ __name(isFullDatabase, "isFullDatabase");
2685
+ function isFullPageOrDataSource(response) {
2686
+ if (response.object === "data_source") {
2687
+ return isFullDataSource(response);
2688
+ } else {
2689
+ return isFullPage(response);
2690
+ }
2691
+ }
2692
+ __name(isFullPageOrDataSource, "isFullPageOrDataSource");
2693
+ function isFullUser(response) {
2694
+ return "type" in response;
2695
+ }
2696
+ __name(isFullUser, "isFullUser");
2697
+ function isFullComment(response) {
2698
+ return "created_by" in response;
2699
+ }
2700
+ __name(isFullComment, "isFullComment");
2701
+ function isFullView(response) {
2702
+ return "type" in response;
2703
+ }
2704
+ __name(isFullView, "isFullView");
2705
+ function isTextRichTextItemResponse(richText) {
2706
+ return richText.type === "text";
2707
+ }
2708
+ __name(isTextRichTextItemResponse, "isTextRichTextItemResponse");
2709
+ function isEquationRichTextItemResponse(richText) {
2710
+ return richText.type === "equation";
2711
+ }
2712
+ __name(isEquationRichTextItemResponse, "isEquationRichTextItemResponse");
2713
+ function isMentionRichTextItemResponse(richText) {
2714
+ return richText.type === "mention";
2715
+ }
2716
+ __name(isMentionRichTextItemResponse, "isMentionRichTextItemResponse");
2717
+ function extractNotionId(urlOrId) {
2718
+ if (!urlOrId || typeof urlOrId !== "string") {
2719
+ return null;
2720
+ }
2721
+ const trimmed = urlOrId.trim();
2722
+ const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
2723
+ if (uuidRegex.test(trimmed)) {
2724
+ return trimmed.toLowerCase();
2725
+ }
2726
+ const compactUuidRegex = /^[0-9a-f]{32}$/i;
2727
+ if (compactUuidRegex.test(trimmed)) {
2728
+ return formatUuid(trimmed);
2729
+ }
2730
+ const pathMatch = trimmed.match(/\/(?:[^/?#]*-)?([0-9a-f]{32})(?:[/?#]|$)/i);
2731
+ if (pathMatch && pathMatch[1]) {
2732
+ return formatUuid(pathMatch[1]);
2733
+ }
2734
+ const queryMatch = trimmed.match(/[?&](?:p|page_id|database_id)=([0-9a-f]{32})/i);
2735
+ if (queryMatch && queryMatch[1]) {
2736
+ return formatUuid(queryMatch[1]);
2737
+ }
2738
+ const anyMatch = trimmed.match(/([0-9a-f]{32})/i);
2739
+ if (anyMatch && anyMatch[1]) {
2740
+ return formatUuid(anyMatch[1]);
2741
+ }
2742
+ return null;
2743
+ }
2744
+ __name(extractNotionId, "extractNotionId");
2745
+ function formatUuid(compactId) {
2746
+ const clean = compactId.toLowerCase();
2747
+ return `${clean.slice(0, 8)}-${clean.slice(8, 12)}-${clean.slice(12, 16)}-${clean.slice(16, 20)}-${clean.slice(20, 32)}`;
2748
+ }
2749
+ __name(formatUuid, "formatUuid");
2750
+ function extractDatabaseId(databaseUrl) {
2751
+ return extractNotionId(databaseUrl);
2752
+ }
2753
+ __name(extractDatabaseId, "extractDatabaseId");
2754
+ function extractPageId(pageUrl) {
2755
+ return extractNotionId(pageUrl);
2756
+ }
2757
+ __name(extractPageId, "extractPageId");
2758
+ function extractBlockId(urlWithBlock) {
2759
+ if (!urlWithBlock || typeof urlWithBlock !== "string") {
2760
+ return null;
2761
+ }
2762
+ const blockMatch = urlWithBlock.match(/#(?:block-)?([0-9a-f]{32})/i);
2763
+ if (blockMatch && blockMatch[1]) {
2764
+ return formatUuid(blockMatch[1]);
2765
+ }
2766
+ return null;
2767
+ }
2768
+ __name(extractBlockId, "extractBlockId");
2769
+ }
2770
+ });
2771
+
2772
+ // node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/webhooks.js
2773
+ var require_webhooks2 = __commonJS({
2774
+ "node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/webhooks.js"(exports) {
2775
+ "use strict";
2776
+ Object.defineProperty(exports, "__esModule", { value: true });
2777
+ exports.verifyWebhookSignature = verifyWebhookSignature;
2778
+ exports.signWebhookPayload = signWebhookPayload;
2779
+ var SIGNATURE_PREFIX = "sha256=";
2780
+ var SHA256_HEX_LENGTH = 64;
2781
+ async function verifyWebhookSignature(args) {
2782
+ const { body, signature, verificationToken } = args;
2783
+ if (typeof signature !== "string") {
2784
+ return false;
2785
+ }
2786
+ if (!signature.startsWith(SIGNATURE_PREFIX)) {
2787
+ return false;
2788
+ }
2789
+ const providedHex = signature.slice(SIGNATURE_PREFIX.length).toLowerCase();
2790
+ if (providedHex.length !== SHA256_HEX_LENGTH) {
2791
+ return false;
2792
+ }
2793
+ if (!/^[0-9a-f]+$/.test(providedHex)) {
2794
+ return false;
2795
+ }
2796
+ const key = await importHmacKey(verificationToken, "verify");
2797
+ return globalThis.crypto.subtle.verify("HMAC", key, hexToBytes(providedHex), bodyToBytes(body));
2798
+ }
2799
+ __name(verifyWebhookSignature, "verifyWebhookSignature");
2800
+ async function signWebhookPayload(args) {
2801
+ const key = await importHmacKey(args.verificationToken, "sign");
2802
+ const signature = await globalThis.crypto.subtle.sign("HMAC", key, bodyToBytes(args.body));
2803
+ return `${SIGNATURE_PREFIX}${bytesToHex(new Uint8Array(signature))}`;
2804
+ }
2805
+ __name(signWebhookPayload, "signWebhookPayload");
2806
+ async function importHmacKey(token, usage) {
2807
+ return globalThis.crypto.subtle.importKey("raw", new TextEncoder().encode(token), { name: "HMAC", hash: "SHA-256" }, false, [usage]);
2808
+ }
2809
+ __name(importHmacKey, "importHmacKey");
2810
+ function bodyToBytes(body) {
2811
+ return typeof body === "string" ? new TextEncoder().encode(body) : Uint8Array.from(body);
2812
+ }
2813
+ __name(bodyToBytes, "bodyToBytes");
2814
+ function bytesToHex(bytes) {
2815
+ let hex = "";
2816
+ for (const byte of bytes) {
2817
+ hex += byte.toString(16).padStart(2, "0");
2818
+ }
2819
+ return hex;
2820
+ }
2821
+ __name(bytesToHex, "bytesToHex");
2822
+ function hexToBytes(hex) {
2823
+ const bytes = new Uint8Array(hex.length / 2);
2824
+ for (let i = 0; i < bytes.length; i++) {
2825
+ bytes[i] = Number.parseInt(hex.slice(i * 2, i * 2 + 2), 16);
2826
+ }
2827
+ return bytes;
2828
+ }
2829
+ __name(hexToBytes, "hexToBytes");
2830
+ }
2831
+ });
2832
+
2833
+ // node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/meeting-notes.js
2834
+ var require_meeting_notes2 = __commonJS({
2835
+ "node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/meeting-notes.js"(exports) {
2836
+ "use strict";
2837
+ Object.defineProperty(exports, "__esModule", { value: true });
2838
+ exports.meetingNotesFilterableProperties = void 0;
2839
+ exports.meetingNotesFilterableProperties = [
2840
+ "title",
2841
+ "created_time",
2842
+ "last_edited_time",
2843
+ "created_by",
2844
+ "last_edited_by",
2845
+ "attendees"
2846
+ ];
2847
+ }
2848
+ });
2849
+
2850
+ // node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/index.js
2851
+ var require_src = __commonJS({
2852
+ "node_modules/.pnpm/@notionhq+client@5.31.1/node_modules/@notionhq/client/build/src/index.js"(exports) {
2853
+ "use strict";
2854
+ var __importDefault = exports && exports.__importDefault || function(mod) {
2855
+ return mod && mod.__esModule ? mod : { "default": mod };
2856
+ };
2857
+ Object.defineProperty(exports, "__esModule", { value: true });
2858
+ exports.meetingNotesFilterableProperties = exports.signWebhookPayload = exports.verifyWebhookSignature = exports.extractBlockId = exports.extractPageId = exports.extractDatabaseId = exports.extractNotionId = exports.isFullPageOrDataSource = exports.isFullView = exports.isFullComment = exports.isFullUser = exports.isFullPage = exports.isFullDatabase = exports.isFullDataSource = exports.isFullBlock = exports.collectAllDataSourceRows = exports.iterateAllDataSourceRows = exports.iterateDataSourceTemplates = exports.collectDataSourceTemplates = exports.iteratePaginatedAPI = exports.collectPaginatedAPI = exports.MIN_VIEW_COLUMN_WIDTH = exports.DEFAULT_MAX_RETRY_DELAY_MS = exports.DEFAULT_INITIAL_RETRY_DELAY_MS = exports.DEFAULT_MAX_RETRIES = exports.DEFAULT_TIMEOUT_MS = exports.DEFAULT_BASE_URL = exports.isHTTPResponseError = exports.isNotionClientError = exports.BrowserTokenNotAllowedError = exports.InvalidPathParameterError = exports.RequestTimeoutError = exports.UnknownHTTPResponseError = exports.APIResponseError = exports.ClientErrorCode = exports.APIErrorCode = exports.LogLevel = exports.Client = void 0;
2859
+ var Client_1 = require_Client();
2860
+ Object.defineProperty(exports, "Client", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2861
+ return __importDefault(Client_1).default;
2862
+ }, "get") });
2863
+ var logging_1 = require_logging();
2864
+ Object.defineProperty(exports, "LogLevel", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2865
+ return logging_1.LogLevel;
2866
+ }, "get") });
2867
+ var errors_1 = require_errors();
2868
+ Object.defineProperty(exports, "APIErrorCode", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2869
+ return errors_1.APIErrorCode;
2870
+ }, "get") });
2871
+ Object.defineProperty(exports, "ClientErrorCode", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2872
+ return errors_1.ClientErrorCode;
2873
+ }, "get") });
2874
+ Object.defineProperty(exports, "APIResponseError", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2875
+ return errors_1.APIResponseError;
2876
+ }, "get") });
2877
+ Object.defineProperty(exports, "UnknownHTTPResponseError", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2878
+ return errors_1.UnknownHTTPResponseError;
2879
+ }, "get") });
2880
+ Object.defineProperty(exports, "RequestTimeoutError", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2881
+ return errors_1.RequestTimeoutError;
2882
+ }, "get") });
2883
+ Object.defineProperty(exports, "InvalidPathParameterError", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2884
+ return errors_1.InvalidPathParameterError;
2885
+ }, "get") });
2886
+ Object.defineProperty(exports, "BrowserTokenNotAllowedError", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2887
+ return errors_1.BrowserTokenNotAllowedError;
2888
+ }, "get") });
2889
+ Object.defineProperty(exports, "isNotionClientError", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2890
+ return errors_1.isNotionClientError;
2891
+ }, "get") });
2892
+ Object.defineProperty(exports, "isHTTPResponseError", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2893
+ return errors_1.isHTTPResponseError;
2894
+ }, "get") });
2895
+ var constants_1 = require_constants();
2896
+ Object.defineProperty(exports, "DEFAULT_BASE_URL", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2897
+ return constants_1.DEFAULT_BASE_URL;
2898
+ }, "get") });
2899
+ Object.defineProperty(exports, "DEFAULT_TIMEOUT_MS", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2900
+ return constants_1.DEFAULT_TIMEOUT_MS;
2901
+ }, "get") });
2902
+ Object.defineProperty(exports, "DEFAULT_MAX_RETRIES", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2903
+ return constants_1.DEFAULT_MAX_RETRIES;
2904
+ }, "get") });
2905
+ Object.defineProperty(exports, "DEFAULT_INITIAL_RETRY_DELAY_MS", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2906
+ return constants_1.DEFAULT_INITIAL_RETRY_DELAY_MS;
2907
+ }, "get") });
2908
+ Object.defineProperty(exports, "DEFAULT_MAX_RETRY_DELAY_MS", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2909
+ return constants_1.DEFAULT_MAX_RETRY_DELAY_MS;
2910
+ }, "get") });
2911
+ Object.defineProperty(exports, "MIN_VIEW_COLUMN_WIDTH", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2912
+ return constants_1.MIN_VIEW_COLUMN_WIDTH;
2913
+ }, "get") });
2914
+ var helpers_1 = require_helpers();
2915
+ Object.defineProperty(exports, "collectPaginatedAPI", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2916
+ return helpers_1.collectPaginatedAPI;
2917
+ }, "get") });
2918
+ Object.defineProperty(exports, "iteratePaginatedAPI", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2919
+ return helpers_1.iteratePaginatedAPI;
2920
+ }, "get") });
2921
+ Object.defineProperty(exports, "collectDataSourceTemplates", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2922
+ return helpers_1.collectDataSourceTemplates;
2923
+ }, "get") });
2924
+ Object.defineProperty(exports, "iterateDataSourceTemplates", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2925
+ return helpers_1.iterateDataSourceTemplates;
2926
+ }, "get") });
2927
+ Object.defineProperty(exports, "iterateAllDataSourceRows", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2928
+ return helpers_1.iterateAllDataSourceRows;
2929
+ }, "get") });
2930
+ Object.defineProperty(exports, "collectAllDataSourceRows", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2931
+ return helpers_1.collectAllDataSourceRows;
2932
+ }, "get") });
2933
+ Object.defineProperty(exports, "isFullBlock", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2934
+ return helpers_1.isFullBlock;
2935
+ }, "get") });
2936
+ Object.defineProperty(exports, "isFullDataSource", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2937
+ return helpers_1.isFullDataSource;
2938
+ }, "get") });
2939
+ Object.defineProperty(exports, "isFullDatabase", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2940
+ return helpers_1.isFullDatabase;
2941
+ }, "get") });
2942
+ Object.defineProperty(exports, "isFullPage", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2943
+ return helpers_1.isFullPage;
2944
+ }, "get") });
2945
+ Object.defineProperty(exports, "isFullUser", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2946
+ return helpers_1.isFullUser;
2947
+ }, "get") });
2948
+ Object.defineProperty(exports, "isFullComment", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2949
+ return helpers_1.isFullComment;
2950
+ }, "get") });
2951
+ Object.defineProperty(exports, "isFullView", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2952
+ return helpers_1.isFullView;
2953
+ }, "get") });
2954
+ Object.defineProperty(exports, "isFullPageOrDataSource", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2955
+ return helpers_1.isFullPageOrDataSource;
2956
+ }, "get") });
2957
+ Object.defineProperty(exports, "extractNotionId", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2958
+ return helpers_1.extractNotionId;
2959
+ }, "get") });
2960
+ Object.defineProperty(exports, "extractDatabaseId", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2961
+ return helpers_1.extractDatabaseId;
2962
+ }, "get") });
2963
+ Object.defineProperty(exports, "extractPageId", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2964
+ return helpers_1.extractPageId;
2965
+ }, "get") });
2966
+ Object.defineProperty(exports, "extractBlockId", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2967
+ return helpers_1.extractBlockId;
2968
+ }, "get") });
2969
+ var webhooks_1 = require_webhooks2();
2970
+ Object.defineProperty(exports, "verifyWebhookSignature", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2971
+ return webhooks_1.verifyWebhookSignature;
2972
+ }, "get") });
2973
+ Object.defineProperty(exports, "signWebhookPayload", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2974
+ return webhooks_1.signWebhookPayload;
2975
+ }, "get") });
2976
+ var meeting_notes_1 = require_meeting_notes2();
2977
+ Object.defineProperty(exports, "meetingNotesFilterableProperties", { enumerable: true, get: /* @__PURE__ */ __name(function() {
2978
+ return meeting_notes_1.meetingNotesFilterableProperties;
2979
+ }, "get") });
2980
+ }
2981
+ });
2982
+
2983
+ // dist/notion/errors.js
2984
+ var import_client = __toESM(require_src(), 1);
2985
+ var REASONS = defineReasons([
2986
+ ["notion.token-refused", "authentication_error", "Notion refused the token"],
2987
+ ["notion.restricted", "permission_error", "the token may not read or change this"],
2988
+ ["notion.blocked", "permission_error", "Notion has restricted this connection's API access"],
2989
+ ["notion.not-shared", "not_found", "no such page or database, or it is not shared with this token"],
2990
+ ["notion.refused", "validation_error", "Notion refused the request as it was sent"],
2991
+ ["notion.conflict", "conflict", "Notion could not save it because it changed at the same time"],
2992
+ ["notion.rate-limited", "rate_limited", "Notion asked to slow down"],
2993
+ ["notion.unavailable", "provider_unavailable", "Notion is down or overloaded"],
2994
+ ["notion.invalid-response", "invalid_response", "Notion's answer does not have the documented shape"],
2995
+ ["notion.id-invalid", "validation_error", "that is not a Notion id or link"],
2996
+ ["notion.truncated", "provider_error", "Notion gave only part of the page"],
2997
+ ["notion.no-workspace", "invalid_response", "Notion did not name the token's workspace"],
2998
+ ["notion.failed", "provider_error", "a Notion read failed"],
2999
+ ["notion.search-incomplete", "provider_error", "Notion cut the search for edits short"],
3000
+ ["notion.window-too-dense", "validation_error", "more than 10,000 rows of one database share one minute"],
3001
+ ["notion.search-capped", "provider_error", "Notion's search gave only its 10,000 most recent results"],
3002
+ ["notion.database-unreadable", "not_found", "a database search listed could not be read"],
3003
+ ["notion.child-unreadable", "not_found", "a child page or database Notion would not give was left out"],
3004
+ ["notion.kept-unconfirmed", "permission_error", "a page Notion would not show was kept as it was"],
3005
+ ["notion.left-out", "not_found", "an item Notion refused was left out of this sync"],
3006
+ ["notion.stopped-early", "provider_error", "the sync stopped early and goes on next time"],
3007
+ ["notion.listing-restarted", "validation_error", "Notion no longer took a saved list position; it started over"],
3008
+ ["notion.listing-stale", "not_found", "Notion no longer takes a folder's saved position; it is listed again"],
3009
+ ["notion.timeout-too-short", "timeout", "the time left was too short for one step of the sync"],
3010
+ ["source.text-limit", "validation_error", "the page is longer than the text the store keeps"],
3011
+ ["profile.not-synced", "not_found", "the profile has no local copy yet; sync first"],
3012
+ ["profile.busy", "provider_unavailable", "another sync or write holds the profile's local copy"],
3013
+ ["state.unreadable", "configuration_error", "the profile's sync state cannot be read"],
3014
+ ["folder.not-a-folder", "validation_error", "only a page or a database can be chosen as a folder"],
3015
+ ["folder.not-chosen", "not_found", "that page or database is not a chosen folder"],
3016
+ ["folder.workspace", "validation_error", "the whole workspace is the scope when no folder is chosen"],
3017
+ ["identity.not-seen", "not_found", "this Notion user was not seen on the document"],
3018
+ ["identity.target", "validation_error", "the target must be a person: reference"],
3019
+ ["identity.no-person", "not_found", "the target person has no known identity"],
3020
+ ["profile.account-taken", "conflict", "another profile already uses this Notion connection", ["profile"]],
3021
+ ["profile.other-account", "conflict", "the profile's local copy was synced from another Notion connection"]
3022
+ ].map(([reason, code, message, details = []]) => ({ reason, code, message, details: [...details] })));
3023
+ var DETAILS = ["notion_code", "rate_limit_reason"];
3024
+ var NOTION = "Notion";
3025
+ var BLOCKED = "public_api_request_blocked";
3026
+ var blocked = /* @__PURE__ */ __name((base = {}) => new CliError("permission_error", `${NOTION} has restricted this connection's API access; retrying will not help, contact Notion support`, { ...base, rate_limit_reason: BLOCKED, reason: "notion.blocked" }), "blocked");
3027
+ var SIGN_IN = "sign in again with `notion <profile> session start`";
3028
+ var additional = /* @__PURE__ */ __name((error, key) => {
3029
+ const value = error.additional_data?.[key];
3030
+ return typeof value === "string" ? value : void 0;
3031
+ }, "additional");
3032
+ var failureOf = /* @__PURE__ */ __name((error) => {
3033
+ if (isCliError(error))
3034
+ return error;
3035
+ if (error instanceof import_client.RequestTimeoutError)
3036
+ return new CliError("timeout", `${NOTION} did not answer in time`, { retryable: true });
3037
+ if (!(0, import_client.isHTTPResponseError)(error))
3038
+ return error;
3039
+ const status = error.status;
3040
+ const notion = import_client.APIResponseError.isAPIResponseError(error) ? error : void 0;
3041
+ const code = notion?.code ?? "unknown";
3042
+ const base = {
3043
+ status,
3044
+ notion_code: code,
3045
+ ...error.request_id ? { request_id: error.request_id } : {}
3046
+ };
3047
+ if (code === "unauthorized" || status === 401)
3048
+ return new CliError("authentication_error", `${NOTION} refused the token; ${SIGN_IN}`, {
3049
+ ...base,
3050
+ reason: "notion.token-refused"
3051
+ });
3052
+ if (code === "rate_limited" || status === 429 || code === "service_overload" || status === 529) {
3053
+ const reason = notion ? additional(notion, "rate_limit_reason") : void 0;
3054
+ if (reason === BLOCKED)
3055
+ return blocked(base);
3056
+ const wait = error.headers instanceof Headers ? providerWaitMs(error.headers, () => /* @__PURE__ */ new Date()) : void 0;
3057
+ return new CliError("rate_limited", `${NOTION} asked to slow down; run the command again later`, {
3058
+ ...base,
3059
+ ...reason ? { rate_limit_reason: reason } : {},
3060
+ ...wait === void 0 ? {} : { retry_after_ms: wait },
3061
+ retryable: true,
3062
+ reason: "notion.rate-limited"
3063
+ });
3064
+ }
3065
+ if (code === "restricted_resource" || status === 403)
3066
+ return new CliError("permission_error", `${NOTION} says this token may not do that`, {
3067
+ ...base,
3068
+ reason: "notion.restricted"
3069
+ });
3070
+ if (code === "object_not_found" || status === 404)
3071
+ return new CliError("not_found", `${NOTION} has no such page or database, or it is not shared with this token: in Notion, open it, choose \u2022\u2022\u2022 \u2192 Connections, and add the connection`, { ...base, reason: "notion.not-shared" });
3072
+ if (code === "conflict_error" || status === 409)
3073
+ return new CliError("conflict", `${NOTION} could not save it because it changed at the same time`, {
3074
+ ...base,
3075
+ reason: "notion.conflict"
3076
+ });
3077
+ if (status >= 500)
3078
+ return new CliError("provider_unavailable", `${NOTION} is unavailable (HTTP ${status}); try again later`, {
3079
+ ...base,
3080
+ retryable: true,
3081
+ reason: "notion.unavailable"
3082
+ });
3083
+ const refused = statusToCode(status) === "validation_error";
3084
+ return new CliError(refused ? "validation_error" : "provider_error", `${NOTION} refused the request (HTTP ${status}, ${code})`, {
3085
+ ...base,
3086
+ reason: refused ? "notion.refused" : "provider.refused"
3087
+ });
3088
+ }, "failureOf");
3089
+ var mapped = /* @__PURE__ */ __name(async (call) => {
3090
+ try {
3091
+ return await call();
3092
+ } catch (error) {
3093
+ throw failureOf(error);
3094
+ }
3095
+ }, "mapped");
3096
+
3097
+ // dist/version.js
3098
+ var VERSION = "0.2.0";
3099
+
3100
+ // dist/identity.js
3101
+ var PACKAGE = "@wirecat/notion-cli";
3102
+ var IDENTITY = {
3103
+ command: "notion",
3104
+ appName: "notion-cli",
3105
+ envPrefix: "WCNOTION",
3106
+ description: "Notion pages and databases for you and your agent, read live with your own token",
3107
+ version: VERSION,
3108
+ issues: "https://github.com/WireCatLabs/notion-cli/issues/new",
3109
+ messenger: false,
3110
+ contentLanguages: ["en", "ru", "es"],
3111
+ errors: { reasons: REASONS, details: DETAILS }
3112
+ };
3113
+ var DESKTOP = {
3114
+ ...IDENTITY,
3115
+ docs: "https://github.com/WireCatLabs/notion-cli#readme",
3116
+ // Every host the CLI contacts (WC-CMD-32).
3117
+ hosts: ["api.notion.com"],
3118
+ tagline: "Notion pages and databases, searchable on your computer",
3119
+ syncs: "Notion pages and database rows",
3120
+ signIn: {
3121
+ gives: "Lets your agent read the Notion pages and databases your token can see.",
3122
+ asks: "A Notion personal access token, or the token of an internal connection you made in Notion."
3123
+ }
3124
+ };
3125
+ var SKILL = new URL("../skills/notion-cli/SKILL.md", new URL("../identity.js", import.meta.url).href);
3126
+
3127
+ export {
3128
+ require_src,
3129
+ NOTION,
3130
+ BLOCKED,
3131
+ blocked,
3132
+ failureOf,
3133
+ mapped,
3134
+ VERSION,
3135
+ PACKAGE,
3136
+ IDENTITY,
3137
+ DESKTOP,
3138
+ SKILL
3139
+ };