qarpeo 0.4.13 → 0.4.14

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 (299) hide show
  1. package/README.md +12 -6
  2. package/dist/apps/cms.d.ts +1 -1
  3. package/dist/apps/comments.d.ts +1 -1
  4. package/dist/apps/payments.d.ts +1 -1
  5. package/dist/apps/store.d.ts +1 -1
  6. package/dist/chunks/{manifest.get.mjs → tools.mjs} +445 -430
  7. package/dist/cli/index.mjs +756 -746
  8. package/dist/core/aliases.d.ts +1 -1
  9. package/dist/core/context.d.ts +1 -1
  10. package/dist/core/d1-migrate.d.ts +1 -1
  11. package/dist/core/devtools.d.ts +1 -1
  12. package/dist/core/nitro.d.ts +1 -1
  13. package/dist/core/schema.d.ts +1 -1
  14. package/dist/core/server-utils.d.ts +1 -1
  15. package/dist/core/wrangler.d.ts +1 -1
  16. package/dist/fate/index.d.ts +8 -8
  17. package/dist/fate/index.mjs +3 -1
  18. package/dist/features/agents.d.ts +1 -1
  19. package/dist/features/auth.d.ts +1 -1
  20. package/dist/features/bots.d.ts +1 -1
  21. package/dist/features/console.d.ts +1 -1
  22. package/dist/features/fate.d.ts +1 -1
  23. package/dist/features/mail.d.ts +1 -1
  24. package/dist/features/mcp.d.ts +1 -1
  25. package/dist/features/multitenant.d.ts +1 -1
  26. package/dist/features/notifications.d.ts +1 -1
  27. package/dist/features/realtime.d.ts +1 -1
  28. package/dist/features/studio.d.ts +4 -0
  29. package/dist/module.d.ts +1 -1
  30. package/dist/module.mjs +5139 -5067
  31. package/dist/primitives/ai.d.ts +1 -1
  32. package/dist/primitives/analytics.d.ts +1 -1
  33. package/dist/primitives/blob.d.ts +1 -1
  34. package/dist/primitives/browser.d.ts +1 -1
  35. package/dist/primitives/cache.d.ts +1 -1
  36. package/dist/primitives/d1.d.ts +1 -1
  37. package/dist/primitives/do.d.ts +1 -1
  38. package/dist/primitives/email.d.ts +1 -1
  39. package/dist/primitives/hyperdrive.d.ts +1 -1
  40. package/dist/primitives/kv.d.ts +1 -1
  41. package/dist/primitives/queue.d.ts +1 -1
  42. package/dist/primitives/ratelimit.d.ts +1 -1
  43. package/dist/primitives/vectorize.d.ts +1 -1
  44. package/dist/primitives/workflows.d.ts +1 -1
  45. package/dist/runtime/ai.mjs +4 -1
  46. package/dist/runtime/app/components/CMSEditor.vue +439 -0
  47. package/dist/runtime/app/components/CMSEditorImageNode.vue +90 -0
  48. package/dist/runtime/app/components/CMSEditorLinkPopover.vue +120 -0
  49. package/dist/runtime/app/components/QDropZone.vue +327 -0
  50. package/dist/runtime/app/components/QImageCropper.vue +658 -0
  51. package/dist/runtime/app/components/QImageStudio.vue +300 -0
  52. package/dist/runtime/app/components/QImg.vue +7 -4
  53. package/dist/runtime/app/composables/analytics.d.ts +8 -8
  54. package/dist/runtime/app/composables/api-tokens.d.ts +5 -5
  55. package/dist/runtime/app/composables/auth.d.ts +23 -19
  56. package/dist/runtime/app/composables/chat.d.ts +7 -6
  57. package/dist/runtime/app/composables/cms-preview.d.ts +7 -8
  58. package/dist/runtime/app/composables/cms.d.ts +6 -6
  59. package/dist/runtime/app/composables/comments.d.ts +5 -5
  60. package/dist/runtime/app/composables/comments.mjs +7 -4
  61. package/dist/runtime/app/composables/console.d.ts +6 -14
  62. package/dist/runtime/app/composables/docs-version.d.ts +8 -8
  63. package/dist/runtime/app/composables/impersonation.d.ts +5 -5
  64. package/dist/runtime/app/composables/organization.d.ts +5 -5
  65. package/dist/runtime/app/composables/passkey.d.ts +5 -5
  66. package/dist/runtime/app/composables/passwordless.d.ts +5 -5
  67. package/dist/runtime/app/composables/payments.d.ts +5 -5
  68. package/dist/runtime/app/composables/rbac.d.ts +5 -5
  69. package/dist/runtime/app/composables/site.d.ts +2 -2
  70. package/dist/runtime/app/composables/sse.d.ts +20 -33
  71. package/dist/runtime/app/composables/sse.mjs +6 -3
  72. package/dist/runtime/app/composables/storage.d.ts +6 -8
  73. package/dist/runtime/app/composables/store.d.ts +37 -36
  74. package/dist/runtime/app/composables/store.mjs +7 -6
  75. package/dist/runtime/app/composables/studio.d.ts +59 -0
  76. package/dist/runtime/app/composables/studio.mjs +129 -0
  77. package/dist/runtime/app/composables/tenant.d.ts +7 -7
  78. package/dist/runtime/app/composables/turnstile.d.ts +5 -5
  79. package/dist/runtime/app/composables/two-factor.d.ts +5 -5
  80. package/dist/runtime/app/pages/devtools/notifications.vue +1 -6
  81. package/dist/runtime/app/plugins/pwa.mjs +1 -3
  82. package/dist/runtime/app/utils/cms-editor.d.ts +25 -0
  83. package/dist/runtime/app/utils/cms-editor.mjs +43 -0
  84. package/dist/runtime/auth.d.ts +9 -9
  85. package/dist/runtime/blob.d.ts +1 -3
  86. package/dist/runtime/blob.mjs +3 -1
  87. package/dist/runtime/cache.d.ts +8 -6
  88. package/dist/runtime/cache.mjs +8 -11
  89. package/dist/runtime/db.d.ts +4 -3
  90. package/dist/runtime/drizzle.d.ts +2 -1
  91. package/dist/runtime/drizzle.mjs +2 -2
  92. package/dist/runtime/queue.d.ts +1 -0
  93. package/dist/runtime/replica.d.ts +6 -10
  94. package/dist/runtime/replica.mjs +3 -1
  95. package/dist/runtime/schema-mysql.d.ts +16 -32
  96. package/dist/runtime/schema-pg.d.ts +15 -31
  97. package/dist/runtime/schema-shared.d.ts +20 -17
  98. package/dist/runtime/schema.d.ts +21 -33
  99. package/dist/runtime/server/durable-objects/agent.mjs +4 -1
  100. package/dist/runtime/server/durable-objects/room.d.ts +4 -6
  101. package/dist/runtime/server/durable-objects/room.mjs +18 -8
  102. package/dist/runtime/server/plugins/comments.d.ts +2 -3
  103. package/dist/runtime/server/plugins/email-inbound.d.ts +1 -3
  104. package/dist/runtime/server/plugins/store.d.ts +2 -3
  105. package/dist/runtime/server/routes/__qarpeo/cloud/agents/run.post.d.ts +2 -2
  106. package/dist/runtime/server/routes/__qarpeo/cloud/cms/entry.get.mjs +10 -2
  107. package/dist/runtime/server/routes/__qarpeo/cloud/cms/entry.post.d.ts +2 -2
  108. package/dist/runtime/server/routes/__qarpeo/cloud/cms/entry.post.mjs +10 -2
  109. package/dist/runtime/server/routes/__qarpeo/cloud/cms.get.d.ts +2 -2
  110. package/dist/runtime/server/routes/__qarpeo/cloud/cms.get.mjs +7 -1
  111. package/dist/runtime/server/routes/__qarpeo/cloud/comments/moderate.post.d.ts +2 -2
  112. package/dist/runtime/server/routes/__qarpeo/cloud/comments/moderate.post.mjs +5 -1
  113. package/dist/runtime/server/routes/__qarpeo/cloud/comments.get.d.ts +1 -3
  114. package/dist/runtime/server/routes/__qarpeo/cloud/extras.get.d.ts +2 -2
  115. package/dist/runtime/server/routes/__qarpeo/cloud/extras.get.mjs +15 -4
  116. package/dist/runtime/server/routes/__qarpeo/cloud/mail/unsuppress.post.d.ts +2 -2
  117. package/dist/runtime/server/routes/__qarpeo/cloud/migrate/cms.post.mjs +13 -4
  118. package/dist/runtime/server/routes/__qarpeo/cloud/migrate/products.post.mjs +1 -1
  119. package/dist/runtime/server/routes/__qarpeo/cloud/migrate.post.d.ts +3 -3
  120. package/dist/runtime/server/routes/__qarpeo/cloud/migrate.post.mjs +22 -6
  121. package/dist/runtime/server/routes/__qarpeo/cloud/notifications/test.post.d.ts +2 -2
  122. package/dist/runtime/server/routes/__qarpeo/cloud/operations.get.d.ts +6 -5
  123. package/dist/runtime/server/routes/__qarpeo/cloud/store/order-status.post.d.ts +1 -3
  124. package/dist/runtime/server/routes/__qarpeo/cloud/store/order-status.post.mjs +14 -2
  125. package/dist/runtime/server/routes/__qarpeo/cloud/store/orders.get.d.ts +1 -3
  126. package/dist/runtime/server/routes/__qarpeo/cloud/store/orders.get.mjs +7 -1
  127. package/dist/runtime/server/routes/__qarpeo/cloud/store/products.get.d.ts +1 -3
  128. package/dist/runtime/server/routes/__qarpeo/cloud/tasks/run.post.d.ts +2 -2
  129. package/dist/runtime/server/routes/__qarpeo/cloud/users/action.post.d.ts +2 -2
  130. package/dist/runtime/server/routes/__qarpeo/cloud/users/action.post.mjs +5 -1
  131. package/dist/runtime/server/routes/__qarpeo/cloud/users.get.d.ts +6 -5
  132. package/dist/runtime/server/routes/__qarpeo/cloud/users.get.mjs +1 -3
  133. package/dist/runtime/server/routes/__qarpeo/mail/track/click/[id].get.mjs +2 -2
  134. package/dist/runtime/server/routes/__qarpeo/manifest.get.d.ts +2 -2
  135. package/dist/runtime/server/routes/__qarpeo/og.get.d.ts +2 -2
  136. package/dist/runtime/server/routes/__qarpeo/rbac/me.get.d.ts +2 -2
  137. package/dist/runtime/server/routes/__qarpeo/rbac/roles.delete.d.ts +2 -2
  138. package/dist/runtime/server/routes/__qarpeo/rbac/roles.delete.mjs +5 -1
  139. package/dist/runtime/server/routes/__qarpeo/rbac/roles.get.d.ts +2 -2
  140. package/dist/runtime/server/routes/__qarpeo/rbac/roles.get.mjs +1 -5
  141. package/dist/runtime/server/routes/__qarpeo/rbac/roles.post.d.ts +2 -2
  142. package/dist/runtime/server/routes/__qarpeo/rbac/roles.post.mjs +5 -1
  143. package/dist/runtime/server/routes/__qarpeo/rbac/users.post.d.ts +2 -2
  144. package/dist/runtime/server/routes/agents/[agent]/chat.post.mjs +1 -6
  145. package/dist/runtime/server/routes/agents/[agent]/clear.post.mjs +1 -6
  146. package/dist/runtime/server/routes/agents/[agent]/history.get.mjs +1 -6
  147. package/dist/runtime/server/routes/auth/2fa/disable.post.mjs +5 -1
  148. package/dist/runtime/server/routes/auth/2fa/verify.post.mjs +7 -1
  149. package/dist/runtime/server/routes/auth/magic-link/send.post.mjs +1 -1
  150. package/dist/runtime/server/routes/auth/otp/send.post.mjs +1 -1
  151. package/dist/runtime/server/routes/cms/search.get.mjs +2 -6
  152. package/dist/runtime/server/routes/comments/[id]/report.post.mjs +1 -4
  153. package/dist/runtime/server/routes/comments/[id].patch.mjs +1 -4
  154. package/dist/runtime/server/routes/comments/batch.post.mjs +1 -3
  155. package/dist/runtime/server/routes/comments/index.post.mjs +1 -5
  156. package/dist/runtime/server/routes/fate.mjs +1 -1
  157. package/dist/runtime/server/routes/mail/webhooks.post.mjs +1 -1
  158. package/dist/runtime/server/routes/sitemap.xml.get.mjs +2 -1
  159. package/dist/runtime/server/routes/storage/presigned-r2.post.d.ts +5 -6
  160. package/dist/runtime/server/routes/storage/presigned-r2.post.mjs +1 -1
  161. package/dist/runtime/server/routes/store/cart/items/[id].delete.mjs +1 -1
  162. package/dist/runtime/server/routes/store/cart/items/[id].patch.mjs +1 -1
  163. package/dist/runtime/server/routes/store/currencies.get.mjs +1 -4
  164. package/dist/runtime/server/routes/store/orders/[id].get.mjs +1 -1
  165. package/dist/runtime/server/routes/store/orders/download/[token].get.mjs +13 -4
  166. package/dist/runtime/server/routes/store/orders/index.get.mjs +1 -1
  167. package/dist/runtime/server/routes/store/tax/calculate.post.d.ts +2 -1
  168. package/dist/runtime/server/routes/store/tax/calculate.post.mjs +12 -3
  169. package/dist/runtime/server/routes/tenants/[tenant]/domains/[domain]/index.delete.mjs +4 -1
  170. package/dist/runtime/server/routes/tenants/[tenant]/domains/[domain]/verify.post.mjs +4 -1
  171. package/dist/runtime/server/utils/ai.d.ts +38 -35
  172. package/dist/runtime/server/utils/ai.mjs +7 -11
  173. package/dist/runtime/server/utils/analytics-query.d.ts +4 -4
  174. package/dist/runtime/server/utils/auth.d.ts +25 -25
  175. package/dist/runtime/server/utils/auth.mjs +22 -8
  176. package/dist/runtime/server/utils/bots.d.ts +7 -7
  177. package/dist/runtime/server/utils/browser-utils.d.ts +26 -27
  178. package/dist/runtime/server/utils/cache.d.ts +20 -20
  179. package/dist/runtime/server/utils/cms/collections.mjs +1 -6
  180. package/dist/runtime/server/utils/cms/common.mjs +1 -0
  181. package/dist/runtime/server/utils/cms/markdown.d.ts +2 -2
  182. package/dist/runtime/server/utils/cms/markdown.mjs +5 -5
  183. package/dist/runtime/server/utils/cms/mutations.mjs +8 -23
  184. package/dist/runtime/server/utils/cms/navigation.mjs +4 -4
  185. package/dist/runtime/server/utils/cms/path.d.ts +1 -0
  186. package/dist/runtime/server/utils/cms/path.mjs +8 -2
  187. package/dist/runtime/server/utils/cms/references.mjs +1 -7
  188. package/dist/runtime/server/utils/cms/search.d.ts +2 -2
  189. package/dist/runtime/server/utils/cms/sync.mjs +4 -2
  190. package/dist/runtime/server/utils/cms/taxonomy.d.ts +2 -2
  191. package/dist/runtime/server/utils/cms.d.ts +1 -1
  192. package/dist/runtime/server/utils/cms.mjs +1 -5
  193. package/dist/runtime/server/utils/comments-filter.d.ts +9 -7
  194. package/dist/runtime/server/utils/comments.d.ts +68 -55
  195. package/dist/runtime/server/utils/comments.mjs +21 -9
  196. package/dist/runtime/server/utils/config.d.ts +2 -2
  197. package/dist/runtime/server/utils/console.d.ts +3 -5
  198. package/dist/runtime/server/utils/context.d.ts +10 -10
  199. package/dist/runtime/server/utils/crypto.d.ts +20 -20
  200. package/dist/runtime/server/utils/domains.mjs +3 -1
  201. package/dist/runtime/server/utils/drizzle.d.ts +24 -25
  202. package/dist/runtime/server/utils/drizzle.mjs +17 -17
  203. package/dist/runtime/server/utils/durable-object.d.ts +27 -25
  204. package/dist/runtime/server/utils/durable-object.mjs +3 -10
  205. package/dist/runtime/server/utils/email-inbound.d.ts +10 -10
  206. package/dist/runtime/server/utils/impersonation.d.ts +18 -18
  207. package/dist/runtime/server/utils/legacy-hash.d.ts +23 -27
  208. package/dist/runtime/server/utils/lock.d.ts +20 -23
  209. package/dist/runtime/server/utils/mail.d.ts +19 -19
  210. package/dist/runtime/server/utils/mail.mjs +4 -2
  211. package/dist/runtime/server/utils/mcp.d.ts +20 -20
  212. package/dist/runtime/server/utils/mcp.mjs +22 -38
  213. package/dist/runtime/server/utils/notifications.d.ts +49 -38
  214. package/dist/runtime/server/utils/oauth.d.ts +3 -9
  215. package/dist/runtime/server/utils/organization.d.ts +28 -28
  216. package/dist/runtime/server/utils/organization.mjs +15 -5
  217. package/dist/runtime/server/utils/passwordless.d.ts +24 -24
  218. package/dist/runtime/server/utils/payments/checkout.d.ts +12 -12
  219. package/dist/runtime/server/utils/payments/checkout.mjs +1 -3
  220. package/dist/runtime/server/utils/payments/common.d.ts +3 -3
  221. package/dist/runtime/server/utils/payments/paddle.d.ts +4 -1
  222. package/dist/runtime/server/utils/payments/polar.d.ts +4 -1
  223. package/dist/runtime/server/utils/payments/stripe.mjs +5 -7
  224. package/dist/runtime/server/utils/payments/subscriptions.d.ts +14 -14
  225. package/dist/runtime/server/utils/payments/subscriptions.mjs +2 -6
  226. package/dist/runtime/server/utils/payments/usage.mjs +1 -3
  227. package/dist/runtime/server/utils/payments/webhooks.mjs +2 -2
  228. package/dist/runtime/server/utils/queue.d.ts +54 -58
  229. package/dist/runtime/server/utils/queue.mjs +2 -6
  230. package/dist/runtime/server/utils/rag.d.ts +23 -23
  231. package/dist/runtime/server/utils/rag.mjs +10 -5
  232. package/dist/runtime/server/utils/ratelimit.d.ts +21 -18
  233. package/dist/runtime/server/utils/rbac.d.ts +13 -15
  234. package/dist/runtime/server/utils/rbac.mjs +44 -10
  235. package/dist/runtime/server/utils/realtime.d.ts +53 -52
  236. package/dist/runtime/server/utils/role-env.d.ts +5 -4
  237. package/dist/runtime/server/utils/scheduled-task.d.ts +14 -15
  238. package/dist/runtime/server/utils/session.d.ts +40 -40
  239. package/dist/runtime/server/utils/sse.d.ts +23 -33
  240. package/dist/runtime/server/utils/sse.mjs +5 -14
  241. package/dist/runtime/server/utils/sso.mjs +3 -1
  242. package/dist/runtime/server/utils/storage.d.ts +20 -22
  243. package/dist/runtime/server/utils/storage.mjs +2 -2
  244. package/dist/runtime/server/utils/store/cart.d.ts +5 -3
  245. package/dist/runtime/server/utils/store/cart.mjs +14 -10
  246. package/dist/runtime/server/utils/store/checkout.mjs +4 -1
  247. package/dist/runtime/server/utils/store/common.d.ts +1 -1
  248. package/dist/runtime/server/utils/store/common.mjs +36 -12
  249. package/dist/runtime/server/utils/store/inventory.mjs +3 -1
  250. package/dist/runtime/server/utils/store/orders.mjs +32 -24
  251. package/dist/runtime/server/utils/store-localization.d.ts +9 -27
  252. package/dist/runtime/server/utils/store-localization.mjs +3 -3
  253. package/dist/runtime/server/utils/table-names.d.ts +15 -15
  254. package/dist/runtime/server/utils/table-names.mjs +1 -1
  255. package/dist/runtime/server/utils/tenant.d.ts +12 -12
  256. package/dist/runtime/server/utils/tenant.mjs +7 -4
  257. package/dist/runtime/server/utils/totp.d.ts +18 -18
  258. package/dist/runtime/server/utils/tracker.d.ts +5 -5
  259. package/dist/runtime/server/utils/turnstile.d.ts +9 -9
  260. package/dist/runtime/server/utils/urn.d.ts +5 -8
  261. package/dist/runtime/server/utils/workflows.d.ts +30 -31
  262. package/dist/runtime/server/utils/workflows.mjs +2 -4
  263. package/dist/runtime/server.d.ts +2 -2
  264. package/dist/runtime/service.d.ts +10 -10
  265. package/dist/runtime/test-utils.d.ts +10 -10
  266. package/dist/runtime/test-utils.mjs +9 -2
  267. package/dist/runtime/types/ai.d.ts +14 -14
  268. package/dist/runtime/types/d1.d.ts +6 -11
  269. package/dist/runtime/types/durable-object.d.ts +4 -8
  270. package/dist/runtime/types/email.d.ts +3 -9
  271. package/dist/runtime/types/index.d.ts +15 -21
  272. package/dist/runtime/types/r2.d.ts +5 -5
  273. package/dist/runtime/types/workflows.d.ts +5 -6
  274. package/dist/runtime/workflows.d.ts +1 -3
  275. package/dist/types/ai.d.ts +10 -17
  276. package/dist/types/auth.d.ts +5 -3
  277. package/dist/types/cache.d.ts +7 -7
  278. package/dist/types/cms.d.ts +30 -5
  279. package/dist/types/comments.d.ts +23 -21
  280. package/dist/types/console.d.ts +1 -3
  281. package/dist/types/db.d.ts +7 -7
  282. package/dist/types/index.d.ts +1 -0
  283. package/dist/types/options.d.ts +36 -24
  284. package/dist/types/site.d.ts +8 -2
  285. package/dist/types/storage.d.ts +2 -1
  286. package/dist/types/store-options.d.ts +10 -26
  287. package/dist/types/studio.d.ts +79 -0
  288. package/dist/utils/bots.d.ts +7 -3
  289. package/dist/utils/cms-table-names.d.ts +1 -1
  290. package/dist/utils/drizzle.d.ts +13 -14
  291. package/dist/utils/email-inbound.d.ts +4 -4
  292. package/dist/utils/features.d.ts +19 -5
  293. package/dist/utils/mcp.d.ts +1 -0
  294. package/dist/utils/migration-lock.d.ts +15 -29
  295. package/dist/utils/pkg.d.ts +6 -7
  296. package/dist/utils/schema-diff.d.ts +7 -11
  297. package/dist/utils/store-schema.d.ts +4 -6
  298. package/dist/utils/tools.d.ts +3 -3
  299. package/package.json +55 -5
@@ -5,50 +5,51 @@ export type { RealtimePeer, RealtimeHandlerOptions, RealtimeHandlerRegistration,
5
5
  * Creates a type-safe room state schema definition helper.
6
6
  *
7
7
  * @example
8
- * ```ts
9
- * interface ChatRoomState {
10
- * topic: string
11
- * isLocked: boolean
12
- * }
13
- * export const chatSchema = defineRoomState<ChatRoomState>({
14
- * name: "chat",
15
- * initialState: { topic: "General", isLocked: false },
16
- * })
17
- * ```
8
+ * ```ts
9
+ * interface ChatRoomState {
10
+ * topic: string
11
+ * isLocked: boolean
12
+ * }
13
+ * export const chatSchema = defineRoomState<ChatRoomState>({
14
+ * name: "chat",
15
+ * initialState: { topic: "General", isLocked: false },
16
+ * })
17
+ * ```
18
18
  */
19
19
  export declare function defineRoomState<T extends Record<string, any>>(schema: RoomStateSchema<T>): RoomStateSchema<T>;
20
20
  /**
21
21
  * Defines a server-side message and lifecycle handler for a room pattern.
22
22
  *
23
23
  * @example
24
- * ```ts
25
- * export default defineRealtimeHandler("chat:*", {
26
- * async message(peer, event, payload) {
27
- * await broadcastToRoom(peer.roomId, "message", {
28
- * from: peer.ctx.user?.name ?? "Anonymous",
29
- * text: payload.text,
30
- * ts: Date.now(),
31
- * })
32
- * },
33
- * connect(peer) {
34
- * console.log(`User connected to ${peer.roomId}`)
35
- * },
36
- * })
37
- * ```
24
+ * ```ts
25
+ * export default defineRealtimeHandler("chat:*", {
26
+ * async message(peer, event, payload) {
27
+ * await broadcastToRoom(peer.roomId, "message", {
28
+ * from: peer.ctx.user?.name ?? "Anonymous",
29
+ * text: payload.text,
30
+ * ts: Date.now(),
31
+ * })
32
+ * },
33
+ * connect(peer) {
34
+ * console.log(`User connected to ${peer.roomId}`)
35
+ * },
36
+ * })
37
+ * ```
38
38
  */
39
39
  export declare function defineRealtimeHandler(roomPattern: string, handlers: RealtimeHandlerOptions): RealtimeHandlerRegistration;
40
40
  /**
41
41
  * Retrieves all registered realtime handlers matching a given room ID.
42
42
  *
43
43
  * @example
44
- * ```ts
45
- * const handlers = getRealtimeHandlersForRoom("chat:general")
46
- * ```
44
+ * ```ts
45
+ * const handlers = getRealtimeHandlersForRoom("chat:general")
46
+ * ```
47
47
  */
48
48
  export declare function getRealtimeHandlersForRoom(roomId: string): RealtimeHandlerOptions[];
49
49
  export type EventOrRoom = RequestEvent | string;
50
50
  /**
51
- * Validates and sanitizes a room identifier to prevent DO ID injection, path traversal, and control character attacks.
51
+ * Validates and sanitizes a room identifier to prevent DO ID injection, path traversal, and control
52
+ * character attacks.
52
53
  */
53
54
  export declare function assertSafeRoomName(room: unknown): string;
54
55
  /**
@@ -63,12 +64,12 @@ export declare function getRoomDurableObject(eventOrRoom?: EventOrRoom, maybeRoo
63
64
  * Broadcasts an event and payload to all clients in a room from the server.
64
65
  *
65
66
  * @example
66
- * ```ts
67
- * await broadcastToRoom(event, "doc:456", "doc:updated", {
68
- * title: "New Title",
69
- * updatedBy: "Admin",
70
- * })
71
- * ```
67
+ * ```ts
68
+ * await broadcastToRoom(event, "doc:456", "doc:updated", {
69
+ * title: "New Title",
70
+ * updatedBy: "Admin",
71
+ * })
72
+ * ```
72
73
  */
73
74
  export declare function broadcastToRoom(eventOrRoom: EventOrRoom, roomOrEventName: string, eventNameOrPayload: unknown, payloadOrOptions?: unknown, options?: {
74
75
  sender?: string;
@@ -88,9 +89,9 @@ export declare function getRoomPresence(eventOrRoom: EventOrRoom, maybeRoom?: st
88
89
  * Retrieves the message history replay buffer for a room from Durable Object storage.
89
90
  *
90
91
  * @example
91
- * ```ts
92
- * const messages = await getRoomHistory(event, "chat:support")
93
- * ```
92
+ * ```ts
93
+ * const messages = await getRoomHistory(event, "chat:support")
94
+ * ```
94
95
  */
95
96
  export declare function getRoomHistory(eventOrRoom: EventOrRoom, maybeRoom?: string, options?: {
96
97
  limit?: number;
@@ -101,44 +102,44 @@ export declare function getRoomHistory(eventOrRoom: EventOrRoom, maybeRoom?: str
101
102
  * Clears the persistent message history replay buffer for a room from Durable Object storage.
102
103
  *
103
104
  * @example
104
- * ```ts
105
- * await clearRoomHistory(event, "chat:support")
106
- * ```
105
+ * ```ts
106
+ * await clearRoomHistory(event, "chat:support")
107
+ * ```
107
108
  */
108
109
  export declare function clearRoomHistory(eventOrRoom: EventOrRoom, maybeRoom?: string): Promise<boolean>;
109
110
  /**
110
111
  * Disconnects a user from a room by their userId.
111
112
  *
112
113
  * @example
113
- * ```ts
114
- * const disconnectedCount = await disconnectRoomUser(event, "chat:general", "user_123")
115
- * ```
114
+ * ```ts
115
+ * const disconnectedCount = await disconnectRoomUser(event, "chat:general", "user_123")
116
+ * ```
116
117
  */
117
118
  export declare function disconnectRoomUser(eventOrRoom: EventOrRoom, roomOrUserId: string, maybeUserId?: string): Promise<number>;
118
119
  /**
119
120
  * Retrieves the synchronized state of a room.
120
121
  *
121
122
  * @example
122
- * ```ts
123
- * const state = await getRoomState(event, "doc:456")
124
- * ```
123
+ * ```ts
124
+ * const state = await getRoomState(event, "doc:456")
125
+ * ```
125
126
  */
126
127
  export declare function getRoomState<T extends Record<string, any> = Record<string, any>>(eventOrRoom: EventOrRoom, maybeRoom?: string): Promise<T>;
127
128
  /**
128
129
  * Replaces the entire synchronized state of a room and broadcasts to all connected clients.
129
130
  *
130
131
  * @example
131
- * ```ts
132
- * await setRoomState(event, "doc:456", { title: "New Document", locked: false })
133
- * ```
132
+ * ```ts
133
+ * await setRoomState(event, "doc:456", { title: "New Document", locked: false })
134
+ * ```
134
135
  */
135
136
  export declare function setRoomState<T extends Record<string, any> = Record<string, any>>(eventOrRoom: EventOrRoom, roomOrState: string | T, maybeState?: T): Promise<T>;
136
137
  /**
137
138
  * Merges a partial patch into the synchronized state of a room and broadcasts the delta.
138
139
  *
139
140
  * @example
140
- * ```ts
141
- * await patchRoomState(event, "doc:456", { locked: true })
142
- * ```
141
+ * ```ts
142
+ * await patchRoomState(event, "doc:456", { locked: true })
143
+ * ```
143
144
  */
144
145
  export declare function patchRoomState<T extends Record<string, any> = Record<string, any>>(eventOrRoom: EventOrRoom, roomOrPatch: string | Partial<T>, maybePatch?: Partial<T>): Promise<T>;
@@ -1,19 +1,20 @@
1
1
  import type { RequestEvent } from "nuxt/server";
2
2
  /**
3
- * Qarpeo role hierarchy — no better-auth dependency so it can be safely imported
4
- * by rbac.ts and other utils without pulling better-auth/crypto into every bundle.
3
+ * Qarpeo role hierarchy — no better-auth dependency so it can be safely imported by rbac.ts and
4
+ * other utils without pulling better-auth/crypto into every bundle.
5
5
  */
6
6
  export type QarpeoRole = "super" | "admin" | "moderator" | "developer" | "user";
7
7
  /**
8
8
  * Resolves the configured role for an email address from environment variables:
9
+ *
9
10
  * - `QARPEO_SUPER_EMAILS` → 'super'
10
11
  * - `QARPEO_ADMIN_EMAILS` → 'admin'
11
12
  * - `QARPEO_MODERATOR_EMAILS` → 'moderator'
12
13
  * - `QARPEO_DEVELOPER_EMAILS` → 'developer'
13
14
  * - Default → 'user'
14
15
  *
15
- * Checks both Cloudflare Worker env (via event context or globalThis) and process.env.
16
- * Supports both `(event, email)` and `(email, event?)` argument orders.
16
+ * Checks both Cloudflare Worker env (via event context or globalThis) and process.env. Supports
17
+ * both `(event, email)` and `(email, event?)` argument orders.
17
18
  */
18
19
  export declare function getRoleFromEnv(event: RequestEvent, email: string): QarpeoRole;
19
20
  export declare function getRoleFromEnv(email: string, event?: RequestEvent): QarpeoRole;
@@ -7,12 +7,11 @@ export interface ScheduledTaskLockOptions {
7
7
  * @default "10 minutes"
8
8
  */
9
9
  ttl?: string | number;
10
- /**
11
- * Custom distributed lock key. Defaults to `cron:lock:<task_name>`.
12
- */
10
+ /** Custom distributed lock key. Defaults to `cron:lock:<task_name>`. */
13
11
  key?: string;
14
12
  /**
15
13
  * Behavior when another execution holds the lock:
14
+ *
16
15
  * - `"skip"` (default): gracefully skip execution and return `{ skipped: true, reason: "locked" }`.
17
16
  * - `"throw"`: throw a lock conflict error.
18
17
  *
@@ -39,8 +38,8 @@ export interface ScheduledTaskDefinition<TPayload = ScheduledTaskPayload, TResul
39
38
  /** Human-readable description */
40
39
  description?: string;
41
40
  /**
42
- * Enable distributed locking to prevent overlapping executions across edge isolates.
43
- * Set to `true` (default: 10m TTL, skips on conflict) or configure custom options.
41
+ * Enable distributed locking to prevent overlapping executions across edge isolates. Set to
42
+ * `true` (default: 10m TTL, skips on conflict) or configure custom options.
44
43
  */
45
44
  lock?: boolean | ScheduledTaskLockOptions;
46
45
  /** Task execution handler */
@@ -54,15 +53,15 @@ export interface ScheduledTaskDefinition<TPayload = ScheduledTaskPayload, TResul
54
53
  * distributed lock protection to prevent concurrent overlapping executions.
55
54
  *
56
55
  * @example
57
- * ```ts
58
- * export default defineScheduledTask({
59
- * meta: { name: "cleanup", description: "Hourly cleanup of expired tokens" },
60
- * cron: "0 * * * *",
61
- * lock: true, // Distributed locking & overlap prevention
62
- * async run({ context }) {
63
- * console.log("Running scheduled cleanup at", context?.scheduledTime)
64
- * },
65
- * })
66
- * ```
56
+ * ```ts
57
+ * export default defineScheduledTask({
58
+ * meta: { name: "cleanup", description: "Hourly cleanup of expired tokens" },
59
+ * cron: "0 * * * *",
60
+ * lock: true, // Distributed locking & overlap prevention
61
+ * async run({ context }) {
62
+ * console.log("Running scheduled cleanup at", context?.scheduledTime)
63
+ * },
64
+ * })
65
+ * ```
67
66
  */
68
67
  export declare function defineScheduledTask<TPayload = ScheduledTaskPayload, TResult = any>(def: ScheduledTaskDefinition<TPayload, TResult>): ScheduledTaskDefinition<TPayload, TResult>;
@@ -5,12 +5,12 @@ import type { QarpeoUser } from "../../types/auth";
5
5
  * native session, with fallback to global session helpers.
6
6
  *
7
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
- * ```
8
+ * ```ts
9
+ * const session = await getAuthSession(event)
10
+ * if (session?.user) {
11
+ * console.log("Logged in user:", session.user.id)
12
+ * }
13
+ * ```
14
14
  */
15
15
  export declare function getAuthSession<T = any>(event: RequestEvent): Promise<T>;
16
16
  /**
@@ -18,9 +18,9 @@ export declare function getAuthSession<T = any>(event: RequestEvent): Promise<T>
18
18
  * and syncs with global session helpers if present.
19
19
  *
20
20
  * @example
21
- * ```ts
22
- * await setAuthSession(event, { user: { id: "u_1", email: "user@example.com" } })
23
- * ```
21
+ * ```ts
22
+ * await setAuthSession(event, { user: { id: "u_1", email: "user@example.com" } })
23
+ * ```
24
24
  */
25
25
  export declare function setAuthSession(event: RequestEvent, sessionData: Record<string, unknown>, config?: Record<string, unknown>): Promise<Record<string, unknown>>;
26
26
  /**
@@ -28,19 +28,19 @@ export declare function setAuthSession(event: RequestEvent, sessionData: Record<
28
28
  * helpers if present.
29
29
  *
30
30
  * @example
31
- * ```ts
32
- * await clearAuthSession(event)
33
- * ```
31
+ * ```ts
32
+ * await clearAuthSession(event)
33
+ * ```
34
34
  */
35
35
  export declare function clearAuthSession(event: RequestEvent, config?: Record<string, unknown>): Promise<boolean>;
36
36
  /**
37
37
  * Requires an active user session, throwing 401 Unauthorized if not authenticated.
38
38
  *
39
39
  * @example
40
- * ```ts
41
- * const session = await requireAuthSession(event)
42
- * console.log("Authorized user:", session.user.id)
43
- * ```
40
+ * ```ts
41
+ * const session = await requireAuthSession(event)
42
+ * console.log("Authorized user:", session.user.id)
43
+ * ```
44
44
  */
45
45
  export declare function requireAuthSession<T = any>(event: RequestEvent, opts?: Record<string, unknown>): Promise<T>;
46
46
  export declare const getUserSession: typeof getAuthSession;
@@ -70,12 +70,12 @@ export interface DeviceSessionRecord {
70
70
  * D1 (and KV if backend="kv").
71
71
  *
72
72
  * @example
73
- * ```ts
74
- * const deviceSession = await createDeviceSession(event, user, {
75
- * backend: "kv",
76
- * maxSessionsPerUser: 5,
77
- * })
78
- * ```
73
+ * ```ts
74
+ * const deviceSession = await createDeviceSession(event, user, {
75
+ * backend: "kv",
76
+ * maxSessionsPerUser: 5,
77
+ * })
78
+ * ```
79
79
  */
80
80
  export declare function createDeviceSession(event: RequestEvent, user: QarpeoUser, options?: CreateDeviceSessionOptions): Promise<DeviceSessionRecord>;
81
81
  /**
@@ -83,9 +83,9 @@ export declare function createDeviceSession(event: RequestEvent, user: QarpeoUse
83
83
  * write quotas.
84
84
  *
85
85
  * @example
86
- * ```ts
87
- * await touchDeviceSession(event, session)
88
- * ```
86
+ * ```ts
87
+ * await touchDeviceSession(event, session)
88
+ * ```
89
89
  */
90
90
  export declare function touchDeviceSession(event: RequestEvent, session: any): Promise<void>;
91
91
  export interface SessionListItem {
@@ -101,44 +101,44 @@ export interface SessionListItem {
101
101
  * Lists all active device sessions for a user, sorted by last_active descending.
102
102
  *
103
103
  * @example
104
- * ```ts
105
- * const sessions = await listDeviceSessions(event, user.id, currentSessionId)
106
- * ```
104
+ * ```ts
105
+ * const sessions = await listDeviceSessions(event, user.id, currentSessionId)
106
+ * ```
107
107
  */
108
108
  export declare function listDeviceSessions(event: RequestEvent, userId: string, currentSessionId?: string): Promise<SessionListItem[]>;
109
109
  /**
110
110
  * Revokes a single session belonging to the user.
111
111
  *
112
112
  * @example
113
- * ```ts
114
- * const success = await revokeDeviceSession(event, user.id, sessionId)
115
- * ```
113
+ * ```ts
114
+ * const success = await revokeDeviceSession(event, user.id, sessionId)
115
+ * ```
116
116
  */
117
117
  export declare function revokeDeviceSession(event: RequestEvent, userId: string, sessionIdToRevoke: string): Promise<boolean>;
118
118
  /**
119
119
  * Revokes all sessions for the given user.
120
120
  *
121
121
  * @example
122
- * ```ts
123
- * await revokeAllDeviceSessions(event, user.id)
124
- * ```
122
+ * ```ts
123
+ * await revokeAllDeviceSessions(event, user.id)
124
+ * ```
125
125
  */
126
126
  export declare function revokeAllDeviceSessions(event: RequestEvent, userId: string): Promise<boolean>;
127
127
  /**
128
128
  * Revokes all sessions for the given user EXCEPT the current active session.
129
129
  *
130
130
  * @example
131
- * ```ts
132
- * await revokeOtherDeviceSessions(event, user.id, currentSessionId)
133
- * ```
131
+ * ```ts
132
+ * await revokeOtherDeviceSessions(event, user.id, currentSessionId)
133
+ * ```
134
134
  */
135
135
  export declare function revokeOtherDeviceSessions(event: RequestEvent, userId: string, currentSessionId?: string): Promise<boolean>;
136
136
  /**
137
137
  * Validates whether a session ID is still valid in KV (sub-millisecond remote revocation check).
138
138
  *
139
139
  * @example
140
- * ```ts
141
- * const isValid = await verifyKVSession(event, sessionId)
142
- * ```
140
+ * ```ts
141
+ * const isValid = await verifyKVSession(event, sessionId)
142
+ * ```
143
143
  */
144
144
  export declare function verifyKVSession(event: RequestEvent, sessionId: string): Promise<boolean>;
@@ -7,15 +7,14 @@ export interface EventStreamMessage {
7
7
  }
8
8
  export interface QarpeoEventStreamOptions {
9
9
  /**
10
- * Heartbeat interval in milliseconds. If set > 0, sends a `: ping\n\n` comment
11
- * at this interval to prevent proxy timeouts.
10
+ * Heartbeat interval in milliseconds. If set > 0, sends a `: ping\n\n` comment at this interval
11
+ * to prevent proxy timeouts.
12
+ *
12
13
  * @default 15000 (15 seconds)
13
14
  */
14
15
  heartbeat?: number | false;
15
16
  }
16
- /**
17
- * Server-Sent Events (SSE) stream wrapper for Cloudflare Workers, Node, and Web standard runtimes.
18
- */
17
+ /** Server-Sent Events (SSE) stream wrapper for Cloudflare Workers, Node, and Web standard runtimes. */
19
18
  export declare class QarpeoEventStream extends Response {
20
19
  private _writer;
21
20
  private _encoder;
@@ -23,53 +22,44 @@ export declare class QarpeoEventStream extends Response {
23
22
  private _closeCallbacks;
24
23
  private _heartbeatTimer?;
25
24
  constructor(event?: RequestEvent, options?: QarpeoEventStreamOptions);
26
- /**
27
- * Push an event to the connected client.
28
- * Objects are automatically JSON-serialized.
29
- */
25
+ /** Push an event to the connected client. Objects are automatically JSON-serialized. */
30
26
  push(data: any, options?: {
31
27
  event?: string;
32
28
  id?: string;
33
29
  retry?: number;
34
30
  }): Promise<void>;
35
- /**
36
- * Push an SSE comment (e.g. `: ping\n\n`) to keep connections alive through proxies.
37
- */
31
+ /** Push an SSE comment (e.g. `: ping\n\n`) to keep connections alive through proxies. */
38
32
  pushComment(comment: string): Promise<void>;
39
- /**
40
- * Register a callback fired when the stream closes or the client disconnects.
41
- */
33
+ /** Register a callback fired when the stream closes or the client disconnects. */
42
34
  onClose(callback: () => void): void;
43
- /**
44
- * Gracefully close the event stream writer.
45
- */
35
+ /** Gracefully close the event stream writer. */
46
36
  close(): Promise<void>;
47
37
  private _cleanup;
48
38
  }
49
39
  /**
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.
40
+ * Creates a Server-Sent Events (SSE) stream from a Nitro/H3 request event. Returns a Response
41
+ * object that can be directly returned from defineEventHandler.
52
42
  *
53
43
  * @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()
44
+ * ```ts
45
+ * export default defineEventHandler((event) => {
46
+ * return createEventStream(event, async (stream) => {
47
+ * await stream.push({ status: "processing" })
48
+ * await stream.push({ status: "done", result: 42 })
49
+ * await stream.close()
50
+ * })
60
51
  * })
61
- * })
62
- * ```
52
+ * ```
63
53
  */
64
54
  export declare function createEventStream(event?: RequestEvent, handler?: (stream: QarpeoEventStream) => Promise<void> | void, options?: QarpeoEventStreamOptions): QarpeoEventStream;
65
55
  /**
66
56
  * Defines a type-safe Server-Sent Events handler.
67
57
  *
68
58
  * @example
69
- * ```ts
70
- * export default defineEventStream(async (event, stream) => {
71
- * await stream.push({ message: "Hello from Cloudflare Workers SSE!" })
72
- * })
73
- * ```
59
+ * ```ts
60
+ * export default defineEventStream(async (event, stream) => {
61
+ * await stream.push({ message: "Hello from Cloudflare Workers SSE!" })
62
+ * })
63
+ * ```
74
64
  */
75
65
  export declare function defineEventStream(handler: (event: RequestEvent, stream: QarpeoEventStream) => Promise<void> | void, options?: QarpeoEventStreamOptions): (event: RequestEvent) => QarpeoEventStream;
@@ -10,7 +10,7 @@ export class QarpeoEventStream extends Response {
10
10
  const headers = new Headers({
11
11
  "Content-Type": "text/event-stream; charset=utf-8",
12
12
  "Cache-Control": "private, no-cache, no-store, no-transform, must-revalidate, max-age=0",
13
- "Connection": "keep-alive",
13
+ Connection: "keep-alive",
14
14
  "X-Accel-Buffering": "no"
15
15
  });
16
16
  super(transform.readable, {
@@ -42,10 +42,7 @@ export class QarpeoEventStream extends Response {
42
42
  }, heartbeatMs);
43
43
  }
44
44
  }
45
- /**
46
- * Push an event to the connected client.
47
- * Objects are automatically JSON-serialized.
48
- */
45
+ /** Push an event to the connected client. Objects are automatically JSON-serialized. */
49
46
  async push(data, options) {
50
47
  if (this._closed) return;
51
48
  let msg;
@@ -80,9 +77,7 @@ export class QarpeoEventStream extends Response {
80
77
  this._cleanup();
81
78
  }
82
79
  }
83
- /**
84
- * Push an SSE comment (e.g. `: ping\n\n`) to keep connections alive through proxies.
85
- */
80
+ /** Push an SSE comment (e.g. `: ping\n\n`) to keep connections alive through proxies. */
86
81
  async pushComment(comment) {
87
82
  if (this._closed) return;
88
83
  const lines = comment.split(/\r\n|\r|\n/);
@@ -94,9 +89,7 @@ export class QarpeoEventStream extends Response {
94
89
  this._cleanup();
95
90
  }
96
91
  }
97
- /**
98
- * Register a callback fired when the stream closes or the client disconnects.
99
- */
92
+ /** Register a callback fired when the stream closes or the client disconnects. */
100
93
  onClose(callback) {
101
94
  if (this._closed) {
102
95
  callback();
@@ -104,9 +97,7 @@ export class QarpeoEventStream extends Response {
104
97
  }
105
98
  this._closeCallbacks.push(callback);
106
99
  }
107
- /**
108
- * Gracefully close the event stream writer.
109
- */
100
+ /** Gracefully close the event stream writer. */
110
101
  async close() {
111
102
  if (this._closed) return;
112
103
  this._cleanup();
@@ -197,7 +197,9 @@ export function parseSAMLResponse(base64Response) {
197
197
  }
198
198
  }
199
199
  if (!notOnOrAfter) {
200
- const scdMatch = xml.match(/<(?:\w+:)?SubjectConfirmationData[^>]*\sNotOnOrAfter=["']([^"']+)["']/i);
200
+ const scdMatch = xml.match(
201
+ /<(?:\w+:)?SubjectConfirmationData[^>]*\sNotOnOrAfter=["']([^"']+)["']/i
202
+ );
201
203
  if (scdMatch) {
202
204
  const parsed = Date.parse(scdMatch[1]);
203
205
  if (!isNaN(parsed)) notOnOrAfter = parsed;
@@ -24,13 +24,13 @@ export declare function validateStorageFile(file: {
24
24
  * Uploads a file to Cloudflare R2 storage with tenant scoping, validation, and access tier tagging.
25
25
  *
26
26
  * @example
27
- * ```ts
28
- * const file = await uploadStorageFile(event, {
29
- * data: buffer,
30
- * filename: "avatar.png",
31
- * type: "image/png",
32
- * })
33
- * ```
27
+ * ;```ts
28
+ * const file = await uploadStorageFile(event, {
29
+ * data: buffer,
30
+ * filename: "avatar.png",
31
+ * type: "image/png",
32
+ * })
33
+ * ```
34
34
  */
35
35
  export declare function uploadStorageFile(event: RequestEvent, file: {
36
36
  data: Uint8Array | ArrayBuffer;
@@ -72,9 +72,7 @@ export declare function createPresignedUploadTicket(event: RequestEvent, input:
72
72
  expiresAt: number;
73
73
  access: BlobAccessTier;
74
74
  }>;
75
- /**
76
- * Generates a true R2 presigned URL for direct client-to-R2 upload (bypassing the server proxy).
77
- */
75
+ /** Generates a true R2 presigned URL for direct client-to-R2 upload (bypassing the server proxy). */
78
76
  export declare function createPresignedUploadUrl(event: RequestEvent, input: {
79
77
  pathname: string;
80
78
  contentType?: string;
@@ -104,9 +102,9 @@ export declare function verifySignedBlobToken(event: RequestEvent, key: string,
104
102
  * Returns a signed download URL for an R2 object with optional custom filename and expiration.
105
103
  *
106
104
  * @example
107
- * ```ts
108
- * const url = await getDownloadUrl(event, "reports/annual.pdf", { expiresIn: "1h" })
109
- * ```
105
+ * ;```ts
106
+ * const url = await getDownloadUrl(event, "reports/annual.pdf", { expiresIn: "1h" })
107
+ * ```
110
108
  */
111
109
  export declare function getDownloadUrl(event: RequestEvent, key: string, options?: {
112
110
  expiresIn?: number | string;
@@ -117,9 +115,9 @@ export declare function getDownloadUrl(event: RequestEvent, key: string, options
117
115
  * Deletes a file from R2 storage.
118
116
  *
119
117
  * @example
120
- * ```ts
121
- * await deleteStorageFile(event, "uploads/avatar.png")
122
- * ```
118
+ * ;```ts
119
+ * await deleteStorageFile(event, "uploads/avatar.png")
120
+ * ```
123
121
  */
124
122
  export declare function deleteStorageFile(event: RequestEvent, key: string): Promise<{
125
123
  success: boolean;
@@ -128,9 +126,9 @@ export declare function deleteStorageFile(event: RequestEvent, key: string): Pro
128
126
  * Lists objects from R2 storage with pagination and access tier metadata.
129
127
  *
130
128
  * @example
131
- * ```ts
132
- * const { files, cursor } = await listStorageFiles(event, { limit: 20 })
133
- * ```
129
+ * ;```ts
130
+ * const { files, cursor } = await listStorageFiles(event, { limit: 20 })
131
+ * ```
134
132
  */
135
133
  export declare function listStorageFiles(event: RequestEvent, options?: {
136
134
  prefix?: string;
@@ -154,9 +152,9 @@ export declare function listStorageFiles(event: RequestEvent, options?: {
154
152
  * enforcement, ETag caching, and download headers.
155
153
  *
156
154
  * @example
157
- * ```ts
158
- * return await serveStorageFile(event, "uploads/avatar.png")
159
- * ```
155
+ * ;```ts
156
+ * return await serveStorageFile(event, "uploads/avatar.png")
157
+ * ```
160
158
  */
161
159
  export declare function serveStorageFile(event: RequestEvent, key: string): Promise<Response | null>;
162
160
  export interface HandleUploadOptions {
@@ -65,7 +65,7 @@ export async function resolveStorageScopePrefix(event, config) {
65
65
  }
66
66
  export function sanitizeFilename(filename) {
67
67
  const clean = filename.toLowerCase().replace(/[^\w.-]/g, "-").replace(/-+/g, "-").replace(/^-+|-+$/g, "");
68
- if (!clean || /^[\.-]+$/.test(clean)) {
68
+ if (!clean || /^[.-]+$/.test(clean)) {
69
69
  return "unnamed-file";
70
70
  }
71
71
  return clean;
@@ -703,7 +703,7 @@ export async function readEventMultipartFormData(event) {
703
703
  }
704
704
  }
705
705
  try {
706
- const { readMultipartFormData } = await import("h3");
706
+ const { readMultipartFormData } = await import("nuxt/server");
707
707
  const form = await readMultipartFormData(event);
708
708
  if (form && form.length > 0) {
709
709
  return form.filter((part) => part.filename && part.data).map((part) => ({