@vandenberghinc/volt 1.2.4 → 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 +6 -2
  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,754 +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 { ExternalStripeError, InternalStripeError } from "./error.js";
7
- import { ensure_stripe_customer } from "./customers.js";
8
- import { assert, public_assert, stripe_api_call, is_non_empty_string, stable_idempotency_key } from "./utils.js";
9
- import { Collection } from "../../database/collection.js";
10
- // ----------------------------------------------------------------------------
11
- // Caching.
12
- /**
13
- * Cache for loading the subscription record of a user.
14
- *
15
- * This is a short lived cache for hot paths,
16
- * since changes accross multiple forks & multi-load server
17
- * are not persisted to this cache.
18
- */
19
- const subscription_record_cache = new vlib.Cache({
20
- max_size: 250_000,
21
- ttl: {
22
- sliding: true,
23
- // Short lived cache, see docstring why
24
- duration: 1000 * 60 * 5,
25
- },
26
- });
27
- /**
28
- * List all subscriptions for a user.
29
- *
30
- * We do not use any caching here by design, dont change this since it will break current implementations.
31
- *
32
- * Stripe docs:
33
- * - List subscriptions: https://docs.stripe.com/api/subscriptions/list
34
- * - Expand: https://docs.stripe.com/expand
35
- */
36
- async function list_all_customer_subscriptions(client, server, uid, customer_id) {
37
- /** Validate input early to avoid cache poisoning with ambiguous keys. */
38
- assert(uid.trim().length > 0, "invalid_argument", "Uid must be a non-empty string.", { uid });
39
- // Ensure customer.
40
- const ensured_customer_id = customer_id ?? await ensure_stripe_customer(client, server, uid);
41
- // Fetch subscriptions.
42
- const subscriptions = [];
43
- let starting_after;
44
- for (;;) {
45
- const page = await stripe_api_call(() => client.subscriptions.list({
46
- customer: ensured_customer_id,
47
- status: "all",
48
- limit: 100,
49
- starting_after,
50
- // ALWAYS expand, since the callee's expect this.
51
- expand: ["data.items.data.price"],
52
- }), { operation: "subscriptions.list", customer_id: ensured_customer_id, starting_after });
53
- subscriptions.push(...page.data);
54
- if (!page.has_more || page.data.length === 0) {
55
- break;
56
- }
57
- const last = page.data[page.data.length - 1];
58
- assert(last !== undefined, "api_error", "Stripe subscriptions pagination returned an empty last item.", {
59
- customer_id: ensured_customer_id,
60
- returned: page.data.length,
61
- });
62
- starting_after = last.id;
63
- }
64
- return subscriptions;
65
- }
66
- /**
67
- * Resolve the parent subscription product for a plan.
68
- * This is needed to apply subscription-level rules (trial_days, billing_anchor).
69
- */
70
- function resolve_plan_parent_subscription(opts) {
71
- for (const product of opts.all_products) {
72
- if (product.type === "subscription" && product.id === opts.plan.subscription_id) {
73
- return product;
74
- }
75
- }
76
- // If we cannot find it, this indicates a corrupted initialization state.
77
- throw new InternalStripeError("invalid_product", "Subscription plan refers to a missing parent subscription product.", { plan_id: opts.plan.id, subscription_id: opts.plan.subscription_id });
78
- }
79
- /**
80
- * Retrieve a Stripe customer and safely resolve the default payment method id for invoices/subscriptions.
81
- *
82
- * Stripe docs:
83
- * - Retrieve customer: https://docs.stripe.com/api/customers/retrieve
84
- * - invoice_settings.default_payment_method: https://docs.stripe.com/api/customers/object#customer_object-invoice_settings
85
- */
86
- async function resolve_default_payment_method_id(client, opts) {
87
- // We expand default_payment_method so we can always read `.id` without extra requests.
88
- const customer = await stripe_api_call(() => client.customers.retrieve(opts.stripe_customer_id, {
89
- expand: ["invoice_settings.default_payment_method"],
90
- }), { operation: "customers.retrieve", uid: opts.uid, stripe_customer_id: opts.stripe_customer_id });
91
- // Stripe can return DeletedCustomer; we must never proceed if the customer is deleted.
92
- public_assert(customer.deleted !== true, "customer_not_found", "Stripe customer was not found.", { uid: opts.uid, stripe_customer_id: opts.stripe_customer_id });
93
- // We avoid any unsafe casts by narrowing through `unknown` and structural checks.
94
- const invoice_settings = customer.invoice_settings;
95
- const default_payment_method = invoice_settings?.default_payment_method;
96
- // invoice_settings.default_payment_method is string | PaymentMethod | null.
97
- if (typeof default_payment_method === "string") {
98
- return default_payment_method;
99
- }
100
- if (default_payment_method && typeof default_payment_method === "object") {
101
- const id = default_payment_method.id;
102
- if (typeof id === "string" && id.trim().length > 0) {
103
- return id;
104
- }
105
- }
106
- // User-facing: without a default payment method, we cannot bill off-session securely.
107
- throw new ExternalStripeError("payment_method_missing", "No default payment method on file. Please add a payment method before subscribing.", { uid: opts.uid, stripe_customer_id: opts.stripe_customer_id });
108
- }
109
- /**
110
- * Extract a PaymentIntent from an expanded subscription.latest_invoice.payment_intent.
111
- *
112
- * Stripe docs:
113
- * - Subscription object: https://docs.stripe.com/api/subscriptions/object
114
- * - Invoice.payment_intent: https://docs.stripe.com/api/invoices/object#invoice_object-payment_intent
115
- * - PaymentIntent statuses: https://docs.stripe.com/api/payment_intents/object#payment_intent_object-status
116
- */
117
- function resolve_payment_intent_from_subscription(subscription) {
118
- const latest_invoice = subscription.latest_invoice;
119
- // latest_invoice is string | Invoice | null.
120
- if (!latest_invoice || typeof latest_invoice === "string") {
121
- return null;
122
- }
123
- const payment_intent = latest_invoice.payment_intent;
124
- // payment_intent is string | PaymentIntent | null.
125
- if (!payment_intent || typeof payment_intent === "string") {
126
- return null;
127
- }
128
- return payment_intent;
129
- }
130
- /**
131
- * Build SubscriptionCreateParams.SubscriptionData from our initialized product configuration.
132
- */
133
- function build_subscription_create_params_from_product(opts) {
134
- const parent = opts.parent_subscription;
135
- const subscription_params = {
136
- // Safe metadata for reconciliation and security auditing.
137
- metadata: {
138
- __volt_uid: opts.uid,
139
- __volt_subscription_id: parent.id,
140
- },
141
- };
142
- // Apply trial days if configured (Stripe requires integer days).
143
- if (parent.trial_days !== undefined) {
144
- subscription_params.trial_period_days = parent.trial_days;
145
- }
146
- // Apply billing anchor strategy.
147
- //
148
- // NOTE:
149
- // - We only support "immediately" and "first_of_month" because those are the only ones we model.
150
- // - For "first_of_month", we disable proration to avoid pro-rated invoices on anchor changes.
151
- const billing_anchor = parent.billing_anchor ?? "immediately";
152
- if (billing_anchor === "immediately") {
153
- return subscription_params;
154
- }
155
- if (billing_anchor === "first_of_month") {
156
- // We keep this logic consistent with checkout.ts: anchor to first day of next month
157
- // after the trial ends (or now if no trial).
158
- const now = new Date();
159
- const trial_days = parent.trial_days;
160
- const trial_end_reference = trial_days !== undefined ? new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate() + trial_days, now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds(), now.getUTCMilliseconds())) : now;
161
- const anchor_date = new Date(Date.UTC(trial_end_reference.getUTCFullYear(), trial_end_reference.getUTCMonth() + 1, 1, 0, 0, 0, 0));
162
- // Stripe expects unix timestamp seconds.
163
- subscription_params.billing_cycle_anchor = Math.floor(anchor_date.getTime() / 1000);
164
- subscription_params.proration_behavior = "none";
165
- return subscription_params;
166
- }
167
- // Future-proof exhaustive safety.
168
- throw new InternalStripeError("invalid_product", "Unsupported billing_anchor value.", { billing_anchor, subscription_id: parent.id });
169
- }
170
- /**
171
- * Create the stripe subscriptions database collection.
172
- */
173
- function create_subscriptions_db(server) {
174
- // Initialize the database connection.
175
- return server.db.collection({
176
- name: "Volt.Stripe.Subscriptions",
177
- indexes: [
178
- {
179
- keys: { uid: 1 },
180
- unique: true,
181
- },
182
- ],
183
- // Ensure its not unique so we retrieve the cached collection if already created.
184
- unique: false,
185
- });
186
- }
187
- // ----------------------------------------------------------------------------
188
- // Internal but exported API.
189
- /**
190
- * Update the subscriptions record for a user after a subscription mutation.
191
- * @note This includes the meter subscriptions.
192
- * @internal
193
- */
194
- export async function update_subscription_record(client, server, opts) {
195
- // List all subscriptions.
196
- const subscriptions = await list_all_customer_subscriptions(client, server, opts.uid, undefined);
197
- // Map subscription plan price ids to their plan ids for quick lookup.
198
- const sub_price_id_to_plan_id = new Map();
199
- const meter_price_id_to_product_id = new Map();
200
- for (const product of opts.all_products) {
201
- if (product.type === "subscription") {
202
- for (const plan of product.plans) {
203
- sub_price_id_to_plan_id.set(plan.stripe_price_id, plan.id);
204
- }
205
- }
206
- else if (product.type === "meter") {
207
- meter_price_id_to_product_id.set(product.stripe_price_id, product.id);
208
- }
209
- else if (product.type !== "one_time") {
210
- // @ts-expect-error Future-proof exhaustive safety.
211
- product.toString();
212
- }
213
- }
214
- // Create record.
215
- const record = {
216
- uid: opts.uid,
217
- subscriptions: {},
218
- meters: {},
219
- };
220
- // Iterate.
221
- for (const subscription of subscriptions) {
222
- switch (subscription.status) {
223
- // Store all semi-active statuses, they can later be filtered.
224
- case "active":
225
- case "trialing":
226
- case "past_due": {
227
- for (const item of subscription.items.data) {
228
- const price = item.price;
229
- if (!price) {
230
- continue;
231
- }
232
- if (sub_price_id_to_plan_id.has(price.id)) {
233
- const plan_id = sub_price_id_to_plan_id.get(price.id);
234
- if (!plan_id) {
235
- continue;
236
- }
237
- record.subscriptions[plan_id] = subscription.status;
238
- }
239
- if (meter_price_id_to_product_id.has(price.id)) {
240
- const product_id = meter_price_id_to_product_id.get(price.id);
241
- if (!product_id) {
242
- continue;
243
- }
244
- record.meters[product_id] = subscription.status;
245
- }
246
- }
247
- break;
248
- }
249
- default:
250
- break;
251
- }
252
- }
253
- // Save the record.
254
- const db = create_subscriptions_db(server);
255
- await db.set({ uid: opts.uid }, record, {
256
- // ensure we do not flatten the subscriptions object so we can remove old plans that are no longer active.
257
- flatten: false,
258
- upsert: true,
259
- retry: 3,
260
- });
261
- }
262
- /**
263
- * Load a subscription record with caching.
264
- */
265
- async function load_subscription_record(server, opts) {
266
- const use_cache = opts.cache ?? true;
267
- // Check cache first.
268
- if (use_cache) {
269
- const cached = subscription_record_cache.get(opts.uid);
270
- if (cached != null) {
271
- return cached;
272
- }
273
- }
274
- // Load.
275
- const db = create_subscriptions_db(server);
276
- const record = await db.load({ uid: opts.uid }, { throw: false });
277
- if (record instanceof Error) {
278
- if (record instanceof Collection.NotFoundError) {
279
- // Cache empty record to avoid repeated db hits for users without subscriptions.
280
- const empty_record = { uid: opts.uid, subscriptions: {}, meters: {} };
281
- subscription_record_cache.set(opts.uid, empty_record);
282
- return empty_record;
283
- }
284
- throw record;
285
- }
286
- // Cache always and return.
287
- subscription_record_cache.set(opts.uid, record);
288
- return record;
289
- }
290
- // ----------------------------------------------------------------------------
291
- // Public API.
292
- /**
293
- * Delete a user from the subscription caches.
294
- * Should be called after any mutation to the user's subscriptions to avoid stale cache entries.
295
- */
296
- export function delete_subscription_caches(uid) {
297
- subscription_record_cache.delete(uid);
298
- }
299
- /**
300
- * List all subscribed product plans for a given user.
301
- */
302
- export async function list_subscribed_plans(client, server, opts) {
303
- /** Validate input early to avoid cache poisoning with ambiguous keys. */
304
- assert(opts.uid.trim().length > 0, "invalid_argument", "Uid must be a non-empty string.", { uid: opts.uid });
305
- // Load record.
306
- const record = await load_subscription_record(server, { uid: opts.uid });
307
- // Subscription statuses that represent a live (entitlement-granting) subscription.
308
- const active_statuses = new Set(opts.status ?? [
309
- "active",
310
- "trialing",
311
- "past_due",
312
- ]);
313
- // Walk all subscriptions.
314
- const active = {};
315
- for (const [id, status] of Object.entries(record.subscriptions)) {
316
- if (!active_statuses.has(status)) {
317
- continue;
318
- }
319
- active[id] = status;
320
- }
321
- return active;
322
- }
323
- /**
324
- * List all meter product id's that a customer is currently subscribed (entitled) to.
325
- *
326
- * We require an active-ish subscription that contains a subscription item for the meter product's price id.
327
- * This prevents accidental/abusive usage reporting for users who aren't subscribed.
328
- *
329
- * Stripe docs:
330
- * - List subscriptions: https://docs.stripe.com/api/subscriptions/list
331
- * - Expand: https://docs.stripe.com/expand
332
- */
333
- export async function list_subscribed_meters(client, server, opts) {
334
- // Load record.
335
- const record = await load_subscription_record(server, { uid: opts.uid });
336
- // Subscription statuses that represent a live (entitlement-granting) subscription.
337
- const active_statuses = new Set(opts.status ?? [
338
- "active",
339
- // We dont allow `trialing` and `past_due` to reduce risk of accidental/abusive access.
340
- ]);
341
- // Walk all subscriptions.
342
- const active = {};
343
- for (const [id, status] of Object.entries(record.meters)) {
344
- if (!active_statuses.has(status)) {
345
- continue;
346
- }
347
- active[id] = status;
348
- }
349
- return active;
350
- }
351
- /**
352
- * Check whether a user (by uid) is subscribed to a specific subscription (plan) or meter product.
353
- *
354
- * @returns `true` if the user has an active subscription to the subscription (plan) or meter product, `false` otherwise.
355
- */
356
- export async function is_user_subscribed_to(client, server, opts) {
357
- /** Validate inputs early. */
358
- assert(opts.plan.id.trim().length > 0, "invalid_argument", "Plan.id must be a non-empty string.", { plan_id: opts.plan.id });
359
- // Meter product path.
360
- if (opts.plan.type === "meter") {
361
- const subscribed_plans = await list_subscribed_meters(client, server, {
362
- uid: opts.uid,
363
- stripe_customer_id: opts.customer_id ?? await ensure_stripe_customer(client, server, opts.uid),
364
- all_products: opts.all_products,
365
- status: opts.status,
366
- });
367
- return Object.keys(subscribed_plans).includes(opts.plan.id);
368
- }
369
- // Subscription (plan) path.
370
- else {
371
- // Retrieve subscribed plans.
372
- const subscribed_plans = await list_subscribed_plans(client, server, {
373
- uid: opts.uid,
374
- customer_id: opts.customer_id,
375
- all_products: opts.all_products,
376
- status: opts.status,
377
- });
378
- return Object.keys(subscribed_plans).includes(opts.plan.id);
379
- }
380
- // Not subscribed.
381
- return false;
382
- }
383
- /**
384
- * Create a subscription for either:
385
- * - a subscription plan (licensed recurring)
386
- * - a meter product (metered recurring)
387
- *
388
- * This uses the customer's default invoice payment method for off-session billing and
389
- * returns a "requires_action" payload when SCA/3DS confirmation is needed in the UI.
390
- *
391
- * Stripe docs:
392
- * - Create subscription: https://docs.stripe.com/api/subscriptions/create
393
- * - Payment behavior (default_incomplete): https://docs.stripe.com/billing/subscriptions/overview#handling-incomplete-subscriptions
394
- * - Expand: https://docs.stripe.com/expand
395
- * - PaymentIntents: https://docs.stripe.com/api/payment_intents
396
- *
397
- * @warning This function intentionally creates subscriptions with `payment_behavior="default_incomplete"`
398
- * so we can reliably detect and surface required customer actions (SCA).
399
- */
400
- export async function create_user_subscription(client, server, opts) {
401
- // -------------------------------------------------------------------------
402
- // Validate inputs (user-facing where appropriate).
403
- public_assert(is_non_empty_string(opts.uid), "invalid_argument", "Property 'uid' must be a non-empty string.");
404
- assert(Array.isArray(opts.all_products), "invalid_argument", "Property 'all_products' must be an array.");
405
- assert(opts.target.id.trim().length > 0, "invalid_argument", "Target.id must be non-empty.", { target_id: opts.target.id });
406
- // Any mutation can change entitlements; invalidate cache up-front to reduce stale reads.
407
- delete_subscription_caches(opts.uid);
408
- // -------------------------------------------------------------------------
409
- // Ensure customer + default payment method.
410
- const stripe_customer_id = await ensure_stripe_customer(client, server, opts.uid);
411
- const default_payment_method_id = await resolve_default_payment_method_id(client, {
412
- uid: opts.uid,
413
- stripe_customer_id,
414
- });
415
- // -------------------------------------------------------------------------
416
- // Build subscription create params.
417
- const idempotency_key = stable_idempotency_key(`sub_create:${opts.uid}:${opts.idempotency_key}`);
418
- // Base params shared for both plan and meter.
419
- const base_params = {
420
- customer: stripe_customer_id,
421
- // We always charge automatically for subscriptions.
422
- // Docs: https://docs.stripe.com/api/subscriptions/create#create_subscription-collection_method
423
- collection_method: "charge_automatically",
424
- // Use the default invoice payment method for off-session charges.
425
- // Docs: https://docs.stripe.com/api/subscriptions/create#create_subscription-default_payment_method
426
- default_payment_method: default_payment_method_id,
427
- // Crucial: create an incomplete subscription when payment can't be completed immediately,
428
- // so we can surface the PaymentIntent client_secret to the UI for SCA/3DS.
429
- // Docs: https://docs.stripe.com/billing/subscriptions/overview#handling-incomplete-subscriptions
430
- payment_behavior: "default_incomplete",
431
- // Safe metadata only.
432
- metadata: {
433
- __volt_uid: opts.uid,
434
- __volt_target_id: opts.target.id,
435
- __volt_target_type: opts.target.type,
436
- },
437
- };
438
- // Items differ per target type.
439
- if (opts.target.type === "subscription_plan") {
440
- // Resolve parent subscription product to apply trial/billing anchor coherently.
441
- const parent_subscription = resolve_plan_parent_subscription({
442
- plan: opts.target,
443
- all_products: opts.all_products,
444
- });
445
- const subscription_level_params = build_subscription_create_params_from_product({
446
- uid: opts.uid,
447
- parent_subscription,
448
- });
449
- // Stripe docs: items.price https://docs.stripe.com/api/subscriptions/create#create_subscription-items-price
450
- base_params.items = [{ price: opts.target.stripe_price_id, quantity: 1 }];
451
- // Apply subscription-level options (trial, anchor, metadata).
452
- base_params.trial_period_days = subscription_level_params.trial_period_days;
453
- base_params.billing_cycle_anchor = subscription_level_params.billing_cycle_anchor;
454
- base_params.proration_behavior = subscription_level_params.proration_behavior;
455
- // Merge metadata (preserve base keys).
456
- base_params.metadata = {
457
- ...(base_params.metadata ?? {}),
458
- ...(subscription_level_params.metadata ?? {}),
459
- __volt_subscription_id: parent_subscription.id,
460
- __volt_plan_id: opts.target.id,
461
- };
462
- }
463
- else if (opts.target.type === "meter") {
464
- // Meter products are metered recurring prices already linked to a Stripe Billing Meter during initialization.
465
- // Stripe docs: https://docs.stripe.com/api/prices/create (recurring.meter)
466
- base_params.items = [{ price: opts.target.stripe_price_id, quantity: 1 }];
467
- // Useful context for reconciliation.
468
- base_params.metadata = {
469
- ...(base_params.metadata ?? {}),
470
- __volt_meter_product_id: opts.target.id,
471
- __volt_meter_event_name: opts.target.meter_event_name,
472
- };
473
- }
474
- else {
475
- // Exhaustive safety for future target types.
476
- // @ts-expect-error should be never
477
- opts.target.toString();
478
- throw new InternalStripeError("invalid_argument", "Unsupported subscription target type.", { target_type: opts.target.type });
479
- }
480
- // -------------------------------------------------------------------------
481
- // Create subscription (expand latest_invoice.payment_intent so we can surface UI actions).
482
- const subscription = await stripe_api_call(() => client.subscriptions.create({
483
- ...base_params,
484
- // Expand payment intent so we can return client_secret for SCA, if required.
485
- // Docs: https://docs.stripe.com/expand
486
- expand: ["latest_invoice.payment_intent"],
487
- }, { idempotencyKey: idempotency_key }), {
488
- operation: "subscriptions.create",
489
- uid: opts.uid,
490
- stripe_customer_id,
491
- target_id: opts.target.id,
492
- target_type: opts.target.type,
493
- });
494
- // Mutation happened: invalidate cache again post-mutation to reduce stale reads.
495
- delete_subscription_caches(opts.uid);
496
- // -------------------------------------------------------------------------
497
- // Handle outcomes:
498
- // - active/trialing/past_due => success
499
- // - incomplete + requires_action => UI must confirm the PaymentIntent
500
- // - incomplete + requires_payment_method => user must add/replace payment method
501
- const payment_intent = resolve_payment_intent_from_subscription(subscription);
502
- // If Stripe indicates the PaymentIntent needs customer action, return client_secret to the UI.
503
- if (payment_intent && payment_intent.status === "requires_action") {
504
- const client_secret = payment_intent.client_secret;
505
- public_assert(is_non_empty_string(client_secret), "subscription_payment_action_required", "Additional payment verification is required, but Stripe did not return a client secret.", { subscription_id: subscription.id, payment_intent_id: payment_intent.id });
506
- return {
507
- type: "requires_action",
508
- subscription_id: subscription.id,
509
- stripe_customer_id,
510
- payment_intent_id: payment_intent.id,
511
- client_secret,
512
- status: subscription.status,
513
- };
514
- }
515
- // If payment method was rejected/invalid, surface a user-actionable error.
516
- if (payment_intent && payment_intent.status === "requires_payment_method") {
517
- throw new ExternalStripeError("payment_method_missing", "Your default payment method could not be charged. Please update your payment method and try again.", { subscription_id: subscription.id, payment_intent_id: payment_intent.id });
518
- }
519
- // Some accounts/flows may produce an "incomplete" subscription without an expanded PI; treat as internal inconsistency.
520
- if (subscription.status === "incomplete" || subscription.status === "incomplete_expired") {
521
- throw new InternalStripeError("subscription_create_error", "Subscription was created in an incomplete state without a resolvable PaymentIntent.", {
522
- uid: opts.uid,
523
- stripe_customer_id,
524
- subscription_id: subscription.id,
525
- status: subscription.status,
526
- has_latest_invoice: subscription.latest_invoice != null,
527
- has_payment_intent: payment_intent != null,
528
- });
529
- }
530
- // Otherwise, consider it created (active/trialing/past_due/etc).
531
- return {
532
- type: "created",
533
- subscription_id: subscription.id,
534
- stripe_customer_id,
535
- status: subscription.status,
536
- };
537
- }
538
- /**
539
- * Cancel a user's Stripe subscription(s) matching a specific subscription plan.
540
- *
541
- * Important behavior change:
542
- * - If the matched Stripe Subscription contains multiple subscription items (multiple plans),
543
- * we still cancel the *entire* subscription (all items) to keep semantics simple and consistent.
544
- *
545
- * Stripe docs:
546
- * - Cancel a subscription: https://docs.stripe.com/api/subscriptions/cancel
547
- * - Update a subscription (cancel_at_period_end): https://docs.stripe.com/api/subscriptions/update
548
- * - List subscriptions: https://docs.stripe.com/api/subscriptions/list
549
- *
550
- * @note If a user is not subscribed to the specified plan, this function succeeds without doing anything (idempotent).
551
- *
552
- * @returns The affected subscriptions which were canceled/updated.
553
- */
554
- export async function cancel_user_subscription(client, server, opts) {
555
- // -------------------------------------------------------------------------
556
- // Validate inputs.
557
- const uid = opts.uid;
558
- /** Validate uid so we never act on an ambiguous identity. */
559
- assert(uid.trim().length > 0, "invalid_argument", "Uid must be a non-empty string.", { uid });
560
- /** Validate plan fields so we only match the intended Stripe price. */
561
- assert(opts.plan.id.trim().length > 0, "invalid_argument", "Plan.id must be non-empty.", { plan_id: opts.plan.id });
562
- assert(opts.plan.stripe_price_id.trim().length > 0, "invalid_argument", "Plan.stripe_price_id must be non-empty.", { plan_id: opts.plan.id });
563
- const cancel_at_period_end = opts.cancel_at_period_end ?? true;
564
- // Any mutation can change entitlements; invalidate cache up-front to reduce stale reads.
565
- delete_subscription_caches(uid);
566
- // -------------------------------------------------------------------------
567
- // Fetch subscriptions.
568
- /** Fetch all subscriptions (paginated). */
569
- const subscriptions = await list_all_customer_subscriptions(client, server, uid, opts.customer_id);
570
- // -------------------------------------------------------------------------
571
- // Identify matching subscriptions.
572
- // Subscription statuses that represent a live (entitlement-granting) subscription.
573
- const active_sub_status = new Set([
574
- "active",
575
- "trialing",
576
- "past_due", // since Stripe can keep subscriptions in past_due while retrying payment.
577
- ]);
578
- const affected_subscriptions = [];
579
- for (const subscription of subscriptions) {
580
- // We only operate on active-ish subscriptions; canceled/unpaid ones are ignored.
581
- if (!active_sub_status.has(subscription.status)) {
582
- continue;
583
- }
584
- // Match if any subscription item uses the plan's Stripe price id.
585
- let matches_plan = false;
586
- for (const item of subscription.items.data) {
587
- const price = item.price;
588
- if (!price) {
589
- continue;
590
- }
591
- if (price.id === opts.plan.stripe_price_id) {
592
- matches_plan = true;
593
- break;
594
- }
595
- }
596
- if (!matches_plan) {
597
- continue;
598
- }
599
- affected_subscriptions.push(subscription);
600
- }
601
- // Idempotent semantics: if nothing matches, succeed without doing anything.
602
- if (affected_subscriptions.length === 0) {
603
- // Best-effort cache invalidation so the next read doesn't serve stale positives.
604
- delete_subscription_caches(uid);
605
- return [];
606
- }
607
- // -------------------------------------------------------------------------
608
- // Cancel/update subscriptions.
609
- //
610
- // NOTE: Even if a subscription contains multiple items (multiple plans),
611
- // we cancel the entire subscription to avoid partial-cancel surprises.
612
- await Promise.all(affected_subscriptions.map(async (subscription) => {
613
- if (cancel_at_period_end) {
614
- // Non-destructive cancel: the subscription stays active until end of period, then cancels.
615
- await stripe_api_call(() => client.subscriptions.update(subscription.id, { cancel_at_period_end: true }, { idempotencyKey: stable_idempotency_key(`sub_update_cancel_at_period_end:${subscription.id}`) }), {
616
- operation: "subscriptions.update",
617
- action: "cancel_at_period_end",
618
- uid,
619
- subscription_id: subscription.id,
620
- plan_id: opts.plan.id,
621
- stripe_price_id: opts.plan.stripe_price_id,
622
- });
623
- }
624
- else {
625
- // Immediate cancellation.
626
- await stripe_api_call(() => client.subscriptions.cancel(subscription.id, undefined, { idempotencyKey: stable_idempotency_key(`sub_cancel_immediate:${subscription.id}`) }), {
627
- operation: "subscriptions.cancel",
628
- action: "cancel_immediately",
629
- uid,
630
- subscription_id: subscription.id,
631
- plan_id: opts.plan.id,
632
- stripe_price_id: opts.plan.stripe_price_id,
633
- });
634
- }
635
- }));
636
- // Mutation happened: invalidate cache again post-mutation to reduce stale reads.
637
- delete_subscription_caches(uid);
638
- // Response.
639
- return affected_subscriptions;
640
- }
641
- /**
642
- * Enforce that a user can only have **one active subscription plan per SubscriptionProduct**.
643
- *
644
- * Workflow:
645
- * 1. Accepts the newly created/updated Stripe.Subscription (expanded items.price).
646
- * 2. Resolves which internal SubscriptionProduct it belongs to by matching *all* known plan price IDs.
647
- * 3. Lists all customer subscriptions.
648
- * 4. Cancels (immediately) all other active subscriptions that contain *any* plan
649
- * from the same SubscriptionProduct, excluding the newly created subscription.
650
- *
651
- * Safety guarantees:
652
- * - Does nothing if the new subscription is not live.
653
- * - Does nothing if the subscription does not map to any known SubscriptionProduct.
654
- * - Cancels only subscriptions that clearly overlap with the same SubscriptionProduct.
655
- */
656
- export async function enforce_single_subscription_plan(client, server, opts) {
657
- assert(opts.uid.length > 0, "invalid_argument", "uid must be provided");
658
- assert(opts.stripe_customer_id.length > 0, "invalid_argument", "stripe_customer_id must be provided");
659
- const { new_subscription, all_products } = opts;
660
- // Subscription statuses that represent a live (entitlement-granting) subscription.
661
- // Keep inline to avoid confusion with `active_subscription_statuses`.
662
- const active_sub_status = new Set([
663
- "active",
664
- "trialing",
665
- "past_due",
666
- ]);
667
- // Only enforce for live subscriptions
668
- if (!active_sub_status.has(new_subscription.status)) {
669
- return [];
670
- }
671
- // Build a map of price_id -> SubscriptionProduct
672
- const price_to_subscription_product = new Map();
673
- for (const product of all_products) {
674
- if (product.type !== "subscription")
675
- continue;
676
- for (const plan of product.plans) {
677
- price_to_subscription_product.set(plan.stripe_price_id, product);
678
- }
679
- }
680
- // Resolve which SubscriptionProduct this new subscription belongs to
681
- const resolved_products = new Set();
682
- for (const item of new_subscription.items.data) {
683
- const price = item.price;
684
- if (!price)
685
- continue;
686
- // Enforce expanded price object, otherwise we can't safely map price ids.
687
- assert(typeof price !== "string", "invalid_argument", "new_subscription.items.data.price must be expanded.", {
688
- subscription_id: new_subscription.id,
689
- });
690
- const sub_product = price_to_subscription_product.get(price.id);
691
- if (sub_product) {
692
- resolved_products.add(sub_product);
693
- }
694
- }
695
- // If we can't resolve exactly one subscription product, do nothing
696
- if (resolved_products.size === 0) {
697
- return [];
698
- }
699
- if (resolved_products.size > 1) {
700
- throw new InternalStripeError("subscription_resolution_error", "Subscription resolves to multiple subscription products.", {
701
- subscription_id: new_subscription.id,
702
- subscription_product_ids: [...resolved_products].map((p) => p.id),
703
- });
704
- }
705
- const [subscription_product] = [...resolved_products];
706
- // All Stripe price ids belonging to this SubscriptionProduct
707
- const product_price_ids = new Set(subscription_product.plans.map((p) => p.stripe_price_id));
708
- // Fetch all customer subscriptions
709
- const all_subscriptions = await list_all_customer_subscriptions(client, server, opts.uid, opts.stripe_customer_id);
710
- const canceled = [];
711
- for (const sub of all_subscriptions) {
712
- // Skip the newly created subscription
713
- if (sub.id === new_subscription.id)
714
- continue;
715
- // Only cancel live subscriptions
716
- if (!active_sub_status.has(sub.status))
717
- continue;
718
- // Check if this subscription contains *any* plan from the same SubscriptionProduct
719
- let overlaps = false;
720
- for (const item of sub.items.data) {
721
- const price = item.price;
722
- if (!price)
723
- continue;
724
- assert(typeof price !== "string", "api_error", "Expected expanded item.price from subscriptions.list expand.", {
725
- subscription_id: sub.id,
726
- });
727
- if (product_price_ids.has(price.id)) {
728
- overlaps = true;
729
- break;
730
- }
731
- }
732
- if (!overlaps)
733
- continue;
734
- // Cancel immediately (idempotent)
735
- await stripe_api_call(() => client.subscriptions.cancel(sub.id, undefined, {
736
- idempotencyKey: opts.idempotency_key ?? stable_idempotency_key(`enforce_single_plan:${opts.stripe_customer_id}:${new_subscription.id}:${sub.id}`),
737
- }), {
738
- operation: "subscriptions.cancel",
739
- action: "enforce_single_plan",
740
- uid: opts.uid,
741
- stripe_customer_id: opts.stripe_customer_id,
742
- kept_subscription_id: new_subscription.id,
743
- canceled_subscription_id: sub.id,
744
- subscription_product_id: subscription_product.id,
745
- });
746
- canceled.push(sub);
747
- }
748
- // Invalidate cache.
749
- if (canceled.length > 0) {
750
- delete_subscription_caches(opts.uid);
751
- }
752
- // Return.
753
- return canceled;
754
- }