@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,508 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var stdin_exports = {};
|
|
29
|
+
__export(stdin_exports, {
|
|
30
|
+
View: () => View
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
33
|
+
var vlib = __toESM(require("@vandenberghinc/vlib"));
|
|
34
|
+
var vts = __toESM(require("@vandenberghinc/vlib/vts"));
|
|
35
|
+
var vhighlight = __toESM(require("@vandenberghinc/vhighlight"));
|
|
36
|
+
var import_zlib = __toESM(require("zlib"));
|
|
37
|
+
var import_meta = require("./meta.js");
|
|
38
|
+
var import_route = require("./route.js");
|
|
39
|
+
var import_frontend = require("./frontend.js");
|
|
40
|
+
var crypto = __toESM(require("crypto"));
|
|
41
|
+
const { debug } = vlib;
|
|
42
|
+
class View {
|
|
43
|
+
// Global settings.
|
|
44
|
+
static includes = [];
|
|
45
|
+
static links = [];
|
|
46
|
+
static body_style = null;
|
|
47
|
+
// css string style.
|
|
48
|
+
static splash_screen = void 0;
|
|
49
|
+
// SplashScreen object.
|
|
50
|
+
// Private static attributes,
|
|
51
|
+
static _volt_css;
|
|
52
|
+
static _vhighlight_css;
|
|
53
|
+
// Attributes.
|
|
54
|
+
source;
|
|
55
|
+
source_path;
|
|
56
|
+
callback;
|
|
57
|
+
includes;
|
|
58
|
+
links;
|
|
59
|
+
templates;
|
|
60
|
+
meta;
|
|
61
|
+
jquery;
|
|
62
|
+
lang;
|
|
63
|
+
body_style;
|
|
64
|
+
splash_screen;
|
|
65
|
+
tree_shaking;
|
|
66
|
+
mangle;
|
|
67
|
+
_src;
|
|
68
|
+
_embedded_sources;
|
|
69
|
+
is_js_ts_view;
|
|
70
|
+
_html;
|
|
71
|
+
raw_html;
|
|
72
|
+
_bundle;
|
|
73
|
+
payments;
|
|
74
|
+
// vhighlight?: string | undefined;
|
|
75
|
+
min_device_width;
|
|
76
|
+
server;
|
|
77
|
+
endpoint;
|
|
78
|
+
// Constructor.
|
|
79
|
+
constructor({ source = null, callback = null, includes = [], links = [], templates = {}, meta = new import_meta.Meta(), jquery = false, lang = "en", body_style = null, splash_screen = void 0, tree_shaking = false, mangle = false, min_device_width = 600, _src }) {
|
|
80
|
+
this.source = source;
|
|
81
|
+
this.callback = callback;
|
|
82
|
+
this.includes = [...View.includes, ...includes];
|
|
83
|
+
this.links = [...View.links, ...links];
|
|
84
|
+
this.templates = templates;
|
|
85
|
+
this.meta = meta;
|
|
86
|
+
this.jquery = jquery;
|
|
87
|
+
this.lang = lang;
|
|
88
|
+
this.body_style = body_style ?? View.body_style;
|
|
89
|
+
this.splash_screen = splash_screen ?? View.splash_screen;
|
|
90
|
+
this.tree_shaking = tree_shaking;
|
|
91
|
+
this.mangle = mangle;
|
|
92
|
+
this.min_device_width = min_device_width;
|
|
93
|
+
this._src = _src;
|
|
94
|
+
this._embedded_sources = [];
|
|
95
|
+
if (this.source != null) {
|
|
96
|
+
this.source_path = new vlib.Path(this.source);
|
|
97
|
+
if (!this.source_path.exists()) {
|
|
98
|
+
throw new Error(`Defined source path "${this.source}" does not exist.`);
|
|
99
|
+
}
|
|
100
|
+
this.source_path = this.source_path.abs();
|
|
101
|
+
this.source = this.source_path.str();
|
|
102
|
+
}
|
|
103
|
+
this.is_js_ts_view = this.source_path != null && /\.(jsx?|tsx?)/.test(this.source_path.extension());
|
|
104
|
+
if (typeof source !== "string" && typeof callback !== "function") {
|
|
105
|
+
throw Error('Invalid usage, define either parameter "source" or "callback".');
|
|
106
|
+
}
|
|
107
|
+
this.includes = vlib.Array.drop_duplicates(this.includes);
|
|
108
|
+
this._html = void 0;
|
|
109
|
+
this._bundle = void 0;
|
|
110
|
+
}
|
|
111
|
+
// Initialize.
|
|
112
|
+
_initialize(server, endpoint) {
|
|
113
|
+
if (server === void 0) {
|
|
114
|
+
throw Error('Invalid usage, define parameter "server".');
|
|
115
|
+
}
|
|
116
|
+
if (endpoint === void 0) {
|
|
117
|
+
throw Error('Invalid usage, define parameter "endpoint".');
|
|
118
|
+
}
|
|
119
|
+
this.server = server;
|
|
120
|
+
this.endpoint = endpoint;
|
|
121
|
+
}
|
|
122
|
+
// Bundle the compiled typescript / javascript dynamically on demand to optimize server startup for development purposes.
|
|
123
|
+
async _dynamic_bundle() {
|
|
124
|
+
if (this.server === void 0 || this.endpoint === void 0) {
|
|
125
|
+
throw Error('View has not been initialized with "View._initialize()" yet.');
|
|
126
|
+
}
|
|
127
|
+
debug(3, this.endpoint?.route?.id, `: Bundling entry path "${this.source_path?.str()}".`);
|
|
128
|
+
this._bundle = await vts.bundle({
|
|
129
|
+
include: this.source_path ? [this.source_path?.str()] : [],
|
|
130
|
+
output: `/tmp/${this.endpoint.route.method}_${this.source_path.str().replace(/\//g, "_")}.js`,
|
|
131
|
+
// esbuild requires an output path to resolve .css and .ttf files etc which can be imported by libraries (such as monaco-editor).
|
|
132
|
+
minify: false,
|
|
133
|
+
//this._server.production,
|
|
134
|
+
platform: "browser",
|
|
135
|
+
format: "esm",
|
|
136
|
+
// format: "iife", // can causes issues with node_modules imports.
|
|
137
|
+
target: "es2022",
|
|
138
|
+
// sourcemap: this.server.production ? false : "inline",
|
|
139
|
+
extract_inputs: true,
|
|
140
|
+
// since bundle.inputs is used by server.js.
|
|
141
|
+
tree_shaking: true
|
|
142
|
+
});
|
|
143
|
+
this.payments = this._bundle.inputs.find((path) => path.endsWith("/modules/paddle.js"));
|
|
144
|
+
}
|
|
145
|
+
/** Ensure the view is bundled when required. */
|
|
146
|
+
async ensure_bundle() {
|
|
147
|
+
if (this.is_js_ts_view && !this._bundle) {
|
|
148
|
+
return this._dynamic_bundle();
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/** Create an error HTML file when errors are encountered during the bundle process. */
|
|
152
|
+
async _build_bundle_err_html() {
|
|
153
|
+
if (this.server?.production) {
|
|
154
|
+
throw new Error("Encountered an error while bundling in production.");
|
|
155
|
+
}
|
|
156
|
+
const nonce_identifier = "{{__VOLT_NONCE__}}";
|
|
157
|
+
const bundle = await vts.inspect_bundle({
|
|
158
|
+
include: this.source_path ? [this.source_path?.str()] : [],
|
|
159
|
+
output: vlib.Path.tmp().join(`${this.endpoint?.route.method}_${this.source_path.str().replace(/\//g, "_")}.js`),
|
|
160
|
+
// esbuild requires an output path to resolve .css and .ttf files etc which can be imported by libraries (such as monaco-editor).
|
|
161
|
+
minify: false,
|
|
162
|
+
//this._server.production,
|
|
163
|
+
platform: "browser",
|
|
164
|
+
format: "esm",
|
|
165
|
+
// format: "iife", // can causes issues with node_modules imports.
|
|
166
|
+
target: "es2022",
|
|
167
|
+
tree_shaking: true
|
|
168
|
+
});
|
|
169
|
+
this.server?.log.error(this.endpoint?.route?.id, `: Encountered an error while bundling "${this.source}".
|
|
170
|
+
${bundle.debug({ limit: 25 })}`);
|
|
171
|
+
const escape_html = (str) => vlib.Color.to_html(str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"));
|
|
172
|
+
if (this.server?.production) {
|
|
173
|
+
this._html = `
|
|
174
|
+
<!DOCTYPE html>
|
|
175
|
+
<html lang='${this.lang}'>
|
|
176
|
+
<head>
|
|
177
|
+
<meta charset="UTF-8">
|
|
178
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
179
|
+
<title>Bundling Error</title>
|
|
180
|
+
<style nonce="${nonce_identifier}">
|
|
181
|
+
body {
|
|
182
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; padding: 2rem; background: #f5f5f5;
|
|
183
|
+
}
|
|
184
|
+
h1 {
|
|
185
|
+
color: #d32f2f; margin-top: 0;
|
|
186
|
+
}
|
|
187
|
+
#error-container {
|
|
188
|
+
max-width: 800px; margin: 0 auto; background: white; padding: 2rem; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
189
|
+
}
|
|
190
|
+
</style>
|
|
191
|
+
</head>
|
|
192
|
+
<body>
|
|
193
|
+
<div id="error-container">
|
|
194
|
+
<h1>Bundling Error</h1>
|
|
195
|
+
<p>An error occurred while processing your request. Please contact support if this issue persists.</p>
|
|
196
|
+
</div>
|
|
197
|
+
</body>
|
|
198
|
+
</html>
|
|
199
|
+
`.dedent(false);
|
|
200
|
+
} else {
|
|
201
|
+
const formatted_import_chains = bundle.format_import_chains();
|
|
202
|
+
const formatted_errors = bundle.format_errors();
|
|
203
|
+
this._html = `
|
|
204
|
+
<!DOCTYPE html>
|
|
205
|
+
<html lang='${this.lang}'>
|
|
206
|
+
<head>
|
|
207
|
+
<meta charset="UTF-8">
|
|
208
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
209
|
+
<title>Bundling Error - ${escape_html(this.source || "Unknown")}</title>
|
|
210
|
+
<style nonce="${nonce_identifier}">
|
|
211
|
+
body {
|
|
212
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
213
|
+
margin: 0;
|
|
214
|
+
padding: 1rem;
|
|
215
|
+
background: #1e1e1e;
|
|
216
|
+
color: #d4d4d4;
|
|
217
|
+
}
|
|
218
|
+
.container {
|
|
219
|
+
max-width: 1200px;
|
|
220
|
+
margin: 0 auto;
|
|
221
|
+
}
|
|
222
|
+
h1 {
|
|
223
|
+
color: #FFFFFF;
|
|
224
|
+
font-size: 1.5rem;
|
|
225
|
+
margin-bottom: 0.5rem;
|
|
226
|
+
}
|
|
227
|
+
.source {
|
|
228
|
+
color: #C0C0C0;
|
|
229
|
+
font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
|
|
230
|
+
font-size: 0.875rem;
|
|
231
|
+
margin-bottom: 1rem;
|
|
232
|
+
}
|
|
233
|
+
pre {
|
|
234
|
+
background: #2d2d2d;
|
|
235
|
+
border: 1px solid #3e3e3e;
|
|
236
|
+
border-radius: 4px;
|
|
237
|
+
padding: 1rem;
|
|
238
|
+
overflow-x: auto;
|
|
239
|
+
font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
|
|
240
|
+
font-size: 0.875rem;
|
|
241
|
+
line-height: 1.5;
|
|
242
|
+
margin: 20px 0px 0px 0px;
|
|
243
|
+
}
|
|
244
|
+
.error-count {
|
|
245
|
+
background: #f44336;
|
|
246
|
+
color: white;
|
|
247
|
+
padding: 0.25rem 0.5rem;
|
|
248
|
+
border-radius: 4px;
|
|
249
|
+
font-size: 0.875rem;
|
|
250
|
+
display: inline-block;
|
|
251
|
+
margin-bottom: 1rem;
|
|
252
|
+
}
|
|
253
|
+
</style>
|
|
254
|
+
</head>
|
|
255
|
+
<body>
|
|
256
|
+
<div class="container">
|
|
257
|
+
<h1>Bundle Error</h1>
|
|
258
|
+
<div class="source">Source: ${escape_html(this.source || "Unknown")}</div>
|
|
259
|
+
<div class="error-count">${bundle.errors.length} error${bundle.errors.length === 1 ? "" : "s"}</div>
|
|
260
|
+
<pre>${escape_html(bundle.debug({ limit: -1 }))}</pre>
|
|
261
|
+
<!--<h2>Metafile</h2>
|
|
262
|
+
<pre>${escape_html(bundle.metafile ?? "No metafile detected.")}</pre>
|
|
263
|
+
<h2>Input files</h2>
|
|
264
|
+
<pre>${escape_html(bundle.inputs.length ? bundle.inputs.join("\n") : "No input files detected.")}</pre>
|
|
265
|
+
<h2>Import Chains</h2>
|
|
266
|
+
<pre>${escape_html(formatted_import_chains.length ? formatted_import_chains.join("\n") : "No import chains detected.")}</pre>
|
|
267
|
+
<h2>Encountered Errors</h2>
|
|
268
|
+
<pre>${escape_html(formatted_errors.length ? formatted_errors.join("\n") : "No errors detected.")}</pre>
|
|
269
|
+
-->
|
|
270
|
+
</div>
|
|
271
|
+
</body>
|
|
272
|
+
</html>
|
|
273
|
+
`.dedent(false);
|
|
274
|
+
}
|
|
275
|
+
this.html_nonce_split = this._html.split(nonce_identifier);
|
|
276
|
+
}
|
|
277
|
+
// Build html.
|
|
278
|
+
async _build_html() {
|
|
279
|
+
const nonce_identifier = "{{__VOLT_NONCE__}}";
|
|
280
|
+
if (this.server == null || this.endpoint == null) {
|
|
281
|
+
throw Error('View has not been initialized with "View._initialize()" yet.');
|
|
282
|
+
}
|
|
283
|
+
if (this.is_js_ts_view && !this._bundle) {
|
|
284
|
+
await this._dynamic_bundle();
|
|
285
|
+
}
|
|
286
|
+
if (this._bundle != null && this._bundle.errors.length > 0) {
|
|
287
|
+
return this._build_bundle_err_html();
|
|
288
|
+
}
|
|
289
|
+
const line_break = this.server.production ? "\n" : "\n";
|
|
290
|
+
const has_bundle = this._bundle != null && typeof this._bundle === "object";
|
|
291
|
+
this._html = "";
|
|
292
|
+
this._html += `<!DOCTYPE html><html lang='${this.lang}'>${line_break}`;
|
|
293
|
+
this._html += `<head>${line_break}`;
|
|
294
|
+
if (this.meta) {
|
|
295
|
+
this._html += this.meta.build_html(this.server.full_domain) + line_break;
|
|
296
|
+
}
|
|
297
|
+
this._html += `<style nonce="${nonce_identifier}">html { min-width:100%;min-height:100%; }body { width:100vw;height:100vh;margin:0;padding:0;${this.body_style ?? ""} }</style>${line_break}`;
|
|
298
|
+
const embed_stylesheet = (url, embed) => {
|
|
299
|
+
if (embed == null && url != null && url.charAt(0) === "/") {
|
|
300
|
+
for (const endpoint of this.server.endpoints.values()) {
|
|
301
|
+
if (url === endpoint.route.endpoint_str) {
|
|
302
|
+
if (typeof endpoint.raw_data === "string") {
|
|
303
|
+
embed = endpoint.raw_data;
|
|
304
|
+
} else if (typeof endpoint.data === "string") {
|
|
305
|
+
embed = endpoint.data;
|
|
306
|
+
}
|
|
307
|
+
break;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
if (embed) {
|
|
312
|
+
this._html += `<style nonce="${nonce_identifier}">${line_break}${embed}${line_break}</style>${line_break}`;
|
|
313
|
+
if (url) {
|
|
314
|
+
this._embedded_sources.push(url);
|
|
315
|
+
}
|
|
316
|
+
return true;
|
|
317
|
+
}
|
|
318
|
+
return false;
|
|
319
|
+
};
|
|
320
|
+
let include_links_script = null;
|
|
321
|
+
const include_link_async = (link) => {
|
|
322
|
+
if (include_links_script == null) {
|
|
323
|
+
include_links_script = "async function __incl_lnk(args){var link = document.createElement('link');for (let key in args) {if (args.hasOwnProperty(key)){link.setAttribute(key,args[key])}}document.head.appendChild(link)}" + line_break;
|
|
324
|
+
}
|
|
325
|
+
if (link.rel == null) {
|
|
326
|
+
link.rel = "stylesheet";
|
|
327
|
+
}
|
|
328
|
+
include_links_script += `__incl_lnk(${JSON.stringify(link)});${line_break}`;
|
|
329
|
+
};
|
|
330
|
+
if (!View._volt_css) {
|
|
331
|
+
View._volt_css = await new vlib.Path(import_frontend.Frontend.css.volt).load();
|
|
332
|
+
}
|
|
333
|
+
if (!View._vhighlight_css) {
|
|
334
|
+
View._vhighlight_css = await new vlib.Path(vhighlight.web_exports.css).load();
|
|
335
|
+
}
|
|
336
|
+
embed_stylesheet(void 0, View._volt_css);
|
|
337
|
+
embed_stylesheet(void 0, View._vhighlight_css);
|
|
338
|
+
if (this.min_device_width != null) {
|
|
339
|
+
this._html += `
|
|
340
|
+
<script nonce="${nonce_identifier}">
|
|
341
|
+
let has_min_width = false;
|
|
342
|
+
const viewport = document.querySelector('meta[name="viewport"]');
|
|
343
|
+
function set_min_width() {
|
|
344
|
+
const device_width = window.innerWidth;
|
|
345
|
+
// console.log("Device width [" + device_width + "] below min_device_width [${this.min_device_width} =", (device_width <= ${this.min_device_width}).toString() + "]");
|
|
346
|
+
if (device_width <= ${this.min_device_width}) {
|
|
347
|
+
const content = 'width=${this.min_device_width}, initial-scale=' + (device_width / ${this.min_device_width});
|
|
348
|
+
// console.log("Below ${this.min_device_width}", {content, width: device_width, has_min_width, viewport: viewport.getAttribute('content')});
|
|
349
|
+
if (viewport.getAttribute('content') !== content) {
|
|
350
|
+
// console.log('set min width viewport', device_width, device_width / ${this.min_device_width})
|
|
351
|
+
viewport.setAttribute('content', content);
|
|
352
|
+
has_min_width = true;
|
|
353
|
+
}
|
|
354
|
+
} else if (has_min_width) {
|
|
355
|
+
// console.log('disable min width viewport', device_width)
|
|
356
|
+
viewport.setAttribute('content', 'width=device-width, initial-scale=1');
|
|
357
|
+
has_min_width = false;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
let timeout_load; window.addEventListener('load', () => {clearTimeout(timeout_load); timeout_load = setTimeout(set_min_width, 25); } );
|
|
361
|
+
let timeout_resize; window.addEventListener('resize', () => {clearTimeout(timeout_resize); timeout_resize = setTimeout(set_min_width, 25); } );
|
|
362
|
+
set_min_width();
|
|
363
|
+
</script>
|
|
364
|
+
`.dedent();
|
|
365
|
+
}
|
|
366
|
+
this.links.forEach((url) => {
|
|
367
|
+
if (typeof url === "string") {
|
|
368
|
+
this._html += `<link rel="stylesheet" href="${url}">`;
|
|
369
|
+
} else if (typeof url === "object") {
|
|
370
|
+
if (typeof url === "object" && url.rel === "stylesheet" && url.embed !== true && typeof url.href === "string" && embed_stylesheet(import_route.Route.clean_endpoint(url.href))) {
|
|
371
|
+
} else {
|
|
372
|
+
if (url.async) {
|
|
373
|
+
include_link_async(url);
|
|
374
|
+
} else {
|
|
375
|
+
this._html += "<link";
|
|
376
|
+
Object.keys(url).forEach((key) => {
|
|
377
|
+
if (key !== "embed") {
|
|
378
|
+
this._html += ` ${key}="${url[key]}"`;
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
this._html += ">" + line_break;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
} else {
|
|
385
|
+
throw Error('Invalid type for a css include, the valid value types are "string" and "object".');
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
if (include_links_script) {
|
|
389
|
+
this._html += `<script nonce="${nonce_identifier}">${line_break}${include_links_script}${line_break}</script>${line_break}`;
|
|
390
|
+
}
|
|
391
|
+
this._html += "</head>" + line_break;
|
|
392
|
+
this._html += "<body id='body'>";
|
|
393
|
+
if (this.splash_screen != null) {
|
|
394
|
+
this._html += this.splash_screen.html + line_break;
|
|
395
|
+
}
|
|
396
|
+
const embed_script = (url) => {
|
|
397
|
+
let embed;
|
|
398
|
+
for (const endpoint of this.server.endpoints.values()) {
|
|
399
|
+
if (url === endpoint.route.endpoint_str && (endpoint.raw_data != null || endpoint.data != null)) {
|
|
400
|
+
embed = endpoint;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
if (embed && (embed.raw_data || embed.data)) {
|
|
404
|
+
if (embed.content_type === "application/javascript") {
|
|
405
|
+
this._html += `<script nonce="${nonce_identifier}">${line_break}${embed.raw_data || embed.data}${line_break}</script>${line_break}`;
|
|
406
|
+
} else {
|
|
407
|
+
this._html += `<script nonce="${nonce_identifier}" type='${embed.content_type}'>${line_break}${embed.raw_data || embed.data}${line_break}</script>${line_break}`;
|
|
408
|
+
}
|
|
409
|
+
this._embedded_sources.push(url);
|
|
410
|
+
return true;
|
|
411
|
+
}
|
|
412
|
+
return false;
|
|
413
|
+
};
|
|
414
|
+
let include_js_script = `async function __volt_incl_js(url, async = true) {var script=document.createElement('script');if(async){script.async = true;}script.src=url;document.head.appendChild(script);};${line_break}`;
|
|
415
|
+
if (this.jquery) {
|
|
416
|
+
this._html += `<script nonce="${nonce_identifier}" src='https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js'></script>${line_break}`;
|
|
417
|
+
}
|
|
418
|
+
if (this.server.google_tag !== void 0) {
|
|
419
|
+
include_js_script += `__volt_incl_js("https://www.googletagmanager.com/gtag/js?id=${this.server.google_tag}");${line_break}`;
|
|
420
|
+
}
|
|
421
|
+
this._html += `<script nonce="${nonce_identifier}">${line_break}window.volt_statics_aspect_ratios = ${JSON.stringify(Object.fromEntries(this.server.statics_aspect_ratios))}${line_break}</script>${line_break}`;
|
|
422
|
+
if (this.server.payments) {
|
|
423
|
+
if (this.server.payments.type === "paddle") {
|
|
424
|
+
if (this.payments) {
|
|
425
|
+
include_js_script += `__volt_incl_js("https://cdn.paddle.com/paddle/v2/paddle.js");${line_break}`;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
this._html += `<script nonce="${nonce_identifier}">${line_break}${include_js_script.trimEnd()}${line_break}</script>${line_break}`;
|
|
430
|
+
this.includes.forEach((url) => {
|
|
431
|
+
if (typeof url === "string" && embed_script(url)) {
|
|
432
|
+
} else {
|
|
433
|
+
if (typeof url === "string") {
|
|
434
|
+
this._html += `<script nonce="${nonce_identifier}" src='${url}'></script>${line_break}`;
|
|
435
|
+
} else if (typeof url === "object") {
|
|
436
|
+
this._html += `<script nonce="${nonce_identifier}"`;
|
|
437
|
+
Object.keys(url).forEach((key) => {
|
|
438
|
+
if (key !== "embed") {
|
|
439
|
+
this._html += ` ${key}="${url[key]}"`;
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
this._html += "></script>" + line_break;
|
|
443
|
+
} else {
|
|
444
|
+
throw Error('Invalid type for a js include, the valid value types are "string" and "object".');
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
});
|
|
448
|
+
if (has_bundle && this._bundle != null && typeof this._bundle.code === "string") {
|
|
449
|
+
this._html += `<script nonce="${nonce_identifier}" type='module'>${line_break}${this._bundle.code}${line_break}</script>${line_break}`;
|
|
450
|
+
} else if (typeof this.source === "string") {
|
|
451
|
+
this._html += `<script nonce="${nonce_identifier}">${line_break}${await new vlib.Path(this.source).load()}${line_break}</script>${line_break}`;
|
|
452
|
+
} else if (this.callback != null) {
|
|
453
|
+
let code = this.callback.toString();
|
|
454
|
+
this._html += `<script nonce="${nonce_identifier}">${line_break}(${code})()${line_break}</script>${line_break}`;
|
|
455
|
+
}
|
|
456
|
+
this._html += "</body>" + line_break;
|
|
457
|
+
this._html += "</html>" + line_break;
|
|
458
|
+
this.html_nonce_split = this._html.split(nonce_identifier);
|
|
459
|
+
}
|
|
460
|
+
/** Retrieve the content length of the built html. */
|
|
461
|
+
async content_length() {
|
|
462
|
+
const nonce = crypto.randomBytes(16).toString("base64");
|
|
463
|
+
if (!this._html) {
|
|
464
|
+
await this._build_html();
|
|
465
|
+
}
|
|
466
|
+
let html = this.html_nonce_split.join(nonce);
|
|
467
|
+
return html.length;
|
|
468
|
+
}
|
|
469
|
+
/** Retrieve the HTML. */
|
|
470
|
+
async html(opts) {
|
|
471
|
+
const nonce = crypto.randomBytes(16).toString("base64");
|
|
472
|
+
if (!this._html) {
|
|
473
|
+
await this._build_html();
|
|
474
|
+
}
|
|
475
|
+
let html = this.html_nonce_split.join(nonce);
|
|
476
|
+
const content_length = Buffer.byteLength(html, "utf-8");
|
|
477
|
+
if (opts?.compress) {
|
|
478
|
+
html = import_zlib.default.gzipSync(html, { level: import_zlib.default.constants.Z_BEST_COMPRESSION });
|
|
479
|
+
}
|
|
480
|
+
return {
|
|
481
|
+
html,
|
|
482
|
+
content_length,
|
|
483
|
+
nonce
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
// Serve a client.
|
|
487
|
+
async _serve(stream, status_code = 200, opts) {
|
|
488
|
+
debug(2, this.endpoint?.route?.id, ": Serving HTML ", this._html?.slice(0, 50), "...");
|
|
489
|
+
const html = await this.html(opts);
|
|
490
|
+
stream.set_header("Content-Length", html.content_length.toString());
|
|
491
|
+
const csp = stream.get_header("Content-Security-Policy");
|
|
492
|
+
if (csp == null || typeof csp !== "string") {
|
|
493
|
+
throw new Error("Cannot serve HTML without a string typed Content-Security-Policy (CSP) header defined on the endpoint. This should by default be defined by the Server.");
|
|
494
|
+
}
|
|
495
|
+
const new_csp = csp.replace(/(script-src|style-src)([^;]*)/g, (_, g1, g2) => `${g1}${g2} 'nonce-${html.nonce}'`);
|
|
496
|
+
stream.set_header("Content-Security-Policy", new_csp);
|
|
497
|
+
stream.send({
|
|
498
|
+
status: status_code,
|
|
499
|
+
headers: { "Content-Type": "text/html" },
|
|
500
|
+
data: html.html
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
html_nonce_split;
|
|
504
|
+
}
|
|
505
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
506
|
+
0 && (module.exports = {
|
|
507
|
+
View
|
|
508
|
+
});
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @author Daan van den Bergh
|
|
3
|
+
* @copyright © 2022 - 2025 Daan van den Bergh. All rights reserved
|
|
4
|
+
*/
|
|
5
|
+
export * from "./errors/index.js";
|
|
2
6
|
export * from "./status.js";
|
|
3
7
|
export * from "./meta.js";
|
|
4
8
|
export * from "./splash_screen.js";
|
|
@@ -9,7 +13,12 @@ export * from "./server.js";
|
|
|
9
13
|
export * from "./database/database.js";
|
|
10
14
|
export * from "./database/document.js";
|
|
11
15
|
export * from "./database/collection.js";
|
|
16
|
+
export * from "./database/quota/quota.js";
|
|
17
|
+
export * from "./database/quota/safe_int.js";
|
|
12
18
|
export * from "./rate_limit.js";
|
|
13
19
|
export * from "./logger.js";
|
|
20
|
+
export * from "./events.js";
|
|
21
|
+
export { User } from "./users.js";
|
|
14
22
|
export * as Mail from "./plugins/mail/ui.js";
|
|
15
23
|
export * from "./frontend.js";
|
|
24
|
+
export type { Request } from "../../frontend/src/modules/request.js";
|
|
@@ -28,12 +28,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var stdin_exports = {};
|
|
30
30
|
__export(stdin_exports, {
|
|
31
|
-
ExternalError: () => import_utils.ExternalError,
|
|
32
|
-
InternalError: () => import_utils.InternalError,
|
|
33
31
|
Mail: () => Mail
|
|
34
32
|
});
|
|
35
33
|
module.exports = __toCommonJS(stdin_exports);
|
|
36
|
-
|
|
34
|
+
__reExport(stdin_exports, require("./errors/index.js"), module.exports);
|
|
37
35
|
__reExport(stdin_exports, require("./status.js"), module.exports);
|
|
38
36
|
__reExport(stdin_exports, require("./meta.js"), module.exports);
|
|
39
37
|
__reExport(stdin_exports, require("./splash_screen.js"), module.exports);
|
|
@@ -44,15 +42,17 @@ __reExport(stdin_exports, require("./server.js"), module.exports);
|
|
|
44
42
|
__reExport(stdin_exports, require("./database/database.js"), module.exports);
|
|
45
43
|
__reExport(stdin_exports, require("./database/document.js"), module.exports);
|
|
46
44
|
__reExport(stdin_exports, require("./database/collection.js"), module.exports);
|
|
45
|
+
__reExport(stdin_exports, require("./database/quota/quota.js"), module.exports);
|
|
46
|
+
__reExport(stdin_exports, require("./database/quota/safe_int.js"), module.exports);
|
|
47
47
|
__reExport(stdin_exports, require("./rate_limit.js"), module.exports);
|
|
48
48
|
__reExport(stdin_exports, require("./logger.js"), module.exports);
|
|
49
|
+
__reExport(stdin_exports, require("./events.js"), module.exports);
|
|
49
50
|
var Mail = __toESM(require("./plugins/mail/ui.js"));
|
|
50
51
|
__reExport(stdin_exports, require("./frontend.js"), module.exports);
|
|
51
52
|
// Annotate the CommonJS export names for ESM import in node:
|
|
52
53
|
0 && (module.exports = {
|
|
53
|
-
ExternalError,
|
|
54
|
-
InternalError,
|
|
55
54
|
Mail,
|
|
55
|
+
...require("./errors/index.js"),
|
|
56
56
|
...require("./status.js"),
|
|
57
57
|
...require("./meta.js"),
|
|
58
58
|
...require("./splash_screen.js"),
|
|
@@ -63,7 +63,10 @@ __reExport(stdin_exports, require("./frontend.js"), module.exports);
|
|
|
63
63
|
...require("./database/database.js"),
|
|
64
64
|
...require("./database/document.js"),
|
|
65
65
|
...require("./database/collection.js"),
|
|
66
|
+
...require("./database/quota/quota.js"),
|
|
67
|
+
...require("./database/quota/safe_int.js"),
|
|
66
68
|
...require("./rate_limit.js"),
|
|
67
69
|
...require("./logger.js"),
|
|
70
|
+
...require("./events.js"),
|
|
68
71
|
...require("./frontend.js")
|
|
69
72
|
});
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author Daan van den Bergh
|
|
3
|
+
* @copyright © 2022 - 2025 Daan van den Bergh.
|
|
4
|
+
*/
|
|
5
|
+
import type { RegisteredEndpoint } from "../../../backend/src/server.js";
|
|
6
|
+
import type { APIError } from "../../../backend/src/stream.js";
|
|
7
|
+
export declare namespace Request {
|
|
8
|
+
/** The method type. */
|
|
9
|
+
export type Method = "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS";
|
|
10
|
+
/** The response data template base. */
|
|
11
|
+
type ResponseBodyBase = unknown | null | undefined | number | boolean | string | any[] | Record<string, any>;
|
|
12
|
+
/** The request data template base. */
|
|
13
|
+
type RequestBodyBase = unknown | null | undefined | string | Record<string, any>;
|
|
14
|
+
/**
|
|
15
|
+
* The detailed generic type for providing info for the {@link request} function.
|
|
16
|
+
*/
|
|
17
|
+
export type Info<Method extends Request.Method, Endpoint extends string | RegExp, ParamsBody extends RequestBodyBase, SuccessBody extends ResponseBodyBase, ErrorBody extends ResponseBodyBase> = {
|
|
18
|
+
/** The HTTP method for the request. */
|
|
19
|
+
method: Method;
|
|
20
|
+
/** The route's endpoint or full url with domain, string or regex. */
|
|
21
|
+
endpoint: Endpoint;
|
|
22
|
+
/** The request payload (body) type. */
|
|
23
|
+
payload: ParamsBody;
|
|
24
|
+
/** The success result body type. */
|
|
25
|
+
result: SuccessBody;
|
|
26
|
+
/** The error result body type. */
|
|
27
|
+
error: ErrorBody;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Create request info from a registered endpoint.
|
|
31
|
+
*/
|
|
32
|
+
export type InfoFromEndpoint<E extends RegisteredEndpoint<any, any, any>, SuccessBody extends ResponseBodyBase = undefined, ErrorBody extends ResponseBodyBase = undefined> = E extends RegisteredEndpoint<infer M, infer EP, infer P> ? Info<M extends undefined ? "GET" : M extends Method ? M : never, EP extends string ? EP : never, P, SuccessBody, ErrorBody> : never;
|
|
33
|
+
/** The request options. */
|
|
34
|
+
export interface Opts<Method extends Request.Method = "GET", Url extends string | RegExp = string, // use regex for backend support.
|
|
35
|
+
RequestBody extends RequestBodyBase = unknown> {
|
|
36
|
+
method?: Method;
|
|
37
|
+
url: Url;
|
|
38
|
+
data?: RequestBody;
|
|
39
|
+
json?: boolean;
|
|
40
|
+
credentials?: RequestCredentials;
|
|
41
|
+
headers?: Record<string, string>;
|
|
42
|
+
}
|
|
43
|
+
/** The returned result */
|
|
44
|
+
export type Result<SuccessBody extends ResponseBodyBase = unknown, ErrorBody extends ResponseBodyBase = unknown> = {
|
|
45
|
+
/** The request status. */
|
|
46
|
+
status: number;
|
|
47
|
+
} & ({
|
|
48
|
+
/** The api error from the backend {@link Stream.error}. */
|
|
49
|
+
error: APIError;
|
|
50
|
+
/** The error response body, always optional in case of body parsing failure. */
|
|
51
|
+
data?: ErrorBody;
|
|
52
|
+
} | {
|
|
53
|
+
/** The success response body. */
|
|
54
|
+
data: SuccessBody;
|
|
55
|
+
/** No API error from the backend {@link Stream.error} was found. */
|
|
56
|
+
error?: never;
|
|
57
|
+
});
|
|
58
|
+
/** The returned result by endpoint {@link Info} */
|
|
59
|
+
export type ResultFromInfo<Info extends Request.Info<any, any, any, any, any>> = Info extends Request.Info<any, any, any, infer S, infer E> ? Result<S, E> : never;
|
|
60
|
+
/** A promise to {@link Result}, for convenience. */
|
|
61
|
+
export type ResultPromise<SuccessBody extends ResponseBodyBase = unknown, ErrorBody extends ResponseBodyBase = unknown> = Promise<Result<SuccessBody, ErrorBody>>;
|
|
62
|
+
/** A promise to {@link Result} from endpoint {@link Info}, for convenience. */
|
|
63
|
+
export type ResultPromiseFromInfo<Info extends Request.Info<any, any, any, any, any>> = Info extends Request.Info<any, any, any, infer S, infer E> ? Promise<Result<S, E>> : never;
|
|
64
|
+
export {};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Make a request with a specific generic typing, optionally passing
|
|
68
|
+
* the request method, endpoint, request body and response body types.
|
|
69
|
+
*/
|
|
70
|
+
export declare function request<Info extends Request.Info<any, any, any, any, any>>(options: Info extends Request.Info<infer M, infer E, infer P, any, any> ? Request.Opts<M, E, P> : never): Promise<Info extends Request.Info<any, any, any, infer S, infer E> ? Request.Result<S, E> : never>;
|