@vandenberghinc/volt 1.2.5 → 1.2.6

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 (489) hide show
  1. package/frontend/assets/admin/admin.png +0 -0
  2. package/frontend/assets/admin/password.webp +0 -0
  3. package/frontend/assets/icons/arrow.v1.webp +0 -0
  4. package/frontend/assets/icons/copy.webp +0 -0
  5. package/frontend/assets/payments/arrow.long.webp +0 -0
  6. package/frontend/assets/payments/arrow.long2.webp +0 -0
  7. package/frontend/assets/payments/cancelled.webp +0 -0
  8. package/frontend/assets/payments/check.sign.webp +0 -0
  9. package/frontend/assets/payments/check.webp +0 -0
  10. package/frontend/assets/payments/close.webp +0 -0
  11. package/frontend/assets/payments/error.webp +0 -0
  12. package/frontend/assets/payments/exclamation.webp +0 -0
  13. package/frontend/assets/payments/minus.webp +0 -0
  14. package/frontend/assets/payments/party.webp +0 -0
  15. package/frontend/assets/payments/plus.webp +0 -0
  16. package/frontend/assets/payments/shopping_cart.webp +0 -0
  17. package/frontend/assets/payments/trash.webp +0 -0
  18. package/package.json +5 -1
  19. package/.libris/config.json +0 -82
  20. package/backend/dist/cjs/backend/src/blacklist.d.ts +0 -12
  21. package/backend/dist/cjs/backend/src/blacklist.js +0 -78
  22. package/backend/dist/cjs/backend/src/cli.d.ts +0 -2
  23. package/backend/dist/cjs/backend/src/cli.js +0 -198
  24. package/backend/dist/cjs/backend/src/database/collection.d.ts +0 -1765
  25. package/backend/dist/cjs/backend/src/database/collection.js +0 -3301
  26. package/backend/dist/cjs/backend/src/database/database.d.ts +0 -92
  27. package/backend/dist/cjs/backend/src/database/database.js +0 -170
  28. package/backend/dist/cjs/backend/src/database/document.d.ts +0 -1
  29. package/backend/dist/cjs/backend/src/database/document.js +0 -15
  30. package/backend/dist/cjs/backend/src/database/filters/filters.d.ts +0 -6
  31. package/backend/dist/cjs/backend/src/database/filters/filters.js +0 -15
  32. package/backend/dist/cjs/backend/src/database/filters/strict_filter.d.ts +0 -223
  33. package/backend/dist/cjs/backend/src/database/filters/strict_filter.js +0 -15
  34. package/backend/dist/cjs/backend/src/database/filters/strict_filter_test.d.ts +0 -1
  35. package/backend/dist/cjs/backend/src/database/filters/strict_filter_test.js +0 -443
  36. package/backend/dist/cjs/backend/src/database/filters/strict_filter_test_v0.d.ts +0 -1
  37. package/backend/dist/cjs/backend/src/database/filters/strict_filter_test_v0.js +0 -15
  38. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v0.d.ts +0 -50
  39. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v0.js +0 -15
  40. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v1.d.ts +0 -76
  41. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v1.js +0 -15
  42. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v2.d.ts +0 -75
  43. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v2.js +0 -15
  44. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v3.d.ts +0 -219
  45. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v3.js +0 -15
  46. package/backend/dist/cjs/backend/src/database/filters/strict_update_filter.d.ts +0 -165
  47. package/backend/dist/cjs/backend/src/database/filters/strict_update_filter.js +0 -15
  48. package/backend/dist/cjs/backend/src/database/filters/strict_update_filter_test.d.ts +0 -5
  49. package/backend/dist/cjs/backend/src/database/filters/strict_update_filter_test.js +0 -355
  50. package/backend/dist/cjs/backend/src/database/flatten.d.ts +0 -78
  51. package/backend/dist/cjs/backend/src/database/flatten.js +0 -53
  52. package/backend/dist/cjs/backend/src/database/flatten_test.d.ts +0 -1
  53. package/backend/dist/cjs/backend/src/database/flatten_test.js +0 -175
  54. package/backend/dist/cjs/backend/src/database/quota/quoata_v2.d.ts +0 -533
  55. package/backend/dist/cjs/backend/src/database/quota/quoata_v2.js +0 -1046
  56. package/backend/dist/cjs/backend/src/database/quota/quota.d.ts +0 -551
  57. package/backend/dist/cjs/backend/src/database/quota/quota.js +0 -1108
  58. package/backend/dist/cjs/backend/src/database/quota/quota_v1.d.ts +0 -534
  59. package/backend/dist/cjs/backend/src/database/quota/quota_v1.js +0 -1087
  60. package/backend/dist/cjs/backend/src/database/quota/safe_int.d.ts +0 -412
  61. package/backend/dist/cjs/backend/src/database/quota/safe_int.js +0 -745
  62. package/backend/dist/cjs/backend/src/endpoint.d.ts +0 -346
  63. package/backend/dist/cjs/backend/src/endpoint.js +0 -468
  64. package/backend/dist/cjs/backend/src/errors/index.d.ts +0 -7
  65. package/backend/dist/cjs/backend/src/errors/index.js +0 -25
  66. package/backend/dist/cjs/backend/src/errors/internal_external.d.ts +0 -52
  67. package/backend/dist/cjs/backend/src/errors/internal_external.js +0 -95
  68. package/backend/dist/cjs/backend/src/errors/invalid_usage_error.d.ts +0 -41
  69. package/backend/dist/cjs/backend/src/errors/invalid_usage_error.js +0 -47
  70. package/backend/dist/cjs/backend/src/errors/system_error.d.ts +0 -261
  71. package/backend/dist/cjs/backend/src/errors/system_error.js +0 -436
  72. package/backend/dist/cjs/backend/src/events.d.ts +0 -97
  73. package/backend/dist/cjs/backend/src/events.js +0 -15
  74. package/backend/dist/cjs/backend/src/frontend.d.ts +0 -11
  75. package/backend/dist/cjs/backend/src/frontend.js +0 -37
  76. package/backend/dist/cjs/backend/src/image_endpoint.d.ts +0 -44
  77. package/backend/dist/cjs/backend/src/image_endpoint.js +0 -185
  78. package/backend/dist/cjs/backend/src/index.d.ts +0 -23
  79. package/backend/dist/cjs/backend/src/index.js +0 -70
  80. package/backend/dist/cjs/backend/src/logger.d.ts +0 -5
  81. package/backend/dist/cjs/backend/src/logger.js +0 -15
  82. package/backend/dist/cjs/backend/src/meta.d.ts +0 -112
  83. package/backend/dist/cjs/backend/src/meta.js +0 -181
  84. package/backend/dist/cjs/backend/src/payments/paddle.d.ts +0 -329
  85. package/backend/dist/cjs/backend/src/payments/paddle.js +0 -1996
  86. package/backend/dist/cjs/backend/src/payments/stripe/checkout.d.ts +0 -113
  87. package/backend/dist/cjs/backend/src/payments/stripe/checkout.js +0 -295
  88. package/backend/dist/cjs/backend/src/payments/stripe/customers.d.ts +0 -17
  89. package/backend/dist/cjs/backend/src/payments/stripe/customers.js +0 -164
  90. package/backend/dist/cjs/backend/src/payments/stripe/error.d.ts +0 -74
  91. package/backend/dist/cjs/backend/src/payments/stripe/error.js +0 -64
  92. package/backend/dist/cjs/backend/src/payments/stripe/events.d.ts +0 -155
  93. package/backend/dist/cjs/backend/src/payments/stripe/events.js +0 -15
  94. package/backend/dist/cjs/backend/src/payments/stripe/meters.d.ts +0 -105
  95. package/backend/dist/cjs/backend/src/payments/stripe/meters.js +0 -230
  96. package/backend/dist/cjs/backend/src/payments/stripe/payment_methods.d.ts +0 -58
  97. package/backend/dist/cjs/backend/src/payments/stripe/payment_methods.js +0 -109
  98. package/backend/dist/cjs/backend/src/payments/stripe/products.d.ts +0 -519
  99. package/backend/dist/cjs/backend/src/payments/stripe/products.js +0 -650
  100. package/backend/dist/cjs/backend/src/payments/stripe/stripe.d.ts +0 -215
  101. package/backend/dist/cjs/backend/src/payments/stripe/stripe.js +0 -468
  102. package/backend/dist/cjs/backend/src/payments/stripe/subscriptions.d.ts +0 -172
  103. package/backend/dist/cjs/backend/src/payments/stripe/subscriptions.js +0 -557
  104. package/backend/dist/cjs/backend/src/payments/stripe/utils.d.ts +0 -63
  105. package/backend/dist/cjs/backend/src/payments/stripe/utils.js +0 -118
  106. package/backend/dist/cjs/backend/src/payments/stripe/webhooks.d.ts +0 -105
  107. package/backend/dist/cjs/backend/src/payments/stripe/webhooks.js +0 -627
  108. package/backend/dist/cjs/backend/src/plugins/browser.d.ts +0 -1
  109. package/backend/dist/cjs/backend/src/plugins/browser.js +0 -15
  110. package/backend/dist/cjs/backend/src/plugins/communication.d.ts +0 -70
  111. package/backend/dist/cjs/backend/src/plugins/communication.js +0 -196
  112. package/backend/dist/cjs/backend/src/plugins/mail/mail.d.ts +0 -255
  113. package/backend/dist/cjs/backend/src/plugins/mail/mail.js +0 -381
  114. package/backend/dist/cjs/backend/src/plugins/mail/ui.d.ts +0 -297
  115. package/backend/dist/cjs/backend/src/plugins/mail/ui.js +0 -1370
  116. package/backend/dist/cjs/backend/src/plugins/pdf.d.ts +0 -1
  117. package/backend/dist/cjs/backend/src/plugins/pdf.js +0 -1456
  118. package/backend/dist/cjs/backend/src/plugins/thread_monitor.d.ts +0 -18
  119. package/backend/dist/cjs/backend/src/plugins/thread_monitor.js +0 -116
  120. package/backend/dist/cjs/backend/src/rate_limit.d.ts +0 -148
  121. package/backend/dist/cjs/backend/src/rate_limit.js +0 -543
  122. package/backend/dist/cjs/backend/src/route.d.ts +0 -39
  123. package/backend/dist/cjs/backend/src/route.js +0 -172
  124. package/backend/dist/cjs/backend/src/server.d.ts +0 -502
  125. package/backend/dist/cjs/backend/src/server.js +0 -1713
  126. package/backend/dist/cjs/backend/src/server.old.d.ts +0 -594
  127. package/backend/dist/cjs/backend/src/server.old.js +0 -2058
  128. package/backend/dist/cjs/backend/src/splash_screen.d.ts +0 -93
  129. package/backend/dist/cjs/backend/src/splash_screen.js +0 -119
  130. package/backend/dist/cjs/backend/src/status.d.ts +0 -89
  131. package/backend/dist/cjs/backend/src/status.js +0 -211
  132. package/backend/dist/cjs/backend/src/stream.d.ts +0 -494
  133. package/backend/dist/cjs/backend/src/stream.js +0 -1370
  134. package/backend/dist/cjs/backend/src/users.d.ts +0 -926
  135. package/backend/dist/cjs/backend/src/users.js +0 -2223
  136. package/backend/dist/cjs/backend/src/utils.d.ts +0 -22
  137. package/backend/dist/cjs/backend/src/utils.js +0 -626
  138. package/backend/dist/cjs/backend/src/view.d.ts +0 -115
  139. package/backend/dist/cjs/backend/src/view.js +0 -519
  140. package/backend/dist/cjs/backend/src/vinc.d.ts +0 -6
  141. package/backend/dist/cjs/backend/src/vinc.js +0 -40
  142. package/backend/dist/cjs/backend/src/volt.d.ts +0 -24
  143. package/backend/dist/cjs/backend/src/volt.js +0 -72
  144. package/backend/dist/cjs/frontend/src/modules/request.d.ts +0 -70
  145. package/backend/dist/cjs/frontend/src/modules/request.js +0 -99
  146. package/backend/dist/cjs/package.json +0 -1
  147. package/backend/dist/esm/backend/src/blacklist.d.ts +0 -12
  148. package/backend/dist/esm/backend/src/blacklist.js +0 -52
  149. package/backend/dist/esm/backend/src/cli.d.ts +0 -2
  150. package/backend/dist/esm/backend/src/cli.js +0 -211
  151. package/backend/dist/esm/backend/src/database/collection.d.ts +0 -1765
  152. package/backend/dist/esm/backend/src/database/collection.js +0 -3779
  153. package/backend/dist/esm/backend/src/database/database.d.ts +0 -92
  154. package/backend/dist/esm/backend/src/database/database.js +0 -214
  155. package/backend/dist/esm/backend/src/database/document.d.ts +0 -1
  156. package/backend/dist/esm/backend/src/database/document.js +0 -558
  157. package/backend/dist/esm/backend/src/database/filters/filters.d.ts +0 -6
  158. package/backend/dist/esm/backend/src/database/filters/filters.js +0 -1
  159. package/backend/dist/esm/backend/src/database/filters/strict_filter.d.ts +0 -223
  160. package/backend/dist/esm/backend/src/database/filters/strict_filter.js +0 -3
  161. package/backend/dist/esm/backend/src/database/filters/strict_filter_test.d.ts +0 -1
  162. package/backend/dist/esm/backend/src/database/filters/strict_filter_test.js +0 -505
  163. package/backend/dist/esm/backend/src/database/filters/strict_filter_test_v0.d.ts +0 -1
  164. package/backend/dist/esm/backend/src/database/filters/strict_filter_test_v0.js +0 -712
  165. package/backend/dist/esm/backend/src/database/filters/strict_filter_v0.d.ts +0 -50
  166. package/backend/dist/esm/backend/src/database/filters/strict_filter_v0.js +0 -5
  167. package/backend/dist/esm/backend/src/database/filters/strict_filter_v1.d.ts +0 -76
  168. package/backend/dist/esm/backend/src/database/filters/strict_filter_v1.js +0 -44
  169. package/backend/dist/esm/backend/src/database/filters/strict_filter_v2.d.ts +0 -75
  170. package/backend/dist/esm/backend/src/database/filters/strict_filter_v2.js +0 -5
  171. package/backend/dist/esm/backend/src/database/filters/strict_filter_v3.d.ts +0 -219
  172. package/backend/dist/esm/backend/src/database/filters/strict_filter_v3.js +0 -1
  173. package/backend/dist/esm/backend/src/database/filters/strict_update_filter.d.ts +0 -165
  174. package/backend/dist/esm/backend/src/database/filters/strict_update_filter.js +0 -5
  175. package/backend/dist/esm/backend/src/database/filters/strict_update_filter_test.d.ts +0 -5
  176. package/backend/dist/esm/backend/src/database/filters/strict_update_filter_test.js +0 -415
  177. package/backend/dist/esm/backend/src/database/flatten.d.ts +0 -78
  178. package/backend/dist/esm/backend/src/database/flatten.js +0 -22
  179. package/backend/dist/esm/backend/src/database/flatten_test.d.ts +0 -1
  180. package/backend/dist/esm/backend/src/database/flatten_test.js +0 -174
  181. package/backend/dist/esm/backend/src/database/quota/quoata_v2.d.ts +0 -533
  182. package/backend/dist/esm/backend/src/database/quota/quoata_v2.js +0 -1155
  183. package/backend/dist/esm/backend/src/database/quota/quota.d.ts +0 -551
  184. package/backend/dist/esm/backend/src/database/quota/quota.js +0 -1219
  185. package/backend/dist/esm/backend/src/database/quota/quota_v1.d.ts +0 -534
  186. package/backend/dist/esm/backend/src/database/quota/quota_v1.js +0 -1242
  187. package/backend/dist/esm/backend/src/database/quota/safe_int.d.ts +0 -412
  188. package/backend/dist/esm/backend/src/database/quota/safe_int.js +0 -810
  189. package/backend/dist/esm/backend/src/endpoint.d.ts +0 -346
  190. package/backend/dist/esm/backend/src/endpoint.js +0 -479
  191. package/backend/dist/esm/backend/src/errors/index.d.ts +0 -7
  192. package/backend/dist/esm/backend/src/errors/index.js +0 -7
  193. package/backend/dist/esm/backend/src/errors/internal_external.d.ts +0 -52
  194. package/backend/dist/esm/backend/src/errors/internal_external.js +0 -86
  195. package/backend/dist/esm/backend/src/errors/invalid_usage_error.d.ts +0 -41
  196. package/backend/dist/esm/backend/src/errors/invalid_usage_error.js +0 -33
  197. package/backend/dist/esm/backend/src/errors/system_error.d.ts +0 -261
  198. package/backend/dist/esm/backend/src/errors/system_error.js +0 -444
  199. package/backend/dist/esm/backend/src/events.d.ts +0 -97
  200. package/backend/dist/esm/backend/src/events.js +0 -5
  201. package/backend/dist/esm/backend/src/frontend.d.ts +0 -11
  202. package/backend/dist/esm/backend/src/frontend.js +0 -12
  203. package/backend/dist/esm/backend/src/image_endpoint.d.ts +0 -44
  204. package/backend/dist/esm/backend/src/image_endpoint.js +0 -196
  205. package/backend/dist/esm/backend/src/index.d.ts +0 -23
  206. package/backend/dist/esm/backend/src/index.js +0 -26
  207. package/backend/dist/esm/backend/src/logger.d.ts +0 -5
  208. package/backend/dist/esm/backend/src/logger.js +0 -8
  209. package/backend/dist/esm/backend/src/meta.d.ts +0 -112
  210. package/backend/dist/esm/backend/src/meta.js +0 -152
  211. package/backend/dist/esm/backend/src/payments/paddle.d.ts +0 -329
  212. package/backend/dist/esm/backend/src/payments/paddle.js +0 -2276
  213. package/backend/dist/esm/backend/src/payments/stripe/checkout.d.ts +0 -113
  214. package/backend/dist/esm/backend/src/payments/stripe/checkout.js +0 -356
  215. package/backend/dist/esm/backend/src/payments/stripe/customers.d.ts +0 -17
  216. package/backend/dist/esm/backend/src/payments/stripe/customers.js +0 -193
  217. package/backend/dist/esm/backend/src/payments/stripe/error.d.ts +0 -74
  218. package/backend/dist/esm/backend/src/payments/stripe/error.js +0 -51
  219. package/backend/dist/esm/backend/src/payments/stripe/events.d.ts +0 -155
  220. package/backend/dist/esm/backend/src/payments/stripe/events.js +0 -5
  221. package/backend/dist/esm/backend/src/payments/stripe/meters.d.ts +0 -105
  222. package/backend/dist/esm/backend/src/payments/stripe/meters.js +0 -318
  223. package/backend/dist/esm/backend/src/payments/stripe/payment_methods.d.ts +0 -58
  224. package/backend/dist/esm/backend/src/payments/stripe/payment_methods.js +0 -135
  225. package/backend/dist/esm/backend/src/payments/stripe/products.d.ts +0 -519
  226. package/backend/dist/esm/backend/src/payments/stripe/products.js +0 -896
  227. package/backend/dist/esm/backend/src/payments/stripe/stripe.d.ts +0 -215
  228. package/backend/dist/esm/backend/src/payments/stripe/stripe.js +0 -464
  229. package/backend/dist/esm/backend/src/payments/stripe/subscriptions.d.ts +0 -172
  230. package/backend/dist/esm/backend/src/payments/stripe/subscriptions.js +0 -754
  231. package/backend/dist/esm/backend/src/payments/stripe/utils.d.ts +0 -63
  232. package/backend/dist/esm/backend/src/payments/stripe/utils.js +0 -131
  233. package/backend/dist/esm/backend/src/payments/stripe/webhooks.d.ts +0 -105
  234. package/backend/dist/esm/backend/src/payments/stripe/webhooks.js +0 -752
  235. package/backend/dist/esm/backend/src/plugins/browser.d.ts +0 -1
  236. package/backend/dist/esm/backend/src/plugins/browser.js +0 -170
  237. package/backend/dist/esm/backend/src/plugins/communication.d.ts +0 -70
  238. package/backend/dist/esm/backend/src/plugins/communication.js +0 -169
  239. package/backend/dist/esm/backend/src/plugins/mail/mail.d.ts +0 -255
  240. package/backend/dist/esm/backend/src/plugins/mail/mail.js +0 -396
  241. package/backend/dist/esm/backend/src/plugins/mail/ui.d.ts +0 -297
  242. package/backend/dist/esm/backend/src/plugins/mail/ui.js +0 -1400
  243. package/backend/dist/esm/backend/src/plugins/pdf.d.ts +0 -1
  244. package/backend/dist/esm/backend/src/plugins/pdf.js +0 -1694
  245. package/backend/dist/esm/backend/src/plugins/thread_monitor.d.ts +0 -18
  246. package/backend/dist/esm/backend/src/plugins/thread_monitor.js +0 -120
  247. package/backend/dist/esm/backend/src/rate_limit.d.ts +0 -148
  248. package/backend/dist/esm/backend/src/rate_limit.js +0 -667
  249. package/backend/dist/esm/backend/src/route.d.ts +0 -39
  250. package/backend/dist/esm/backend/src/route.js +0 -222
  251. package/backend/dist/esm/backend/src/server.d.ts +0 -502
  252. package/backend/dist/esm/backend/src/server.js +0 -2034
  253. package/backend/dist/esm/backend/src/server.old.d.ts +0 -594
  254. package/backend/dist/esm/backend/src/server.old.js +0 -2630
  255. package/backend/dist/esm/backend/src/splash_screen.d.ts +0 -93
  256. package/backend/dist/esm/backend/src/splash_screen.js +0 -156
  257. package/backend/dist/esm/backend/src/status.d.ts +0 -89
  258. package/backend/dist/esm/backend/src/status.js +0 -213
  259. package/backend/dist/esm/backend/src/stream.d.ts +0 -494
  260. package/backend/dist/esm/backend/src/stream.js +0 -1611
  261. package/backend/dist/esm/backend/src/users.d.ts +0 -926
  262. package/backend/dist/esm/backend/src/users.js +0 -2423
  263. package/backend/dist/esm/backend/src/utils.d.ts +0 -22
  264. package/backend/dist/esm/backend/src/utils.js +0 -463
  265. package/backend/dist/esm/backend/src/view.d.ts +0 -115
  266. package/backend/dist/esm/backend/src/view.js +0 -584
  267. package/backend/dist/esm/backend/src/vinc.d.ts +0 -6
  268. package/backend/dist/esm/backend/src/vinc.js +0 -6
  269. package/backend/dist/esm/backend/src/volt.d.ts +0 -24
  270. package/backend/dist/esm/backend/src/volt.js +0 -27
  271. package/backend/dist/esm/frontend/src/modules/request.d.ts +0 -70
  272. package/backend/dist/esm/frontend/src/modules/request.js +0 -117
  273. package/backend/old/file_watcher.ts +0 -359
  274. package/backend/old/request.deprc.js +0 -626
  275. package/backend/old/response.deprc.js +0 -354
  276. package/frontend/dist/backend/src/database/collection.d.ts +0 -1765
  277. package/frontend/dist/backend/src/database/collection.js +0 -3779
  278. package/frontend/dist/backend/src/database/database.d.ts +0 -92
  279. package/frontend/dist/backend/src/database/database.js +0 -214
  280. package/frontend/dist/backend/src/database/filters/filters.d.ts +0 -6
  281. package/frontend/dist/backend/src/database/filters/filters.js +0 -1
  282. package/frontend/dist/backend/src/database/filters/strict_filter.d.ts +0 -223
  283. package/frontend/dist/backend/src/database/filters/strict_filter.js +0 -3
  284. package/frontend/dist/backend/src/database/filters/strict_update_filter.d.ts +0 -165
  285. package/frontend/dist/backend/src/database/filters/strict_update_filter.js +0 -5
  286. package/frontend/dist/backend/src/database/flatten.d.ts +0 -78
  287. package/frontend/dist/backend/src/database/flatten.js +0 -22
  288. package/frontend/dist/backend/src/endpoint.d.ts +0 -346
  289. package/frontend/dist/backend/src/endpoint.js +0 -479
  290. package/frontend/dist/backend/src/errors/index.d.ts +0 -7
  291. package/frontend/dist/backend/src/errors/index.js +0 -7
  292. package/frontend/dist/backend/src/errors/internal_external.d.ts +0 -52
  293. package/frontend/dist/backend/src/errors/internal_external.js +0 -86
  294. package/frontend/dist/backend/src/errors/invalid_usage_error.d.ts +0 -41
  295. package/frontend/dist/backend/src/errors/invalid_usage_error.js +0 -33
  296. package/frontend/dist/backend/src/errors/system_error.d.ts +0 -261
  297. package/frontend/dist/backend/src/errors/system_error.js +0 -444
  298. package/frontend/dist/backend/src/events.d.ts +0 -97
  299. package/frontend/dist/backend/src/events.js +0 -5
  300. package/frontend/dist/backend/src/frontend.d.ts +0 -11
  301. package/frontend/dist/backend/src/frontend.js +0 -12
  302. package/frontend/dist/backend/src/image_endpoint.d.ts +0 -44
  303. package/frontend/dist/backend/src/image_endpoint.js +0 -196
  304. package/frontend/dist/backend/src/meta.d.ts +0 -112
  305. package/frontend/dist/backend/src/meta.js +0 -152
  306. package/frontend/dist/backend/src/payments/paddle.d.ts +0 -329
  307. package/frontend/dist/backend/src/payments/paddle.js +0 -2276
  308. package/frontend/dist/backend/src/payments/stripe/checkout.d.ts +0 -113
  309. package/frontend/dist/backend/src/payments/stripe/checkout.js +0 -356
  310. package/frontend/dist/backend/src/payments/stripe/customers.d.ts +0 -17
  311. package/frontend/dist/backend/src/payments/stripe/customers.js +0 -193
  312. package/frontend/dist/backend/src/payments/stripe/error.d.ts +0 -74
  313. package/frontend/dist/backend/src/payments/stripe/error.js +0 -51
  314. package/frontend/dist/backend/src/payments/stripe/events.d.ts +0 -155
  315. package/frontend/dist/backend/src/payments/stripe/events.js +0 -5
  316. package/frontend/dist/backend/src/payments/stripe/meters.d.ts +0 -105
  317. package/frontend/dist/backend/src/payments/stripe/meters.js +0 -318
  318. package/frontend/dist/backend/src/payments/stripe/payment_methods.d.ts +0 -58
  319. package/frontend/dist/backend/src/payments/stripe/payment_methods.js +0 -135
  320. package/frontend/dist/backend/src/payments/stripe/products.d.ts +0 -519
  321. package/frontend/dist/backend/src/payments/stripe/products.js +0 -896
  322. package/frontend/dist/backend/src/payments/stripe/stripe.d.ts +0 -215
  323. package/frontend/dist/backend/src/payments/stripe/stripe.js +0 -464
  324. package/frontend/dist/backend/src/payments/stripe/subscriptions.d.ts +0 -172
  325. package/frontend/dist/backend/src/payments/stripe/subscriptions.js +0 -754
  326. package/frontend/dist/backend/src/payments/stripe/utils.d.ts +0 -63
  327. package/frontend/dist/backend/src/payments/stripe/utils.js +0 -131
  328. package/frontend/dist/backend/src/payments/stripe/webhooks.d.ts +0 -105
  329. package/frontend/dist/backend/src/payments/stripe/webhooks.js +0 -752
  330. package/frontend/dist/backend/src/plugins/mail/mail.d.ts +0 -255
  331. package/frontend/dist/backend/src/plugins/mail/mail.js +0 -396
  332. package/frontend/dist/backend/src/plugins/mail/ui.d.ts +0 -297
  333. package/frontend/dist/backend/src/plugins/mail/ui.js +0 -1400
  334. package/frontend/dist/backend/src/rate_limit.d.ts +0 -148
  335. package/frontend/dist/backend/src/rate_limit.js +0 -667
  336. package/frontend/dist/backend/src/route.d.ts +0 -39
  337. package/frontend/dist/backend/src/route.js +0 -222
  338. package/frontend/dist/backend/src/server.d.ts +0 -502
  339. package/frontend/dist/backend/src/server.js +0 -2034
  340. package/frontend/dist/backend/src/splash_screen.d.ts +0 -93
  341. package/frontend/dist/backend/src/splash_screen.js +0 -156
  342. package/frontend/dist/backend/src/status.d.ts +0 -89
  343. package/frontend/dist/backend/src/status.js +0 -213
  344. package/frontend/dist/backend/src/stream.d.ts +0 -494
  345. package/frontend/dist/backend/src/stream.js +0 -1611
  346. package/frontend/dist/backend/src/users.d.ts +0 -926
  347. package/frontend/dist/backend/src/users.js +0 -2423
  348. package/frontend/dist/backend/src/utils.d.ts +0 -22
  349. package/frontend/dist/backend/src/utils.js +0 -463
  350. package/frontend/dist/backend/src/view.d.ts +0 -115
  351. package/frontend/dist/backend/src/view.js +0 -584
  352. package/frontend/dist/frontend/src/elements/base.d.ts +0 -3743
  353. package/frontend/dist/frontend/src/elements/base.js +0 -12151
  354. package/frontend/dist/frontend/src/elements/module.d.ts +0 -95
  355. package/frontend/dist/frontend/src/elements/module.js +0 -216
  356. package/frontend/dist/frontend/src/elements/register_element.d.ts +0 -3
  357. package/frontend/dist/frontend/src/elements/register_element.js +0 -22
  358. package/frontend/dist/frontend/src/elements/resize_query_manager.d.ts +0 -0
  359. package/frontend/dist/frontend/src/elements/resize_query_manager.js +0 -150
  360. package/frontend/dist/frontend/src/elements/types.d.ts +0 -52
  361. package/frontend/dist/frontend/src/elements/types.js +0 -5
  362. package/frontend/dist/frontend/src/index.d.ts +0 -21
  363. package/frontend/dist/frontend/src/index.js +0 -29
  364. package/frontend/dist/frontend/src/modules/attachment.d.ts +0 -126
  365. package/frontend/dist/frontend/src/modules/attachment.js +0 -306
  366. package/frontend/dist/frontend/src/modules/auth.d.ts +0 -44
  367. package/frontend/dist/frontend/src/modules/auth.js +0 -80
  368. package/frontend/dist/frontend/src/modules/color.d.ts +0 -160
  369. package/frontend/dist/frontend/src/modules/color.js +0 -316
  370. package/frontend/dist/frontend/src/modules/compression.d.ts +0 -39
  371. package/frontend/dist/frontend/src/modules/compression.js +0 -102
  372. package/frontend/dist/frontend/src/modules/cookies.d.ts +0 -44
  373. package/frontend/dist/frontend/src/modules/cookies.js +0 -143
  374. package/frontend/dist/frontend/src/modules/events.d.ts +0 -31
  375. package/frontend/dist/frontend/src/modules/events.js +0 -79
  376. package/frontend/dist/frontend/src/modules/google.d.ts +0 -23
  377. package/frontend/dist/frontend/src/modules/google.js +0 -52
  378. package/frontend/dist/frontend/src/modules/meta.d.ts +0 -14
  379. package/frontend/dist/frontend/src/modules/meta.js +0 -48
  380. package/frontend/dist/frontend/src/modules/paddle.d.ts +0 -1207
  381. package/frontend/dist/frontend/src/modules/paddle.js +0 -2594
  382. package/frontend/dist/frontend/src/modules/request.d.ts +0 -70
  383. package/frontend/dist/frontend/src/modules/request.js +0 -117
  384. package/frontend/dist/frontend/src/modules/settings.d.ts +0 -3
  385. package/frontend/dist/frontend/src/modules/settings.js +0 -5
  386. package/frontend/dist/frontend/src/modules/statics.d.ts +0 -21
  387. package/frontend/dist/frontend/src/modules/statics.js +0 -43
  388. package/frontend/dist/frontend/src/modules/stripe/cart.d.ts +0 -112
  389. package/frontend/dist/frontend/src/modules/stripe/cart.js +0 -321
  390. package/frontend/dist/frontend/src/modules/stripe/checkout.d.ts +0 -7
  391. package/frontend/dist/frontend/src/modules/stripe/checkout.js +0 -37
  392. package/frontend/dist/frontend/src/modules/stripe/index.m.d.ts +0 -6
  393. package/frontend/dist/frontend/src/modules/stripe/index.m.js +0 -6
  394. package/frontend/dist/frontend/src/modules/stripe/payments.d.ts +0 -58
  395. package/frontend/dist/frontend/src/modules/stripe/payments.js +0 -92
  396. package/frontend/dist/frontend/src/modules/support.d.ts +0 -30
  397. package/frontend/dist/frontend/src/modules/support.js +0 -53
  398. package/frontend/dist/frontend/src/modules/theme.d.ts +0 -133
  399. package/frontend/dist/frontend/src/modules/theme.js +0 -406
  400. package/frontend/dist/frontend/src/modules/themes.d.ts +0 -12
  401. package/frontend/dist/frontend/src/modules/themes.js +0 -22
  402. package/frontend/dist/frontend/src/modules/user.d.ts +0 -164
  403. package/frontend/dist/frontend/src/modules/user.js +0 -270
  404. package/frontend/dist/frontend/src/modules/utils.d.ts +0 -176
  405. package/frontend/dist/frontend/src/modules/utils.js +0 -569
  406. package/frontend/dist/frontend/src/types/gradient.d.ts +0 -29
  407. package/frontend/dist/frontend/src/types/gradient.js +0 -79
  408. package/frontend/dist/frontend/src/ui/border_button.d.ts +0 -94
  409. package/frontend/dist/frontend/src/ui/border_button.js +0 -228
  410. package/frontend/dist/frontend/src/ui/button.d.ts +0 -241
  411. package/frontend/dist/frontend/src/ui/button.js +0 -682
  412. package/frontend/dist/frontend/src/ui/canvas.d.ts +0 -138
  413. package/frontend/dist/frontend/src/ui/canvas.js +0 -444
  414. package/frontend/dist/frontend/src/ui/checkbox.d.ts +0 -74
  415. package/frontend/dist/frontend/src/ui/checkbox.js +0 -321
  416. package/frontend/dist/frontend/src/ui/code.d.ts +0 -235
  417. package/frontend/dist/frontend/src/ui/code.js +0 -1007
  418. package/frontend/dist/frontend/src/ui/context_menu.d.ts +0 -36
  419. package/frontend/dist/frontend/src/ui/context_menu.js +0 -205
  420. package/frontend/dist/frontend/src/ui/css.d.ts +0 -16
  421. package/frontend/dist/frontend/src/ui/css.js +0 -48
  422. package/frontend/dist/frontend/src/ui/divider.d.ts +0 -15
  423. package/frontend/dist/frontend/src/ui/divider.js +0 -78
  424. package/frontend/dist/frontend/src/ui/dropdown.d.ts +0 -176
  425. package/frontend/dist/frontend/src/ui/dropdown.js +0 -481
  426. package/frontend/dist/frontend/src/ui/for_each.d.ts +0 -37
  427. package/frontend/dist/frontend/src/ui/for_each.js +0 -92
  428. package/frontend/dist/frontend/src/ui/form.d.ts +0 -34
  429. package/frontend/dist/frontend/src/ui/form.js +0 -233
  430. package/frontend/dist/frontend/src/ui/frame_modes.d.ts +0 -37
  431. package/frontend/dist/frontend/src/ui/frame_modes.js +0 -108
  432. package/frontend/dist/frontend/src/ui/google_map.d.ts +0 -24
  433. package/frontend/dist/frontend/src/ui/google_map.js +0 -106
  434. package/frontend/dist/frontend/src/ui/gradient.d.ts +0 -25
  435. package/frontend/dist/frontend/src/ui/gradient.js +0 -131
  436. package/frontend/dist/frontend/src/ui/image.d.ts +0 -111
  437. package/frontend/dist/frontend/src/ui/image.js +0 -576
  438. package/frontend/dist/frontend/src/ui/input.d.ts +0 -392
  439. package/frontend/dist/frontend/src/ui/input.js +0 -1201
  440. package/frontend/dist/frontend/src/ui/link.d.ts +0 -25
  441. package/frontend/dist/frontend/src/ui/link.js +0 -140
  442. package/frontend/dist/frontend/src/ui/list.d.ts +0 -37
  443. package/frontend/dist/frontend/src/ui/list.js +0 -170
  444. package/frontend/dist/frontend/src/ui/loader_button.d.ts +0 -80
  445. package/frontend/dist/frontend/src/ui/loader_button.js +0 -193
  446. package/frontend/dist/frontend/src/ui/loaders.d.ts +0 -57
  447. package/frontend/dist/frontend/src/ui/loaders.js +0 -157
  448. package/frontend/dist/frontend/src/ui/popup.d.ts +0 -94
  449. package/frontend/dist/frontend/src/ui/popup.js +0 -510
  450. package/frontend/dist/frontend/src/ui/pseudo.d.ts +0 -44
  451. package/frontend/dist/frontend/src/ui/pseudo.js +0 -154
  452. package/frontend/dist/frontend/src/ui/scroller.d.ts +0 -105
  453. package/frontend/dist/frontend/src/ui/scroller.js +0 -1253
  454. package/frontend/dist/frontend/src/ui/slider.d.ts +0 -45
  455. package/frontend/dist/frontend/src/ui/slider.js +0 -217
  456. package/frontend/dist/frontend/src/ui/spacer.d.ts +0 -15
  457. package/frontend/dist/frontend/src/ui/spacer.js +0 -78
  458. package/frontend/dist/frontend/src/ui/span.d.ts +0 -15
  459. package/frontend/dist/frontend/src/ui/span.js +0 -73
  460. package/frontend/dist/frontend/src/ui/stack.d.ts +0 -66
  461. package/frontend/dist/frontend/src/ui/stack.js +0 -335
  462. package/frontend/dist/frontend/src/ui/steps.d.ts +0 -131
  463. package/frontend/dist/frontend/src/ui/steps.js +0 -308
  464. package/frontend/dist/frontend/src/ui/style.d.ts +0 -17
  465. package/frontend/dist/frontend/src/ui/style.js +0 -73
  466. package/frontend/dist/frontend/src/ui/switch.d.ts +0 -69
  467. package/frontend/dist/frontend/src/ui/switch.js +0 -357
  468. package/frontend/dist/frontend/src/ui/table.d.ts +0 -100
  469. package/frontend/dist/frontend/src/ui/table.js +0 -405
  470. package/frontend/dist/frontend/src/ui/tabs.d.ts +0 -111
  471. package/frontend/dist/frontend/src/ui/tabs.js +0 -424
  472. package/frontend/dist/frontend/src/ui/text.d.ts +0 -15
  473. package/frontend/dist/frontend/src/ui/text.js +0 -83
  474. package/frontend/dist/frontend/src/ui/title.d.ts +0 -91
  475. package/frontend/dist/frontend/src/ui/title.js +0 -272
  476. package/frontend/dist/frontend/src/ui/ui.d.ts +0 -35
  477. package/frontend/dist/frontend/src/ui/ui.js +0 -38
  478. package/frontend/dist/frontend/src/ui/view.d.ts +0 -15
  479. package/frontend/dist/frontend/src/ui/view.js +0 -88
  480. package/frontend/dist/frontend/src/volt.d.ts +0 -20
  481. package/frontend/dist/frontend/src/volt.js +0 -27
  482. package/frontend/examples/theme/theme.ts +0 -58
  483. package/frontend/tools/bundle_d_ts.js +0 -71
  484. package/frontend/tools/convert_to_jsdoc_input.txt +0 -9452
  485. package/frontend/tools/convert_to_jsdoc_output.txt +0 -7626
  486. package/frontend/tools/convert_to_jsdoc_tmp.js +0 -345
  487. package/frontend/tools/scan_mixed_imports.js +0 -69
  488. /package/frontend/{dist/frontend/src/css → css}/adyen.css +0 -0
  489. /package/frontend/{dist/frontend/src/css → css}/volt.css +0 -0
@@ -1,113 +0,0 @@
1
- /**
2
- * @author Daan van den Bergh
3
- * @copyright © 2026 - 2026 Daan van den Bergh. All rights reserved
4
- */
5
- import Stripe from "stripe";
6
- import { type InitializedOneTimeProduct, type InitializedProduct, type InitializedSubscriptionPlan, type InitializedMeterProduct, SubscriptionPlanId, ProductId } from "./products.js";
7
- import { Server } from "../../server.js";
8
- /**
9
- * A checkout line item input accepted by our API.
10
- */
11
- export interface CreateCheckoutLineItem {
12
- /** Product reference: initialized product/plan object OR an id string. */
13
- product: InitializedOneTimeProduct | InitializedSubscriptionPlan | ProductId | SubscriptionPlanId;
14
- /** Quantity to purchase/subscribe with. */
15
- quantity: number;
16
- }
17
- /**
18
- * Options for creating a Stripe Checkout Session.
19
- */
20
- export interface CreateCheckoutSessionOpts {
21
- /**
22
- * The internal user id, used to resolve/ensure Stripe customer.
23
- * The `uid` may be undefined for one-time payment checkouts, but must be defined for subscription checkouts since a Stripe Customer is required. In that case, the user must be authenticated and not "anonymous".
24
- */
25
- uid: string | undefined;
26
- /**
27
- * A caller-provided idempotency key for initialize/start.
28
- * Re-using the same session_id makes `start_checkout_session` idempotent across retries.
29
- */
30
- session_id: string;
31
- /** Items to purchase/subscribe to. */
32
- line_items: CreateCheckoutLineItem[];
33
- /** All initialized products, used to resolve string ids to objects. */
34
- all_products: InitializedProduct[];
35
- /** Where Stripe should redirect after successful payment. */
36
- success_url: string;
37
- /** Where Stripe should redirect when the customer cancels. */
38
- cancel_url: string;
39
- /** Optional: require tax id collection (useful for B2B in EU). */
40
- tax_id_collection_enabled?: boolean;
41
- /** The allowed hosts for redirect URLs. */
42
- allowed_hosts: undefined | string[];
43
- }
44
- /**
45
- * A minimal response payload for a created Checkout Session.
46
- */
47
- export interface CreatedCheckoutSession {
48
- /** The Stripe Checkout Session id. */
49
- id: string;
50
- /** The hosted Checkout URL (only for hosted sessions). */
51
- url: string;
52
- /** The Checkout mode used. */
53
- mode: "payment" | "subscription";
54
- /** Currency used for the session. */
55
- currency: string;
56
- }
57
- /**
58
- * Options for creating a metered Stripe Subscription (MeterProduct).
59
- *
60
- * This is intentionally separate from Checkout because Stripe Checkout is not always
61
- * a good fit for usage-based billing flows where you want to subscribe a customer
62
- * immediately and bill later based on meter events.
63
- */
64
- export interface CreateMeterSubscriptionOpts {
65
- /** The internal user id, used to resolve/ensure Stripe customer. */
66
- uid: string;
67
- /**
68
- * A caller-provided idempotency key.
69
- * Re-using the same subscription_id makes `create_meter_subscription` idempotent across retries.
70
- */
71
- subscription_id: string;
72
- /** The meter product reference: initialized object OR an id string. */
73
- meter_product: InitializedMeterProduct | string;
74
- /** All initialized products, used to resolve string ids to objects. */
75
- all_products: InitializedProduct[];
76
- }
77
- /**
78
- * A minimal response payload for a created metered subscription.
79
- */
80
- export interface CreatedMeterSubscription {
81
- /** The Stripe Subscription id. */
82
- id: string;
83
- /**
84
- * The Stripe Subscription status.
85
- * Note: We only return "active" or "trialing" for success; "incomplete" can be returned when action is required.
86
- */
87
- status: Stripe.Subscription.Status;
88
- /**
89
- * When action is required, Stripe returns a PaymentIntent client_secret.
90
- * This is safe to return to the client to complete SCA/3DS flows.
91
- */
92
- latest_invoice_payment_intent_client_secret?: string;
93
- /** The subscribed meter product id (our internal product id). */
94
- product_id: string;
95
- /** The Stripe price id used by the subscription item. */
96
- stripe_price_id: string;
97
- }
98
- /**
99
- * Create a new session id to ensure idempotency for checkout session creation.
100
- */
101
- export declare function create_checkout_session_id(uid: string | undefined): string;
102
- /**
103
- * Start a Stripe Checkout Session for the provided items.
104
- *
105
- * Stripe docs:
106
- * - Create session: https://docs.stripe.com/api/checkout/sessions/create
107
- * - Mixed cart (subscription + one-time): https://docs.stripe.com/payments/checkout/how-checkout-works
108
- * - Stripe Tax for Checkout: https://docs.stripe.com/tax/checkout
109
- *
110
- * @warning Only one subscription plan per checkout session is supported, due to later subscription cancellation restrictions.
111
- * @warning If subscription mode is used, subscription-level settings (`billing_anchor`, `trial_days`) must be unambiguous.
112
- */
113
- export declare function start_checkout_session(client: Stripe, server: Server, opts: CreateCheckoutSessionOpts): Promise<CreatedCheckoutSession>;
@@ -1,356 +0,0 @@
1
- /**
2
- * @author Daan van den Bergh
3
- * @copyright © 2026 - 2026 Daan van den Bergh. All rights reserved
4
- */
5
- import * as vlib from "@vandenberghinc/vlib";
6
- import { resolve_plan_to_parent_subscription, } from "./products.js";
7
- import { ensure_stripe_customer } from "./customers.js";
8
- import { ExternalStripeError, InternalStripeError } from "./error.js";
9
- import { assert, public_assert, stripe_api_call, add_days_utc, first_day_of_next_month_utc, to_unix_seconds, is_non_empty_string, generate_random_idempotency_key, stable_idempotency_key, } from "./utils.js";
10
- import { Collection } from "../../database/collection.js";
11
- import { is_user_subscribed_to } from "./subscriptions.js";
12
- // ----------------------------------------------------------------------------------
13
- // Internal helpers.
14
- /**
15
- * Resolve a product reference (object or id string) into an initialized purchasable item.
16
- *
17
- * Note: Passing a subscription *product id* is ambiguous (it can have multiple plans),
18
- * so we reject it with a user-visible error.
19
- */
20
- function resolve_checkout_item_product(opts) {
21
- const { product_ref, all_products } = opts;
22
- // Fast path: already a concrete initialized object.
23
- if (typeof product_ref !== "string") {
24
- return product_ref;
25
- }
26
- public_assert(is_non_empty_string(product_ref), "checkout_invalid_product_ref", "Invalid product reference.", { product_ref_type: typeof product_ref });
27
- const ref_id = product_ref.trim();
28
- // 1) Try matching a one-time product by product id.
29
- for (const product of all_products) {
30
- if (product.type === "one_time" && product.id === ref_id) {
31
- return product;
32
- }
33
- }
34
- // 2) Try matching a subscription plan by plan id across all subscription products.
35
- const matching_plans = [];
36
- for (const product of all_products) {
37
- if (product.type !== "subscription") {
38
- continue;
39
- }
40
- for (const plan of product.plans) {
41
- if (plan.id === ref_id) {
42
- matching_plans.push(plan);
43
- }
44
- }
45
- // If the caller passed a subscription product id, that is ambiguous by definition.
46
- if (product.id === ref_id) {
47
- throw new ExternalStripeError("checkout_subscription_plan_ambiguous", "Subscription product id is ambiguous. Please specify a subscription plan id.", { ref_id: ref_id });
48
- }
49
- }
50
- public_assert(matching_plans.length === 1, matching_plans.length === 0 ? "checkout_invalid_product_ref" : "checkout_subscription_plan_ambiguous", matching_plans.length === 0
51
- ? "Unknown product reference."
52
- : "Ambiguous subscription plan reference. Plan id must be unique across products.", { ref_id, matches: matching_plans.length });
53
- const plan = matching_plans[0];
54
- assert(plan !== undefined, "checkout_invalid_product_ref", "Missing plan after plan resolution.", { ref_id });
55
- return plan;
56
- }
57
- /**
58
- * Create the checkout session database collection.
59
- * The collection is only initialized on the first call and the cached collection is returned afterwards.
60
- */
61
- function create_checkout_session_db(server) {
62
- // Initialize the database connection.
63
- return server.db.collection({
64
- name: "Volt.Stripe.CheckoutSessions",
65
- indexes: [
66
- {
67
- keys: { session_id: 1 },
68
- unique: true,
69
- },
70
- {
71
- keys: { uid: 1 },
72
- unique: false, // since it might be undefined/anonymous
73
- },
74
- ],
75
- ttl: {
76
- milliseconds: 1000 * 60 * 60 * 24, // 24 hours
77
- sliding: false,
78
- },
79
- // Ensure its not unique so we retrieve the cached collection if already created.
80
- unique: false,
81
- });
82
- }
83
- /**
84
- * Assert a success_url or cancel_url is a valid https URL.
85
- */
86
- function assert_https_url(raw, field, allowed_hosts) {
87
- public_assert(is_non_empty_string(raw), "invalid_argument", `Property '${field}' must be provided.`);
88
- let url;
89
- try {
90
- url = new URL(raw);
91
- }
92
- catch {
93
- throw new ExternalStripeError("invalid_argument", `Property '${field}' must be a valid absolute URL.`, { field });
94
- }
95
- public_assert(url.protocol === "https:", "invalid_argument", `Property '${field}' must use https.`, { field });
96
- public_assert(allowed_hosts === undefined || allowed_hosts.includes(url.host), "invalid_argument", `Property '${field}' must use an allowed host.`, { field, host: url.host });
97
- }
98
- // ----------------------------------------------------------------------------------
99
- // Public API
100
- /**
101
- * Create a new session id to ensure idempotency for checkout session creation.
102
- */
103
- export function create_checkout_session_id(uid) {
104
- return generate_random_idempotency_key(`checkout_${uid ?? "anonymous"}`, 255);
105
- }
106
- /**
107
- * Start a Stripe Checkout Session for the provided items.
108
- *
109
- * Stripe docs:
110
- * - Create session: https://docs.stripe.com/api/checkout/sessions/create
111
- * - Mixed cart (subscription + one-time): https://docs.stripe.com/payments/checkout/how-checkout-works
112
- * - Stripe Tax for Checkout: https://docs.stripe.com/tax/checkout
113
- *
114
- * @warning Only one subscription plan per checkout session is supported, due to later subscription cancellation restrictions.
115
- * @warning If subscription mode is used, subscription-level settings (`billing_anchor`, `trial_days`) must be unambiguous.
116
- */
117
- export async function start_checkout_session(client, server, opts) {
118
- // Basic validation (external/user-facing where appropriate).
119
- public_assert(is_non_empty_string(opts.session_id), "invalid_argument", "Property 'session_id' must be a non-empty string when provided.");
120
- public_assert(Array.isArray(opts.line_items) && opts.line_items.length > 0, "invalid_argument", "Property 'line_items' must be a non-empty array.");
121
- public_assert(opts.line_items.length <= 50, "invalid_argument", "Too many line items.", { count: opts.line_items.length });
122
- assert(Array.isArray(opts.all_products), "invalid_argument", "Property 'all_products' must be an array.");
123
- assert_https_url(opts.success_url, "success_url", opts.allowed_hosts);
124
- assert_https_url(opts.cancel_url, "cancel_url", opts.allowed_hosts);
125
- // Resolve all item product references into concrete purchasable objects.
126
- const resolved_items = opts.line_items.map((item, index) => {
127
- public_assert(Number.isInteger(item.quantity) && item.quantity >= 1, "checkout_invalid_quantity", "Quantity must be an integer >= 1.", { index, quantity: item.quantity });
128
- const resolved_product = resolve_checkout_item_product({
129
- product_ref: item.product,
130
- all_products: opts.all_products,
131
- });
132
- // Validate quantity rules.
133
- if (resolved_product.type === "one_time" && resolved_product.quantity_rules) {
134
- if (resolved_product.quantity_rules.min !== undefined) {
135
- public_assert(item.quantity >= resolved_product.quantity_rules.min, "checkout_invalid_quantity", "Quantity is below the minimum allowed.", { product_id: resolved_product.id, quantity: item.quantity, min: resolved_product.quantity_rules.min });
136
- }
137
- if (resolved_product.quantity_rules.max !== undefined) {
138
- public_assert(item.quantity <= resolved_product.quantity_rules.max, "checkout_invalid_quantity", "Quantity is above the maximum allowed.", { product_id: resolved_product.id, quantity: item.quantity, max: resolved_product.quantity_rules.max });
139
- }
140
- }
141
- // Validate subscription.
142
- if (resolved_product.type === "subscription_plan") {
143
- // Subscriptions are not seat-based in our model; quantity for subscription plans must be 1.
144
- public_assert(item.quantity === 1, "checkout_invalid_quantity", "Quantity must be 1 for subscription plans.", { plan_id: resolved_product.id, quantity: item.quantity });
145
- }
146
- return {
147
- product: resolved_product,
148
- quantity: item.quantity,
149
- };
150
- });
151
- // Enforce: a Checkout Session may contain at most one subscription plan.
152
- //
153
- // Reason: Stripe Checkout creates exactly one Subscription per session in `mode="subscription"`,
154
- // and every recurring line item becomes a Subscription Item on that single Subscription.
155
- // Therefore, multiple `subscription_plan` items would create a multi-item subscription, which we forbid.
156
- // Since we need to cancel a subscription as a whole in Stripe, allowing multiple plans would also
157
- // cancel multiple plans when the user only meant to cancel one, which would be a bad experience.
158
- //
159
- // Stripe docs: https://docs.stripe.com/api/checkout/sessions/create
160
- let subscription_plan_count = 0;
161
- let selected_plan_id;
162
- let selected_subscription_id;
163
- for (const item of resolved_items) {
164
- if (item.product.type !== "subscription_plan") {
165
- continue;
166
- }
167
- subscription_plan_count += 1;
168
- // Capture for safe debug context.
169
- selected_plan_id = item.product.id;
170
- selected_subscription_id = item.product.subscription_id;
171
- public_assert(subscription_plan_count === 1, "checkout_subscription_plan_ambiguous", "Only one subscription plan can be purchased per checkout session.", {
172
- selected_plan_id,
173
- selected_subscription_id,
174
- subscription_plan_count,
175
- });
176
- // Ensure uid is defined.
177
- public_assert(opts.uid != null && opts.uid !== "anonymous", "invalid_uid", "You must be authenticated to purchase a subscription, sign in or sign up and try again.", { uid: opts.uid });
178
- // Ensure the user is not already subscribed to the plan.
179
- const is_already_subscribed = await is_user_subscribed_to(client, server, {
180
- uid: opts.uid,
181
- plan: item.product,
182
- all_products: opts.all_products,
183
- customer_id: undefined,
184
- });
185
- public_assert(!is_already_subscribed, "checkout_already_subscribed", "You are already subscribed to this plan.", { uid: opts.uid, plan_id: item.product.id, subscription_id: item.product.subscription_id });
186
- }
187
- // Determine mode (Stripe requires subscription mode if any recurring item is present).
188
- const has_subscription_item = resolved_items.some((item) => item.product.type === "subscription_plan");
189
- const mode = has_subscription_item ? "subscription" : "payment";
190
- // Enforce single-currency checkouts (Stripe Checkout sessions are single-currency).
191
- const currencies = new Set();
192
- for (const item of resolved_items) {
193
- if (item.product.type === "subscription_plan") {
194
- const parent_subscription = resolve_plan_to_parent_subscription({
195
- plan: item.product,
196
- all_products: opts.all_products,
197
- });
198
- currencies.add(parent_subscription.currency);
199
- }
200
- else {
201
- currencies.add(item.product.currency);
202
- }
203
- }
204
- public_assert(currencies.size === 1, "checkout_mixed_currency", "All checkout items must use the same currency.", { currencies: Array.from(currencies.values()) });
205
- const currency = Array.from(currencies.values())[0];
206
- assert(currency !== undefined, "checkout_mixed_currency", "Missing currency after currency validation.");
207
- // If mode is subscription, ensure the `uid` is defined.
208
- // And retrieve the stripe customer id.
209
- // For one-time payments, creating a Customer is optional; avoid extra API calls unless you need it.
210
- let stripe_customer_id;
211
- if (mode === "subscription" || opts.uid) {
212
- public_assert(opts.uid != null && opts.uid !== "anonymous", "invalid_uid", "You must be authenticated to purchase a subscription, sign in or sign up and try again.", { uid: opts.uid });
213
- public_assert(is_non_empty_string(opts.uid), "invalid_argument", "Property 'uid' must be a non-empty string.");
214
- stripe_customer_id = await ensure_stripe_customer(client, server, opts.uid);
215
- }
216
- // Build Stripe line items.
217
- const stripe_line_items = resolved_items.map((item) => {
218
- // We only use pre-created Price ids to avoid “inline price” pitfalls and keep tax behavior stable.
219
- // Stripe docs: line_items.price https://docs.stripe.com/api/checkout/sessions/create
220
- public_assert(is_non_empty_string(item.product.stripe_price_id), "invalid_product", "Product is missing a Stripe price id.", { product_id: item.product.id, type: item.product.type });
221
- return {
222
- price: item.product.stripe_price_id,
223
- quantity: item.quantity,
224
- };
225
- });
226
- // Subscription-specific settings (trial_days + billing_anchor).
227
- let subscription_data;
228
- if (mode === "subscription") {
229
- // Collect the subscription-level settings from each subscription product referenced.
230
- // Note: Stripe creates a single Subscription object for the Checkout Session, so
231
- // these settings must be coherent across all subscription products in the cart.
232
- const trial_days_values = new Set();
233
- const billing_anchor_values = new Set();
234
- for (const item of resolved_items) {
235
- if (item.product.type !== "subscription_plan") {
236
- continue;
237
- }
238
- const parent_subscription = resolve_plan_to_parent_subscription({
239
- plan: item.product,
240
- all_products: opts.all_products,
241
- });
242
- if (parent_subscription.trial_days !== undefined) {
243
- trial_days_values.add(parent_subscription.trial_days);
244
- }
245
- // Default was set during initialization, but we still guard.
246
- const anchor = parent_subscription.billing_anchor ?? "immediately";
247
- billing_anchor_values.add(anchor);
248
- }
249
- // If multiple different trial_days or anchors exist, it is ambiguous which to apply.
250
- public_assert(trial_days_values.size <= 1, "invalid_product", "Conflicting 'trial_days' across subscription products in the same checkout.", { trial_days_values: Array.from(trial_days_values.values()) });
251
- public_assert(billing_anchor_values.size <= 1, "invalid_product", "Conflicting 'billing_anchor' across subscription products in the same checkout.", { billing_anchor_values: Array.from(billing_anchor_values.values()) });
252
- const trial_days = Array.from(trial_days_values.values())[0];
253
- const billing_anchor = Array.from(billing_anchor_values.values())[0] ?? "immediately";
254
- subscription_data = {};
255
- // Apply trial days, if configured.
256
- if (trial_days !== undefined) {
257
- subscription_data.trial_period_days = trial_days;
258
- }
259
- // Apply billing anchor strategy, if requested.
260
- if (billing_anchor === "first_of_month") {
261
- // We anchor to the first day of the next month *after the trial ends* (or after “now” if no trial).
262
- // This avoids Stripe rejecting an anchor that is earlier than the first invoice timing in practice.
263
- // Stripe docs: subscription_data.billing_cycle_anchor and proration_behavior.
264
- const now = new Date();
265
- const trial_end_reference = trial_days !== undefined ? add_days_utc(now, trial_days) : now;
266
- const anchor_date = first_day_of_next_month_utc(trial_end_reference);
267
- subscription_data.billing_cycle_anchor = to_unix_seconds(anchor_date);
268
- subscription_data.proration_behavior = "none";
269
- }
270
- else if (billing_anchor === "immediately") {
271
- // Default behavior: Stripe anchors to creation time (or trial end when a trial is set).
272
- }
273
- else {
274
- // Exhaustive safety for future anchor variants.
275
- throw new InternalStripeError("invalid_product", "Unsupported billing_anchor value.", { billing_anchor });
276
- }
277
- // Include safe metadata on the Subscription object for downstream reconciliation (optional).
278
- if (opts.uid) {
279
- subscription_data.metadata = {
280
- __volt_uid: opts.uid,
281
- };
282
- }
283
- }
284
- // Build Checkout Session request.
285
- const create_params = {
286
- // Docs: https://docs.stripe.com/api/checkout/sessions/create
287
- mode,
288
- ...(stripe_customer_id ? { customer: stripe_customer_id } : {}),
289
- success_url: opts.success_url,
290
- cancel_url: opts.cancel_url,
291
- line_items: stripe_line_items,
292
- customer_update: {
293
- address: "auto",
294
- name: "auto",
295
- shipping: "auto",
296
- },
297
- // Stripe Tax: collect address automatically for tax calculation.
298
- // Docs: https://docs.stripe.com/tax/checkout
299
- automatic_tax: { enabled: true },
300
- // Optional: tax id collection is helpful for B2B scenarios (e.g. VAT).
301
- ...(opts.tax_id_collection_enabled === true ? { tax_id_collection: { enabled: true } } : {}),
302
- // Attach safe session metadata (not secrets).
303
- metadata: {
304
- ...(opts.uid ? { __volt_uid: opts.uid } : {}),
305
- __volt_mode: mode,
306
- },
307
- // Include subscription configuration only in subscription mode.
308
- ...(subscription_data ? { subscription_data } : {}),
309
- };
310
- // Initialize the record collection.
311
- const checkout_session_db = create_checkout_session_db(server);
312
- // Check if a session record already exists.
313
- // If so then we need to assert the create_params and currency are the same to ensure idempotency.
314
- const loaded_session = await checkout_session_db.load({ session_id: opts.session_id }, { throw: false, retry: 3 });
315
- let pinned_session;
316
- if (loaded_session instanceof Collection.NotFoundError) {
317
- // No existing session, proceed to create a new one.
318
- const record = {
319
- uid: opts.uid,
320
- session_id: opts.session_id,
321
- currency,
322
- create_params,
323
- };
324
- await checkout_session_db.set({ session_id: opts.session_id }, record, { throw: true, retry: 3 });
325
- pinned_session = record;
326
- }
327
- // Another error.
328
- else if (loaded_session instanceof Error) {
329
- throw new InternalStripeError("checkout_create_error", "Failed to access checkout session record.", { uid: opts.uid, session_id: opts.session_id }, loaded_session);
330
- }
331
- // Compare the existing session's create_params and currency with the current ones to ensure idempotency.
332
- else {
333
- if (loaded_session.currency !== currency
334
- || !vlib.Object.deep_eq(loaded_session.create_params, create_params)) {
335
- throw new ExternalStripeError("checkout_create_error", "A checkout session with the same session_id already exists with different parameters. Please use a unique session_id for each distinct checkout session.", { uid: opts.uid, session_id: opts.session_id });
336
- }
337
- pinned_session = loaded_session;
338
- }
339
- // Create session.
340
- // We use stripe_api_call to consistently throw InternalStripeError on Stripe API failures.
341
- // Docs: https://docs.stripe.com/api/checkout/sessions/create
342
- const session = await stripe_api_call(() => client.checkout.sessions.create(pinned_session.create_params, {
343
- idempotencyKey: stable_idempotency_key(`checkout.sessions.create:${pinned_session.session_id}`, 255),
344
- }), { operation: "checkout.sessions.create" });
345
- // The hosted URL is required for redirect-based Checkout.
346
- // If your integration uses embedded/custom UI mode later, you’d return client_secret instead.
347
- public_assert(is_non_empty_string(session.url), "checkout_create_error", "Stripe did not return a checkout URL.", { session_id: session.id, mode: session.mode });
348
- // Stripe returns `mode` as a string; we normalize to our union type.
349
- const session_mode = session.mode === "subscription" ? "subscription" : "payment";
350
- return {
351
- id: session.id,
352
- url: session.url,
353
- mode: session_mode,
354
- currency: pinned_session.currency,
355
- };
356
- }
@@ -1,17 +0,0 @@
1
- /**
2
- * @author Daan van den Bergh
3
- * @copyright © 2026 - 2026 Daan van den Bergh. All rights reserved
4
- */
5
- import Stripe from "stripe";
6
- import { Server } from "../../server.js";
7
- /**
8
- * Ensure a Stripe customer exists for the given `uid`.
9
- * @returns The Stripe customer ID. If a customer already exists for the `uid`, it is returned. Otherwise, a new customer is created and its ID is returned.
10
- */
11
- export declare function ensure_stripe_customer(client: Stripe, server: Server, uid: string): Promise<string>;
12
- /**
13
- * Delete a Stripe customer by their `uid`.
14
- * This operation is best-effort and idempotent: if no Stripe customer exists for the `uid`, it returns without error.
15
- * @see https://docs.stripe.com/api/customers/delete
16
- */
17
- export declare function delete_stripe_customer(client: Stripe, server: Server, uid: string): Promise<void>;