@vandenberghinc/volt 1.1.26 → 1.1.28
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/backend/dist/cjs/{blacklist.d.ts → backend/src/blacklist.d.ts} +5 -3
- package/backend/dist/cjs/{blacklist.js → backend/src/blacklist.js} +8 -5
- package/backend/dist/cjs/{cli.js → backend/src/cli.js} +29 -47
- package/backend/dist/cjs/backend/src/database/collection.d.ts +1543 -0
- package/backend/dist/cjs/backend/src/database/collection.js +3042 -0
- package/backend/dist/cjs/backend/src/database/database.d.ts +66 -0
- package/backend/dist/cjs/{database → backend/src/database}/database.js +48 -43
- package/backend/dist/cjs/backend/src/database/filters/filters.d.ts +6 -0
- package/backend/dist/cjs/backend/src/database/filters/filters.js +15 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter.d.ts +223 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter.js +15 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_test.js +443 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_test_v0.js +15 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_v0.d.ts +50 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_v0.js +15 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_v1.d.ts +76 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_v1.js +15 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_v2.d.ts +75 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_v2.js +15 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_v3.d.ts +219 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_filter_v3.js +15 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_update_filter.d.ts +165 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_update_filter.js +15 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_update_filter_test.d.ts +5 -0
- package/backend/dist/cjs/backend/src/database/filters/strict_update_filter_test.js +355 -0
- package/backend/dist/cjs/backend/src/database/flatten.d.ts +75 -0
- package/backend/dist/cjs/{logger.js → backend/src/database/flatten.js} +18 -7
- package/backend/dist/cjs/backend/src/database/flatten_test.js +175 -0
- package/backend/dist/cjs/backend/src/database/quota/quota.d.ts +461 -0
- package/backend/dist/cjs/backend/src/database/quota/quota.js +1014 -0
- package/backend/dist/cjs/backend/src/database/quota/quota_v1.d.ts +534 -0
- package/backend/dist/cjs/backend/src/database/quota/quota_v1.js +1087 -0
- package/backend/dist/cjs/backend/src/database/quota/safe_int.d.ts +293 -0
- package/backend/dist/cjs/backend/src/database/quota/safe_int.js +573 -0
- package/backend/dist/{esm → cjs/backend/src}/endpoint.d.ts +69 -46
- package/backend/dist/cjs/{endpoint.js → backend/src/endpoint.js} +87 -101
- package/backend/dist/cjs/backend/src/errors/index.d.ts +7 -0
- package/backend/dist/cjs/backend/src/errors/index.js +25 -0
- package/backend/dist/{esm/utils.d.ts → cjs/backend/src/errors/internal_external.d.ts} +14 -22
- package/backend/dist/cjs/backend/src/errors/internal_external.js +85 -0
- package/backend/dist/cjs/backend/src/errors/invalid_usage_error.d.ts +38 -0
- package/backend/dist/cjs/{mutex.js → backend/src/errors/invalid_usage_error.js} +20 -37
- package/backend/dist/cjs/backend/src/errors/system_error.d.ts +230 -0
- package/backend/dist/cjs/backend/src/errors/system_error.js +393 -0
- package/backend/dist/cjs/backend/src/events.d.ts +54 -0
- package/backend/dist/cjs/backend/src/events.js +15 -0
- package/backend/dist/cjs/{frontend.js → backend/src/frontend.js} +1 -1
- package/backend/dist/cjs/{image_endpoint.d.ts → backend/src/image_endpoint.d.ts} +16 -1
- package/backend/dist/cjs/{image_endpoint.js → backend/src/image_endpoint.js} +3 -5
- package/backend/dist/cjs/backend/src/logger.d.ts +5 -0
- package/backend/dist/cjs/backend/src/logger.js +15 -0
- package/backend/dist/cjs/backend/src/meta.d.ts +64 -0
- package/backend/dist/cjs/{meta.js → backend/src/meta.js} +9 -12
- package/backend/dist/cjs/backend/src/payments/paddle.d.ts +326 -0
- package/backend/dist/cjs/{payments → backend/src/payments}/paddle.js +377 -327
- package/backend/dist/cjs/backend/src/plugins/browser.d.ts +1 -0
- package/backend/dist/cjs/backend/src/plugins/browser.js +15 -0
- package/backend/dist/cjs/backend/src/plugins/mail/mail.d.ts +248 -0
- package/backend/dist/cjs/backend/src/plugins/mail/mail.js +379 -0
- package/backend/dist/{esm → cjs/backend/src}/plugins/mail/ui.d.ts +23 -0
- package/backend/dist/cjs/backend/src/plugins/pdf.d.ts +1 -0
- package/backend/dist/cjs/backend/src/rate_limit.d.ts +145 -0
- package/backend/dist/cjs/backend/src/rate_limit.js +549 -0
- package/backend/dist/cjs/{route.d.ts → backend/src/route.d.ts} +3 -10
- package/backend/dist/cjs/{route.js → backend/src/route.js} +23 -21
- package/backend/dist/cjs/backend/src/server.d.ts +485 -0
- package/backend/dist/cjs/{server.js → backend/src/server.js} +688 -873
- package/backend/dist/cjs/backend/src/splash_screen.d.ts +80 -0
- package/backend/dist/cjs/{splash_screen.js → backend/src/splash_screen.js} +24 -3
- package/backend/dist/cjs/backend/src/status.d.ts +74 -0
- package/backend/dist/cjs/{status.js → backend/src/status.js} +64 -64
- package/backend/dist/cjs/backend/src/stream.d.ts +376 -0
- package/backend/dist/cjs/{stream.js → backend/src/stream.js} +299 -276
- package/backend/dist/cjs/backend/src/users.d.ts +807 -0
- package/backend/dist/cjs/backend/src/users.js +1971 -0
- package/backend/dist/cjs/backend/src/utils.d.ts +16 -0
- package/backend/dist/cjs/{utils.js → backend/src/utils.js} +14 -77
- package/backend/dist/{esm → cjs/backend/src}/view.d.ts +33 -11
- package/backend/dist/cjs/backend/src/view.js +508 -0
- package/backend/dist/{esm → cjs/backend/src}/volt.d.ts +10 -1
- package/backend/dist/cjs/{volt.js → backend/src/volt.js} +8 -5
- package/backend/dist/cjs/frontend/src/modules/request.d.ts +70 -0
- package/backend/dist/cjs/frontend/src/modules/request.js +99 -0
- package/backend/dist/esm/{blacklist.d.ts → backend/src/blacklist.d.ts} +5 -3
- package/backend/dist/esm/{blacklist.js → backend/src/blacklist.js} +9 -6
- package/backend/dist/esm/{cli.js → backend/src/cli.js} +43 -60
- package/backend/dist/esm/backend/src/database/collection.d.ts +1543 -0
- package/backend/dist/esm/backend/src/database/collection.js +3510 -0
- package/backend/dist/esm/backend/src/database/database.d.ts +66 -0
- package/backend/dist/esm/{database → backend/src/database}/database.js +62 -103
- package/backend/dist/esm/backend/src/database/document.d.ts +1 -0
- package/backend/dist/esm/backend/src/database/document.js +558 -0
- package/backend/dist/esm/backend/src/database/filters/filters.d.ts +6 -0
- package/backend/dist/esm/backend/src/database/filters/filters.js +1 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter.d.ts +223 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter.js +3 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_test.d.ts +1 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_test.js +505 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_test_v0.d.ts +1 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_test_v0.js +712 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_v0.d.ts +50 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_v0.js +5 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_v1.d.ts +76 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_v1.js +44 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_v2.d.ts +75 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_v2.js +5 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_v3.d.ts +219 -0
- package/backend/dist/esm/backend/src/database/filters/strict_filter_v3.js +1 -0
- package/backend/dist/esm/backend/src/database/filters/strict_update_filter.d.ts +165 -0
- package/backend/dist/esm/backend/src/database/filters/strict_update_filter.js +5 -0
- package/backend/dist/esm/backend/src/database/filters/strict_update_filter_test.d.ts +5 -0
- package/backend/dist/esm/backend/src/database/filters/strict_update_filter_test.js +405 -0
- package/backend/dist/esm/backend/src/database/flatten.d.ts +75 -0
- package/backend/dist/esm/backend/src/database/flatten.js +22 -0
- package/backend/dist/esm/backend/src/database/flatten_test.d.ts +1 -0
- package/backend/dist/esm/backend/src/database/flatten_test.js +174 -0
- package/backend/dist/esm/backend/src/database/quota/quota.d.ts +461 -0
- package/backend/dist/esm/backend/src/database/quota/quota.js +1118 -0
- package/backend/dist/esm/backend/src/database/quota/quota_v1.d.ts +534 -0
- package/backend/dist/esm/backend/src/database/quota/quota_v1.js +1242 -0
- package/backend/dist/esm/backend/src/database/quota/safe_int.d.ts +293 -0
- package/backend/dist/esm/backend/src/database/quota/safe_int.js +602 -0
- package/backend/dist/{cjs → esm/backend/src}/endpoint.d.ts +69 -46
- package/backend/dist/esm/{endpoint.js → backend/src/endpoint.js} +136 -127
- package/backend/dist/esm/backend/src/errors/index.d.ts +7 -0
- package/backend/dist/esm/backend/src/errors/index.js +7 -0
- package/backend/dist/{cjs/utils.d.ts → esm/backend/src/errors/internal_external.d.ts} +14 -22
- package/backend/dist/esm/backend/src/errors/internal_external.js +70 -0
- package/backend/dist/esm/backend/src/errors/invalid_usage_error.d.ts +38 -0
- package/backend/dist/esm/backend/src/errors/invalid_usage_error.js +30 -0
- package/backend/dist/esm/backend/src/errors/system_error.d.ts +230 -0
- package/backend/dist/esm/backend/src/errors/system_error.js +402 -0
- package/backend/dist/esm/backend/src/events.d.ts +54 -0
- package/backend/dist/esm/backend/src/events.js +5 -0
- package/backend/dist/esm/{frontend.js → backend/src/frontend.js} +1 -1
- package/backend/dist/esm/{image_endpoint.d.ts → backend/src/image_endpoint.d.ts} +16 -1
- package/backend/dist/esm/{image_endpoint.js → backend/src/image_endpoint.js} +16 -20
- package/backend/dist/esm/backend/src/logger.d.ts +5 -0
- package/backend/dist/esm/backend/src/logger.js +8 -0
- package/backend/dist/esm/backend/src/meta.d.ts +64 -0
- package/backend/dist/esm/{meta.js → backend/src/meta.js} +15 -54
- package/backend/dist/esm/backend/src/payments/paddle.d.ts +326 -0
- package/backend/dist/esm/{payments → backend/src/payments}/paddle.js +417 -452
- package/backend/dist/esm/backend/src/plugins/browser.d.ts +1 -0
- package/backend/dist/esm/backend/src/plugins/browser.js +170 -0
- package/backend/dist/esm/backend/src/plugins/mail/mail.d.ts +248 -0
- package/backend/dist/esm/backend/src/plugins/mail/mail.js +389 -0
- package/backend/dist/{cjs → esm/backend/src}/plugins/mail/ui.d.ts +23 -0
- package/backend/dist/esm/{plugins → backend/src/plugins}/mail/ui.js +3 -6
- package/backend/dist/esm/backend/src/plugins/pdf.d.ts +1 -0
- package/backend/dist/esm/{plugins → backend/src/plugins}/pdf.js +3 -3
- package/backend/dist/esm/backend/src/rate_limit.d.ts +145 -0
- package/backend/dist/esm/backend/src/rate_limit.js +667 -0
- package/backend/dist/esm/{route.d.ts → backend/src/route.d.ts} +3 -10
- package/backend/dist/esm/{route.js → backend/src/route.js} +26 -21
- package/backend/dist/esm/backend/src/server.d.ts +485 -0
- package/backend/dist/esm/{server.js → backend/src/server.js} +891 -1441
- package/backend/dist/esm/backend/src/splash_screen.d.ts +80 -0
- package/backend/dist/esm/{splash_screen.js → backend/src/splash_screen.js} +42 -55
- package/backend/dist/esm/backend/src/status.d.ts +74 -0
- package/backend/dist/esm/backend/src/status.js +199 -0
- package/backend/dist/esm/backend/src/stream.d.ts +376 -0
- package/backend/dist/esm/{stream.js → backend/src/stream.js} +327 -292
- package/backend/dist/esm/backend/src/users.d.ts +809 -0
- package/backend/dist/esm/backend/src/users.js +2140 -0
- package/backend/dist/esm/backend/src/utils.d.ts +16 -0
- package/backend/dist/esm/{utils.js → backend/src/utils.js} +20 -81
- package/backend/dist/{cjs → esm/backend/src}/view.d.ts +33 -11
- package/backend/dist/esm/{view.js → backend/src/view.js} +266 -86
- package/backend/dist/{cjs → esm/backend/src}/volt.d.ts +10 -1
- package/backend/dist/esm/{volt.js → backend/src/volt.js} +7 -4
- package/backend/dist/esm/frontend/src/modules/request.d.ts +70 -0
- package/backend/dist/esm/frontend/src/modules/request.js +117 -0
- package/frontend/dist/backend/src/database/collection.d.ts +1543 -0
- package/frontend/dist/backend/src/database/collection.js +3510 -0
- package/frontend/dist/backend/src/database/database.d.ts +66 -0
- package/frontend/dist/backend/src/database/database.js +196 -0
- package/frontend/dist/backend/src/database/filters/filters.d.ts +6 -0
- package/frontend/dist/backend/src/database/filters/filters.js +1 -0
- package/frontend/dist/backend/src/database/filters/strict_filter.d.ts +223 -0
- package/frontend/dist/backend/src/database/filters/strict_filter.js +3 -0
- package/frontend/dist/backend/src/database/filters/strict_update_filter.d.ts +165 -0
- package/frontend/dist/backend/src/database/filters/strict_update_filter.js +5 -0
- package/frontend/dist/backend/src/database/flatten.d.ts +75 -0
- package/frontend/dist/backend/src/database/flatten.js +22 -0
- package/frontend/dist/backend/src/endpoint.d.ts +204 -0
- package/frontend/dist/backend/src/endpoint.js +570 -0
- package/frontend/dist/backend/src/errors/index.d.ts +7 -0
- package/frontend/dist/backend/src/errors/index.js +7 -0
- package/frontend/dist/backend/src/errors/internal_external.d.ts +38 -0
- package/frontend/dist/backend/src/errors/internal_external.js +70 -0
- package/frontend/dist/backend/src/errors/invalid_usage_error.d.ts +38 -0
- package/frontend/dist/backend/src/errors/invalid_usage_error.js +30 -0
- package/frontend/dist/backend/src/errors/system_error.d.ts +230 -0
- package/frontend/dist/backend/src/errors/system_error.js +402 -0
- package/frontend/dist/backend/src/events.d.ts +54 -0
- package/frontend/dist/backend/src/events.js +5 -0
- package/frontend/dist/backend/src/frontend.d.ts +11 -0
- package/frontend/dist/backend/src/frontend.js +12 -0
- package/frontend/dist/backend/src/image_endpoint.d.ts +39 -0
- package/frontend/dist/backend/src/image_endpoint.js +202 -0
- package/frontend/dist/backend/src/meta.d.ts +64 -0
- package/frontend/dist/backend/src/meta.js +110 -0
- package/frontend/dist/backend/src/payments/paddle.d.ts +326 -0
- package/frontend/dist/backend/src/payments/paddle.js +2256 -0
- package/frontend/dist/backend/src/plugins/mail/mail.d.ts +248 -0
- package/frontend/dist/backend/src/plugins/mail/mail.js +389 -0
- package/{backend/dist/esm/plugins/mail.d.ts → frontend/dist/backend/src/plugins/mail/ui.d.ts} +23 -0
- package/{backend/dist/esm/plugins/mail.js → frontend/dist/backend/src/plugins/mail/ui.js} +3 -6
- package/frontend/dist/backend/src/rate_limit.d.ts +145 -0
- package/frontend/dist/backend/src/rate_limit.js +673 -0
- package/frontend/dist/backend/src/route.d.ts +35 -0
- package/frontend/dist/backend/src/route.js +212 -0
- package/frontend/dist/backend/src/server.d.ts +485 -0
- package/frontend/dist/backend/src/server.js +2670 -0
- package/frontend/dist/backend/src/splash_screen.d.ts +80 -0
- package/frontend/dist/backend/src/splash_screen.js +135 -0
- package/frontend/dist/backend/src/status.d.ts +74 -0
- package/frontend/dist/backend/src/status.js +199 -0
- package/frontend/dist/backend/src/stream.d.ts +376 -0
- package/frontend/dist/backend/src/stream.js +1007 -0
- package/frontend/dist/backend/src/users.d.ts +807 -0
- package/frontend/dist/backend/src/users.js +2118 -0
- package/frontend/dist/backend/src/utils.d.ts +16 -0
- package/frontend/dist/backend/src/utils.js +241 -0
- package/frontend/dist/backend/src/view.d.ts +162 -0
- package/frontend/dist/backend/src/view.js +720 -0
- package/frontend/dist/frontend/src/elements/base.d.ts +4414 -0
- package/frontend/dist/{elements → frontend/src/elements}/base.js +3624 -260
- package/frontend/dist/frontend/src/elements/module.d.ts +95 -0
- package/frontend/dist/{elements → frontend/src/elements}/module.js +53 -52
- package/frontend/dist/frontend/src/elements/types.d.ts +52 -0
- package/frontend/dist/frontend/src/elements/types.js +5 -0
- package/frontend/dist/frontend/src/modules/attachment.d.ts +126 -0
- package/frontend/dist/frontend/src/modules/attachment.js +306 -0
- package/frontend/dist/frontend/src/modules/auth.d.ts +44 -0
- package/frontend/dist/frontend/src/modules/auth.js +80 -0
- package/frontend/dist/{modules → frontend/src/modules}/color.js +2 -2
- package/frontend/dist/frontend/src/modules/compression.d.ts +39 -0
- package/frontend/dist/frontend/src/modules/compression.js +102 -0
- package/frontend/dist/frontend/src/modules/cookies.d.ts +44 -0
- package/frontend/dist/frontend/src/modules/cookies.js +143 -0
- package/frontend/dist/frontend/src/modules/events.d.ts +31 -0
- package/frontend/dist/frontend/src/modules/events.js +74 -0
- package/frontend/dist/frontend/src/modules/google.d.ts +23 -0
- package/frontend/dist/frontend/src/modules/google.js +52 -0
- package/frontend/dist/frontend/src/modules/meta.d.ts +14 -0
- package/frontend/dist/{modules → frontend/src/modules}/meta.js +9 -7
- package/frontend/dist/{modules → frontend/src/modules}/paddle.d.ts +37 -134
- package/frontend/dist/{modules → frontend/src/modules}/paddle.js +620 -568
- package/frontend/dist/frontend/src/modules/request.d.ts +70 -0
- package/frontend/dist/frontend/src/modules/request.js +117 -0
- package/frontend/dist/frontend/src/modules/settings.d.ts +3 -0
- package/frontend/dist/frontend/src/modules/settings.js +5 -0
- package/frontend/dist/frontend/src/modules/statics.d.ts +21 -0
- package/frontend/dist/{modules → frontend/src/modules}/statics.js +15 -18
- package/frontend/dist/frontend/src/modules/support.d.ts +30 -0
- package/frontend/dist/frontend/src/modules/support.js +53 -0
- package/frontend/dist/{modules → frontend/src/modules}/theme.d.ts +67 -0
- package/frontend/dist/{modules → frontend/src/modules}/theme.js +68 -38
- package/frontend/dist/frontend/src/modules/themes.d.ts +12 -0
- package/frontend/dist/frontend/src/modules/themes.js +22 -0
- package/frontend/dist/frontend/src/modules/user.d.ts +164 -0
- package/frontend/dist/frontend/src/modules/user.js +268 -0
- package/frontend/dist/frontend/src/modules/utils.d.ts +176 -0
- package/frontend/dist/frontend/src/modules/utils.js +569 -0
- package/frontend/dist/frontend/src/types/gradient.d.ts +29 -0
- package/frontend/dist/{types → frontend/src/types}/gradient.js +14 -18
- package/frontend/dist/frontend/src/ui/border_button.d.ts +94 -0
- package/frontend/dist/{ui → frontend/src/ui}/border_button.js +7 -13
- package/frontend/dist/frontend/src/ui/button.d.ts +28 -0
- package/frontend/dist/{ui → frontend/src/ui}/button.js +21 -12
- package/frontend/dist/frontend/src/ui/canvas.d.ts +138 -0
- package/frontend/dist/{ui → frontend/src/ui}/canvas.js +88 -55
- package/frontend/dist/frontend/src/ui/checkbox.d.ts +74 -0
- package/frontend/dist/{ui → frontend/src/ui}/checkbox.js +80 -41
- package/frontend/dist/{ui → frontend/src/ui}/code.d.ts +73 -6
- package/frontend/dist/{ui → frontend/src/ui}/code.js +55 -52
- package/frontend/dist/{ui → frontend/src/ui}/context_menu.d.ts +4 -0
- package/frontend/dist/{ui → frontend/src/ui}/context_menu.js +12 -17
- package/frontend/dist/{ui → frontend/src/ui}/css.d.ts +4 -0
- package/frontend/dist/{ui → frontend/src/ui}/css.js +3 -3
- package/frontend/dist/{ui → frontend/src/ui}/divider.d.ts +4 -0
- package/frontend/dist/{ui → frontend/src/ui}/divider.js +3 -3
- package/frontend/dist/{ui → frontend/src/ui}/dropdown.d.ts +57 -2
- package/frontend/dist/{ui → frontend/src/ui}/dropdown.js +87 -94
- package/frontend/dist/{ui → frontend/src/ui}/for_each.d.ts +4 -0
- package/frontend/dist/{ui → frontend/src/ui}/for_each.js +3 -3
- package/frontend/dist/{ui → frontend/src/ui}/form.d.ts +6 -2
- package/frontend/dist/{ui → frontend/src/ui}/form.js +10 -7
- package/frontend/dist/frontend/src/ui/frame_modes.d.ts +37 -0
- package/frontend/dist/{ui → frontend/src/ui}/frame_modes.js +16 -22
- package/frontend/dist/{ui → frontend/src/ui}/google_map.d.ts +4 -0
- package/frontend/dist/{ui → frontend/src/ui}/google_map.js +4 -4
- package/frontend/dist/{ui → frontend/src/ui}/gradient.d.ts +4 -0
- package/frontend/dist/{ui → frontend/src/ui}/gradient.js +3 -3
- package/frontend/dist/{ui → frontend/src/ui}/image.d.ts +4 -0
- package/frontend/dist/{ui → frontend/src/ui}/image.js +5 -5
- package/frontend/dist/frontend/src/ui/input.d.ts +392 -0
- package/frontend/dist/{ui → frontend/src/ui}/input.js +346 -360
- package/frontend/dist/{ui → frontend/src/ui}/link.d.ts +4 -0
- package/frontend/dist/{ui → frontend/src/ui}/link.js +3 -3
- package/frontend/dist/{ui → frontend/src/ui}/list.d.ts +4 -0
- package/frontend/dist/{ui → frontend/src/ui}/list.js +12 -6
- package/frontend/dist/frontend/src/ui/loader_button.d.ts +80 -0
- package/frontend/dist/{ui → frontend/src/ui}/loader_button.js +35 -47
- package/frontend/dist/frontend/src/ui/loaders.d.ts +57 -0
- package/frontend/dist/{ui → frontend/src/ui}/loaders.js +11 -11
- package/frontend/dist/{ui → frontend/src/ui}/popup.d.ts +11 -6
- package/frontend/dist/{ui → frontend/src/ui}/popup.js +32 -18
- package/frontend/dist/frontend/src/ui/pseudo.d.ts +44 -0
- package/frontend/dist/{ui → frontend/src/ui}/pseudo.js +84 -8
- package/frontend/dist/{ui → frontend/src/ui}/scroller.d.ts +14 -2
- package/frontend/dist/{ui → frontend/src/ui}/scroller.js +37 -43
- package/frontend/dist/{ui → frontend/src/ui}/slider.d.ts +5 -1
- package/frontend/dist/{ui → frontend/src/ui}/slider.js +4 -4
- package/frontend/dist/{ui → frontend/src/ui}/spacer.d.ts +4 -0
- package/frontend/dist/{ui → frontend/src/ui}/spacer.js +3 -3
- package/frontend/dist/{ui → frontend/src/ui}/span.d.ts +4 -0
- package/frontend/dist/{ui → frontend/src/ui}/span.js +3 -3
- package/frontend/dist/{ui → frontend/src/ui}/stack.d.ts +4 -0
- package/frontend/dist/{ui → frontend/src/ui}/stack.js +3 -9
- package/frontend/dist/frontend/src/ui/steps.d.ts +131 -0
- package/frontend/dist/{ui → frontend/src/ui}/steps.js +30 -45
- package/frontend/dist/{ui → frontend/src/ui}/style.d.ts +4 -0
- package/frontend/dist/{ui → frontend/src/ui}/style.js +3 -3
- package/frontend/dist/{ui → frontend/src/ui}/switch.d.ts +5 -1
- package/frontend/dist/{ui → frontend/src/ui}/switch.js +4 -4
- package/frontend/dist/{ui → frontend/src/ui}/table.d.ts +4 -0
- package/frontend/dist/{ui → frontend/src/ui}/table.js +6 -6
- package/frontend/dist/{ui → frontend/src/ui}/tabs.d.ts +45 -3
- package/frontend/dist/{ui → frontend/src/ui}/tabs.js +65 -40
- package/frontend/dist/{ui → frontend/src/ui}/text.d.ts +4 -0
- package/frontend/dist/{ui → frontend/src/ui}/text.js +3 -3
- package/frontend/dist/frontend/src/ui/title.d.ts +91 -0
- package/frontend/dist/frontend/src/ui/title.js +272 -0
- package/frontend/dist/{ui → frontend/src/ui}/view.d.ts +4 -0
- package/frontend/dist/{ui → frontend/src/ui}/view.js +3 -3
- package/frontend/dist/{volt.d.ts → frontend/src/volt.d.ts} +3 -0
- package/frontend/dist/{volt.js → frontend/src/volt.js} +4 -0
- package/frontend/tools/bundle_d_ts.js +71 -0
- package/frontend/tools/convert_to_jsdoc_input.txt +9452 -0
- package/frontend/tools/convert_to_jsdoc_output.txt +7626 -0
- package/frontend/tools/convert_to_jsdoc_tmp.js +345 -0
- package/package.json +11 -12
- package/backend/dist/cjs/database/collection.d.ts +0 -160
- package/backend/dist/cjs/database/collection.js +0 -842
- package/backend/dist/cjs/database/database.d.ts +0 -121
- package/backend/dist/cjs/database/document.d.ts +0 -131
- package/backend/dist/cjs/database/document.js +0 -224
- package/backend/dist/cjs/database.d.ts +0 -502
- package/backend/dist/cjs/database.js +0 -2248
- package/backend/dist/cjs/logger.d.ts +0 -3
- package/backend/dist/cjs/meta.d.ts +0 -50
- package/backend/dist/cjs/mutex.d.ts +0 -24
- package/backend/dist/cjs/payments/paddle.d.ts +0 -160
- package/backend/dist/cjs/plugins/browser.d.ts +0 -36
- package/backend/dist/cjs/plugins/browser.js +0 -198
- package/backend/dist/cjs/plugins/css.d.ts +0 -11
- package/backend/dist/cjs/plugins/css.js +0 -80
- package/backend/dist/cjs/plugins/mail.d.ts +0 -277
- package/backend/dist/cjs/plugins/mail.js +0 -1370
- package/backend/dist/cjs/plugins/ts/compiler.d.ts +0 -139
- package/backend/dist/cjs/plugins/ts/compiler.js +0 -750
- package/backend/dist/cjs/plugins/ts/preprocessing.d.ts +0 -14
- package/backend/dist/cjs/plugins/ts/preprocessing.js +0 -440
- package/backend/dist/cjs/rate_limit.d.ts +0 -63
- package/backend/dist/cjs/rate_limit.js +0 -348
- package/backend/dist/cjs/request.deprc.d.ts +0 -48
- package/backend/dist/cjs/request.deprc.js +0 -572
- package/backend/dist/cjs/response.deprc.d.ts +0 -55
- package/backend/dist/cjs/response.deprc.js +0 -275
- package/backend/dist/cjs/server.d.ts +0 -342
- package/backend/dist/cjs/splash_screen.d.ts +0 -35
- package/backend/dist/cjs/status.d.ts +0 -61
- package/backend/dist/cjs/stream.d.ts +0 -79
- package/backend/dist/cjs/users.d.ts +0 -111
- package/backend/dist/cjs/users.js +0 -1817
- package/backend/dist/cjs/view.js +0 -352
- package/backend/dist/cjs/vinc.dev.d.ts +0 -3
- package/backend/dist/cjs/vinc.dev.js +0 -7
- package/backend/dist/css/adyen.css +0 -92
- package/backend/dist/css/volt.css +0 -70
- package/backend/dist/esm/database/collection.d.ts +0 -160
- package/backend/dist/esm/database/collection.js +0 -1328
- package/backend/dist/esm/database/database.d.ts +0 -121
- package/backend/dist/esm/database/document.d.ts +0 -131
- package/backend/dist/esm/database/document.js +0 -247
- package/backend/dist/esm/database.d.ts +0 -502
- package/backend/dist/esm/database.js +0 -2423
- package/backend/dist/esm/file_watcher.js +0 -329
- package/backend/dist/esm/logger.d.ts +0 -3
- package/backend/dist/esm/logger.js +0 -11
- package/backend/dist/esm/meta.d.ts +0 -50
- package/backend/dist/esm/mutex.d.ts +0 -24
- package/backend/dist/esm/mutex.js +0 -48
- package/backend/dist/esm/payments/paddle.d.ts +0 -160
- package/backend/dist/esm/plugins/browser.d.ts +0 -36
- package/backend/dist/esm/plugins/browser.js +0 -176
- package/backend/dist/esm/plugins/css.d.ts +0 -11
- package/backend/dist/esm/plugins/css.js +0 -90
- package/backend/dist/esm/plugins/ts/compiler.d.ts +0 -139
- package/backend/dist/esm/plugins/ts/compiler.js +0 -1194
- package/backend/dist/esm/plugins/ts/preprocessing.d.ts +0 -14
- package/backend/dist/esm/plugins/ts/preprocessing.js +0 -726
- package/backend/dist/esm/rate_limit.d.ts +0 -63
- package/backend/dist/esm/rate_limit.js +0 -417
- package/backend/dist/esm/request.deprc.d.ts +0 -48
- package/backend/dist/esm/request.deprc.js +0 -572
- package/backend/dist/esm/response.deprc.d.ts +0 -55
- package/backend/dist/esm/response.deprc.js +0 -275
- package/backend/dist/esm/server.d.ts +0 -342
- package/backend/dist/esm/splash_screen.d.ts +0 -35
- package/backend/dist/esm/status.d.ts +0 -61
- package/backend/dist/esm/status.js +0 -197
- package/backend/dist/esm/stream.d.ts +0 -79
- package/backend/dist/esm/users.d.ts +0 -111
- package/backend/dist/esm/users.js +0 -1935
- package/backend/dist/esm/vinc.dev.d.ts +0 -3
- package/backend/dist/esm/vinc.dev.js +0 -7
- package/frontend/dist/elements/base.d.ts +0 -9889
- package/frontend/dist/elements/module.d.ts +0 -30
- package/frontend/dist/modules/array.d.ts +0 -94
- package/frontend/dist/modules/array.js +0 -634
- package/frontend/dist/modules/auth.d.ts +0 -46
- package/frontend/dist/modules/auth.js +0 -139
- package/frontend/dist/modules/colors.d.ts +0 -1
- package/frontend/dist/modules/colors.js +0 -417
- package/frontend/dist/modules/compression.d.ts +0 -6
- package/frontend/dist/modules/compression.js +0 -999
- package/frontend/dist/modules/cookies.d.ts +0 -18
- package/frontend/dist/modules/cookies.js +0 -167
- package/frontend/dist/modules/date.d.ts +0 -142
- package/frontend/dist/modules/date.js +0 -493
- package/frontend/dist/modules/events.d.ts +0 -8
- package/frontend/dist/modules/events.js +0 -91
- package/frontend/dist/modules/google.d.ts +0 -11
- package/frontend/dist/modules/google.js +0 -54
- package/frontend/dist/modules/meta.d.ts +0 -10
- package/frontend/dist/modules/mutex.d.ts +0 -7
- package/frontend/dist/modules/mutex.js +0 -51
- package/frontend/dist/modules/number.d.ts +0 -16
- package/frontend/dist/modules/number.js +0 -23
- package/frontend/dist/modules/object.d.ts +0 -52
- package/frontend/dist/modules/object.js +0 -383
- package/frontend/dist/modules/scheme.d.ts +0 -227
- package/frontend/dist/modules/scheme.js +0 -531
- package/frontend/dist/modules/settings.d.ts +0 -3
- package/frontend/dist/modules/settings.js +0 -4
- package/frontend/dist/modules/statics.d.ts +0 -5
- package/frontend/dist/modules/string.d.ts +0 -124
- package/frontend/dist/modules/string.js +0 -745
- package/frontend/dist/modules/support.d.ts +0 -19
- package/frontend/dist/modules/support.js +0 -103
- package/frontend/dist/modules/themes.d.ts +0 -8
- package/frontend/dist/modules/themes.js +0 -18
- package/frontend/dist/modules/user.d.ts +0 -59
- package/frontend/dist/modules/user.js +0 -280
- package/frontend/dist/modules/utils.d.ts +0 -87
- package/frontend/dist/modules/utils.js +0 -923
- package/frontend/dist/types/gradient.d.ts +0 -12
- package/frontend/dist/ui/border_button.d.ts +0 -152
- package/frontend/dist/ui/button.d.ts +0 -21
- package/frontend/dist/ui/canvas.d.ts +0 -56
- package/frontend/dist/ui/checkbox.d.ts +0 -52
- package/frontend/dist/ui/frame_modes.d.ts +0 -25
- package/frontend/dist/ui/input.d.ts +0 -241
- package/frontend/dist/ui/loader_button.d.ts +0 -93
- package/frontend/dist/ui/loaders.d.ts +0 -57
- package/frontend/dist/ui/pseudo.d.ts +0 -16
- package/frontend/dist/ui/steps.d.ts +0 -59
- package/frontend/dist/ui/title.d.ts +0 -21
- package/frontend/dist/ui/title.js +0 -121
- package/frontend/examples/dashboard/dashboard.ts +0 -776
- /package/backend/dist/cjs/{cli.d.ts → backend/src/cli.d.ts} +0 -0
- /package/backend/dist/cjs/{file_watcher.d.ts → backend/src/database/document.d.ts} +0 -0
- /package/backend/dist/cjs/{file_watcher.js → backend/src/database/document.js} +0 -0
- /package/backend/dist/cjs/{plugins/pdf.d.ts → backend/src/database/filters/strict_filter_test.d.ts} +0 -0
- /package/backend/dist/{esm/file_watcher.d.ts → cjs/backend/src/database/filters/strict_filter_test_v0.d.ts} +0 -0
- /package/backend/dist/{esm/plugins/pdf.d.ts → cjs/backend/src/database/flatten_test.d.ts} +0 -0
- /package/backend/dist/cjs/{frontend.d.ts → backend/src/frontend.d.ts} +0 -0
- /package/backend/dist/cjs/{plugins → backend/src/plugins}/communication.d.ts +0 -0
- /package/backend/dist/cjs/{plugins → backend/src/plugins}/communication.js +0 -0
- /package/backend/dist/cjs/{plugins → backend/src/plugins}/mail/ui.js +0 -0
- /package/backend/dist/cjs/{plugins → backend/src/plugins}/pdf.js +0 -0
- /package/backend/dist/cjs/{plugins → backend/src/plugins}/thread_monitor.d.ts +0 -0
- /package/backend/dist/cjs/{plugins → backend/src/plugins}/thread_monitor.js +0 -0
- /package/backend/dist/cjs/{vinc.d.ts → backend/src/vinc.d.ts} +0 -0
- /package/backend/dist/cjs/{vinc.js → backend/src/vinc.js} +0 -0
- /package/backend/dist/esm/{cli.d.ts → backend/src/cli.d.ts} +0 -0
- /package/backend/dist/esm/{frontend.d.ts → backend/src/frontend.d.ts} +0 -0
- /package/backend/dist/esm/{plugins → backend/src/plugins}/communication.d.ts +0 -0
- /package/backend/dist/esm/{plugins → backend/src/plugins}/communication.js +0 -0
- /package/backend/dist/esm/{plugins → backend/src/plugins}/thread_monitor.d.ts +0 -0
- /package/backend/dist/esm/{plugins → backend/src/plugins}/thread_monitor.js +0 -0
- /package/backend/dist/esm/{vinc.d.ts → backend/src/vinc.d.ts} +0 -0
- /package/backend/dist/esm/{vinc.js → backend/src/vinc.js} +0 -0
- /package/frontend/dist/{elements → frontend/src/elements}/register_element.d.ts +0 -0
- /package/frontend/dist/{elements → frontend/src/elements}/register_element.js +0 -0
- /package/frontend/dist/{modules → frontend/src/modules}/color.d.ts +0 -0
- /package/frontend/dist/{ui → frontend/src/ui}/ui.d.ts +0 -0
- /package/frontend/dist/{ui → frontend/src/ui}/ui.js +0 -0
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author Daan van den Bergh
|
|
3
|
+
* @copyright © 2025 - 2025 Daan van den Bergh. All rights reserved.
|
|
4
|
+
*/
|
|
5
|
+
// External imports.
|
|
6
|
+
import * as vlib from "@vandenberghinc/vlib";
|
|
7
|
+
/**
|
|
8
|
+
* The system error.
|
|
9
|
+
* Used to indicate a fatal system error that should not occur and should be reported to developers.
|
|
10
|
+
* When created, it is logged and (optionally) persisted to the configured collection.
|
|
11
|
+
*/
|
|
12
|
+
export class SystemError extends Error {
|
|
13
|
+
/**
|
|
14
|
+
* The default logger to dump messages to.
|
|
15
|
+
* This can either be `console` or a custom logger such as `FileLogger`.
|
|
16
|
+
*
|
|
17
|
+
* This logger is shared across all system errors,
|
|
18
|
+
* unless a specific logger is passed to the {@link SystemError.Opts} constructor options.
|
|
19
|
+
*/
|
|
20
|
+
static logger = console;
|
|
21
|
+
/**
|
|
22
|
+
* The default collection to save the error to.
|
|
23
|
+
*
|
|
24
|
+
* This collection is shared across all system errors,
|
|
25
|
+
* unless a specific collection is passed to the {@link SystemError.Opts} constructor options.
|
|
26
|
+
*
|
|
27
|
+
* @warning
|
|
28
|
+
* If both {@link SystemError.collection} and field {@link SystemError.Opts.collection} are undefined,
|
|
29
|
+
* the error will not be saved to the database.
|
|
30
|
+
*
|
|
31
|
+
* @note Ensure a database index is created for field `id`.
|
|
32
|
+
*/
|
|
33
|
+
static collection;
|
|
34
|
+
/**
|
|
35
|
+
* Set a collection that will be used as default to save system errors to.
|
|
36
|
+
*
|
|
37
|
+
* @param collection The collection options to use.
|
|
38
|
+
*/
|
|
39
|
+
static set_collection(opts) {
|
|
40
|
+
SystemError.collection = opts.server.db.collection({
|
|
41
|
+
name: opts.name,
|
|
42
|
+
ttl: opts.ttl,
|
|
43
|
+
indexes: [
|
|
44
|
+
{ keys: { id: 1 }, unique: true, forced: true }
|
|
45
|
+
],
|
|
46
|
+
record_version: 1,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The generated identifier length (characters) for error IDs.
|
|
51
|
+
* Defaults to 256 to preserve existing behavior; tune per database constraints.
|
|
52
|
+
*/
|
|
53
|
+
static id_length = 256;
|
|
54
|
+
/**
|
|
55
|
+
* The maximum length for the stringified {@link SystemError.details} field when saved to the database collection as a string.
|
|
56
|
+
* The `details` field is stringified when it (a) contains cycles or non-plain structures, or (b) its full JSON size exceeds
|
|
57
|
+
* {@link SystemError.max_details_length}. Otherwise, the redacted plain object/array is stored.
|
|
58
|
+
*/
|
|
59
|
+
static max_details_length = 10_000;
|
|
60
|
+
/**
|
|
61
|
+
* A unique id for this error instance.
|
|
62
|
+
* Unique to this system error instance.
|
|
63
|
+
*/
|
|
64
|
+
id;
|
|
65
|
+
/** The attached message. */
|
|
66
|
+
message;
|
|
67
|
+
/** The attached details. */
|
|
68
|
+
details;
|
|
69
|
+
/** A nested error cause. */
|
|
70
|
+
cause;
|
|
71
|
+
/** The collection to save the error to. */
|
|
72
|
+
collection;
|
|
73
|
+
/**
|
|
74
|
+
* The logger to dump messages to.
|
|
75
|
+
* Defaults to static attribute {@link SystemError.logger}.
|
|
76
|
+
*/
|
|
77
|
+
logger;
|
|
78
|
+
/**
|
|
79
|
+
* An optional owner field.
|
|
80
|
+
* For instance system errors saved by the {@link QuotaManager} have an owner of `volt.QuotaManager`.
|
|
81
|
+
*/
|
|
82
|
+
owner;
|
|
83
|
+
/** The creation timestamp in milliseconds since Unix epoch. */
|
|
84
|
+
timestamp;
|
|
85
|
+
/** The captured stacktrace of the creation of the system error. */
|
|
86
|
+
trace;
|
|
87
|
+
/** A cache for the result of format({ colored: true }). */
|
|
88
|
+
_format_colored;
|
|
89
|
+
/** A cache for the result of format({ colored: false }). */
|
|
90
|
+
_format_non_colored;
|
|
91
|
+
/**
|
|
92
|
+
* Private constructor.
|
|
93
|
+
* Use {@link SystemError.create} or {@link SystemError.create_detach} to create a new system error.
|
|
94
|
+
*/
|
|
95
|
+
constructor(opts) {
|
|
96
|
+
super(opts.message);
|
|
97
|
+
// Ensures `instanceof SystemError` works in all transpilation targets.
|
|
98
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
99
|
+
// Attributes.
|
|
100
|
+
this.message = opts.message;
|
|
101
|
+
this.details = opts.details;
|
|
102
|
+
this.collection = opts.collection ?? SystemError.collection;
|
|
103
|
+
this.logger = opts.logger ?? SystemError.logger;
|
|
104
|
+
this.owner = opts.owner;
|
|
105
|
+
// Define 'cause' as non-enumerable to avoid accidental leakage on serialization.
|
|
106
|
+
if (opts.cause) {
|
|
107
|
+
Object.defineProperty(this, "cause", {
|
|
108
|
+
value: opts.cause,
|
|
109
|
+
enumerable: false,
|
|
110
|
+
configurable: true,
|
|
111
|
+
writable: true,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
// Generate an id.
|
|
115
|
+
this.id = vlib.String.random(SystemError.id_length, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
|
|
116
|
+
// Set error instance name.
|
|
117
|
+
this.name = "SystemError";
|
|
118
|
+
// Add timestamp.
|
|
119
|
+
this.timestamp = Date.now();
|
|
120
|
+
/** Capture a robust stack trace at the point of creation (cross-env safe). */
|
|
121
|
+
const holder = { name: "X", message: "Y" };
|
|
122
|
+
let prev_limit;
|
|
123
|
+
try {
|
|
124
|
+
// Feature-detect Node API.
|
|
125
|
+
const has_capture = typeof Error.captureStackTrace === "function";
|
|
126
|
+
const has_limit = typeof Error.stackTraceLimit === "number";
|
|
127
|
+
if (has_limit) {
|
|
128
|
+
prev_limit = Error.stackTraceLimit;
|
|
129
|
+
Error.stackTraceLimit = 35;
|
|
130
|
+
}
|
|
131
|
+
if (has_capture) {
|
|
132
|
+
Error.captureStackTrace(holder, this.constructor);
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
// Fallback: use current error stack
|
|
136
|
+
holder.stack = this.stack;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
finally {
|
|
140
|
+
if (typeof prev_limit === "number") {
|
|
141
|
+
Error.stackTraceLimit = prev_limit;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
this.trace = (holder.stack || "")
|
|
145
|
+
.split("\n")
|
|
146
|
+
.slice(1)
|
|
147
|
+
.map((line) => line.trim());
|
|
148
|
+
// Dont log from here, log from create or create_detach.
|
|
149
|
+
// Perhaps we also want to create a constructor for loaded sys errs later.
|
|
150
|
+
}
|
|
151
|
+
/** Construct a system error & save it to the database. */
|
|
152
|
+
static async create(opts) {
|
|
153
|
+
const error = new SystemError(opts);
|
|
154
|
+
error.logger.error(error.format({ colored: false }));
|
|
155
|
+
if (error.collection) {
|
|
156
|
+
await error.collection.set({ id: error.id }, error.document(), { retry: 25, });
|
|
157
|
+
}
|
|
158
|
+
return error;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Construct a system error & save it to the database.
|
|
162
|
+
* This is a synchronous version of the create method.
|
|
163
|
+
* Beware that this does not join the async save operation,
|
|
164
|
+
* Instead it detaches and catches and logs any errors that occur during saving
|
|
165
|
+
*/
|
|
166
|
+
static create_detach(opts) {
|
|
167
|
+
const error = new SystemError(opts);
|
|
168
|
+
error.logger.error(error.format({ colored: false }));
|
|
169
|
+
if (error.collection) {
|
|
170
|
+
void error.collection.set({ id: error.id }, error.document(), { retry: 25 }).catch((e) => {
|
|
171
|
+
try {
|
|
172
|
+
error.logger.error(`Failed to save system error to database: ${e instanceof Error ? e.message : String(e)}\n` + error.format({ colored: false }));
|
|
173
|
+
}
|
|
174
|
+
catch (_) { /** ignore */ }
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
return error;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Get the error as a database document.
|
|
181
|
+
*
|
|
182
|
+
* @returns A plain object representing the system error for database storage.
|
|
183
|
+
*/
|
|
184
|
+
document() {
|
|
185
|
+
const doc = {
|
|
186
|
+
id: this.id,
|
|
187
|
+
message: this.message,
|
|
188
|
+
timestamp: this.timestamp,
|
|
189
|
+
trace: this.trace,
|
|
190
|
+
stack: this.stack,
|
|
191
|
+
format: vlib.String.truncate(this.format({ colored: false }), 10_000),
|
|
192
|
+
};
|
|
193
|
+
if (this.details) {
|
|
194
|
+
try {
|
|
195
|
+
doc.details = this.prepare_details_for_db();
|
|
196
|
+
}
|
|
197
|
+
catch (e) {
|
|
198
|
+
doc.details = `Encountered an error while processing details: ${e instanceof Error ? e.message : String(e)}`;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
if (this.owner != null) {
|
|
202
|
+
doc.owner = this.owner;
|
|
203
|
+
}
|
|
204
|
+
if (this.cause) {
|
|
205
|
+
doc.error = {
|
|
206
|
+
name: this.cause.name,
|
|
207
|
+
message: this.cause.message,
|
|
208
|
+
stack: this.cause.stack,
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
return doc;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Format the error as a string.
|
|
215
|
+
* @param colored Present the formatted error with colors to make it more visually pleasing.
|
|
216
|
+
* Defaults to `false`.
|
|
217
|
+
* @returns A string representation of the system error.
|
|
218
|
+
*/
|
|
219
|
+
format({ colored = false } = {}) {
|
|
220
|
+
if (colored && this._format_colored)
|
|
221
|
+
return this._format_colored;
|
|
222
|
+
else if (!colored && this._format_non_colored)
|
|
223
|
+
return this._format_non_colored;
|
|
224
|
+
try {
|
|
225
|
+
const green = (m) => colored ? vlib.Color.green(m) : m;
|
|
226
|
+
const lines = [
|
|
227
|
+
`SystemError: ${this.message}`,
|
|
228
|
+
];
|
|
229
|
+
if (this.trace) {
|
|
230
|
+
lines.push(...this.trace.map(l => ` ${l}`));
|
|
231
|
+
}
|
|
232
|
+
lines.push(` error_id: ${green('"' + this.id + '"')}`);
|
|
233
|
+
if (this.owner != null) {
|
|
234
|
+
lines.push(` owner: ${green('"' + this.owner + '"')}`);
|
|
235
|
+
}
|
|
236
|
+
let details;
|
|
237
|
+
try {
|
|
238
|
+
details = vlib.Object.stringify(this.redact_secrets(this.details), {
|
|
239
|
+
indent: 2,
|
|
240
|
+
start_indent: 1,
|
|
241
|
+
colored: colored,
|
|
242
|
+
max_length: 1000,
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
catch (e) {
|
|
246
|
+
details = `Encountered an error while processing details: ${e instanceof Error ? e.message : String(e)}`;
|
|
247
|
+
}
|
|
248
|
+
lines.push(` created_at: ${green('"' + new Date(this.timestamp).toISOString() + '"')}`, ` details: ${details}`);
|
|
249
|
+
if (this.cause) {
|
|
250
|
+
lines.push(` nested error:`, ...(this.cause?.stack ?? this.cause.toString()).split("\n")
|
|
251
|
+
.map(line => ` ${line.trim()}`));
|
|
252
|
+
}
|
|
253
|
+
if (colored) {
|
|
254
|
+
return this._format_colored = lines.join("\n");
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
return this._format_non_colored = lines.join("\n");
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
catch (e) {
|
|
261
|
+
return `Encountered an error while formatting the system error: ${e instanceof Error ? e.message : String(e)}`;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Convert the error to a string without ANSI colors to avoid leaking escape codes into sinks
|
|
266
|
+
* (e.g., files, JSON logs) that assume plain text.
|
|
267
|
+
* @returns Non-colored string representation of the error.
|
|
268
|
+
*/
|
|
269
|
+
toString() {
|
|
270
|
+
return this.format({ colored: false });
|
|
271
|
+
}
|
|
272
|
+
// ----------------------------------------------------------
|
|
273
|
+
// Private methods.
|
|
274
|
+
/**
|
|
275
|
+
* Detect a plain object (no custom prototype, not an array).
|
|
276
|
+
* @param v - The value to test.
|
|
277
|
+
*/
|
|
278
|
+
is_plain_object(v) {
|
|
279
|
+
if (v === null || typeof v !== "object" || Array.isArray(v))
|
|
280
|
+
return false;
|
|
281
|
+
const proto = Object.getPrototypeOf(v);
|
|
282
|
+
return proto === Object.prototype || proto === null;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Inspect and prepare the details for safe storage in `SystemError.Document.details`.
|
|
286
|
+
*
|
|
287
|
+
* @returns
|
|
288
|
+
* - `undefined` if no details were defined.
|
|
289
|
+
* - A string if (a) the value contains circular references, (b) it is not a plain object / array,
|
|
290
|
+
* or (c) the full stringified representation exceeds {@link SystemError.max_details_length}.
|
|
291
|
+
* - Otherwise, the redacted raw object is returned.
|
|
292
|
+
*/
|
|
293
|
+
prepare_details_for_db() {
|
|
294
|
+
if (!this.details)
|
|
295
|
+
return undefined;
|
|
296
|
+
/**
|
|
297
|
+
* Recursively verify JSON-safety and detect cycles using path-level tracking.
|
|
298
|
+
* @param val - The value to traverse.
|
|
299
|
+
* @param in_path - WeakSet to track the current recursion path for cycles.
|
|
300
|
+
*/
|
|
301
|
+
const is_json_safe = (val, in_path = new WeakSet()) => {
|
|
302
|
+
if (val == null)
|
|
303
|
+
return true;
|
|
304
|
+
const t = typeof val;
|
|
305
|
+
if (t === "undefined" || t === "boolean" || t === "number" || t === "string")
|
|
306
|
+
return true;
|
|
307
|
+
if (t === "function" || t === "symbol" || t === "bigint")
|
|
308
|
+
return false;
|
|
309
|
+
if (val instanceof String || val instanceof Date)
|
|
310
|
+
return true;
|
|
311
|
+
if (typeof val === "object") {
|
|
312
|
+
const obj = val;
|
|
313
|
+
if (in_path.has(obj))
|
|
314
|
+
return false; // cycle
|
|
315
|
+
in_path.add(obj);
|
|
316
|
+
if (Array.isArray(obj)) {
|
|
317
|
+
for (const item of obj) {
|
|
318
|
+
if (!is_json_safe(item, in_path)) {
|
|
319
|
+
in_path.delete(obj);
|
|
320
|
+
return false;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
in_path.delete(obj);
|
|
324
|
+
return true;
|
|
325
|
+
}
|
|
326
|
+
if (this.is_plain_object(obj)) {
|
|
327
|
+
for (const v of Object.values(obj)) {
|
|
328
|
+
if (!is_json_safe(v, in_path)) {
|
|
329
|
+
in_path.delete(obj);
|
|
330
|
+
return false;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
in_path.delete(obj);
|
|
334
|
+
return true;
|
|
335
|
+
}
|
|
336
|
+
in_path.delete(obj);
|
|
337
|
+
return false; // Non-plain object (Map/Set/RegExp/etc.)
|
|
338
|
+
}
|
|
339
|
+
return false;
|
|
340
|
+
};
|
|
341
|
+
// Redact early (never mutate the original).
|
|
342
|
+
const redacted = this.redact_secrets(this.details);
|
|
343
|
+
// If structurally unsafe => stringify (capped).
|
|
344
|
+
if (!is_json_safe(redacted)) {
|
|
345
|
+
return vlib.Object.stringify(redacted, {
|
|
346
|
+
colored: false,
|
|
347
|
+
max_length: SystemError.max_details_length,
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
// Measure the *full* length (no cap) to decide storage shape.
|
|
351
|
+
// Measure the *full* length (no cap) to decide storage shape.
|
|
352
|
+
let full_string;
|
|
353
|
+
try {
|
|
354
|
+
full_string = JSON.stringify(redacted);
|
|
355
|
+
}
|
|
356
|
+
catch (_) {
|
|
357
|
+
// Extremely defensive fallback; should not execute after JSON-safety verification.
|
|
358
|
+
full_string = vlib.Object.stringify(redacted, { colored: false });
|
|
359
|
+
}
|
|
360
|
+
if (full_string.length > SystemError.max_details_length) {
|
|
361
|
+
// Persist as a truncated string to enforce the size budget.
|
|
362
|
+
return vlib.String.truncate(full_string, SystemError.max_details_length);
|
|
363
|
+
}
|
|
364
|
+
// Safe & within budget: store as object.
|
|
365
|
+
return redacted;
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Deep-clone arrays/plain objects and redact sensitive keys (best-effort).
|
|
369
|
+
* Does not mutate the source object.
|
|
370
|
+
* Uses a null-prototype object & explicit property definitions to prevent prototype pollution via magic keys.
|
|
371
|
+
* @param input - The value to clone & redact.
|
|
372
|
+
* @returns A redacted deep clone of the input.
|
|
373
|
+
*/
|
|
374
|
+
redact_secrets(input) {
|
|
375
|
+
const sensitive = /^(password|pass|secret|api[_-]?key|token|access[_-]?token|refresh[_-]?token|authorization|auth|cookie|session|private[_-]?key|client[_-]?secret)$/i;
|
|
376
|
+
const define_plain = (obj, key, value) => {
|
|
377
|
+
Object.defineProperty(obj, key, { value, enumerable: true, writable: true, configurable: true });
|
|
378
|
+
};
|
|
379
|
+
const clone = (val) => {
|
|
380
|
+
if (val == null)
|
|
381
|
+
return val;
|
|
382
|
+
if (Array.isArray(val))
|
|
383
|
+
return val.map(clone);
|
|
384
|
+
if (this.is_plain_object(val)) {
|
|
385
|
+
const out = Object.create(null);
|
|
386
|
+
for (const [k, v] of Object.entries(val)) {
|
|
387
|
+
if (sensitive.test(k)) {
|
|
388
|
+
define_plain(out, k, "[REDACTED]");
|
|
389
|
+
}
|
|
390
|
+
else {
|
|
391
|
+
define_plain(out, k, clone(v));
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
return out;
|
|
395
|
+
}
|
|
396
|
+
// Leave other types as-is.
|
|
397
|
+
return val;
|
|
398
|
+
};
|
|
399
|
+
return clone(input);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author Daan van den Bergh
|
|
3
|
+
* @copyright © 2022 - 2025 Daan van den Bergh.
|
|
4
|
+
*/
|
|
5
|
+
import * as vlib from "@vandenberghinc/vlib";
|
|
6
|
+
import { User } from "./users.js";
|
|
7
|
+
/** All events and their callback types. */
|
|
8
|
+
export type Events = {
|
|
9
|
+
/**
|
|
10
|
+
* Add an (async) callback executed at the end of `server.start()`. The callback may take arguments `({forked <boolean>})`.
|
|
11
|
+
* @example
|
|
12
|
+
* ...
|
|
13
|
+
* server.on("start", opts => console.log("Hello World!"));
|
|
14
|
+
*/
|
|
15
|
+
start: (opts: {
|
|
16
|
+
forked: boolean;
|
|
17
|
+
}) => void | Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Set an (async) callback which will be executed at the start of `server.stop()`.
|
|
20
|
+
* @example
|
|
21
|
+
* ...
|
|
22
|
+
* server.on("stop", () => console.log("Hello World!"));
|
|
23
|
+
*/
|
|
24
|
+
stop: () => void | Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Set an (async) callback which will be executed at the start of `server.initialize()`.
|
|
27
|
+
* @example
|
|
28
|
+
* ...
|
|
29
|
+
* server.on("initialize", () => console.log("Hello World!"));
|
|
30
|
+
*/
|
|
31
|
+
initialize: () => void | Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* This callback is executed when a user is created.
|
|
34
|
+
* @note Errors thrown in this callback will be logged but ignored.
|
|
35
|
+
*/
|
|
36
|
+
create_user: (opts: {
|
|
37
|
+
user: User;
|
|
38
|
+
}) => void | Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* This callback is executed when a user is deleted.
|
|
41
|
+
* @note Errors thrown in this callback will be logged but ignored.
|
|
42
|
+
*/
|
|
43
|
+
delete_user: (opts: {
|
|
44
|
+
user: User;
|
|
45
|
+
}) => void | Promise<void>;
|
|
46
|
+
};
|
|
47
|
+
/** Event name. */
|
|
48
|
+
export type EventName = vlib.EventName<Events>;
|
|
49
|
+
/** Event callback. */
|
|
50
|
+
export type EventCallback<N extends EventName> = vlib.EventCallback<Events, N>;
|
|
51
|
+
/** Event parameters. */
|
|
52
|
+
export type EventParams<N extends EventName> = vlib.EventParams<Events, N>;
|
|
53
|
+
/** Event result type. */
|
|
54
|
+
export type EventResult<N extends EventName> = vlib.EventResult<Events, N>;
|
|
@@ -1,6 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author Daan van den Bergh
|
|
3
|
+
* @copyright © 2022 - 2025 Daan van den Bergh. All rights reserved
|
|
4
|
+
*/
|
|
1
5
|
import * as vlib from "@vandenberghinc/vlib";
|
|
2
6
|
import { Endpoint } from "./endpoint.js";
|
|
3
7
|
import { RateLimitGroup } from "./rate_limit.js";
|
|
8
|
+
/**
|
|
9
|
+
* All static images are served through the `ImageEndpoint`.
|
|
10
|
+
*
|
|
11
|
+
* The image endpoint accepts three optional query parameters when retrieving the image to transform the image.
|
|
12
|
+
* - `type` string: The input type.
|
|
13
|
+
* - `width` number: The height of the image as a number `100` or percentage `50%` / `0.5x`. The aspect ratio will be maintained when `height` is undefined.
|
|
14
|
+
* - `height` number: The width of the image as a number `100` or percentage `50%` / `0.5x`. The aspect ratio will be maintained when `width` is undefined.
|
|
15
|
+
* - `aspect_ratio` boolean: Maintain the aspect ratio when only one resizing dimension has been defined.
|
|
16
|
+
* @docs
|
|
17
|
+
* @nav Backend/Endpoints
|
|
18
|
+
*/
|
|
4
19
|
declare class ImageEndpoint extends Endpoint implements Endpoint {
|
|
5
20
|
static cache_in_memory: boolean;
|
|
6
21
|
static supported_images: string[];
|
|
@@ -19,6 +34,6 @@ declare class ImageEndpoint extends Endpoint implements Endpoint {
|
|
|
19
34
|
});
|
|
20
35
|
transform(type?: string | null, width?: number | string | null, height?: number | string | null, aspect_ratio?: string | boolean | null): Promise<Buffer>;
|
|
21
36
|
get_aspect_ratio(): Promise<string | null>;
|
|
22
|
-
_clear_cache
|
|
37
|
+
private _clear_cache;
|
|
23
38
|
}
|
|
24
39
|
export { ImageEndpoint };
|
|
@@ -1,28 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
*
|
|
1
|
+
/**
|
|
2
|
+
* @author Daan van den Bergh
|
|
3
|
+
* @copyright © 2022 - 2025 Daan van den Bergh. All rights reserved
|
|
4
4
|
*/
|
|
5
5
|
// ---------------------------------------------------------
|
|
6
6
|
// Libraries.
|
|
7
7
|
import sharp from 'sharp';
|
|
8
8
|
import { Endpoint } from "./endpoint.js";
|
|
9
|
-
import { logger } from "./logger.js";
|
|
10
|
-
const { log, error } = logger;
|
|
11
9
|
// ---------------------------------------------------------
|
|
12
10
|
// ImageEndpoint.
|
|
13
11
|
// Supports resizing and editing formats.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
- `height` number: The width of the image as a number `100` or percentage `50%` / `0.5x`. The aspect ratio will be maintained when `width` is undefined.
|
|
25
|
-
- `aspect_ratio` boolean: Maintain the aspect ratio when only one resizing dimension has been defined.
|
|
12
|
+
/**
|
|
13
|
+
* All static images are served through the `ImageEndpoint`.
|
|
14
|
+
*
|
|
15
|
+
* The image endpoint accepts three optional query parameters when retrieving the image to transform the image.
|
|
16
|
+
* - `type` string: The input type.
|
|
17
|
+
* - `width` number: The height of the image as a number `100` or percentage `50%` / `0.5x`. The aspect ratio will be maintained when `height` is undefined.
|
|
18
|
+
* - `height` number: The width of the image as a number `100` or percentage `50%` / `0.5x`. The aspect ratio will be maintained when `width` is undefined.
|
|
19
|
+
* - `aspect_ratio` boolean: Maintain the aspect ratio when only one resizing dimension has been defined.
|
|
20
|
+
* @docs
|
|
21
|
+
* @nav Backend/Endpoints
|
|
26
22
|
*/
|
|
27
23
|
class ImageEndpoint extends Endpoint {
|
|
28
24
|
// Cache the original and transformed image data in memory.
|
|
@@ -60,7 +56,7 @@ class ImageEndpoint extends Endpoint {
|
|
|
60
56
|
"aspect_ratio": { type: "string", default: null },
|
|
61
57
|
},
|
|
62
58
|
rate_limit,
|
|
63
|
-
|
|
59
|
+
file_path: path,
|
|
64
60
|
_is_static,
|
|
65
61
|
});
|
|
66
62
|
// Attributes.
|
|
@@ -186,11 +182,11 @@ class ImageEndpoint extends Endpoint {
|
|
|
186
182
|
// Get aspect ratio.
|
|
187
183
|
async get_aspect_ratio() {
|
|
188
184
|
try {
|
|
189
|
-
const metadata = await sharp(this.
|
|
185
|
+
const metadata = await sharp(this.file_path?.str()).metadata();
|
|
190
186
|
return `${metadata.width} / ${metadata.height}`;
|
|
191
187
|
}
|
|
192
188
|
catch (err) {
|
|
193
|
-
error(`Unable to determine the aspect ratio of image ${this.
|
|
189
|
+
this.server?.log.error(`Unable to determine the aspect ratio of image ${this.file_path}: `, err);
|
|
194
190
|
return null;
|
|
195
191
|
}
|
|
196
192
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author Daan van den Bergh
|
|
3
|
+
* @copyright © 2022 - 2025 Daan van den Bergh. All rights reserved
|
|
4
|
+
*/
|
|
5
|
+
/** Nested types for the {@link Meta} class. */
|
|
6
|
+
export declare namespace Meta {
|
|
7
|
+
/** Constructor options. */
|
|
8
|
+
interface Opts {
|
|
9
|
+
/** The author's name. */
|
|
10
|
+
author?: string;
|
|
11
|
+
/** The page's title. */
|
|
12
|
+
title?: string;
|
|
13
|
+
/** The page's description. */
|
|
14
|
+
description?: string;
|
|
15
|
+
/** The page's image source. */
|
|
16
|
+
image?: string;
|
|
17
|
+
/** The robots rules. */
|
|
18
|
+
robots?: string;
|
|
19
|
+
/** The used charset. */
|
|
20
|
+
charset?: string;
|
|
21
|
+
/** The viewport settings. */
|
|
22
|
+
viewport?: string;
|
|
23
|
+
/** The url to the favicon. */
|
|
24
|
+
favicon?: string;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The js view meta information class.
|
|
29
|
+
* @nav: Backend/Endpoints
|
|
30
|
+
*/
|
|
31
|
+
export declare class Meta {
|
|
32
|
+
author?: string;
|
|
33
|
+
title?: string;
|
|
34
|
+
description?: string;
|
|
35
|
+
image?: string;
|
|
36
|
+
robots: string;
|
|
37
|
+
charset: string;
|
|
38
|
+
viewport: string;
|
|
39
|
+
favicon: string;
|
|
40
|
+
constructor({ author, title, description, image, robots, charset, viewport, favicon, }?: Meta.Opts);
|
|
41
|
+
/**
|
|
42
|
+
* Create a copy of the current meta object without any references.
|
|
43
|
+
* @param override - The <Type>Meta</Type> constructor arguments to override.
|
|
44
|
+
* @docs
|
|
45
|
+
*/
|
|
46
|
+
copy(override?: Partial<Meta.Opts>): Meta;
|
|
47
|
+
/**
|
|
48
|
+
* Set value funcs that return the current object.
|
|
49
|
+
* @return: Returns the current <Type>Meta</Type> object.
|
|
50
|
+
* @funcs 8
|
|
51
|
+
* @docs
|
|
52
|
+
*/
|
|
53
|
+
set_author(value: string | undefined): this;
|
|
54
|
+
set_title(value: string | undefined): this;
|
|
55
|
+
set_description(value: string | undefined): this;
|
|
56
|
+
set_image(value: string | undefined): this;
|
|
57
|
+
set_robots(value: string): this;
|
|
58
|
+
set_charset(value: string): this;
|
|
59
|
+
set_viewport(value: string): this;
|
|
60
|
+
set_favicon(value: string): this;
|
|
61
|
+
obj(): Meta.Opts;
|
|
62
|
+
build_html(domain?: string | null): string;
|
|
63
|
+
}
|
|
64
|
+
export default Meta;
|