qarpeo 0.4.13 → 0.4.15

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 (304) hide show
  1. package/README.md +197 -191
  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 +5451 -5249
  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 +52 -36
  74. package/dist/runtime/app/composables/store.mjs +70 -11
  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/products/index.get.mjs +2 -0
  168. package/dist/runtime/server/routes/store/tax/calculate.post.d.ts +2 -1
  169. package/dist/runtime/server/routes/store/tax/calculate.post.mjs +12 -3
  170. package/dist/runtime/server/routes/tenants/[tenant]/domains/[domain]/index.delete.mjs +4 -1
  171. package/dist/runtime/server/routes/tenants/[tenant]/domains/[domain]/verify.post.mjs +4 -1
  172. package/dist/runtime/server/utils/ai.d.ts +38 -35
  173. package/dist/runtime/server/utils/ai.mjs +7 -11
  174. package/dist/runtime/server/utils/analytics-query.d.ts +4 -4
  175. package/dist/runtime/server/utils/auth.d.ts +25 -25
  176. package/dist/runtime/server/utils/auth.mjs +22 -8
  177. package/dist/runtime/server/utils/bots.d.ts +7 -7
  178. package/dist/runtime/server/utils/browser-utils.d.ts +26 -27
  179. package/dist/runtime/server/utils/cache.d.ts +20 -20
  180. package/dist/runtime/server/utils/cms/collections.mjs +1 -6
  181. package/dist/runtime/server/utils/cms/common.mjs +1 -0
  182. package/dist/runtime/server/utils/cms/markdown.d.ts +2 -2
  183. package/dist/runtime/server/utils/cms/markdown.mjs +5 -5
  184. package/dist/runtime/server/utils/cms/mutations.mjs +8 -23
  185. package/dist/runtime/server/utils/cms/navigation.mjs +4 -4
  186. package/dist/runtime/server/utils/cms/path.d.ts +1 -0
  187. package/dist/runtime/server/utils/cms/path.mjs +8 -2
  188. package/dist/runtime/server/utils/cms/references.mjs +1 -7
  189. package/dist/runtime/server/utils/cms/search.d.ts +2 -2
  190. package/dist/runtime/server/utils/cms/sync.mjs +4 -2
  191. package/dist/runtime/server/utils/cms/taxonomy.d.ts +2 -2
  192. package/dist/runtime/server/utils/cms.d.ts +1 -1
  193. package/dist/runtime/server/utils/cms.mjs +1 -5
  194. package/dist/runtime/server/utils/comments-filter.d.ts +9 -7
  195. package/dist/runtime/server/utils/comments.d.ts +68 -55
  196. package/dist/runtime/server/utils/comments.mjs +21 -9
  197. package/dist/runtime/server/utils/config.d.ts +2 -2
  198. package/dist/runtime/server/utils/console.d.ts +3 -5
  199. package/dist/runtime/server/utils/context.d.ts +10 -10
  200. package/dist/runtime/server/utils/crypto.d.ts +20 -20
  201. package/dist/runtime/server/utils/domains.mjs +3 -1
  202. package/dist/runtime/server/utils/drizzle.d.ts +24 -25
  203. package/dist/runtime/server/utils/drizzle.mjs +17 -17
  204. package/dist/runtime/server/utils/durable-object.d.ts +27 -25
  205. package/dist/runtime/server/utils/durable-object.mjs +3 -10
  206. package/dist/runtime/server/utils/email-inbound.d.ts +10 -10
  207. package/dist/runtime/server/utils/impersonation.d.ts +18 -18
  208. package/dist/runtime/server/utils/legacy-hash.d.ts +23 -27
  209. package/dist/runtime/server/utils/lock.d.ts +20 -23
  210. package/dist/runtime/server/utils/mail.d.ts +19 -19
  211. package/dist/runtime/server/utils/mail.mjs +4 -2
  212. package/dist/runtime/server/utils/mcp.d.ts +20 -20
  213. package/dist/runtime/server/utils/mcp.mjs +22 -38
  214. package/dist/runtime/server/utils/notifications.d.ts +49 -38
  215. package/dist/runtime/server/utils/oauth.d.ts +3 -9
  216. package/dist/runtime/server/utils/organization.d.ts +28 -28
  217. package/dist/runtime/server/utils/organization.mjs +15 -5
  218. package/dist/runtime/server/utils/passwordless.d.ts +24 -24
  219. package/dist/runtime/server/utils/payments/checkout.d.ts +12 -12
  220. package/dist/runtime/server/utils/payments/checkout.mjs +1 -3
  221. package/dist/runtime/server/utils/payments/common.d.ts +3 -3
  222. package/dist/runtime/server/utils/payments/paddle.d.ts +4 -1
  223. package/dist/runtime/server/utils/payments/polar.d.ts +4 -1
  224. package/dist/runtime/server/utils/payments/stripe.mjs +5 -7
  225. package/dist/runtime/server/utils/payments/subscriptions.d.ts +14 -14
  226. package/dist/runtime/server/utils/payments/subscriptions.mjs +2 -6
  227. package/dist/runtime/server/utils/payments/usage.mjs +1 -3
  228. package/dist/runtime/server/utils/payments/webhooks.mjs +2 -2
  229. package/dist/runtime/server/utils/queue.d.ts +54 -58
  230. package/dist/runtime/server/utils/queue.mjs +2 -6
  231. package/dist/runtime/server/utils/rag.d.ts +23 -23
  232. package/dist/runtime/server/utils/rag.mjs +10 -5
  233. package/dist/runtime/server/utils/ratelimit.d.ts +21 -18
  234. package/dist/runtime/server/utils/rbac.d.ts +13 -15
  235. package/dist/runtime/server/utils/rbac.mjs +44 -10
  236. package/dist/runtime/server/utils/realtime.d.ts +53 -52
  237. package/dist/runtime/server/utils/role-env.d.ts +5 -4
  238. package/dist/runtime/server/utils/scheduled-task.d.ts +14 -15
  239. package/dist/runtime/server/utils/session.d.ts +40 -40
  240. package/dist/runtime/server/utils/sse.d.ts +23 -33
  241. package/dist/runtime/server/utils/sse.mjs +5 -14
  242. package/dist/runtime/server/utils/sso.mjs +3 -1
  243. package/dist/runtime/server/utils/storage.d.ts +20 -22
  244. package/dist/runtime/server/utils/storage.mjs +2 -2
  245. package/dist/runtime/server/utils/store/cart.d.ts +5 -3
  246. package/dist/runtime/server/utils/store/cart.mjs +14 -10
  247. package/dist/runtime/server/utils/store/checkout.mjs +4 -1
  248. package/dist/runtime/server/utils/store/common.d.ts +1 -1
  249. package/dist/runtime/server/utils/store/common.mjs +36 -12
  250. package/dist/runtime/server/utils/store/inventory.mjs +3 -1
  251. package/dist/runtime/server/utils/store/orders.mjs +32 -24
  252. package/dist/runtime/server/utils/store/vendor.d.ts +11 -1
  253. package/dist/runtime/server/utils/store/vendor.mjs +47 -0
  254. package/dist/runtime/server/utils/store-localization.d.ts +9 -27
  255. package/dist/runtime/server/utils/store-localization.mjs +3 -3
  256. package/dist/runtime/server/utils/table-names.d.ts +15 -15
  257. package/dist/runtime/server/utils/table-names.mjs +1 -1
  258. package/dist/runtime/server/utils/tenant.d.ts +12 -12
  259. package/dist/runtime/server/utils/tenant.mjs +7 -4
  260. package/dist/runtime/server/utils/totp.d.ts +18 -18
  261. package/dist/runtime/server/utils/tracker.d.ts +5 -5
  262. package/dist/runtime/server/utils/turnstile.d.ts +9 -9
  263. package/dist/runtime/server/utils/urn.d.ts +5 -8
  264. package/dist/runtime/server/utils/workflows.d.ts +30 -31
  265. package/dist/runtime/server/utils/workflows.mjs +2 -4
  266. package/dist/runtime/server.d.ts +2 -2
  267. package/dist/runtime/service.d.ts +10 -10
  268. package/dist/runtime/test-utils.d.ts +10 -10
  269. package/dist/runtime/test-utils.mjs +9 -2
  270. package/dist/runtime/types/ai.d.ts +14 -14
  271. package/dist/runtime/types/d1.d.ts +6 -11
  272. package/dist/runtime/types/durable-object.d.ts +4 -8
  273. package/dist/runtime/types/email.d.ts +3 -9
  274. package/dist/runtime/types/index.d.ts +15 -21
  275. package/dist/runtime/types/r2.d.ts +5 -5
  276. package/dist/runtime/types/store.d.ts +7 -0
  277. package/dist/runtime/types/workflows.d.ts +5 -6
  278. package/dist/runtime/workflows.d.ts +1 -3
  279. package/dist/types/ai.d.ts +10 -17
  280. package/dist/types/auth.d.ts +5 -3
  281. package/dist/types/cache.d.ts +7 -7
  282. package/dist/types/cms.d.ts +30 -5
  283. package/dist/types/comments.d.ts +23 -21
  284. package/dist/types/console.d.ts +1 -3
  285. package/dist/types/db.d.ts +7 -7
  286. package/dist/types/index.d.ts +1 -0
  287. package/dist/types/options.d.ts +36 -24
  288. package/dist/types/site.d.ts +8 -2
  289. package/dist/types/storage.d.ts +2 -1
  290. package/dist/types/store-options.d.ts +31 -26
  291. package/dist/types/studio.d.ts +79 -0
  292. package/dist/utils/bots.d.ts +7 -3
  293. package/dist/utils/cms-table-names.d.ts +1 -1
  294. package/dist/utils/drizzle.d.ts +13 -14
  295. package/dist/utils/email-inbound.d.ts +4 -4
  296. package/dist/utils/features.d.ts +19 -5
  297. package/dist/utils/mcp.d.ts +1 -0
  298. package/dist/utils/migration-lock.d.ts +15 -29
  299. package/dist/utils/overridable-routes.d.ts +12 -0
  300. package/dist/utils/pkg.d.ts +6 -7
  301. package/dist/utils/schema-diff.d.ts +7 -11
  302. package/dist/utils/store-schema.d.ts +4 -6
  303. package/dist/utils/tools.d.ts +3 -3
  304. package/package.json +55 -5
@@ -1,14 +1,20 @@
1
1
  import { createError } from "nuxt/server";
2
2
  export function assertSafeCmsSlug(slug) {
3
3
  if (typeof slug !== "string" || !slug.trim()) {
4
- throw createError({ statusCode: 400, message: "Slug is required and must be a non-empty string" });
4
+ throw createError({
5
+ statusCode: 400,
6
+ message: "Slug is required and must be a non-empty string"
7
+ });
5
8
  }
6
9
  const trimmed = slug.trim();
7
10
  if (trimmed.length > 256) {
8
11
  throw createError({ statusCode: 400, message: "Slug exceeds maximum length of 256 characters" });
9
12
  }
10
13
  if (trimmed.includes("\\") || trimmed.includes("..") || /[\x00-\x1f\x7f]/.test(trimmed)) {
11
- throw createError({ statusCode: 400, message: "Slug contains invalid characters or path traversal sequences" });
14
+ throw createError({
15
+ statusCode: 400,
16
+ message: "Slug contains invalid characters or path traversal sequences"
17
+ });
12
18
  }
13
19
  if (trimmed.startsWith("/") || trimmed.endsWith("/") || trimmed.startsWith(".") || trimmed.endsWith(".")) {
14
20
  throw createError({ statusCode: 400, message: "Slug cannot start or end with slashes or dots" });
@@ -1,12 +1,6 @@
1
1
  import { createError } from "nuxt/server";
2
2
  import { resolveTableName } from "../table-names.mjs";
3
- import {
4
- getCMSDb,
5
- getCMSConfig,
6
- getCMSTenantId,
7
- cmsCollectionTbl,
8
- cmsEntryTbl
9
- } from "./common.mjs";
3
+ import { getCMSDb, getCMSConfig, getCMSTenantId, cmsCollectionTbl, cmsEntryTbl } from "./common.mjs";
10
4
  import { getCMSEntry } from "./queries.mjs";
11
5
  const userTbl = (e) => resolveTableName("user", e);
12
6
  export function isReferenceValue(v) {
@@ -8,8 +8,8 @@ export declare function registerEnsureCMSSynced(fn: (event: RequestEvent) => Pro
8
8
  */
9
9
  export declare function buildFtsQuery(query: string, operator?: "AND" | "OR"): string;
10
10
  /**
11
- * Rebuilds the FTS5 virtual table from current `cms_entry` records. Can be used after
12
- * schema migrations or to re-index all content.
11
+ * Rebuilds the FTS5 virtual table from current `cms_entry` records. Can be used after schema
12
+ * migrations or to re-index all content.
13
13
  */
14
14
  export declare function rebuildCMSFTS(event?: RequestEvent): Promise<{
15
15
  total: number;
@@ -9,6 +9,7 @@ Install it with: pnpm add yaml`
9
9
  }
10
10
  }
11
11
  import { getKVBinding } from "../../../kv.mjs";
12
+ import { resolveReferenceFieldsFromFrontmatter } from "../cms.mjs";
12
13
  import { resolveIndexName } from "../table-names.mjs";
13
14
  import {
14
15
  getCMSDb,
@@ -36,7 +37,6 @@ import {
36
37
  extractTOC
37
38
  } from "./path.mjs";
38
39
  import { registerEnsureCMSSynced } from "./search.mjs";
39
- import { resolveReferenceFieldsFromFrontmatter } from "../cms.mjs";
40
40
  let ensureCMSTablesPromise = null;
41
41
  export async function ensureCMSTables(event) {
42
42
  const db = getCMSDb(event);
@@ -768,7 +768,9 @@ export async function syncLocalContentFiles(event, contentDir, collectionsConfig
768
768
  now
769
769
  ).run();
770
770
  } else if (folderSchema?.fields && existingCol.schema_json !== initialFields && existingCol.source === "file") {
771
- await db.prepare(`UPDATE ${cmsCollectionTbl(event)} SET schema_json = ?, updated_at = ? WHERE id = ?`).bind(initialFields, now, collectionId).run();
771
+ await db.prepare(
772
+ `UPDATE ${cmsCollectionTbl(event)} SET schema_json = ?, updated_at = ? WHERE id = ?`
773
+ ).bind(initialFields, now, collectionId).run();
772
774
  }
773
775
  if (meta.isSingleDataFile) {
774
776
  const filePath = meta.directory;
@@ -42,8 +42,8 @@ export declare function deleteCMSCategory(event: RequestEvent, id: string): Prom
42
42
  deletedId: string;
43
43
  }>;
44
44
  /**
45
- * Synchronizes tags into the `cms_tag` table and updates usage count. Handles addition,
46
- * updates, or removal of tags on an entry.
45
+ * Synchronizes tags into the `cms_tag` table and updates usage count. Handles addition, updates, or
46
+ * removal of tags on an entry.
47
47
  */
48
48
  export declare function syncCMSEntryTags(event: RequestEvent, oldTagsString?: string | null, newTagsString?: string | null): Promise<void>;
49
49
  export declare function queryCMSTags(event?: RequestEvent): Promise<any>;
@@ -12,4 +12,4 @@ export { formatEntryAsMarkdown, projectCMSEntry, rowToEntry, queryCMSEntries, ge
12
12
  export { getCollectionFields, defineCMSComponent, resolveReference, resolveReferenceFieldsFromFrontmatter, } from "./cms/references";
13
13
  export { invalidateCMSEntryCache } from "./cms/cache";
14
14
  export { createCMSEntry, updateCMSEntry, deleteCMSEntry, publishCMSEntry, publishDueScheduledEntries, submitCMSEntryForReview, rejectCMSEntryReview, } from "./cms/mutations";
15
- export { pruneRevisions, listCMSRevisions, restoreCMSRevision, } from "./cms/revisions";
15
+ export { pruneRevisions, listCMSRevisions, restoreCMSRevision } from "./cms/revisions";
@@ -31,8 +31,4 @@ export {
31
31
  submitCMSEntryForReview,
32
32
  rejectCMSEntryReview
33
33
  } from "./cms/mutations.mjs";
34
- export {
35
- pruneRevisions,
36
- listCMSRevisions,
37
- restoreCMSRevision
38
- } from "./cms/revisions.mjs";
34
+ export { pruneRevisions, listCMSRevisions, restoreCMSRevision } from "./cms/revisions.mjs";
@@ -2,6 +2,7 @@
2
2
  * Comment content filter — blocks adult website links and banned keywords.
3
3
  *
4
4
  * Design decisions:
5
+ *
5
6
  * - O(1) Set<string> hash lookup for adult domain matching (no loop over list)
6
7
  * - Adult TLD regex catches millions of sites not in the explicit set
7
8
  * - Obfuscation normalization: handles [dot], (dot), [.], zero-width chars
@@ -27,19 +28,20 @@ export interface ModerationCheckResult {
27
28
  valid: boolean;
28
29
  violation?: ModerationViolation;
29
30
  }
30
- /**
31
- * Normalizes obfuscation and extracts all URLs + apex domains from the comment.
32
- */
31
+ /** Normalizes obfuscation and extracts all URLs + apex domains from the comment. */
33
32
  export declare function extractUrlsAndDomains(content: string): ExtractedContent;
34
33
  /**
35
- * Pure checker: inspects comment text against moderation rules and returns
36
- * a ModerationCheckResult without throwing.
34
+ * Pure checker: inspects comment text against moderation rules and returns a ModerationCheckResult
35
+ * without throwing.
37
36
  */
38
37
  export declare function checkCommentContent(content: string, cfg: CommentsModerationConfig): ModerationCheckResult;
39
38
  /**
40
39
  * Validates comment content against moderation rules.
41
- * - If action is "reject" (default) and a violation is found, throws createError({ statusCode: 400 }).
42
- * - If action is "quarantine" and a violation is found, returns { valid: false, violation } without throwing.
40
+ *
41
+ * - If action is "reject" (default) and a violation is found, throws createError({ statusCode: 400
42
+ * }).
43
+ * - If action is "quarantine" and a violation is found, returns { valid: false, violation } without
44
+ * throwing.
43
45
  * - If valid, returns { valid: true }.
44
46
  */
45
47
  export declare function validateCommentContent(content: string, cfg: CommentsModerationConfig): ModerationCheckResult;
@@ -75,32 +75,35 @@ export declare function getCommentsConfig(event?: RequestEvent): CommentsOptions
75
75
  prefix?: string;
76
76
  };
77
77
  /**
78
- * Extracts the integer sequence number from a materialized path segment.
79
- * Handles both hardened segments (e.g. "000005_x9y2" -> 5) and legacy 4-digit segments ("0004" -> 4).
78
+ * Extracts the integer sequence number from a materialized path segment. Handles both hardened
79
+ * segments (e.g. "000005_x9y2" -> 5) and legacy 4-digit segments ("0004" -> 4).
80
80
  */
81
81
  export declare function extractSegmentIndex(segment: string): number;
82
82
  /**
83
- * Builds a materialized path for a new comment.
84
- * Formats segments with 6-digit zero padding and a unique 4-character tiebreaker
85
- * (e.g. /000001_a1b2/) to guarantee collision-free subtree indexing even during concurrent posts.
83
+ * Builds a materialized path for a new comment. Formats segments with 6-digit zero padding and a
84
+ * unique 4-character tiebreaker (e.g. /000001_a1b2/) to guarantee collision-free subtree indexing
85
+ * even during concurrent posts.
86
86
  */
87
87
  export declare function buildPath(parentPath: string, siblingIndex: number): string;
88
88
  /**
89
- * Creates all three comments tables if they do not already exist.
90
- * Uses a module-level promise cache so the 10+ SQL statements only execute once
91
- * per Worker isolate — subsequent calls are free no-ops.
89
+ * Creates all three comments tables if they do not already exist. Uses a module-level promise cache
90
+ * so the 10+ SQL statements only execute once per Worker isolate — subsequent calls are free
91
+ * no-ops.
92
92
  */
93
93
  export declare function ensureCommentsTables(event?: RequestEvent): Promise<void>;
94
94
  /**
95
95
  * Fetches comments for a target URN. Supports flat or threaded (nested replies) output.
96
96
  *
97
97
  * @example
98
- * ```ts
99
- * const { comments, total } = await queryComments({
100
- * targetUrn: "urn:qarpeo:blog:hello-world",
101
- * threaded: true,
102
- * }, event)
103
- * ```
98
+ * ```ts
99
+ * const { comments, total } = await queryComments(
100
+ * {
101
+ * targetUrn: "urn:qarpeo:blog:hello-world",
102
+ * threaded: true,
103
+ * },
104
+ * event,
105
+ * )
106
+ * ```
104
107
  */
105
108
  export declare function queryComments(opts: QueryCommentsOptions, event?: RequestEvent): Promise<{
106
109
  comments: Comment[];
@@ -110,81 +113,91 @@ export declare function queryComments(opts: QueryCommentsOptions, event?: Reques
110
113
  * Fetches a single comment by ID.
111
114
  *
112
115
  * @example
113
- * ```ts
114
- * const comment = await getComment("cmt_123", event)
115
- * ```
116
+ * ```ts
117
+ * const comment = await getComment("cmt_123", event)
118
+ * ```
116
119
  */
117
120
  export declare function getComment(id: string, event?: RequestEvent): Promise<Comment | null>;
118
121
  /**
119
- * Creates a new comment with rate limiting, auth checks, length validation,
120
- * materialized path threading, and avatar generation.
122
+ * Creates a new comment with rate limiting, auth checks, length validation, materialized path
123
+ * threading, and avatar generation.
121
124
  *
122
125
  * @example
123
- * ```ts
124
- * const comment = await createComment({
125
- * targetUrn: "urn:qarpeo:blog:hello-world",
126
- * authorName: "Alice",
127
- * content: "Great post!",
128
- * }, event)
129
- * ```
126
+ * ```ts
127
+ * const comment = await createComment(
128
+ * {
129
+ * targetUrn: "urn:qarpeo:blog:hello-world",
130
+ * authorName: "Alice",
131
+ * content: "Great post!",
132
+ * },
133
+ * event,
134
+ * )
135
+ * ```
130
136
  */
131
137
  export declare function createComment(input: CreateCommentInput, event?: RequestEvent): Promise<Comment>;
132
138
  /**
133
139
  * Updates the moderation status of a comment (approved, spam, pending, deleted).
134
140
  *
135
141
  * @example
136
- * ```ts
137
- * const updated = await updateCommentStatus("cmt_123", "approved", event)
138
- * ```
142
+ * ```ts
143
+ * const updated = await updateCommentStatus("cmt_123", "approved", event)
144
+ * ```
139
145
  */
140
146
  export declare function updateCommentStatus(id: string, status: CommentStatus, event?: RequestEvent): Promise<Comment | null>;
141
147
  /**
142
- * Soft-deletes a comment, retaining tree structure.
143
- * Sets `deletedAt`, `status = "deleted"`, and clears PII fields.
144
- * Content is replaced with "[deleted]" at read time.
148
+ * Soft-deletes a comment, retaining tree structure. Sets `deletedAt`, `status = "deleted"`, and
149
+ * clears PII fields. Content is replaced with "[deleted]" at read time.
145
150
  *
146
151
  * @example
147
- * ```ts
148
- * await deleteComment("cmt_123", event)
149
- * ```
152
+ * ```ts
153
+ * await deleteComment("cmt_123", event)
154
+ * ```
150
155
  */
151
156
  export declare function deleteComment(id: string, event?: RequestEvent): Promise<void>;
152
157
  /**
153
- * Moderates multiple comments in a single operation.
154
- * Supports "approve", "spam", and "delete" actions.
158
+ * Moderates multiple comments in a single operation. Supports "approve", "spam", and "delete"
159
+ * actions.
155
160
  *
156
161
  * @example
157
- * ```ts
158
- * await batchModerateComments({
159
- * ids: ["cmt_1", "cmt_2"],
160
- * action: "approve",
161
- * }, event)
162
- * ```
162
+ * ```ts
163
+ * await batchModerateComments(
164
+ * {
165
+ * ids: ["cmt_1", "cmt_2"],
166
+ * action: "approve",
167
+ * },
168
+ * event,
169
+ * )
170
+ * ```
163
171
  */
164
172
  export declare function batchModerateComments(input: BatchModerateInput, event?: RequestEvent): Promise<BatchModerateResult>;
165
173
  /**
166
- * Submits a community report for a comment.
167
- * Auto-hides the comment when the report count exceeds the configured threshold.
174
+ * Submits a community report for a comment. Auto-hides the comment when the report count exceeds
175
+ * the configured threshold.
168
176
  *
169
177
  * @example
170
- * ```ts
171
- * await reportComment("cmt_123", "spam", { note: "Repeated advertising" }, event)
172
- * ```
178
+ * ```ts
179
+ * await reportComment("cmt_123", "spam", { note: "Repeated advertising" }, event)
180
+ * ```
173
181
  */
174
182
  export declare function reportComment(commentId: string, reason: ReportReason, opts?: {
175
183
  note?: string;
176
184
  userId?: string;
177
185
  }, event?: RequestEvent): Promise<CommentReport>;
178
186
  /**
179
- * Toggles a reaction on a comment (adds if not present, removes if already reacted).
180
- * Updates the `reaction_counts` JSON denormalisation on the comment row.
181
- *
182
- * @returns The updated reaction counts map.
187
+ * Toggles a reaction on a comment (adds if not present, removes if already reacted). Updates the
188
+ * `reaction_counts` JSON denormalisation on the comment row.
183
189
  *
184
190
  * @example
185
- * ```ts
186
- * const { added, reactionCounts } = await reactToComment("cmt_123", "👍", { userId: "u_1" }, event)
187
- * ```
191
+ * ```ts
192
+ * const { added, reactionCounts } = await reactToComment(
193
+ * "cmt_123",
194
+ * "👍",
195
+ * { userId: "u_1" },
196
+ * event,
197
+ * )
198
+ * ```
199
+ *
200
+ * @returns The updated reaction counts map.
188
201
  */
189
202
  export declare function reactToComment(commentId: string, reaction: string, opts?: {
190
203
  userId?: string;
@@ -1,15 +1,15 @@
1
1
  import { createError, getRequestHeader } from "nuxt/server";
2
2
  import { getCloudflareEnv } from "../../bindings.mjs";
3
+ import { validateCommentContent } from "./comments-filter.mjs";
3
4
  import { getQarpeoConfig } from "./config.mjs";
4
- import { assertRateLimit } from "./ratelimit.mjs";
5
- import { requireTurnstile } from "./turnstile.mjs";
6
5
  import { getAuthContext } from "./context.mjs";
7
6
  import { nanoid } from "./crypto.mjs";
8
- import { validateCommentContent } from "./comments-filter.mjs";
9
- import { validateTargetUrn } from "./urn.mjs";
10
- import { resolveTableName, resolveIndexName } from "./table-names.mjs";
7
+ import { assertRateLimit } from "./ratelimit.mjs";
11
8
  import { escapeHtml } from "./string.mjs";
9
+ import { resolveTableName, resolveIndexName } from "./table-names.mjs";
12
10
  import { getTenant } from "./tenant.mjs";
11
+ import { requireTurnstile } from "./turnstile.mjs";
12
+ import { validateTargetUrn } from "./urn.mjs";
13
13
  export { isValidTargetUrn, validateTargetUrn } from "./urn.mjs";
14
14
  function getD1(event) {
15
15
  const env = getCloudflareEnv(event);
@@ -391,7 +391,7 @@ export async function createComment(input, event) {
391
391
  }
392
392
  }
393
393
  }
394
- let commentMetadata = { ...input.metadata ?? {} };
394
+ let commentMetadata = { ...input.metadata };
395
395
  if (isQuarantined && moderationViolation) {
396
396
  status = "spam";
397
397
  commentMetadata = {
@@ -498,7 +498,9 @@ export async function batchModerateComments(input, event) {
498
498
  const t = getTable(event);
499
499
  const now = Date.now();
500
500
  const placeholders = cappedIds.map(() => "?").join(", ");
501
- await db.prepare(`UPDATE ${t} SET status = ?, updated_at = ? WHERE id IN (${placeholders})${tenantClause}`).bind(newStatus, now, ...cappedIds, ...tenantBinds).run();
501
+ await db.prepare(
502
+ `UPDATE ${t} SET status = ?, updated_at = ? WHERE id IN (${placeholders})${tenantClause}`
503
+ ).bind(newStatus, now, ...cappedIds, ...tenantBinds).run();
502
504
  return { success: true, count: cappedIds.length };
503
505
  }
504
506
  export async function reportComment(commentId, reason, opts, event) {
@@ -525,9 +527,19 @@ export async function reportComment(commentId, reason, opts, event) {
525
527
  `UPDATE ${getTable(event)} SET report_count = report_count + 1, updated_at = ? WHERE id = ? RETURNING report_count`
526
528
  ).bind(now, commentId).first();
527
529
  if ((updated?.report_count ?? 0) >= getAutoHideThreshold(event)) {
528
- await db.prepare(`UPDATE ${getTable(event)} SET status = 'spam', updated_at = ? WHERE id = ? AND status = 'approved'`).bind(now, commentId).run();
530
+ await db.prepare(
531
+ `UPDATE ${getTable(event)} SET status = 'spam', updated_at = ? WHERE id = ? AND status = 'approved'`
532
+ ).bind(now, commentId).run();
529
533
  }
530
- return { id, commentId, reporterIp: ip, reporterUserId: opts?.userId, reason, note: opts?.note, createdAt: now };
534
+ return {
535
+ id,
536
+ commentId,
537
+ reporterIp: ip,
538
+ reporterUserId: opts?.userId,
539
+ reason,
540
+ note: opts?.note,
541
+ createdAt: now
542
+ };
531
543
  }
532
544
  export async function reactToComment(commentId, reaction, opts, event) {
533
545
  const db = getD1(event);
@@ -25,7 +25,7 @@ export declare function getQarpeoConfig(event?: RequestEvent): QarpeoRuntimeConf
25
25
  /** Alias for getQarpeoConfig */
26
26
  export declare const useQarpeoConfig: typeof getQarpeoConfig;
27
27
  /**
28
- * Returns the application secret (NUXT_APP_SECRET) from runtime config or Cloudflare bindings.
29
- * Used for HMAC signing where we need a root secret key.
28
+ * Returns the application secret (NUXT_APP_SECRET) from runtime config or Cloudflare bindings. Used
29
+ * for HMAC signing where we need a root secret key.
30
30
  */
31
31
  export declare function getSessionSecret(event?: RequestEvent, fallback?: string): string;
@@ -1,13 +1,11 @@
1
1
  import { type RequestEvent } from "nuxt/server";
2
2
  import { type ResolvedPermissions } from "./rbac";
3
3
  /**
4
- * Enforces that the current request has `console:access`.
5
- * Throws 401 if unauthenticated, 403 if denied.
4
+ * Enforces that the current request has `console:access`. Throws 401 if unauthenticated, 403 if
5
+ * denied.
6
6
  */
7
7
  export declare function requireConsoleAccess(event: RequestEvent): Promise<ResolvedPermissions>;
8
- /**
9
- * Checks whether the current request has `console:access` without throwing.
10
- */
8
+ /** Checks whether the current request has `console:access` without throwing. */
11
9
  export declare function hasConsoleAccess(event: RequestEvent): Promise<boolean>;
12
10
  /**
13
11
  * Enforces `console:access` AND the specified module/action permission(s).
@@ -7,10 +7,10 @@ export declare function getQarpeoSession(event: RequestEvent): Promise<QarpeoSes
7
7
  * (qp_live_...) and cookie sessions. Returns null if unauthenticated (never throws).
8
8
  *
9
9
  * @example
10
- * ```ts
11
- * const auth = await getAuthContext(event)
12
- * if (auth) console.log("User:", auth.user.email, "IsAdmin:", auth.isAdmin)
13
- * ```
10
+ * ```ts
11
+ * const auth = await getAuthContext(event)
12
+ * if (auth) console.log("User:", auth.user.email, "IsAdmin:", auth.isAdmin)
13
+ * ```
14
14
  */
15
15
  export declare function getAuthContext(event: RequestEvent): Promise<QarpeoAuthContext | null>;
16
16
  /**
@@ -18,11 +18,11 @@ export declare function getAuthContext(event: RequestEvent): Promise<QarpeoAuthC
18
18
  * gates, and organization gates. Throws 401 or 403 on failure.
19
19
  *
20
20
  * @example
21
- * ```ts
22
- * export default defineEventHandler(async (event) => {
23
- * const { user, isAdmin } = await requireAuth(event, { role: "admin" })
24
- * return { message: `Hello ${user.name}` }
25
- * })
26
- * ```
21
+ * ```ts
22
+ * export default defineEventHandler(async (event) => {
23
+ * const { user, isAdmin } = await requireAuth(event, { role: "admin" })
24
+ * return { message: `Hello ${user.name}` }
25
+ * })
26
+ * ```
27
27
  */
28
28
  export declare function requireAuth(event: RequestEvent, options?: RequireAuthOptions): Promise<QarpeoAuthContext>;
@@ -7,9 +7,9 @@ import type { RequestEvent } from "nuxt/server";
7
7
  * in naive implementations that return early on `a.length !== b.length`.
8
8
  *
9
9
  * @example
10
- * ```ts
11
- * const valid = timingSafeEqualString(sigA, sigB)
12
- * ```
10
+ * ```ts
11
+ * const valid = timingSafeEqualString(sigA, sigB)
12
+ * ```
13
13
  */
14
14
  export declare function timingSafeEqualString(a: string, b: string): boolean;
15
15
  /** Alias for timingSafeEqualString */
@@ -18,9 +18,9 @@ export declare const constantTimeEqual: typeof timingSafeEqualString;
18
18
  * Generates a cryptographically secure URL-friendly unique identifier using Web Crypto.
19
19
  *
20
20
  * @example
21
- * ```ts
22
- * const id = nanoid() // "V1StGXR8_Z5jdHi6B-myT"
23
- * ```
21
+ * ```ts
22
+ * const id = nanoid() // "V1StGXR8_Z5jdHi6B-myT"
23
+ * ```
24
24
  */
25
25
  export declare function nanoid(size?: number): string;
26
26
  /**
@@ -28,9 +28,9 @@ export declare function nanoid(size?: number): string;
28
28
  * value is prefixed with `enc:` followed by the hex-encoded `iv ‖ ciphertext`.
29
29
  *
30
30
  * @example
31
- * ```ts
32
- * const ciphertext = await encryptToken(accessToken, event)
33
- * ```
31
+ * ```ts
32
+ * const ciphertext = await encryptToken(accessToken, event)
33
+ * ```
34
34
  */
35
35
  export declare function encryptToken(plaintext: string, event?: RequestEvent): Promise<string>;
36
36
  /**
@@ -38,27 +38,27 @@ export declare function encryptToken(plaintext: string, event?: RequestEvent): P
38
38
  * returned as-is. Decryption failures resolve to an empty string.
39
39
  *
40
40
  * @example
41
- * ```ts
42
- * const plaintext = await decryptToken(ciphertext, event)
43
- * ```
41
+ * ```ts
42
+ * const plaintext = await decryptToken(ciphertext, event)
43
+ * ```
44
44
  */
45
45
  export declare function decryptToken(ciphertext: string, event?: RequestEvent): Promise<string>;
46
46
  /**
47
- * Computes an HMAC-SHA256 hex signature using standard Web Crypto.
48
- * Used for tamper-proof download URLs, signed query parameters, and webhooks.
47
+ * Computes an HMAC-SHA256 hex signature using standard Web Crypto. Used for tamper-proof download
48
+ * URLs, signed query parameters, and webhooks.
49
49
  *
50
50
  * @example
51
- * ```ts
52
- * const signature = await signHmacSha256("payload-data", event)
53
- * ```
51
+ * ```ts
52
+ * const signature = await signHmacSha256("payload-data", event)
53
+ * ```
54
54
  */
55
55
  export declare function signHmacSha256(data: string, secretOrEvent?: string | RequestEvent): Promise<string>;
56
56
  /**
57
57
  * Verifies an HMAC-SHA256 hex signature in constant time.
58
58
  *
59
59
  * @example
60
- * ```ts
61
- * const isValid = await verifyHmacSha256("payload-data", signature, event)
62
- * ```
60
+ * ```ts
61
+ * const isValid = await verifyHmacSha256("payload-data", signature, event)
62
+ * ```
63
63
  */
64
64
  export declare function verifyHmacSha256(data: string, signature: string, secretOrEvent?: string | RequestEvent): Promise<boolean>;
@@ -255,7 +255,9 @@ export async function getCustomDomain(rawDomain, event) {
255
255
  try {
256
256
  const db = event?.context?.db;
257
257
  if (db) {
258
- const rows = await db.all(`SELECT * FROM ${domainTbl(event)} WHERE domain = ? LIMIT 1`, [domain]);
258
+ const rows = await db.all(`SELECT * FROM ${domainTbl(event)} WHERE domain = ? LIMIT 1`, [
259
+ domain
260
+ ]);
259
261
  if (rows?.[0]) {
260
262
  const row = rows[0];
261
263
  const rec = {
@@ -7,20 +7,16 @@ export interface UseDrizzleOptions<S extends Record<string, unknown> = typeof _s
7
7
  event?: CFEvent;
8
8
  /**
9
9
  * Route reads to Cloudflare D1 Read Replicas:
10
+ *
10
11
  * - `true`: routes to nearest replica using "first-unconstrained" session
11
12
  * - `"first-unconstrained"`: reads from nearest replica immediately
12
13
  * - `"first-primary"`: first query routed to primary, subsequent reads routed to replica
13
14
  * - `string`: bookmark token string to guarantee sequential consistency
14
15
  */
15
16
  replica?: boolean | "first-unconstrained" | "first-primary" | string;
16
- /**
17
- * Optional Cloudflare D1 session bookmark token.
18
- */
17
+ /** Optional Cloudflare D1 session bookmark token. */
19
18
  bookmark?: string;
20
- /**
21
- * Automatically fallback to primary database if replica read fails.
22
- * Default: `true`.
23
- */
19
+ /** Automatically fallback to primary database if replica read fails. Default: `true`. */
24
20
  fallbackToPrimary?: boolean;
25
21
  }
26
22
  /** Access a typed Drizzle ORM client connected to Cloudflare D1 or PostgreSQL. */
@@ -29,24 +25,24 @@ export declare function useDrizzle<S extends Record<string, unknown> = typeof _s
29
25
  * Primary typed database accessor for Cloudflare D1 or PostgreSQL.
30
26
  *
31
27
  * @example
32
- * ```ts
33
- * // Default primary D1 database
34
- * const db = useDb()
35
- * const users = await db.query.users.findMany()
28
+ * ```ts
29
+ * // Default primary D1 database
30
+ * const db = useDb()
31
+ * const users = await db.query.users.findMany()
36
32
  *
37
- * // Secondary D1 database (e.g. db/d1-analytics/ or ANALYTICS_DB)
38
- * const analytics = useDb("analytics")
33
+ * // Secondary D1 database (e.g. db/d1-analytics/ or ANALYTICS_DB)
34
+ * const analytics = useDb("analytics")
39
35
  *
40
- * // Cloudflare D1 Read Replica routing (reads route to replica, writes route to primary)
41
- * const readDb = useDb({ replica: true })
42
- * const users = await readDb.query.users.findMany()
36
+ * // Cloudflare D1 Read Replica routing (reads route to replica, writes route to primary)
37
+ * const readDb = useDb({ replica: true })
38
+ * const users = await readDb.query.users.findMany()
43
39
  *
44
- * // Named database with read replica and sequential consistency bookmark
45
- * const analyticsReplica = useDb("analytics", { replica: true, bookmark: "bm_123" })
40
+ * // Named database with read replica and sequential consistency bookmark
41
+ * const analyticsReplica = useDb("analytics", { replica: true, bookmark: "bm_123" })
46
42
  *
47
- * // PostgreSQL via Hyperdrive
48
- * const warehouse = useDb("postgres")
49
- * ```
43
+ * // PostgreSQL via Hyperdrive
44
+ * const warehouse = useDb("postgres")
45
+ * ```
50
46
  */
51
47
  export declare function useDb<S extends Record<string, unknown> = typeof _schema>(options?: UseDrizzleOptions<S>): QarpeoDrizzleDB<InferDrizzleRelations<S>>;
52
48
  export declare function useDb<S extends Record<string, unknown> = typeof _schema>(bindingName?: string, eventOrOptions?: CFEvent | UseDrizzleOptions<S>): QarpeoDrizzleDB<InferDrizzleRelations<S>>;
@@ -58,10 +54,13 @@ export declare const d1Db: QarpeoDrizzleDB<import("drizzle-orm").ExtractTablesWi
58
54
  * Creates a lazily-evaluated Proxy around a named database binding.
59
55
  *
60
56
  * @example
61
- * ```ts
62
- * export const d1AnalyticsDb = createDbProxy("analytics")
63
- * ```
57
+ * ```ts
58
+ * export const d1AnalyticsDb = createDbProxy("analytics")
59
+ * ```
64
60
  */
65
61
  export declare function createDbProxy(name?: string): QarpeoDrizzleDB<SchemaRelations>;
66
- /** All exported tables, views, and relations from your schema (e.g. `db/d1/schema/` or `db/schema.ts`). */
62
+ /**
63
+ * All exported tables, views, and relations from your schema (e.g. `db/d1/schema/` or
64
+ * `db/schema.ts`).
65
+ */
67
66
  export declare const schema: typeof _schema;