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,14 +5,17 @@ import type { NotificationRecord, PushSubscriptionRecord, SendNotificationReques
5
5
  * channel.
6
6
  *
7
7
  * @example
8
- * ```ts
9
- * await sendNotification({
10
- * userId: "user_123",
11
- * title: "Order Shipped",
12
- * body: "Your order #42 has been shipped!",
13
- * channels: ["in-app", "email"],
14
- * }, event)
15
- * ```
8
+ * ```ts
9
+ * await sendNotification(
10
+ * {
11
+ * userId: "user_123",
12
+ * title: "Order Shipped",
13
+ * body: "Your order #42 has been shipped!",
14
+ * channels: ["in-app", "email"],
15
+ * },
16
+ * event,
17
+ * )
18
+ * ```
16
19
  */
17
20
  export declare function sendNotification(request: SendNotificationRequest, event?: RequestEvent): Promise<void>;
18
21
  /** Alias for sendNotification */
@@ -27,12 +30,16 @@ export interface GetNotificationsOptions {
27
30
  * Get paginated notifications for a user from D1.
28
31
  *
29
32
  * @example
30
- * ```ts
31
- * const { notifications, total, unread } = await getNotifications(user.id, {
32
- * limit: 10,
33
- * unreadOnly: true,
34
- * }, event)
35
- * ```
33
+ * ```ts
34
+ * const { notifications, total, unread } = await getNotifications(
35
+ * user.id,
36
+ * {
37
+ * limit: 10,
38
+ * unreadOnly: true,
39
+ * },
40
+ * event,
41
+ * )
42
+ * ```
36
43
  */
37
44
  export declare function getNotifications(userId: string, options?: GetNotificationsOptions, event?: RequestEvent): Promise<{
38
45
  notifications: NotificationRecord[];
@@ -43,66 +50,70 @@ export declare function getNotifications(userId: string, options?: GetNotificati
43
50
  * Get a single notification by ID, scoped to user.
44
51
  *
45
52
  * @example
46
- * ```ts
47
- * const notification = await getNotification(notificationId, user.id, event)
48
- * ```
53
+ * ```ts
54
+ * const notification = await getNotification(notificationId, user.id, event)
55
+ * ```
49
56
  */
50
57
  export declare function getNotification(id: string, userId: string, event?: RequestEvent): Promise<NotificationRecord | null>;
51
58
  /**
52
59
  * Mark a single notification as read.
53
60
  *
54
61
  * @example
55
- * ```ts
56
- * await markNotificationRead(notificationId, user.id, event)
57
- * ```
62
+ * ```ts
63
+ * await markNotificationRead(notificationId, user.id, event)
64
+ * ```
58
65
  */
59
66
  export declare function markNotificationRead(id: string, userId: string, event?: RequestEvent): Promise<void>;
60
67
  /**
61
68
  * Mark all notifications as read for a user.
62
69
  *
63
70
  * @example
64
- * ```ts
65
- * await markAllNotificationsRead(user.id, event)
66
- * ```
71
+ * ```ts
72
+ * await markAllNotificationsRead(user.id, event)
73
+ * ```
67
74
  */
68
75
  export declare function markAllNotificationsRead(userId: string, event?: RequestEvent, tenantId?: string): Promise<void>;
69
76
  /**
70
77
  * Delete a notification.
71
78
  *
72
79
  * @example
73
- * ```ts
74
- * await deleteNotification(notificationId, user.id, event)
75
- * ```
80
+ * ```ts
81
+ * await deleteNotification(notificationId, user.id, event)
82
+ * ```
76
83
  */
77
84
  export declare function deleteNotification(id: string, userId: string, event?: RequestEvent): Promise<void>;
78
85
  /**
79
86
  * Save a Web Push subscription for a user.
80
87
  *
81
88
  * @example
82
- * ```ts
83
- * await savePushSubscription(user.id, subscription, undefined, event)
84
- * ```
89
+ * ```ts
90
+ * await savePushSubscription(user.id, subscription, undefined, event)
91
+ * ```
85
92
  */
86
93
  export declare function savePushSubscription(userId: string, subscription: PushSubscriptionRecord, tenantId?: string, event?: RequestEvent): Promise<void>;
87
94
  /**
88
95
  * Remove a Web Push subscription by endpoint, optionally scoped to user.
89
96
  *
90
97
  * @example
91
- * ```ts
92
- * await removePushSubscription(subscription.endpoint, event, user.id)
93
- * ```
98
+ * ```ts
99
+ * await removePushSubscription(subscription.endpoint, event, user.id)
100
+ * ```
94
101
  */
95
102
  export declare function removePushSubscription(endpoint: string, event?: RequestEvent, userId?: string): Promise<void>;
96
103
  /**
97
104
  * Send a Web Push notification to all subscriptions for a user.
98
105
  *
99
106
  * @example
100
- * ```ts
101
- * await sendWebPush(user.id, {
102
- * title: "New Message",
103
- * body: "Alice sent you a direct message.",
104
- * }, event)
105
- * ```
107
+ * ```ts
108
+ * await sendWebPush(
109
+ * user.id,
110
+ * {
111
+ * title: "New Message",
112
+ * body: "Alice sent you a direct message.",
113
+ * },
114
+ * event,
115
+ * )
116
+ * ```
106
117
  */
107
118
  export declare function sendWebPush(userId: string, payload: {
108
119
  title: string;
@@ -8,9 +8,7 @@
8
8
  * built-in `/auth/[provider]` routes.
9
9
  */
10
10
  import { type RequestEvent } from "nuxt/server";
11
- /**
12
- * @internal User profile returned by Google OAuth userinfo endpoint.
13
- */
11
+ /** @internal User profile returned by Google OAuth userinfo endpoint. */
14
12
  export interface OAuthGoogleUser {
15
13
  sub: string;
16
14
  email: string;
@@ -21,9 +19,7 @@ export interface OAuthGoogleUser {
21
19
  family_name?: string;
22
20
  [key: string]: any;
23
21
  }
24
- /**
25
- * @internal Payload passed to internal onSuccess callback.
26
- */
22
+ /** @internal Payload passed to internal onSuccess callback. */
27
23
  export interface OAuthSuccessPayload<T = OAuthGoogleUser> {
28
24
  user: T;
29
25
  tokens: {
@@ -36,9 +32,7 @@ export interface OAuthSuccessPayload<T = OAuthGoogleUser> {
36
32
  [key: string]: any;
37
33
  };
38
34
  }
39
- /**
40
- * @internal Configuration options for internal Google OAuth event handler.
41
- */
35
+ /** @internal Configuration options for internal Google OAuth event handler. */
42
36
  export interface DefineOAuthGoogleOptions {
43
37
  onSuccess: (event: RequestEvent, payload: OAuthSuccessPayload<OAuthGoogleUser>) => unknown | Promise<unknown>;
44
38
  onError?: (event: RequestEvent, error: unknown) => unknown | Promise<unknown>;
@@ -6,12 +6,12 @@ export { slugify };
6
6
  * Creates a new organization with the current authenticated user as "owner".
7
7
  *
8
8
  * @example
9
- * ```ts
10
- * const { organization, member } = await createOrganization(event, {
11
- * name: "Acme Corp",
12
- * slug: "acme",
13
- * })
14
- * ```
9
+ * ```ts
10
+ * const { organization, member } = await createOrganization(event, {
11
+ * name: "Acme Corp",
12
+ * slug: "acme",
13
+ * })
14
+ * ```
15
15
  */
16
16
  export declare function createOrganization(event: RequestEvent, input: {
17
17
  name: string;
@@ -25,9 +25,9 @@ export declare function createOrganization(event: RequestEvent, input: {
25
25
  * Lists all organizations the authenticated user belongs to.
26
26
  *
27
27
  * @example
28
- * ```ts
29
- * const orgs = await listUserOrganizations(event, user.id)
30
- * ```
28
+ * ```ts
29
+ * const orgs = await listUserOrganizations(event, user.id)
30
+ * ```
31
31
  */
32
32
  export declare function listUserOrganizations(event: RequestEvent, userId: string): Promise<Array<QarpeoOrganization & {
33
33
  role: string;
@@ -37,9 +37,9 @@ export declare function listUserOrganizations(event: RequestEvent, userId: strin
37
37
  * Switches the active organization for the current user's session.
38
38
  *
39
39
  * @example
40
- * ```ts
41
- * const res = await switchActiveOrganization(event, "org_123")
42
- * ```
40
+ * ```ts
41
+ * const res = await switchActiveOrganization(event, "org_123")
42
+ * ```
43
43
  */
44
44
  export declare function switchActiveOrganization(event: RequestEvent, organizationId: string): Promise<{
45
45
  success: boolean;
@@ -50,13 +50,13 @@ export declare function switchActiveOrganization(event: RequestEvent, organizati
50
50
  * Invites a new member to an organization via email.
51
51
  *
52
52
  * @example
53
- * ```ts
54
- * const invite = await inviteOrganizationMember(event, {
55
- * organizationId: "org_123",
56
- * email: "colleague@example.com",
57
- * role: "member",
58
- * })
59
- * ```
53
+ * ```ts
54
+ * const invite = await inviteOrganizationMember(event, {
55
+ * organizationId: "org_123",
56
+ * email: "colleague@example.com",
57
+ * role: "member",
58
+ * })
59
+ * ```
60
60
  */
61
61
  export declare function inviteOrganizationMember(event: RequestEvent, input: {
62
62
  organizationId: string;
@@ -74,9 +74,9 @@ export declare function inviteOrganizationMember(event: RequestEvent, input: {
74
74
  * Removes a member from an organization.
75
75
  *
76
76
  * @example
77
- * ```ts
78
- * await removeOrganizationMember(event, { organizationId: "org_123", memberId: "mem_456" })
79
- * ```
77
+ * ```ts
78
+ * await removeOrganizationMember(event, { organizationId: "org_123", memberId: "mem_456" })
79
+ * ```
80
80
  */
81
81
  export declare function removeOrganizationMember(event: RequestEvent, input: {
82
82
  organizationId: string;
@@ -88,9 +88,9 @@ export declare function removeOrganizationMember(event: RequestEvent, input: {
88
88
  * Accepts an invitation token and adds user as a member.
89
89
  *
90
90
  * @example
91
- * ```ts
92
- * const res = await acceptOrganizationInvitation(event, "raw-invite-token")
93
- * ```
91
+ * ```ts
92
+ * const res = await acceptOrganizationInvitation(event, "raw-invite-token")
93
+ * ```
94
94
  */
95
95
  export declare function acceptOrganizationInvitation(event: RequestEvent, token: string): Promise<{
96
96
  success: boolean;
@@ -101,9 +101,9 @@ export declare function acceptOrganizationInvitation(event: RequestEvent, token:
101
101
  * Lists all members for a given organization (requires organization membership).
102
102
  *
103
103
  * @example
104
- * ```ts
105
- * const members = await listOrganizationMembers(event, "org_123")
106
- * ```
104
+ * ```ts
105
+ * const members = await listOrganizationMembers(event, "org_123")
106
+ * ```
107
107
  */
108
108
  export declare function listOrganizationMembers(event: RequestEvent, organizationId: string): Promise<Array<QarpeoMember & {
109
109
  email?: string;
@@ -56,7 +56,9 @@ export async function createOrganization(event, input) {
56
56
  createdAt: now
57
57
  };
58
58
  await d1.batch([
59
- d1.prepare(`INSERT INTO ${orgTbl(event)} (id, name, slug, logo, created_at) VALUES (?, ?, ?, ?, ?)`).bind(
59
+ d1.prepare(
60
+ `INSERT INTO ${orgTbl(event)} (id, name, slug, logo, created_at) VALUES (?, ?, ?, ?, ?)`
61
+ ).bind(
60
62
  organization.id,
61
63
  organization.name,
62
64
  organization.slug,
@@ -104,7 +106,9 @@ export async function switchActiveOrganization(event, organizationId) {
104
106
  }
105
107
  const d1 = getD1(event);
106
108
  await ensureAuthTables(d1);
107
- const member = await d1.prepare(`SELECT id, role FROM ${memberTbl(event)} WHERE organization_id = ? AND user_id = ? LIMIT 1`).bind(organizationId, user.id).first();
109
+ const member = await d1.prepare(
110
+ `SELECT id, role FROM ${memberTbl(event)} WHERE organization_id = ? AND user_id = ? LIMIT 1`
111
+ ).bind(organizationId, user.id).first();
108
112
  if (!member) {
109
113
  throw createError({
110
114
  statusCode: 403,
@@ -153,7 +157,9 @@ export async function inviteOrganizationMember(event, input) {
153
157
  }
154
158
  const d1 = getD1(event);
155
159
  await ensureAuthTables(d1);
156
- const callerMember = await d1.prepare(`SELECT role FROM ${memberTbl(event)} WHERE organization_id = ? AND user_id = ? LIMIT 1`).bind(input.organizationId, user.id).first();
160
+ const callerMember = await d1.prepare(
161
+ `SELECT role FROM ${memberTbl(event)} WHERE organization_id = ? AND user_id = ? LIMIT 1`
162
+ ).bind(input.organizationId, user.id).first();
157
163
  if (!callerMember || !["owner", "admin"].includes(callerMember.role)) {
158
164
  throw createError({
159
165
  statusCode: 403,
@@ -268,7 +274,9 @@ export async function removeOrganizationMember(event, input) {
268
274
  }
269
275
  const d1 = getD1(event);
270
276
  await ensureAuthTables(d1);
271
- const callerMember = await d1.prepare(`SELECT id, role FROM ${memberTbl(event)} WHERE organization_id = ? AND user_id = ? LIMIT 1`).bind(input.organizationId, user.id).first();
277
+ const callerMember = await d1.prepare(
278
+ `SELECT id, role FROM ${memberTbl(event)} WHERE organization_id = ? AND user_id = ? LIMIT 1`
279
+ ).bind(input.organizationId, user.id).first();
272
280
  if (!callerMember) {
273
281
  throw createError({
274
282
  statusCode: 403,
@@ -306,7 +314,9 @@ export async function removeOrganizationMember(event, input) {
306
314
  });
307
315
  }
308
316
  if (targetMember.role === "owner") {
309
- const ownerCount = await d1.prepare(`SELECT count(*) as count FROM ${memberTbl(event)} WHERE organization_id = ? AND role = 'owner'`).bind(input.organizationId).first();
317
+ const ownerCount = await d1.prepare(
318
+ `SELECT count(*) as count FROM ${memberTbl(event)} WHERE organization_id = ? AND role = 'owner'`
319
+ ).bind(input.organizationId).first();
310
320
  if ((ownerCount?.count || 0) <= 1) {
311
321
  throw createError({
312
322
  statusCode: 400,
@@ -30,36 +30,36 @@ export interface VerifyMagicLinkResult {
30
30
  * Sends a one-time password (OTP) verification code to the specified email address.
31
31
  *
32
32
  * @example
33
- * ```ts
34
- * const result = await sendOTPCode(event, "user@example.com")
35
- * if (result.sent) {
36
- * console.log("OTP code sent successfully, expires at", result.expiresAt)
37
- * }
38
- * ```
33
+ * ```ts
34
+ * const result = await sendOTPCode(event, "user@example.com")
35
+ * if (result.sent) {
36
+ * console.log("OTP code sent successfully, expires at", result.expiresAt)
37
+ * }
38
+ * ```
39
39
  */
40
40
  export declare function sendOTPCode(event: RequestEvent, email: string, options?: SendOTPOptions): Promise<SendOTPResult>;
41
41
  /**
42
42
  * Verifies a submitted OTP code for an email address against KV.
43
43
  *
44
44
  * @example
45
- * ```ts
46
- * const result = await verifyOTPCode(event, "user@example.com", "123456")
47
- * if (result.valid) {
48
- * console.log("OTP successfully verified")
49
- * }
50
- * ```
45
+ * ```ts
46
+ * const result = await verifyOTPCode(event, "user@example.com", "123456")
47
+ * if (result.valid) {
48
+ * console.log("OTP successfully verified")
49
+ * }
50
+ * ```
51
51
  */
52
52
  export declare function verifyOTPCode(event: RequestEvent, email: string, code: string): Promise<VerifyOTPResult>;
53
53
  /**
54
54
  * Sends a passwordless magic sign-in link to the specified email address.
55
55
  *
56
56
  * @example
57
- * ```ts
58
- * const result = await sendMagicLink(event, "user@example.com")
59
- * if (result.sent) {
60
- * console.log("Magic link sent successfully")
61
- * }
62
- * ```
57
+ * ```ts
58
+ * const result = await sendMagicLink(event, "user@example.com")
59
+ * if (result.sent) {
60
+ * console.log("Magic link sent successfully")
61
+ * }
62
+ * ```
63
63
  */
64
64
  export declare function sendMagicLink(event: RequestEvent, email: string, options?: {
65
65
  ttl?: number;
@@ -68,11 +68,11 @@ export declare function sendMagicLink(event: RequestEvent, email: string, option
68
68
  * Verifies and consumes a passwordless magic sign-in link token.
69
69
  *
70
70
  * @example
71
- * ```ts
72
- * const result = await verifyMagicLinkToken(event, token)
73
- * if (result.valid) {
74
- * console.log("Verified email:", result.email)
75
- * }
76
- * ```
71
+ * ```ts
72
+ * const result = await verifyMagicLinkToken(event, token)
73
+ * if (result.valid) {
74
+ * console.log("Verified email:", result.email)
75
+ * }
76
+ * ```
77
77
  */
78
78
  export declare function verifyMagicLinkToken(event: RequestEvent, token: string): Promise<VerifyMagicLinkResult>;
@@ -5,13 +5,13 @@ import type { CreateCheckoutOptions } from "../../../../types";
5
5
  * Workers using standard `fetch`.
6
6
  *
7
7
  * @example
8
- * ```ts
9
- * const { url } = await createCheckoutSession(event, {
10
- * planId: "pro_monthly",
11
- * successUrl: "https://example.com/billing?success=true",
12
- * cancelUrl: "https://example.com/pricing",
13
- * })
14
- * ```
8
+ * ```ts
9
+ * const { url } = await createCheckoutSession(event, {
10
+ * planId: "pro_monthly",
11
+ * successUrl: "https://example.com/billing?success=true",
12
+ * cancelUrl: "https://example.com/pricing",
13
+ * })
14
+ * ```
15
15
  */
16
16
  export declare function createCheckoutSession(event: RequestEvent, options: CreateCheckoutOptions): Promise<{
17
17
  id: string;
@@ -21,11 +21,11 @@ export declare function createCheckoutSession(event: RequestEvent, options: Crea
21
21
  * Creates a Customer Billing Portal session for the current user.
22
22
  *
23
23
  * @example
24
- * ```ts
25
- * const { url } = await createCustomerPortalSession(event, {
26
- * returnUrl: "https://example.com/settings/billing",
27
- * })
28
- * ```
24
+ * ```ts
25
+ * const { url } = await createCustomerPortalSession(event, {
26
+ * returnUrl: "https://example.com/settings/billing",
27
+ * })
28
+ * ```
29
29
  */
30
30
  export declare function createCustomerPortalSession(event: RequestEvent, options?: {
31
31
  returnUrl?: string;
@@ -53,9 +53,7 @@ export async function createCheckoutSession(event, options) {
53
53
  if (config.provider === "stripe") {
54
54
  let customerId = null;
55
55
  if (user?.id) {
56
- const cust = await db.prepare(
57
- `SELECT customer_id FROM ${ct} WHERE user_id = ? AND provider = 'stripe' LIMIT 1`
58
- ).bind(user.id).first();
56
+ const cust = await db.prepare(`SELECT customer_id FROM ${ct} WHERE user_id = ? AND provider = 'stripe' LIMIT 1`).bind(user.id).first();
59
57
  if (cust) customerId = cust.customer_id;
60
58
  }
61
59
  const mode = options.mode || "subscription";
@@ -37,9 +37,9 @@ export interface PaymentWebhookListenerPayload {
37
37
  }
38
38
  export type PaymentWebhookListener = (payload: PaymentWebhookListenerPayload) => void | Promise<void>;
39
39
  /**
40
- * Registers a server-side listener for verified payment webhook events.
41
- * Used by higher-level modules (such as Store) to reconcile orders without
42
- * creating a compile-time dependency from Payments to App modules.
40
+ * Registers a server-side listener for verified payment webhook events. Used by higher-level
41
+ * modules (such as Store) to reconcile orders without creating a compile-time dependency from
42
+ * Payments to App modules.
43
43
  */
44
44
  export declare function registerPaymentWebhookListener(listener: PaymentWebhookListener): () => void;
45
45
  export declare function notifyPaymentWebhookListeners(info: PaymentWebhookListenerPayload): Promise<void>;
@@ -1,4 +1,7 @@
1
- /** Verifies Paddle Billing webhook signature (Paddle-Signature header: `ts=TIMESTAMP;h1=HMAC_HEX`) with replay protection */
1
+ /**
2
+ * Verifies Paddle Billing webhook signature (Paddle-Signature header: `ts=TIMESTAMP;h1=HMAC_HEX`)
3
+ * with replay protection
4
+ */
2
5
  export declare function verifyPaddleSignature(rawBody: string, signatureHeader: string | null | undefined, secret: string, toleranceSec?: number): Promise<boolean>;
3
6
  export declare function handlePaddleWebhookEvent(db: any, ct: string, st: string, payload: any, now: number): Promise<{
4
7
  eventType: string;
@@ -1,4 +1,7 @@
1
- /** Verifies Polar webhook signature (webhook-signature header with optional Standard Webhooks headers) */
1
+ /**
2
+ * Verifies Polar webhook signature (webhook-signature header with optional Standard Webhooks
3
+ * headers)
4
+ */
2
5
  export declare function verifyPolarSignature(rawBody: string, signatureHeader: string | null | undefined, secret: string, options?: {
3
6
  timestamp?: string | null;
4
7
  webhookId?: string | null;
@@ -22,7 +22,9 @@ export async function verifyStripeSignature(rawBody, signatureHeader, secret, to
22
22
  }
23
23
  const payload = `${timestamp}.${rawBody}`;
24
24
  const expectedSignature = await computeHmacSha256(secret, payload);
25
- return signatures.some((sig) => timingSafeEqualString(sig.toLowerCase(), expectedSignature.toLowerCase()));
25
+ return signatures.some(
26
+ (sig) => timingSafeEqualString(sig.toLowerCase(), expectedSignature.toLowerCase())
27
+ );
26
28
  }
27
29
  export async function handleStripeWebhookEvent(db, ct, st, payload, now) {
28
30
  const eventType = payload.type;
@@ -138,9 +140,7 @@ export async function handleStripeWebhookEvent(db, ct, st, payload, now) {
138
140
  const subId = obj.subscription;
139
141
  if (subId) {
140
142
  affectedSubId = subId;
141
- await db.prepare(
142
- `UPDATE ${st} SET status = 'active', updated_at = ? WHERE subscription_id = ?`
143
- ).bind(now, subId).run();
143
+ await db.prepare(`UPDATE ${st} SET status = 'active', updated_at = ? WHERE subscription_id = ?`).bind(now, subId).run();
144
144
  }
145
145
  break;
146
146
  }
@@ -148,9 +148,7 @@ export async function handleStripeWebhookEvent(db, ct, st, payload, now) {
148
148
  const subId = obj.subscription;
149
149
  if (subId) {
150
150
  affectedSubId = subId;
151
- await db.prepare(
152
- `UPDATE ${st} SET status = 'past_due', updated_at = ? WHERE subscription_id = ?`
153
- ).bind(now, subId).run();
151
+ await db.prepare(`UPDATE ${st} SET status = 'past_due', updated_at = ? WHERE subscription_id = ?`).bind(now, subId).run();
154
152
  }
155
153
  break;
156
154
  }
@@ -32,12 +32,12 @@ export declare function changePlan(event: RequestEvent, subscriptionId: string,
32
32
  * Gets the current active subscription for a user or organization from D1.
33
33
  *
34
34
  * @example
35
- * ```ts
36
- * const sub = await getSubscription(event)
37
- * if (sub?.status === "active") {
38
- * console.log("Plan:", sub.planId)
39
- * }
40
- * ```
35
+ * ```ts
36
+ * const sub = await getSubscription(event)
37
+ * if (sub?.status === "active") {
38
+ * console.log("Plan:", sub.planId)
39
+ * }
40
+ * ```
41
41
  */
42
42
  export declare function getSubscription(event: RequestEvent, options?: {
43
43
  userId?: string;
@@ -53,9 +53,9 @@ export interface RequireSubscriptionOptions {
53
53
  * Server guard: throws 402 Payment Required if caller has no active subscription.
54
54
  *
55
55
  * @example
56
- * ```ts
57
- * const sub = await requireSubscription(event, { plan: "pro" })
58
- * ```
56
+ * ```ts
57
+ * const sub = await requireSubscription(event, { plan: "pro" })
58
+ * ```
59
59
  */
60
60
  export declare function requireSubscription(event: RequestEvent, options?: RequireSubscriptionOptions): Promise<QarpeoSubscription>;
61
61
  /**
@@ -63,11 +63,11 @@ export declare function requireSubscription(event: RequestEvent, options?: Requi
63
63
  * feature flag.
64
64
  *
65
65
  * @example
66
- * ```ts
67
- * if (!(await hasFeature(event, "custom_domain"))) {
68
- * throw createError({ statusCode: 403, message: "Custom domains require Pro plan" })
69
- * }
70
- * ```
66
+ * ```ts
67
+ * if (!(await hasFeature(event, "custom_domain"))) {
68
+ * throw createError({ statusCode: 403, message: "Custom domains require Pro plan" })
69
+ * }
70
+ * ```
71
71
  */
72
72
  export declare function hasFeature(event: RequestEvent, feature: string): Promise<boolean>;
73
73
  /**
@@ -90,9 +90,7 @@ export async function pauseSubscription(event, subscriptionId) {
90
90
  throw createError({ statusCode: res.status, message: `Stripe pause failed: ${errText}` });
91
91
  }
92
92
  const now = Date.now();
93
- await db.prepare(
94
- `UPDATE ${st} SET status = 'paused', updated_at = ? WHERE subscription_id = ?`
95
- ).bind(now, subscriptionId).run();
93
+ await db.prepare(`UPDATE ${st} SET status = 'paused', updated_at = ? WHERE subscription_id = ?`).bind(now, subscriptionId).run();
96
94
  return { success: true, subscriptionId, status: "paused" };
97
95
  }
98
96
  export async function changePlan(event, subscriptionId, newPriceId) {
@@ -160,9 +158,7 @@ export async function changePlan(event, subscriptionId, newPriceId) {
160
158
  const updated = await res.json();
161
159
  const newPlanId = updated?.items?.data?.[0]?.price?.id || newPriceId;
162
160
  const now = Date.now();
163
- await db.prepare(
164
- `UPDATE ${st} SET plan_id = ?, price_id = ?, updated_at = ? WHERE subscription_id = ?`
165
- ).bind(newPlanId, newPriceId, now, subscriptionId).run();
161
+ await db.prepare(`UPDATE ${st} SET plan_id = ?, price_id = ?, updated_at = ? WHERE subscription_id = ?`).bind(newPlanId, newPriceId, now, subscriptionId).run();
166
162
  return { success: true, subscriptionId, planId: newPlanId };
167
163
  }
168
164
  export async function getSubscription(event, options) {
@@ -43,9 +43,7 @@ export async function reportUsage(event, options) {
43
43
  if (config.provider === "stripe" && config.secretKey) {
44
44
  let custId = options.customerId;
45
45
  if (!custId && userId) {
46
- const cust = await db.prepare(
47
- `SELECT customer_id FROM ${ct} WHERE user_id = ? AND provider = 'stripe' LIMIT 1`
48
- ).bind(userId).first();
46
+ const cust = await db.prepare(`SELECT customer_id FROM ${ct} WHERE user_id = ? AND provider = 'stripe' LIMIT 1`).bind(userId).first();
49
47
  if (cust) custId = cust.customer_id;
50
48
  }
51
49
  if (custId) {
@@ -10,10 +10,10 @@ import {
10
10
  rowToSubscription,
11
11
  notifyPaymentWebhookListeners
12
12
  } from "./common.mjs";
13
- import { verifyStripeSignature, handleStripeWebhookEvent } from "./stripe.mjs";
14
13
  import { verifyLemonSqueezySignature, handleLemonSqueezyWebhookEvent } from "./lemonsqueezy.mjs";
15
- import { verifyPolarSignature, handlePolarWebhookEvent } from "./polar.mjs";
16
14
  import { verifyPaddleSignature, handlePaddleWebhookEvent } from "./paddle.mjs";
15
+ import { verifyPolarSignature, handlePolarWebhookEvent } from "./polar.mjs";
16
+ import { verifyStripeSignature, handleStripeWebhookEvent } from "./stripe.mjs";
17
17
  export async function processPaymentWebhook(event, rawBody) {
18
18
  await ensurePaymentsTables(event);
19
19
  const db = getPaymentsDb(event);