qarpeo 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (260) hide show
  1. package/dist/chunks/tools.mjs +993 -31
  2. package/dist/cli/index.mjs +1102 -31
  3. package/dist/fate/index.d.ts +9 -1
  4. package/dist/fate/index.mjs +20 -3
  5. package/dist/module.mjs +296 -753
  6. package/dist/runtime/browser.mjs +2 -2
  7. package/dist/runtime/comments-server.d.ts +3 -0
  8. package/dist/runtime/comments-server.mjs +2 -0
  9. package/dist/runtime/comments.d.ts +0 -2
  10. package/dist/runtime/comments.mjs +0 -2
  11. package/dist/runtime/db.d.ts +10 -9
  12. package/dist/runtime/db.mjs +79 -8
  13. package/dist/runtime/drizzle.mjs +21 -6
  14. package/dist/runtime/index.d.ts +4 -0
  15. package/dist/runtime/realtime-server.d.ts +4 -0
  16. package/dist/runtime/realtime-server.mjs +13 -0
  17. package/dist/runtime/realtime.d.ts +1 -4
  18. package/dist/runtime/realtime.mjs +0 -13
  19. package/dist/runtime/replica.d.ts +27 -0
  20. package/dist/runtime/replica.mjs +229 -0
  21. package/dist/runtime/server/durable-objects/agent.mjs +14 -2
  22. package/dist/runtime/server/durable-objects/room.d.ts +10 -0
  23. package/dist/runtime/server/durable-objects/room.mjs +119 -28
  24. package/dist/runtime/server/middleware/devtools.mjs +1 -1
  25. package/dist/runtime/server/middleware/tenancy.mjs +7 -4
  26. package/dist/runtime/server/plugins/store.mjs +1 -1
  27. package/dist/runtime/server/routes/__qarpeo/mail/track/click/[id].get.mjs +57 -17
  28. package/dist/runtime/server/routes/agents/[agent]/chat.post.mjs +19 -12
  29. package/dist/runtime/server/routes/agents/[agent]/clear.post.mjs +8 -9
  30. package/dist/runtime/server/routes/agents/[agent]/history.get.mjs +8 -9
  31. package/dist/runtime/server/routes/analytics/events.get.mjs +12 -2
  32. package/dist/runtime/server/routes/analytics/pageviews.get.mjs +10 -1
  33. package/dist/runtime/server/routes/analytics/summary.get.mjs +10 -1
  34. package/dist/runtime/server/routes/auth/2fa/disable.post.mjs +11 -2
  35. package/dist/runtime/server/routes/auth/2fa/setup.post.mjs +7 -0
  36. package/dist/runtime/server/routes/auth/2fa/verify.post.mjs +11 -2
  37. package/dist/runtime/server/routes/auth/account.delete.mjs +7 -0
  38. package/dist/runtime/server/routes/auth/magic-link/verify.get.mjs +5 -3
  39. package/dist/runtime/server/routes/auth/organization/sso/index.post.mjs +10 -0
  40. package/dist/runtime/server/routes/auth/otp/verify.post.mjs +5 -3
  41. package/dist/runtime/server/routes/auth/sso/saml/acs.post.mjs +18 -0
  42. package/dist/runtime/server/routes/auth/webauthn/login/options.post.d.ts +1 -1
  43. package/dist/runtime/server/routes/auth/webauthn/login/options.post.mjs +11 -2
  44. package/dist/runtime/server/routes/auth/webauthn/login/verify.post.mjs +10 -1
  45. package/dist/runtime/server/routes/auth/webauthn/register/options.post.d.ts +1 -1
  46. package/dist/runtime/server/routes/auth/webauthn/register/options.post.mjs +10 -1
  47. package/dist/runtime/server/routes/auth/webauthn/register/verify.post.mjs +10 -1
  48. package/dist/runtime/server/routes/browser/crawl.post.mjs +13 -0
  49. package/dist/runtime/server/routes/browser/invoice.post.mjs +15 -1
  50. package/dist/runtime/server/routes/browser/og-image.post.mjs +13 -0
  51. package/dist/runtime/server/routes/browser/pdf.post.mjs +15 -1
  52. package/dist/runtime/server/routes/browser/screenshot.post.mjs +13 -0
  53. package/dist/runtime/server/routes/cms/[collection]/[id]/preview-token.post.mjs +23 -8
  54. package/dist/runtime/server/routes/cms/[collection]/[id]/publish.post.mjs +2 -1
  55. package/dist/runtime/server/routes/cms/[collection]/[id]/review.post.mjs +2 -1
  56. package/dist/runtime/server/routes/cms/[collection]/[id]/revisions/[revId]/restore.post.mjs +2 -1
  57. package/dist/runtime/server/routes/cms/[collection]/[id].delete.mjs +2 -1
  58. package/dist/runtime/server/routes/cms/[collection]/[id].put.mjs +2 -1
  59. package/dist/runtime/server/routes/cms/[collection]/index.post.mjs +2 -1
  60. package/dist/runtime/server/routes/cms/categories/[id].delete.mjs +2 -1
  61. package/dist/runtime/server/routes/cms/categories/[id].put.mjs +2 -1
  62. package/dist/runtime/server/routes/cms/categories.post.mjs +2 -1
  63. package/dist/runtime/server/routes/cms/collections/[id].delete.mjs +2 -1
  64. package/dist/runtime/server/routes/cms/collections/[id].put.mjs +2 -1
  65. package/dist/runtime/server/routes/cms/collections/index.post.mjs +2 -1
  66. package/dist/runtime/server/routes/cms/export.post.mjs +1 -1
  67. package/dist/runtime/server/routes/cms/subscribers/[id].delete.mjs +2 -1
  68. package/dist/runtime/server/routes/cms/subscribers/[id].patch.mjs +2 -1
  69. package/dist/runtime/server/routes/cms/tags/[id].delete.mjs +2 -1
  70. package/dist/runtime/server/routes/cms/tags.post.mjs +2 -1
  71. package/dist/runtime/server/routes/comments/[id]/react.post.mjs +7 -3
  72. package/dist/runtime/server/routes/comments/[id]/report.post.mjs +3 -0
  73. package/dist/runtime/server/routes/comments/[id].delete.mjs +1 -1
  74. package/dist/runtime/server/routes/comments/[id].get.mjs +13 -0
  75. package/dist/runtime/server/routes/comments/[id].patch.mjs +1 -1
  76. package/dist/runtime/server/routes/fate.d.ts +6 -0
  77. package/dist/runtime/server/routes/fate.mjs +32 -3
  78. package/dist/runtime/server/routes/mail/bounce.post.mjs +14 -2
  79. package/dist/runtime/server/routes/mail/unsubscribe.mjs +2 -1
  80. package/dist/runtime/server/routes/mail/webhooks.post.mjs +18 -4
  81. package/dist/runtime/server/routes/notifications/[id].get.mjs +3 -4
  82. package/dist/runtime/server/routes/notifications/index.get.mjs +4 -2
  83. package/dist/runtime/server/routes/notifications/push/subscribe.post.mjs +3 -1
  84. package/dist/runtime/server/routes/notifications/push/unsubscribe.post.mjs +5 -3
  85. package/dist/runtime/server/routes/notifications/read-all.post.mjs +6 -2
  86. package/dist/runtime/server/routes/notifications/send.post.mjs +13 -2
  87. package/dist/runtime/server/routes/payments/cancel.post.mjs +1 -1
  88. package/dist/runtime/server/routes/payments/change-plan.post.mjs +1 -1
  89. package/dist/runtime/server/routes/payments/checkout.post.mjs +1 -1
  90. package/dist/runtime/server/routes/payments/pause.post.mjs +1 -1
  91. package/dist/runtime/server/routes/payments/portal.post.mjs +1 -1
  92. package/dist/runtime/server/routes/payments/subscription.get.mjs +1 -1
  93. package/dist/runtime/server/routes/payments/usage.get.mjs +1 -1
  94. package/dist/runtime/server/routes/payments/usage.post.mjs +1 -1
  95. package/dist/runtime/server/routes/payments/webhook.post.mjs +8 -1
  96. package/dist/runtime/server/routes/realtime/broadcast.post.mjs +3 -2
  97. package/dist/runtime/server/routes/realtime/history.delete.mjs +2 -2
  98. package/dist/runtime/server/routes/realtime/history.get.mjs +2 -2
  99. package/dist/runtime/server/routes/realtime/presence.get.mjs +3 -3
  100. package/dist/runtime/server/routes/realtime/state.get.mjs +3 -3
  101. package/dist/runtime/server/routes/realtime/state.post.mjs +13 -4
  102. package/dist/runtime/server/routes/realtime/ws.get.mjs +2 -2
  103. package/dist/runtime/server/routes/storage/file/[...key].delete.mjs +1 -1
  104. package/dist/runtime/server/routes/storage/file/[...key].get.mjs +7 -0
  105. package/dist/runtime/server/routes/storage/files.get.d.ts +1 -1
  106. package/dist/runtime/server/routes/storage/files.get.mjs +24 -4
  107. package/dist/runtime/server/routes/storage/multipart/abort.post.mjs +16 -1
  108. package/dist/runtime/server/routes/storage/multipart/complete.post.d.ts +1 -1
  109. package/dist/runtime/server/routes/storage/multipart/complete.post.mjs +15 -1
  110. package/dist/runtime/server/routes/storage/multipart/create.post.mjs +7 -0
  111. package/dist/runtime/server/routes/storage/multipart/part.put.mjs +15 -1
  112. package/dist/runtime/server/routes/storage/presigned-r2.post.mjs +8 -1
  113. package/dist/runtime/server/routes/storage/presigned.post.d.ts +1 -1
  114. package/dist/runtime/server/routes/storage/presigned.post.mjs +8 -1
  115. package/dist/runtime/server/routes/storage/sign.post.mjs +7 -0
  116. package/dist/runtime/server/routes/storage/upload.post.d.ts +2 -2
  117. package/dist/runtime/server/routes/store/cart/index.delete.mjs +3 -4
  118. package/dist/runtime/server/routes/store/cart/index.get.mjs +3 -10
  119. package/dist/runtime/server/routes/store/cart/items/[id].delete.mjs +6 -4
  120. package/dist/runtime/server/routes/store/cart/items/[id].patch.mjs +12 -4
  121. package/dist/runtime/server/routes/store/cart/items.post.mjs +9 -10
  122. package/dist/runtime/server/routes/store/categories/index.get.mjs +4 -2
  123. package/dist/runtime/server/routes/store/checkout.post.mjs +13 -3
  124. package/dist/runtime/server/routes/store/coupons/apply.post.mjs +6 -5
  125. package/dist/runtime/server/routes/store/orders/[id].get.mjs +2 -2
  126. package/dist/runtime/server/routes/store/orders/download/[token].get.mjs +6 -3
  127. package/dist/runtime/server/routes/store/orders/index.get.mjs +1 -1
  128. package/dist/runtime/server/routes/store/products/[slug].get.mjs +2 -2
  129. package/dist/runtime/server/routes/store/products/index.get.mjs +1 -1
  130. package/dist/runtime/server/routes/store/tax/calculate.post.mjs +10 -0
  131. package/dist/runtime/server/routes/tenants/[tenant]/domains/[domain]/index.delete.mjs +26 -25
  132. package/dist/runtime/server/routes/tenants/[tenant]/domains/[domain]/verify.post.mjs +26 -25
  133. package/dist/runtime/server/utils/ai.d.ts +6 -0
  134. package/dist/runtime/server/utils/ai.mjs +12 -2
  135. package/dist/runtime/server/utils/analytics-query.mjs +8 -4
  136. package/dist/runtime/server/utils/browser-utils.d.ts +9 -0
  137. package/dist/runtime/server/utils/browser-utils.mjs +135 -0
  138. package/dist/runtime/server/utils/cms/cache.d.ts +13 -0
  139. package/dist/runtime/server/utils/cms/cache.mjs +95 -0
  140. package/dist/runtime/server/utils/cms/common.mjs +1 -1
  141. package/dist/runtime/server/utils/cms/markdown.mjs +38 -8
  142. package/dist/runtime/server/utils/cms/mutations.d.ts +26 -0
  143. package/dist/runtime/server/utils/cms/mutations.mjs +569 -0
  144. package/dist/runtime/server/utils/cms/path.d.ts +8 -0
  145. package/dist/runtime/server/utils/cms/path.mjs +23 -0
  146. package/dist/runtime/server/utils/cms/queries.d.ts +27 -0
  147. package/dist/runtime/server/utils/cms/queries.mjs +366 -0
  148. package/dist/runtime/server/utils/cms/references.d.ts +48 -0
  149. package/dist/runtime/server/utils/cms/references.mjs +309 -0
  150. package/dist/runtime/server/utils/cms/revisions.d.ts +7 -0
  151. package/dist/runtime/server/utils/cms/revisions.mjs +60 -0
  152. package/dist/runtime/server/utils/cms/sync.mjs +3 -3
  153. package/dist/runtime/server/utils/cms.d.ts +5 -82
  154. package/dist/runtime/server/utils/cms.mjs +28 -1367
  155. package/dist/runtime/server/utils/comments.d.ts +11 -0
  156. package/dist/runtime/server/utils/comments.mjs +65 -17
  157. package/dist/runtime/server/utils/crypto.mjs +1 -1
  158. package/dist/runtime/server/utils/domains.mjs +9 -0
  159. package/dist/runtime/server/utils/drizzle.d.ts +26 -1
  160. package/dist/runtime/server/utils/drizzle.mjs +78 -19
  161. package/dist/runtime/server/utils/email-inbound.mjs +9 -1
  162. package/dist/runtime/server/utils/impersonation.mjs +58 -1
  163. package/dist/runtime/server/utils/lock.d.ts +11 -0
  164. package/dist/runtime/server/utils/lock.mjs +4 -0
  165. package/dist/runtime/server/utils/mail-suppression.mjs +48 -13
  166. package/dist/runtime/server/utils/mail.d.ts +2 -1
  167. package/dist/runtime/server/utils/mail.mjs +17 -11
  168. package/dist/runtime/server/utils/notifications.d.ts +13 -4
  169. package/dist/runtime/server/utils/notifications.mjs +20 -4
  170. package/dist/runtime/server/utils/organization.mjs +36 -1
  171. package/dist/runtime/server/utils/passwordless.mjs +8 -0
  172. package/dist/runtime/server/utils/payments/checkout.d.ts +34 -0
  173. package/dist/runtime/server/utils/payments/checkout.mjs +158 -0
  174. package/dist/runtime/server/utils/payments/common.d.ts +45 -0
  175. package/dist/runtime/server/utils/payments/common.mjs +234 -0
  176. package/dist/runtime/server/utils/payments/index.d.ts +9 -0
  177. package/dist/runtime/server/utils/payments/index.mjs +21 -0
  178. package/dist/runtime/server/utils/payments/lemonsqueezy.d.ts +7 -0
  179. package/dist/runtime/server/utils/payments/lemonsqueezy.mjs +55 -0
  180. package/dist/runtime/server/utils/payments/paddle.d.ts +7 -0
  181. package/dist/runtime/server/utils/payments/paddle.mjs +92 -0
  182. package/dist/runtime/server/utils/payments/polar.d.ts +11 -0
  183. package/dist/runtime/server/utils/payments/polar.mjs +66 -0
  184. package/dist/runtime/server/utils/payments/stripe.d.ts +7 -0
  185. package/dist/runtime/server/utils/payments/stripe.mjs +159 -0
  186. package/dist/runtime/server/utils/payments/subscriptions.d.ts +89 -0
  187. package/dist/runtime/server/utils/payments/subscriptions.mjs +236 -0
  188. package/dist/runtime/server/utils/payments/usage.d.ts +12 -0
  189. package/dist/runtime/server/utils/payments/usage.mjs +143 -0
  190. package/dist/runtime/server/utils/payments/webhooks.d.ts +10 -0
  191. package/dist/runtime/server/utils/payments/webhooks.mjs +200 -0
  192. package/dist/runtime/server/utils/payments.d.ts +1 -158
  193. package/dist/runtime/server/utils/payments.mjs +1 -1289
  194. package/dist/runtime/server/utils/queue.d.ts +2 -0
  195. package/dist/runtime/server/utils/queue.mjs +34 -21
  196. package/dist/runtime/server/utils/rag.mjs +30 -17
  197. package/dist/runtime/server/utils/realtime.d.ts +5 -1
  198. package/dist/runtime/server/utils/realtime.mjs +43 -7
  199. package/dist/runtime/server/utils/session.mjs +16 -3
  200. package/dist/runtime/server/utils/sso.d.ts +3 -0
  201. package/dist/runtime/server/utils/sso.mjs +43 -0
  202. package/dist/runtime/server/utils/storage.mjs +12 -1
  203. package/dist/runtime/server/utils/store/cart.d.ts +63 -0
  204. package/dist/runtime/server/utils/store/cart.mjs +542 -0
  205. package/dist/runtime/server/utils/store/checkout.d.ts +14 -0
  206. package/dist/runtime/server/utils/store/checkout.mjs +118 -0
  207. package/dist/runtime/server/utils/store/common.d.ts +29 -0
  208. package/dist/runtime/server/utils/store/common.mjs +479 -0
  209. package/dist/runtime/server/utils/store/index.d.ts +7 -0
  210. package/dist/runtime/server/utils/store/index.mjs +30 -0
  211. package/dist/runtime/server/utils/store/inventory.d.ts +25 -0
  212. package/dist/runtime/server/utils/store/inventory.mjs +190 -0
  213. package/dist/runtime/server/utils/store/orders.d.ts +60 -0
  214. package/dist/runtime/server/utils/store/orders.mjs +590 -0
  215. package/dist/runtime/server/utils/store/products.d.ts +35 -0
  216. package/dist/runtime/server/utils/store/products.mjs +461 -0
  217. package/dist/runtime/server/utils/store/vendor.d.ts +18 -0
  218. package/dist/runtime/server/utils/store/vendor.mjs +68 -0
  219. package/dist/runtime/server/utils/store.d.ts +1 -207
  220. package/dist/runtime/server/utils/store.mjs +1 -2227
  221. package/dist/runtime/server/utils/string.d.ts +1 -1
  222. package/dist/runtime/server/utils/string.mjs +12 -4
  223. package/dist/runtime/server/utils/tenant.mjs +19 -5
  224. package/dist/runtime/server/utils/tracker.mjs +2 -0
  225. package/dist/runtime/server.d.ts +3 -3
  226. package/dist/runtime/server.mjs +4 -4
  227. package/dist/runtime/storage-server.d.ts +2 -0
  228. package/dist/runtime/storage-server.mjs +1 -0
  229. package/dist/runtime/storage.d.ts +1 -1
  230. package/dist/runtime/storage.mjs +0 -1
  231. package/dist/runtime/store.d.ts +0 -1
  232. package/dist/runtime/store.mjs +0 -1
  233. package/dist/runtime/test-utils.d.ts +4 -0
  234. package/dist/runtime/test-utils.mjs +54 -0
  235. package/dist/runtime/types/d1.d.ts +43 -0
  236. package/dist/runtime/types/drizzle.d.ts +6 -0
  237. package/dist/runtime/types/store.d.ts +1 -1
  238. package/dist/types/analytics.d.ts +80 -0
  239. package/dist/types/auth.d.ts +282 -0
  240. package/dist/types/cache.d.ts +55 -0
  241. package/dist/types/comments.d.ts +130 -0
  242. package/dist/types/db.d.ts +29 -0
  243. package/dist/types/email.d.ts +182 -0
  244. package/dist/types/index.d.ts +22 -0
  245. package/dist/types/jobs.d.ts +58 -0
  246. package/dist/types/notifications.d.ts +77 -0
  247. package/dist/types/options.d.ts +363 -0
  248. package/dist/types/payments.d.ts +145 -0
  249. package/dist/types/ratelimit.d.ts +71 -0
  250. package/dist/types/realtime.d.ts +136 -0
  251. package/dist/types/site.d.ts +121 -0
  252. package/dist/types/storage.d.ts +164 -0
  253. package/dist/types/store-options.d.ts +199 -0
  254. package/dist/types/tenant.d.ts +100 -0
  255. package/dist/types.d.ts +1 -2174
  256. package/dist/utils/migration-lock.d.ts +139 -0
  257. package/dist/utils/pkg.d.ts +14 -1
  258. package/dist/utils/schema-diff.d.ts +39 -0
  259. package/package.json +55 -17
  260. package/dist/chunks/auth-schema.mjs +0 -364
@@ -0,0 +1,363 @@
1
+ import type { Nuxt } from "@nuxt/schema";
2
+ import type { WorkflowsOptions } from "../runtime/types/workflows";
3
+ import type { DurableObjectsOptions } from "../runtime/types/durable-object";
4
+ import type { AgentsOptions, BotsOptions, McpOptions } from "./ai";
5
+ import type { AnalyticsOptions } from "./analytics";
6
+ import type { AuthOptions, EmailOptions } from "./auth";
7
+ import type { CacheOptions } from "./cache";
8
+ import type { CMSOptions } from "./cms";
9
+ import type { CommentsOptions } from "./comments";
10
+ import type { DbOptions } from "./db";
11
+ import type { JobsOptions } from "./jobs";
12
+ import type { MailOptions } from "./email";
13
+ import type { MultitenantOptions } from "./tenant";
14
+ import type { NotificationsOptions } from "./notifications";
15
+ import type { PaymentsOptions } from "./payments";
16
+ import type { AppRateLimitOptions } from "./ratelimit";
17
+ import type { RealtimeOptions } from "./realtime";
18
+ import type { QarpeoSiteConfig } from "./site";
19
+ import type { BlobOptions } from "./storage";
20
+ import type { QarpeoTablesConfig, StoreOptions } from "./store-options";
21
+ /** Fate Relay-style data fetching options */
22
+ export interface FateOptions {
23
+ /**
24
+ * The route to mount the Fate batch handler on.
25
+ *
26
+ * @default "/fate"
27
+ */
28
+ endpoint?: string;
29
+ /**
30
+ * Directory (relative to project root) where `views.ts` is located.
31
+ *
32
+ * @default "server/fate"
33
+ */
34
+ viewsDir?: string;
35
+ /**
36
+ * Require an authenticated user session on the Fate endpoint.
37
+ * Set to `false` only if all mounted Fate views are intentionally public.
38
+ *
39
+ * @default true
40
+ */
41
+ auth?: boolean;
42
+ }
43
+ export interface QarpeoOptions {
44
+ /**
45
+ * Database table prefix for Qarpeo-managed tables (comments, payments, notifications, CMS, multi-tenancy, audit logs).
46
+ * - `false` or `""` (default): clean singular table names (`comment`, `customer`, `subscription`, `cms_entry`, `audit_log`)
47
+ * - `true`: standard `qarpeo_` prefix (`qarpeo_comment`, `qarpeo_customer`)
48
+ * - `string`: custom prefix e.g. `"q_"` (`q_comment`, `q_customer`)
49
+ *
50
+ * @default false
51
+ */
52
+ tablePrefix?: boolean | string;
53
+ /**
54
+ * Shorthand alias for `tablePrefix`.
55
+ *
56
+ * @default false
57
+ */
58
+ prefix?: boolean | string;
59
+ /**
60
+ * Granular table name overrides. Takes precedence over `tablePrefix`.
61
+ *
62
+ * @example
63
+ * ```ts
64
+ * qarpeo: {
65
+ * tablePrefix: "q_",
66
+ * tables: {
67
+ * user: "profiles", // overrides to "profiles" instead of "q_user"
68
+ * }
69
+ * }
70
+ * ```
71
+ */
72
+ tables?: QarpeoTablesConfig;
73
+ /** Project & site metadata (name, url, SEO, branding) */
74
+ site?: QarpeoSiteConfig;
75
+ /** Native SEO engine configuration (alias for site config) */
76
+ seo?: boolean | QarpeoSiteConfig;
77
+ /**
78
+ * Cloudflare Worker service name override.
79
+ *
80
+ * By default, Qarpeo infers the worker name from `package.json` -> `name` (sanitized for
81
+ * Cloudflare).
82
+ *
83
+ * @example
84
+ * ;```ts
85
+ * qarpeo: {
86
+ * workerName: "my-edge-app",
87
+ * }
88
+ * ```
89
+ */
90
+ workerName?: string;
91
+ /** Project / Cloudflare Worker name override (alias for workerName) */
92
+ name?: string;
93
+ /**
94
+ * Use live Cloudflare remote bindings during `nuxt dev` instead of local Miniflare emulation.
95
+ *
96
+ * @default false
97
+ */
98
+ remote?: boolean;
99
+ /**
100
+ * Enable Cloudflare Workers AI integration for serverless LLMs, embeddings, and generative AI.
101
+ *
102
+ * @default false
103
+ */
104
+ ai?: boolean;
105
+ /**
106
+ * Enable Cloudflare Vectorize integration for vector embeddings and semantic search.
107
+ *
108
+ * @default false
109
+ */
110
+ vectorize?: boolean;
111
+ /**
112
+ * Enable Cloudflare Queues integration for asynchronous message queues and background jobs.
113
+ *
114
+ * @default false
115
+ */
116
+ queue?: boolean;
117
+ /**
118
+ * Enable Cloudflare Hyperdrive integration for pooled connections and query acceleration to
119
+ * external PostgreSQL databases.
120
+ *
121
+ * @default false
122
+ */
123
+ hyperdrive?: boolean;
124
+ /**
125
+ * Enable Cloudflare Browser Rendering integration for headless Chromium web scraping, PDF
126
+ * generation, and automated screenshots.
127
+ *
128
+ * @default false
129
+ */
130
+ browser?: boolean;
131
+ /**
132
+ * Enable Cloudflare Durable Objects binding for stateful, low-latency coordination, presence,
133
+ * and modern RPC methods.
134
+ *
135
+ * @default false
136
+ */
137
+ do?: boolean | DurableObjectsOptions;
138
+ /**
139
+ * Cloudflare Cron Triggers configuration.
140
+ *
141
+ * @default false
142
+ */
143
+ cron?: boolean | Record<string, string[]>;
144
+ /**
145
+ * Enable Cloudflare Send Email integration for transactional emails.
146
+ *
147
+ * @default false
148
+ */
149
+ email?: boolean | EmailOptions;
150
+ /**
151
+ * Direct Cloudflare D1 SQL database binding.
152
+ *
153
+ * @default false
154
+ */
155
+ d1?: boolean;
156
+ /**
157
+ * Direct Cloudflare R2 Blob storage binding.
158
+ *
159
+ * @default false
160
+ */
161
+ r2?: boolean;
162
+ /**
163
+ * Enable Edge Database powered by Drizzle ORM on Cloudflare D1 (Tier 2). Auto-imports `db`,
164
+ * `useDrizzle()`, `schema`, and all Drizzle helpers.
165
+ *
166
+ * - `autoMigrate`: Automatically apply unapplied D1 migrations on `nuxt dev` startup (default:
167
+ * true).
168
+ * - `migrateOnBuild`: Apply D1 migrations during `nuxt build`. Can be `true` (auto-detects remote
169
+ * in CI / local otherwise), `"local"`, or `"remote"`. Also controllable via
170
+ * `QARPEO_MIGRATE_ON_BUILD` env var (default: false).
171
+ *
172
+ * @default false
173
+ */
174
+ db?: boolean | DbOptions;
175
+ /**
176
+ * Enable Cloudflare Key-Value (KV) storage. Auto-imports `kv` across server routes and handlers.
177
+ *
178
+ * @default false
179
+ */
180
+ kv?: boolean;
181
+ /**
182
+ * Enable Edge Cache Layer powered by Cloudflare KV (Tier 2). Mounts Nitro's `cache` storage
183
+ * driver to Cloudflare KV in production. Enables SWR routeRules and `purgeCache()`.
184
+ *
185
+ * @default false
186
+ */
187
+ cache?: boolean | CacheOptions;
188
+ /**
189
+ * Enable Cloudflare Edge Authentication powered by Better Auth + D1 (Tier 2).
190
+ *
191
+ * @default false
192
+ */
193
+ auth?: boolean | AuthOptions;
194
+ /**
195
+ * Enable Edge Blob / File System Layer powered by Cloudflare R2 (Tier 2).
196
+ *
197
+ * @default false
198
+ */
199
+ blob?: boolean | BlobOptions;
200
+ /**
201
+ * Enable Hybrid Edge Content Management System powered by D1 + R2 + Auth (Tier 2).
202
+ *
203
+ * @default false
204
+ */
205
+ cms?: boolean | CMSOptions;
206
+ /**
207
+ * Enable Realtime Layer powered by Cloudflare Durable Objects + KV (Tier 2).
208
+ *
209
+ * @default false
210
+ */
211
+ realtime?: boolean | RealtimeOptions;
212
+ /**
213
+ * Enable Edge Payments Layer powered by Stripe, Lemon Squeezy, or Polar (Tier 2).
214
+ *
215
+ * @default false
216
+ */
217
+ payments?: boolean | PaymentsOptions;
218
+ /**
219
+ * Enable Background Jobs Layer powered by Cloudflare Queues (Tier 2). Auto-scans `server/jobs/`
220
+ * and exposes `defineJob()` and `dispatchJob()`.
221
+ *
222
+ * @default false
223
+ */
224
+ jobs?: boolean | JobsOptions;
225
+ /**
226
+ * Enable Cloudflare Workflows durable execution engine (Tier 2).
227
+ * Auto-scans `server/workflows/` and exposes `defineWorkflow()` and `useWorkflow()`.
228
+ *
229
+ * @default false
230
+ */
231
+ workflows?: boolean | WorkflowsOptions;
232
+ /**
233
+ * Enable Edge Rate Limiting powered by Cloudflare RateLimiter / KV (Tier 2). Exposes
234
+ * `assertRateLimit()`, `checkRateLimit()`, and per-route rate limiting.
235
+ *
236
+ * @default false
237
+ */
238
+ ratelimit?: boolean | AppRateLimitOptions;
239
+ /**
240
+ * Enable Stateful Edge Agents & AI Streaming Layer (Tier 2). Backed by Cloudflare Durable Objects
241
+ * (`QarpeoAgentDO`), Workers AI, and Vectorize. Exposes `defineAgent()`, `defineTool()`,
242
+ * `useChat()`, `streamText()`, and `useAgent()`.
243
+ *
244
+ * @default false
245
+ */
246
+ agents?: boolean | AgentsOptions;
247
+ /**
248
+ * Enable Edge Bots & Webhooks Suite. Auto-discovers bot webhook handlers in `server/bots/` or `server/bot/`,
249
+ * exposing them at `/api/bots/<name>`.
250
+ *
251
+ * @default false (auto-activates when files exist in `server/bots/` or `server/bot/`)
252
+ */
253
+ bots?: boolean | BotsOptions;
254
+ /**
255
+ * Enable Model Context Protocol (MCP) Edge Servers & Client.
256
+ * Auto-discovers MCP server definition files in `server/mcp/` or `server/mcp.ts`,
257
+ * exposing them at `/mcp` or `/mcp/<name>`.
258
+ *
259
+ * @default false (auto-activates when files exist in `server/mcp/` or `server/mcp.ts`)
260
+ */
261
+ mcp?: boolean | McpOptions;
262
+ /**
263
+ * Enable Transactional Email & Dev Mailbox Layer (Tier 2). Pre-built responsive HTML email
264
+ * templates, multi-provider delivery (Cloudflare, Resend, Postmark), and in-browser Dev Mailbox
265
+ * preview in development.
266
+ *
267
+ * @default false
268
+ */
269
+ mail?: boolean | MailOptions;
270
+ /**
271
+ * Enable Edge Analytics Dashboard (Tier 2). Privacy-first structured pageview tracking, custom
272
+ * business events, and a pre-built dashboard API backed by Cloudflare Analytics Engine.
273
+ *
274
+ * @default false
275
+ */
276
+ analytics?: boolean | AnalyticsOptions;
277
+ /**
278
+ * Enable Multi-Tenancy & Custom Domains Layer (Tier 2). Subdomain routing, custom domains via
279
+ * Cloudflare for SaaS, automated SSL, edge tenant resolution (`useTenant()`), and tenant data
280
+ * isolation.
281
+ *
282
+ * @default false
283
+ */
284
+ multitenant?: boolean | MultitenantOptions;
285
+ /**
286
+ * Enable Notifications Layer (Tier 2). Unified in-app feeds, realtime UI push via Durable
287
+ * Objects, browser Web Push (VAPID via Web Crypto), and email alerts.
288
+ *
289
+ * @default false
290
+ */
291
+ notifications?: boolean | NotificationsOptions;
292
+ /** Shorthand alias for notifications */
293
+ notify?: boolean | NotificationsOptions;
294
+ /**
295
+ * Enable Fate Relay-style normalized data fetching.
296
+ *
297
+ * When `true`, qarpeo will:
298
+ *
299
+ * - Auto-install `@nkzw/fate` and `vue-fate`
300
+ * - Mount a `/fate` batch handler automatically
301
+ * - Add the Fate Vue plugin (SSR hydration included)
302
+ * - Auto-import `useRequest`, `useListView`, `useView`, `useFateClient`
303
+ * - Auto-import everything in `app/fate/` (view selectors)
304
+ *
305
+ * Define your entities and resolvers in `server/fate/views.ts` using the `defineFateViews` helper
306
+ * from `qarpeo/fate`.
307
+ *
308
+ * @default false
309
+ */
310
+ fate?: boolean | FateOptions;
311
+ /**
312
+ * Threaded comments and discussion system with D1 persistence, moderation, and reactions.
313
+ *
314
+ * @default false
315
+ */
316
+ comments?: boolean | CommentsOptions;
317
+ /**
318
+ * Turnkey E-Commerce & Store App with D1 persistence, variant matrix, cart, and payment checkout.
319
+ *
320
+ * @default false
321
+ */
322
+ store?: boolean | StoreOptions;
323
+ /**
324
+ * Configuration for Qarpeo DevTools (Dev-Only Management Console & DevTools panel).
325
+ *
326
+ * @default false
327
+ */
328
+ devtools?: boolean | DevtoolsOptions;
329
+ }
330
+ export interface DevtoolsOptions {
331
+ /**
332
+ * Whether Qarpeo DevTools is enabled in development.
333
+ *
334
+ * @default false
335
+ */
336
+ enabled?: boolean;
337
+ /**
338
+ * IP addresses allowed to access Qarpeo DevTools endpoints in development.
339
+ *
340
+ * @default ["127.0.0.1", "::1", "localhost", "::ffff:127.0.0.1"]
341
+ */
342
+ allowedIps?: string[];
343
+ /**
344
+ * Allow access from any IP address (e.g. when binding to 0.0.0.0 for remote/mobile testing).
345
+ *
346
+ * @default false
347
+ */
348
+ allowAnyIp?: boolean;
349
+ /**
350
+ * Require an authentication token to access Qarpeo DevTools. Can also be provided via
351
+ * `QARPEO_DEVTOOLS_TOKEN` or `NUXT_DEVTOOLS_TOKEN` environment variables.
352
+ */
353
+ token?: string;
354
+ /**
355
+ * Whether authentication token is strictly required.
356
+ *
357
+ * @default false
358
+ */
359
+ requireAuth?: boolean;
360
+ }
361
+ export type ModuleOptions = QarpeoOptions;
362
+ /** Type alias for the Nuxt instance, using official @nuxt/schema Nuxt interface. */
363
+ export type NuxtInstance = Nuxt;
@@ -0,0 +1,145 @@
1
+ export type PaymentProvider = "stripe" | "lemonsqueezy" | "polar" | "paddle";
2
+ export type SubscriptionStatus = "active" | "trialing" | "past_due" | "canceled" | "unpaid" | "incomplete" | "paused";
3
+ export interface PaymentPlanConfig {
4
+ name: string;
5
+ priceId: string;
6
+ features?: string[];
7
+ limits?: Record<string, number>;
8
+ }
9
+ export interface PaymentsOptions {
10
+ /**
11
+ * Payment provider backend.
12
+ *
13
+ * @default "stripe"
14
+ */
15
+ provider?: PaymentProvider;
16
+ /**
17
+ * Secret API key for provider. Defaults to process.env.STRIPE_SECRET_KEY, LEMONSQUEEZY_API_KEY,
18
+ * POLAR_ACCESS_TOKEN.
19
+ */
20
+ secretKey?: string;
21
+ /** Webhook signing secret. Defaults to process.env.STRIPE_WEBHOOK_SECRET, etc. */
22
+ webhookSecret?: string;
23
+ /**
24
+ * Base route prefix for payments endpoints.
25
+ *
26
+ * @default "/api/payments"
27
+ */
28
+ prefix?: string;
29
+ /** Default trial period in days for new subscriptions. */
30
+ trialDays?: number;
31
+ /** Default 3-letter currency code (e.g. 'usd', 'eur'). */
32
+ currency?: string;
33
+ /** Predefined plans mapping plan identifiers to price IDs and features. */
34
+ plans?: Record<string, PaymentPlanConfig>;
35
+ /**
36
+ * Default return URL after customer billing portal session completes.
37
+ *
38
+ * @default "/"
39
+ */
40
+ portalReturnUrl?: string;
41
+ /** Default redirect URLs for checkout sessions. */
42
+ checkoutUrls?: {
43
+ success?: string;
44
+ cancel?: string;
45
+ };
46
+ /** Paddle configuration options (environment, clientToken). */
47
+ paddle?: {
48
+ environment?: "sandbox" | "production";
49
+ clientToken?: string;
50
+ };
51
+ }
52
+ export interface QarpeoCustomer {
53
+ id: string;
54
+ userId: string;
55
+ orgId?: string | null;
56
+ provider: PaymentProvider;
57
+ customerId: string;
58
+ email: string;
59
+ name?: string | null;
60
+ metadataJson?: string | null;
61
+ createdAt: number;
62
+ updatedAt: number;
63
+ }
64
+ export interface QarpeoSubscription {
65
+ id: string;
66
+ customerId: string;
67
+ userId: string;
68
+ orgId?: string | null;
69
+ provider: PaymentProvider;
70
+ subscriptionId: string;
71
+ planId: string;
72
+ priceId: string;
73
+ status: SubscriptionStatus;
74
+ quantity: number;
75
+ cancelAtPeriodEnd: boolean;
76
+ currentPeriodStart: number;
77
+ currentPeriodEnd: number;
78
+ trialEnd?: number | null;
79
+ canceledAt?: number | null;
80
+ metadata?: Record<string, any>;
81
+ metadataJson?: string | null;
82
+ createdAt: number;
83
+ updatedAt: number;
84
+ }
85
+ export interface CreateCheckoutOptions {
86
+ planId?: string;
87
+ priceId?: string;
88
+ mode?: "subscription" | "payment" | "setup";
89
+ trialDays?: number;
90
+ currency?: string;
91
+ successUrl?: string;
92
+ cancelUrl?: string;
93
+ customerEmail?: string;
94
+ metadata?: Record<string, string>;
95
+ }
96
+ export interface QarpeoWebhookEvent {
97
+ id: string;
98
+ eventId: string;
99
+ provider: PaymentProvider;
100
+ eventType: string;
101
+ createdAt: number;
102
+ }
103
+ export interface MeterRecordOptions {
104
+ /** Optional user ID (defaults to current authenticated user) */
105
+ userId?: string;
106
+ /** Optional organization ID (defaults to current organization) */
107
+ orgId?: string;
108
+ /** Customer ID from payment provider */
109
+ customerId?: string;
110
+ /** Subscription ID from payment provider */
111
+ subscriptionId?: string;
112
+ /** Meter event or feature name (e.g. "api_requests", "tokens_generated", "storage_gb") */
113
+ eventName: string;
114
+ /** Quantity of units consumed (e.g. 100, 1) */
115
+ quantity: number;
116
+ /** Action: 'increment' (delta counter, default) or 'set' (absolute gauge) */
117
+ action?: "increment" | "set";
118
+ /** Timestamp of usage occurrence (defaults to now) */
119
+ timestamp?: number;
120
+ /** Custom metadata associated with this usage record */
121
+ metadata?: Record<string, any>;
122
+ }
123
+ export interface MeterUsageResult {
124
+ success: boolean;
125
+ id: string;
126
+ eventName: string;
127
+ quantity: number;
128
+ total?: number;
129
+ timestamp: number;
130
+ }
131
+ export interface UsageSummary {
132
+ eventName: string;
133
+ total: number;
134
+ count: number;
135
+ limit?: number;
136
+ remaining?: number;
137
+ periodStart?: number;
138
+ periodEnd?: number;
139
+ records?: Array<{
140
+ id: string;
141
+ quantity: number;
142
+ timestamp: number;
143
+ metadata?: Record<string, any>;
144
+ }>;
145
+ }
@@ -0,0 +1,71 @@
1
+ import type { RateLimitConfig } from "./auth";
2
+ export interface AppRateLimitRule {
3
+ /** Max requests permitted in the time window */
4
+ max?: number;
5
+ /** Time window (e.g. '1m', '10s', '1h', or seconds) */
6
+ window?: string | number;
7
+ /** Optional custom identifier/key or grouping */
8
+ key?: string;
9
+ }
10
+ export interface RateLimitCheckResult {
11
+ /** Whether the request is permitted */
12
+ success: boolean;
13
+ /** Number of remaining requests permitted in the current window */
14
+ remaining: number;
15
+ /** Max limit for this window */
16
+ limit: number;
17
+ /** Seconds until the rate limit window resets */
18
+ reset: number;
19
+ }
20
+ export interface CheckRateLimitOptions extends AppRateLimitRule {
21
+ /** Optional custom identifier/key to rate limit against (defaults to client IP + route path) */
22
+ key?: string;
23
+ /** Storage backend override ('auto' | 'kv' | 'memory') */
24
+ backend?: "auto" | "kv" | "memory";
25
+ /** Custom binding name override */
26
+ binding?: string;
27
+ /** Custom error message when rate limit is exceeded */
28
+ message?: string;
29
+ /** Explicit event context */
30
+ event?: any;
31
+ }
32
+ export interface AppRateLimitOptions extends RateLimitConfig {
33
+ /** Whether edge rate limiting is enabled. */
34
+ enabled?: boolean;
35
+ /** Whether rate limiting applies globally to all routes not matched by `rules`. */
36
+ global?: boolean;
37
+ /**
38
+ * Max requests permitted within default window.
39
+ *
40
+ * @default 100
41
+ */
42
+ max?: number;
43
+ /**
44
+ * Default time window (e.g. '1m', '10s', '1h', or seconds).
45
+ *
46
+ * @default "1m"
47
+ */
48
+ window?: string | number;
49
+ /** IP whitelist that bypasses rate limiting. */
50
+ ipWhitelist?: string[];
51
+ /**
52
+ * Per-route rate limiting rules mapping path patterns to rules.
53
+ *
54
+ * @example
55
+ * rules: {
56
+ * '/api/auth/**': { max: 5, window: '1m' },
57
+ * '/api/search': { max: 30, window: '1m' },
58
+ * }
59
+ */
60
+ rules?: Record<string, AppRateLimitRule>;
61
+ /**
62
+ * Storage backend for rate limit counters.
63
+ *
64
+ * - 'auto': uses native Cloudflare RateLimiter binding if available, falls back to KV or memory
65
+ * - 'kv': Cloudflare KV
66
+ * - 'memory': in-memory sliding window
67
+ *
68
+ * @default "auto"
69
+ */
70
+ backend?: "auto" | "kv" | "memory";
71
+ }