qarpeo 0.1.34 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (364) hide show
  1. package/README.md +114 -26
  2. package/dist/apps/cms.d.ts +4 -0
  3. package/dist/apps/comments.d.ts +4 -0
  4. package/dist/apps/payments.d.ts +4 -0
  5. package/dist/apps/store.d.ts +4 -0
  6. package/dist/chunks/auth-schema.mjs +169 -30
  7. package/dist/chunks/tools.mjs +1680 -0
  8. package/dist/cli/index.mjs +1256 -221
  9. package/dist/core/aliases.d.ts +5 -0
  10. package/dist/core/context.d.ts +10 -0
  11. package/dist/core/cross-drive.d.ts +2 -0
  12. package/dist/core/d1-migrate.d.ts +4 -0
  13. package/dist/core/devtools.d.ts +4 -0
  14. package/dist/core/nitro.d.ts +4 -0
  15. package/dist/core/schema.d.ts +4 -0
  16. package/dist/core/server-utils.d.ts +4 -0
  17. package/dist/core/wrangler.d.ts +4 -0
  18. package/dist/dev/wrangler.d.ts +1 -0
  19. package/dist/fate/index.d.ts +8 -8
  20. package/dist/features/agents.d.ts +4 -0
  21. package/dist/features/auth.d.ts +4 -0
  22. package/dist/features/bots.d.ts +4 -0
  23. package/dist/features/fate.d.ts +4 -0
  24. package/dist/features/mail.d.ts +4 -0
  25. package/dist/features/mcp.d.ts +4 -0
  26. package/dist/features/multitenant.d.ts +4 -0
  27. package/dist/features/notifications.d.ts +4 -0
  28. package/dist/features/realtime.d.ts +4 -0
  29. package/dist/module.d.ts +10 -2
  30. package/dist/module.mjs +6313 -5114
  31. package/dist/primitives/ai.d.ts +4 -0
  32. package/dist/primitives/analytics.d.ts +4 -0
  33. package/dist/primitives/blob.d.ts +4 -0
  34. package/dist/primitives/browser.d.ts +4 -0
  35. package/dist/primitives/cache.d.ts +4 -0
  36. package/dist/primitives/d1.d.ts +4 -0
  37. package/dist/primitives/do.d.ts +4 -0
  38. package/dist/primitives/email.d.ts +4 -0
  39. package/dist/primitives/hyperdrive.d.ts +4 -0
  40. package/dist/primitives/kv.d.ts +4 -0
  41. package/dist/primitives/queue.d.ts +4 -0
  42. package/dist/primitives/ratelimit.d.ts +4 -0
  43. package/dist/primitives/vectorize.d.ts +4 -0
  44. package/dist/primitives/workflows.d.ts +4 -0
  45. package/dist/runtime/ai.d.ts +3 -3
  46. package/dist/runtime/ai.mjs +8 -1
  47. package/dist/runtime/app/components/RealtimeCursors.vue +2 -2
  48. package/dist/runtime/app/composables/ai.d.ts +56 -29
  49. package/dist/runtime/app/composables/analytics.d.ts +26 -106
  50. package/dist/runtime/app/composables/api-tokens.d.ts +31 -34
  51. package/dist/runtime/app/composables/auth.d.ts +147 -51
  52. package/dist/runtime/app/composables/auth.mjs +0 -7
  53. package/dist/runtime/app/composables/chat.d.ts +38 -35
  54. package/dist/runtime/app/composables/cms-preview.d.ts +30 -25
  55. package/dist/runtime/app/composables/cms.d.ts +57 -282
  56. package/dist/runtime/app/composables/cms.mjs +0 -35
  57. package/dist/runtime/app/composables/comments.d.ts +32 -5
  58. package/dist/runtime/app/composables/comments.mjs +29 -1
  59. package/dist/runtime/app/composables/docs-version.d.ts +25 -28
  60. package/dist/runtime/app/composables/impersonation.d.ts +22 -5
  61. package/dist/runtime/app/composables/organization.d.ts +38 -91
  62. package/dist/runtime/app/composables/passkey.d.ts +22 -6
  63. package/dist/runtime/app/composables/passwordless.d.ts +24 -7
  64. package/dist/runtime/app/composables/payments.d.ts +50 -34
  65. package/dist/runtime/app/composables/payments.mjs +1 -0
  66. package/dist/runtime/app/composables/sse.d.ts +76 -0
  67. package/dist/runtime/app/composables/sse.mjs +152 -0
  68. package/dist/runtime/app/composables/storage.d.ts +53 -65
  69. package/dist/runtime/app/composables/storage.mjs +17 -0
  70. package/dist/runtime/app/composables/store.d.ts +198 -0
  71. package/dist/runtime/app/composables/store.mjs +414 -0
  72. package/dist/runtime/app/composables/tenant.d.ts +31 -72
  73. package/dist/runtime/app/composables/turnstile.d.ts +16 -3
  74. package/dist/runtime/app/composables/two-factor.d.ts +23 -6
  75. package/dist/runtime/app/pages/devtools/notifications.vue +30 -27
  76. package/dist/runtime/app/pages/devtools/realtime.vue +19 -31
  77. package/dist/runtime/app/pages/devtools.vue +0 -7
  78. package/dist/runtime/auth.d.ts +9 -9
  79. package/dist/runtime/blob.d.ts +10 -1
  80. package/dist/runtime/blob.mjs +83 -0
  81. package/dist/runtime/cache.d.ts +48 -0
  82. package/dist/runtime/cache.mjs +92 -0
  83. package/dist/runtime/comments.d.ts +4 -0
  84. package/dist/runtime/comments.mjs +2 -0
  85. package/dist/runtime/db.d.ts +21 -1
  86. package/dist/runtime/db.mjs +54 -0
  87. package/dist/runtime/drizzle.d.ts +4 -2
  88. package/dist/runtime/drizzle.mjs +68 -1
  89. package/dist/runtime/durable-object.d.ts +2 -0
  90. package/dist/runtime/durable-object.mjs +2 -0
  91. package/dist/runtime/email.d.ts +1 -1
  92. package/dist/runtime/email.mjs +1 -1
  93. package/dist/runtime/kv.mjs +50 -1
  94. package/dist/runtime/mcp.d.ts +2 -0
  95. package/dist/runtime/mcp.mjs +2 -0
  96. package/dist/runtime/queue.d.ts +12 -2
  97. package/dist/runtime/queue.mjs +19 -1
  98. package/dist/runtime/ratelimit.d.ts +1 -0
  99. package/dist/runtime/ratelimit.mjs +7 -0
  100. package/dist/runtime/schema.d.ts +313 -0
  101. package/dist/runtime/schema.mjs +259 -0
  102. package/dist/runtime/server/db/cms-schema.d.ts +1225 -171
  103. package/dist/runtime/server/db/cms-schema.mjs +69 -70
  104. package/dist/runtime/server/db/store-schema.d.ts +4344 -0
  105. package/dist/runtime/server/db/store-schema.mjs +266 -0
  106. package/dist/runtime/server/durable-objects/agent.mjs +35 -0
  107. package/dist/runtime/server/durable-objects/room.mjs +0 -1
  108. package/dist/runtime/server/middleware/ratelimit.mjs +10 -8
  109. package/dist/runtime/server/plugins/comments.d.ts +7 -0
  110. package/dist/runtime/server/plugins/comments.mjs +7 -0
  111. package/dist/runtime/server/plugins/email-inbound.d.ts +5 -0
  112. package/dist/runtime/server/plugins/email-inbound.mjs +17 -0
  113. package/dist/runtime/server/plugins/store.d.ts +7 -0
  114. package/dist/runtime/server/plugins/store.mjs +7 -0
  115. package/dist/runtime/server/routes/__qarpeo/db/tables.get.mjs +2 -2
  116. package/dist/runtime/server/routes/atom.xml.get.mjs +3 -1
  117. package/dist/runtime/server/routes/auth/2fa/disable.post.mjs +13 -2
  118. package/dist/runtime/server/routes/auth/2fa/setup.post.mjs +9 -3
  119. package/dist/runtime/server/routes/auth/2fa/verify.post.mjs +11 -3
  120. package/dist/runtime/server/routes/auth/account.delete.mjs +2 -1
  121. package/dist/runtime/server/routes/auth/audit-logs.get.mjs +1 -1
  122. package/dist/runtime/server/routes/auth/magic-link/send.post.d.ts +1 -9
  123. package/dist/runtime/server/routes/auth/magic-link/send.post.mjs +8 -0
  124. package/dist/runtime/server/routes/auth/organization/sso/[id].delete.mjs +1 -1
  125. package/dist/runtime/server/routes/auth/organization/sso/index.get.mjs +1 -1
  126. package/dist/runtime/server/routes/auth/organization/sso/index.post.mjs +1 -1
  127. package/dist/runtime/server/routes/auth/otp/send.post.d.ts +1 -9
  128. package/dist/runtime/server/routes/auth/otp/send.post.mjs +8 -0
  129. package/dist/runtime/server/routes/auth/sso/login.get.mjs +3 -3
  130. package/dist/runtime/server/routes/auth/sso/oidc/callback.get.mjs +1 -1
  131. package/dist/runtime/server/routes/auth/sso/saml/acs.post.mjs +2 -2
  132. package/dist/runtime/server/routes/auth/webauthn/login/options.post.mjs +1 -1
  133. package/dist/runtime/server/routes/auth/webauthn/login/verify.post.mjs +1 -1
  134. package/dist/runtime/server/routes/auth/webauthn/register/options.post.mjs +2 -2
  135. package/dist/runtime/server/routes/auth/webauthn/register/verify.post.mjs +1 -1
  136. package/dist/runtime/server/routes/cms/[collection]/[id]/preview-token.post.mjs +1 -1
  137. package/dist/runtime/server/routes/cms/[collection]/atom.xml.get.mjs +3 -1
  138. package/dist/runtime/server/routes/cms/[collection]/feed.xml.get.mjs +3 -1
  139. package/dist/runtime/server/routes/cms/bookmarks/[id].delete.mjs +1 -1
  140. package/dist/runtime/server/routes/cms/bookmarks/check.post.mjs +1 -1
  141. package/dist/runtime/server/routes/cms/bookmarks/index.get.mjs +1 -1
  142. package/dist/runtime/server/routes/cms/bookmarks/index.post.mjs +1 -1
  143. package/dist/runtime/server/routes/cms/deploy.post.mjs +1 -1
  144. package/dist/runtime/server/routes/cms/export.post.mjs +4 -3
  145. package/dist/runtime/server/routes/cms/search.get.mjs +7 -5
  146. package/dist/runtime/server/routes/cms/sync.post.mjs +2 -1
  147. package/dist/runtime/server/routes/comments/[id]/react.post.mjs +1 -2
  148. package/dist/runtime/server/routes/comments/[id]/report.post.d.ts +1 -1
  149. package/dist/runtime/server/routes/comments/[id]/report.post.mjs +0 -2
  150. package/dist/runtime/server/routes/comments/[id].delete.mjs +8 -4
  151. package/dist/runtime/server/routes/comments/[id].get.d.ts +1 -1
  152. package/dist/runtime/server/routes/comments/[id].get.mjs +1 -2
  153. package/dist/runtime/server/routes/comments/[id].patch.d.ts +1 -1
  154. package/dist/runtime/server/routes/comments/[id].patch.mjs +6 -3
  155. package/dist/runtime/server/routes/comments/batch.post.d.ts +2 -0
  156. package/dist/runtime/server/routes/comments/batch.post.mjs +33 -0
  157. package/dist/runtime/server/routes/comments/index.get.d.ts +1 -1
  158. package/dist/runtime/server/routes/comments/index.get.mjs +6 -4
  159. package/dist/runtime/server/routes/comments/index.post.d.ts +1 -1
  160. package/dist/runtime/server/routes/comments/index.post.mjs +6 -2
  161. package/dist/runtime/server/routes/feed.xml.get.mjs +3 -1
  162. package/dist/runtime/server/routes/sitemap.xml.get.mjs +3 -1
  163. package/dist/runtime/server/routes/storage/presigned-r2.post.d.ts +17 -0
  164. package/dist/runtime/server/routes/storage/presigned-r2.post.mjs +29 -0
  165. package/dist/runtime/server/routes/store/cart/index.delete.d.ts +6 -0
  166. package/dist/runtime/server/routes/store/cart/index.delete.mjs +11 -0
  167. package/dist/runtime/server/routes/store/cart/index.get.d.ts +5 -0
  168. package/dist/runtime/server/routes/store/cart/index.get.mjs +14 -0
  169. package/dist/runtime/server/routes/store/cart/items/[id].delete.d.ts +6 -0
  170. package/dist/runtime/server/routes/store/cart/items/[id].delete.mjs +25 -0
  171. package/dist/runtime/server/routes/store/cart/items/[id].patch.d.ts +6 -0
  172. package/dist/runtime/server/routes/store/cart/items/[id].patch.mjs +29 -0
  173. package/dist/runtime/server/routes/store/cart/items.post.d.ts +6 -0
  174. package/dist/runtime/server/routes/store/cart/items.post.mjs +36 -0
  175. package/dist/runtime/server/routes/store/categories/index.get.d.ts +2 -0
  176. package/dist/runtime/server/routes/store/categories/index.get.mjs +8 -0
  177. package/dist/runtime/server/routes/store/checkout.post.d.ts +6 -0
  178. package/dist/runtime/server/routes/store/checkout.post.mjs +21 -0
  179. package/dist/runtime/server/routes/store/coupons/apply.post.d.ts +7 -0
  180. package/dist/runtime/server/routes/store/coupons/apply.post.mjs +18 -0
  181. package/dist/runtime/server/routes/store/currencies.get.d.ts +15 -0
  182. package/dist/runtime/server/routes/store/currencies.get.mjs +13 -0
  183. package/dist/runtime/server/routes/store/orders/[id].get.d.ts +2 -0
  184. package/dist/runtime/server/routes/store/orders/[id].get.mjs +26 -0
  185. package/dist/runtime/server/routes/store/orders/download/[token].get.d.ts +7 -0
  186. package/dist/runtime/server/routes/store/orders/download/[token].get.mjs +57 -0
  187. package/dist/runtime/server/routes/store/orders/index.get.d.ts +5 -0
  188. package/dist/runtime/server/routes/store/orders/index.get.mjs +30 -0
  189. package/dist/runtime/server/routes/store/products/[slug].get.d.ts +2 -0
  190. package/dist/runtime/server/routes/store/products/[slug].get.mjs +18 -0
  191. package/dist/runtime/server/routes/store/products/index.get.d.ts +5 -0
  192. package/dist/runtime/server/routes/store/products/index.get.mjs +33 -0
  193. package/dist/runtime/server/routes/store/tax/calculate.post.d.ts +9 -0
  194. package/dist/runtime/server/routes/store/tax/calculate.post.mjs +18 -0
  195. package/dist/runtime/server/routes/tenants/[tenant]/domains/[domain]/index.delete.mjs +14 -1
  196. package/dist/runtime/server/routes/tenants/[tenant]/domains/[domain]/verify.post.mjs +14 -1
  197. package/dist/runtime/server/routes/tenants/[tenant]/domains/index.get.mjs +24 -1
  198. package/dist/runtime/server/routes/tenants/[tenant]/domains/index.post.mjs +6 -0
  199. package/dist/runtime/server/utils/ai.d.ts +146 -21
  200. package/dist/runtime/server/utils/ai.mjs +406 -11
  201. package/dist/runtime/server/utils/analytics-query.d.ts +13 -58
  202. package/dist/runtime/server/utils/audit.d.ts +5 -4
  203. package/dist/runtime/server/utils/audit.mjs +25 -14
  204. package/dist/runtime/server/utils/auth.d.ts +29 -12
  205. package/dist/runtime/server/utils/auth.mjs +88 -70
  206. package/dist/runtime/server/utils/bots.d.ts +20 -4
  207. package/dist/runtime/server/utils/bots.mjs +7 -3
  208. package/dist/runtime/server/utils/browser-utils.d.ts +23 -23
  209. package/dist/runtime/server/utils/cache.d.ts +31 -10
  210. package/dist/runtime/server/utils/cache.mjs +130 -53
  211. package/dist/runtime/server/utils/cms/collections.d.ts +23 -0
  212. package/dist/runtime/server/utils/cms/collections.mjs +143 -0
  213. package/dist/runtime/server/utils/cms/common.d.ts +9 -0
  214. package/dist/runtime/server/utils/cms/common.mjs +28 -0
  215. package/dist/runtime/server/utils/cms/git.mjs +2 -2
  216. package/dist/runtime/server/utils/cms/navigation.d.ts +46 -0
  217. package/dist/runtime/server/utils/cms/navigation.mjs +683 -0
  218. package/dist/runtime/server/utils/cms/preview.d.ts +11 -0
  219. package/dist/runtime/server/utils/cms/preview.mjs +50 -0
  220. package/dist/runtime/server/utils/cms/search.d.ts +1 -1
  221. package/dist/runtime/server/utils/cms/search.mjs +11 -7
  222. package/dist/runtime/server/utils/cms/sync.d.ts +34 -0
  223. package/dist/runtime/server/utils/cms/sync.mjs +1082 -0
  224. package/dist/runtime/server/utils/cms/taxonomy.d.ts +103 -0
  225. package/dist/runtime/server/utils/cms/taxonomy.mjs +348 -0
  226. package/dist/runtime/server/utils/cms.d.ts +13 -249
  227. package/dist/runtime/server/utils/cms.mjs +108 -2350
  228. package/dist/runtime/server/utils/comments-filter.d.ts +45 -0
  229. package/dist/runtime/server/utils/comments-filter.mjs +541 -0
  230. package/dist/runtime/server/utils/comments.d.ts +71 -0
  231. package/dist/runtime/server/utils/comments.mjs +137 -61
  232. package/dist/runtime/server/utils/config.d.ts +4 -3
  233. package/dist/runtime/server/utils/config.mjs +7 -6
  234. package/dist/runtime/server/utils/context.d.ts +14 -0
  235. package/dist/runtime/server/utils/context.mjs +2 -2
  236. package/dist/runtime/server/utils/crypto.d.ts +44 -5
  237. package/dist/runtime/server/utils/crypto.mjs +18 -0
  238. package/dist/runtime/server/utils/domains.mjs +9 -5
  239. package/dist/runtime/server/utils/drizzle.d.ts +35 -3
  240. package/dist/runtime/server/utils/drizzle.mjs +115 -6
  241. package/dist/runtime/server/utils/durable-object.d.ts +106 -0
  242. package/dist/runtime/server/utils/durable-object.mjs +628 -0
  243. package/dist/runtime/server/utils/email-inbound.d.ts +29 -0
  244. package/dist/runtime/server/utils/email-inbound.mjs +76 -0
  245. package/dist/runtime/server/utils/impersonation.d.ts +32 -2
  246. package/dist/runtime/server/utils/impersonation.mjs +16 -13
  247. package/dist/runtime/server/utils/lock.d.ts +71 -0
  248. package/dist/runtime/server/utils/lock.mjs +139 -0
  249. package/dist/runtime/server/utils/mail-suppression.mjs +7 -7
  250. package/dist/runtime/server/utils/mail.d.ts +30 -19
  251. package/dist/runtime/server/utils/mcp.d.ts +44 -0
  252. package/dist/runtime/server/utils/mcp.mjs +308 -0
  253. package/dist/runtime/server/utils/notifications.d.ts +72 -7
  254. package/dist/runtime/server/utils/notifications.mjs +67 -55
  255. package/dist/runtime/server/utils/oauth.d.ts +27 -4
  256. package/dist/runtime/server/utils/organization.d.ts +63 -7
  257. package/dist/runtime/server/utils/organization.mjs +26 -21
  258. package/dist/runtime/server/utils/passwordless.d.ts +62 -33
  259. package/dist/runtime/server/utils/payments.d.ts +51 -12
  260. package/dist/runtime/server/utils/payments.mjs +472 -282
  261. package/dist/runtime/server/utils/queue.d.ts +106 -13
  262. package/dist/runtime/server/utils/queue.mjs +313 -28
  263. package/dist/runtime/server/utils/rag.d.ts +42 -14
  264. package/dist/runtime/server/utils/rag.mjs +169 -4
  265. package/dist/runtime/server/utils/ratelimit.d.ts +34 -5
  266. package/dist/runtime/server/utils/ratelimit.mjs +95 -14
  267. package/dist/runtime/server/utils/realtime.d.ts +68 -52
  268. package/dist/runtime/server/utils/scheduled-task.d.ts +42 -1
  269. package/dist/runtime/server/utils/scheduled-task.mjs +29 -0
  270. package/dist/runtime/server/utils/schema-fallback.d.ts +1 -1
  271. package/dist/runtime/server/utils/schema-fallback.mjs +1 -1
  272. package/dist/runtime/server/utils/session.d.ts +84 -10
  273. package/dist/runtime/server/utils/session.mjs +12 -10
  274. package/dist/runtime/server/utils/sse.d.ts +75 -0
  275. package/dist/runtime/server/utils/sse.mjs +147 -0
  276. package/dist/runtime/server/utils/sso.d.ts +1 -1
  277. package/dist/runtime/server/utils/storage.d.ts +53 -4
  278. package/dist/runtime/server/utils/storage.mjs +15 -11
  279. package/dist/runtime/server/utils/store-localization.d.ts +51 -0
  280. package/dist/runtime/server/utils/store-localization.mjs +417 -0
  281. package/dist/runtime/server/utils/store.d.ts +207 -0
  282. package/dist/runtime/server/utils/store.mjs +2227 -0
  283. package/dist/runtime/server/utils/table-names.d.ts +51 -0
  284. package/dist/runtime/server/utils/table-names.mjs +69 -0
  285. package/dist/runtime/server/utils/tenant.d.ts +26 -2
  286. package/dist/runtime/server/utils/tenant.mjs +16 -12
  287. package/dist/runtime/server/utils/tools-registry-fallback.d.ts +1 -0
  288. package/dist/runtime/server/utils/tools-registry-fallback.mjs +1 -0
  289. package/dist/runtime/server/utils/totp.d.ts +45 -2
  290. package/dist/runtime/server/utils/tracker.d.ts +10 -11
  291. package/dist/runtime/server/utils/turnstile.d.ts +16 -1
  292. package/dist/runtime/server/utils/workflows.d.ts +92 -0
  293. package/dist/runtime/server/utils/workflows.mjs +299 -0
  294. package/dist/runtime/server.d.ts +8 -1
  295. package/dist/runtime/server.mjs +8 -5
  296. package/dist/runtime/service.d.ts +10 -10
  297. package/dist/runtime/storage.d.ts +1 -0
  298. package/dist/runtime/storage.mjs +1 -0
  299. package/dist/runtime/store.d.ts +4 -0
  300. package/dist/runtime/store.mjs +2 -0
  301. package/dist/runtime/test-utils.d.ts +11 -10
  302. package/dist/runtime/test-utils.mjs +64 -4
  303. package/dist/runtime/types/ai.d.ts +21 -2
  304. package/dist/runtime/types/d1.d.ts +17 -0
  305. package/dist/runtime/types/drizzle.d.ts +2 -2
  306. package/dist/runtime/types/durable-object.d.ts +62 -2
  307. package/dist/runtime/types/email.d.ts +46 -0
  308. package/dist/runtime/types/imports.d.ts +6 -1
  309. package/dist/runtime/types/index.d.ts +58 -0
  310. package/dist/runtime/types/index.mjs +3 -0
  311. package/dist/runtime/types/mcp.d.ts +83 -0
  312. package/dist/runtime/types/mcp.mjs +0 -0
  313. package/dist/runtime/types/queue.d.ts +36 -0
  314. package/dist/runtime/types/r2.d.ts +41 -0
  315. package/dist/runtime/types/store.d.ts +313 -0
  316. package/dist/runtime/types/store.mjs +0 -0
  317. package/dist/runtime/types/workflows.d.ts +98 -0
  318. package/dist/runtime/types/workflows.mjs +0 -0
  319. package/dist/runtime/workflows.d.ts +5 -0
  320. package/dist/runtime/workflows.mjs +2 -0
  321. package/dist/types/ai.d.ts +721 -0
  322. package/dist/types/cms.d.ts +710 -0
  323. package/dist/types.d.ts +430 -1292
  324. package/dist/utils/auth-schema.d.ts +3 -2
  325. package/dist/utils/bots.d.ts +20 -0
  326. package/dist/utils/comments-schema.d.ts +5 -4
  327. package/dist/utils/drizzle.d.ts +83 -3
  328. package/dist/utils/durable-objects.d.ts +10 -0
  329. package/dist/utils/email-inbound.d.ts +10 -0
  330. package/dist/utils/local-db.d.ts +1 -3
  331. package/dist/utils/mcp.d.ts +24 -0
  332. package/dist/utils/notifications-schema.d.ts +5 -4
  333. package/dist/utils/payments-schema.d.ts +4 -3
  334. package/dist/utils/store-schema.d.ts +14 -0
  335. package/dist/utils/table-names.d.ts +1 -0
  336. package/dist/utils/tenants-schema.d.ts +4 -3
  337. package/dist/utils/tools.d.ts +20 -0
  338. package/dist/utils/workflows.d.ts +8 -0
  339. package/package.json +34 -4
  340. package/dist/chunks/wrangler.mjs +0 -897
  341. package/dist/runtime/app/components/AuthRegister.vue +0 -306
  342. package/dist/runtime/app/components/AuthSessionsList.vue +0 -137
  343. package/dist/runtime/app/components/AuthSignIn.vue +0 -298
  344. package/dist/runtime/app/components/CMSBookmarkButton.vue +0 -59
  345. package/dist/runtime/app/components/CMSImage.vue +0 -47
  346. package/dist/runtime/app/components/CMSLocaleSwitcher.vue +0 -110
  347. package/dist/runtime/app/components/CMSNewsletter.vue +0 -81
  348. package/dist/runtime/app/components/CMSPreviewBanner.vue +0 -83
  349. package/dist/runtime/app/components/CMSTableOfContents.vue +0 -84
  350. package/dist/runtime/app/components/CMSVersionBanner.vue +0 -53
  351. package/dist/runtime/app/components/CMSVersionSwitcher.vue +0 -140
  352. package/dist/runtime/app/components/Comments.vue +0 -411
  353. package/dist/runtime/app/components/FileUpload.vue +0 -200
  354. package/dist/runtime/app/components/ImpersonationBanner.vue +0 -61
  355. package/dist/runtime/app/components/NotificationBell.vue +0 -263
  356. package/dist/runtime/app/components/NotificationList.vue +0 -205
  357. package/dist/runtime/app/components/NotificationPrompt.vue +0 -133
  358. package/dist/runtime/app/components/PricingGated.vue +0 -81
  359. package/dist/runtime/app/components/PricingTable.vue +0 -274
  360. package/dist/runtime/app/components/RealtimeChat.vue +0 -164
  361. package/dist/runtime/app/components/RealtimePresence.vue +0 -129
  362. package/dist/runtime/app/components/RealtimeStatus.vue +0 -79
  363. package/dist/runtime/app/components/SubscriptionCard.vue +0 -207
  364. package/dist/runtime/app/components/UserProfile.vue +0 -558
@@ -0,0 +1,299 @@
1
+ import { getCloudflareEnv } from "../../bindings.mjs";
2
+ const workflowRegistry = /* @__PURE__ */ new Map();
3
+ const instanceStore = /* @__PURE__ */ new Map();
4
+ let fastForwardSleep = false;
5
+ export function setWorkflowFastForward(enabled) {
6
+ fastForwardSleep = enabled;
7
+ }
8
+ export function parseDuration(duration) {
9
+ if (typeof duration === "number") {
10
+ return Math.max(0, duration);
11
+ }
12
+ if (typeof duration !== "string" || !duration.trim()) {
13
+ return 0;
14
+ }
15
+ const str = duration.trim().toLowerCase();
16
+ const match = str.match(/^([\d.]+)\s*([a-z]+)$/);
17
+ if (!match) {
18
+ const num = Number(str);
19
+ return isNaN(num) ? 0 : Math.max(0, num);
20
+ }
21
+ const val = parseFloat(match[1]);
22
+ const unit = match[2];
23
+ switch (unit) {
24
+ case "ms":
25
+ case "millisecond":
26
+ case "milliseconds":
27
+ return Math.round(val);
28
+ case "s":
29
+ case "sec":
30
+ case "secs":
31
+ case "second":
32
+ case "seconds":
33
+ return Math.round(val * 1e3);
34
+ case "m":
35
+ case "min":
36
+ case "mins":
37
+ case "minute":
38
+ case "minutes":
39
+ return Math.round(val * 60 * 1e3);
40
+ case "h":
41
+ case "hr":
42
+ case "hrs":
43
+ case "hour":
44
+ case "hours":
45
+ return Math.round(val * 3600 * 1e3);
46
+ case "d":
47
+ case "day":
48
+ case "days":
49
+ return Math.round(val * 86400 * 1e3);
50
+ default:
51
+ return Math.round(val);
52
+ }
53
+ }
54
+ export function createStepEngine(options) {
55
+ const { instance } = options;
56
+ const isFastForward = options.fastForward ?? fastForwardSleep;
57
+ const step = {
58
+ async do(name, configOrCallback, maybeCallback) {
59
+ let config = {};
60
+ let callback;
61
+ if (typeof configOrCallback === "function") {
62
+ callback = configOrCallback;
63
+ } else {
64
+ config = configOrCallback || {};
65
+ callback = maybeCallback;
66
+ }
67
+ const existing = instance.stepStates.get(name);
68
+ if (existing && existing.status === "complete") {
69
+ return existing.value;
70
+ }
71
+ const retryConfig = config.retries || {};
72
+ const maxRetries = retryConfig.limit ?? 1;
73
+ const initialDelay = parseDuration(retryConfig.delay ?? 1e3);
74
+ const backoff = retryConfig.backoff ?? "exponential";
75
+ const timeoutMs = config.timeout ? parseDuration(config.timeout) : 0;
76
+ let lastError;
77
+ for (let attempt = 1; attempt <= maxRetries; attempt++) {
78
+ try {
79
+ let promise = Promise.resolve(callback());
80
+ if (timeoutMs > 0) {
81
+ promise = Promise.race([
82
+ promise,
83
+ new Promise(
84
+ (_, reject) => setTimeout(
85
+ () => reject(
86
+ new Error(
87
+ `[qarpeo:workflows] Step "${name}" timed out after ${timeoutMs}ms`
88
+ )
89
+ ),
90
+ timeoutMs
91
+ )
92
+ )
93
+ ]);
94
+ }
95
+ const result = await promise;
96
+ instance.stepStates.set(name, {
97
+ status: "complete",
98
+ value: result
99
+ });
100
+ return result;
101
+ } catch (err) {
102
+ lastError = err;
103
+ if (attempt < maxRetries) {
104
+ let delayMs = initialDelay;
105
+ if (backoff === "linear") {
106
+ delayMs = initialDelay * attempt;
107
+ } else if (backoff === "exponential") {
108
+ delayMs = initialDelay * Math.pow(2, attempt - 1);
109
+ }
110
+ if (!isFastForward && delayMs > 0) {
111
+ await new Promise((resolve) => setTimeout(resolve, delayMs));
112
+ }
113
+ }
114
+ }
115
+ }
116
+ instance.stepStates.set(name, {
117
+ status: "errored",
118
+ error: lastError
119
+ });
120
+ throw lastError;
121
+ },
122
+ async sleep(name, duration) {
123
+ const ms = parseDuration(duration);
124
+ const existing = instance.stepStates.get(name);
125
+ if (existing && existing.status === "complete") {
126
+ return;
127
+ }
128
+ instance.status = "waiting";
129
+ if (!isFastForward && ms > 0) {
130
+ await new Promise((resolve) => setTimeout(resolve, ms));
131
+ }
132
+ instance.status = "running";
133
+ instance.stepStates.set(name, { status: "complete" });
134
+ },
135
+ async sleepUntil(name, until) {
136
+ const target = until instanceof Date ? until.getTime() : until;
137
+ const ms = Math.max(0, target - Date.now());
138
+ await step.sleep(name, ms);
139
+ }
140
+ };
141
+ return step;
142
+ }
143
+ export function defineWorkflow(defOrRun) {
144
+ const definition = typeof defOrRun === "function" ? { run: defOrRun } : defOrRun;
145
+ if (definition.name) {
146
+ workflowRegistry.set(definition.name, definition);
147
+ }
148
+ return definition;
149
+ }
150
+ export function getWorkflowBinding(bindingName, event) {
151
+ let env = {};
152
+ try {
153
+ env = getCloudflareEnv(event);
154
+ } catch {
155
+ }
156
+ const direct = env[bindingName];
157
+ if (direct) return direct;
158
+ const upper = bindingName.toUpperCase();
159
+ const prefixed = `WORKFLOW_${upper}`;
160
+ return env[upper] || env[prefixed] || void 0;
161
+ }
162
+ export function useWorkflow(name, event) {
163
+ return createWorkflowClient(name, event);
164
+ }
165
+ export function createWorkflowClient(name, event) {
166
+ const nativeBinding = getWorkflowBinding(name, event);
167
+ if (nativeBinding && typeof nativeBinding.create === "function") {
168
+ return {
169
+ async create(options) {
170
+ const instance = await nativeBinding.create(options);
171
+ const status = await instance.status();
172
+ return {
173
+ id: instance.id,
174
+ status: status.status || "queued",
175
+ output: status.output,
176
+ error: status.error
177
+ };
178
+ },
179
+ async status(instanceId) {
180
+ const instance = await nativeBinding.get(instanceId);
181
+ if (!instance) {
182
+ throw new Error(`[qarpeo:workflows] Workflow instance "${instanceId}" not found.`);
183
+ }
184
+ const st = await instance.status();
185
+ return {
186
+ id: instanceId,
187
+ status: st.status || "unknown",
188
+ output: st.output,
189
+ error: st.error
190
+ };
191
+ },
192
+ async pause(instanceId) {
193
+ const instance = await nativeBinding.get(instanceId);
194
+ if (instance?.pause) await instance.pause();
195
+ },
196
+ async resume(instanceId) {
197
+ const instance = await nativeBinding.get(instanceId);
198
+ if (instance?.resume) await instance.resume();
199
+ },
200
+ async restart(instanceId) {
201
+ const instance = await nativeBinding.get(instanceId);
202
+ if (instance?.restart) await instance.restart();
203
+ },
204
+ async terminate(instanceId) {
205
+ const instance = await nativeBinding.get(instanceId);
206
+ if (instance?.terminate) await instance.terminate();
207
+ }
208
+ };
209
+ }
210
+ const executeLocalWorkflow = async (instance, def) => {
211
+ instance.status = "running";
212
+ const stepEngine = createStepEngine({ instance });
213
+ const wfEvent = {
214
+ instanceId: instance.id,
215
+ payload: instance.params,
216
+ timestamp: instance.createdAt
217
+ };
218
+ try {
219
+ const output = await def.run(wfEvent, stepEngine);
220
+ instance.status = "complete";
221
+ instance.output = output;
222
+ } catch (err) {
223
+ instance.status = "errored";
224
+ instance.error = err?.message || String(err);
225
+ }
226
+ };
227
+ return {
228
+ async create(options) {
229
+ const id = options?.id || `wf_${crypto.randomUUID()}`;
230
+ const def = workflowRegistry.get(name);
231
+ const instance = {
232
+ id,
233
+ workflowName: name,
234
+ status: "queued",
235
+ createdAt: /* @__PURE__ */ new Date(),
236
+ params: options?.params,
237
+ stepStates: /* @__PURE__ */ new Map()
238
+ };
239
+ instanceStore.set(id, instance);
240
+ if (def) {
241
+ executeLocalWorkflow(instance, def);
242
+ }
243
+ return {
244
+ id,
245
+ status: instance.status,
246
+ createdAt: instance.createdAt
247
+ };
248
+ },
249
+ async status(instanceId) {
250
+ const instance = instanceStore.get(instanceId);
251
+ if (!instance) {
252
+ throw new Error(`[qarpeo:workflows] Workflow instance "${instanceId}" was not found.`);
253
+ }
254
+ return {
255
+ id: instance.id,
256
+ status: instance.status,
257
+ output: instance.output,
258
+ error: instance.error,
259
+ createdAt: instance.createdAt
260
+ };
261
+ },
262
+ async pause(instanceId) {
263
+ const instance = instanceStore.get(instanceId);
264
+ if (instance && (instance.status === "running" || instance.status === "queued" || instance.status === "waiting")) {
265
+ instance.status = "paused";
266
+ }
267
+ },
268
+ async resume(instanceId) {
269
+ const instance = instanceStore.get(instanceId);
270
+ if (instance && instance.status === "paused") {
271
+ instance.status = "running";
272
+ }
273
+ },
274
+ async restart(instanceId) {
275
+ const instance = instanceStore.get(instanceId);
276
+ if (!instance) {
277
+ throw new Error(`[qarpeo:workflows] Workflow instance "${instanceId}" was not found.`);
278
+ }
279
+ instance.stepStates.clear();
280
+ instance.error = void 0;
281
+ instance.output = void 0;
282
+ const def = workflowRegistry.get(name);
283
+ if (def) {
284
+ executeLocalWorkflow(instance, def);
285
+ }
286
+ },
287
+ async terminate(instanceId) {
288
+ const instance = instanceStore.get(instanceId);
289
+ if (instance) {
290
+ instance.status = "terminated";
291
+ }
292
+ }
293
+ };
294
+ }
295
+ export function clearWorkflowRegistry() {
296
+ workflowRegistry.clear();
297
+ instanceStore.clear();
298
+ fastForwardSleep = false;
299
+ }
@@ -38,10 +38,17 @@ export * from "./service";
38
38
  export * from "./auth";
39
39
  export * from "./realtime";
40
40
  export * from "./cms";
41
+ export * from "./comments";
42
+ export * from "./server/utils/store";
41
43
  export * from "./payments";
42
44
  export * from "./storage";
45
+ export * from "./workflows";
43
46
  export * from "./bots";
44
47
  export * from "./rag";
45
48
  export * from "./server/utils/string";
46
49
  export * from "./server/utils/audit";
47
- export { resolveUserRole, checkIfExistsBeforeCreate, getRoleFromEnv, } from "./server/utils/auth";
50
+ export * from "./server/utils/sse";
51
+ export * from "./server/utils/email-inbound";
52
+ export * from "./server/utils/lock";
53
+ export * from "./durable-object";
54
+ export * from "./mcp";
@@ -17,14 +17,17 @@ export * from "./service.mjs";
17
17
  export * from "./auth.mjs";
18
18
  export * from "./realtime.mjs";
19
19
  export * from "./cms.mjs";
20
+ export * from "./comments.mjs";
21
+ export * from "./server/utils/store.mjs";
20
22
  export * from "./payments.mjs";
21
23
  export * from "./storage.mjs";
24
+ export * from "./workflows.mjs";
22
25
  export * from "./bots.mjs";
23
26
  export * from "./rag.mjs";
24
27
  export * from "./server/utils/string.mjs";
25
28
  export * from "./server/utils/audit.mjs";
26
- export {
27
- resolveUserRole,
28
- checkIfExistsBeforeCreate,
29
- getRoleFromEnv
30
- } from "./server/utils/auth.mjs";
29
+ export * from "./server/utils/sse.mjs";
30
+ export * from "./server/utils/email-inbound.mjs";
31
+ export * from "./server/utils/lock.mjs";
32
+ export * from "./durable-object.mjs";
33
+ export * from "./mcp.mjs";
@@ -13,19 +13,19 @@ export declare function getServiceBinding(serviceName: string, event?: CFEvent):
13
13
  * HTTP-style fetch/JSON requests and Cloudflare Workers RPC direct method calls.
14
14
  *
15
15
  * @example
16
- * ;```ts
17
- * interface AuthService {
18
- * verifyToken(token: string): Promise<{ userId: string }>
19
- * }
16
+ * ```ts
17
+ * interface AuthService {
18
+ * verifyToken(token: string): Promise<{ userId: string }>
19
+ * }
20
20
  *
21
- * const auth = useServiceBinding<AuthService>("AUTH_SERVICE")
21
+ * const auth = useServiceBinding<AuthService>("AUTH_SERVICE")
22
22
  *
23
- * // RPC style (zero HTTP serialization overhead)
24
- * const user = await auth.rpc.verifyToken("jwt-xyz")
23
+ * // RPC style (zero HTTP serialization overhead)
24
+ * const user = await auth.rpc.verifyToken("jwt-xyz")
25
25
  *
26
- * // HTTP style
27
- * const profile = await auth.get("/api/profile", { userId: user.userId })
28
- * ```
26
+ * // HTTP style
27
+ * const profile = await auth.get("/api/profile", { userId: user.userId })
28
+ * ```
29
29
  */
30
30
  export declare function createServiceClient<TRpc = Record<string, any>>(serviceName: string, event?: CFEvent): QarpeoServiceClient<TRpc>;
31
31
  /**
@@ -1 +1,2 @@
1
1
  export type * from "./app/composables/storage";
2
+ export * from "./blob";
@@ -0,0 +1 @@
1
+ export * from "./blob.mjs";
@@ -0,0 +1,4 @@
1
+ export * from "./types/store";
2
+ export * from "./server/utils/store";
3
+ export type * from "./app/composables/store";
4
+ export type { StoreOptions } from "../types";
@@ -0,0 +1,2 @@
1
+ export * from "./types/store.mjs";
2
+ export * from "./server/utils/store.mjs";
@@ -67,6 +67,7 @@ export interface MockR2Bucket {
67
67
  head(key: string): Promise<any>;
68
68
  createMultipartUpload(key: string, options?: any): Promise<any>;
69
69
  resumeMultipartUpload(key: string, uploadId: string): any;
70
+ createPresignedUrl(key: string, options?: any): Promise<string>;
70
71
  _store: Map<string, any>;
71
72
  }
72
73
  export interface MockVectorizeIndex {
@@ -163,18 +164,18 @@ export declare function createMockQueue<T = any>(queueName?: string): MockQueue<
163
164
  * mock bindings onto `getCloudflareEnv()`.
164
165
  *
165
166
  * @example
166
- * ;```ts
167
- * import { createEdgeTestContext } from "qarpeo/test-utils"
167
+ * ```ts
168
+ * import { createEdgeTestContext } from "qarpeo/test-utils"
168
169
  *
169
- * describe("My Edge Route", () => {
170
- * const edge = createEdgeTestContext()
171
- * afterEach(() => edge.cleanup())
170
+ * describe("My Edge Route", () => {
171
+ * const edge = createEdgeTestContext()
172
+ * afterEach(() => edge.cleanup())
172
173
  *
173
- * it("interacts with D1 and KV", async () => {
174
- * await edge.kv.put("user:1", { name: "Alice" })
175
- * expect(await edge.kv.get("user:1", "json")).toEqual({ name: "Alice" })
176
- * })
174
+ * it("interacts with D1 and KV", async () => {
175
+ * await edge.kv.put("user:1", { name: "Alice" })
176
+ * expect(await edge.kv.get("user:1", "json")).toEqual({ name: "Alice" })
177
177
  * })
178
- * ```
178
+ * })
179
+ * ```
179
180
  */
180
181
  export declare function createEdgeTestContext(options?: EdgeTestContextOptions): EdgeTestContext;
@@ -179,10 +179,12 @@ export function createMockR2Bucket() {
179
179
  key,
180
180
  size: item.size || 0,
181
181
  etag: item.etag || "mock-etag",
182
+ httpEtag: item.etag || "mock-etag",
182
183
  httpMetadata: item.httpMetadata || {},
183
184
  customMetadata: item.customMetadata || {},
185
+ uploaded: item.uploaded || /* @__PURE__ */ new Date(),
184
186
  async arrayBuffer() {
185
- return item.data?.buffer || new ArrayBuffer(0);
187
+ return item.data?.buffer ? item.data.buffer.slice(item.data.byteOffset, item.data.byteOffset + item.data.byteLength) : new ArrayBuffer(0);
186
188
  },
187
189
  async text() {
188
190
  return new TextDecoder().decode(item.data || new Uint8Array(0));
@@ -190,19 +192,73 @@ export function createMockR2Bucket() {
190
192
  async json() {
191
193
  return JSON.parse(await this.text());
192
194
  },
193
- body: null
195
+ async blob() {
196
+ return new Blob([item.data || new Uint8Array(0)], {
197
+ type: item.httpMetadata?.contentType || "application/octet-stream"
198
+ });
199
+ },
200
+ writeHttpMetadata(headers) {
201
+ if (item.httpMetadata?.contentType) {
202
+ headers.set("content-type", item.httpMetadata.contentType);
203
+ }
204
+ if (item.httpMetadata?.cacheControl) {
205
+ headers.set("cache-control", item.httpMetadata.cacheControl);
206
+ }
207
+ if (item.httpMetadata?.contentDisposition) {
208
+ headers.set("content-disposition", item.httpMetadata.contentDisposition);
209
+ }
210
+ },
211
+ body: item.data ? new ReadableStream({
212
+ start(controller) {
213
+ controller.enqueue(item.data);
214
+ controller.close();
215
+ }
216
+ }) : null
194
217
  };
195
218
  },
196
219
  async put(key, value, options) {
197
- const rawData = value instanceof Uint8Array ? value : new Uint8Array(0);
220
+ let rawData;
221
+ if (typeof value === "string") {
222
+ rawData = new TextEncoder().encode(value);
223
+ } else if (value instanceof Uint8Array) {
224
+ rawData = value;
225
+ } else if (value instanceof ArrayBuffer) {
226
+ rawData = new Uint8Array(value);
227
+ } else if (value && typeof value.arrayBuffer === "function") {
228
+ rawData = new Uint8Array(await value.arrayBuffer());
229
+ } else if (value && typeof value.getReader === "function") {
230
+ const reader = value.getReader();
231
+ const chunks = [];
232
+ let done = false;
233
+ while (!done) {
234
+ const r = await reader.read();
235
+ done = r.done;
236
+ if (r.value) chunks.push(r.value);
237
+ }
238
+ const total = chunks.reduce((acc, c) => acc + c.byteLength, 0);
239
+ rawData = new Uint8Array(total);
240
+ let offset = 0;
241
+ for (const c of chunks) {
242
+ rawData.set(c, offset);
243
+ offset += c.byteLength;
244
+ }
245
+ } else {
246
+ rawData = new Uint8Array(0);
247
+ }
198
248
  const obj = {
199
249
  key,
200
250
  size: rawData.byteLength,
201
251
  etag: `mock-r2-etag-${Date.now()}`,
252
+ httpEtag: `mock-r2-etag-${Date.now()}`,
202
253
  httpMetadata: options?.httpMetadata || {},
203
254
  customMetadata: options?.customMetadata || {},
204
255
  data: rawData,
205
- uploaded: /* @__PURE__ */ new Date()
256
+ uploaded: /* @__PURE__ */ new Date(),
257
+ writeHttpMetadata(headers) {
258
+ if (options?.httpMetadata?.contentType) {
259
+ headers.set("content-type", options.httpMetadata.contentType);
260
+ }
261
+ }
206
262
  };
207
263
  store.set(key, obj);
208
264
  return obj;
@@ -238,6 +294,10 @@ export function createMockR2Bucket() {
238
294
  complete: async () => ({ key, size: 0, etag: "complete-etag" })
239
295
  };
240
296
  },
297
+ async createPresignedUrl(key, options) {
298
+ const expiresIn = options?.expiresIn || 900;
299
+ return `https://mock-r2.cloudflarestorage.com/${encodeURIComponent(key)}?expires=${expiresIn}`;
300
+ },
241
301
  _store: store
242
302
  };
243
303
  }
@@ -1,5 +1,5 @@
1
- import type { GenerateImageOptions, GenerateImageResult, GenerateSpeechOptions, GenerateSpeechResult, TranscribeAudioInput, TranscribeAudioOptions, TranscribeAudioResult, StreamTextOptions } from "../../types";
2
- export type { GenerateImageOptions, GenerateImageResult, GenerateSpeechOptions, GenerateSpeechResult, TranscribeAudioInput, TranscribeAudioOptions, TranscribeAudioResult, StreamTextOptions, };
1
+ import type { GenerateImageOptions, GenerateImageResult, GenerateSpeechOptions, GenerateSpeechResult, TranscribeAudioInput, TranscribeAudioOptions, TranscribeAudioResult, StreamTextOptions, GenerateObjectOptions, GenerateObjectResult } from "../../types";
2
+ export type { GenerateImageOptions, GenerateImageResult, GenerateSpeechOptions, GenerateSpeechResult, TranscribeAudioInput, TranscribeAudioOptions, TranscribeAudioResult, StreamTextOptions, GenerateObjectOptions, GenerateObjectResult, };
3
3
  export interface AiOptions {
4
4
  /** Optional Cloudflare AI Gateway routing options */
5
5
  gateway?: {
@@ -58,6 +58,25 @@ export interface QarpeoAI {
58
58
  speechToText(options: TranscribeAudioInput | TranscribeAudioOptions): Promise<TranscribeAudioResult>;
59
59
  /** Generate complete text from a prompt or chat messages. */
60
60
  generateText(options: StreamTextOptions): Promise<string>;
61
+ /**
62
+ * Generate a structured object from a prompt using Cloudflare Workers AI
63
+ * constrained JSON schema decoding and validation.
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * import { z } from "zod"
68
+ * const user = await ai.generateObject({
69
+ * prompt: "Extract: Jane Doe, 32, likes reading and tennis",
70
+ * schema: z.object({
71
+ * name: z.string(),
72
+ * age: z.number(),
73
+ * hobbies: z.array(z.string()),
74
+ * }),
75
+ * })
76
+ * console.log(user.object.name) // "Jane Doe"
77
+ * ```
78
+ */
79
+ generateObject<T = any>(options: GenerateObjectOptions<T>): Promise<GenerateObjectResult<T>>;
61
80
  /** Stream text generation as a Server-Sent Events response. */
62
81
  streamText(options: StreamTextOptions): Promise<Response>;
63
82
  /** Generate vector embeddings for text. */
@@ -42,3 +42,20 @@ export interface QarpeoDB extends D1Database {
42
42
  /** Access the raw underlying Cloudflare D1Database binding. */
43
43
  raw(bindingName?: string): D1Database;
44
44
  }
45
+ /** Inferred database dialect based on connection configuration. */
46
+ export type DatabaseDialect = "d1" | "postgres" | "mysql";
47
+ /** Runtime metadata for the active database connection. */
48
+ export interface DatabaseInfo {
49
+ /** Inferred dialect: "d1" (Cloudflare D1 / SQLite), "postgres" (PostgreSQL), or "mysql" (MySQL) */
50
+ dialect: DatabaseDialect;
51
+ /** Whether the active dialect is Cloudflare D1 (SQLite) */
52
+ isD1: boolean;
53
+ /** Whether the active dialect is PostgreSQL */
54
+ isPostgres: boolean;
55
+ /** Whether the active dialect is MySQL */
56
+ isMysql: boolean;
57
+ /** Active connection URL if configured (from DATABASE_URL or Hyperdrive) */
58
+ url?: string;
59
+ /** Whether a Cloudflare Hyperdrive connection pool binding is active */
60
+ hasHyperdrive: boolean;
61
+ }
@@ -8,6 +8,6 @@ import type { D1Database } from "./d1";
8
8
  */
9
9
  export type InferDrizzleRelations<TSchema extends Record<string, unknown>> = ReturnType<typeof defineRelations<ExtractTablesFromSchema<TSchema>>>;
10
10
  export type QarpeoDrizzleDB<TRelations extends AnyRelations = AnyRelations> = DrizzleD1Database<TRelations> & {
11
- /** Access the raw underlying Cloudflare D1Database binding. */
12
- raw(bindingName?: string): D1Database;
11
+ /** Access the raw underlying Cloudflare D1Database binding or database client. */
12
+ raw(bindingName?: string): D1Database | any;
13
13
  };
@@ -9,15 +9,44 @@ export interface DurableObjectStub {
9
9
  readonly name?: string;
10
10
  fetch(request: Request | string, init?: RequestInit): Promise<Response>;
11
11
  }
12
- export interface DurableObjectNamespace {
12
+ export interface DurableObjectNamespace<T = any> {
13
13
  newUniqueId(options?: {
14
14
  jurisdiction?: string;
15
15
  }): DurableObjectId;
16
16
  idFromName(name: string): DurableObjectId;
17
17
  idFromString(id: string): DurableObjectId;
18
- get(id: DurableObjectId): DurableObjectStub;
18
+ get(id: DurableObjectId): DurableObjectRPCStub<T>;
19
+ /** Convenient helper: resolves or creates a stub using `idFromName(name)`. */
20
+ getByName?(name: string): DurableObjectRPCStub<T>;
21
+ }
22
+ export interface SqlStorageCursor<T = Record<string, any>> extends Iterable<T> {
23
+ /** Array of column names present in the query results. */
24
+ readonly columnNames: string[];
25
+ /** Number of rows read from the database to satisfy the query. */
26
+ readonly rowsRead: number;
27
+ /** Number of rows written/modified by this statement. */
28
+ readonly rowsWritten: number;
29
+ /** Collects all matching rows into a standard array. */
30
+ toArray(): T[];
31
+ /** Returns the first row in the cursor, or null if the cursor is empty. */
32
+ one(): T | null;
33
+ }
34
+ export interface SqlStorage {
35
+ /**
36
+ * Executes an embedded SQLite statement with optional positional parameter bindings.
37
+ *
38
+ * @param query SQL query statement, e.g. "SELECT * FROM users WHERE age > ?"
39
+ * @param bindings Positional parameter bindings for placeholder marks (?)
40
+ */
41
+ exec<T = Record<string, any>>(query: string, ...bindings: any[]): SqlStorageCursor<T>;
42
+ /** Size of the embedded SQLite database in bytes. */
43
+ readonly databaseSize: number;
19
44
  }
20
45
  export interface DurableObjectStorage {
46
+ /**
47
+ * Zero-latency embedded SQLite database interface directly inside this Durable Object isolate.
48
+ */
49
+ readonly sql: SqlStorage;
21
50
  get<T = unknown>(key: string): Promise<T | undefined>;
22
51
  get<T = unknown>(keys: string[]): Promise<Map<string, T>>;
23
52
  put<T = unknown>(key: string, value: T): Promise<void>;
@@ -49,3 +78,34 @@ export interface DurableObjectState {
49
78
  getWebSocketAutoResponse?(): unknown;
50
79
  getWebSocketAutoResponseTimestamp?(ws: WebSocket): Date | null;
51
80
  }
81
+ /**
82
+ * Execution context provided to object-literal Durable Object methods via `this`.
83
+ */
84
+ export interface DurableObjectContext {
85
+ readonly state: DurableObjectState;
86
+ readonly storage: DurableObjectStorage;
87
+ /** Zero-latency embedded SQLite database interface directly on `this.sql`. */
88
+ readonly sql: SqlStorage;
89
+ readonly env: Record<string, any>;
90
+ readonly id: DurableObjectId;
91
+ waitUntil(promise: Promise<unknown>): void;
92
+ blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
93
+ }
94
+ /**
95
+ * Modern typed RPC Stub for a Durable Object.
96
+ * Any method defined on the Durable Object can be directly called as an asynchronous RPC call.
97
+ */
98
+ export type DurableObjectRPCStub<T = any> = DurableObjectStub & {
99
+ [K in keyof T]: T[K] extends (...args: infer P) => infer R ? (...args: P) => Promise<Awaited<R>> : T[K];
100
+ };
101
+ export type DurableObjectClass<T = any> = new (state: DurableObjectState, env: Record<string, any>) => T;
102
+ export type DurableObjectDefinitionMethods = Record<string, any>;
103
+ export type DurableObjectDefinition<T extends DurableObjectDefinitionMethods = DurableObjectDefinitionMethods> = (T & ThisType<DurableObjectContext & T>) | DurableObjectClass<T>;
104
+ export interface DurableObjectsOptions {
105
+ /** Directory containing Durable Object definition files (default: "server/durable-objects") */
106
+ dir?: string;
107
+ /** Explicit bindings mapping (e.g. `{ COUNTER: { className: "CounterDO" } }`) */
108
+ bindings?: Record<string, {
109
+ className: string;
110
+ }>;
111
+ }