qarpeo 0.0.0-alpha.10

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 (599) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +102 -0
  3. package/dist/chunks/auth-schema.mjs +219 -0
  4. package/dist/chunks/wrangler.mjs +783 -0
  5. package/dist/cli/index.mjs +1085 -0
  6. package/dist/dev/env.d.ts +12 -0
  7. package/dist/dev/wrangler.d.ts +18 -0
  8. package/dist/module.d.ts +16 -0
  9. package/dist/module.mjs +4436 -0
  10. package/dist/runtime/ai.d.ts +25 -0
  11. package/dist/runtime/ai.mjs +106 -0
  12. package/dist/runtime/analytics.d.ts +24 -0
  13. package/dist/runtime/analytics.mjs +38 -0
  14. package/dist/runtime/app/components/BlobImage.vue +100 -0
  15. package/dist/runtime/app/components/CMSBlocks.vue +93 -0
  16. package/dist/runtime/app/components/CMSContent.vue +23 -0
  17. package/dist/runtime/app/components/CMSImage.vue +49 -0
  18. package/dist/runtime/app/components/CMSLocaleSwitcher.vue +110 -0
  19. package/dist/runtime/app/components/CMSPreviewBanner.vue +79 -0
  20. package/dist/runtime/app/components/CMSVersionBanner.vue +49 -0
  21. package/dist/runtime/app/components/CMSVersionSwitcher.vue +126 -0
  22. package/dist/runtime/app/components/ContentRenderer.vue +80 -0
  23. package/dist/runtime/app/components/FileUpload.vue +196 -0
  24. package/dist/runtime/app/components/ImpersonationBanner.vue +57 -0
  25. package/dist/runtime/app/components/SignedIn.vue +13 -0
  26. package/dist/runtime/app/components/SignedOut.vue +13 -0
  27. package/dist/runtime/app/components/shiki.css +34 -0
  28. package/dist/runtime/app/composables/analytics.d.ts +125 -0
  29. package/dist/runtime/app/composables/analytics.mjs +81 -0
  30. package/dist/runtime/app/composables/api-tokens.d.ts +49 -0
  31. package/dist/runtime/app/composables/api-tokens.mjs +61 -0
  32. package/dist/runtime/app/composables/auth.d.ts +50 -0
  33. package/dist/runtime/app/composables/auth.mjs +101 -0
  34. package/dist/runtime/app/composables/chat.d.ts +69 -0
  35. package/dist/runtime/app/composables/chat.mjs +159 -0
  36. package/dist/runtime/app/composables/cms-preview.d.ts +33 -0
  37. package/dist/runtime/app/composables/cms-preview.mjs +83 -0
  38. package/dist/runtime/app/composables/cms.d.ts +307 -0
  39. package/dist/runtime/app/composables/cms.mjs +355 -0
  40. package/dist/runtime/app/composables/docs-version.d.ts +35 -0
  41. package/dist/runtime/app/composables/docs-version.mjs +70 -0
  42. package/dist/runtime/app/composables/impersonation.d.ts +14 -0
  43. package/dist/runtime/app/composables/impersonation.mjs +44 -0
  44. package/dist/runtime/app/composables/notifications.d.ts +35 -0
  45. package/dist/runtime/app/composables/notifications.mjs +139 -0
  46. package/dist/runtime/app/composables/organization.d.ts +127 -0
  47. package/dist/runtime/app/composables/organization.mjs +138 -0
  48. package/dist/runtime/app/composables/passkey.d.ts +6 -0
  49. package/dist/runtime/app/composables/passkey.mjs +105 -0
  50. package/dist/runtime/app/composables/passwordless.d.ts +7 -0
  51. package/dist/runtime/app/composables/passwordless.mjs +67 -0
  52. package/dist/runtime/app/composables/payments.d.ts +43 -0
  53. package/dist/runtime/app/composables/payments.mjs +74 -0
  54. package/dist/runtime/app/composables/realtime.d.ts +96 -0
  55. package/dist/runtime/app/composables/realtime.mjs +432 -0
  56. package/dist/runtime/app/composables/site.d.ts +35 -0
  57. package/dist/runtime/app/composables/site.mjs +36 -0
  58. package/dist/runtime/app/composables/storage.d.ts +60 -0
  59. package/dist/runtime/app/composables/storage.mjs +294 -0
  60. package/dist/runtime/app/composables/tenant.d.ts +82 -0
  61. package/dist/runtime/app/composables/tenant.mjs +120 -0
  62. package/dist/runtime/app/composables/turnstile.d.ts +3 -0
  63. package/dist/runtime/app/composables/turnstile.mjs +10 -0
  64. package/dist/runtime/app/composables/two-factor.d.ts +12 -0
  65. package/dist/runtime/app/composables/two-factor.mjs +65 -0
  66. package/dist/runtime/app/middleware/auth.global.d.ts +2 -0
  67. package/dist/runtime/app/middleware/auth.global.mjs +44 -0
  68. package/dist/runtime/app/pages/cms.vue +2249 -0
  69. package/dist/runtime/app/pages/devtools/agents.vue +717 -0
  70. package/dist/runtime/app/pages/devtools/analytics.vue +618 -0
  71. package/dist/runtime/app/pages/devtools/auth.vue +351 -0
  72. package/dist/runtime/app/pages/devtools/blob.vue +745 -0
  73. package/dist/runtime/app/pages/devtools/db.vue +546 -0
  74. package/dist/runtime/app/pages/devtools/domains.vue +772 -0
  75. package/dist/runtime/app/pages/devtools/kv.vue +829 -0
  76. package/dist/runtime/app/pages/devtools/logs.vue +655 -0
  77. package/dist/runtime/app/pages/devtools/mail.vue +389 -0
  78. package/dist/runtime/app/pages/devtools/overview.vue +390 -0
  79. package/dist/runtime/app/pages/devtools/settings.vue +560 -0
  80. package/dist/runtime/app/pages/devtools.vue +165 -0
  81. package/dist/runtime/app/plugins/seo.d.ts +2 -0
  82. package/dist/runtime/app/plugins/seo.mjs +105 -0
  83. package/dist/runtime/app/plugins/shortcuts.client.d.ts +6 -0
  84. package/dist/runtime/app/plugins/shortcuts.client.mjs +19 -0
  85. package/dist/runtime/app/public/sw-notifications.mjs +52 -0
  86. package/dist/runtime/auth.d.ts +25 -0
  87. package/dist/runtime/auth.mjs +11 -0
  88. package/dist/runtime/bindings.d.ts +27 -0
  89. package/dist/runtime/bindings.mjs +38 -0
  90. package/dist/runtime/blob.d.ts +26 -0
  91. package/dist/runtime/blob.mjs +334 -0
  92. package/dist/runtime/bots.d.ts +1 -0
  93. package/dist/runtime/bots.mjs +1 -0
  94. package/dist/runtime/browser.d.ts +21 -0
  95. package/dist/runtime/browser.mjs +64 -0
  96. package/dist/runtime/cache.d.ts +19 -0
  97. package/dist/runtime/cache.mjs +12 -0
  98. package/dist/runtime/cms.d.ts +2 -0
  99. package/dist/runtime/cms.mjs +0 -0
  100. package/dist/runtime/db.d.ts +21 -0
  101. package/dist/runtime/db.mjs +36 -0
  102. package/dist/runtime/drizzle.d.ts +11 -0
  103. package/dist/runtime/drizzle.mjs +18 -0
  104. package/dist/runtime/email.d.ts +51 -0
  105. package/dist/runtime/email.mjs +245 -0
  106. package/dist/runtime/hyperdrive.d.ts +21 -0
  107. package/dist/runtime/hyperdrive.mjs +49 -0
  108. package/dist/runtime/index.d.ts +23 -0
  109. package/dist/runtime/index.mjs +23 -0
  110. package/dist/runtime/kv.d.ts +16 -0
  111. package/dist/runtime/kv.mjs +126 -0
  112. package/dist/runtime/payments.d.ts +2 -0
  113. package/dist/runtime/payments.mjs +0 -0
  114. package/dist/runtime/queue.d.ts +21 -0
  115. package/dist/runtime/queue.mjs +41 -0
  116. package/dist/runtime/rag.d.ts +1 -0
  117. package/dist/runtime/rag.mjs +1 -0
  118. package/dist/runtime/ratelimit.d.ts +21 -0
  119. package/dist/runtime/ratelimit.mjs +38 -0
  120. package/dist/runtime/realtime.d.ts +6 -0
  121. package/dist/runtime/realtime.mjs +13 -0
  122. package/dist/runtime/server/db/cms-schema.d.ts +651 -0
  123. package/dist/runtime/server/db/cms-schema.mjs +74 -0
  124. package/dist/runtime/server/durable-objects/agent.d.ts +14 -0
  125. package/dist/runtime/server/durable-objects/agent.mjs +571 -0
  126. package/dist/runtime/server/durable-objects/room.d.ts +34 -0
  127. package/dist/runtime/server/durable-objects/room.mjs +514 -0
  128. package/dist/runtime/server/middleware/auth.d.ts +2 -0
  129. package/dist/runtime/server/middleware/auth.mjs +108 -0
  130. package/dist/runtime/server/middleware/devtools.d.ts +2 -0
  131. package/dist/runtime/server/middleware/devtools.mjs +61 -0
  132. package/dist/runtime/server/middleware/ratelimit.d.ts +2 -0
  133. package/dist/runtime/server/middleware/ratelimit.mjs +49 -0
  134. package/dist/runtime/server/middleware/tenancy.d.ts +6 -0
  135. package/dist/runtime/server/middleware/tenancy.mjs +15 -0
  136. package/dist/runtime/server/middleware/tracker.d.ts +7 -0
  137. package/dist/runtime/server/middleware/tracker.mjs +9 -0
  138. package/dist/runtime/server/plugins/agents.d.ts +7 -0
  139. package/dist/runtime/server/plugins/agents.mjs +3 -0
  140. package/dist/runtime/server/plugins/cms.d.ts +7 -0
  141. package/dist/runtime/server/plugins/cms.mjs +16 -0
  142. package/dist/runtime/server/plugins/dev-logs.d.ts +1 -0
  143. package/dist/runtime/server/plugins/dev-logs.mjs +58 -0
  144. package/dist/runtime/server/plugins/dev-proxy.d.ts +3 -0
  145. package/dist/runtime/server/plugins/dev-proxy.mjs +21 -0
  146. package/dist/runtime/server/plugins/env.d.ts +6 -0
  147. package/dist/runtime/server/plugins/env.mjs +17 -0
  148. package/dist/runtime/server/plugins/queue.d.ts +6 -0
  149. package/dist/runtime/server/plugins/queue.mjs +8 -0
  150. package/dist/runtime/server/routes/__qarpeo/agents/chat.post.d.ts +20 -0
  151. package/dist/runtime/server/routes/__qarpeo/agents/chat.post.mjs +110 -0
  152. package/dist/runtime/server/routes/__qarpeo/agents/clear.post.d.ts +7 -0
  153. package/dist/runtime/server/routes/__qarpeo/agents/clear.post.mjs +15 -0
  154. package/dist/runtime/server/routes/__qarpeo/agents/create.post.d.ts +17 -0
  155. package/dist/runtime/server/routes/__qarpeo/agents/create.post.mjs +47 -0
  156. package/dist/runtime/server/routes/__qarpeo/agents/history.get.d.ts +15 -0
  157. package/dist/runtime/server/routes/__qarpeo/agents/history.get.mjs +24 -0
  158. package/dist/runtime/server/routes/__qarpeo/agents/list.get.d.ts +5 -0
  159. package/dist/runtime/server/routes/__qarpeo/agents/list.get.mjs +63 -0
  160. package/dist/runtime/server/routes/__qarpeo/analytics/events.get.d.ts +64 -0
  161. package/dist/runtime/server/routes/__qarpeo/analytics/events.get.mjs +55 -0
  162. package/dist/runtime/server/routes/__qarpeo/analytics/summary.get.d.ts +30 -0
  163. package/dist/runtime/server/routes/__qarpeo/analytics/summary.get.mjs +73 -0
  164. package/dist/runtime/server/routes/__qarpeo/auth/revoke-session.post.d.ts +6 -0
  165. package/dist/runtime/server/routes/__qarpeo/auth/revoke-session.post.mjs +26 -0
  166. package/dist/runtime/server/routes/__qarpeo/auth/sessions.get.d.ts +6 -0
  167. package/dist/runtime/server/routes/__qarpeo/auth/sessions.get.mjs +46 -0
  168. package/dist/runtime/server/routes/__qarpeo/auth/users.get.d.ts +7 -0
  169. package/dist/runtime/server/routes/__qarpeo/auth/users.get.mjs +65 -0
  170. package/dist/runtime/server/routes/__qarpeo/blob/files.get.d.ts +22 -0
  171. package/dist/runtime/server/routes/__qarpeo/blob/files.get.mjs +36 -0
  172. package/dist/runtime/server/routes/__qarpeo/db/query.post.d.ts +23 -0
  173. package/dist/runtime/server/routes/__qarpeo/db/query.post.mjs +34 -0
  174. package/dist/runtime/server/routes/__qarpeo/db/tables.get.d.ts +31 -0
  175. package/dist/runtime/server/routes/__qarpeo/db/tables.get.mjs +81 -0
  176. package/dist/runtime/server/routes/__qarpeo/kv/delete.post.d.ts +11 -0
  177. package/dist/runtime/server/routes/__qarpeo/kv/delete.post.mjs +18 -0
  178. package/dist/runtime/server/routes/__qarpeo/kv/get.get.d.ts +11 -0
  179. package/dist/runtime/server/routes/__qarpeo/kv/get.get.mjs +20 -0
  180. package/dist/runtime/server/routes/__qarpeo/kv/keys.get.d.ts +8 -0
  181. package/dist/runtime/server/routes/__qarpeo/kv/keys.get.mjs +27 -0
  182. package/dist/runtime/server/routes/__qarpeo/kv/set.post.d.ts +14 -0
  183. package/dist/runtime/server/routes/__qarpeo/kv/set.post.mjs +24 -0
  184. package/dist/runtime/server/routes/__qarpeo/logs.delete.d.ts +5 -0
  185. package/dist/runtime/server/routes/__qarpeo/logs.delete.mjs +6 -0
  186. package/dist/runtime/server/routes/__qarpeo/logs.get.d.ts +5 -0
  187. package/dist/runtime/server/routes/__qarpeo/logs.get.mjs +26 -0
  188. package/dist/runtime/server/routes/__qarpeo/logs.post.d.ts +6 -0
  189. package/dist/runtime/server/routes/__qarpeo/logs.post.mjs +17 -0
  190. package/dist/runtime/server/routes/__qarpeo/mail/bounce.post.d.ts +5 -0
  191. package/dist/runtime/server/routes/__qarpeo/mail/bounce.post.mjs +37 -0
  192. package/dist/runtime/server/routes/__qarpeo/mail/clear.post.d.ts +4 -0
  193. package/dist/runtime/server/routes/__qarpeo/mail/clear.post.mjs +6 -0
  194. package/dist/runtime/server/routes/__qarpeo/mail/inbox.get.d.ts +5 -0
  195. package/dist/runtime/server/routes/__qarpeo/mail/inbox.get.mjs +7 -0
  196. package/dist/runtime/server/routes/__qarpeo/mail/send-test.post.d.ts +4 -0
  197. package/dist/runtime/server/routes/__qarpeo/mail/send-test.post.mjs +29 -0
  198. package/dist/runtime/server/routes/__qarpeo/mail/track/click/[id].get.d.ts +2 -0
  199. package/dist/runtime/server/routes/__qarpeo/mail/track/click/[id].get.mjs +23 -0
  200. package/dist/runtime/server/routes/__qarpeo/mail/track/open/[id].get.d.ts +2 -0
  201. package/dist/runtime/server/routes/__qarpeo/mail/track/open/[id].get.mjs +31 -0
  202. package/dist/runtime/server/routes/__qarpeo/overview/health.get.d.ts +8 -0
  203. package/dist/runtime/server/routes/__qarpeo/overview/health.get.mjs +46 -0
  204. package/dist/runtime/server/routes/__qarpeo/overview.get.d.ts +32 -0
  205. package/dist/runtime/server/routes/__qarpeo/overview.get.mjs +38 -0
  206. package/dist/runtime/server/routes/__qarpeo/settings/reset-dev-data.post.d.ts +11 -0
  207. package/dist/runtime/server/routes/__qarpeo/settings/reset-dev-data.post.mjs +84 -0
  208. package/dist/runtime/server/routes/__qarpeo/settings.get.d.ts +124 -0
  209. package/dist/runtime/server/routes/__qarpeo/settings.get.mjs +145 -0
  210. package/dist/runtime/server/routes/__qarpeo/tenants/create.post.d.ts +7 -0
  211. package/dist/runtime/server/routes/__qarpeo/tenants/create.post.mjs +26 -0
  212. package/dist/runtime/server/routes/__qarpeo/tenants/domain-add.post.d.ts +6 -0
  213. package/dist/runtime/server/routes/__qarpeo/tenants/domain-add.post.mjs +29 -0
  214. package/dist/runtime/server/routes/__qarpeo/tenants/domain-delete.post.d.ts +7 -0
  215. package/dist/runtime/server/routes/__qarpeo/tenants/domain-delete.post.mjs +21 -0
  216. package/dist/runtime/server/routes/__qarpeo/tenants/domain-verify.post.d.ts +9 -0
  217. package/dist/runtime/server/routes/__qarpeo/tenants/domain-verify.post.mjs +21 -0
  218. package/dist/runtime/server/routes/__qarpeo/tenants/list.get.d.ts +15 -0
  219. package/dist/runtime/server/routes/__qarpeo/tenants/list.get.mjs +22 -0
  220. package/dist/runtime/server/routes/agents/[agent]/chat.post.d.ts +2 -0
  221. package/dist/runtime/server/routes/agents/[agent]/chat.post.mjs +35 -0
  222. package/dist/runtime/server/routes/agents/[agent]/clear.post.d.ts +4 -0
  223. package/dist/runtime/server/routes/agents/[agent]/clear.post.mjs +27 -0
  224. package/dist/runtime/server/routes/agents/[agent]/history.get.d.ts +4 -0
  225. package/dist/runtime/server/routes/agents/[agent]/history.get.mjs +27 -0
  226. package/dist/runtime/server/routes/analytics/events.get.d.ts +3 -0
  227. package/dist/runtime/server/routes/analytics/events.get.mjs +17 -0
  228. package/dist/runtime/server/routes/analytics/pageviews.get.d.ts +3 -0
  229. package/dist/runtime/server/routes/analytics/pageviews.get.mjs +15 -0
  230. package/dist/runtime/server/routes/analytics/summary.get.d.ts +6 -0
  231. package/dist/runtime/server/routes/analytics/summary.get.mjs +15 -0
  232. package/dist/runtime/server/routes/atom.xml.get.d.ts +2 -0
  233. package/dist/runtime/server/routes/atom.xml.get.mjs +76 -0
  234. package/dist/runtime/server/routes/auth/2fa/disable.post.d.ts +4 -0
  235. package/dist/runtime/server/routes/auth/2fa/disable.post.mjs +44 -0
  236. package/dist/runtime/server/routes/auth/2fa/setup.post.d.ts +6 -0
  237. package/dist/runtime/server/routes/auth/2fa/setup.post.mjs +32 -0
  238. package/dist/runtime/server/routes/auth/2fa/verify.post.d.ts +6 -0
  239. package/dist/runtime/server/routes/auth/2fa/verify.post.mjs +92 -0
  240. package/dist/runtime/server/routes/auth/[provider]/callback.d.ts +1 -0
  241. package/dist/runtime/server/routes/auth/[provider]/callback.mjs +1 -0
  242. package/dist/runtime/server/routes/auth/[provider].d.ts +3 -0
  243. package/dist/runtime/server/routes/auth/[provider].mjs +95 -0
  244. package/dist/runtime/server/routes/auth/account.delete.d.ts +5 -0
  245. package/dist/runtime/server/routes/auth/account.delete.mjs +52 -0
  246. package/dist/runtime/server/routes/auth/impersonate/start.post.d.ts +5 -0
  247. package/dist/runtime/server/routes/auth/impersonate/start.post.mjs +14 -0
  248. package/dist/runtime/server/routes/auth/impersonate/stop.post.d.ts +5 -0
  249. package/dist/runtime/server/routes/auth/impersonate/stop.post.mjs +5 -0
  250. package/dist/runtime/server/routes/auth/logout-all.post.d.ts +4 -0
  251. package/dist/runtime/server/routes/auth/logout-all.post.mjs +16 -0
  252. package/dist/runtime/server/routes/auth/logout-others.post.d.ts +4 -0
  253. package/dist/runtime/server/routes/auth/logout-others.post.mjs +11 -0
  254. package/dist/runtime/server/routes/auth/logout.post.d.ts +4 -0
  255. package/dist/runtime/server/routes/auth/logout.post.mjs +17 -0
  256. package/dist/runtime/server/routes/auth/magic-link/send.post.d.ts +10 -0
  257. package/dist/runtime/server/routes/auth/magic-link/send.post.mjs +29 -0
  258. package/dist/runtime/server/routes/auth/magic-link/verify.get.d.ts +2 -0
  259. package/dist/runtime/server/routes/auth/magic-link/verify.get.mjs +81 -0
  260. package/dist/runtime/server/routes/auth/organization/create.post.d.ts +5 -0
  261. package/dist/runtime/server/routes/auth/organization/create.post.mjs +10 -0
  262. package/dist/runtime/server/routes/auth/organization/invite.post.d.ts +9 -0
  263. package/dist/runtime/server/routes/auth/organization/invite.post.mjs +27 -0
  264. package/dist/runtime/server/routes/auth/organization/join.post.d.ts +6 -0
  265. package/dist/runtime/server/routes/auth/organization/join.post.mjs +15 -0
  266. package/dist/runtime/server/routes/auth/organization/list.get.d.ts +5 -0
  267. package/dist/runtime/server/routes/auth/organization/list.get.mjs +7 -0
  268. package/dist/runtime/server/routes/auth/organization/members/[id].delete.d.ts +4 -0
  269. package/dist/runtime/server/routes/auth/organization/members/[id].delete.mjs +33 -0
  270. package/dist/runtime/server/routes/auth/organization/members/index.get.d.ts +6 -0
  271. package/dist/runtime/server/routes/auth/organization/members/index.get.mjs +18 -0
  272. package/dist/runtime/server/routes/auth/organization/mfa.post.d.ts +6 -0
  273. package/dist/runtime/server/routes/auth/organization/mfa.post.mjs +33 -0
  274. package/dist/runtime/server/routes/auth/organization/sso/[id].delete.d.ts +4 -0
  275. package/dist/runtime/server/routes/auth/organization/sso/[id].delete.mjs +28 -0
  276. package/dist/runtime/server/routes/auth/organization/sso/index.get.d.ts +2 -0
  277. package/dist/runtime/server/routes/auth/organization/sso/index.get.mjs +23 -0
  278. package/dist/runtime/server/routes/auth/organization/sso/index.post.d.ts +5 -0
  279. package/dist/runtime/server/routes/auth/organization/sso/index.post.mjs +84 -0
  280. package/dist/runtime/server/routes/auth/organization/switch.post.d.ts +6 -0
  281. package/dist/runtime/server/routes/auth/organization/switch.post.mjs +14 -0
  282. package/dist/runtime/server/routes/auth/otp/send.post.d.ts +10 -0
  283. package/dist/runtime/server/routes/auth/otp/send.post.mjs +29 -0
  284. package/dist/runtime/server/routes/auth/otp/verify.post.d.ts +6 -0
  285. package/dist/runtime/server/routes/auth/otp/verify.post.mjs +95 -0
  286. package/dist/runtime/server/routes/auth/sessions/[id].delete.d.ts +5 -0
  287. package/dist/runtime/server/routes/auth/sessions/[id].delete.mjs +24 -0
  288. package/dist/runtime/server/routes/auth/sessions.get.d.ts +2 -0
  289. package/dist/runtime/server/routes/auth/sessions.get.mjs +11 -0
  290. package/dist/runtime/server/routes/auth/sso/login.get.d.ts +2 -0
  291. package/dist/runtime/server/routes/auth/sso/login.get.mjs +94 -0
  292. package/dist/runtime/server/routes/auth/sso/oidc/callback.get.d.ts +2 -0
  293. package/dist/runtime/server/routes/auth/sso/oidc/callback.get.mjs +113 -0
  294. package/dist/runtime/server/routes/auth/sso/saml/acs.post.d.ts +2 -0
  295. package/dist/runtime/server/routes/auth/sso/saml/acs.post.mjs +95 -0
  296. package/dist/runtime/server/routes/auth/tokens/[id].delete.d.ts +4 -0
  297. package/dist/runtime/server/routes/auth/tokens/[id].delete.mjs +13 -0
  298. package/dist/runtime/server/routes/auth/tokens/create.post.d.ts +9 -0
  299. package/dist/runtime/server/routes/auth/tokens/create.post.mjs +17 -0
  300. package/dist/runtime/server/routes/auth/tokens/index.get.d.ts +9 -0
  301. package/dist/runtime/server/routes/auth/tokens/index.get.mjs +5 -0
  302. package/dist/runtime/server/routes/auth/turnstile/verify.post.d.ts +2 -0
  303. package/dist/runtime/server/routes/auth/turnstile/verify.post.mjs +15 -0
  304. package/dist/runtime/server/routes/auth/user.get.d.ts +2 -0
  305. package/dist/runtime/server/routes/auth/user.get.mjs +6 -0
  306. package/dist/runtime/server/routes/auth/webauthn/login/options.post.d.ts +2 -0
  307. package/dist/runtime/server/routes/auth/webauthn/login/options.post.mjs +17 -0
  308. package/dist/runtime/server/routes/auth/webauthn/login/verify.post.d.ts +6 -0
  309. package/dist/runtime/server/routes/auth/webauthn/login/verify.post.mjs +127 -0
  310. package/dist/runtime/server/routes/auth/webauthn/register/options.post.d.ts +2 -0
  311. package/dist/runtime/server/routes/auth/webauthn/register/options.post.mjs +47 -0
  312. package/dist/runtime/server/routes/auth/webauthn/register/verify.post.d.ts +5 -0
  313. package/dist/runtime/server/routes/auth/webauthn/register/verify.post.mjs +88 -0
  314. package/dist/runtime/server/routes/cms/[collection]/[id]/preview-token.post.d.ts +8 -0
  315. package/dist/runtime/server/routes/cms/[collection]/[id]/preview-token.post.mjs +27 -0
  316. package/dist/runtime/server/routes/cms/[collection]/[id]/publish.post.d.ts +6 -0
  317. package/dist/runtime/server/routes/cms/[collection]/[id]/publish.post.mjs +19 -0
  318. package/dist/runtime/server/routes/cms/[collection]/[id]/review.post.d.ts +6 -0
  319. package/dist/runtime/server/routes/cms/[collection]/[id]/review.post.mjs +33 -0
  320. package/dist/runtime/server/routes/cms/[collection]/[id].delete.d.ts +4 -0
  321. package/dist/runtime/server/routes/cms/[collection]/[id].delete.mjs +17 -0
  322. package/dist/runtime/server/routes/cms/[collection]/[id].put.d.ts +4 -0
  323. package/dist/runtime/server/routes/cms/[collection]/[id].put.mjs +18 -0
  324. package/dist/runtime/server/routes/cms/[collection]/[slug].get.d.ts +4 -0
  325. package/dist/runtime/server/routes/cms/[collection]/[slug].get.mjs +19 -0
  326. package/dist/runtime/server/routes/cms/[collection]/atom.xml.get.d.ts +2 -0
  327. package/dist/runtime/server/routes/cms/[collection]/atom.xml.get.mjs +69 -0
  328. package/dist/runtime/server/routes/cms/[collection]/by-path.get.d.ts +8 -0
  329. package/dist/runtime/server/routes/cms/[collection]/by-path.get.mjs +23 -0
  330. package/dist/runtime/server/routes/cms/[collection]/feed.xml.get.d.ts +2 -0
  331. package/dist/runtime/server/routes/cms/[collection]/feed.xml.get.mjs +65 -0
  332. package/dist/runtime/server/routes/cms/[collection]/index.get.d.ts +7 -0
  333. package/dist/runtime/server/routes/cms/[collection]/index.get.mjs +15 -0
  334. package/dist/runtime/server/routes/cms/[collection]/index.post.d.ts +4 -0
  335. package/dist/runtime/server/routes/cms/[collection]/index.post.mjs +23 -0
  336. package/dist/runtime/server/routes/cms/[collection]/references.get.d.ts +19 -0
  337. package/dist/runtime/server/routes/cms/[collection]/references.get.mjs +47 -0
  338. package/dist/runtime/server/routes/cms/[collection]/surroundings.get.d.ts +10 -0
  339. package/dist/runtime/server/routes/cms/[collection]/surroundings.get.mjs +12 -0
  340. package/dist/runtime/server/routes/cms/collections/[id].delete.d.ts +4 -0
  341. package/dist/runtime/server/routes/cms/collections/[id].delete.mjs +10 -0
  342. package/dist/runtime/server/routes/cms/collections/[id].put.d.ts +4 -0
  343. package/dist/runtime/server/routes/cms/collections/[id].put.mjs +11 -0
  344. package/dist/runtime/server/routes/cms/collections/index.get.d.ts +4 -0
  345. package/dist/runtime/server/routes/cms/collections/index.get.mjs +6 -0
  346. package/dist/runtime/server/routes/cms/collections/index.post.d.ts +4 -0
  347. package/dist/runtime/server/routes/cms/collections/index.post.mjs +19 -0
  348. package/dist/runtime/server/routes/cms/components/index.get.d.ts +17 -0
  349. package/dist/runtime/server/routes/cms/components/index.get.mjs +16 -0
  350. package/dist/runtime/server/routes/cms/deploy.post.d.ts +4 -0
  351. package/dist/runtime/server/routes/cms/deploy.post.mjs +46 -0
  352. package/dist/runtime/server/routes/cms/export.post.d.ts +10 -0
  353. package/dist/runtime/server/routes/cms/export.post.mjs +55 -0
  354. package/dist/runtime/server/routes/cms/navigation.get.d.ts +8 -0
  355. package/dist/runtime/server/routes/cms/navigation.get.mjs +36 -0
  356. package/dist/runtime/server/routes/cms/preview/disable.get.d.ts +9 -0
  357. package/dist/runtime/server/routes/cms/preview/disable.get.mjs +9 -0
  358. package/dist/runtime/server/routes/cms/preview/enable.get.d.ts +14 -0
  359. package/dist/runtime/server/routes/cms/preview/enable.get.mjs +42 -0
  360. package/dist/runtime/server/routes/cms/publish-scheduled.post.d.ts +11 -0
  361. package/dist/runtime/server/routes/cms/publish-scheduled.post.mjs +35 -0
  362. package/dist/runtime/server/routes/cms/search.get.d.ts +13 -0
  363. package/dist/runtime/server/routes/cms/search.get.mjs +137 -0
  364. package/dist/runtime/server/routes/cms/sync.post.d.ts +7 -0
  365. package/dist/runtime/server/routes/cms/sync.post.mjs +18 -0
  366. package/dist/runtime/server/routes/cms/webhooks/[provider].post.d.ts +150 -0
  367. package/dist/runtime/server/routes/cms/webhooks/[provider].post.mjs +213 -0
  368. package/dist/runtime/server/routes/docs/search.get.d.ts +15 -0
  369. package/dist/runtime/server/routes/docs/search.get.mjs +20 -0
  370. package/dist/runtime/server/routes/feed.xml.get.d.ts +2 -0
  371. package/dist/runtime/server/routes/feed.xml.get.mjs +73 -0
  372. package/dist/runtime/server/routes/mail/bounce.post.d.ts +14 -0
  373. package/dist/runtime/server/routes/mail/bounce.post.mjs +56 -0
  374. package/dist/runtime/server/routes/mail/inbox/[id].get.d.ts +2 -0
  375. package/dist/runtime/server/routes/mail/inbox/[id].get.mjs +9 -0
  376. package/dist/runtime/server/routes/mail/inbox.get.d.ts +4 -0
  377. package/dist/runtime/server/routes/mail/inbox.get.mjs +7 -0
  378. package/dist/runtime/server/routes/mail/suppressions/[email].delete.d.ts +11 -0
  379. package/dist/runtime/server/routes/mail/suppressions/[email].delete.mjs +18 -0
  380. package/dist/runtime/server/routes/mail/suppressions/index.get.d.ts +12 -0
  381. package/dist/runtime/server/routes/mail/suppressions/index.get.mjs +23 -0
  382. package/dist/runtime/server/routes/mail/suppressions/index.post.d.ts +10 -0
  383. package/dist/runtime/server/routes/mail/suppressions/index.post.mjs +23 -0
  384. package/dist/runtime/server/routes/mail/unsubscribe.d.ts +13 -0
  385. package/dist/runtime/server/routes/mail/unsubscribe.mjs +91 -0
  386. package/dist/runtime/server/routes/mail/webhooks.post.d.ts +12 -0
  387. package/dist/runtime/server/routes/mail/webhooks.post.mjs +71 -0
  388. package/dist/runtime/server/routes/notifications/[id]/read.post.d.ts +4 -0
  389. package/dist/runtime/server/routes/notifications/[id]/read.post.mjs +13 -0
  390. package/dist/runtime/server/routes/notifications/[id].delete.d.ts +4 -0
  391. package/dist/runtime/server/routes/notifications/[id].delete.mjs +13 -0
  392. package/dist/runtime/server/routes/notifications/[id].get.d.ts +2 -0
  393. package/dist/runtime/server/routes/notifications/[id].get.mjs +15 -0
  394. package/dist/runtime/server/routes/notifications/index.get.d.ts +6 -0
  395. package/dist/runtime/server/routes/notifications/index.get.mjs +18 -0
  396. package/dist/runtime/server/routes/notifications/push/subscribe.post.d.ts +4 -0
  397. package/dist/runtime/server/routes/notifications/push/subscribe.post.mjs +20 -0
  398. package/dist/runtime/server/routes/notifications/push/unsubscribe.post.d.ts +4 -0
  399. package/dist/runtime/server/routes/notifications/push/unsubscribe.post.mjs +15 -0
  400. package/dist/runtime/server/routes/notifications/read-all.post.d.ts +4 -0
  401. package/dist/runtime/server/routes/notifications/read-all.post.mjs +11 -0
  402. package/dist/runtime/server/routes/payments/cancel.post.d.ts +7 -0
  403. package/dist/runtime/server/routes/payments/cancel.post.mjs +9 -0
  404. package/dist/runtime/server/routes/payments/change-plan.post.d.ts +7 -0
  405. package/dist/runtime/server/routes/payments/change-plan.post.mjs +12 -0
  406. package/dist/runtime/server/routes/payments/checkout.post.d.ts +9 -0
  407. package/dist/runtime/server/routes/payments/checkout.post.mjs +16 -0
  408. package/dist/runtime/server/routes/payments/pause.post.d.ts +7 -0
  409. package/dist/runtime/server/routes/payments/pause.post.mjs +9 -0
  410. package/dist/runtime/server/routes/payments/portal.post.d.ts +5 -0
  411. package/dist/runtime/server/routes/payments/portal.post.mjs +9 -0
  412. package/dist/runtime/server/routes/payments/subscription.get.d.ts +6 -0
  413. package/dist/runtime/server/routes/payments/subscription.get.mjs +9 -0
  414. package/dist/runtime/server/routes/payments/usage.get.d.ts +12 -0
  415. package/dist/runtime/server/routes/payments/usage.get.mjs +18 -0
  416. package/dist/runtime/server/routes/payments/usage.post.d.ts +6 -0
  417. package/dist/runtime/server/routes/payments/usage.post.mjs +24 -0
  418. package/dist/runtime/server/routes/payments/webhook.post.d.ts +14 -0
  419. package/dist/runtime/server/routes/payments/webhook.post.mjs +21 -0
  420. package/dist/runtime/server/routes/realtime/broadcast.post.d.ts +4 -0
  421. package/dist/runtime/server/routes/realtime/broadcast.post.mjs +26 -0
  422. package/dist/runtime/server/routes/realtime/history.delete.d.ts +13 -0
  423. package/dist/runtime/server/routes/realtime/history.delete.mjs +12 -0
  424. package/dist/runtime/server/routes/realtime/history.get.d.ts +16 -0
  425. package/dist/runtime/server/routes/realtime/history.get.mjs +15 -0
  426. package/dist/runtime/server/routes/realtime/presence.get.d.ts +6 -0
  427. package/dist/runtime/server/routes/realtime/presence.get.mjs +27 -0
  428. package/dist/runtime/server/routes/realtime/state.get.d.ts +5 -0
  429. package/dist/runtime/server/routes/realtime/state.get.mjs +26 -0
  430. package/dist/runtime/server/routes/realtime/state.post.d.ts +6 -0
  431. package/dist/runtime/server/routes/realtime/state.post.mjs +37 -0
  432. package/dist/runtime/server/routes/realtime/ws.get.d.ts +2 -0
  433. package/dist/runtime/server/routes/realtime/ws.get.mjs +73 -0
  434. package/dist/runtime/server/routes/robots.txt.get.d.ts +2 -0
  435. package/dist/runtime/server/routes/robots.txt.get.mjs +41 -0
  436. package/dist/runtime/server/routes/rss.xml.get.d.ts +2 -0
  437. package/dist/runtime/server/routes/rss.xml.get.mjs +2 -0
  438. package/dist/runtime/server/routes/sitemap.xml.get.d.ts +2 -0
  439. package/dist/runtime/server/routes/sitemap.xml.get.mjs +84 -0
  440. package/dist/runtime/server/routes/storage/file/[...key].delete.d.ts +4 -0
  441. package/dist/runtime/server/routes/storage/file/[...key].delete.mjs +23 -0
  442. package/dist/runtime/server/routes/storage/file/[...key].get.d.ts +2 -0
  443. package/dist/runtime/server/routes/storage/file/[...key].get.mjs +23 -0
  444. package/dist/runtime/server/routes/storage/files.get.d.ts +14 -0
  445. package/dist/runtime/server/routes/storage/files.get.mjs +11 -0
  446. package/dist/runtime/server/routes/storage/presigned.post.d.ts +8 -0
  447. package/dist/runtime/server/routes/storage/presigned.post.mjs +39 -0
  448. package/dist/runtime/server/routes/storage/sign.post.d.ts +6 -0
  449. package/dist/runtime/server/routes/storage/sign.post.mjs +24 -0
  450. package/dist/runtime/server/routes/storage/upload.post.d.ts +22 -0
  451. package/dist/runtime/server/routes/storage/upload.post.mjs +96 -0
  452. package/dist/runtime/server/routes/tenants/[tenant]/domains/[domain]/index.delete.d.ts +8 -0
  453. package/dist/runtime/server/routes/tenants/[tenant]/domains/[domain]/index.delete.mjs +39 -0
  454. package/dist/runtime/server/routes/tenants/[tenant]/domains/[domain]/verify.post.d.ts +8 -0
  455. package/dist/runtime/server/routes/tenants/[tenant]/domains/[domain]/verify.post.mjs +39 -0
  456. package/dist/runtime/server/routes/tenants/[tenant]/domains/index.get.d.ts +8 -0
  457. package/dist/runtime/server/routes/tenants/[tenant]/domains/index.get.mjs +20 -0
  458. package/dist/runtime/server/routes/tenants/[tenant]/domains/index.post.d.ts +8 -0
  459. package/dist/runtime/server/routes/tenants/[tenant]/domains/index.post.mjs +44 -0
  460. package/dist/runtime/server/routes/tenants/current.get.d.ts +8 -0
  461. package/dist/runtime/server/routes/tenants/current.get.mjs +6 -0
  462. package/dist/runtime/server/tasks/cms/publish.d.ts +4 -0
  463. package/dist/runtime/server/tasks/cms/publish.mjs +18 -0
  464. package/dist/runtime/server/utils/agent-store.d.ts +24 -0
  465. package/dist/runtime/server/utils/agent-store.mjs +53 -0
  466. package/dist/runtime/server/utils/agents-registry-fallback.d.ts +1 -0
  467. package/dist/runtime/server/utils/agents-registry-fallback.mjs +1 -0
  468. package/dist/runtime/server/utils/ai.d.ts +119 -0
  469. package/dist/runtime/server/utils/ai.mjs +607 -0
  470. package/dist/runtime/server/utils/analytics-query.d.ts +109 -0
  471. package/dist/runtime/server/utils/analytics-query.mjs +234 -0
  472. package/dist/runtime/server/utils/auth.d.ts +60 -0
  473. package/dist/runtime/server/utils/auth.mjs +361 -0
  474. package/dist/runtime/server/utils/blob-store.d.ts +13 -0
  475. package/dist/runtime/server/utils/blob-store.mjs +60 -0
  476. package/dist/runtime/server/utils/bots.d.ts +21 -0
  477. package/dist/runtime/server/utils/bots.mjs +491 -0
  478. package/dist/runtime/server/utils/cache.d.ts +33 -0
  479. package/dist/runtime/server/utils/cache.mjs +128 -0
  480. package/dist/runtime/server/utils/cms-events.d.ts +17 -0
  481. package/dist/runtime/server/utils/cms-events.mjs +80 -0
  482. package/dist/runtime/server/utils/cms-filter.d.ts +3 -0
  483. package/dist/runtime/server/utils/cms-filter.mjs +34 -0
  484. package/dist/runtime/server/utils/cms.d.ts +278 -0
  485. package/dist/runtime/server/utils/cms.mjs +3268 -0
  486. package/dist/runtime/server/utils/config.d.ts +27 -0
  487. package/dist/runtime/server/utils/config.mjs +38 -0
  488. package/dist/runtime/server/utils/context.d.ts +13 -0
  489. package/dist/runtime/server/utils/context.mjs +98 -0
  490. package/dist/runtime/server/utils/crypto.d.ts +16 -0
  491. package/dist/runtime/server/utils/crypto.mjs +56 -0
  492. package/dist/runtime/server/utils/dev-logs.d.ts +21 -0
  493. package/dist/runtime/server/utils/dev-logs.mjs +41 -0
  494. package/dist/runtime/server/utils/dev-proxy.d.ts +1 -0
  495. package/dist/runtime/server/utils/dev-proxy.mjs +69 -0
  496. package/dist/runtime/server/utils/domains.d.ts +46 -0
  497. package/dist/runtime/server/utils/domains.mjs +318 -0
  498. package/dist/runtime/server/utils/drizzle.d.ts +10 -0
  499. package/dist/runtime/server/utils/drizzle.mjs +36 -0
  500. package/dist/runtime/server/utils/email-templates.d.ts +44 -0
  501. package/dist/runtime/server/utils/email-templates.mjs +373 -0
  502. package/dist/runtime/server/utils/feed.d.ts +42 -0
  503. package/dist/runtime/server/utils/feed.mjs +161 -0
  504. package/dist/runtime/server/utils/impersonation.d.ts +67 -0
  505. package/dist/runtime/server/utils/impersonation.mjs +298 -0
  506. package/dist/runtime/server/utils/jobs.d.ts +70 -0
  507. package/dist/runtime/server/utils/jobs.mjs +125 -0
  508. package/dist/runtime/server/utils/kv-store.d.ts +9 -0
  509. package/dist/runtime/server/utils/kv-store.mjs +32 -0
  510. package/dist/runtime/server/utils/mail-suppression.d.ts +62 -0
  511. package/dist/runtime/server/utils/mail-suppression.mjs +328 -0
  512. package/dist/runtime/server/utils/mail.d.ts +90 -0
  513. package/dist/runtime/server/utils/mail.mjs +366 -0
  514. package/dist/runtime/server/utils/notifications.d.ts +51 -0
  515. package/dist/runtime/server/utils/notifications.mjs +215 -0
  516. package/dist/runtime/server/utils/organization.d.ts +54 -0
  517. package/dist/runtime/server/utils/organization.mjs +354 -0
  518. package/dist/runtime/server/utils/passwordless.d.ts +48 -0
  519. package/dist/runtime/server/utils/passwordless.mjs +179 -0
  520. package/dist/runtime/server/utils/payments.d.ts +121 -0
  521. package/dist/runtime/server/utils/payments.mjs +1067 -0
  522. package/dist/runtime/server/utils/queue-fallback.d.ts +2 -0
  523. package/dist/runtime/server/utils/queue-fallback.mjs +2 -0
  524. package/dist/runtime/server/utils/queue.d.ts +4 -0
  525. package/dist/runtime/server/utils/queue.mjs +3 -0
  526. package/dist/runtime/server/utils/rag.d.ts +25 -0
  527. package/dist/runtime/server/utils/rag.mjs +333 -0
  528. package/dist/runtime/server/utils/ratelimit.d.ts +45 -0
  529. package/dist/runtime/server/utils/ratelimit.mjs +182 -0
  530. package/dist/runtime/server/utils/realtime.d.ts +110 -0
  531. package/dist/runtime/server/utils/realtime.mjs +197 -0
  532. package/dist/runtime/server/utils/schema-fallback.d.ts +3 -0
  533. package/dist/runtime/server/utils/schema-fallback.mjs +2 -0
  534. package/dist/runtime/server/utils/session.d.ts +72 -0
  535. package/dist/runtime/server/utils/session.mjs +287 -0
  536. package/dist/runtime/server/utils/sso.d.ts +49 -0
  537. package/dist/runtime/server/utils/sso.mjs +131 -0
  538. package/dist/runtime/server/utils/storage.d.ts +111 -0
  539. package/dist/runtime/server/utils/storage.mjs +654 -0
  540. package/dist/runtime/server/utils/tenant.d.ts +44 -0
  541. package/dist/runtime/server/utils/tenant.mjs +285 -0
  542. package/dist/runtime/server/utils/totp.d.ts +33 -0
  543. package/dist/runtime/server/utils/totp.mjs +112 -0
  544. package/dist/runtime/server/utils/tracker.d.ts +72 -0
  545. package/dist/runtime/server/utils/tracker.mjs +139 -0
  546. package/dist/runtime/server/utils/turnstile.d.ts +17 -0
  547. package/dist/runtime/server/utils/turnstile.mjs +68 -0
  548. package/dist/runtime/server/utils/vapid.d.ts +35 -0
  549. package/dist/runtime/server/utils/vapid.mjs +211 -0
  550. package/dist/runtime/storage.d.ts +1 -0
  551. package/dist/runtime/storage.mjs +0 -0
  552. package/dist/runtime/types/ai.d.ts +68 -0
  553. package/dist/runtime/types/ai.mjs +0 -0
  554. package/dist/runtime/types/analytics.d.ts +30 -0
  555. package/dist/runtime/types/analytics.mjs +0 -0
  556. package/dist/runtime/types/auth-globals.d.ts +14 -0
  557. package/dist/runtime/types/auth.d.ts +153 -0
  558. package/dist/runtime/types/auth.mjs +0 -0
  559. package/dist/runtime/types/browser.d.ts +29 -0
  560. package/dist/runtime/types/browser.mjs +0 -0
  561. package/dist/runtime/types/d1.d.ts +44 -0
  562. package/dist/runtime/types/d1.mjs +0 -0
  563. package/dist/runtime/types/drizzle.d.ts +13 -0
  564. package/dist/runtime/types/drizzle.mjs +0 -0
  565. package/dist/runtime/types/durable-object.d.ts +51 -0
  566. package/dist/runtime/types/durable-object.mjs +0 -0
  567. package/dist/runtime/types/email.d.ts +66 -0
  568. package/dist/runtime/types/email.mjs +0 -0
  569. package/dist/runtime/types/hyperdrive.d.ts +18 -0
  570. package/dist/runtime/types/hyperdrive.mjs +0 -0
  571. package/dist/runtime/types/imports.d.ts +58 -0
  572. package/dist/runtime/types/index.d.ts +156 -0
  573. package/dist/runtime/types/index.mjs +13 -0
  574. package/dist/runtime/types/queue.d.ts +67 -0
  575. package/dist/runtime/types/queue.mjs +0 -0
  576. package/dist/runtime/types/r2.d.ts +108 -0
  577. package/dist/runtime/types/r2.mjs +0 -0
  578. package/dist/runtime/types/ratelimit.d.ts +21 -0
  579. package/dist/runtime/types/ratelimit.mjs +0 -0
  580. package/dist/runtime/types/vectorize.d.ts +74 -0
  581. package/dist/runtime/types/vectorize.mjs +0 -0
  582. package/dist/runtime/vectorize.d.ts +21 -0
  583. package/dist/runtime/vectorize.mjs +53 -0
  584. package/dist/types.d.ts +2750 -0
  585. package/dist/types.mjs +1 -0
  586. package/dist/utils/agents.d.ts +8 -0
  587. package/dist/utils/auth-schema.d.ts +11 -0
  588. package/dist/utils/bindings.d.ts +16 -0
  589. package/dist/utils/cms-schema.d.ts +1 -0
  590. package/dist/utils/cms-sources.d.ts +62 -0
  591. package/dist/utils/drizzle.d.ts +42 -0
  592. package/dist/utils/jobs.d.ts +8 -0
  593. package/dist/utils/local-db.d.ts +28 -0
  594. package/dist/utils/notifications-schema.d.ts +15 -0
  595. package/dist/utils/payments-schema.d.ts +11 -0
  596. package/dist/utils/pkg.d.ts +15 -0
  597. package/dist/utils/queue.d.ts +8 -0
  598. package/dist/utils/tenants-schema.d.ts +11 -0
  599. package/package.json +104 -0
@@ -0,0 +1,2750 @@
1
+ export interface RateLimitConfig {
2
+ /**
3
+ * Max number of requests permitted within the time window.
4
+ *
5
+ * @default 100
6
+ */
7
+ limit?: number;
8
+ /**
9
+ * Period window in seconds: must be 10 or 60.
10
+ *
11
+ * @default 60
12
+ */
13
+ period?: 10 | 60;
14
+ /**
15
+ * Unique namespace ID grouping rate limit counters.
16
+ *
17
+ * @default 1001
18
+ */
19
+ namespaceId?: number;
20
+ }
21
+ export interface EmailOptions {
22
+ /**
23
+ * Default sender address or map of named sender presets.
24
+ *
25
+ * @example
26
+ * // Single default address:
27
+ * from: "MyApp <noreply@myapp.com>"
28
+ *
29
+ * // Map of named presets:
30
+ * from: {
31
+ * default: "MyApp <noreply@myapp.com>",
32
+ * support: "Support Team <support@myapp.com>",
33
+ * billing: "Acme Invoicing <billing@myapp.com>",
34
+ * }
35
+ */
36
+ from?: string | Record<string, string>;
37
+ /**
38
+ * Cloudflare send_email binding name override.
39
+ *
40
+ * @default "EMAIL"
41
+ */
42
+ binding?: string;
43
+ }
44
+ export interface AuthRedirectConfig {
45
+ /**
46
+ * Route to redirect after successful login.
47
+ *
48
+ * @default "/dashboard"
49
+ */
50
+ success?: string;
51
+ /**
52
+ * Route to redirect after logout.
53
+ *
54
+ * @default "/login"
55
+ */
56
+ logout?: string;
57
+ /**
58
+ * Route to redirect when an unauthenticated user accesses a protected route.
59
+ *
60
+ * @default "/login"
61
+ */
62
+ login?: string;
63
+ }
64
+ export interface AuthSessionConfig {
65
+ /**
66
+ * Session storage backend: sealed cookie or Cloudflare KV.
67
+ *
68
+ * @default "cookie"
69
+ */
70
+ backend?: "cookie" | "kv";
71
+ /**
72
+ * Session expiration maxAge in seconds.
73
+ *
74
+ * @default 604800 (7 days)
75
+ */
76
+ maxAge?: number;
77
+ /**
78
+ * Maximum concurrent sessions per user before LRU eviction.
79
+ *
80
+ * @default 5
81
+ */
82
+ maxSessionsPerUser?: number;
83
+ /**
84
+ * Throttled device tracking in D1.
85
+ *
86
+ * @default false
87
+ */
88
+ trackDevice?: boolean;
89
+ }
90
+ export interface AuthPasswordlessOtpConfig {
91
+ /** Enable 6-digit OTP codes */
92
+ enabled?: boolean;
93
+ /** Code TTL in seconds @default 300 */
94
+ ttl?: number;
95
+ /** Delivery channels @default ["email"] */
96
+ channels?: Array<"email" | "sms" | "whatsapp" | "telegram">;
97
+ }
98
+ export interface AuthPasswordlessMagicLinkConfig {
99
+ /** Enable email magic login links */
100
+ enabled?: boolean;
101
+ /** Link TTL in seconds @default 900 */
102
+ ttl?: number;
103
+ }
104
+ export interface AuthPasswordlessConfig {
105
+ otp?: boolean | AuthPasswordlessOtpConfig;
106
+ magicLink?: boolean | AuthPasswordlessMagicLinkConfig;
107
+ }
108
+ export interface AuthFieldDefinition {
109
+ type: "string" | "number" | "boolean" | "json";
110
+ default?: string | number | boolean;
111
+ enum?: readonly string[];
112
+ nullable?: boolean;
113
+ }
114
+ export interface AuthFieldsConfig {
115
+ extends?: Record<string, AuthFieldDefinition>;
116
+ }
117
+ export interface AuthOptions {
118
+ /** Route protection rules mapping path patterns to required role/permissions or boolean. */
119
+ rules?: Record<string, any>;
120
+ /**
121
+ * Base route prefix for auto-injected auth endpoints.
122
+ *
123
+ * @default "/api/auth"
124
+ */
125
+ prefix?: string;
126
+ /**
127
+ * Enabled OAuth providers (e.g. ['github', 'google', 'discord']). Auto-uses
128
+ * `NUXT_OAUTH_<PROVIDER>_CLIENT_ID` and `_CLIENT_SECRET`.
129
+ */
130
+ providers?: string[];
131
+ /**
132
+ * Automatic account linking for accounts sharing the same verified email address. Enforces
133
+ * dual-verified email check.
134
+ *
135
+ * @default true
136
+ */
137
+ linkAccounts?: boolean;
138
+ /** Redirect paths for auth flows. */
139
+ redirect?: AuthRedirectConfig;
140
+ /** Session storage configuration. */
141
+ session?: AuthSessionConfig;
142
+ /** Passwordless authentication (OTP / Magic Links). */
143
+ passwordless?: AuthPasswordlessConfig;
144
+ /** Declarative custom user fields (Tier 2). */
145
+ fields?: AuthFieldsConfig;
146
+ /**
147
+ * Enable Two-Factor Authentication (TOTP Authenticator Apps).
148
+ *
149
+ * @default false
150
+ */
151
+ twoFactor?: boolean;
152
+ /**
153
+ * Enable Multi-tenant Organizations & Teams.
154
+ *
155
+ * @default false
156
+ */
157
+ organizations?: boolean;
158
+ /**
159
+ * Enable Admin Impersonation.
160
+ *
161
+ * @default false
162
+ */
163
+ impersonation?: boolean;
164
+ /**
165
+ * Enable WebAuthn / Passkeys.
166
+ *
167
+ * @default false
168
+ */
169
+ webauthn?: boolean;
170
+ /**
171
+ * Alias for `webauthn`. Enable WebAuthn / Passkeys.
172
+ *
173
+ * @default false
174
+ */
175
+ webAuthn?: boolean;
176
+ /**
177
+ * Enable Personal Access Tokens (CLI keys).
178
+ *
179
+ * @default false
180
+ */
181
+ apiTokens?: boolean;
182
+ /**
183
+ * Enterprise: Cloudflare Turnstile bot and abuse protection.
184
+ */
185
+ turnstile?: boolean | AuthTurnstileConfig;
186
+ /**
187
+ * Enterprise: Mandatory Multi-Factor Authentication enforcement policies.
188
+ */
189
+ mfa?: AuthMfaConfig;
190
+ /**
191
+ * Enterprise: SAML 2.0 & Enterprise OIDC Single Sign-On (SSO).
192
+ *
193
+ * @default false
194
+ */
195
+ sso?: boolean | AuthSSOConfig;
196
+ /**
197
+ * Enterprise / GDPR: Self-serve account deletion settings.
198
+ */
199
+ accountDeletion?: boolean | AuthAccountDeletionConfig;
200
+ }
201
+ export interface AuthTurnstileConfig {
202
+ /** Turnstile secret key (or set NUXT_TURNSTILE_SECRET_KEY). */
203
+ secretKey?: string;
204
+ /** Turnstile public site key. */
205
+ siteKey?: string;
206
+ /** Automatic protection toggles for auth operations. */
207
+ protect?: {
208
+ login?: boolean;
209
+ register?: boolean;
210
+ otp?: boolean;
211
+ magicLink?: boolean;
212
+ accountDelete?: boolean;
213
+ };
214
+ }
215
+ export interface AuthMfaConfig {
216
+ /**
217
+ * Policy for MFA enforcement:
218
+ * - false / undefined: Optional MFA
219
+ * - true: Enforced for all authenticated users
220
+ * - "org": Enforced if user's current organization has mfaRequired set
221
+ * - "role": Enforced if user's role is in roles
222
+ */
223
+ enforce?: boolean | "org" | "role";
224
+ /** Roles that require MFA when enforce === "role" (default: ['admin', 'owner']) */
225
+ roles?: string[];
226
+ /** Redirect path when MFA is required but unverified (default: "/auth/2fa/verify") */
227
+ redirect?: string;
228
+ }
229
+ export interface AuthSSOConfig {
230
+ /** Enable Enterprise SSO endpoints & database tables. */
231
+ enabled?: boolean;
232
+ /** Default organization role for new users created via SSO (default: "member"). */
233
+ defaultRole?: string;
234
+ /** Allow automated self-registration for matching SSO domains (default: true). */
235
+ allowSelfRegistration?: boolean;
236
+ }
237
+ export interface AuthAccountDeletionConfig {
238
+ /** Allow users to delete their account self-serve (default: true). */
239
+ enabled?: boolean;
240
+ /** Require Cloudflare Turnstile verification token before deleting (default: false). */
241
+ requireTurnstile?: boolean;
242
+ /** Require explicit confirmation phrase (e.g. "DELETE") (default: false). */
243
+ requireConfirmationPhrase?: boolean;
244
+ /** Confirmation phrase string (default: "DELETE"). */
245
+ confirmationPhrase?: string;
246
+ /** Allow cascade deleting owned organizations if user is sole owner (default: false). */
247
+ allowOrgCascade?: boolean;
248
+ }
249
+ export interface QarpeoSSOConnection {
250
+ id: string;
251
+ organizationId?: string | null;
252
+ providerType: "saml" | "oidc";
253
+ name: string;
254
+ domain?: string | null;
255
+ clientId?: string | null;
256
+ clientSecret?: string | null;
257
+ issuer?: string | null;
258
+ ssoUrl: string;
259
+ tokenUrl?: string | null;
260
+ userinfoUrl?: string | null;
261
+ cert?: string | null;
262
+ enabled: boolean;
263
+ createdAt: number;
264
+ updatedAt: number;
265
+ }
266
+ export interface DeleteAccountOptions {
267
+ confirm?: boolean;
268
+ phrase?: string;
269
+ turnstileToken?: string;
270
+ cascadeOrg?: boolean;
271
+ }
272
+ export interface StorageImagePreset {
273
+ width?: number;
274
+ height?: number;
275
+ quality?: number;
276
+ format?: "webp" | "avif" | "jpeg" | "png";
277
+ fit?: "cover" | "contain" | "scale-down" | "crop" | "pad";
278
+ }
279
+ export interface JobsOptions {
280
+ /**
281
+ * Cloudflare Queue binding name override.
282
+ *
283
+ * @default "QUEUE"
284
+ */
285
+ binding?: string;
286
+ /**
287
+ * Directory where background jobs are located.
288
+ *
289
+ * @default "server/jobs"
290
+ */
291
+ dir?: string;
292
+ /**
293
+ * Maximum retry attempts for failed jobs.
294
+ *
295
+ * @default 3
296
+ */
297
+ maxRetries?: number;
298
+ /**
299
+ * Maximum batch size delivered to consumer.
300
+ *
301
+ * @default 10
302
+ */
303
+ maxBatchSize?: number;
304
+ /**
305
+ * Maximum batch timeout in seconds before delivering.
306
+ *
307
+ * @default 5
308
+ */
309
+ maxBatchTimeout?: number;
310
+ }
311
+ export interface JobContext {
312
+ /** Unique message/job ID */
313
+ id: string;
314
+ /** Timestamp when the job was dispatched */
315
+ timestamp: Date;
316
+ /** Delivery attempt count (starts at 1) */
317
+ attempts: number;
318
+ /** Name of the job being executed */
319
+ jobName: string;
320
+ /** Manually request a retry for this message */
321
+ retry: () => void;
322
+ /** Manually acknowledge this message */
323
+ ack: () => void;
324
+ }
325
+ export type JobHandler<T = any> = (data: T, context: JobContext) => Promise<void> | void;
326
+ export interface JobDefinitionOptions {
327
+ /** Override queue binding */
328
+ binding?: string;
329
+ /** Max retries before dead-letter */
330
+ maxRetries?: number;
331
+ }
332
+ export interface JobDefinition<T = any> {
333
+ name: string;
334
+ handler: JobHandler<T>;
335
+ options?: JobDefinitionOptions;
336
+ }
337
+ export interface AppRateLimitRule {
338
+ /** Max requests permitted in the time window */
339
+ max?: number;
340
+ /** Time window (e.g. '1m', '10s', '1h', or seconds) */
341
+ window?: string | number;
342
+ /** Optional custom identifier/key or grouping */
343
+ key?: string;
344
+ }
345
+ export interface RateLimitCheckResult {
346
+ /** Whether the request is permitted */
347
+ success: boolean;
348
+ /** Number of remaining requests permitted in the current window */
349
+ remaining: number;
350
+ /** Max limit for this window */
351
+ limit: number;
352
+ /** Seconds until the rate limit window resets */
353
+ reset: number;
354
+ }
355
+ export interface CheckRateLimitOptions extends AppRateLimitRule {
356
+ /** Optional custom identifier/key to rate limit against (defaults to client IP + route path) */
357
+ key?: string;
358
+ /** Storage backend override ('auto' | 'kv' | 'memory') */
359
+ backend?: "auto" | "kv" | "memory";
360
+ /** Custom binding name override */
361
+ binding?: string;
362
+ /** Custom error message when rate limit is exceeded */
363
+ message?: string;
364
+ /** Explicit event context */
365
+ event?: any;
366
+ }
367
+ export interface AppRateLimitOptions extends RateLimitConfig {
368
+ /** Whether edge rate limiting is enabled. */
369
+ enabled?: boolean;
370
+ /** Whether rate limiting applies globally to all routes not matched by `rules`. */
371
+ global?: boolean;
372
+ /**
373
+ * Max requests permitted within default window.
374
+ *
375
+ * @default 100
376
+ */
377
+ max?: number;
378
+ /**
379
+ * Default time window (e.g. '1m', '10s', '1h', or seconds).
380
+ *
381
+ * @default "1m"
382
+ */
383
+ window?: string | number;
384
+ /** IP whitelist that bypasses rate limiting. */
385
+ ipWhitelist?: string[];
386
+ /**
387
+ * Per-route rate limiting rules mapping path patterns to rules.
388
+ *
389
+ * @example
390
+ * rules: {
391
+ * '/api/auth/**': { max: 5, window: '1m' },
392
+ * '/api/search': { max: 30, window: '1m' },
393
+ * }
394
+ */
395
+ rules?: Record<string, AppRateLimitRule>;
396
+ /**
397
+ * Storage backend for rate limit counters.
398
+ *
399
+ * - 'auto': uses native Cloudflare RateLimiter binding if available, falls back to KV or memory
400
+ * - 'kv': Cloudflare KV
401
+ * - 'memory': in-memory sliding window
402
+ *
403
+ * @default "auto"
404
+ */
405
+ backend?: "auto" | "kv" | "memory";
406
+ }
407
+ export type AgentRole = "user" | "assistant" | "system" | "tool";
408
+ export interface AgentMessage {
409
+ id?: string;
410
+ role: AgentRole;
411
+ content: string;
412
+ name?: string;
413
+ toolCalls?: Array<{
414
+ id: string;
415
+ name: string;
416
+ arguments: any;
417
+ }>;
418
+ toolCallId?: string;
419
+ createdAt?: number;
420
+ }
421
+ export interface AgentTool<TParams = any, TResult = any> {
422
+ name?: string;
423
+ description: string;
424
+ parameters?: Record<string, any>;
425
+ execute: (params: TParams, context?: any) => Promise<TResult> | TResult;
426
+ }
427
+ export interface AgentContext {
428
+ agentId: string;
429
+ agentName: string;
430
+ state: Record<string, any>;
431
+ setState: (state: Record<string, any>) => Promise<void>;
432
+ messages: AgentMessage[];
433
+ saveMessages: (messages: AgentMessage[]) => Promise<void>;
434
+ tools: Record<string, AgentTool>;
435
+ env: Record<string, any>;
436
+ setAlarm: (timestamp: number | Date) => Promise<void>;
437
+ }
438
+ export interface AgentDefinition {
439
+ name: string;
440
+ model?: string;
441
+ system?: string;
442
+ tools?: Record<string, AgentTool> | AgentTool[];
443
+ maxSteps?: number;
444
+ maxTokens?: number;
445
+ temperature?: number;
446
+ maxContextMessages?: number;
447
+ onMessage?: (message: AgentMessage, context: AgentContext) => Promise<string | void> | string | void;
448
+ }
449
+ export interface AgentsOptions {
450
+ /**
451
+ * Cloudflare Durable Object binding name for agents.
452
+ *
453
+ * @default "QARPEO_AGENT_DO"
454
+ */
455
+ binding?: string;
456
+ /**
457
+ * Directory where agent files are located.
458
+ *
459
+ * @default "server/agents"
460
+ */
461
+ dir?: string;
462
+ /**
463
+ * Default Workers AI model to use.
464
+ *
465
+ * @default "@cf/meta/llama-3.3-70b-instruct"
466
+ */
467
+ defaultModel?: string;
468
+ /**
469
+ * Base API route path for agents.
470
+ *
471
+ * @default "/api/agents"
472
+ */
473
+ path?: string;
474
+ /**
475
+ * Require active user session to access agent endpoints.
476
+ *
477
+ * @default false
478
+ */
479
+ requireAuth?: boolean;
480
+ /** Alias for `requireAuth`. */
481
+ auth?: boolean;
482
+ /**
483
+ * Maximum autonomous tool execution steps before stopping.
484
+ *
485
+ * @default 5
486
+ */
487
+ maxSteps?: number;
488
+ /**
489
+ * Maximum messages preserved in context history sliding window.
490
+ *
491
+ * @default 30
492
+ */
493
+ maxContextMessages?: number;
494
+ }
495
+ export type BotProvider = "telegram" | "slack" | "discord" | "github" | "whatsapp" | "generic";
496
+ export interface BotMessageSender {
497
+ id: string;
498
+ name?: string;
499
+ username?: string;
500
+ avatarUrl?: string;
501
+ }
502
+ export interface BotMessage {
503
+ id: string;
504
+ text: string;
505
+ chatId: string;
506
+ channelId?: string;
507
+ sender?: BotMessageSender;
508
+ isCommand?: boolean;
509
+ command?: string;
510
+ args?: string[];
511
+ raw?: any;
512
+ }
513
+ export interface BotReplyOptions {
514
+ text: string;
515
+ parseMode?: "HTML" | "Markdown" | "MarkdownV2";
516
+ replyToMessageId?: string;
517
+ ephemeral?: boolean;
518
+ metadata?: Record<string, any>;
519
+ /**
520
+ * Enable or customize RFC 2369 / RFC 8058 List-Unsubscribe headers for this message.
521
+ * Set alse to disable for transactional emails (e.g. OTP, password reset).
522
+ */
523
+ unsubscribe?: boolean | {
524
+ url?: string;
525
+ email?: string;
526
+ };
527
+ /**
528
+ * Whether to check the suppression list before sending. Set alse to bypass
529
+ * suppression checks for critical security or transactional emails.
530
+ * @default true
531
+ */
532
+ suppression?: boolean;
533
+ }
534
+ export interface BotContext<TPayload = any> {
535
+ provider: BotProvider;
536
+ event: any;
537
+ rawBody: string;
538
+ payload: TPayload;
539
+ message?: BotMessage;
540
+ query: Record<string, any>;
541
+ headers: Record<string, string | undefined>;
542
+ reply: (textOrOptions: string | BotReplyOptions) => Promise<any>;
543
+ agent: (agentName: string, id?: string) => any;
544
+ }
545
+ export interface BotHandlerConfig<TPayload = any> {
546
+ /** The bot/webhook provider platform */
547
+ provider: BotProvider;
548
+ /**
549
+ * Secret or token used to verify incoming webhook signatures:
550
+ * - Telegram: secret_token configured in setWebhook
551
+ * - Slack: Signing Secret
552
+ * - Discord: Public Key (hex string)
553
+ * - GitHub: Webhook secret
554
+ * - WhatsApp: Meta App Secret
555
+ * - Generic: Secret token or HMAC secret
556
+ */
557
+ secret?: string;
558
+ /**
559
+ * Bot API token or credentials for sending replies:
560
+ * - Telegram: Bot Token from @BotFather (`TELEGRAM_BOT_TOKEN`)
561
+ * - Slack: Bot User OAuth Token `xoxb-...` (`SLACK_BOT_TOKEN`)
562
+ * - Discord: Bot Token (`DISCORD_BOT_TOKEN`)
563
+ * - WhatsApp: Meta System User Access Token (`WHATSAPP_ACCESS_TOKEN`)
564
+ */
565
+ botToken?: string;
566
+ /** Phone Number ID for WhatsApp Cloud API (falls back to `WHATSAPP_PHONE_NUMBER_ID`) */
567
+ phoneNumberId?: string;
568
+ /** Verify token for WhatsApp Cloud API GET challenge verification (falls back to `WHATSAPP_VERIFY_TOKEN`) */
569
+ verifyToken?: string;
570
+ /**
571
+ * Optional name of a Qarpeo agent to auto-wire. Incoming user messages are automatically sent
572
+ * to this agent and the agent's response is dispatched back to the chat platform.
573
+ */
574
+ agent?: string;
575
+ /**
576
+ * Custom session ID resolver for auto-wired agents. Defaults to `(msg) => msg.chatId`.
577
+ */
578
+ agentSessionId?: (message: BotMessage, event: any) => string;
579
+ /**
580
+ * Custom hook called whenever a text message is received.
581
+ */
582
+ onMessage?: (ctx: BotContext<TPayload>) => Promise<any> | any;
583
+ /**
584
+ * Custom hook called for any incoming platform event/action (e.g. Slack button clicks, GitHub push).
585
+ */
586
+ onEvent?: (eventName: string, ctx: BotContext<TPayload>) => Promise<any> | any;
587
+ /**
588
+ * Custom signature verification validator if you wish to override the default verification.
589
+ */
590
+ verifySignature?: (event: any, rawBody: string) => Promise<boolean> | boolean;
591
+ }
592
+ export interface ChunkOptions {
593
+ /** Maximum number of characters per chunk (default: 800) */
594
+ chunkSize?: number;
595
+ /** Number of characters of overlap between consecutive chunks (default: 100) */
596
+ chunkOverlap?: number;
597
+ /** Custom separator pattern or array of separators in priority order (default: ['\n\n', '\n', '. ', ' ']) */
598
+ separators?: string[];
599
+ }
600
+ export interface RAGDocument {
601
+ /** Unique document identifier */
602
+ id: string;
603
+ /** Full text content of the document */
604
+ text: string;
605
+ /** Optional metadata attached to every chunk of this document (e.g. title, url, author, category) */
606
+ metadata?: Record<string, any>;
607
+ /** Optional namespace within the Vectorize index */
608
+ namespace?: string;
609
+ }
610
+ export interface RAGChunk {
611
+ /** Unique chunk ID, e.g. `<docId>#chunk-<index>` */
612
+ id: string;
613
+ /** The text slice of this chunk */
614
+ text: string;
615
+ /** Parent document ID */
616
+ documentId: string;
617
+ /** 0-based index of the chunk */
618
+ chunkIndex: number;
619
+ /** Total number of chunks for this document */
620
+ totalChunks: number;
621
+ /** Merged document and chunk metadata */
622
+ metadata: Record<string, any>;
623
+ }
624
+ export interface RAGPipelineConfig {
625
+ /**
626
+ * Vectorize index binding name.
627
+ *
628
+ * @default "VECTORIZE"
629
+ */
630
+ binding?: string;
631
+ /**
632
+ * Workers AI binding name.
633
+ *
634
+ * @default "AI"
635
+ */
636
+ aiBinding?: string;
637
+ /**
638
+ * Embedding model to use.
639
+ *
640
+ * @default "@cf/baai/bge-base-en-v1.5"
641
+ */
642
+ embeddingModel?: string;
643
+ /**
644
+ * Generative LLM to use for answer generation.
645
+ *
646
+ * @default "@cf/meta/llama-3.3-70b-instruct"
647
+ */
648
+ llmModel?: string;
649
+ /** Default chunking parameters */
650
+ chunking?: ChunkOptions;
651
+ /** Default namespace for this pipeline */
652
+ namespace?: string;
653
+ /** Optional event context for binding resolution */
654
+ event?: any;
655
+ }
656
+ export interface RAGQueryOptions {
657
+ /** Maximum number of top matching chunks to retrieve (default: 5) */
658
+ topK?: number;
659
+ /** Minimum similarity score threshold (0.0 to 1.0) */
660
+ minScore?: number;
661
+ /** Metadata filter object */
662
+ filter?: Record<string, any>;
663
+ /** Namespace override */
664
+ namespace?: string;
665
+ /** Event context */
666
+ event?: any;
667
+ }
668
+ export interface RAGChunkMatch extends RAGChunk {
669
+ /** Similarity score (higher is more similar, typically 0.0 to 1.0) */
670
+ score: number;
671
+ }
672
+ export interface RAGContextResult {
673
+ /** Formatted markdown context string ready to inject into prompt */
674
+ contextText: string;
675
+ /** The matched chunks with scores and metadata */
676
+ matches: RAGChunkMatch[];
677
+ }
678
+ export interface RAGAnswerOptions extends RAGQueryOptions {
679
+ /** Custom system prompt instructions for answer generation */
680
+ system?: string;
681
+ /** Temperature for generation (default: 0.2) */
682
+ temperature?: number;
683
+ /** Maximum generation tokens */
684
+ maxTokens?: number;
685
+ }
686
+ export interface RAGAnswerResult {
687
+ /** Generated answer text */
688
+ answer: string;
689
+ /** Source chunks cited/used in answering */
690
+ sources: RAGChunkMatch[];
691
+ /** Query text */
692
+ query: string;
693
+ }
694
+ export interface RAGPipeline {
695
+ /** Splits raw text into overlapping contextual chunks */
696
+ chunkText(text: string, options?: ChunkOptions): string[];
697
+ /** Ingests and indexes a single document into Vectorize */
698
+ indexDocument(doc: RAGDocument, options?: {
699
+ chunking?: ChunkOptions;
700
+ event?: any;
701
+ }): Promise<{
702
+ chunksIndexed: number;
703
+ mutationId?: string;
704
+ }>;
705
+ /** Ingests and indexes multiple documents in batches */
706
+ indexDocuments(docs: RAGDocument[], options?: {
707
+ chunking?: ChunkOptions;
708
+ batchSize?: number;
709
+ event?: any;
710
+ }): Promise<{
711
+ totalIndexed: number;
712
+ totalChunks: number;
713
+ }>;
714
+ /** Deletes a document and all its chunks from the index */
715
+ deleteDocument(documentId: string, options?: {
716
+ maxChunks?: number;
717
+ event?: any;
718
+ }): Promise<void>;
719
+ /** Searches for most relevant chunks matching the query text */
720
+ query(queryText: string, options?: RAGQueryOptions): Promise<RAGChunkMatch[]>;
721
+ /** Retrieves matching chunks and formats them into an LLM context block */
722
+ retrieveContext(queryText: string, options?: RAGQueryOptions): Promise<RAGContextResult>;
723
+ /** Directly answers a user question using grounded RAG retrieval + LLM synthesis */
724
+ answer(queryText: string, options?: RAGAnswerOptions): Promise<RAGAnswerResult>;
725
+ /** Exports this pipeline as a typed tool for `defineAgent({ tools: { ... } })` */
726
+ asTool(options?: {
727
+ name?: string;
728
+ description?: string;
729
+ topK?: number;
730
+ minScore?: number;
731
+ }): AgentTool;
732
+ }
733
+ export interface AnalyticsOptions {
734
+ /**
735
+ * Cloudflare Analytics Engine binding name.
736
+ *
737
+ * @default "ANALYTICS"
738
+ */
739
+ binding?: string;
740
+ /**
741
+ * Cloudflare Analytics Engine dataset name (used in wrangler.json). Defaults to
742
+ * `<binding-lowercase>-prod` in production, `<binding-lowercase>-local-dev` in dev.
743
+ */
744
+ dataset?: string;
745
+ /**
746
+ * Cloudflare Account ID — required for the SQL API (read queries / dashboard). Falls back to
747
+ * `CLOUDFLARE_ACCOUNT_ID` environment variable.
748
+ */
749
+ accountId?: string;
750
+ /**
751
+ * Cloudflare API token with Analytics Engine read permissions. Falls back to
752
+ * `CLOUDFLARE_API_TOKEN` environment variable.
753
+ */
754
+ apiToken?: string;
755
+ /**
756
+ * Site identifier written to `indexes[0]` on every data point. Useful when a single AE dataset
757
+ * tracks multiple sites. Falls back to the request hostname.
758
+ */
759
+ siteId?: string;
760
+ /**
761
+ * Automatically track a pageview on every non-API SSR request via a server middleware.
762
+ *
763
+ * @default true
764
+ */
765
+ autoTrack?: boolean;
766
+ /**
767
+ * Base path for the analytics dashboard API routes.
768
+ *
769
+ * @default "/api/analytics"
770
+ */
771
+ path?: string;
772
+ }
773
+ /** Time range shorthand for dashboard queries. */
774
+ export type AnalyticsRange = "1h" | "24h" | "7d" | "30d" | "90d";
775
+ /** A single time-series bucket returned by AE SQL queries. */
776
+ export interface AnalyticsTimeSeriesPoint {
777
+ date: string;
778
+ count: number;
779
+ }
780
+ /** Pageview summary returned by the dashboard API. */
781
+ export interface PageviewSummary {
782
+ total: number;
783
+ series: AnalyticsTimeSeriesPoint[];
784
+ }
785
+ /** KPI summary returned by `/api/analytics/summary`. */
786
+ export interface AnalyticsSummary {
787
+ pageviews: number;
788
+ visitors: number;
789
+ topPages: Array<{
790
+ path: string;
791
+ views: number;
792
+ }>;
793
+ topReferrers: Array<{
794
+ referrer: string;
795
+ count: number;
796
+ }>;
797
+ countries: Array<{
798
+ country: string;
799
+ count: number;
800
+ }>;
801
+ devices: {
802
+ mobile: number;
803
+ desktop: number;
804
+ bot: number;
805
+ };
806
+ }
807
+ /** Tracked event record returned by `/api/analytics/events`. */
808
+ export interface AnalyticsEventRecord {
809
+ name: string;
810
+ count: number;
811
+ lastSeen: string;
812
+ }
813
+ export type DomainStatus = "pending" | "active" | "error" | "deleting";
814
+ export type DomainSslStatus = "initializing" | "pending_validation" | "active" | "expired";
815
+ export type DomainProviderType = "cloudflare" | "custom";
816
+ export interface DomainVerificationRecord {
817
+ type: "cname" | "txt";
818
+ name: string;
819
+ value: string;
820
+ target?: string;
821
+ }
822
+ export interface CustomDomainRecord {
823
+ id: string;
824
+ tenantId: string;
825
+ domain: string;
826
+ status: DomainStatus;
827
+ sslStatus: DomainSslStatus;
828
+ verificationRecords?: DomainVerificationRecord[];
829
+ cnameTarget?: string;
830
+ cloudflareHostnameId?: string;
831
+ errorMessage?: string;
832
+ createdAt: number;
833
+ updatedAt: number;
834
+ }
835
+ export interface TenantRecord {
836
+ id: string;
837
+ slug: string;
838
+ name: string;
839
+ plan?: string;
840
+ organizationId?: string;
841
+ customDomain?: string;
842
+ logoUrl?: string;
843
+ metadata?: Record<string, any>;
844
+ createdAt: number;
845
+ updatedAt: number;
846
+ }
847
+ export interface MultitenantOptions {
848
+ /**
849
+ * Root / apex domain(s) for subdomain matching (e.g. "qarpeo.com" or ["qarpeo.com",
850
+ * "qarpeo.dev"]). Requests matching `<tenant>.<rootDomain>` will automatically resolve to that
851
+ * tenant slug.
852
+ */
853
+ rootDomains?: string | string[];
854
+ /**
855
+ * Enable Custom Domains with automated SSL and DNS verification via Cloudflare for SaaS.
856
+ *
857
+ * @default true
858
+ */
859
+ customDomains?: boolean;
860
+ /**
861
+ * Domain provider for custom hostnames and SSL certificate provisioning. Currently supports
862
+ * "cloudflare" (Cloudflare for SaaS Custom Hostnames API), with extensible architecture for other
863
+ * providers.
864
+ *
865
+ * @default "cloudflare"
866
+ */
867
+ provider?: DomainProviderType;
868
+ /**
869
+ * Cloudflare Zone ID for Custom Hostnames API. Falls back to `CLOUDFLARE_ZONE_ID` environment
870
+ * variable.
871
+ */
872
+ zoneId?: string;
873
+ /**
874
+ * Cloudflare API token with SSL and Custom Hostnames permissions. Falls back to
875
+ * `CLOUDFLARE_API_TOKEN` environment variable.
876
+ */
877
+ apiToken?: string;
878
+ /** CNAME fallback target that custom domains must point to (e.g. "cname.myapp.com"). */
879
+ cnameTarget?: string;
880
+ /**
881
+ * Reserved tenant slugs that cannot be registered or resolved as subdomains.
882
+ *
883
+ * @default ["admin", "api", "app", "auth", "cms", "dashboard", "mail", "static", "studio", "www"]
884
+ */
885
+ reservedSlugs?: string[];
886
+ /**
887
+ * Header name to check for tenant ID / slug override (useful for API and local dev testing).
888
+ *
889
+ * @default "x-tenant-id"
890
+ */
891
+ headerName?: string;
892
+ /**
893
+ * Base API path for tenant domain endpoints.
894
+ *
895
+ * @default "/api/tenants"
896
+ */
897
+ path?: string;
898
+ /**
899
+ * KV binding name used for high-speed edge domain-to-tenant lookup cache.
900
+ *
901
+ * @default "KV"
902
+ */
903
+ kvBinding?: string;
904
+ }
905
+ export interface StreamTextOptions {
906
+ model?: string;
907
+ prompt?: string;
908
+ messages?: AgentMessage[];
909
+ system?: string;
910
+ tools?: Record<string, AgentTool>;
911
+ maxSteps?: number;
912
+ maxTokens?: number;
913
+ temperature?: number;
914
+ binding?: string;
915
+ event?: any;
916
+ }
917
+ export interface GenerateImageOptions {
918
+ /** The text prompt describing the image to generate */
919
+ prompt: string;
920
+ /** Negative prompt describing what to avoid in the generation */
921
+ negativePrompt?: string;
922
+ /**
923
+ * The model to use.
924
+ *
925
+ * @default "@cf/black-forest-labs/flux-1-schnell"
926
+ * Other common options:
927
+ * - "@cf/stabilityai/stable-diffusion-xl-base-1.0"
928
+ * - "@cf/bytedance/stable-diffusion-xl-lightning"
929
+ * - "@cf/runwayml/stable-diffusion-v1-5"
930
+ */
931
+ model?: string;
932
+ /** Number of diffusion steps (schnell default: 4, sdxl default: 20) */
933
+ steps?: number;
934
+ /** Output image width (default: 1024 or 512 depending on model) */
935
+ width?: number;
936
+ /** Output image height (default: 1024 or 512 depending on model) */
937
+ height?: number;
938
+ /** Classifier-free guidance scale (for SDXL/SD1.5) */
939
+ guidance?: number;
940
+ /** Random seed for reproducible generation */
941
+ seed?: number;
942
+ /** Optional source image for image-to-image (img2img) tasks */
943
+ image?: Uint8Array | ArrayBuffer | Blob | Array<number> | string;
944
+ /** Strength / denoising factor for image-to-image (0.0 to 1.0) */
945
+ strength?: number;
946
+ /** Desired output format / MIME type */
947
+ format?: "png" | "jpeg" | "webp";
948
+ /** Binding name or override (defaults to "AI") */
949
+ binding?: string;
950
+ /** Event context for binding resolution */
951
+ event?: any;
952
+ /** Cloudflare AI Gateway options */
953
+ gateway?: {
954
+ id: string;
955
+ skipCache?: boolean;
956
+ cacheTtl?: number;
957
+ };
958
+ }
959
+ export interface GenerateImageResult {
960
+ /** Binary bytes of the generated image */
961
+ uint8Array: Uint8Array;
962
+ /** ArrayBuffer representation */
963
+ arrayBuffer: ArrayBuffer;
964
+ /** Base64 string without data prefix */
965
+ base64: string;
966
+ /** Ready-to-use data URL (e.g. data:image/png;base64,...) */
967
+ dataUrl: string;
968
+ /** MIME type (e.g. "image/png" or "image/jpeg") */
969
+ mimeType: string;
970
+ /** Width in pixels if specified/known */
971
+ width?: number;
972
+ /** Height in pixels if specified/known */
973
+ height?: number;
974
+ /** Returns a Web Standard Response with Content-Type and Cache-Control headers */
975
+ toResponse(headers?: HeadersInit): Response;
976
+ /**
977
+ * Persist this image directly to Qarpeo's R2 Blob storage.
978
+ *
979
+ * @param key Blob path/key to save to (e.g. "generated/avatar.png")
980
+ */
981
+ saveToBlob(key: string, options?: {
982
+ binding?: string;
983
+ event?: any;
984
+ contentType?: string;
985
+ }): Promise<any>;
986
+ }
987
+ export interface GenerateSpeechOptions {
988
+ /** The text script to convert into spoken audio */
989
+ text: string;
990
+ /**
991
+ * The TTS model to use.
992
+ *
993
+ * @default "@cf/meta/mms-tts-eng"
994
+ * Other common options:
995
+ * - "@cf/myshell-ai/melotts-english"
996
+ * - "@cf/meta/mms-tts-fra"
997
+ * - "@cf/meta/mms-tts-spa"
998
+ * - "@cf/meta/mms-tts-deu"
999
+ */
1000
+ model?: string;
1001
+ /** Language code (e.g. "en", "eng", "es", "fr", "de") */
1002
+ lang?: string;
1003
+ /** Voice name or preset (for models that support multiple voices) */
1004
+ voice?: string;
1005
+ /** Speech rate / speed multiplier (e.g. 1.0) */
1006
+ speed?: number;
1007
+ /** Binding name override */
1008
+ binding?: string;
1009
+ /** Event context */
1010
+ event?: any;
1011
+ /** Cloudflare AI Gateway options */
1012
+ gateway?: {
1013
+ id: string;
1014
+ skipCache?: boolean;
1015
+ cacheTtl?: number;
1016
+ };
1017
+ }
1018
+ export interface GenerateSpeechResult {
1019
+ /** Binary bytes of the generated audio */
1020
+ uint8Array: Uint8Array;
1021
+ /** ArrayBuffer representation */
1022
+ arrayBuffer: ArrayBuffer;
1023
+ /** Base64 string */
1024
+ base64: string;
1025
+ /** Ready-to-use data URL (e.g. data:audio/wav;base64,...) */
1026
+ dataUrl: string;
1027
+ /** Audio MIME type, e.g. "audio/wav" */
1028
+ mimeType: string;
1029
+ /** Returns a Web Standard Response with Content-Type header */
1030
+ toResponse(headers?: HeadersInit): Response;
1031
+ /** Persist directly to R2 Blob storage */
1032
+ saveToBlob(key: string, options?: {
1033
+ binding?: string;
1034
+ event?: any;
1035
+ contentType?: string;
1036
+ }): Promise<any>;
1037
+ }
1038
+ export type TranscribeAudioInput = Uint8Array | ArrayBuffer | Blob | Array<number> | string;
1039
+ export interface TranscribeAudioOptions {
1040
+ /** Audio data as Uint8Array, ArrayBuffer, Blob, number array, or Base64 string */
1041
+ audio: TranscribeAudioInput;
1042
+ /**
1043
+ * The STT model to use.
1044
+ *
1045
+ * @default "@cf/openai/whisper"
1046
+ * Other options:
1047
+ * - "@cf/openai/whisper-tiny-en"
1048
+ * - "@cf/openai/whisper-large-v3-turbo"
1049
+ */
1050
+ model?: string;
1051
+ /** Language spoken in the audio (e.g. "en", "es", "fr", "de") */
1052
+ language?: string;
1053
+ /** Task: 'transcribe' (default) or 'translate' (translates spoken audio into English) */
1054
+ task?: "transcribe" | "translate";
1055
+ /** Whether to generate word-level timestamp intervals */
1056
+ timestamps?: boolean;
1057
+ /** Initial prompt / vocabulary hint to guide transcription accuracy */
1058
+ prompt?: string;
1059
+ /** Binding name override */
1060
+ binding?: string;
1061
+ /** Event context */
1062
+ event?: any;
1063
+ /** Cloudflare AI Gateway options */
1064
+ gateway?: {
1065
+ id: string;
1066
+ skipCache?: boolean;
1067
+ cacheTtl?: number;
1068
+ };
1069
+ }
1070
+ export interface TranscribeAudioResult {
1071
+ /** The transcribed text */
1072
+ text: string;
1073
+ /** Approximate or exact word count */
1074
+ wordCount: number;
1075
+ /** Word-level timestamps and tokens if returned by the model */
1076
+ words?: Array<{
1077
+ word: string;
1078
+ start: number;
1079
+ end: number;
1080
+ }>;
1081
+ /** WebVTT subtitles format if returned */
1082
+ vtt?: string;
1083
+ /** Language detected by the model if available */
1084
+ language?: string;
1085
+ /** Raw output object directly from Cloudflare Workers AI */
1086
+ raw: any;
1087
+ }
1088
+ export type EmailTemplateName = "welcome" | "magic-link" | "otp" | "order-confirmation" | "invite" | "notification" | string;
1089
+ export interface MailTemplateOptions {
1090
+ brandColor?: string;
1091
+ logoUrl?: string;
1092
+ companyName?: string;
1093
+ supportEmail?: string;
1094
+ }
1095
+ export interface EmailTemplateResult {
1096
+ subject?: string;
1097
+ html: string;
1098
+ text?: string;
1099
+ }
1100
+ export type EmailTemplateHandler<T = any> = (data: T, branding?: MailTemplateOptions) => EmailTemplateResult | Promise<EmailTemplateResult>;
1101
+ export interface MailTrackingOptions {
1102
+ /**
1103
+ * Track email open events via an invisible 1x1 tracking pixel.
1104
+ *
1105
+ * @default false
1106
+ */
1107
+ opens?: boolean;
1108
+ /**
1109
+ * Track link clicks by rewriting outgoing HTML links.
1110
+ *
1111
+ * @default false
1112
+ */
1113
+ clicks?: boolean;
1114
+ /**
1115
+ * Base URL used for tracking links and pixels (e.g. "https://myapp.com").
1116
+ * Defaults to request host or site URL.
1117
+ */
1118
+ baseUrl?: string;
1119
+ }
1120
+ export type MailSuppressionReason = "bounce" | "complaint" | "unsubscribe" | "manual";
1121
+ export type MailSuppressionType = "hard_bounce" | "soft_bounce" | "spam_complaint" | "unsubscribe" | "manual";
1122
+ export interface MailSuppressionRecord {
1123
+ id: string;
1124
+ email: string;
1125
+ reason: MailSuppressionReason;
1126
+ type: MailSuppressionType;
1127
+ source?: string;
1128
+ metadata?: Record<string, any>;
1129
+ createdAt: number;
1130
+ updatedAt: number;
1131
+ }
1132
+ export interface MailSuppressionOptions {
1133
+ /**
1134
+ * Automatically add emails to the suppression list upon hard bounce, spam complaints, or unsubscribes.
1135
+ * @default true
1136
+ */
1137
+ autoSuppress?: boolean;
1138
+ /**
1139
+ * Enforce suppression checks prior to dispatching outgoing mail.
1140
+ * Suppressed addresses are automatically filtered out to protect sender domain reputation.
1141
+ * @default true
1142
+ */
1143
+ enforce?: boolean;
1144
+ /**
1145
+ * Number of consecutive soft bounces before an address is permanently suppressed.
1146
+ * @default 3
1147
+ */
1148
+ softBounceThreshold?: number;
1149
+ }
1150
+ export interface MailUnsubscribeOptions {
1151
+ /**
1152
+ * Automatically generate and inject RFC 2369 & RFC 8058 compliant `List-Unsubscribe`
1153
+ * and `List-Unsubscribe-Post: List-Unsubscribe=One-Click` headers.
1154
+ * @default true
1155
+ */
1156
+ enabled?: boolean;
1157
+ /**
1158
+ * Custom unsubscribe URL or base path (e.g. "https://myapp.com/api/mail/unsubscribe").
1159
+ */
1160
+ url?: string;
1161
+ /**
1162
+ * Mailto fallback address for List-Unsubscribe header (e.g. "unsubscribe@myapp.com").
1163
+ */
1164
+ email?: string;
1165
+ /**
1166
+ * Secret key used to sign HMAC tokens for unsubscribe links.
1167
+ * Defaults to auth secret or session secret.
1168
+ */
1169
+ secret?: string;
1170
+ }
1171
+ export interface SendMailRequest {
1172
+ to: string | string[];
1173
+ from?: string;
1174
+ /** Email subject line. Optional when provided by a template. */
1175
+ subject?: string;
1176
+ template?: EmailTemplateName;
1177
+ data?: Record<string, any>;
1178
+ html?: string;
1179
+ text?: string;
1180
+ /**
1181
+ * Markdown body content. Automatically parsed into responsive, email-client-safe HTML.
1182
+ */
1183
+ markdown?: string;
1184
+ replyTo?: string;
1185
+ cc?: string | string[];
1186
+ bcc?: string | string[];
1187
+ headers?: Record<string, string>;
1188
+ /**
1189
+ * Queue this email for asynchronous background delivery via Cloudflare Queues.
1190
+ */
1191
+ queue?: boolean;
1192
+ /**
1193
+ * Enable open/click tracking for this specific message.
1194
+ */
1195
+ track?: boolean | {
1196
+ opens?: boolean;
1197
+ clicks?: boolean;
1198
+ };
1199
+ /**
1200
+ * Arbitrary metadata associated with this message for tracking, analytics, and webhooks.
1201
+ */
1202
+ metadata?: Record<string, any>;
1203
+ /**
1204
+ * Enable or customize RFC 2369 / RFC 8058 List-Unsubscribe headers for this message.
1205
+ * Set alse to disable for transactional emails (e.g. OTP, password reset).
1206
+ */
1207
+ unsubscribe?: boolean | {
1208
+ url?: string;
1209
+ email?: string;
1210
+ };
1211
+ /**
1212
+ * Whether to check the suppression list before sending. Set alse to bypass
1213
+ * suppression checks for critical security or transactional emails.
1214
+ * @default true
1215
+ */
1216
+ suppression?: boolean;
1217
+ }
1218
+ export interface MailResult {
1219
+ success: boolean;
1220
+ messageId: string;
1221
+ timestamp: number;
1222
+ previewUrl?: string;
1223
+ queued?: boolean;
1224
+ /** Whether the send was skipped because all recipients are suppressed */
1225
+ suppressed?: boolean;
1226
+ /** List of recipient addresses that were suppressed and excluded from delivery */
1227
+ suppressedRecipients?: string[];
1228
+ }
1229
+ export interface MailOptions {
1230
+ /** Default sender address (e.g. "My App <noreply@myapp.com>"). */
1231
+ from?: string;
1232
+ /**
1233
+ * Delivery provider.
1234
+ *
1235
+ * - 'cloudflare': Cloudflare send_email binding (default)
1236
+ * - 'resend': Resend API
1237
+ * - 'postmark': Postmark API
1238
+ * - 'dev': In-memory dev mailbox intercept only
1239
+ *
1240
+ * @default "cloudflare"
1241
+ */
1242
+ provider?: "cloudflare" | "resend" | "postmark" | "dev";
1243
+ /** API Key for external providers (Resend, Postmark). */
1244
+ apiKey?: string;
1245
+ /** Branding options applied to built-in email templates. */
1246
+ branding?: MailTemplateOptions;
1247
+ /**
1248
+ * Enable in-browser Dev Mailbox preview during local development.
1249
+ *
1250
+ * @default true
1251
+ */
1252
+ devMailbox?: boolean;
1253
+ /**
1254
+ * Enable queue-backed background email delivery using Cloudflare Queues.
1255
+ * When true, messages sent with sendMail are enqueued and delivered asynchronously
1256
+ * with automatic retries and exponential backoff.
1257
+ *
1258
+ * @default false
1259
+ */
1260
+ queue?: boolean | string;
1261
+ /**
1262
+ * Configure open and click tracking.
1263
+ */
1264
+ tracking?: MailTrackingOptions;
1265
+ /**
1266
+ * Email suppression list configuration for managing bounces, spam complaints, and unsubscribes.
1267
+ *
1268
+ * @default true
1269
+ */
1270
+ suppression?: boolean | MailSuppressionOptions;
1271
+ /**
1272
+ * RFC 2369 & RFC 8058 compliant List-Unsubscribe and one-click unsubscribe configuration.
1273
+ *
1274
+ * @default true
1275
+ */
1276
+ unsubscribe?: boolean | MailUnsubscribeOptions;
1277
+ }
1278
+ export interface CacheOptions {
1279
+ /**
1280
+ * Cloudflare KV binding name override for cache storage.
1281
+ *
1282
+ * @default "CACHE"
1283
+ */
1284
+ binding?: string;
1285
+ /**
1286
+ * Key prefix for cache entries in KV.
1287
+ *
1288
+ * @default "nitro:cache:"
1289
+ */
1290
+ base?: string;
1291
+ /**
1292
+ * Default Time-To-Live for cached items when not explicitly specified. Accepts number (seconds)
1293
+ * or human string (e.g. '1h', '30m', '1d').
1294
+ *
1295
+ * @default "1h"
1296
+ */
1297
+ defaultTtl?: string | number;
1298
+ /**
1299
+ * Automatically configure Stale-While-Revalidate (SWR) headers for cached responses.
1300
+ *
1301
+ * @default true
1302
+ */
1303
+ swr?: boolean;
1304
+ }
1305
+ export type BlobAccessTier = "public" | "unlisted" | "private";
1306
+ export interface SignedDownloadUrlOptions {
1307
+ /** Expiration duration (e.g. '1h', '15m', '7d', or seconds) */
1308
+ expiresIn?: string | number;
1309
+ /** Force browser download attachment */
1310
+ download?: boolean;
1311
+ /** Custom download filename override */
1312
+ filename?: string;
1313
+ }
1314
+ export interface StorageOptions {
1315
+ /**
1316
+ * Custom Cloudflare R2 binding name.
1317
+ *
1318
+ * @default "BLOB"
1319
+ */
1320
+ binding?: string;
1321
+ /**
1322
+ * Base route prefix for auto-injected storage endpoints.
1323
+ *
1324
+ * @default "/api/storage"
1325
+ */
1326
+ prefix?: string;
1327
+ /**
1328
+ * Custom public CDN domain or URL prefix (e.g. 'https://cdn.example.com'). If omitted, files are
1329
+ * served through Qarpeo's edge handler.
1330
+ */
1331
+ cdnUrl?: string;
1332
+ /**
1333
+ * Maximum allowed file upload size. Accepts number (bytes) or human string (e.g. '10MB',
1334
+ * '500KB').
1335
+ *
1336
+ * @default "20MB"
1337
+ */
1338
+ maxSize?: string | number;
1339
+ /**
1340
+ * Allowed MIME types for uploaded files (e.g. ['image/*', 'application/pdf']).
1341
+ *
1342
+ * @default ["*"]
1343
+ */
1344
+ allowedTypes?: string[];
1345
+ /**
1346
+ * Automatic directory scoping for multi-tenancy.
1347
+ *
1348
+ * - 'org': files stored under `org_${orgId}/`
1349
+ * - 'user': files stored under `user_${userId}/`
1350
+ * - 'public': files stored directly under root prefix
1351
+ *
1352
+ * @default "public"
1353
+ */
1354
+ scope?: "org" | "user" | "public";
1355
+ /**
1356
+ * Default access tier for newly uploaded files.
1357
+ *
1358
+ * - 'public': accessible to anyone
1359
+ * - 'unlisted': accessible via token-signed URL only
1360
+ * - 'private': guarded by session & authentication
1361
+ *
1362
+ * @default "public"
1363
+ */
1364
+ defaultAccess?: BlobAccessTier;
1365
+ /**
1366
+ * Whether unauthenticated callers are allowed to generate presigned upload tickets. Defaults to
1367
+ * false (authentication required).
1368
+ *
1369
+ * @default false
1370
+ */
1371
+ allowAnonymousUploads?: boolean;
1372
+ /** Cloudflare Image Resizing / optimization presets and settings. */
1373
+ images?: {
1374
+ /**
1375
+ * Enable Cloudflare Image Resizing (/cdn-cgi/image/...) on served URLs.
1376
+ *
1377
+ * @default true
1378
+ */
1379
+ resizing?: boolean;
1380
+ /**
1381
+ * Named transformation presets.
1382
+ *
1383
+ * @example
1384
+ * presets: {
1385
+ * thumbnail: { width: 150, height: 150, format: "webp" },
1386
+ * banner: { width: 1200, height: 400, quality: 85 }
1387
+ * }
1388
+ */
1389
+ presets?: Record<string, StorageImagePreset>;
1390
+ };
1391
+ }
1392
+ export type BlobOptions = StorageOptions;
1393
+ export type CMSFieldType = "string" | "text" | "number" | "boolean" | "image" | "date" | "tags" | "json" | "reference" | "blocks" | "component";
1394
+ /**
1395
+ * Options for a `reference` field, which links an entry to an entry in another collection (or the
1396
+ * same collection). References are stored inside the entry's `metadata_json`.
1397
+ */
1398
+ export interface CMSReferenceFieldOptions {
1399
+ /** Target collection ID that this field references. */
1400
+ to: string;
1401
+ /** Allow multiple references. When `true` the value is stored as an array. */
1402
+ multiple?: boolean;
1403
+ /** Optional filter restricting which target entries may be referenced. */
1404
+ filter?: Record<string, unknown>;
1405
+ }
1406
+ /** Stored shape of a single reference value inside entry `metadata_json`. */
1407
+ export interface CMSReferenceValue {
1408
+ id: string;
1409
+ collectionId: string;
1410
+ slug: string;
1411
+ title: string;
1412
+ }
1413
+ export interface CMSBlockDefinition {
1414
+ label?: string;
1415
+ icon?: string;
1416
+ description?: string;
1417
+ fields: Record<string, CMSFieldDefinition>;
1418
+ }
1419
+ export interface CMSBlockData {
1420
+ _id?: string;
1421
+ _type: string;
1422
+ [key: string]: any;
1423
+ }
1424
+ export interface CMSComponentDefinition {
1425
+ name?: string;
1426
+ label?: string;
1427
+ icon?: string;
1428
+ description?: string;
1429
+ fields: Record<string, CMSFieldDefinition>;
1430
+ }
1431
+ export interface CMSComponentFieldOptions {
1432
+ /** Registered component name (from cms.components) or inline component definition */
1433
+ name?: string;
1434
+ /** Inline field definitions if not referencing a named component */
1435
+ fields?: Record<string, CMSFieldDefinition>;
1436
+ /** Whether this component field is a repeatable list (array of component objects) */
1437
+ repeatable?: boolean;
1438
+ /** Maximum items allowed if repeatable */
1439
+ max?: number;
1440
+ /** Minimum items required if repeatable */
1441
+ min?: number;
1442
+ }
1443
+ export interface CMSFieldDefinition {
1444
+ type: CMSFieldType;
1445
+ label?: string;
1446
+ description?: string;
1447
+ required?: boolean;
1448
+ default?: any;
1449
+ options?: Array<{
1450
+ label: string;
1451
+ value: string;
1452
+ }>;
1453
+ /** Reference-specific options. Only used when `type` is `"reference"`. */
1454
+ reference?: CMSReferenceFieldOptions;
1455
+ /** Block schemas allowed in dynamic zones / page builders. Only used when `type` is `"blocks"`. */
1456
+ blocks?: Record<string, CMSBlockDefinition>;
1457
+ /** Reusable component options. Only used when `type` is `"component"`. */
1458
+ component?: string | CMSComponentFieldOptions;
1459
+ /** Shorthand to make a component field a repeatable list */
1460
+ repeatable?: boolean;
1461
+ }
1462
+ export interface CMSCollectionConfig {
1463
+ name?: string;
1464
+ description?: string;
1465
+ order?: number;
1466
+ fields?: Record<string, CMSFieldDefinition>;
1467
+ /**
1468
+ * Directory inside project where markdown files live for this collection. Default:
1469
+ * `content/<collection>`
1470
+ */
1471
+ directory?: string;
1472
+ /**
1473
+ * Path pattern(s) to automatically match files into this collection. Supports globs: e.g.
1474
+ * `"/docs/**"` or `["/docs/**", "/guides/**"]`.
1475
+ */
1476
+ path?: string | string[];
1477
+ /**
1478
+ * Collection type.
1479
+ *
1480
+ * - `"content"` (default) — flat key/value entries, slug-based lookup
1481
+ * - `"page"` — hierarchical markdown pages with path-based routing, TOC, MDC directives, and
1482
+ * navigation tree
1483
+ */
1484
+ type?: "content" | "page";
1485
+ /**
1486
+ * Whether to include this collection in the navigation tree. Set `false` or `{ hidden: true }` to
1487
+ * hide from navigation links.
1488
+ *
1489
+ * @default true
1490
+ */
1491
+ navigation?: boolean | {
1492
+ hidden?: boolean;
1493
+ title?: string;
1494
+ icon?: string;
1495
+ };
1496
+ /**
1497
+ * Hide this collection from navigation links.
1498
+ *
1499
+ * @default false
1500
+ */
1501
+ hidden?: boolean;
1502
+ /**
1503
+ * Editorial workflow mode for this collection.
1504
+ *
1505
+ * - `'db'` (default) — Dashboard edits are authoritative. D1 owns the content after initial
1506
+ * seeding.
1507
+ * - `'file-lock'` — Read-only in CMS Admin. Content is managed via Git files/PRs only.
1508
+ * - `'git-sync'` — Dashboard edits write back to Git (via disk in dev, GitHub API in production).
1509
+ */
1510
+ mode?: "db" | "file-lock" | "git-sync";
1511
+ /** Git sync configuration for this collection when mode is 'git-sync'. */
1512
+ github?: CMSGitHubConfig;
1513
+ /** Outgoing webhooks triggered by changes in this collection. */
1514
+ webhooks?: CMSWebhookConfig[];
1515
+ /** Deploy trigger settings for this collection. */
1516
+ deploy?: CMSDeployTriggerConfig;
1517
+ /**
1518
+ * Editorial approval workflow configuration. When enabled, content mutations require approval
1519
+ * before being published.
1520
+ *
1521
+ * - `true`: Requires an admin or second editor to approve before publish.
1522
+ * - `{ roles: [...], allowSelfApproval: false }`: Fine-grained approval policy.
1523
+ */
1524
+ approval?: boolean | CMSApprovalConfig;
1525
+ /**
1526
+ * Supported locales for localized content (e.g. ["en", "es", "fr", "de"]).
1527
+ *
1528
+ * @default ["en"]
1529
+ */
1530
+ locales?: string[];
1531
+ /**
1532
+ * Default fallback locale for content resolution.
1533
+ *
1534
+ * @default "en"
1535
+ */
1536
+ defaultLocale?: string;
1537
+ /**
1538
+ * Enable scheduled publishing for this collection.
1539
+ *
1540
+ * @default false
1541
+ */
1542
+ scheduledPublish?: boolean;
1543
+ /**
1544
+ * Whether this collection is a singleton (max 1 entry, e.g. site settings).
1545
+ *
1546
+ * @default false
1547
+ */
1548
+ singleton?: boolean;
1549
+ }
1550
+ export interface CMSApprovalConfig {
1551
+ /**
1552
+ * Roles authorized to approve and publish entries in this collection.
1553
+ *
1554
+ * @default ["admin"]
1555
+ */
1556
+ roles?: string[];
1557
+ /**
1558
+ * Whether the author of an entry is permitted to approve their own entry. When `false`, a
1559
+ * different team member with an approver role must approve it.
1560
+ *
1561
+ * @default false
1562
+ */
1563
+ allowSelfApproval?: boolean;
1564
+ }
1565
+ export interface CMSGitHubConfig {
1566
+ /**
1567
+ * GitHub repository in "owner/repo" format. e.g. "qarpeo/qarpeo.com" Can also be inferred from
1568
+ * process.env.GITHUB_REPOSITORY.
1569
+ */
1570
+ repo?: string;
1571
+ /**
1572
+ * Target branch for direct commits.
1573
+ *
1574
+ * @default "main"
1575
+ */
1576
+ branch?: string;
1577
+ /**
1578
+ * Whether to open a Pull Request instead of committing directly to the branch.
1579
+ *
1580
+ * @default false
1581
+ */
1582
+ pr?: boolean;
1583
+ /**
1584
+ * Base branch to open PR against if `pr: true`.
1585
+ *
1586
+ * @default "main"
1587
+ */
1588
+ prBase?: string;
1589
+ /**
1590
+ * Branch prefix when creating a branch for PR.
1591
+ *
1592
+ * @default "content/"
1593
+ */
1594
+ branchPrefix?: string;
1595
+ /**
1596
+ * Commit message template. Supports placeholders: `{collection}`, `{slug}`, `{action}` (create,
1597
+ * update, delete)
1598
+ *
1599
+ * @default "content({collection}): {action} {slug}"
1600
+ */
1601
+ commitMessage?: string;
1602
+ /**
1603
+ * GitHub personal access token with contents:write permission. Falls back to
1604
+ * `process.env.GITHUB_TOKEN` or `GH_TOKEN`.
1605
+ */
1606
+ token?: string;
1607
+ /**
1608
+ * Secret used to verify incoming GitHub webhook signatures (`X-Hub-Signature-256`).
1609
+ * Falls back to `process.env.GITHUB_WEBHOOK_SECRET` or `cms.webhookSecret`.
1610
+ */
1611
+ webhookSecret?: string;
1612
+ }
1613
+ export interface CMSWebhookConfig {
1614
+ /** Target endpoint URL to send HTTP POST request */
1615
+ url: string;
1616
+ /**
1617
+ * Action events that trigger this webhook.
1618
+ *
1619
+ * @default ["publish", "unpublish"]
1620
+ */
1621
+ events?: Array<"create" | "update" | "delete" | "publish" | "unpublish">;
1622
+ /** Optional secret for HMAC-SHA256 signature in `X-Qarpeo-Signature` header (`sha256=<hex>`). */
1623
+ secret?: string;
1624
+ /** Custom headers to include with the webhook POST request. */
1625
+ headers?: Record<string, string>;
1626
+ }
1627
+ export interface CMSDeployTriggerConfig {
1628
+ /**
1629
+ * When to trigger a site redeployment.
1630
+ *
1631
+ * - `"on-publish"` (default) — Trigger whenever content is published or unpublished
1632
+ * - `"manual"` — Only triggered when explicitly requested via CMS Admin or API
1633
+ */
1634
+ trigger?: "on-publish" | "manual";
1635
+ /**
1636
+ * HTTP deploy hook URL (e.g. Cloudflare Pages deploy hook, Vercel deploy hook, Netlify build
1637
+ * hook).
1638
+ */
1639
+ hookUrl?: string;
1640
+ /** Provider options (e.g. GitHub Actions workflow dispatch). */
1641
+ github?: {
1642
+ repo: string;
1643
+ workflow: string;
1644
+ ref?: string;
1645
+ token?: string;
1646
+ };
1647
+ }
1648
+ export interface CMSRevisionsConfig {
1649
+ /**
1650
+ * Maximum revisions to retain per entry before pruning.
1651
+ *
1652
+ * @default 10
1653
+ */
1654
+ max?: number;
1655
+ }
1656
+ export interface CMSOptions {
1657
+ /**
1658
+ * Mount the embedded edge CMS Admin.
1659
+ *
1660
+ * @default true
1661
+ */
1662
+ admin?: boolean;
1663
+ /**
1664
+ * Base route path for the CMS Admin.
1665
+ *
1666
+ * @default "/cms"
1667
+ */
1668
+ path?: string;
1669
+ /**
1670
+ * Base route path for public CMS API endpoints.
1671
+ *
1672
+ * @default "/api/cms"
1673
+ */
1674
+ apiPath?: string;
1675
+ /**
1676
+ * Root directory in project for file-based markdown/MDX content.
1677
+ *
1678
+ * @default "content"
1679
+ */
1680
+ contentDir?: string;
1681
+ /**
1682
+ * Shiki syntax highlighting shortcut.
1683
+ *
1684
+ * @default true
1685
+ */
1686
+ shiki?: boolean | CMSShikiPluginOptions;
1687
+ /**
1688
+ * Hybrid mode: automatically synchronize local content files into D1 on dev server start.
1689
+ *
1690
+ * @default true
1691
+ */
1692
+ hybrid?: boolean;
1693
+ /**
1694
+ * Roles allowed to access the CMS admin and mutate entries.
1695
+ *
1696
+ * @default ["admin", "editor"]
1697
+ */
1698
+ roles?: string[];
1699
+ /**
1700
+ * Revision history settings.
1701
+ *
1702
+ * @default { max: 10 }
1703
+ */
1704
+ revisions?: boolean | CMSRevisionsConfig;
1705
+ /**
1706
+ * Cache queries at the edge in KV.
1707
+ *
1708
+ * @default true
1709
+ */
1710
+ cache?: boolean;
1711
+ /** Collections schema definitions. */
1712
+ collections?: Record<string, CMSCollectionConfig>;
1713
+ /**
1714
+ * Globally registered reusable component definitions.
1715
+ * Components can be referenced by name in collection fields using `type: \"component\"`\.
1716
+ */
1717
+ components?: Record<string, CMSComponentDefinition>;
1718
+ /** Multi-source content aggregation sources (can also be defined via content _sources.yml files). */
1719
+ sources?: CMSSourceConfig[];
1720
+ /**
1721
+ * Glob pattern(s) to exclude files or folders from CMS synchronization. e.g. `["**\/hosting\/**",
1722
+ * "**\/dashboard\/**"]`
1723
+ */
1724
+ exclude?: string | string[];
1725
+ /** Global GitHub repository configuration for CMS git-sync write-back. */
1726
+ github?: CMSGitHubConfig;
1727
+ /** Global deploy trigger configuration to rebuild static sites on content publish. */
1728
+ deploy?: CMSDeployTriggerConfig;
1729
+ /** Global outgoing webhook endpoints triggered on content mutations. */
1730
+ webhooks?: CMSWebhookConfig[];
1731
+ /**
1732
+ * Secret used to authenticate incoming CMS webhooks (e.g. from GitHub, Cloudflare Queues, or CI/CD).
1733
+ * Passed via `X-CMS-Secret`, `Authorization: Bearer <secret>`, or `X-Hub-Signature-256`.
1734
+ */
1735
+ webhookSecret?: string;
1736
+ /** Global approval workflow default for collections. */
1737
+ approval?: boolean | CMSApprovalConfig;
1738
+ /**
1739
+ * Supported locales for localized content (e.g. ["en", "es", "fr", "de"]).
1740
+ *
1741
+ * @default ["en"]
1742
+ */
1743
+ locales?: string[];
1744
+ /**
1745
+ * Default fallback locale for content resolution.
1746
+ *
1747
+ * @default "en"
1748
+ */
1749
+ defaultLocale?: string;
1750
+ /**
1751
+ * Global default for scheduled publishing.
1752
+ *
1753
+ * @default false
1754
+ */
1755
+ scheduledPublish?: boolean;
1756
+ /**
1757
+ * Markdown rendering plugins to enable.
1758
+ *
1759
+ * Each key enables (or configures) an optional comark plugin:
1760
+ *
1761
+ * - `shiki` — Syntax highlighting via Shiki. Enabled by default when the `cms` option is active.
1762
+ * - `math` — KaTeX equation rendering (future).
1763
+ * - `mermaid` — Mermaid diagram rendering (future).
1764
+ *
1765
+ * Pass `true`/`false` to enable/disable, or an options object to configure.
1766
+ *
1767
+ * @example
1768
+ * ;```ts
1769
+ * cms: {
1770
+ * plugins: {
1771
+ * shiki: { theme: 'github-dark' },
1772
+ * math: true,
1773
+ * }
1774
+ * }
1775
+ * ```
1776
+ */
1777
+ plugins?: CMSPluginOptions;
1778
+ }
1779
+ /**
1780
+ * Config-driven plugin options for the CMS markdown renderer. Plugins are applied both server-side
1781
+ * (pre-render to HTML) and client-side (live render via ContentRenderer).
1782
+ */
1783
+ export interface CMSPluginOptions {
1784
+ /**
1785
+ * Shiki syntax highlighting. Pass `true` to enable with defaults, or an options object to
1786
+ * customise.
1787
+ *
1788
+ * @default true (when cms is enabled)
1789
+ */
1790
+ shiki?: boolean | CMSShikiPluginOptions;
1791
+ /**
1792
+ * KaTeX math equation rendering.
1793
+ *
1794
+ * @default false
1795
+ */
1796
+ math?: boolean;
1797
+ /**
1798
+ * Mermaid diagram rendering.
1799
+ *
1800
+ * @default false
1801
+ */
1802
+ mermaid?: boolean;
1803
+ }
1804
+ /** Options for the Shiki syntax highlighting plugin. */
1805
+ export interface CMSShikiPluginOptions {
1806
+ /**
1807
+ * Light mode theme.
1808
+ *
1809
+ * @default "material-theme-lighter"
1810
+ */
1811
+ lightTheme?: string;
1812
+ /**
1813
+ * Dark mode theme.
1814
+ *
1815
+ * @default "material-theme-palenight"
1816
+ */
1817
+ darkTheme?: string;
1818
+ /**
1819
+ * Extra languages to support beyond the built-in defaults. Built-in defaults: vue, tsx, svelte,
1820
+ * typescript, javascript, bash, json, yaml, astro.
1821
+ */
1822
+ langs?: string[];
1823
+ }
1824
+ export interface CMSSourceConfig {
1825
+ /**
1826
+ * Source location:
1827
+ *
1828
+ * - Local directory relative to the _sources.yml file: e.g. `../qarpeo/docs`
1829
+ * - Remote GitHub repo: e.g. `github:qarpeo/qarpeo-blog/posts#main`
1830
+ * - Remote tarball URL
1831
+ */
1832
+ from: string;
1833
+ /**
1834
+ * Content URL prefix.
1835
+ *
1836
+ * - Omitted / './' : relative to the directory containing this _sources.yml
1837
+ * - '../sub' : relative, up one level
1838
+ * - '/docs' : absolute from content root
1839
+ */
1840
+ prefix?: string;
1841
+ /** Priority (higher wins). Default: 0. Local content/ files have implicit priority 10. */
1842
+ priority?: number;
1843
+ /** Order position in navigation relative to other sources (e.g. 1, 2, 3). */
1844
+ order?: number;
1845
+ /** Glob include pattern (default: all markdown files) */
1846
+ include?: string;
1847
+ /** Glob exclude pattern (e.g. "_drafts/*") */
1848
+ exclude?: string;
1849
+ /** Human-readable label for debugging / devtools display */
1850
+ label?: string;
1851
+ }
1852
+ export interface CMSResolvedSource extends CMSSourceConfig {
1853
+ /** Absolute resolved path on local disk (either resolved sibling or downloaded giget cache dir) */
1854
+ resolvedDir: string;
1855
+ /** Normalized absolute content route prefix (e.g. "/docs", "/templates") */
1856
+ normalizedPrefix: string;
1857
+ /** Source config file location where this was defined */
1858
+ sourceConfigFile?: string;
1859
+ }
1860
+ export interface CMSHeadingLink {
1861
+ id: string;
1862
+ text: string;
1863
+ depth: number;
1864
+ children?: CMSHeadingLink[];
1865
+ }
1866
+ export interface CMSNavigationItem {
1867
+ title: string;
1868
+ path?: string;
1869
+ to?: string;
1870
+ icon?: string;
1871
+ description?: string;
1872
+ type?: string;
1873
+ children?: CMSNavigationItem[];
1874
+ locale?: string;
1875
+ [key: string]: any;
1876
+ }
1877
+ export interface CMSNavigationOptions {
1878
+ /**
1879
+ * Maximum nesting depth to return. `1` = root level only (e.g. top-level sections for header
1880
+ * menus).
1881
+ */
1882
+ levels?: number;
1883
+ /**
1884
+ * Scope navigation tree to a specific path prefix (e.g. `"/docs/cms"`). Useful for lazy-loading
1885
+ * subtrees on demand.
1886
+ */
1887
+ path?: string;
1888
+ /** Maximum number of items to return (at root or top-level list). */
1889
+ limit?: number;
1890
+ /** Number of items to skip (offset) for pagination. */
1891
+ skip?: number;
1892
+ /**
1893
+ * Filter navigation items by editorial status.
1894
+ *
1895
+ * - `"published"` (default) — only published items
1896
+ * - `"draft"` — only draft items
1897
+ * - `"all"` — all items including drafts
1898
+ *
1899
+ * @default "published"
1900
+ */
1901
+ status?: "published" | "draft" | "all";
1902
+ /**
1903
+ * Filter navigation items by any frontmatter field value. First-class columns (`title`,
1904
+ * `description`, `tags`, `path`, `slug`) are matched directly; all other fields are matched
1905
+ * against the `metadata_json` blob stored alongside each entry.
1906
+ *
1907
+ * Values are compared with strict equality (`===`). `null` matches entries where the field is
1908
+ * absent or explicitly `null`.
1909
+ *
1910
+ * @example
1911
+ * // Only show items tagged as tutorials in the "guides" category
1912
+ * queryCollectionNavigation("docs", { where: { category: "guides", featured: true } })
1913
+ */
1914
+ where?: Record<string, string | number | boolean | null>;
1915
+ /** Optional locale filter (e.g. "en", "es") */
1916
+ locale?: string;
1917
+ /** When true, unwraps a single root collection node (e.g. /docs) */
1918
+ unwrap?: boolean;
1919
+ }
1920
+ export interface CMSEntry {
1921
+ id: string;
1922
+ collectionId: string;
1923
+ slug: string;
1924
+ path?: string;
1925
+ title: string;
1926
+ description?: string | null;
1927
+ coverImage?: string | null;
1928
+ tags?: string | null;
1929
+ order: number;
1930
+ contentMd: string;
1931
+ contentHtml: string;
1932
+ body?: {
1933
+ toc?: {
1934
+ links: CMSHeadingLink[];
1935
+ };
1936
+ [key: string]: any;
1937
+ };
1938
+ toc?: {
1939
+ links: CMSHeadingLink[];
1940
+ };
1941
+ navigation?: {
1942
+ title?: string;
1943
+ icon?: string;
1944
+ };
1945
+ metadata?: Record<string, unknown>;
1946
+ metadataJson?: string;
1947
+ status: CMSEntryStatus;
1948
+ source: "file" | "db";
1949
+ filePath?: string | null;
1950
+ contentHash?: string | null;
1951
+ authorId?: string | null;
1952
+ publishedAt?: number | null;
1953
+ tenantId?: string | null;
1954
+ locale?: string;
1955
+ version?: string;
1956
+ createdAt: number;
1957
+ updatedAt: number;
1958
+ }
1959
+ export type CMSEntryStatus = "draft" | "pending_review" | "scheduled" | "published" | "archived";
1960
+ /** A CMS collection record as stored in D1 (`_qarpeo_cms_collections`). */
1961
+ export interface CMSCollection {
1962
+ id: string;
1963
+ name: string;
1964
+ description?: string | null;
1965
+ schemaJson: string;
1966
+ tenantId?: string | null;
1967
+ /** Parsed field definitions (derived from schemaJson at runtime). */
1968
+ fields?: Record<string, CMSFieldDefinition>;
1969
+ /** 'config' = seeded from nuxt.config.ts; 'db' = created from CMS Admin. */
1970
+ source: "config" | "db";
1971
+ /** Order position in collection list / navigation tree. */
1972
+ order?: number;
1973
+ /** Whether this collection is a singleton (max 1 entry). */
1974
+ singleton?: boolean;
1975
+ createdAt: number;
1976
+ updatedAt: number;
1977
+ }
1978
+ export interface CMSPreviewTokenResult {
1979
+ token: string;
1980
+ expires: number;
1981
+ /** Direct URL to preview the page with query parameters */
1982
+ previewUrl: string;
1983
+ /** One-click share URL that activates the preview cookie and redirects to the page */
1984
+ shareUrl: string;
1985
+ }
1986
+ export interface CMSPreviewState {
1987
+ isPreview: boolean;
1988
+ token: string | null;
1989
+ expires: string | null;
1990
+ collection: string | null;
1991
+ slug: string | null;
1992
+ }
1993
+ export interface CMSQueryOptions {
1994
+ page?: number;
1995
+ limit?: number;
1996
+ sort?: string;
1997
+ status?: CMSEntryStatus | "all";
1998
+ tag?: string;
1999
+ fields?: string;
2000
+ /** Whether to allow fetching draft entries when preview mode or token is active */
2001
+ preview?: boolean;
2002
+ /** HMAC preview token for draft access */
2003
+ previewToken?: string;
2004
+ /** Preview token expiration timestamp */
2005
+ previewExpires?: string | number;
2006
+ /**
2007
+ * Filter entries by custom metadata fields. Key-value pairs matching JSON properties in
2008
+ * `metadataJson`.
2009
+ */
2010
+ where?: Record<string, unknown>;
2011
+ /**
2012
+ * Resolve reference fields into the full referenced entry. `true` populates every reference
2013
+ * field; an array of field names populates only the listed fields. When omitted, reference fields
2014
+ * are returned as lightweight `{ id, collectionId, slug, title }` objects.
2015
+ */
2016
+ populate?: boolean | string[];
2017
+ }
2018
+ export interface CMSCreateInput {
2019
+ slug: string;
2020
+ title: string;
2021
+ description?: string;
2022
+ coverImage?: string;
2023
+ tags?: string;
2024
+ order?: number;
2025
+ contentMd: string;
2026
+ metadata?: Record<string, unknown>;
2027
+ status?: CMSEntryStatus;
2028
+ authorId?: string;
2029
+ publishedAt?: number | null;
2030
+ }
2031
+ export interface CMSUpdateInput {
2032
+ slug?: string;
2033
+ title?: string;
2034
+ description?: string;
2035
+ coverImage?: string;
2036
+ tags?: string;
2037
+ order?: number;
2038
+ contentMd?: string;
2039
+ metadata?: Record<string, unknown>;
2040
+ status?: CMSEntryStatus;
2041
+ authorId?: string;
2042
+ publishedAt?: number | null;
2043
+ }
2044
+ export interface RealtimeOptions {
2045
+ /**
2046
+ * Base route path for WebSocket connections.
2047
+ *
2048
+ * @default "/api/realtime/ws"
2049
+ */
2050
+ path?: string;
2051
+ /**
2052
+ * Cloudflare Durable Object binding name.
2053
+ *
2054
+ * @default "QARPEO_ROOM_DO"
2055
+ */
2056
+ binding?: string;
2057
+ /**
2058
+ * Enable presence tracking (automatic join/leave events and active roster sync).
2059
+ *
2060
+ * @default true
2061
+ */
2062
+ presence?: boolean;
2063
+ /**
2064
+ * Require authenticated session to connect to rooms.
2065
+ *
2066
+ * @default false
2067
+ */
2068
+ requireAuth?: boolean;
2069
+ /**
2070
+ * Alias for `requireAuth`. Require authenticated session to connect to rooms.
2071
+ *
2072
+ * @default false
2073
+ */
2074
+ auth?: boolean;
2075
+ /**
2076
+ * Maximum concurrent WebSocket connections allowed per room.
2077
+ *
2078
+ * @default 100
2079
+ */
2080
+ maxConnectionsPerRoom?: number;
2081
+ /**
2082
+ * Maximum recent messages retained in the room's replay buffer in Durable Object storage.
2083
+ *
2084
+ * @default 50
2085
+ */
2086
+ historyLimit?: number;
2087
+ /**
2088
+ * Ping/heartbeat interval in milliseconds.
2089
+ *
2090
+ * @default 30000
2091
+ */
2092
+ heartbeatInterval?: number;
2093
+ /** Alias for heartbeatInterval. */
2094
+ heartbeat?: number;
2095
+ /** Auto-reconnect enabled by default on client composable. */
2096
+ reconnect?: boolean;
2097
+ /** Replay unreceived messages automatically on reconnect using sequence numbers. @default true */
2098
+ replayOnReconnect?: boolean;
2099
+ }
2100
+ export interface RealtimePeer {
2101
+ id: string;
2102
+ roomId: string;
2103
+ ctx: {
2104
+ user: RealtimeUser | Record<string, any> | null;
2105
+ [key: string]: any;
2106
+ };
2107
+ }
2108
+ export interface RealtimeHandlerOptions {
2109
+ connect?(peer: RealtimePeer): void | Promise<void>;
2110
+ disconnect?(peer: RealtimePeer): void | Promise<void>;
2111
+ message?(peer: RealtimePeer, event: string, payload: any): void | Promise<void>;
2112
+ }
2113
+ export interface RealtimeHandlerRegistration {
2114
+ pattern: string;
2115
+ handlers: RealtimeHandlerOptions;
2116
+ }
2117
+ export interface RealtimeUser<TPresence = Record<string, any>> {
2118
+ id: string;
2119
+ name?: string | null;
2120
+ avatar?: string | null;
2121
+ metadata?: Record<string, unknown>;
2122
+ presence?: TPresence;
2123
+ joinedAt: number;
2124
+ isAnonymous?: boolean;
2125
+ }
2126
+ export interface RealtimeMessage<T = unknown> {
2127
+ type: "message" | "presence:sync" | "presence:join" | "presence:leave" | "presence:update" | "state:sync" | "state:set" | "state:patch" | "history:sync" | "ping" | "pong";
2128
+ event?: string;
2129
+ payload?: T;
2130
+ sender?: string;
2131
+ user?: RealtimeUser;
2132
+ presence?: RealtimeUser[];
2133
+ state?: Record<string, any>;
2134
+ history?: RealtimeMessage[];
2135
+ id?: string;
2136
+ seq?: number;
2137
+ replay?: boolean;
2138
+ lastSeq?: number;
2139
+ timestamp?: number;
2140
+ }
2141
+ export interface UsePresenceOptions<T extends Record<string, any> = Record<string, any>> {
2142
+ /** Initial presence state */
2143
+ initial?: T;
2144
+ /** Minimum interval in milliseconds between broadcast updates (throttling). @default 50 */
2145
+ throttle?: number;
2146
+ }
2147
+ export interface UsePresenceReturn<T extends Record<string, any> = Record<string, any>> {
2148
+ /** My own current presence state */
2149
+ myPresence: any;
2150
+ /** Update my presence state (throttled) */
2151
+ updatePresence: (partial: Partial<T>) => void;
2152
+ /** Connected peers in the room with their presence data (excluding self) */
2153
+ peers: any;
2154
+ /** Total number of online peers including self */
2155
+ onlineCount: any;
2156
+ /** All connected users including self */
2157
+ presence: any;
2158
+ /** Helper to track and broadcast mouse/cursor coordinates on an element or window */
2159
+ onCursorMove: (e: {
2160
+ clientX: number;
2161
+ clientY: number;
2162
+ }) => void;
2163
+ }
2164
+ export interface UseRoomStateReturn<T extends Record<string, any> = Record<string, any>> {
2165
+ /** Current synchronized room state */
2166
+ state: any;
2167
+ /** Replace entire room state */
2168
+ setState: (newState: T) => void;
2169
+ /** Merge partial update into room state */
2170
+ patchState: (partial: Partial<T>) => void;
2171
+ /** Whether initial state sync has completed */
2172
+ synced: any;
2173
+ }
2174
+ export type PaymentProvider = "stripe" | "lemonsqueezy" | "polar" | "paddle";
2175
+ export type SubscriptionStatus = "active" | "trialing" | "past_due" | "canceled" | "unpaid" | "incomplete" | "paused";
2176
+ export interface PaymentPlanConfig {
2177
+ name: string;
2178
+ priceId: string;
2179
+ features?: string[];
2180
+ limits?: Record<string, number>;
2181
+ }
2182
+ export interface PaymentsOptions {
2183
+ /**
2184
+ * Payment provider backend.
2185
+ *
2186
+ * @default "stripe"
2187
+ */
2188
+ provider?: PaymentProvider;
2189
+ /**
2190
+ * Secret API key for provider. Defaults to process.env.STRIPE_SECRET_KEY, LEMONSQUEEZY_API_KEY,
2191
+ * POLAR_ACCESS_TOKEN.
2192
+ */
2193
+ secretKey?: string;
2194
+ /** Webhook signing secret. Defaults to process.env.STRIPE_WEBHOOK_SECRET, etc. */
2195
+ webhookSecret?: string;
2196
+ /**
2197
+ * Base route prefix for payments endpoints.
2198
+ *
2199
+ * @default "/api/payments"
2200
+ */
2201
+ prefix?: string;
2202
+ /** Default trial period in days for new subscriptions. */
2203
+ trialDays?: number;
2204
+ /** Default 3-letter currency code (e.g. 'usd', 'eur'). */
2205
+ currency?: string;
2206
+ /** Predefined plans mapping plan identifiers to price IDs and features. */
2207
+ plans?: Record<string, PaymentPlanConfig>;
2208
+ /**
2209
+ * Default return URL after customer billing portal session completes.
2210
+ *
2211
+ * @default "/"
2212
+ */
2213
+ portalReturnUrl?: string;
2214
+ /** Default redirect URLs for checkout sessions. */
2215
+ checkoutUrls?: {
2216
+ success?: string;
2217
+ cancel?: string;
2218
+ };
2219
+ /** Paddle configuration options (environment, clientToken). */
2220
+ paddle?: {
2221
+ environment?: "sandbox" | "production";
2222
+ clientToken?: string;
2223
+ };
2224
+ }
2225
+ export interface QarpeoCustomer {
2226
+ id: string;
2227
+ userId: string;
2228
+ orgId?: string | null;
2229
+ provider: PaymentProvider;
2230
+ customerId: string;
2231
+ email: string;
2232
+ name?: string | null;
2233
+ metadataJson?: string | null;
2234
+ createdAt: number;
2235
+ updatedAt: number;
2236
+ }
2237
+ export interface QarpeoSubscription {
2238
+ id: string;
2239
+ customerId: string;
2240
+ userId: string;
2241
+ orgId?: string | null;
2242
+ provider: PaymentProvider;
2243
+ subscriptionId: string;
2244
+ planId: string;
2245
+ priceId: string;
2246
+ status: SubscriptionStatus;
2247
+ quantity: number;
2248
+ cancelAtPeriodEnd: boolean;
2249
+ currentPeriodStart: number;
2250
+ currentPeriodEnd: number;
2251
+ trialEnd?: number | null;
2252
+ canceledAt?: number | null;
2253
+ metadata?: Record<string, any>;
2254
+ metadataJson?: string | null;
2255
+ createdAt: number;
2256
+ updatedAt: number;
2257
+ }
2258
+ export interface CreateCheckoutOptions {
2259
+ planId?: string;
2260
+ priceId?: string;
2261
+ mode?: "subscription" | "payment" | "setup";
2262
+ trialDays?: number;
2263
+ currency?: string;
2264
+ successUrl?: string;
2265
+ cancelUrl?: string;
2266
+ customerEmail?: string;
2267
+ metadata?: Record<string, string>;
2268
+ }
2269
+ export interface QarpeoWebhookEvent {
2270
+ id: string;
2271
+ eventId: string;
2272
+ provider: PaymentProvider;
2273
+ eventType: string;
2274
+ createdAt: number;
2275
+ }
2276
+ export interface MeterRecordOptions {
2277
+ /** Optional user ID (defaults to current authenticated user) */
2278
+ userId?: string;
2279
+ /** Optional organization ID (defaults to current organization) */
2280
+ orgId?: string;
2281
+ /** Customer ID from payment provider */
2282
+ customerId?: string;
2283
+ /** Subscription ID from payment provider */
2284
+ subscriptionId?: string;
2285
+ /** Meter event or feature name (e.g. "api_requests", "tokens_generated", "storage_gb") */
2286
+ eventName: string;
2287
+ /** Quantity of units consumed (e.g. 100, 1) */
2288
+ quantity: number;
2289
+ /** Action: 'increment' (delta counter, default) or 'set' (absolute gauge) */
2290
+ action?: "increment" | "set";
2291
+ /** Timestamp of usage occurrence (defaults to now) */
2292
+ timestamp?: number;
2293
+ /** Custom metadata associated with this usage record */
2294
+ metadata?: Record<string, any>;
2295
+ }
2296
+ export interface MeterUsageResult {
2297
+ success: boolean;
2298
+ id: string;
2299
+ eventName: string;
2300
+ quantity: number;
2301
+ total?: number;
2302
+ timestamp: number;
2303
+ }
2304
+ export interface UsageSummary {
2305
+ eventName: string;
2306
+ total: number;
2307
+ count: number;
2308
+ limit?: number;
2309
+ remaining?: number;
2310
+ periodStart?: number;
2311
+ periodEnd?: number;
2312
+ records?: Array<{
2313
+ id: string;
2314
+ quantity: number;
2315
+ timestamp: number;
2316
+ metadata?: Record<string, any>;
2317
+ }>;
2318
+ }
2319
+ export interface DocsSearchSection {
2320
+ /** Unique ID for search result item (e.g. "/docs/features/payments#paddle") */
2321
+ id: string;
2322
+ /** Canonical entry path */
2323
+ path: string;
2324
+ /** Section heading title (or page title if lead section) */
2325
+ title: string;
2326
+ /** Overall document page title */
2327
+ pageTitle: string;
2328
+ /** Breadcrumb hierarchy of titles */
2329
+ titles: string[];
2330
+ /** Clean highlighted text excerpt */
2331
+ content: string;
2332
+ /** Hash anchor for heading (e.g. "#webhooks") */
2333
+ section?: string;
2334
+ /** Locale of the document (e.g. "en", "es") */
2335
+ locale?: string;
2336
+ /** Heading level (1 for h1/title, 2 for h2, 3 for h3) */
2337
+ level?: number;
2338
+ /** Relevance match score */
2339
+ score: number;
2340
+ }
2341
+ export interface DocsSearchResponse {
2342
+ results: DocsSearchSection[];
2343
+ total: number;
2344
+ query: string;
2345
+ /** Search execution engine used */
2346
+ mode?: "fts" | "like";
2347
+ }
2348
+ export interface DocsSearchOptions {
2349
+ q?: string;
2350
+ locale?: string;
2351
+ collection?: string;
2352
+ limit?: number;
2353
+ version?: string;
2354
+ /** Search mode: 'fts' (default), 'like', or 'semantic' */
2355
+ mode?: "fts" | "like" | "semantic";
2356
+ }
2357
+ export interface CMSLocaleConfig {
2358
+ code: string;
2359
+ name: string;
2360
+ flag?: string;
2361
+ dir?: "ltr" | "rtl";
2362
+ }
2363
+ export interface DocsVersionItem {
2364
+ /** Version identifier (e.g. 'latest', 'v1', 'v2', 'next') */
2365
+ id: string;
2366
+ /** Display label in the version switcher (e.g. 'v2 (latest)', 'v1.x') */
2367
+ label: string;
2368
+ /** URL path prefix (e.g. '/docs', '/docs/v1') */
2369
+ prefix: string;
2370
+ /** Whether this is the active latest version */
2371
+ isLatest?: boolean;
2372
+ /** Whether this version is archived / deprecated */
2373
+ isArchived?: boolean;
2374
+ }
2375
+ export interface SiteRobotsConfig {
2376
+ /** Allow search engines to index the site. When false, generates Disallow: / on robots.txt and noindex meta. */
2377
+ index?: boolean;
2378
+ /** Paths to disallow in robots.txt. Defaults to ["/api/", "/devtools/", "/_qarpeo/"] */
2379
+ disallow?: string[];
2380
+ /** Paths to allow in robots.txt. Defaults to ["/"] */
2381
+ allow?: string[];
2382
+ }
2383
+ export interface SiteSitemapUrl {
2384
+ loc: string;
2385
+ lastmod?: string;
2386
+ changefreq?: "always" | "hourly" | "daily" | "weekly" | "monthly" | "yearly" | "never";
2387
+ priority?: number;
2388
+ }
2389
+ export interface SiteSitemapConfig {
2390
+ /** Automatically generate /sitemap.xml. Defaults to true when site.url is provided. */
2391
+ enabled?: boolean;
2392
+ /** Paths to exclude from /sitemap.xml (supports wildcards, e.g. ["/api/**", "/_qarpeo/**"]) */
2393
+ exclude?: string[];
2394
+ /** Include published CMS entries from D1 database. Defaults to true. */
2395
+ cms?: boolean;
2396
+ /** Additional custom URLs to include in sitemap */
2397
+ urls?: SiteSitemapUrl[];
2398
+ }
2399
+ export interface SiteFeedConfig {
2400
+ /** Enabled by default when site.url is set. Set false to disable. */
2401
+ enabled?: boolean;
2402
+ /** CMS collection IDs/slugs to include in the global feed. Default: all published. */
2403
+ collections?: string[];
2404
+ /** Maximum entries per feed. Default: 50. */
2405
+ maxItems?: number;
2406
+ /** RSS TTL in minutes. Default: 60. */
2407
+ ttl?: number;
2408
+ /** Cache-Control max-age in seconds. Default: 3600. */
2409
+ cacheMaxAge?: number;
2410
+ }
2411
+ export interface QarpeoSiteConfig {
2412
+ /** Project/site name (used for Cloudflare Worker name, SEO, emails, branding) */
2413
+ name?: string;
2414
+ /** Canonical site URL (e.g. 'https://qarpeo.com') */
2415
+ url?: string;
2416
+ /** Site description */
2417
+ description?: string;
2418
+ /** Primary locale */
2419
+ defaultLocale?: string;
2420
+ /** Title template, e.g. "%s — %siteName" or "%s | %siteName". Default: "%s — %siteName" */
2421
+ titleTemplate?: string;
2422
+ /** Default separator between page title and site name. Default: "—" */
2423
+ separator?: string;
2424
+ /** Default OpenGraph / social share image URL (absolute or relative to site.url) */
2425
+ image?: string;
2426
+ /** Twitter/X creator or site handle (e.g. "@qarpeo") */
2427
+ twitter?: string;
2428
+ /** Canonical robots.txt rules */
2429
+ robots?: boolean | SiteRobotsConfig;
2430
+ /** Sitemap configuration */
2431
+ sitemap?: boolean | SiteSitemapConfig;
2432
+ /** RSS 2.0 / Atom 1.0 feed configuration */
2433
+ feed?: boolean | SiteFeedConfig;
2434
+ /** Auto-inject WebSite JSON-LD schema on root page. Default: true */
2435
+ schemaOrg?: boolean;
2436
+ }
2437
+ /** Root configuration options for the Qarpeo Nuxt module (Strict Two-Tier Standard, Decision 22 & 23) */
2438
+ export interface QarpeoOptions {
2439
+ /** Project & site metadata (name, url, SEO, branding) */
2440
+ site?: QarpeoSiteConfig;
2441
+ /** Native SEO engine configuration (alias for site config) */
2442
+ seo?: boolean | QarpeoSiteConfig;
2443
+ /** Project / Cloudflare Worker name override */
2444
+ name?: string;
2445
+ /**
2446
+ * Use live Cloudflare remote bindings during `nuxt dev` instead of local Miniflare emulation.
2447
+ *
2448
+ * @default false
2449
+ */
2450
+ remote?: boolean;
2451
+ /**
2452
+ * Enable Cloudflare Workers AI integration for serverless LLMs, embeddings, and generative AI.
2453
+ *
2454
+ * @default false
2455
+ */
2456
+ ai?: boolean;
2457
+ /**
2458
+ * Enable Cloudflare Vectorize integration for vector embeddings and semantic search.
2459
+ *
2460
+ * @default false
2461
+ */
2462
+ vectorize?: boolean;
2463
+ /**
2464
+ * Enable Cloudflare Queues integration for asynchronous message queues and background jobs.
2465
+ *
2466
+ * @default false
2467
+ */
2468
+ queue?: boolean;
2469
+ /**
2470
+ * Enable Cloudflare Hyperdrive integration for pooled connections and query acceleration to
2471
+ * external PostgreSQL/MySQL databases.
2472
+ *
2473
+ * @default false
2474
+ */
2475
+ hyperdrive?: boolean;
2476
+ /**
2477
+ * Enable Cloudflare Browser Rendering integration for headless Chromium web scraping, PDF
2478
+ * generation, and automated screenshots.
2479
+ *
2480
+ * @default false
2481
+ */
2482
+ browser?: boolean;
2483
+ /**
2484
+ * Enable Cloudflare Durable Objects binding for stateful, low-latency coordination and presence.
2485
+ *
2486
+ * @default false
2487
+ */
2488
+ do?: boolean;
2489
+ /**
2490
+ * Cloudflare Cron Triggers configuration.
2491
+ *
2492
+ * @default false
2493
+ */
2494
+ cron?: boolean | Record<string, string[]>;
2495
+ /**
2496
+ * Enable Cloudflare Send Email integration for transactional emails.
2497
+ *
2498
+ * @default false
2499
+ */
2500
+ email?: boolean | EmailOptions;
2501
+ /**
2502
+ * Direct Cloudflare D1 SQL database binding.
2503
+ *
2504
+ * @default false
2505
+ */
2506
+ d1?: boolean;
2507
+ /**
2508
+ * Direct Cloudflare R2 Blob storage binding.
2509
+ *
2510
+ * @default false
2511
+ */
2512
+ r2?: boolean;
2513
+ /**
2514
+ * Enable Edge Database powered by Drizzle ORM on Cloudflare D1 (Tier 2). Auto-imports `db`,
2515
+ * `useDrizzle()`, `schema`, and all Drizzle helpers.
2516
+ *
2517
+ * - `autoMigrate`: Automatically apply unapplied D1 migrations on `nuxt dev` startup (default:
2518
+ * true).
2519
+ * - `migrateOnBuild`: Apply D1 migrations during `nuxt build`. Can be `true` (auto-detects remote
2520
+ * in CI / local otherwise), `"local"`, or `"remote"`. Also controllable via
2521
+ * `QARPEO_MIGRATE_ON_BUILD` env var (default: false).
2522
+ *
2523
+ * @default false
2524
+ */
2525
+ db?: boolean | {
2526
+ autoMigrate?: boolean;
2527
+ migrateOnBuild?: boolean | "local" | "remote";
2528
+ };
2529
+ /**
2530
+ * Enable Cloudflare Key-Value (KV) storage. Auto-imports `kv` across server routes and handlers.
2531
+ *
2532
+ * @default false
2533
+ */
2534
+ kv?: boolean;
2535
+ /**
2536
+ * Enable Edge Cache Layer powered by Cloudflare KV (Tier 2). Mounts Nitro's `cache` storage
2537
+ * driver to Cloudflare KV in production. Enables SWR routeRules and `purgeCache()`.
2538
+ *
2539
+ * @default false
2540
+ */
2541
+ cache?: boolean | CacheOptions;
2542
+ /**
2543
+ * Enable Cloudflare Edge Authentication powered by nuxt-auth-utils + D1 + KV (Tier 2).
2544
+ *
2545
+ * @default false
2546
+ */
2547
+ auth?: boolean | AuthOptions;
2548
+ /**
2549
+ * Enable Edge Blob / File System Layer powered by Cloudflare R2 (Tier 2).
2550
+ *
2551
+ * @default false
2552
+ */
2553
+ blob?: boolean | BlobOptions;
2554
+ /**
2555
+ * Alias for `blob` options (deprecated).
2556
+ *
2557
+ * @deprecated Use `blob` instead.
2558
+ */
2559
+ storage?: boolean | StorageOptions;
2560
+ /**
2561
+ * Enable Hybrid Edge Content Management System powered by D1 + R2 + Auth (Tier 2).
2562
+ *
2563
+ * @default false
2564
+ */
2565
+ cms?: boolean | CMSOptions;
2566
+ /**
2567
+ * Enable Realtime Layer powered by Cloudflare Durable Objects + KV (Tier 2).
2568
+ *
2569
+ * @default false
2570
+ */
2571
+ realtime?: boolean | RealtimeOptions;
2572
+ /**
2573
+ * Enable Edge Payments Layer powered by Stripe, Lemon Squeezy, or Polar (Tier 2).
2574
+ *
2575
+ * @default false
2576
+ */
2577
+ payments?: boolean | PaymentsOptions;
2578
+ /**
2579
+ * Enable Background Jobs Layer powered by Cloudflare Queues (Tier 2). Auto-scans `server/jobs/`
2580
+ * and exposes `defineJob()` and `dispatchJob()`.
2581
+ *
2582
+ * @default false
2583
+ */
2584
+ jobs?: boolean | JobsOptions;
2585
+ /**
2586
+ * Enable Edge Rate Limiting powered by Cloudflare RateLimiter / KV (Tier 2). Exposes
2587
+ * `assertRateLimit()`, `checkRateLimit()`, and per-route rate limiting.
2588
+ *
2589
+ * @default false
2590
+ */
2591
+ ratelimit?: boolean | AppRateLimitOptions;
2592
+ /**
2593
+ * Enable Stateful Edge Agents & AI Streaming Layer (Tier 2). Backed by Cloudflare Durable Objects
2594
+ * (`QarpeoAgentDO`), Workers AI, and Vectorize. Exposes `defineAgent()`, `defineTool()`,
2595
+ * `useChat()`, `streamText()`, and `useAgent()`.
2596
+ *
2597
+ * @default false
2598
+ */
2599
+ agents?: boolean | AgentsOptions;
2600
+ /**
2601
+ * Enable Transactional Email & Dev Mailbox Layer (Tier 2). Pre-built responsive HTML email
2602
+ * templates, multi-provider delivery (Cloudflare, Resend, Postmark), and in-browser Dev Mailbox
2603
+ * preview in development.
2604
+ *
2605
+ * @default false
2606
+ */
2607
+ mail?: boolean | MailOptions;
2608
+ /**
2609
+ * Enable Edge Analytics Dashboard (Tier 2). Privacy-first structured pageview tracking, custom
2610
+ * business events, and a pre-built dashboard API backed by Cloudflare Analytics Engine.
2611
+ *
2612
+ * @default false
2613
+ */
2614
+ analytics?: boolean | AnalyticsOptions;
2615
+ /**
2616
+ * Enable Multi-Tenancy & Custom Domains Layer (Tier 2). Subdomain routing, custom domains via
2617
+ * Cloudflare for SaaS, automated SSL, edge tenant resolution (`useTenant()`), and tenant data
2618
+ * isolation.
2619
+ *
2620
+ * @default false
2621
+ */
2622
+ multitenant?: boolean | MultitenantOptions;
2623
+ /**
2624
+ * Enable Notifications Layer (Tier 2). Unified in-app feeds, realtime UI push via Durable
2625
+ * Objects, browser Web Push (VAPID via Web Crypto), and email alerts.
2626
+ *
2627
+ * @default false
2628
+ */
2629
+ notifications?: boolean | NotificationsOptions;
2630
+ /** Shorthand alias for notifications */
2631
+ notify?: boolean | NotificationsOptions;
2632
+ /**
2633
+ * Configuration for Qarpeo DevTools (Dev-Only Management Console & DevTools panel).
2634
+ *
2635
+ * @default false
2636
+ */
2637
+ devtools?: boolean | DevtoolsOptions;
2638
+ }
2639
+ export type NotificationChannel = "in-app" | "push" | "email";
2640
+ export interface NotificationRecord {
2641
+ id: string;
2642
+ userId: string;
2643
+ tenantId?: string;
2644
+ title: string;
2645
+ body?: string;
2646
+ icon?: string;
2647
+ actionUrl?: string;
2648
+ channels: NotificationChannel[];
2649
+ read: boolean;
2650
+ readAt?: number;
2651
+ createdAt: number;
2652
+ metadata?: Record<string, any>;
2653
+ /**
2654
+ * Enable or customize RFC 2369 / RFC 8058 List-Unsubscribe headers for this message.
2655
+ * Set alse to disable for transactional emails (e.g. OTP, password reset).
2656
+ */
2657
+ unsubscribe?: boolean | {
2658
+ url?: string;
2659
+ email?: string;
2660
+ };
2661
+ /**
2662
+ * Whether to check the suppression list before sending. Set alse to bypass
2663
+ * suppression checks for critical security or transactional emails.
2664
+ * @default true
2665
+ */
2666
+ suppression?: boolean;
2667
+ }
2668
+ export interface PushSubscriptionKeys {
2669
+ p256dh: string;
2670
+ auth: string;
2671
+ }
2672
+ export interface PushSubscriptionRecord {
2673
+ endpoint: string;
2674
+ keys: PushSubscriptionKeys;
2675
+ }
2676
+ export interface SendNotificationRequest {
2677
+ userId: string;
2678
+ title: string;
2679
+ body?: string;
2680
+ icon?: string;
2681
+ actionUrl?: string;
2682
+ channels?: NotificationChannel[];
2683
+ tenantId?: string;
2684
+ metadata?: Record<string, any>;
2685
+ emailOptions?: {
2686
+ subject?: string;
2687
+ from?: string;
2688
+ template?: string;
2689
+ };
2690
+ }
2691
+ export interface NotificationsVapidOptions {
2692
+ publicKey: string;
2693
+ privateKey: string;
2694
+ subject?: string;
2695
+ }
2696
+ export interface NotificationsOptions {
2697
+ /**
2698
+ * Cloudflare D1 table name for notifications.
2699
+ *
2700
+ * @default "_qarpeo_notifications"
2701
+ */
2702
+ tableName?: string;
2703
+ /**
2704
+ * VAPID configuration for browser Web Push notifications.
2705
+ * Can also be configured via NUXT_VAPID_PUBLIC_KEY, NUXT_VAPID_PRIVATE_KEY, NUXT_VAPID_SUBJECT.
2706
+ */
2707
+ vapid?: NotificationsVapidOptions;
2708
+ /**
2709
+ * Default notification channels when none specified.
2710
+ *
2711
+ * @default ["in-app"]
2712
+ */
2713
+ channels?: NotificationChannel[];
2714
+ }
2715
+ export interface DevtoolsOptions {
2716
+ /**
2717
+ * Whether Qarpeo DevTools is enabled in development.
2718
+ *
2719
+ * @default false
2720
+ */
2721
+ enabled?: boolean;
2722
+ /**
2723
+ * IP addresses allowed to access Qarpeo DevTools endpoints in development.
2724
+ *
2725
+ * @default ["127.0.0.1", "::1", "localhost", "::ffff:127.0.0.1"]
2726
+ */
2727
+ allowedIps?: string[];
2728
+ /**
2729
+ * Allow access from any IP address (e.g. when binding to 0.0.0.0 for remote/mobile testing).
2730
+ *
2731
+ * @default false
2732
+ */
2733
+ allowAnyIp?: boolean;
2734
+ /**
2735
+ * Require an authentication token to access Qarpeo DevTools. Can also be provided via
2736
+ * `QARPEO_DEVTOOLS_TOKEN` or `NUXT_DEVTOOLS_TOKEN` environment variables.
2737
+ */
2738
+ token?: string;
2739
+ /**
2740
+ * Whether authentication token is strictly required.
2741
+ *
2742
+ * @default false
2743
+ */
2744
+ requireAuth?: boolean;
2745
+ }
2746
+ import type { Nuxt } from "@nuxt/schema";
2747
+ export type ModuleOptions = QarpeoOptions;
2748
+ export * from "./runtime/types/durable-object";
2749
+ /** Type alias for the Nuxt instance, using official @nuxt/schema Nuxt interface. */
2750
+ export type NuxtInstance = Nuxt;