@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.
- package/frontend/assets/admin/admin.png +0 -0
- package/frontend/assets/admin/password.webp +0 -0
- package/frontend/assets/icons/arrow.v1.webp +0 -0
- package/frontend/assets/icons/copy.webp +0 -0
- package/frontend/assets/payments/arrow.long.webp +0 -0
- package/frontend/assets/payments/arrow.long2.webp +0 -0
- package/frontend/assets/payments/cancelled.webp +0 -0
- package/frontend/assets/payments/check.sign.webp +0 -0
- package/frontend/assets/payments/check.webp +0 -0
- package/frontend/assets/payments/close.webp +0 -0
- package/frontend/assets/payments/error.webp +0 -0
- package/frontend/assets/payments/exclamation.webp +0 -0
- package/frontend/assets/payments/minus.webp +0 -0
- package/frontend/assets/payments/party.webp +0 -0
- package/frontend/assets/payments/plus.webp +0 -0
- package/frontend/assets/payments/shopping_cart.webp +0 -0
- package/frontend/assets/payments/trash.webp +0 -0
- package/package.json +5 -1
- package/.libris/config.json +0 -82
- package/backend/dist/cjs/backend/src/blacklist.d.ts +0 -12
- package/backend/dist/cjs/backend/src/blacklist.js +0 -78
- package/backend/dist/cjs/backend/src/cli.d.ts +0 -2
- package/backend/dist/cjs/backend/src/cli.js +0 -198
- package/backend/dist/cjs/backend/src/database/collection.d.ts +0 -1765
- package/backend/dist/cjs/backend/src/database/collection.js +0 -3301
- package/backend/dist/cjs/backend/src/database/database.d.ts +0 -92
- package/backend/dist/cjs/backend/src/database/database.js +0 -170
- package/backend/dist/cjs/backend/src/database/document.d.ts +0 -1
- package/backend/dist/cjs/backend/src/database/document.js +0 -15
- package/backend/dist/cjs/backend/src/database/filters/filters.d.ts +0 -6
- package/backend/dist/cjs/backend/src/database/filters/filters.js +0 -15
- package/backend/dist/cjs/backend/src/database/filters/strict_filter.d.ts +0 -223
- package/backend/dist/cjs/backend/src/database/filters/strict_filter.js +0 -15
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_test.d.ts +0 -1
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_test.js +0 -443
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_test_v0.d.ts +0 -1
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_test_v0.js +0 -15
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_v0.d.ts +0 -50
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_v0.js +0 -15
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_v1.d.ts +0 -76
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_v1.js +0 -15
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_v2.d.ts +0 -75
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_v2.js +0 -15
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_v3.d.ts +0 -219
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_v3.js +0 -15
- package/backend/dist/cjs/backend/src/database/filters/strict_update_filter.d.ts +0 -165
- package/backend/dist/cjs/backend/src/database/filters/strict_update_filter.js +0 -15
- package/backend/dist/cjs/backend/src/database/filters/strict_update_filter_test.d.ts +0 -5
- package/backend/dist/cjs/backend/src/database/filters/strict_update_filter_test.js +0 -355
- package/backend/dist/cjs/backend/src/database/flatten.d.ts +0 -78
- package/backend/dist/cjs/backend/src/database/flatten.js +0 -53
- package/backend/dist/cjs/backend/src/database/flatten_test.d.ts +0 -1
- package/backend/dist/cjs/backend/src/database/flatten_test.js +0 -175
- package/backend/dist/cjs/backend/src/database/quota/quoata_v2.d.ts +0 -533
- package/backend/dist/cjs/backend/src/database/quota/quoata_v2.js +0 -1046
- package/backend/dist/cjs/backend/src/database/quota/quota.d.ts +0 -551
- package/backend/dist/cjs/backend/src/database/quota/quota.js +0 -1108
- package/backend/dist/cjs/backend/src/database/quota/quota_v1.d.ts +0 -534
- package/backend/dist/cjs/backend/src/database/quota/quota_v1.js +0 -1087
- package/backend/dist/cjs/backend/src/database/quota/safe_int.d.ts +0 -412
- package/backend/dist/cjs/backend/src/database/quota/safe_int.js +0 -745
- package/backend/dist/cjs/backend/src/endpoint.d.ts +0 -346
- package/backend/dist/cjs/backend/src/endpoint.js +0 -468
- package/backend/dist/cjs/backend/src/errors/index.d.ts +0 -7
- package/backend/dist/cjs/backend/src/errors/index.js +0 -25
- package/backend/dist/cjs/backend/src/errors/internal_external.d.ts +0 -52
- package/backend/dist/cjs/backend/src/errors/internal_external.js +0 -95
- package/backend/dist/cjs/backend/src/errors/invalid_usage_error.d.ts +0 -41
- package/backend/dist/cjs/backend/src/errors/invalid_usage_error.js +0 -47
- package/backend/dist/cjs/backend/src/errors/system_error.d.ts +0 -261
- package/backend/dist/cjs/backend/src/errors/system_error.js +0 -436
- package/backend/dist/cjs/backend/src/events.d.ts +0 -97
- package/backend/dist/cjs/backend/src/events.js +0 -15
- package/backend/dist/cjs/backend/src/frontend.d.ts +0 -11
- package/backend/dist/cjs/backend/src/frontend.js +0 -37
- package/backend/dist/cjs/backend/src/image_endpoint.d.ts +0 -44
- package/backend/dist/cjs/backend/src/image_endpoint.js +0 -185
- package/backend/dist/cjs/backend/src/index.d.ts +0 -23
- package/backend/dist/cjs/backend/src/index.js +0 -70
- package/backend/dist/cjs/backend/src/logger.d.ts +0 -5
- package/backend/dist/cjs/backend/src/logger.js +0 -15
- package/backend/dist/cjs/backend/src/meta.d.ts +0 -112
- package/backend/dist/cjs/backend/src/meta.js +0 -181
- package/backend/dist/cjs/backend/src/payments/paddle.d.ts +0 -329
- package/backend/dist/cjs/backend/src/payments/paddle.js +0 -1996
- package/backend/dist/cjs/backend/src/payments/stripe/checkout.d.ts +0 -113
- package/backend/dist/cjs/backend/src/payments/stripe/checkout.js +0 -295
- package/backend/dist/cjs/backend/src/payments/stripe/customers.d.ts +0 -17
- package/backend/dist/cjs/backend/src/payments/stripe/customers.js +0 -164
- package/backend/dist/cjs/backend/src/payments/stripe/error.d.ts +0 -74
- package/backend/dist/cjs/backend/src/payments/stripe/error.js +0 -64
- package/backend/dist/cjs/backend/src/payments/stripe/events.d.ts +0 -155
- package/backend/dist/cjs/backend/src/payments/stripe/events.js +0 -15
- package/backend/dist/cjs/backend/src/payments/stripe/meters.d.ts +0 -105
- package/backend/dist/cjs/backend/src/payments/stripe/meters.js +0 -230
- package/backend/dist/cjs/backend/src/payments/stripe/payment_methods.d.ts +0 -58
- package/backend/dist/cjs/backend/src/payments/stripe/payment_methods.js +0 -109
- package/backend/dist/cjs/backend/src/payments/stripe/products.d.ts +0 -519
- package/backend/dist/cjs/backend/src/payments/stripe/products.js +0 -650
- package/backend/dist/cjs/backend/src/payments/stripe/stripe.d.ts +0 -215
- package/backend/dist/cjs/backend/src/payments/stripe/stripe.js +0 -468
- package/backend/dist/cjs/backend/src/payments/stripe/subscriptions.d.ts +0 -172
- package/backend/dist/cjs/backend/src/payments/stripe/subscriptions.js +0 -557
- package/backend/dist/cjs/backend/src/payments/stripe/utils.d.ts +0 -63
- package/backend/dist/cjs/backend/src/payments/stripe/utils.js +0 -118
- package/backend/dist/cjs/backend/src/payments/stripe/webhooks.d.ts +0 -105
- package/backend/dist/cjs/backend/src/payments/stripe/webhooks.js +0 -627
- package/backend/dist/cjs/backend/src/plugins/browser.d.ts +0 -1
- package/backend/dist/cjs/backend/src/plugins/browser.js +0 -15
- package/backend/dist/cjs/backend/src/plugins/communication.d.ts +0 -70
- package/backend/dist/cjs/backend/src/plugins/communication.js +0 -196
- package/backend/dist/cjs/backend/src/plugins/mail/mail.d.ts +0 -255
- package/backend/dist/cjs/backend/src/plugins/mail/mail.js +0 -381
- package/backend/dist/cjs/backend/src/plugins/mail/ui.d.ts +0 -297
- package/backend/dist/cjs/backend/src/plugins/mail/ui.js +0 -1370
- package/backend/dist/cjs/backend/src/plugins/pdf.d.ts +0 -1
- package/backend/dist/cjs/backend/src/plugins/pdf.js +0 -1456
- package/backend/dist/cjs/backend/src/plugins/thread_monitor.d.ts +0 -18
- package/backend/dist/cjs/backend/src/plugins/thread_monitor.js +0 -116
- package/backend/dist/cjs/backend/src/rate_limit.d.ts +0 -148
- package/backend/dist/cjs/backend/src/rate_limit.js +0 -543
- package/backend/dist/cjs/backend/src/route.d.ts +0 -39
- package/backend/dist/cjs/backend/src/route.js +0 -172
- package/backend/dist/cjs/backend/src/server.d.ts +0 -502
- package/backend/dist/cjs/backend/src/server.js +0 -1713
- package/backend/dist/cjs/backend/src/server.old.d.ts +0 -594
- package/backend/dist/cjs/backend/src/server.old.js +0 -2058
- package/backend/dist/cjs/backend/src/splash_screen.d.ts +0 -93
- package/backend/dist/cjs/backend/src/splash_screen.js +0 -119
- package/backend/dist/cjs/backend/src/status.d.ts +0 -89
- package/backend/dist/cjs/backend/src/status.js +0 -211
- package/backend/dist/cjs/backend/src/stream.d.ts +0 -494
- package/backend/dist/cjs/backend/src/stream.js +0 -1370
- package/backend/dist/cjs/backend/src/users.d.ts +0 -926
- package/backend/dist/cjs/backend/src/users.js +0 -2223
- package/backend/dist/cjs/backend/src/utils.d.ts +0 -22
- package/backend/dist/cjs/backend/src/utils.js +0 -626
- package/backend/dist/cjs/backend/src/view.d.ts +0 -115
- package/backend/dist/cjs/backend/src/view.js +0 -519
- package/backend/dist/cjs/backend/src/vinc.d.ts +0 -6
- package/backend/dist/cjs/backend/src/vinc.js +0 -40
- package/backend/dist/cjs/backend/src/volt.d.ts +0 -24
- package/backend/dist/cjs/backend/src/volt.js +0 -72
- package/backend/dist/cjs/frontend/src/modules/request.d.ts +0 -70
- package/backend/dist/cjs/frontend/src/modules/request.js +0 -99
- package/backend/dist/cjs/package.json +0 -1
- package/backend/dist/esm/backend/src/blacklist.d.ts +0 -12
- package/backend/dist/esm/backend/src/blacklist.js +0 -52
- package/backend/dist/esm/backend/src/cli.d.ts +0 -2
- package/backend/dist/esm/backend/src/cli.js +0 -211
- package/backend/dist/esm/backend/src/database/collection.d.ts +0 -1765
- package/backend/dist/esm/backend/src/database/collection.js +0 -3779
- package/backend/dist/esm/backend/src/database/database.d.ts +0 -92
- package/backend/dist/esm/backend/src/database/database.js +0 -214
- package/backend/dist/esm/backend/src/database/document.d.ts +0 -1
- package/backend/dist/esm/backend/src/database/document.js +0 -558
- package/backend/dist/esm/backend/src/database/filters/filters.d.ts +0 -6
- package/backend/dist/esm/backend/src/database/filters/filters.js +0 -1
- package/backend/dist/esm/backend/src/database/filters/strict_filter.d.ts +0 -223
- package/backend/dist/esm/backend/src/database/filters/strict_filter.js +0 -3
- package/backend/dist/esm/backend/src/database/filters/strict_filter_test.d.ts +0 -1
- package/backend/dist/esm/backend/src/database/filters/strict_filter_test.js +0 -505
- package/backend/dist/esm/backend/src/database/filters/strict_filter_test_v0.d.ts +0 -1
- package/backend/dist/esm/backend/src/database/filters/strict_filter_test_v0.js +0 -712
- package/backend/dist/esm/backend/src/database/filters/strict_filter_v0.d.ts +0 -50
- package/backend/dist/esm/backend/src/database/filters/strict_filter_v0.js +0 -5
- package/backend/dist/esm/backend/src/database/filters/strict_filter_v1.d.ts +0 -76
- package/backend/dist/esm/backend/src/database/filters/strict_filter_v1.js +0 -44
- package/backend/dist/esm/backend/src/database/filters/strict_filter_v2.d.ts +0 -75
- package/backend/dist/esm/backend/src/database/filters/strict_filter_v2.js +0 -5
- package/backend/dist/esm/backend/src/database/filters/strict_filter_v3.d.ts +0 -219
- package/backend/dist/esm/backend/src/database/filters/strict_filter_v3.js +0 -1
- package/backend/dist/esm/backend/src/database/filters/strict_update_filter.d.ts +0 -165
- package/backend/dist/esm/backend/src/database/filters/strict_update_filter.js +0 -5
- package/backend/dist/esm/backend/src/database/filters/strict_update_filter_test.d.ts +0 -5
- package/backend/dist/esm/backend/src/database/filters/strict_update_filter_test.js +0 -415
- package/backend/dist/esm/backend/src/database/flatten.d.ts +0 -78
- package/backend/dist/esm/backend/src/database/flatten.js +0 -22
- package/backend/dist/esm/backend/src/database/flatten_test.d.ts +0 -1
- package/backend/dist/esm/backend/src/database/flatten_test.js +0 -174
- package/backend/dist/esm/backend/src/database/quota/quoata_v2.d.ts +0 -533
- package/backend/dist/esm/backend/src/database/quota/quoata_v2.js +0 -1155
- package/backend/dist/esm/backend/src/database/quota/quota.d.ts +0 -551
- package/backend/dist/esm/backend/src/database/quota/quota.js +0 -1219
- package/backend/dist/esm/backend/src/database/quota/quota_v1.d.ts +0 -534
- package/backend/dist/esm/backend/src/database/quota/quota_v1.js +0 -1242
- package/backend/dist/esm/backend/src/database/quota/safe_int.d.ts +0 -412
- package/backend/dist/esm/backend/src/database/quota/safe_int.js +0 -810
- package/backend/dist/esm/backend/src/endpoint.d.ts +0 -346
- package/backend/dist/esm/backend/src/endpoint.js +0 -479
- package/backend/dist/esm/backend/src/errors/index.d.ts +0 -7
- package/backend/dist/esm/backend/src/errors/index.js +0 -7
- package/backend/dist/esm/backend/src/errors/internal_external.d.ts +0 -52
- package/backend/dist/esm/backend/src/errors/internal_external.js +0 -86
- package/backend/dist/esm/backend/src/errors/invalid_usage_error.d.ts +0 -41
- package/backend/dist/esm/backend/src/errors/invalid_usage_error.js +0 -33
- package/backend/dist/esm/backend/src/errors/system_error.d.ts +0 -261
- package/backend/dist/esm/backend/src/errors/system_error.js +0 -444
- package/backend/dist/esm/backend/src/events.d.ts +0 -97
- package/backend/dist/esm/backend/src/events.js +0 -5
- package/backend/dist/esm/backend/src/frontend.d.ts +0 -11
- package/backend/dist/esm/backend/src/frontend.js +0 -12
- package/backend/dist/esm/backend/src/image_endpoint.d.ts +0 -44
- package/backend/dist/esm/backend/src/image_endpoint.js +0 -196
- package/backend/dist/esm/backend/src/index.d.ts +0 -23
- package/backend/dist/esm/backend/src/index.js +0 -26
- package/backend/dist/esm/backend/src/logger.d.ts +0 -5
- package/backend/dist/esm/backend/src/logger.js +0 -8
- package/backend/dist/esm/backend/src/meta.d.ts +0 -112
- package/backend/dist/esm/backend/src/meta.js +0 -152
- package/backend/dist/esm/backend/src/payments/paddle.d.ts +0 -329
- package/backend/dist/esm/backend/src/payments/paddle.js +0 -2276
- package/backend/dist/esm/backend/src/payments/stripe/checkout.d.ts +0 -113
- package/backend/dist/esm/backend/src/payments/stripe/checkout.js +0 -356
- package/backend/dist/esm/backend/src/payments/stripe/customers.d.ts +0 -17
- package/backend/dist/esm/backend/src/payments/stripe/customers.js +0 -193
- package/backend/dist/esm/backend/src/payments/stripe/error.d.ts +0 -74
- package/backend/dist/esm/backend/src/payments/stripe/error.js +0 -51
- package/backend/dist/esm/backend/src/payments/stripe/events.d.ts +0 -155
- package/backend/dist/esm/backend/src/payments/stripe/events.js +0 -5
- package/backend/dist/esm/backend/src/payments/stripe/meters.d.ts +0 -105
- package/backend/dist/esm/backend/src/payments/stripe/meters.js +0 -318
- package/backend/dist/esm/backend/src/payments/stripe/payment_methods.d.ts +0 -58
- package/backend/dist/esm/backend/src/payments/stripe/payment_methods.js +0 -135
- package/backend/dist/esm/backend/src/payments/stripe/products.d.ts +0 -519
- package/backend/dist/esm/backend/src/payments/stripe/products.js +0 -896
- package/backend/dist/esm/backend/src/payments/stripe/stripe.d.ts +0 -215
- package/backend/dist/esm/backend/src/payments/stripe/stripe.js +0 -464
- package/backend/dist/esm/backend/src/payments/stripe/subscriptions.d.ts +0 -172
- package/backend/dist/esm/backend/src/payments/stripe/subscriptions.js +0 -754
- package/backend/dist/esm/backend/src/payments/stripe/utils.d.ts +0 -63
- package/backend/dist/esm/backend/src/payments/stripe/utils.js +0 -131
- package/backend/dist/esm/backend/src/payments/stripe/webhooks.d.ts +0 -105
- package/backend/dist/esm/backend/src/payments/stripe/webhooks.js +0 -752
- package/backend/dist/esm/backend/src/plugins/browser.d.ts +0 -1
- package/backend/dist/esm/backend/src/plugins/browser.js +0 -170
- package/backend/dist/esm/backend/src/plugins/communication.d.ts +0 -70
- package/backend/dist/esm/backend/src/plugins/communication.js +0 -169
- package/backend/dist/esm/backend/src/plugins/mail/mail.d.ts +0 -255
- package/backend/dist/esm/backend/src/plugins/mail/mail.js +0 -396
- package/backend/dist/esm/backend/src/plugins/mail/ui.d.ts +0 -297
- package/backend/dist/esm/backend/src/plugins/mail/ui.js +0 -1400
- package/backend/dist/esm/backend/src/plugins/pdf.d.ts +0 -1
- package/backend/dist/esm/backend/src/plugins/pdf.js +0 -1694
- package/backend/dist/esm/backend/src/plugins/thread_monitor.d.ts +0 -18
- package/backend/dist/esm/backend/src/plugins/thread_monitor.js +0 -120
- package/backend/dist/esm/backend/src/rate_limit.d.ts +0 -148
- package/backend/dist/esm/backend/src/rate_limit.js +0 -667
- package/backend/dist/esm/backend/src/route.d.ts +0 -39
- package/backend/dist/esm/backend/src/route.js +0 -222
- package/backend/dist/esm/backend/src/server.d.ts +0 -502
- package/backend/dist/esm/backend/src/server.js +0 -2034
- package/backend/dist/esm/backend/src/server.old.d.ts +0 -594
- package/backend/dist/esm/backend/src/server.old.js +0 -2630
- package/backend/dist/esm/backend/src/splash_screen.d.ts +0 -93
- package/backend/dist/esm/backend/src/splash_screen.js +0 -156
- package/backend/dist/esm/backend/src/status.d.ts +0 -89
- package/backend/dist/esm/backend/src/status.js +0 -213
- package/backend/dist/esm/backend/src/stream.d.ts +0 -494
- package/backend/dist/esm/backend/src/stream.js +0 -1611
- package/backend/dist/esm/backend/src/users.d.ts +0 -926
- package/backend/dist/esm/backend/src/users.js +0 -2423
- package/backend/dist/esm/backend/src/utils.d.ts +0 -22
- package/backend/dist/esm/backend/src/utils.js +0 -463
- package/backend/dist/esm/backend/src/view.d.ts +0 -115
- package/backend/dist/esm/backend/src/view.js +0 -584
- package/backend/dist/esm/backend/src/vinc.d.ts +0 -6
- package/backend/dist/esm/backend/src/vinc.js +0 -6
- package/backend/dist/esm/backend/src/volt.d.ts +0 -24
- package/backend/dist/esm/backend/src/volt.js +0 -27
- package/backend/dist/esm/frontend/src/modules/request.d.ts +0 -70
- package/backend/dist/esm/frontend/src/modules/request.js +0 -117
- package/backend/old/file_watcher.ts +0 -359
- package/backend/old/request.deprc.js +0 -626
- package/backend/old/response.deprc.js +0 -354
- package/frontend/dist/backend/src/database/collection.d.ts +0 -1765
- package/frontend/dist/backend/src/database/collection.js +0 -3779
- package/frontend/dist/backend/src/database/database.d.ts +0 -92
- package/frontend/dist/backend/src/database/database.js +0 -214
- package/frontend/dist/backend/src/database/filters/filters.d.ts +0 -6
- package/frontend/dist/backend/src/database/filters/filters.js +0 -1
- package/frontend/dist/backend/src/database/filters/strict_filter.d.ts +0 -223
- package/frontend/dist/backend/src/database/filters/strict_filter.js +0 -3
- package/frontend/dist/backend/src/database/filters/strict_update_filter.d.ts +0 -165
- package/frontend/dist/backend/src/database/filters/strict_update_filter.js +0 -5
- package/frontend/dist/backend/src/database/flatten.d.ts +0 -78
- package/frontend/dist/backend/src/database/flatten.js +0 -22
- package/frontend/dist/backend/src/endpoint.d.ts +0 -346
- package/frontend/dist/backend/src/endpoint.js +0 -479
- package/frontend/dist/backend/src/errors/index.d.ts +0 -7
- package/frontend/dist/backend/src/errors/index.js +0 -7
- package/frontend/dist/backend/src/errors/internal_external.d.ts +0 -52
- package/frontend/dist/backend/src/errors/internal_external.js +0 -86
- package/frontend/dist/backend/src/errors/invalid_usage_error.d.ts +0 -41
- package/frontend/dist/backend/src/errors/invalid_usage_error.js +0 -33
- package/frontend/dist/backend/src/errors/system_error.d.ts +0 -261
- package/frontend/dist/backend/src/errors/system_error.js +0 -444
- package/frontend/dist/backend/src/events.d.ts +0 -97
- package/frontend/dist/backend/src/events.js +0 -5
- package/frontend/dist/backend/src/frontend.d.ts +0 -11
- package/frontend/dist/backend/src/frontend.js +0 -12
- package/frontend/dist/backend/src/image_endpoint.d.ts +0 -44
- package/frontend/dist/backend/src/image_endpoint.js +0 -196
- package/frontend/dist/backend/src/meta.d.ts +0 -112
- package/frontend/dist/backend/src/meta.js +0 -152
- package/frontend/dist/backend/src/payments/paddle.d.ts +0 -329
- package/frontend/dist/backend/src/payments/paddle.js +0 -2276
- package/frontend/dist/backend/src/payments/stripe/checkout.d.ts +0 -113
- package/frontend/dist/backend/src/payments/stripe/checkout.js +0 -356
- package/frontend/dist/backend/src/payments/stripe/customers.d.ts +0 -17
- package/frontend/dist/backend/src/payments/stripe/customers.js +0 -193
- package/frontend/dist/backend/src/payments/stripe/error.d.ts +0 -74
- package/frontend/dist/backend/src/payments/stripe/error.js +0 -51
- package/frontend/dist/backend/src/payments/stripe/events.d.ts +0 -155
- package/frontend/dist/backend/src/payments/stripe/events.js +0 -5
- package/frontend/dist/backend/src/payments/stripe/meters.d.ts +0 -105
- package/frontend/dist/backend/src/payments/stripe/meters.js +0 -318
- package/frontend/dist/backend/src/payments/stripe/payment_methods.d.ts +0 -58
- package/frontend/dist/backend/src/payments/stripe/payment_methods.js +0 -135
- package/frontend/dist/backend/src/payments/stripe/products.d.ts +0 -519
- package/frontend/dist/backend/src/payments/stripe/products.js +0 -896
- package/frontend/dist/backend/src/payments/stripe/stripe.d.ts +0 -215
- package/frontend/dist/backend/src/payments/stripe/stripe.js +0 -464
- package/frontend/dist/backend/src/payments/stripe/subscriptions.d.ts +0 -172
- package/frontend/dist/backend/src/payments/stripe/subscriptions.js +0 -754
- package/frontend/dist/backend/src/payments/stripe/utils.d.ts +0 -63
- package/frontend/dist/backend/src/payments/stripe/utils.js +0 -131
- package/frontend/dist/backend/src/payments/stripe/webhooks.d.ts +0 -105
- package/frontend/dist/backend/src/payments/stripe/webhooks.js +0 -752
- package/frontend/dist/backend/src/plugins/mail/mail.d.ts +0 -255
- package/frontend/dist/backend/src/plugins/mail/mail.js +0 -396
- package/frontend/dist/backend/src/plugins/mail/ui.d.ts +0 -297
- package/frontend/dist/backend/src/plugins/mail/ui.js +0 -1400
- package/frontend/dist/backend/src/rate_limit.d.ts +0 -148
- package/frontend/dist/backend/src/rate_limit.js +0 -667
- package/frontend/dist/backend/src/route.d.ts +0 -39
- package/frontend/dist/backend/src/route.js +0 -222
- package/frontend/dist/backend/src/server.d.ts +0 -502
- package/frontend/dist/backend/src/server.js +0 -2034
- package/frontend/dist/backend/src/splash_screen.d.ts +0 -93
- package/frontend/dist/backend/src/splash_screen.js +0 -156
- package/frontend/dist/backend/src/status.d.ts +0 -89
- package/frontend/dist/backend/src/status.js +0 -213
- package/frontend/dist/backend/src/stream.d.ts +0 -494
- package/frontend/dist/backend/src/stream.js +0 -1611
- package/frontend/dist/backend/src/users.d.ts +0 -926
- package/frontend/dist/backend/src/users.js +0 -2423
- package/frontend/dist/backend/src/utils.d.ts +0 -22
- package/frontend/dist/backend/src/utils.js +0 -463
- package/frontend/dist/backend/src/view.d.ts +0 -115
- package/frontend/dist/backend/src/view.js +0 -584
- package/frontend/dist/frontend/src/elements/base.d.ts +0 -3743
- package/frontend/dist/frontend/src/elements/base.js +0 -12151
- package/frontend/dist/frontend/src/elements/module.d.ts +0 -95
- package/frontend/dist/frontend/src/elements/module.js +0 -216
- package/frontend/dist/frontend/src/elements/register_element.d.ts +0 -3
- package/frontend/dist/frontend/src/elements/register_element.js +0 -22
- package/frontend/dist/frontend/src/elements/resize_query_manager.d.ts +0 -0
- package/frontend/dist/frontend/src/elements/resize_query_manager.js +0 -150
- package/frontend/dist/frontend/src/elements/types.d.ts +0 -52
- package/frontend/dist/frontend/src/elements/types.js +0 -5
- package/frontend/dist/frontend/src/index.d.ts +0 -21
- package/frontend/dist/frontend/src/index.js +0 -29
- package/frontend/dist/frontend/src/modules/attachment.d.ts +0 -126
- package/frontend/dist/frontend/src/modules/attachment.js +0 -306
- package/frontend/dist/frontend/src/modules/auth.d.ts +0 -44
- package/frontend/dist/frontend/src/modules/auth.js +0 -80
- package/frontend/dist/frontend/src/modules/color.d.ts +0 -160
- package/frontend/dist/frontend/src/modules/color.js +0 -316
- package/frontend/dist/frontend/src/modules/compression.d.ts +0 -39
- package/frontend/dist/frontend/src/modules/compression.js +0 -102
- package/frontend/dist/frontend/src/modules/cookies.d.ts +0 -44
- package/frontend/dist/frontend/src/modules/cookies.js +0 -143
- package/frontend/dist/frontend/src/modules/events.d.ts +0 -31
- package/frontend/dist/frontend/src/modules/events.js +0 -79
- package/frontend/dist/frontend/src/modules/google.d.ts +0 -23
- package/frontend/dist/frontend/src/modules/google.js +0 -52
- package/frontend/dist/frontend/src/modules/meta.d.ts +0 -14
- package/frontend/dist/frontend/src/modules/meta.js +0 -48
- package/frontend/dist/frontend/src/modules/paddle.d.ts +0 -1207
- package/frontend/dist/frontend/src/modules/paddle.js +0 -2594
- package/frontend/dist/frontend/src/modules/request.d.ts +0 -70
- package/frontend/dist/frontend/src/modules/request.js +0 -117
- package/frontend/dist/frontend/src/modules/settings.d.ts +0 -3
- package/frontend/dist/frontend/src/modules/settings.js +0 -5
- package/frontend/dist/frontend/src/modules/statics.d.ts +0 -21
- package/frontend/dist/frontend/src/modules/statics.js +0 -43
- package/frontend/dist/frontend/src/modules/stripe/cart.d.ts +0 -112
- package/frontend/dist/frontend/src/modules/stripe/cart.js +0 -321
- package/frontend/dist/frontend/src/modules/stripe/checkout.d.ts +0 -7
- package/frontend/dist/frontend/src/modules/stripe/checkout.js +0 -37
- package/frontend/dist/frontend/src/modules/stripe/index.m.d.ts +0 -6
- package/frontend/dist/frontend/src/modules/stripe/index.m.js +0 -6
- package/frontend/dist/frontend/src/modules/stripe/payments.d.ts +0 -58
- package/frontend/dist/frontend/src/modules/stripe/payments.js +0 -92
- package/frontend/dist/frontend/src/modules/support.d.ts +0 -30
- package/frontend/dist/frontend/src/modules/support.js +0 -53
- package/frontend/dist/frontend/src/modules/theme.d.ts +0 -133
- package/frontend/dist/frontend/src/modules/theme.js +0 -406
- package/frontend/dist/frontend/src/modules/themes.d.ts +0 -12
- package/frontend/dist/frontend/src/modules/themes.js +0 -22
- package/frontend/dist/frontend/src/modules/user.d.ts +0 -164
- package/frontend/dist/frontend/src/modules/user.js +0 -270
- package/frontend/dist/frontend/src/modules/utils.d.ts +0 -176
- package/frontend/dist/frontend/src/modules/utils.js +0 -569
- package/frontend/dist/frontend/src/types/gradient.d.ts +0 -29
- package/frontend/dist/frontend/src/types/gradient.js +0 -79
- package/frontend/dist/frontend/src/ui/border_button.d.ts +0 -94
- package/frontend/dist/frontend/src/ui/border_button.js +0 -228
- package/frontend/dist/frontend/src/ui/button.d.ts +0 -241
- package/frontend/dist/frontend/src/ui/button.js +0 -682
- package/frontend/dist/frontend/src/ui/canvas.d.ts +0 -138
- package/frontend/dist/frontend/src/ui/canvas.js +0 -444
- package/frontend/dist/frontend/src/ui/checkbox.d.ts +0 -74
- package/frontend/dist/frontend/src/ui/checkbox.js +0 -321
- package/frontend/dist/frontend/src/ui/code.d.ts +0 -235
- package/frontend/dist/frontend/src/ui/code.js +0 -1007
- package/frontend/dist/frontend/src/ui/context_menu.d.ts +0 -36
- package/frontend/dist/frontend/src/ui/context_menu.js +0 -205
- package/frontend/dist/frontend/src/ui/css.d.ts +0 -16
- package/frontend/dist/frontend/src/ui/css.js +0 -48
- package/frontend/dist/frontend/src/ui/divider.d.ts +0 -15
- package/frontend/dist/frontend/src/ui/divider.js +0 -78
- package/frontend/dist/frontend/src/ui/dropdown.d.ts +0 -176
- package/frontend/dist/frontend/src/ui/dropdown.js +0 -481
- package/frontend/dist/frontend/src/ui/for_each.d.ts +0 -37
- package/frontend/dist/frontend/src/ui/for_each.js +0 -92
- package/frontend/dist/frontend/src/ui/form.d.ts +0 -34
- package/frontend/dist/frontend/src/ui/form.js +0 -233
- package/frontend/dist/frontend/src/ui/frame_modes.d.ts +0 -37
- package/frontend/dist/frontend/src/ui/frame_modes.js +0 -108
- package/frontend/dist/frontend/src/ui/google_map.d.ts +0 -24
- package/frontend/dist/frontend/src/ui/google_map.js +0 -106
- package/frontend/dist/frontend/src/ui/gradient.d.ts +0 -25
- package/frontend/dist/frontend/src/ui/gradient.js +0 -131
- package/frontend/dist/frontend/src/ui/image.d.ts +0 -111
- package/frontend/dist/frontend/src/ui/image.js +0 -576
- package/frontend/dist/frontend/src/ui/input.d.ts +0 -392
- package/frontend/dist/frontend/src/ui/input.js +0 -1201
- package/frontend/dist/frontend/src/ui/link.d.ts +0 -25
- package/frontend/dist/frontend/src/ui/link.js +0 -140
- package/frontend/dist/frontend/src/ui/list.d.ts +0 -37
- package/frontend/dist/frontend/src/ui/list.js +0 -170
- package/frontend/dist/frontend/src/ui/loader_button.d.ts +0 -80
- package/frontend/dist/frontend/src/ui/loader_button.js +0 -193
- package/frontend/dist/frontend/src/ui/loaders.d.ts +0 -57
- package/frontend/dist/frontend/src/ui/loaders.js +0 -157
- package/frontend/dist/frontend/src/ui/popup.d.ts +0 -94
- package/frontend/dist/frontend/src/ui/popup.js +0 -510
- package/frontend/dist/frontend/src/ui/pseudo.d.ts +0 -44
- package/frontend/dist/frontend/src/ui/pseudo.js +0 -154
- package/frontend/dist/frontend/src/ui/scroller.d.ts +0 -105
- package/frontend/dist/frontend/src/ui/scroller.js +0 -1253
- package/frontend/dist/frontend/src/ui/slider.d.ts +0 -45
- package/frontend/dist/frontend/src/ui/slider.js +0 -217
- package/frontend/dist/frontend/src/ui/spacer.d.ts +0 -15
- package/frontend/dist/frontend/src/ui/spacer.js +0 -78
- package/frontend/dist/frontend/src/ui/span.d.ts +0 -15
- package/frontend/dist/frontend/src/ui/span.js +0 -73
- package/frontend/dist/frontend/src/ui/stack.d.ts +0 -66
- package/frontend/dist/frontend/src/ui/stack.js +0 -335
- package/frontend/dist/frontend/src/ui/steps.d.ts +0 -131
- package/frontend/dist/frontend/src/ui/steps.js +0 -308
- package/frontend/dist/frontend/src/ui/style.d.ts +0 -17
- package/frontend/dist/frontend/src/ui/style.js +0 -73
- package/frontend/dist/frontend/src/ui/switch.d.ts +0 -69
- package/frontend/dist/frontend/src/ui/switch.js +0 -357
- package/frontend/dist/frontend/src/ui/table.d.ts +0 -100
- package/frontend/dist/frontend/src/ui/table.js +0 -405
- package/frontend/dist/frontend/src/ui/tabs.d.ts +0 -111
- package/frontend/dist/frontend/src/ui/tabs.js +0 -424
- package/frontend/dist/frontend/src/ui/text.d.ts +0 -15
- package/frontend/dist/frontend/src/ui/text.js +0 -83
- package/frontend/dist/frontend/src/ui/title.d.ts +0 -91
- package/frontend/dist/frontend/src/ui/title.js +0 -272
- package/frontend/dist/frontend/src/ui/ui.d.ts +0 -35
- package/frontend/dist/frontend/src/ui/ui.js +0 -38
- package/frontend/dist/frontend/src/ui/view.d.ts +0 -15
- package/frontend/dist/frontend/src/ui/view.js +0 -88
- package/frontend/dist/frontend/src/volt.d.ts +0 -20
- package/frontend/dist/frontend/src/volt.js +0 -27
- package/frontend/examples/theme/theme.ts +0 -58
- package/frontend/tools/bundle_d_ts.js +0 -71
- package/frontend/tools/convert_to_jsdoc_input.txt +0 -9452
- package/frontend/tools/convert_to_jsdoc_output.txt +0 -7626
- package/frontend/tools/convert_to_jsdoc_tmp.js +0 -345
- package/frontend/tools/scan_mixed_imports.js +0 -69
- /package/frontend/{dist/frontend/src/css → css}/adyen.css +0 -0
- /package/frontend/{dist/frontend/src/css → css}/volt.css +0 -0
|
@@ -1,193 +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 { InternalStripeError } from "./error.js";
|
|
7
|
-
import { stable_idempotency_key, stripe_api_call } from "./utils.js";
|
|
8
|
-
import { Collection } from "../../database/collection.js";
|
|
9
|
-
/**
|
|
10
|
-
* A cache for resolving Stripe customer ids from our internal user IDs (`uid`).
|
|
11
|
-
*/
|
|
12
|
-
const stripe_customer_cache = new vlib.Cache({
|
|
13
|
-
max_size: 100_000,
|
|
14
|
-
ttl: {
|
|
15
|
-
sliding: false,
|
|
16
|
-
duration: 60 * 60 * 1000, // 1 hour
|
|
17
|
-
},
|
|
18
|
-
});
|
|
19
|
-
/** The Stripe customer metadata key we use to link Stripe customers to our internal users. */
|
|
20
|
-
const stripe_customer_uid_metadata_key = "__volt_uid";
|
|
21
|
-
/**
|
|
22
|
-
* Escape a value for safe usage inside a Stripe Search query string.
|
|
23
|
-
* @see https://docs.stripe.com/search#search-query-language
|
|
24
|
-
*/
|
|
25
|
-
function escape_stripe_search_value(value) {
|
|
26
|
-
// Stripe search values are typically embedded in single quotes; escape backslashes and single quotes defensively.
|
|
27
|
-
// This prevents query breaking and reduces risk of accidental query injection from unexpected uid formats.
|
|
28
|
-
return value
|
|
29
|
-
.replaceAll("\\", "\\\\")
|
|
30
|
-
.replaceAll("'", "\\'");
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Assert that a `uid` is valid for use in Stripe customer mapping.
|
|
34
|
-
*/
|
|
35
|
-
function assert_uid(uid) {
|
|
36
|
-
if (typeof uid !== "string" || uid.length < 16 || uid.length > 128) {
|
|
37
|
-
throw new InternalStripeError("invalid_uid", "Invalid uid for Stripe customer mapping.", { uid_length: typeof uid === "string" ? uid.length : null });
|
|
38
|
-
}
|
|
39
|
-
// Fail closed on control characters instead of normalizing (normalizing can change identity).
|
|
40
|
-
if (/[\u0000-\u001F\u007F]/.test(uid)) {
|
|
41
|
-
throw new InternalStripeError("invalid_uid", "uid contains control characters.", {});
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Create the stripe customer session database collection.
|
|
46
|
-
*/
|
|
47
|
-
function create_customer_db(server) {
|
|
48
|
-
// Initialize the database connection.
|
|
49
|
-
return server.db.collection({
|
|
50
|
-
name: "Volt.Stripe.Customers",
|
|
51
|
-
indexes: [
|
|
52
|
-
{
|
|
53
|
-
keys: { customer_id: 1 },
|
|
54
|
-
unique: true,
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
keys: { uid: 1 },
|
|
58
|
-
unique: true,
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
// Ensure its not unique so we retrieve the cached collection if already created.
|
|
62
|
-
unique: false,
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Find an existing Stripe customer id for the given `uid` using Stripe's Search API.
|
|
67
|
-
* Returns `null` when no customer is found.
|
|
68
|
-
* @see https://docs.stripe.com/api/customers/search
|
|
69
|
-
*/
|
|
70
|
-
async function find_stripe_customer_id(client, uid) {
|
|
71
|
-
assert_uid(uid);
|
|
72
|
-
// Search by metadata so we never rely on PII like email for identity mapping.
|
|
73
|
-
// Docs: https://docs.stripe.com/api/customers/search
|
|
74
|
-
const escaped_uid = escape_stripe_search_value(uid);
|
|
75
|
-
const query = `metadata['${stripe_customer_uid_metadata_key}']:'${escaped_uid}'`;
|
|
76
|
-
const search_result = await stripe_api_call(() => client.customers.search({
|
|
77
|
-
query,
|
|
78
|
-
limit: 1,
|
|
79
|
-
}), { uid, query });
|
|
80
|
-
const customer = search_result.data[0];
|
|
81
|
-
if (!customer) {
|
|
82
|
-
return null;
|
|
83
|
-
}
|
|
84
|
-
return customer.id;
|
|
85
|
-
}
|
|
86
|
-
// ----------------------------------------------------------------------------
|
|
87
|
-
// Public API.
|
|
88
|
-
/**
|
|
89
|
-
* Ensure a Stripe customer exists for the given `uid`.
|
|
90
|
-
* @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.
|
|
91
|
-
*/
|
|
92
|
-
export async function ensure_stripe_customer(client, server, uid) {
|
|
93
|
-
assert_uid(uid);
|
|
94
|
-
// Check cache first.
|
|
95
|
-
const cached_customer_id = stripe_customer_cache.get(uid);
|
|
96
|
-
if (cached_customer_id) {
|
|
97
|
-
return cached_customer_id;
|
|
98
|
-
}
|
|
99
|
-
// Create collection.
|
|
100
|
-
const db = create_customer_db(server);
|
|
101
|
-
// The fetched customer id.
|
|
102
|
-
let customer_id;
|
|
103
|
-
// Attempt to load from database.
|
|
104
|
-
const record = await db.load({ uid }, {
|
|
105
|
-
throw: false,
|
|
106
|
-
projection: { customer_id: 1 },
|
|
107
|
-
retry: 3,
|
|
108
|
-
});
|
|
109
|
-
// Found.
|
|
110
|
-
if (!(record instanceof Error)) {
|
|
111
|
-
customer_id = record.customer_id;
|
|
112
|
-
}
|
|
113
|
-
// Not found.
|
|
114
|
-
else if (record instanceof Collection.NotFoundError) {
|
|
115
|
-
// Attempt to find an existing customer by metadata (idempotent across services/processes).
|
|
116
|
-
const existing_customer_id = await find_stripe_customer_id(client, uid);
|
|
117
|
-
if (existing_customer_id) {
|
|
118
|
-
customer_id = existing_customer_id;
|
|
119
|
-
}
|
|
120
|
-
// If none exists, create a new customer and store uid in metadata for future lookups.
|
|
121
|
-
else {
|
|
122
|
-
const created_customer = await stripe_api_call(() => client.customers.create({
|
|
123
|
-
metadata: {
|
|
124
|
-
[stripe_customer_uid_metadata_key]: uid,
|
|
125
|
-
},
|
|
126
|
-
}, {
|
|
127
|
-
// Prevent duplicates across concurrent calls / processes.
|
|
128
|
-
idempotencyKey: stable_idempotency_key(`customer_create_uid:${uid}`),
|
|
129
|
-
}), { uid, metadata_key: stripe_customer_uid_metadata_key });
|
|
130
|
-
customer_id = created_customer.id;
|
|
131
|
-
}
|
|
132
|
-
// Persist to database.
|
|
133
|
-
await db.set({ uid }, { customer_id }, {
|
|
134
|
-
upsert: true,
|
|
135
|
-
retry: 3,
|
|
136
|
-
});
|
|
137
|
-
// Load again in case we concurrently created the same customer in another process (should not error due to upsert, but ensures we have the correct customer_id).
|
|
138
|
-
const final_record = await db.load({ uid }, {
|
|
139
|
-
throw: false,
|
|
140
|
-
projection: { customer_id: 1 },
|
|
141
|
-
retry: 3,
|
|
142
|
-
});
|
|
143
|
-
if (final_record instanceof Error) {
|
|
144
|
-
throw new InternalStripeError("customer_not_found", "Failed to load Stripe customer from database after creation.", { uid, cause: final_record });
|
|
145
|
-
}
|
|
146
|
-
customer_id = final_record.customer_id;
|
|
147
|
-
}
|
|
148
|
-
// Error.
|
|
149
|
-
else {
|
|
150
|
-
throw new InternalStripeError("customer_not_found", "Failed to load Stripe customer from database.", { uid, cause: record });
|
|
151
|
-
}
|
|
152
|
-
// Save to cache.
|
|
153
|
-
stripe_customer_cache.set(uid, customer_id);
|
|
154
|
-
return customer_id;
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Delete a Stripe customer by their `uid`.
|
|
158
|
-
* This operation is best-effort and idempotent: if no Stripe customer exists for the `uid`, it returns without error.
|
|
159
|
-
* @see https://docs.stripe.com/api/customers/delete
|
|
160
|
-
*/
|
|
161
|
-
export async function delete_stripe_customer(client, server, uid) {
|
|
162
|
-
assert_uid(uid);
|
|
163
|
-
// Clear cache after resolving to prevent stale ids being served.
|
|
164
|
-
stripe_customer_cache.delete(uid);
|
|
165
|
-
// Create collection.
|
|
166
|
-
const db = create_customer_db(server);
|
|
167
|
-
// Load from database.
|
|
168
|
-
const record = await db.load({ uid }, {
|
|
169
|
-
throw: false,
|
|
170
|
-
projection: { customer_id: 1 },
|
|
171
|
-
});
|
|
172
|
-
// Not found, consider delete successful (idempotent semantics).
|
|
173
|
-
if (record instanceof Collection.NotFoundError) {
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
// Error.
|
|
177
|
-
else if (record instanceof Error) {
|
|
178
|
-
throw new InternalStripeError("customer_not_found", "Failed to load Stripe customer from database.", { uid, cause: record });
|
|
179
|
-
}
|
|
180
|
-
// If no customer exists, consider the delete successful (idempotent semantics).
|
|
181
|
-
if (!record.customer_id) {
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
// Delete customer in Stripe.
|
|
185
|
-
// Docs: https://docs.stripe.com/api/customers/delete
|
|
186
|
-
const deleted_customer = await stripe_api_call(() => client.customers.del(record.customer_id), { uid, customer_id: record.customer_id });
|
|
187
|
-
// Stripe returns a DeletedCustomer object with `deleted: true` on success.
|
|
188
|
-
if (deleted_customer.deleted !== true) {
|
|
189
|
-
throw new InternalStripeError("customer_delete_error", "Stripe customer delete did not return a deleted confirmation.", { uid, customer_id: record.customer_id });
|
|
190
|
-
}
|
|
191
|
-
// Remove from database.
|
|
192
|
-
await db.delete({ uid });
|
|
193
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author Daan van den Bergh
|
|
3
|
-
* @copyright © 2026 - 2026 Daan van den Bergh. All rights reserved
|
|
4
|
-
*/
|
|
5
|
-
import { ExternalError, InternalError } from "../../errors/internal_external.js";
|
|
6
|
-
/** The available stripe error code. */
|
|
7
|
-
export type StripeErrorCode = (
|
|
8
|
-
/** An error code indicating an invalid uid for Stripe customer mapping. */
|
|
9
|
-
"invalid_uid"
|
|
10
|
-
/** An error code indicating a failure to delete a Stripe customer. */
|
|
11
|
-
| "customer_delete_error"
|
|
12
|
-
/** An error code indicating a Stripe customer was not found. */
|
|
13
|
-
| "customer_not_found"
|
|
14
|
-
/** Invalid argument error code. */
|
|
15
|
-
| "invalid_argument"
|
|
16
|
-
/** Error code for an invalid product. */
|
|
17
|
-
| "invalid_product"
|
|
18
|
-
/** An error code indicating a generic Stripe API failure. */
|
|
19
|
-
| "api_error"
|
|
20
|
-
/** An error code indicating a failure during checkout session creation. */
|
|
21
|
-
| "checkout_create_error"
|
|
22
|
-
/** An error code indicating an invalid product reference during checkout session creation. */
|
|
23
|
-
| "checkout_invalid_product_ref"
|
|
24
|
-
/** An error code indicating a mixed currency error during checkout session creation. */
|
|
25
|
-
| "checkout_mixed_currency"
|
|
26
|
-
/** An error code indicating an ambiguous subscription plan reference during checkout session creation. */
|
|
27
|
-
| "checkout_subscription_plan_ambiguous"
|
|
28
|
-
/** An error code indicating an invalid quantity during checkout session creation. */
|
|
29
|
-
| "checkout_invalid_quantity"
|
|
30
|
-
/** An error code indicating the user is already subscribed to the plan. */
|
|
31
|
-
| "checkout_already_subscribed"
|
|
32
|
-
/** An error code indicating a subscription is not active and can not be billed. */
|
|
33
|
-
| "subscription_not_active"
|
|
34
|
-
/** An error code indicating a failure during subscription creation. */
|
|
35
|
-
| "subscription_create_error"
|
|
36
|
-
/** An error code indicating a subscription payment action is required. */
|
|
37
|
-
| "subscription_payment_action_required"
|
|
38
|
-
/** An error code indicating a missing payment method. */
|
|
39
|
-
| "payment_method_missing"
|
|
40
|
-
/** An error code indicating a subscription resolution error */
|
|
41
|
-
| "subscription_resolution_error"
|
|
42
|
-
/** An error code indicating a missing webhook endpoint secret. */
|
|
43
|
-
| "webhook_endpoint_secret_missing"
|
|
44
|
-
/** An error code indicating a failure to load webhook endpoint configuration. */
|
|
45
|
-
| "webhook_endpoint_load_error"
|
|
46
|
-
/** An error code indicating a mismatch between the webhook event's app id and the expected app id. */
|
|
47
|
-
| "webhook_endpoint_app_id_mismatch");
|
|
48
|
-
/**
|
|
49
|
-
* Custom error class to attach safe context while preserving the original cause.
|
|
50
|
-
* Internal errors thrown in REST API calls will be presented to the user as
|
|
51
|
-
* a generic internal server errog. Therefore the code, message and context
|
|
52
|
-
* are never shown to the user.
|
|
53
|
-
*/
|
|
54
|
-
export declare class InternalStripeError extends InternalError {
|
|
55
|
-
/** Stable error code for programmatic handling (never include secrets). */
|
|
56
|
-
readonly error_code: StripeErrorCode;
|
|
57
|
-
/** Optional safe context for debugging (never include secrets). */
|
|
58
|
-
readonly context?: Record<string, unknown>;
|
|
59
|
-
/** Constructs a StripeWrapperError. */
|
|
60
|
-
constructor(code: StripeErrorCode, message: string, context?: Record<string, unknown>, cause?: unknown);
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Custom error class to attach safe context while preserving the original cause.
|
|
64
|
-
* External errors thrown in REST API calls will be presented to the user with the message and code,
|
|
65
|
-
* but context is never shown to the user.
|
|
66
|
-
*/
|
|
67
|
-
export declare class ExternalStripeError extends ExternalError {
|
|
68
|
-
/** Stable error code for programmatic handling (never include secrets). */
|
|
69
|
-
readonly error_code: StripeErrorCode;
|
|
70
|
-
/** Optional safe context for debugging (never include secrets). */
|
|
71
|
-
readonly context?: Record<string, unknown>;
|
|
72
|
-
/** Constructs a StripeWrapperError. */
|
|
73
|
-
constructor(code: StripeErrorCode, message: string, context?: Record<string, unknown>, cause?: unknown);
|
|
74
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author Daan van den Bergh
|
|
3
|
-
* @copyright © 2026 - 2026 Daan van den Bergh. All rights reserved
|
|
4
|
-
*/
|
|
5
|
-
import { ExternalError, InternalError } from "../../errors/internal_external.js";
|
|
6
|
-
/**
|
|
7
|
-
* Custom error class to attach safe context while preserving the original cause.
|
|
8
|
-
* Internal errors thrown in REST API calls will be presented to the user as
|
|
9
|
-
* a generic internal server errog. Therefore the code, message and context
|
|
10
|
-
* are never shown to the user.
|
|
11
|
-
*/
|
|
12
|
-
export class InternalStripeError extends InternalError {
|
|
13
|
-
/** Stable error code for programmatic handling (never include secrets). */
|
|
14
|
-
error_code;
|
|
15
|
-
/** Optional safe context for debugging (never include secrets). */
|
|
16
|
-
context;
|
|
17
|
-
/** Constructs a StripeWrapperError. */
|
|
18
|
-
constructor(code, message, context, cause) {
|
|
19
|
-
super({
|
|
20
|
-
message,
|
|
21
|
-
type: code,
|
|
22
|
-
cause,
|
|
23
|
-
});
|
|
24
|
-
this.name = "StripeError";
|
|
25
|
-
this.error_code = code;
|
|
26
|
-
this.context = context;
|
|
27
|
-
this.cause = cause;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Custom error class to attach safe context while preserving the original cause.
|
|
32
|
-
* External errors thrown in REST API calls will be presented to the user with the message and code,
|
|
33
|
-
* but context is never shown to the user.
|
|
34
|
-
*/
|
|
35
|
-
export class ExternalStripeError extends ExternalError {
|
|
36
|
-
/** Stable error code for programmatic handling (never include secrets). */
|
|
37
|
-
error_code;
|
|
38
|
-
/** Optional safe context for debugging (never include secrets). */
|
|
39
|
-
context;
|
|
40
|
-
/** Constructs a StripeWrapperError. */
|
|
41
|
-
constructor(code, message, context, cause) {
|
|
42
|
-
super({
|
|
43
|
-
message,
|
|
44
|
-
type: code,
|
|
45
|
-
cause,
|
|
46
|
-
});
|
|
47
|
-
this.name = "StripeError";
|
|
48
|
-
this.error_code = code;
|
|
49
|
-
this.context = context;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
@@ -1,155 +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 { StripeResolvedSubscriptionItem } from "./webhooks.js";
|
|
7
|
-
/**
|
|
8
|
-
* Stripe webhook-driven events emitted by this module.
|
|
9
|
-
*
|
|
10
|
-
* These event names are intentionally explicit and stable.
|
|
11
|
-
* Consumers can subscribe via `server.on("<event-type>", cb)` if your Server supports it,
|
|
12
|
-
* or you can route them via `server.events.trigger("<event-type>", args)` as done below.
|
|
13
|
-
*/
|
|
14
|
-
export type StripeEvents = {
|
|
15
|
-
/**
|
|
16
|
-
* Fired when a Stripe Checkout Session is completed.
|
|
17
|
-
*
|
|
18
|
-
* Docs: https://docs.stripe.com/api/events/types#event_types-checkout.session.completed
|
|
19
|
-
*
|
|
20
|
-
* @note The defined events are executed in parallel and are awaited inside the webhook handler.
|
|
21
|
-
*/
|
|
22
|
-
"stripe.checkout_session_completed": (opts: {
|
|
23
|
-
/** The internal user id resolved from metadata. */
|
|
24
|
-
uid: string;
|
|
25
|
-
/** Stripe checkout session id. */
|
|
26
|
-
stripe_session_id: string;
|
|
27
|
-
/** Stripe checkout mode. */
|
|
28
|
-
mode: "payment" | "subscription" | "setup";
|
|
29
|
-
/** Stripe customer id. */
|
|
30
|
-
stripe_customer_id: string;
|
|
31
|
-
/** Stripe subscription id (only for mode="subscription"). */
|
|
32
|
-
stripe_subscription_id?: string;
|
|
33
|
-
/** Currency if available on the session. */
|
|
34
|
-
currency?: string;
|
|
35
|
-
/** Session metadata (safe). */
|
|
36
|
-
metadata: Stripe.Metadata;
|
|
37
|
-
}) => void | Promise<void>;
|
|
38
|
-
/**
|
|
39
|
-
* Fired when a Stripe subscription is created.
|
|
40
|
-
* Docs: https://docs.stripe.com/api/events/types#event_types-customer.subscription.created
|
|
41
|
-
*
|
|
42
|
-
* @note The defined events are executed in parallel and are awaited inside the webhook handler.
|
|
43
|
-
*/
|
|
44
|
-
"stripe.subscription_created": (opts: {
|
|
45
|
-
/** The internal user id. */
|
|
46
|
-
uid: string;
|
|
47
|
-
/** Stripe subscription id. */
|
|
48
|
-
stripe_subscription_id: string;
|
|
49
|
-
/** Stripe customer id. */
|
|
50
|
-
stripe_customer_id: string;
|
|
51
|
-
/** Stripe subscription status. */
|
|
52
|
-
status: Stripe.Subscription.Status;
|
|
53
|
-
/**
|
|
54
|
-
* Matched subscription items (price -> plan/product mapping when resolvable).
|
|
55
|
-
* This can contain multiple items if the subscription has multiple prices.
|
|
56
|
-
*/
|
|
57
|
-
items: StripeResolvedSubscriptionItem[];
|
|
58
|
-
}) => void | Promise<void>;
|
|
59
|
-
/**
|
|
60
|
-
* Fired when a Stripe subscription is updated.
|
|
61
|
-
* Docs: https://docs.stripe.com/api/events/types#event_types-customer.subscription.updated
|
|
62
|
-
*
|
|
63
|
-
* @note The defined events are executed in parallel and are awaited inside the webhook handler.
|
|
64
|
-
*/
|
|
65
|
-
"stripe.subscription_updated": (opts: {
|
|
66
|
-
uid: string;
|
|
67
|
-
stripe_subscription_id: string;
|
|
68
|
-
stripe_customer_id: string;
|
|
69
|
-
status: Stripe.Subscription.Status;
|
|
70
|
-
items: StripeResolvedSubscriptionItem[];
|
|
71
|
-
cancel_at_period_end?: boolean;
|
|
72
|
-
}) => void | Promise<void>;
|
|
73
|
-
/**
|
|
74
|
-
* Fired when a Stripe subscription is deleted/canceled.
|
|
75
|
-
* Docs: https://docs.stripe.com/api/events/types#event_types-customer.subscription.deleted
|
|
76
|
-
*
|
|
77
|
-
* @note The defined events are executed in parallel and are awaited inside the webhook handler.
|
|
78
|
-
*/
|
|
79
|
-
"stripe.subscription_deleted": (opts: {
|
|
80
|
-
uid: string;
|
|
81
|
-
stripe_subscription_id: string;
|
|
82
|
-
stripe_customer_id: string;
|
|
83
|
-
status: Stripe.Subscription.Status;
|
|
84
|
-
items: StripeResolvedSubscriptionItem[];
|
|
85
|
-
}) => void | Promise<void>;
|
|
86
|
-
/**
|
|
87
|
-
* Fired when an invoice is paid successfully.
|
|
88
|
-
* Docs: https://docs.stripe.com/api/events/types#event_types-invoice.paid
|
|
89
|
-
*
|
|
90
|
-
* @note The defined events are executed in parallel and are awaited inside the webhook handler.
|
|
91
|
-
*/
|
|
92
|
-
"stripe.invoice_paid": (opts: {
|
|
93
|
-
uid: string;
|
|
94
|
-
stripe_invoice_id: string;
|
|
95
|
-
stripe_customer_id: string;
|
|
96
|
-
amount_paid: number;
|
|
97
|
-
currency: string;
|
|
98
|
-
hosted_invoice_url?: string;
|
|
99
|
-
}) => void | Promise<void>;
|
|
100
|
-
/**
|
|
101
|
-
* Fired when an invoice payment fails.
|
|
102
|
-
* Docs: https://docs.stripe.com/api/events/types#event_types-invoice.payment_failed
|
|
103
|
-
*
|
|
104
|
-
* @note The defined events are executed in parallel and are awaited inside the webhook handler.
|
|
105
|
-
*/
|
|
106
|
-
"stripe.invoice_payment_failed": (opts: {
|
|
107
|
-
uid: string;
|
|
108
|
-
stripe_invoice_id: string;
|
|
109
|
-
stripe_customer_id: string;
|
|
110
|
-
amount_due: number;
|
|
111
|
-
currency: string;
|
|
112
|
-
hosted_invoice_url?: string;
|
|
113
|
-
}) => void | Promise<void>;
|
|
114
|
-
/**
|
|
115
|
-
* Fired when a PaymentIntent succeeds (covers one-time and some subscription flows).
|
|
116
|
-
* Docs: https://docs.stripe.com/api/events/types#event_types-payment_intent.succeeded
|
|
117
|
-
*
|
|
118
|
-
* @note The defined events are executed in parallel and are awaited inside the webhook handler.
|
|
119
|
-
*/
|
|
120
|
-
"stripe.payment_succeeded": (opts: {
|
|
121
|
-
uid: string;
|
|
122
|
-
stripe_payment_intent_id: string;
|
|
123
|
-
stripe_customer_id?: string;
|
|
124
|
-
amount_received: number;
|
|
125
|
-
currency: string;
|
|
126
|
-
metadata: Stripe.Metadata;
|
|
127
|
-
}) => void | Promise<void>;
|
|
128
|
-
/**
|
|
129
|
-
* Fired when a PaymentIntent fails.
|
|
130
|
-
* Docs: https://docs.stripe.com/api/events/types#event_types-payment_intent.payment_failed
|
|
131
|
-
*
|
|
132
|
-
* @note The defined events are executed in parallel and are awaited inside the webhook handler.
|
|
133
|
-
*/
|
|
134
|
-
"stripe.payment_failed": (opts: {
|
|
135
|
-
uid: string;
|
|
136
|
-
stripe_payment_intent_id: string;
|
|
137
|
-
stripe_customer_id?: string;
|
|
138
|
-
amount: number;
|
|
139
|
-
currency: string;
|
|
140
|
-
last_payment_error_message?: string;
|
|
141
|
-
metadata: Stripe.Metadata;
|
|
142
|
-
}) => void | Promise<void>;
|
|
143
|
-
/**
|
|
144
|
-
* Fired when a SetupIntent succeeds and we (best-effort) set the default payment method.
|
|
145
|
-
* Docs: https://docs.stripe.com/api/events/types#event_types-setup_intent.succeeded
|
|
146
|
-
*
|
|
147
|
-
* @note The defined events are executed in parallel and are awaited inside the webhook handler.
|
|
148
|
-
*/
|
|
149
|
-
"stripe.payment_method_ready": (opts: {
|
|
150
|
-
uid: string;
|
|
151
|
-
stripe_customer_id: string;
|
|
152
|
-
stripe_setup_intent_id: string;
|
|
153
|
-
stripe_payment_method_id: string;
|
|
154
|
-
}) => void | Promise<void>;
|
|
155
|
-
};
|
|
@@ -1,105 +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 { InitializedMeterProduct, InitializedProduct, MeterProduct } from "./products.js";
|
|
7
|
-
import { Server } from "../../server.js";
|
|
8
|
-
type AmountRounding = "exact" | "floor" | "ceil" | "round";
|
|
9
|
-
/**
|
|
10
|
-
* The options for recording meter usage.
|
|
11
|
-
*/
|
|
12
|
-
export type RecordMeterUsageOpts<Kind extends MeterProduct.Kind> = {
|
|
13
|
-
/** The internal user id (uid) whose usage should be recorded. */
|
|
14
|
-
uid: string;
|
|
15
|
-
/** The initialized meter product to record usage for. */
|
|
16
|
-
product: InitializedMeterProduct<Kind extends "units" ? MeterProduct.UnitsMeter : Kind extends "money" ? MeterProduct.MoneyMeter : never>;
|
|
17
|
-
/**
|
|
18
|
-
* Optional event timestamp.
|
|
19
|
-
* Must be within the past 35 calendar days or up to 5 minutes in the future.
|
|
20
|
-
* @see https://docs.stripe.com/api/billing/meter-event/create
|
|
21
|
-
*/
|
|
22
|
-
timestamp?: Date;
|
|
23
|
-
/**
|
|
24
|
-
* Event identifier to deduplicate accidental retries.
|
|
25
|
-
* Stripe enforces uniqueness within a rolling >=24h window.
|
|
26
|
-
* Must be non-empty, max 100 chars, and contain only letters, numbers, dots, underscores or hyphens.
|
|
27
|
-
* @see https://docs.stripe.com/api/billing/meter-event/create
|
|
28
|
-
*/
|
|
29
|
-
identifier: string;
|
|
30
|
-
} & (Kind extends "units" ? {
|
|
31
|
-
/**
|
|
32
|
-
* The numeric usage value to record (integer).
|
|
33
|
-
* For "sum"/"last" meters this is the numeric value.
|
|
34
|
-
* For "count" meters this can be 1 per event (but we still send a value).
|
|
35
|
-
*/
|
|
36
|
-
value: number;
|
|
37
|
-
} : Kind extends "money" ? {
|
|
38
|
-
/**
|
|
39
|
-
* Money amount in major units (e.g., "0.007463" USD), used only when product.kind === "money".
|
|
40
|
-
* Can be string or number (number is normalized to string).
|
|
41
|
-
*/
|
|
42
|
-
amount: string | number;
|
|
43
|
-
/**
|
|
44
|
-
* Rounding mode used when converting amount to internal integer units.
|
|
45
|
-
* @default "exact"
|
|
46
|
-
* @warning When round is `exact`, amounts with more precision than supported will be rejected by a thrown error, to prevent silent rounding bugs. Use an explicit rounding mode to allow lossy conversions.
|
|
47
|
-
*/
|
|
48
|
-
round?: AmountRounding;
|
|
49
|
-
} : never);
|
|
50
|
-
/**
|
|
51
|
-
* The result of recording meter usage.
|
|
52
|
-
*/
|
|
53
|
-
export interface RecordMeterUsageResult {
|
|
54
|
-
/** The Stripe billing meter event id. */
|
|
55
|
-
meter_event_identifier: string;
|
|
56
|
-
/** The meter event name used. */
|
|
57
|
-
event_name: string;
|
|
58
|
-
/** The unix timestamp (seconds) used for the event, if provided. */
|
|
59
|
-
timestamp: number;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Record usage for a metered subscription by creating a Stripe Billing Meter Event.
|
|
63
|
-
*
|
|
64
|
-
* Security & correctness guarantees:
|
|
65
|
-
* - Requires that the user has an active-ish subscription containing the meter product's price id.
|
|
66
|
-
* - Uses the meter's configured payload keys for customer/value mapping.
|
|
67
|
-
* - Allows caller-provided `identifier` to dedupe retries.
|
|
68
|
-
*
|
|
69
|
-
* Stripe docs:
|
|
70
|
-
* - Create meter event: https://docs.stripe.com/api/billing/meter-event/create
|
|
71
|
-
* - Record usage guide: https://docs.stripe.com/billing/subscriptions/usage-based/recording-usage-api
|
|
72
|
-
*
|
|
73
|
-
* @throws {InternalStripeError} When round mode is `exact` and the amount has more precision than supported.
|
|
74
|
-
* @throws {InternalStripeError} On internal errors.
|
|
75
|
-
* @throws {ExternalStripeError} On external errors such as the customer not being entitled to record usage for the meter product.
|
|
76
|
-
*/
|
|
77
|
-
export declare function record_meter_usage<Kind extends MeterProduct.Kind>(client: Stripe, server: Server, all_products: InitializedProduct[], opts: RecordMeterUsageOpts<Kind>): Promise<RecordMeterUsageResult>;
|
|
78
|
-
/** The options for {@link cancel_meter_usage_event} */
|
|
79
|
-
export interface CancelMeterUsageEventOpts {
|
|
80
|
-
/** The user id. */
|
|
81
|
-
uid: string;
|
|
82
|
-
/** The meter product whose event stream the event belongs to. */
|
|
83
|
-
product: InitializedMeterProduct;
|
|
84
|
-
/** The identifier of the meter event to cancel. */
|
|
85
|
-
meter_event_identifier: string;
|
|
86
|
-
}
|
|
87
|
-
/** The result type of {@link cancel_meter_usage_event} */
|
|
88
|
-
export interface CancelMeterUsageEventResult {
|
|
89
|
-
/** The identifier of the canceled meter event. */
|
|
90
|
-
meter_event_identifier: string;
|
|
91
|
-
/** The status of the adjustment created to cancel the event. Typically "pending". */
|
|
92
|
-
status: string;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Cancel a previously recorded meter event by identifier (best-effort within 24 hours).
|
|
96
|
-
*
|
|
97
|
-
* This is useful for:
|
|
98
|
-
* - reverting accidental double-reporting
|
|
99
|
-
* - compensating failed internal workflows
|
|
100
|
-
*
|
|
101
|
-
* Stripe docs:
|
|
102
|
-
* - Create meter event adjustment: https://docs.stripe.com/api/billing/meter-event-adjustment/create
|
|
103
|
-
*/
|
|
104
|
-
export declare function cancel_meter_usage_event(client: Stripe, server: Server, all_products: InitializedProduct[], opts: CancelMeterUsageEventOpts): Promise<CancelMeterUsageEventResult>;
|
|
105
|
-
export {};
|