qarpeo 0.1.35 → 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 (363) 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 -5118
  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 +3 -3
  210. package/dist/runtime/server/utils/cms/collections.d.ts +23 -0
  211. package/dist/runtime/server/utils/cms/collections.mjs +143 -0
  212. package/dist/runtime/server/utils/cms/common.d.ts +9 -0
  213. package/dist/runtime/server/utils/cms/common.mjs +28 -0
  214. package/dist/runtime/server/utils/cms/git.mjs +2 -2
  215. package/dist/runtime/server/utils/cms/navigation.d.ts +46 -0
  216. package/dist/runtime/server/utils/cms/navigation.mjs +683 -0
  217. package/dist/runtime/server/utils/cms/preview.d.ts +11 -0
  218. package/dist/runtime/server/utils/cms/preview.mjs +50 -0
  219. package/dist/runtime/server/utils/cms/search.d.ts +1 -1
  220. package/dist/runtime/server/utils/cms/search.mjs +11 -7
  221. package/dist/runtime/server/utils/cms/sync.d.ts +34 -0
  222. package/dist/runtime/server/utils/cms/sync.mjs +1082 -0
  223. package/dist/runtime/server/utils/cms/taxonomy.d.ts +103 -0
  224. package/dist/runtime/server/utils/cms/taxonomy.mjs +348 -0
  225. package/dist/runtime/server/utils/cms.d.ts +13 -249
  226. package/dist/runtime/server/utils/cms.mjs +108 -2350
  227. package/dist/runtime/server/utils/comments-filter.d.ts +45 -0
  228. package/dist/runtime/server/utils/comments-filter.mjs +541 -0
  229. package/dist/runtime/server/utils/comments.d.ts +71 -0
  230. package/dist/runtime/server/utils/comments.mjs +137 -61
  231. package/dist/runtime/server/utils/config.d.ts +4 -3
  232. package/dist/runtime/server/utils/config.mjs +7 -6
  233. package/dist/runtime/server/utils/context.d.ts +14 -0
  234. package/dist/runtime/server/utils/context.mjs +2 -2
  235. package/dist/runtime/server/utils/crypto.d.ts +44 -5
  236. package/dist/runtime/server/utils/crypto.mjs +18 -0
  237. package/dist/runtime/server/utils/domains.mjs +9 -5
  238. package/dist/runtime/server/utils/drizzle.d.ts +35 -3
  239. package/dist/runtime/server/utils/drizzle.mjs +115 -6
  240. package/dist/runtime/server/utils/durable-object.d.ts +106 -0
  241. package/dist/runtime/server/utils/durable-object.mjs +628 -0
  242. package/dist/runtime/server/utils/email-inbound.d.ts +29 -0
  243. package/dist/runtime/server/utils/email-inbound.mjs +76 -0
  244. package/dist/runtime/server/utils/impersonation.d.ts +32 -2
  245. package/dist/runtime/server/utils/impersonation.mjs +16 -13
  246. package/dist/runtime/server/utils/lock.d.ts +71 -0
  247. package/dist/runtime/server/utils/lock.mjs +139 -0
  248. package/dist/runtime/server/utils/mail-suppression.mjs +7 -7
  249. package/dist/runtime/server/utils/mail.d.ts +30 -19
  250. package/dist/runtime/server/utils/mcp.d.ts +44 -0
  251. package/dist/runtime/server/utils/mcp.mjs +308 -0
  252. package/dist/runtime/server/utils/notifications.d.ts +72 -7
  253. package/dist/runtime/server/utils/notifications.mjs +67 -55
  254. package/dist/runtime/server/utils/oauth.d.ts +27 -4
  255. package/dist/runtime/server/utils/organization.d.ts +63 -7
  256. package/dist/runtime/server/utils/organization.mjs +26 -21
  257. package/dist/runtime/server/utils/passwordless.d.ts +62 -33
  258. package/dist/runtime/server/utils/payments.d.ts +51 -12
  259. package/dist/runtime/server/utils/payments.mjs +472 -282
  260. package/dist/runtime/server/utils/queue.d.ts +106 -13
  261. package/dist/runtime/server/utils/queue.mjs +313 -28
  262. package/dist/runtime/server/utils/rag.d.ts +42 -14
  263. package/dist/runtime/server/utils/rag.mjs +169 -4
  264. package/dist/runtime/server/utils/ratelimit.d.ts +34 -5
  265. package/dist/runtime/server/utils/ratelimit.mjs +95 -14
  266. package/dist/runtime/server/utils/realtime.d.ts +68 -52
  267. package/dist/runtime/server/utils/scheduled-task.d.ts +42 -1
  268. package/dist/runtime/server/utils/scheduled-task.mjs +29 -0
  269. package/dist/runtime/server/utils/schema-fallback.d.ts +1 -1
  270. package/dist/runtime/server/utils/schema-fallback.mjs +1 -1
  271. package/dist/runtime/server/utils/session.d.ts +84 -10
  272. package/dist/runtime/server/utils/session.mjs +12 -10
  273. package/dist/runtime/server/utils/sse.d.ts +75 -0
  274. package/dist/runtime/server/utils/sse.mjs +147 -0
  275. package/dist/runtime/server/utils/sso.d.ts +1 -1
  276. package/dist/runtime/server/utils/storage.d.ts +53 -4
  277. package/dist/runtime/server/utils/storage.mjs +15 -11
  278. package/dist/runtime/server/utils/store-localization.d.ts +51 -0
  279. package/dist/runtime/server/utils/store-localization.mjs +417 -0
  280. package/dist/runtime/server/utils/store.d.ts +207 -0
  281. package/dist/runtime/server/utils/store.mjs +2227 -0
  282. package/dist/runtime/server/utils/table-names.d.ts +51 -0
  283. package/dist/runtime/server/utils/table-names.mjs +69 -0
  284. package/dist/runtime/server/utils/tenant.d.ts +26 -2
  285. package/dist/runtime/server/utils/tenant.mjs +16 -12
  286. package/dist/runtime/server/utils/tools-registry-fallback.d.ts +1 -0
  287. package/dist/runtime/server/utils/tools-registry-fallback.mjs +1 -0
  288. package/dist/runtime/server/utils/totp.d.ts +45 -2
  289. package/dist/runtime/server/utils/tracker.d.ts +10 -11
  290. package/dist/runtime/server/utils/turnstile.d.ts +16 -1
  291. package/dist/runtime/server/utils/workflows.d.ts +92 -0
  292. package/dist/runtime/server/utils/workflows.mjs +299 -0
  293. package/dist/runtime/server.d.ts +8 -1
  294. package/dist/runtime/server.mjs +8 -5
  295. package/dist/runtime/service.d.ts +10 -10
  296. package/dist/runtime/storage.d.ts +1 -0
  297. package/dist/runtime/storage.mjs +1 -0
  298. package/dist/runtime/store.d.ts +4 -0
  299. package/dist/runtime/store.mjs +2 -0
  300. package/dist/runtime/test-utils.d.ts +11 -10
  301. package/dist/runtime/test-utils.mjs +64 -4
  302. package/dist/runtime/types/ai.d.ts +21 -2
  303. package/dist/runtime/types/d1.d.ts +17 -0
  304. package/dist/runtime/types/drizzle.d.ts +2 -2
  305. package/dist/runtime/types/durable-object.d.ts +62 -2
  306. package/dist/runtime/types/email.d.ts +46 -0
  307. package/dist/runtime/types/imports.d.ts +6 -1
  308. package/dist/runtime/types/index.d.ts +58 -0
  309. package/dist/runtime/types/index.mjs +3 -0
  310. package/dist/runtime/types/mcp.d.ts +83 -0
  311. package/dist/runtime/types/mcp.mjs +0 -0
  312. package/dist/runtime/types/queue.d.ts +36 -0
  313. package/dist/runtime/types/r2.d.ts +41 -0
  314. package/dist/runtime/types/store.d.ts +313 -0
  315. package/dist/runtime/types/store.mjs +0 -0
  316. package/dist/runtime/types/workflows.d.ts +98 -0
  317. package/dist/runtime/types/workflows.mjs +0 -0
  318. package/dist/runtime/workflows.d.ts +5 -0
  319. package/dist/runtime/workflows.mjs +2 -0
  320. package/dist/types/ai.d.ts +721 -0
  321. package/dist/types/cms.d.ts +710 -0
  322. package/dist/types.d.ts +406 -1288
  323. package/dist/utils/auth-schema.d.ts +3 -2
  324. package/dist/utils/bots.d.ts +20 -0
  325. package/dist/utils/comments-schema.d.ts +5 -4
  326. package/dist/utils/drizzle.d.ts +83 -3
  327. package/dist/utils/durable-objects.d.ts +10 -0
  328. package/dist/utils/email-inbound.d.ts +10 -0
  329. package/dist/utils/local-db.d.ts +1 -3
  330. package/dist/utils/mcp.d.ts +24 -0
  331. package/dist/utils/notifications-schema.d.ts +5 -4
  332. package/dist/utils/payments-schema.d.ts +4 -3
  333. package/dist/utils/store-schema.d.ts +14 -0
  334. package/dist/utils/table-names.d.ts +1 -0
  335. package/dist/utils/tenants-schema.d.ts +4 -3
  336. package/dist/utils/tools.d.ts +20 -0
  337. package/dist/utils/workflows.d.ts +8 -0
  338. package/package.json +34 -4
  339. package/dist/chunks/wrangler.mjs +0 -897
  340. package/dist/runtime/app/components/AuthRegister.vue +0 -306
  341. package/dist/runtime/app/components/AuthSessionsList.vue +0 -137
  342. package/dist/runtime/app/components/AuthSignIn.vue +0 -298
  343. package/dist/runtime/app/components/CMSBookmarkButton.vue +0 -59
  344. package/dist/runtime/app/components/CMSImage.vue +0 -47
  345. package/dist/runtime/app/components/CMSLocaleSwitcher.vue +0 -110
  346. package/dist/runtime/app/components/CMSNewsletter.vue +0 -81
  347. package/dist/runtime/app/components/CMSPreviewBanner.vue +0 -83
  348. package/dist/runtime/app/components/CMSTableOfContents.vue +0 -84
  349. package/dist/runtime/app/components/CMSVersionBanner.vue +0 -53
  350. package/dist/runtime/app/components/CMSVersionSwitcher.vue +0 -140
  351. package/dist/runtime/app/components/Comments.vue +0 -411
  352. package/dist/runtime/app/components/FileUpload.vue +0 -200
  353. package/dist/runtime/app/components/ImpersonationBanner.vue +0 -61
  354. package/dist/runtime/app/components/NotificationBell.vue +0 -263
  355. package/dist/runtime/app/components/NotificationList.vue +0 -205
  356. package/dist/runtime/app/components/NotificationPrompt.vue +0 -133
  357. package/dist/runtime/app/components/PricingGated.vue +0 -81
  358. package/dist/runtime/app/components/PricingTable.vue +0 -274
  359. package/dist/runtime/app/components/RealtimeChat.vue +0 -164
  360. package/dist/runtime/app/components/RealtimePresence.vue +0 -129
  361. package/dist/runtime/app/components/RealtimeStatus.vue +0 -79
  362. package/dist/runtime/app/components/SubscriptionCard.vue +0 -207
  363. package/dist/runtime/app/components/UserProfile.vue +0 -558
@@ -18,8 +18,8 @@ export declare const authenticators: undefined;
18
18
  export declare const organizations: undefined;
19
19
  export declare const members: undefined;
20
20
  export declare const invitations: undefined;
21
+ export declare const auditLog: undefined;
21
22
  export declare const auditLogs: undefined;
22
23
  export declare const audit_logs: undefined;
23
- export declare const _qarpeo_audit_logs: undefined;
24
24
  export type AuditLog = any;
25
25
  export type NewAuditLog = any;
@@ -17,6 +17,6 @@ export const authenticators = void 0;
17
17
  export const organizations = void 0;
18
18
  export const members = void 0;
19
19
  export const invitations = void 0;
20
+ export const auditLog = void 0;
20
21
  export const auditLogs = void 0;
21
22
  export const audit_logs = void 0;
22
- export const _qarpeo_audit_logs = void 0;
@@ -3,20 +3,46 @@ import type { QarpeoUser } from "../../types/auth";
3
3
  /**
4
4
  * Returns the current authenticated user session data from sealed cookie. Powered by Nuxt 4.6+
5
5
  * native session, with fallback to global session helpers.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * const session = await getAuthSession(event)
10
+ * if (session?.user) {
11
+ * console.log("Logged in user:", session.user.id)
12
+ * }
13
+ * ```
6
14
  */
7
- export declare function getAuthSession<T = any>(event: any): Promise<T>;
15
+ export declare function getAuthSession<T = any>(event: RequestEvent): Promise<T>;
8
16
  /**
9
17
  * Updates the sealed session cookie with user session data. Powered by Nuxt 4.6+ native session,
10
18
  * and syncs with global session helpers if present.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * await setAuthSession(event, { user: { id: "u_1", email: "user@example.com" } })
23
+ * ```
11
24
  */
12
- export declare function setAuthSession(event: any, sessionData: any, config?: any): Promise<any>;
25
+ export declare function setAuthSession(event: RequestEvent, sessionData: Record<string, unknown>, config?: Record<string, unknown>): Promise<Record<string, unknown>>;
13
26
  /**
14
27
  * Clears the session cookie. Powered by Nuxt 4.6+ native session, and syncs with global session
15
28
  * helpers if present.
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * await clearAuthSession(event)
33
+ * ```
16
34
  */
17
- export declare function clearAuthSession(event: any, config?: any): Promise<boolean>;
18
- /** Requires an active user session, throwing 401 Unauthorized if not authenticated. */
19
- export declare function requireAuthSession<T = any>(event: any, opts?: any): Promise<T>;
35
+ export declare function clearAuthSession(event: RequestEvent, config?: Record<string, unknown>): Promise<boolean>;
36
+ /**
37
+ * Requires an active user session, throwing 401 Unauthorized if not authenticated.
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * const session = await requireAuthSession(event)
42
+ * console.log("Authorized user:", session.user.id)
43
+ * ```
44
+ */
45
+ export declare function requireAuthSession<T = any>(event: RequestEvent, opts?: Record<string, unknown>): Promise<T>;
20
46
  export declare const getUserSession: typeof getAuthSession;
21
47
  export declare const setUserSession: typeof setAuthSession;
22
48
  export declare const clearUserSession: typeof clearAuthSession;
@@ -42,11 +68,24 @@ export interface DeviceSessionRecord {
42
68
  /**
43
69
  * Creates a new multi-device session, handles LRU eviction if limits are exceeded, and saves into
44
70
  * D1 (and KV if backend="kv").
71
+ *
72
+ * @example
73
+ * ```ts
74
+ * const deviceSession = await createDeviceSession(event, user, {
75
+ * backend: "kv",
76
+ * maxSessionsPerUser: 5,
77
+ * })
78
+ * ```
45
79
  */
46
80
  export declare function createDeviceSession(event: RequestEvent, user: QarpeoUser, options?: CreateDeviceSessionOptions): Promise<DeviceSessionRecord>;
47
81
  /**
48
82
  * Throttled sliding-window update of last_active. Runs at most once every 15 minutes to preserve D1
49
83
  * write quotas.
84
+ *
85
+ * @example
86
+ * ```ts
87
+ * await touchDeviceSession(event, session)
88
+ * ```
50
89
  */
51
90
  export declare function touchDeviceSession(event: RequestEvent, session: any): Promise<void>;
52
91
  export interface SessionListItem {
@@ -58,13 +97,48 @@ export interface SessionListItem {
58
97
  expiresAt: number;
59
98
  isCurrent: boolean;
60
99
  }
61
- /** Lists all active device sessions for a user, sorted by last_active descending. */
100
+ /**
101
+ * Lists all active device sessions for a user, sorted by last_active descending.
102
+ *
103
+ * @example
104
+ * ```ts
105
+ * const sessions = await listDeviceSessions(event, user.id, currentSessionId)
106
+ * ```
107
+ */
62
108
  export declare function listDeviceSessions(event: RequestEvent, userId: string, currentSessionId?: string): Promise<SessionListItem[]>;
63
- /** Revokes a single session belonging to the user. */
109
+ /**
110
+ * Revokes a single session belonging to the user.
111
+ *
112
+ * @example
113
+ * ```ts
114
+ * const success = await revokeDeviceSession(event, user.id, sessionId)
115
+ * ```
116
+ */
64
117
  export declare function revokeDeviceSession(event: RequestEvent, userId: string, sessionIdToRevoke: string): Promise<boolean>;
65
- /** Revokes all sessions for the given user. */
118
+ /**
119
+ * Revokes all sessions for the given user.
120
+ *
121
+ * @example
122
+ * ```ts
123
+ * await revokeAllDeviceSessions(event, user.id)
124
+ * ```
125
+ */
66
126
  export declare function revokeAllDeviceSessions(event: RequestEvent, userId: string): Promise<boolean>;
67
- /** Revokes all sessions for the given user EXCEPT the current active session. */
127
+ /**
128
+ * Revokes all sessions for the given user EXCEPT the current active session.
129
+ *
130
+ * @example
131
+ * ```ts
132
+ * await revokeOtherDeviceSessions(event, user.id, currentSessionId)
133
+ * ```
134
+ */
68
135
  export declare function revokeOtherDeviceSessions(event: RequestEvent, userId: string, currentSessionId?: string): Promise<boolean>;
69
- /** Validates whether a session ID is still valid in KV (sub-millisecond remote revocation check). */
136
+ /**
137
+ * Validates whether a session ID is still valid in KV (sub-millisecond remote revocation check).
138
+ *
139
+ * @example
140
+ * ```ts
141
+ * const isValid = await verifyKVSession(event, sessionId)
142
+ * ```
143
+ */
70
144
  export declare function verifyKVSession(event: RequestEvent, sessionId: string): Promise<boolean>;
@@ -8,6 +8,8 @@ import {
8
8
  } from "nuxt/server";
9
9
  import { getD1Binding } from "../../db.mjs";
10
10
  import { getKVBinding } from "../../kv.mjs";
11
+ import { resolveTableName } from "./table-names.mjs";
12
+ const sessionTbl = (e) => resolveTableName("session", e);
11
13
  export async function getAuthSession(event) {
12
14
  try {
13
15
  const s = await getSession(event);
@@ -116,17 +118,17 @@ export async function createDeviceSession(event, user, options = {}) {
116
118
  }
117
119
  if (d1) {
118
120
  await d1.prepare(`
119
- INSERT INTO session (id, user_id, token, user_agent, ip_address, created_at, updated_at, expires_at)
121
+ INSERT INTO ${sessionTbl(event)} (id, user_id, token, user_agent, ip_address, created_at, updated_at, expires_at)
120
122
  VALUES (?, ?, ?, ?, ?, ?, ?, ?)
121
123
  `).bind(sessionId, user.id, tokenHash, userAgent, ipAddress, now, now, expiresAt).run();
122
124
  if (maxSessions > 0) {
123
- const activeSessions = await d1.prepare("SELECT id FROM session WHERE user_id = ? ORDER BY updated_at ASC").bind(user.id).all();
125
+ const activeSessions = await d1.prepare(`SELECT id FROM ${sessionTbl(event)} WHERE user_id = ? ORDER BY updated_at ASC`).bind(user.id).all();
124
126
  const results = activeSessions.results || [];
125
127
  if (results.length > maxSessions) {
126
128
  const excessCount = results.length - maxSessions;
127
129
  const toEvict = results.slice(0, excessCount).map((r) => r.id);
128
130
  for (const evictId of toEvict) {
129
- await d1.prepare("DELETE FROM session WHERE id = ?").bind(evictId).run();
131
+ await d1.prepare(`DELETE FROM ${sessionTbl(event)} WHERE id = ?`).bind(evictId).run();
130
132
  if (options.backend === "kv") {
131
133
  try {
132
134
  const kv = getKVBinding("KV", event);
@@ -183,7 +185,7 @@ export async function touchDeviceSession(event, session) {
183
185
  try {
184
186
  const bindingName = globalThis.process?.env?.QARPEO_DEFAULT_DB_BINDING || "DB";
185
187
  const d1 = getD1Binding(bindingName, event);
186
- await d1.prepare("UPDATE session SET updated_at = ? WHERE id = ?").bind(now, session.sessionId).run();
188
+ await d1.prepare(`UPDATE ${sessionTbl(event)} SET updated_at = ? WHERE id = ?`).bind(now, session.sessionId).run();
187
189
  } catch {
188
190
  }
189
191
  };
@@ -200,7 +202,7 @@ export async function listDeviceSessions(event, userId, currentSessionId) {
200
202
  const bindingName = globalThis.process?.env?.QARPEO_DEFAULT_DB_BINDING || "DB";
201
203
  const d1 = getD1Binding(bindingName, event);
202
204
  const res = await d1.prepare(
203
- "SELECT id, user_agent, ip_address, updated_at as last_active, expires_at FROM session WHERE user_id = ? ORDER BY updated_at DESC"
205
+ `SELECT id, user_agent, ip_address, updated_at as last_active, expires_at FROM ${sessionTbl(event)} WHERE user_id = ? ORDER BY updated_at DESC`
204
206
  ).bind(userId).all();
205
207
  const rows = res.results || [];
206
208
  return rows.map((r) => ({
@@ -220,7 +222,7 @@ export async function revokeDeviceSession(event, userId, sessionIdToRevoke) {
220
222
  try {
221
223
  const bindingName = globalThis.process?.env?.QARPEO_DEFAULT_DB_BINDING || "DB";
222
224
  const d1 = getD1Binding(bindingName, event);
223
- await d1.prepare("DELETE FROM session WHERE id = ? AND user_id = ?").bind(sessionIdToRevoke, userId).run();
225
+ await d1.prepare(`DELETE FROM ${sessionTbl(event)} WHERE id = ? AND user_id = ?`).bind(sessionIdToRevoke, userId).run();
224
226
  try {
225
227
  const kv = getKVBinding("KV", event);
226
228
  await kv.delete(`session:${sessionIdToRevoke}`);
@@ -235,9 +237,9 @@ export async function revokeAllDeviceSessions(event, userId) {
235
237
  try {
236
238
  const bindingName = globalThis.process?.env?.QARPEO_DEFAULT_DB_BINDING || "DB";
237
239
  const d1 = getD1Binding(bindingName, event);
238
- const res = await d1.prepare("SELECT id FROM session WHERE user_id = ?").bind(userId).all();
240
+ const res = await d1.prepare(`SELECT id FROM ${sessionTbl(event)} WHERE user_id = ?`).bind(userId).all();
239
241
  const sessionIds = (res.results || []).map((r) => r.id);
240
- await d1.prepare("DELETE FROM session WHERE user_id = ?").bind(userId).run();
242
+ await d1.prepare(`DELETE FROM ${sessionTbl(event)} WHERE user_id = ?`).bind(userId).run();
241
243
  try {
242
244
  const kv = getKVBinding("KV", event);
243
245
  for (const id of sessionIds) {
@@ -255,9 +257,9 @@ export async function revokeOtherDeviceSessions(event, userId, currentSessionId)
255
257
  try {
256
258
  const bindingName = globalThis.process?.env?.QARPEO_DEFAULT_DB_BINDING || "DB";
257
259
  const d1 = getD1Binding(bindingName, event);
258
- const res = await d1.prepare("SELECT id FROM session WHERE user_id = ? AND id != ?").bind(userId, currentSessionId).all();
260
+ const res = await d1.prepare(`SELECT id FROM ${sessionTbl(event)} WHERE user_id = ? AND id != ?`).bind(userId, currentSessionId).all();
259
261
  const sessionIds = (res.results || []).map((r) => r.id);
260
- await d1.prepare("DELETE FROM session WHERE user_id = ? AND id != ?").bind(userId, currentSessionId).run();
262
+ await d1.prepare(`DELETE FROM ${sessionTbl(event)} WHERE user_id = ? AND id != ?`).bind(userId, currentSessionId).run();
261
263
  try {
262
264
  const kv = getKVBinding("KV", event);
263
265
  for (const id of sessionIds) {
@@ -0,0 +1,75 @@
1
+ import type { RequestEvent } from "nuxt/server";
2
+ export interface EventStreamMessage {
3
+ id?: string;
4
+ event?: string;
5
+ retry?: number;
6
+ data?: any;
7
+ }
8
+ export interface QarpeoEventStreamOptions {
9
+ /**
10
+ * Heartbeat interval in milliseconds. If set > 0, sends a `: ping\n\n` comment
11
+ * at this interval to prevent proxy timeouts.
12
+ * @default 15000 (15 seconds)
13
+ */
14
+ heartbeat?: number | false;
15
+ }
16
+ /**
17
+ * Server-Sent Events (SSE) stream wrapper for Cloudflare Workers, Node, and Web standard runtimes.
18
+ */
19
+ export declare class QarpeoEventStream extends Response {
20
+ private _writer;
21
+ private _encoder;
22
+ private _closed;
23
+ private _closeCallbacks;
24
+ private _heartbeatTimer?;
25
+ constructor(event?: RequestEvent, options?: QarpeoEventStreamOptions);
26
+ /**
27
+ * Push an event to the connected client.
28
+ * Objects are automatically JSON-serialized.
29
+ */
30
+ push(data: any, options?: {
31
+ event?: string;
32
+ id?: string;
33
+ retry?: number;
34
+ }): Promise<void>;
35
+ /**
36
+ * Push an SSE comment (e.g. `: ping\n\n`) to keep connections alive through proxies.
37
+ */
38
+ pushComment(comment: string): Promise<void>;
39
+ /**
40
+ * Register a callback fired when the stream closes or the client disconnects.
41
+ */
42
+ onClose(callback: () => void): void;
43
+ /**
44
+ * Gracefully close the event stream writer.
45
+ */
46
+ close(): Promise<void>;
47
+ private _cleanup;
48
+ }
49
+ /**
50
+ * Creates a Server-Sent Events (SSE) stream from a Nitro/H3 request event.
51
+ * Returns a Response object that can be directly returned from defineEventHandler.
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * export default defineEventHandler((event) => {
56
+ * return createEventStream(event, async (stream) => {
57
+ * await stream.push({ status: "processing" })
58
+ * await stream.push({ status: "done", result: 42 })
59
+ * await stream.close()
60
+ * })
61
+ * })
62
+ * ```
63
+ */
64
+ export declare function createEventStream(event?: RequestEvent, handler?: (stream: QarpeoEventStream) => Promise<void> | void, options?: QarpeoEventStreamOptions): QarpeoEventStream;
65
+ /**
66
+ * Defines a type-safe Server-Sent Events handler.
67
+ *
68
+ * @example
69
+ * ```ts
70
+ * export default defineEventStream(async (event, stream) => {
71
+ * await stream.push({ message: "Hello from Cloudflare Workers SSE!" })
72
+ * })
73
+ * ```
74
+ */
75
+ export declare function defineEventStream(handler: (event: RequestEvent, stream: QarpeoEventStream) => Promise<void> | void, options?: QarpeoEventStreamOptions): (event: RequestEvent) => QarpeoEventStream;
@@ -0,0 +1,147 @@
1
+ export class QarpeoEventStream extends Response {
2
+ _writer;
3
+ _encoder = new TextEncoder();
4
+ _closed = false;
5
+ _closeCallbacks = [];
6
+ _heartbeatTimer;
7
+ constructor(event, options = {}) {
8
+ const strategy = new CountQueuingStrategy({ highWaterMark: 100 });
9
+ const transform = new TransformStream(void 0, strategy, strategy);
10
+ const headers = new Headers({
11
+ "Content-Type": "text/event-stream; charset=utf-8",
12
+ "Cache-Control": "private, no-cache, no-store, no-transform, must-revalidate, max-age=0",
13
+ "Connection": "keep-alive",
14
+ "X-Accel-Buffering": "no"
15
+ });
16
+ super(transform.readable, {
17
+ status: 200,
18
+ headers
19
+ });
20
+ this._writer = transform.writable.getWriter();
21
+ this._writer.closed.catch(() => {
22
+ }).finally(() => {
23
+ this._cleanup();
24
+ });
25
+ if (event) {
26
+ const req = event.node?.req || event.web?.request;
27
+ if (req?.signal?.addEventListener) {
28
+ req.signal.addEventListener("abort", () => {
29
+ this.close().catch(() => {
30
+ });
31
+ });
32
+ }
33
+ }
34
+ const heartbeatMs = options.heartbeat === false ? 0 : options.heartbeat ?? 15e3;
35
+ if (heartbeatMs > 0) {
36
+ this._heartbeatTimer = setInterval(() => {
37
+ if (!this._closed) {
38
+ this.pushComment("ping").catch(() => {
39
+ this._cleanup();
40
+ });
41
+ }
42
+ }, heartbeatMs);
43
+ }
44
+ }
45
+ /**
46
+ * Push an event to the connected client.
47
+ * Objects are automatically JSON-serialized.
48
+ */
49
+ async push(data, options) {
50
+ if (this._closed) return;
51
+ let msg;
52
+ if (typeof data === "object" && data !== null && ("data" in data || "event" in data || "id" in data) && !options) {
53
+ msg = data;
54
+ } else {
55
+ msg = { data, ...options };
56
+ }
57
+ let payload = "";
58
+ if (msg.id !== void 0) {
59
+ payload += `id: ${String(msg.id).replace(/\r\n|\r|\n/g, "")}
60
+ `;
61
+ }
62
+ if (msg.event) {
63
+ payload += `event: ${String(msg.event).replace(/\r\n|\r|\n/g, "")}
64
+ `;
65
+ }
66
+ if (typeof msg.retry === "number") {
67
+ payload += `retry: ${msg.retry}
68
+ `;
69
+ }
70
+ const rawData = typeof msg.data === "string" ? msg.data : msg.data === void 0 ? "" : JSON.stringify(msg.data);
71
+ const lines = rawData.split(/\r\n|\r|\n/);
72
+ for (const line of lines) {
73
+ payload += `data: ${line}
74
+ `;
75
+ }
76
+ payload += "\n";
77
+ try {
78
+ await this._writer.write(this._encoder.encode(payload));
79
+ } catch {
80
+ this._cleanup();
81
+ }
82
+ }
83
+ /**
84
+ * Push an SSE comment (e.g. `: ping\n\n`) to keep connections alive through proxies.
85
+ */
86
+ async pushComment(comment) {
87
+ if (this._closed) return;
88
+ const lines = comment.split(/\r\n|\r|\n/);
89
+ const payload = lines.map((l) => `: ${l}
90
+ `).join("") + "\n";
91
+ try {
92
+ await this._writer.write(this._encoder.encode(payload));
93
+ } catch {
94
+ this._cleanup();
95
+ }
96
+ }
97
+ /**
98
+ * Register a callback fired when the stream closes or the client disconnects.
99
+ */
100
+ onClose(callback) {
101
+ if (this._closed) {
102
+ callback();
103
+ return;
104
+ }
105
+ this._closeCallbacks.push(callback);
106
+ }
107
+ /**
108
+ * Gracefully close the event stream writer.
109
+ */
110
+ async close() {
111
+ if (this._closed) return;
112
+ this._cleanup();
113
+ try {
114
+ await this._writer.close();
115
+ } catch {
116
+ }
117
+ }
118
+ _cleanup() {
119
+ if (this._closed) return;
120
+ this._closed = true;
121
+ if (this._heartbeatTimer) {
122
+ clearInterval(this._heartbeatTimer);
123
+ this._heartbeatTimer = void 0;
124
+ }
125
+ for (const cb of this._closeCallbacks) {
126
+ try {
127
+ cb();
128
+ } catch {
129
+ }
130
+ }
131
+ this._closeCallbacks = [];
132
+ }
133
+ }
134
+ export function createEventStream(event, handler, options) {
135
+ const stream = new QarpeoEventStream(event, options);
136
+ if (handler) {
137
+ Promise.resolve(handler(stream)).catch((err) => {
138
+ console.error("[qarpeo:sse] Error in event stream handler:", err);
139
+ stream.close().catch(() => {
140
+ });
141
+ });
142
+ }
143
+ return stream;
144
+ }
145
+ export function defineEventStream(handler, options) {
146
+ return (event) => createEventStream(event, (stream) => handler(event, stream), options);
147
+ }
@@ -14,7 +14,7 @@ export interface SAMLAssertionResult {
14
14
  }
15
15
  /**
16
16
  * Verifies the XML digital signature on a SAML Response using the IdP's signing certificate stored
17
- * in `_qarpeo_sso_connections.cert`.
17
+ * in `sso_connection.cert`.
18
18
  *
19
19
  * Returns `true` if the signature is valid, `false` if it fails verification, and `null` if no
20
20
  * signature is present (allowing callers to decide policy).
@@ -20,7 +20,18 @@ export declare function validateStorageFile(file: {
20
20
  type?: string;
21
21
  size?: number;
22
22
  }, config: StorageOptions): void;
23
- /** Uploads a file to Cloudflare R2 storage with tenant scoping, validation, and access tier tagging. */
23
+ /**
24
+ * Uploads a file to Cloudflare R2 storage with tenant scoping, validation, and access tier tagging.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * const file = await uploadStorageFile(event, {
29
+ * data: buffer,
30
+ * filename: "avatar.png",
31
+ * type: "image/png",
32
+ * })
33
+ * ```
34
+ */
24
35
  export declare function uploadStorageFile(event: RequestEvent, file: {
25
36
  data: Uint8Array | ArrayBuffer;
26
37
  filename?: string;
@@ -61,6 +72,18 @@ export declare function createPresignedUploadTicket(event: RequestEvent, input:
61
72
  expiresAt: number;
62
73
  access: BlobAccessTier;
63
74
  }>;
75
+ /**
76
+ * Generates a true R2 presigned URL for direct client-to-R2 upload (bypassing the server proxy).
77
+ */
78
+ export declare function createPresignedUploadUrl(event: RequestEvent, input: {
79
+ pathname: string;
80
+ contentType?: string;
81
+ expiresIn?: number | string;
82
+ }): Promise<{
83
+ url: string;
84
+ key: string;
85
+ expiresAt: number;
86
+ }>;
64
87
  /** Verifies a presigned upload ticket. Throws 403 if invalid or expired. */
65
88
  export declare function verifyPresignedUploadTicket(event: RequestEvent, key: string, type: string, ticket: string, access?: BlobAccessTier): Promise<boolean>;
66
89
  /** Generates an HMAC signed token and URL for accessing unlisted/private files or forced downloads. */
@@ -77,17 +100,38 @@ export declare function verifySignedBlobToken(event: RequestEvent, key: string,
77
100
  valid: boolean;
78
101
  download: boolean;
79
102
  }>;
80
- /** Returns a signed download URL for an R2 object with optional custom filename and expiration. */
103
+ /**
104
+ * Returns a signed download URL for an R2 object with optional custom filename and expiration.
105
+ *
106
+ * @example
107
+ * ```ts
108
+ * const url = await getDownloadUrl(event, "reports/annual.pdf", { expiresIn: "1h" })
109
+ * ```
110
+ */
81
111
  export declare function getDownloadUrl(event: RequestEvent, key: string, options?: {
82
112
  expiresIn?: number | string;
83
113
  download?: boolean;
84
114
  filename?: string;
85
115
  }): Promise<string>;
86
- /** Deletes a file from R2 storage. */
116
+ /**
117
+ * Deletes a file from R2 storage.
118
+ *
119
+ * @example
120
+ * ```ts
121
+ * await deleteStorageFile(event, "uploads/avatar.png")
122
+ * ```
123
+ */
87
124
  export declare function deleteStorageFile(event: RequestEvent, key: string): Promise<{
88
125
  success: boolean;
89
126
  }>;
90
- /** Lists objects from R2 storage with pagination and access tier metadata. */
127
+ /**
128
+ * Lists objects from R2 storage with pagination and access tier metadata.
129
+ *
130
+ * @example
131
+ * ```ts
132
+ * const { files, cursor } = await listStorageFiles(event, { limit: 20 })
133
+ * ```
134
+ */
91
135
  export declare function listStorageFiles(event: RequestEvent, options?: {
92
136
  prefix?: string;
93
137
  limit?: number;
@@ -108,6 +152,11 @@ export declare function listStorageFiles(event: RequestEvent, options?: {
108
152
  /**
109
153
  * Serves an object from R2 with streaming, range requests (206 Partial Content), access tier
110
154
  * enforcement, ETag caching, and download headers.
155
+ *
156
+ * @example
157
+ * ```ts
158
+ * return await serveStorageFile(event, "uploads/avatar.png")
159
+ * ```
111
160
  */
112
161
  export declare function serveStorageFile(event: RequestEvent, key: string): Promise<Response | null>;
113
162
  export interface HandleUploadOptions {
@@ -4,7 +4,7 @@ import {
4
4
  getRequestHeader,
5
5
  getQuery
6
6
  } from "nuxt/server";
7
- import { getR2Binding, parseByteSize } from "../../blob.mjs";
7
+ import { getR2Binding, parseByteSize, createBlob } from "../../blob.mjs";
8
8
  import { getDevMockBlobStore } from "./blob-store.mjs";
9
9
  import { getQarpeoConfig, getSessionSecret } from "./config.mjs";
10
10
  import { getAuthContext } from "./context.mjs";
@@ -257,6 +257,13 @@ export async function createPresignedUploadTicket(event, input) {
257
257
  access
258
258
  };
259
259
  }
260
+ export async function createPresignedUploadUrl(event, input) {
261
+ const blobClient = createBlob(void 0, event);
262
+ return await blobClient.createUploadUrl(input.pathname, {
263
+ contentType: input.contentType,
264
+ expiresIn: input.expiresIn
265
+ });
266
+ }
260
267
  export async function verifyPresignedUploadTicket(event, key, type, ticket, access = "public") {
261
268
  const [expiresAtStr, signatureHex] = ticket.split(".");
262
269
  const expiresAt = Number(expiresAtStr);
@@ -280,21 +287,12 @@ export async function verifyPresignedUploadTicket(event, key, type, ticket, acce
280
287
  const sigBytes = new Uint8Array(
281
288
  signatureHex.match(/.{1,2}/g)?.map((byte) => parseInt(byte, 16)) || []
282
289
  );
283
- let isValid = await crypto.subtle.verify(
290
+ const isValid = await crypto.subtle.verify(
284
291
  "HMAC",
285
292
  cryptoKey,
286
293
  sigBytes,
287
294
  encoder.encode(payloadWithAccess)
288
295
  );
289
- if (!isValid && access === "public") {
290
- const legacyPayload = `${key}:${type}:${expiresAt}`;
291
- isValid = await crypto.subtle.verify(
292
- "HMAC",
293
- cryptoKey,
294
- sigBytes,
295
- encoder.encode(legacyPayload)
296
- );
297
- }
298
296
  if (!isValid) {
299
297
  throw createError({
300
298
  statusCode: 403,
@@ -636,6 +634,7 @@ export async function serveStorageFile(event, key) {
636
634
  ETag: object.etag,
637
635
  "Content-Type": object.httpMetadata?.contentType || "application/octet-stream",
638
636
  "Accept-Ranges": "bytes",
637
+ "X-Content-Type-Options": "nosniff",
639
638
  "Cache-Control": access === "public" ? object.httpMetadata?.cacheControl || "public, max-age=31536000, immutable" : "private, no-cache, no-store, must-revalidate"
640
639
  };
641
640
  if (isRange && !object.range) {
@@ -664,6 +663,11 @@ export async function serveStorageFile(event, key) {
664
663
  headers["Content-Disposition"] = `attachment; filename="${safeFilename}"`;
665
664
  } else if (object.httpMetadata?.contentDisposition) {
666
665
  headers["Content-Disposition"] = object.httpMetadata.contentDisposition;
666
+ } else {
667
+ const ct = (object.httpMetadata?.contentType || "").toLowerCase();
668
+ if (ct.includes("text/html") || ct.includes("image/svg+xml")) {
669
+ headers["Content-Disposition"] = "attachment";
670
+ }
667
671
  }
668
672
  return new Response(object.body, { headers });
669
673
  }
@@ -0,0 +1,51 @@
1
+ import { type RequestEvent } from "nuxt/server";
2
+ import type { StoreCurrency, StoreTaxCalculationInput, StoreTaxResult, StoreTaxOptions, StoreLocalizationOptions } from "../../types/store";
3
+ export declare const DEFAULT_STORE_RATES: Record<string, number>;
4
+ export declare const SUPPORTED_STORE_CURRENCIES: Record<string, Omit<StoreCurrency, "rate">>;
5
+ export declare const COUNTRY_TO_CURRENCY_MAP: Record<string, string>;
6
+ /**
7
+ * Detects visitor ISO 3166-1 alpha-2 country code using Cloudflare headers.
8
+ */
9
+ export declare function detectStoreCountry(event?: RequestEvent): string;
10
+ /**
11
+ * Detects visitor preferred currency based on cookie or Cloudflare geo-location.
12
+ */
13
+ export declare function detectStoreCurrency(event?: RequestEvent, options?: StoreLocalizationOptions): string;
14
+ /**
15
+ * Converts a price in cents from one currency to another using exchange rates.
16
+ */
17
+ export declare function convertStoreCurrency(amountInCents: number, fromCurrency: string, toCurrency: string, rates?: Record<string, number>, rounding?: "none" | "round" | "charm-99" | "charm-95"): number;
18
+ /**
19
+ * Formats a cent amount into a localized currency string.
20
+ */
21
+ export declare function formatStorePrice(amountInCents: number, currency?: string, locale?: string): string;
22
+ /**
23
+ * Standard EU VAT Rates (as of 2026/2027 standard rules).
24
+ */
25
+ export declare const EU_STANDARD_VAT_RATES: Record<string, {
26
+ rate: number;
27
+ name: string;
28
+ }>;
29
+ /**
30
+ * US State Sales Tax Default Base Rates.
31
+ */
32
+ export declare const US_STATE_TAX_RATES: Record<string, number>;
33
+ /**
34
+ * Canadian Province Combined Sales Tax (GST/PST/HST).
35
+ */
36
+ export declare const CANADA_PROVINCE_TAX_RATES: Record<string, {
37
+ rate: number;
38
+ name: string;
39
+ }>;
40
+ /**
41
+ * Validates an EU VAT identification number format against official member state syntax rules.
42
+ */
43
+ export declare function validateEuVatNumber(vatNumber: string): {
44
+ valid: boolean;
45
+ countryCode?: string;
46
+ cleanNumber?: string;
47
+ };
48
+ /**
49
+ * Edge Tax Engine: Calculates exact tax, VAT, and B2B reverse charge exemptions.
50
+ */
51
+ export declare function calculateStoreTax(input: StoreTaxCalculationInput, options?: StoreTaxOptions): StoreTaxResult;