@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,306 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author ...
|
|
3
|
+
* @copyright ...
|
|
4
|
+
*/
|
|
5
|
+
import { Compression } from "./compression.js";
|
|
6
|
+
/** A file attachment with an internal byte buffer and compression/encoding helpers. */
|
|
7
|
+
export class Attachment {
|
|
8
|
+
/** File or directory name. */
|
|
9
|
+
name;
|
|
10
|
+
/** Path relative to the dropped root. */
|
|
11
|
+
path;
|
|
12
|
+
/** MIME type of the data. */
|
|
13
|
+
mime_type;
|
|
14
|
+
/** Charset used for text decoding (if applicable). */
|
|
15
|
+
charset;
|
|
16
|
+
/** Whether the internal buffer is gzip-compressed. */
|
|
17
|
+
compressed;
|
|
18
|
+
/** Optional original File/Blob source. */
|
|
19
|
+
file;
|
|
20
|
+
/** Internal raw buffer (compressed or not depending on state). */
|
|
21
|
+
_bytes;
|
|
22
|
+
/** Create an Attachment from initial metadata and/or bytes. */
|
|
23
|
+
constructor(init) {
|
|
24
|
+
this.name = init.name;
|
|
25
|
+
this.path = init.path ?? "";
|
|
26
|
+
this.mime_type = init.mime_type ?? "";
|
|
27
|
+
this.charset = init.charset;
|
|
28
|
+
this.file = init.file;
|
|
29
|
+
this.compressed = !!init.compressed;
|
|
30
|
+
this._bytes = init.bytes ? Compression.to_uint8(init.bytes) : new Uint8Array(0);
|
|
31
|
+
}
|
|
32
|
+
/** Current size of the internal buffer in bytes (compressed if flagged). */
|
|
33
|
+
get size() { return this._bytes.byteLength; }
|
|
34
|
+
/** Get a copy of the internal buffer (leave compression state unchanged). */
|
|
35
|
+
bytes() { return new Uint8Array(this._bytes); }
|
|
36
|
+
/** Replace the internal buffer (optionally update compression flag). */
|
|
37
|
+
set_bytes(bytes, compressed = false) {
|
|
38
|
+
this._bytes = Compression.to_uint8(bytes);
|
|
39
|
+
this.compressed = compressed;
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
/** Ensure the buffer is gzip-compressed (noop if already compressed). */
|
|
43
|
+
compress(options = { level: 9 }) {
|
|
44
|
+
if (!this.compressed) {
|
|
45
|
+
this._bytes = Compression.compress(this._bytes, options);
|
|
46
|
+
this.compressed = true;
|
|
47
|
+
}
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
50
|
+
/** Ensure the buffer is uncompressed (noop if already uncompressed). */
|
|
51
|
+
decompress() {
|
|
52
|
+
if (this.compressed) {
|
|
53
|
+
this._bytes = Compression.decompress(this._bytes);
|
|
54
|
+
this.compressed = false;
|
|
55
|
+
}
|
|
56
|
+
return this;
|
|
57
|
+
}
|
|
58
|
+
/** Return Base64 of the current buffer (compressed or not). */
|
|
59
|
+
to_base64({ url_safe = false } = {}) {
|
|
60
|
+
return Compression.to_base64(this._bytes, { url_safe });
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Return a string view of the data using a charset.
|
|
64
|
+
* @param decompress Whether to decompress first if compressed. Default true.
|
|
65
|
+
* @param encoding Charset label; defaults to this.charset or "utf-8".
|
|
66
|
+
*/
|
|
67
|
+
to_string(decompress = true, encoding) {
|
|
68
|
+
const buf = decompress && this.compressed ? Compression.decompress(this._bytes) : this._bytes;
|
|
69
|
+
const enc = (encoding ?? this.charset ?? "utf-8").toLowerCase();
|
|
70
|
+
if (enc === "utf-8" || enc === "utf8")
|
|
71
|
+
return new TextDecoder().decode(buf);
|
|
72
|
+
try {
|
|
73
|
+
return new TextDecoder(enc).decode(buf);
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
return new TextDecoder().decode(buf);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Parse JSON from the data.
|
|
81
|
+
* @param decompress Whether to decompress first if compressed. Default true.
|
|
82
|
+
*/
|
|
83
|
+
to_json(decompress = true) {
|
|
84
|
+
return JSON.parse(this.to_string(decompress));
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Convert this attachment to a backend REST API attachment payload.
|
|
88
|
+
*
|
|
89
|
+
* This returns an object compatible with the server's `Mail.Attachment.RestAPI`
|
|
90
|
+
* shape using either:
|
|
91
|
+
* - `{ content, encoding }` (default; embeds the payload), or
|
|
92
|
+
* - `{ url }` (streams from an http(s)/data URL).
|
|
93
|
+
*
|
|
94
|
+
* @param opts Conversion options.
|
|
95
|
+
* @param opts.encoding Output string encoding for `content`. Defaults to `"base64"`.
|
|
96
|
+
* Supported: `"base64" | "hex" | "utf8"`.
|
|
97
|
+
* Use `"utf8"` only for textual data.
|
|
98
|
+
* @param opts.decompress Whether to decompress before encoding. Defaults to `true`.
|
|
99
|
+
* @param opts.url Optional http(s) or data: URL. When provided, `content`/`encoding`
|
|
100
|
+
* are omitted and the server will stream from this URL.
|
|
101
|
+
*
|
|
102
|
+
* @returns A REST API attachment payload with metadata plus either `{ content, encoding }` or `{ url }`.
|
|
103
|
+
*/
|
|
104
|
+
to_rest_api(opts = {}) {
|
|
105
|
+
const { encoding = "base64", decompress = true, url } = opts;
|
|
106
|
+
const base = {
|
|
107
|
+
name: this.name,
|
|
108
|
+
path: this.path || undefined,
|
|
109
|
+
mime_type: this.mime_type || undefined,
|
|
110
|
+
charset: this.charset || undefined,
|
|
111
|
+
compressed: this.compressed || undefined,
|
|
112
|
+
};
|
|
113
|
+
if (url) {
|
|
114
|
+
return { ...base, url };
|
|
115
|
+
}
|
|
116
|
+
const bytes = decompress && this.compressed ? Compression.decompress(this._bytes) : this._bytes;
|
|
117
|
+
if (encoding === "base64") {
|
|
118
|
+
return { ...base, content: Compression.to_base64(bytes, { url_safe: false }), encoding };
|
|
119
|
+
}
|
|
120
|
+
if (encoding === "hex") {
|
|
121
|
+
// encode bytes -> hex (lowercase)
|
|
122
|
+
const hex = (() => {
|
|
123
|
+
const v = bytes;
|
|
124
|
+
let out = "";
|
|
125
|
+
for (let i = 0; i < v.length; i++) {
|
|
126
|
+
const h = v[i].toString(16).padStart(2, "0");
|
|
127
|
+
out += h;
|
|
128
|
+
}
|
|
129
|
+
return out;
|
|
130
|
+
})();
|
|
131
|
+
return { ...base, content: hex, encoding };
|
|
132
|
+
}
|
|
133
|
+
if (encoding === "utf8") {
|
|
134
|
+
// textual encoding (may be lossy for binary data)
|
|
135
|
+
const text = new TextDecoder().decode(bytes);
|
|
136
|
+
return { ...base, content: text, encoding };
|
|
137
|
+
}
|
|
138
|
+
// fallback to base64 if unsupported encoding is passed
|
|
139
|
+
return { ...base, content: Compression.to_base64(bytes, { url_safe: false }), encoding: "base64" };
|
|
140
|
+
}
|
|
141
|
+
/** Clone the attachment, including bytes and metadata. */
|
|
142
|
+
clone() {
|
|
143
|
+
return new Attachment({
|
|
144
|
+
name: this.name,
|
|
145
|
+
path: this.path,
|
|
146
|
+
mime_type: this.mime_type,
|
|
147
|
+
charset: this.charset,
|
|
148
|
+
bytes: this.bytes(),
|
|
149
|
+
file: this.file,
|
|
150
|
+
compressed: this.compressed,
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
(function (Attachment) {
|
|
155
|
+
/** Create an Attachment from a Blob/File; optionally read and compress. */
|
|
156
|
+
async function from_blob(blob, opts = {}) {
|
|
157
|
+
const name = (opts.name ?? blob.name) || "blob";
|
|
158
|
+
const mime_type = blob.type || "";
|
|
159
|
+
const charset = (() => {
|
|
160
|
+
const label = opts.charset ?? "auto";
|
|
161
|
+
if (label !== "auto")
|
|
162
|
+
return label;
|
|
163
|
+
const m = /charset\s*=\s*([^;]+)/i.exec(mime_type);
|
|
164
|
+
return m ? m[1].trim().toLowerCase() : undefined;
|
|
165
|
+
})();
|
|
166
|
+
const att = new Attachment({ name, mime_type, charset, file: blob, bytes: new Uint8Array(0), compressed: false });
|
|
167
|
+
if (opts.read !== false) {
|
|
168
|
+
const ab = "arrayBuffer" in blob
|
|
169
|
+
? await blob.arrayBuffer()
|
|
170
|
+
: await new Promise((res, rej) => {
|
|
171
|
+
const r = new FileReader();
|
|
172
|
+
r.onerror = () => rej(r.error);
|
|
173
|
+
r.onload = () => res(r.result);
|
|
174
|
+
r.readAsArrayBuffer(blob);
|
|
175
|
+
});
|
|
176
|
+
att.set_bytes(new Uint8Array(ab), false);
|
|
177
|
+
if (opts.compress)
|
|
178
|
+
att.compress();
|
|
179
|
+
}
|
|
180
|
+
return att;
|
|
181
|
+
}
|
|
182
|
+
Attachment.from_blob = from_blob;
|
|
183
|
+
/**
|
|
184
|
+
* Handle drag/drop; recursively traverses directories and adds only files.
|
|
185
|
+
* Uses FS Access API when available, falls back to WebKit entries, otherwise flat files only.
|
|
186
|
+
*/
|
|
187
|
+
function on_drop(node, sink, opts) {
|
|
188
|
+
let { callback, read = true, compress = false, on_start, on_stop, on_error = (e) => console.error(e), max_size = 50 * 1024 * 1024, total_max_size = 50 * 1024 * 1024, } = opts;
|
|
189
|
+
/** Sum current sink sizes. */
|
|
190
|
+
const sink_total = () => sink.reduce((a, b) => a + b.size, 0);
|
|
191
|
+
/** Guard size constraints. */
|
|
192
|
+
const enforce_sizes = (file) => {
|
|
193
|
+
if (max_size !== -1 && file.size > max_size) {
|
|
194
|
+
on_error(new Error(`Attachment '${file.name}' exceeds the size limit of ${Math.round(max_size / (1024 * 1024))}MB.`));
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
if (total_max_size !== -1 && (sink_total() + file.size) > total_max_size) {
|
|
198
|
+
on_error(new Error(`Attachment '${file.name}' exceeds the total size limit of ${Math.round(total_max_size / (1024 * 1024))}MB.`));
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
201
|
+
return true;
|
|
202
|
+
};
|
|
203
|
+
/** Push a file as Attachment (respects read/compress). */
|
|
204
|
+
const push_file = async (file, rel_path = "") => {
|
|
205
|
+
if (!enforce_sizes(file))
|
|
206
|
+
return;
|
|
207
|
+
try {
|
|
208
|
+
const att = await Attachment.from_blob(file, { read, compress });
|
|
209
|
+
att.path = rel_path || file.path || file.name;
|
|
210
|
+
sink.push(att);
|
|
211
|
+
callback(att);
|
|
212
|
+
}
|
|
213
|
+
catch (e) {
|
|
214
|
+
on_error(e instanceof Error ? e : new Error(String(e)));
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
/** FS Access API: recursively collect files from a directory handle. */
|
|
218
|
+
const walk_fs_handle = async (handle, prefix = "") => {
|
|
219
|
+
if (handle.kind === "file") {
|
|
220
|
+
const file = await handle.getFile();
|
|
221
|
+
await push_file(file, `${prefix}${file.name}`);
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
if (handle.kind === "directory") {
|
|
225
|
+
// @ts-ignore: async iterator is standard on Chromium
|
|
226
|
+
for await (const [name, child] of handle.entries()) {
|
|
227
|
+
await walk_fs_handle(child, `${prefix}${name}/`);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
/** WebKit fallback: recursively collect files from a FileSystemEntry directory. */
|
|
232
|
+
const walk_webkit_entry = async (entry, prefix = "") => {
|
|
233
|
+
if (entry.isFile) {
|
|
234
|
+
await new Promise((resolve, reject) => {
|
|
235
|
+
entry.file(async (file) => { try {
|
|
236
|
+
await push_file(file, `${prefix}${file.name}`);
|
|
237
|
+
resolve();
|
|
238
|
+
}
|
|
239
|
+
catch (e) {
|
|
240
|
+
reject(e);
|
|
241
|
+
} }, reject);
|
|
242
|
+
});
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
if (entry.isDirectory) {
|
|
246
|
+
const reader = entry.createReader();
|
|
247
|
+
const read_all = async () => new Promise((res, rej) => reader.readEntries((ents) => res(ents), rej));
|
|
248
|
+
// readEntries may return partial batches; keep reading until empty
|
|
249
|
+
for (;;) {
|
|
250
|
+
const batch = await read_all();
|
|
251
|
+
if (!batch.length)
|
|
252
|
+
break;
|
|
253
|
+
for (const child of batch) {
|
|
254
|
+
await walk_webkit_entry(child, `${prefix}${entry.name ? entry.name + "/" : ""}${child.name ? "" : ""}`);
|
|
255
|
+
// Note: child.name is already included when recursing into child; build prefix at directory level:
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
node.ondragover = (event) => {
|
|
261
|
+
event.preventDefault();
|
|
262
|
+
event.dataTransfer && (event.dataTransfer.dropEffect = "copy");
|
|
263
|
+
on_start?.(event);
|
|
264
|
+
};
|
|
265
|
+
node.ondragend = (event) => { event.preventDefault(); on_stop?.(event); };
|
|
266
|
+
node.ondrop = (event) => {
|
|
267
|
+
event.preventDefault();
|
|
268
|
+
const items = event.dataTransfer?.items;
|
|
269
|
+
if (!items)
|
|
270
|
+
return;
|
|
271
|
+
// Process each DataTransferItem
|
|
272
|
+
(async () => {
|
|
273
|
+
for (let i = 0; i < items.length; i++) {
|
|
274
|
+
const item = items[i];
|
|
275
|
+
if (item.kind !== "file")
|
|
276
|
+
continue;
|
|
277
|
+
// Prefer FS Access API if available.
|
|
278
|
+
const get_handle = item.getAsFileSystemHandle?.bind(item);
|
|
279
|
+
if (get_handle) {
|
|
280
|
+
try {
|
|
281
|
+
const handle = await get_handle();
|
|
282
|
+
// handle can be file or directory
|
|
283
|
+
await walk_fs_handle(handle, "");
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
catch { /* fall through to other paths */ }
|
|
287
|
+
}
|
|
288
|
+
// WebKit directory traversal fallback.
|
|
289
|
+
const entry = item.webkitGetAsEntry?.();
|
|
290
|
+
if (entry && (entry.isDirectory || entry.isFile)) {
|
|
291
|
+
try {
|
|
292
|
+
await walk_webkit_entry(entry, "");
|
|
293
|
+
continue;
|
|
294
|
+
}
|
|
295
|
+
catch { /* fall through */ }
|
|
296
|
+
}
|
|
297
|
+
// Basic file fallback: just the file (most browsers).
|
|
298
|
+
const file = item.getAsFile();
|
|
299
|
+
if (file)
|
|
300
|
+
await push_file(file, file.name);
|
|
301
|
+
}
|
|
302
|
+
})().catch((e) => on_error(e instanceof Error ? e : new Error(String(e))));
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
Attachment.on_drop = on_drop;
|
|
306
|
+
})(Attachment || (Attachment = {}));
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author Daan van den Bergh
|
|
3
|
+
* @copyright © 2022 - 2025 Daan van den Bergh. All rights reserved
|
|
4
|
+
*/
|
|
5
|
+
import type { Users as UsersBackend } from "../../../backend/src/users.js";
|
|
6
|
+
import { Request } from "./request.js";
|
|
7
|
+
export declare namespace Auth {
|
|
8
|
+
/**
|
|
9
|
+
* Make a sign in request.
|
|
10
|
+
* @param payload The request payload.
|
|
11
|
+
* @docs
|
|
12
|
+
*/
|
|
13
|
+
function sign_in(payload: UsersBackend.Endpoints.SignIn["payload"]): Request.ResultPromiseFromInfo<UsersBackend.Endpoints.SignIn>;
|
|
14
|
+
/**
|
|
15
|
+
* Make a sign up request.
|
|
16
|
+
*
|
|
17
|
+
* Note that a request can be made first without the `payload.code` field,
|
|
18
|
+
* when all other fields are correctly defined it will return a {@link Status.two_factor_auth_required} backend status.
|
|
19
|
+
* Indicating a two-factor authentication challenge is sent, prompt the user to the next screen where the user can fill in the 2fa code.
|
|
20
|
+
* Then retrieve the 2fa code and resubmit the request with the code included.
|
|
21
|
+
*
|
|
22
|
+
* @param payload The request payload.
|
|
23
|
+
* @docs
|
|
24
|
+
*/
|
|
25
|
+
function sign_up(payload: UsersBackend.Endpoints.SignUp["payload"]): Request.ResultPromiseFromInfo<UsersBackend.Endpoints.SignUp>;
|
|
26
|
+
/**
|
|
27
|
+
* Make a sign out request.
|
|
28
|
+
* @docs
|
|
29
|
+
*/
|
|
30
|
+
function sign_out(): Request.ResultPromiseFromInfo<UsersBackend.Endpoints.SignOut>;
|
|
31
|
+
/**
|
|
32
|
+
* Make a send 2FA request.
|
|
33
|
+
* @param payload The request payload.
|
|
34
|
+
* @docs
|
|
35
|
+
*/
|
|
36
|
+
function send_2fa(payload: UsersBackend.Endpoints.Send2FA["payload"]): Request.ResultPromiseFromInfo<UsersBackend.Endpoints.Send2FA>;
|
|
37
|
+
/**
|
|
38
|
+
* Make a forgot password request.
|
|
39
|
+
* @param payload The request payload.
|
|
40
|
+
* @docs
|
|
41
|
+
*/
|
|
42
|
+
function forgot_password(payload: UsersBackend.Endpoints.ForgotPassword["payload"]): Request.ResultPromiseFromInfo<UsersBackend.Endpoints.ForgotPassword>;
|
|
43
|
+
}
|
|
44
|
+
export { Auth as auth };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author Daan van den Bergh
|
|
3
|
+
* @copyright © 2022 - 2025 Daan van den Bergh. All rights reserved
|
|
4
|
+
*/
|
|
5
|
+
import { request } from "./request.js";
|
|
6
|
+
// Namespace.
|
|
7
|
+
export var Auth;
|
|
8
|
+
(function (Auth) {
|
|
9
|
+
/**
|
|
10
|
+
* Make a sign in request.
|
|
11
|
+
* @param payload The request payload.
|
|
12
|
+
* @docs
|
|
13
|
+
*/
|
|
14
|
+
function sign_in(payload) {
|
|
15
|
+
return request({
|
|
16
|
+
method: "POST",
|
|
17
|
+
url: "/volt/api/v1/auth/signin",
|
|
18
|
+
data: payload,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
Auth.sign_in = sign_in;
|
|
22
|
+
/**
|
|
23
|
+
* Make a sign up request.
|
|
24
|
+
*
|
|
25
|
+
* Note that a request can be made first without the `payload.code` field,
|
|
26
|
+
* when all other fields are correctly defined it will return a {@link Status.two_factor_auth_required} backend status.
|
|
27
|
+
* Indicating a two-factor authentication challenge is sent, prompt the user to the next screen where the user can fill in the 2fa code.
|
|
28
|
+
* Then retrieve the 2fa code and resubmit the request with the code included.
|
|
29
|
+
*
|
|
30
|
+
* @param payload The request payload.
|
|
31
|
+
* @docs
|
|
32
|
+
*/
|
|
33
|
+
function sign_up(payload) {
|
|
34
|
+
return request({
|
|
35
|
+
method: "POST",
|
|
36
|
+
url: "/volt/api/v1/auth/signup",
|
|
37
|
+
data: payload,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
Auth.sign_up = sign_up;
|
|
41
|
+
/**
|
|
42
|
+
* Make a sign out request.
|
|
43
|
+
* @docs
|
|
44
|
+
*/
|
|
45
|
+
function sign_out() {
|
|
46
|
+
return request({
|
|
47
|
+
method: "POST",
|
|
48
|
+
url: "/volt/api/v1/auth/signout",
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
Auth.sign_out = sign_out;
|
|
52
|
+
/**
|
|
53
|
+
* Make a send 2FA request.
|
|
54
|
+
* @param payload The request payload.
|
|
55
|
+
* @docs
|
|
56
|
+
*/
|
|
57
|
+
function send_2fa(payload) {
|
|
58
|
+
return request({
|
|
59
|
+
method: "POST",
|
|
60
|
+
url: "/volt/api/v1/auth/2fa",
|
|
61
|
+
data: payload,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
Auth.send_2fa = send_2fa;
|
|
65
|
+
/**
|
|
66
|
+
* Make a forgot password request.
|
|
67
|
+
* @param payload The request payload.
|
|
68
|
+
* @docs
|
|
69
|
+
*/
|
|
70
|
+
function forgot_password(payload) {
|
|
71
|
+
return request({
|
|
72
|
+
method: "POST",
|
|
73
|
+
url: "/volt/api/v1/auth/forgot_password",
|
|
74
|
+
data: payload,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
Auth.forgot_password = forgot_password;
|
|
78
|
+
})(Auth || (Auth = {}));
|
|
79
|
+
;
|
|
80
|
+
export { Auth as auth }; // also export as lowercase for compatibility.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Schema } from "@vandenberghinc/vlib/frontend";
|
|
2
2
|
/**
|
|
3
3
|
* A utility class for color manipulation, conversion, and adjustment.
|
|
4
4
|
* Accepts colors in hex (e.g. "#ff0000"), RGB/RGBA strings (e.g. "rgb(255, 0, 0)" or "rgba(255,0,0,1)"),
|
|
@@ -73,7 +73,7 @@ export class Color {
|
|
|
73
73
|
else if (Array.isArray(input)) {
|
|
74
74
|
return Color.array_to_rgba(input);
|
|
75
75
|
}
|
|
76
|
-
throw new Error(`Invalid color input "${input}" with type "${
|
|
76
|
+
throw new Error(`Invalid color input "${input}" with type "${Schema.value_type(input)}". Ensure the input is a hex or rgb(a) color.`);
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
79
|
* Converts a numeric array to an RGBA object.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author Daan van den Bergh
|
|
3
|
+
* @copyright © 2022 - 2025 Daan van den Bergh. All rights reserved
|
|
4
|
+
*/
|
|
5
|
+
import type { DeflateOptions } from "pako";
|
|
6
|
+
/**
|
|
7
|
+
* Compression module.
|
|
8
|
+
* @nav Compression
|
|
9
|
+
*/
|
|
10
|
+
export declare namespace Compression {
|
|
11
|
+
/** Bytes-like inputs accepted by this wrapper (string must be pre-encoded if you want raw bytes). */
|
|
12
|
+
type BytesLike = Uint8Array | ArrayBuffer | DataView | ArrayLike<number> | Buffer;
|
|
13
|
+
/** GZip options passed through to pako.gzip. */
|
|
14
|
+
type GzipOptions = DeflateOptions;
|
|
15
|
+
/** Encode a UTF-8 string to bytes. */
|
|
16
|
+
function encode_utf8(str: string): Uint8Array;
|
|
17
|
+
/** Decode UTF-8 bytes to string. */
|
|
18
|
+
function decode_utf8(bytes: BytesLike): string;
|
|
19
|
+
/** Encode raw bytes to Base64 (URL-safe optional). */
|
|
20
|
+
function to_base64(bytes: BytesLike, opts?: {
|
|
21
|
+
url_safe?: boolean;
|
|
22
|
+
}): string;
|
|
23
|
+
/** Decode Base64 to bytes (supports URL-safe). */
|
|
24
|
+
function from_base64(b64: string): Uint8Array;
|
|
25
|
+
/** Internal: normalize various byte-like inputs to Uint8Array. */
|
|
26
|
+
function to_uint8(x: BytesLike): Uint8Array;
|
|
27
|
+
/** Compress bytes using gzip (no implicit stringify). */
|
|
28
|
+
function compress(data: BytesLike | string, options?: GzipOptions): Uint8Array;
|
|
29
|
+
/** Compress a JSON object or array. */
|
|
30
|
+
function compress_json(blob: Record<string, any> | any[], options?: GzipOptions): Promise<Uint8Array>;
|
|
31
|
+
/** Compress a Blob/File using FileReader (browser-safe). */
|
|
32
|
+
function compress_blob(blob: Blob | File, options?: GzipOptions): Promise<Uint8Array>;
|
|
33
|
+
/** Decompress gzip to raw bytes (use decode_utf8 / json_from_bytes explicitly if needed). */
|
|
34
|
+
function decompress(data: BytesLike): Uint8Array;
|
|
35
|
+
/** Decompress gzip and return a UTF-8 string. */
|
|
36
|
+
function decompress_to_string(data: BytesLike): string;
|
|
37
|
+
/** Decompress gzip and return parsed JSON. */
|
|
38
|
+
function decompress_to_json<T = unknown>(data: BytesLike): T;
|
|
39
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author Daan van den Bergh
|
|
3
|
+
* @copyright © 2022 - 2025 Daan van den Bergh. All rights reserved
|
|
4
|
+
*/
|
|
5
|
+
import * as pako from "pako";
|
|
6
|
+
/**
|
|
7
|
+
* Compression module.
|
|
8
|
+
* @nav Compression
|
|
9
|
+
*/
|
|
10
|
+
export var Compression;
|
|
11
|
+
(function (Compression) {
|
|
12
|
+
// ---------------------------------------------------------
|
|
13
|
+
// Types.
|
|
14
|
+
// ---------------------------------------------------------
|
|
15
|
+
//
|
|
16
|
+
/** Encode a UTF-8 string to bytes. */
|
|
17
|
+
function encode_utf8(str) {
|
|
18
|
+
return new TextEncoder().encode(str);
|
|
19
|
+
}
|
|
20
|
+
Compression.encode_utf8 = encode_utf8;
|
|
21
|
+
/** Decode UTF-8 bytes to string. */
|
|
22
|
+
function decode_utf8(bytes) {
|
|
23
|
+
return new TextDecoder().decode(to_uint8(bytes));
|
|
24
|
+
}
|
|
25
|
+
Compression.decode_utf8 = decode_utf8;
|
|
26
|
+
/** Encode raw bytes to Base64 (URL-safe optional). */
|
|
27
|
+
function to_base64(bytes, opts) {
|
|
28
|
+
const b = to_uint8(bytes);
|
|
29
|
+
const s = (typeof window !== "undefined" && "btoa" in window)
|
|
30
|
+
? btoa(String.fromCharCode(...b))
|
|
31
|
+
: Buffer.from(b).toString("base64");
|
|
32
|
+
if (opts?.url_safe) {
|
|
33
|
+
return s.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
34
|
+
}
|
|
35
|
+
return s;
|
|
36
|
+
}
|
|
37
|
+
Compression.to_base64 = to_base64;
|
|
38
|
+
/** Decode Base64 to bytes (supports URL-safe). */
|
|
39
|
+
function from_base64(b64) {
|
|
40
|
+
const norm = b64.replace(/-/g, "+").replace(/_/g, "/") + "===".slice((b64.length + 3) % 4);
|
|
41
|
+
if (typeof window !== "undefined" && "atob" in window) {
|
|
42
|
+
const bin = atob(norm);
|
|
43
|
+
const out = new Uint8Array(bin.length);
|
|
44
|
+
for (let i = 0; i < bin.length; i++)
|
|
45
|
+
out[i] = bin.charCodeAt(i);
|
|
46
|
+
return out;
|
|
47
|
+
}
|
|
48
|
+
return new Uint8Array(Buffer.from(norm, "base64"));
|
|
49
|
+
}
|
|
50
|
+
Compression.from_base64 = from_base64;
|
|
51
|
+
/** Internal: normalize various byte-like inputs to Uint8Array. */
|
|
52
|
+
function to_uint8(x) {
|
|
53
|
+
if (x instanceof Uint8Array)
|
|
54
|
+
return x;
|
|
55
|
+
if (x instanceof ArrayBuffer)
|
|
56
|
+
return new Uint8Array(x);
|
|
57
|
+
if (x instanceof DataView)
|
|
58
|
+
return new Uint8Array(x.buffer, x.byteOffset, x.byteLength);
|
|
59
|
+
// Covers Buffer and generic ArrayLike<number> without copying if already Uint8Array/Buffer.
|
|
60
|
+
return new Uint8Array(x);
|
|
61
|
+
}
|
|
62
|
+
Compression.to_uint8 = to_uint8;
|
|
63
|
+
// ---------------------------------------------------------
|
|
64
|
+
// Compression.
|
|
65
|
+
/** Compress bytes using gzip (no implicit stringify). */
|
|
66
|
+
function compress(data, options = { level: 9 }) {
|
|
67
|
+
const input = typeof data === "string" ? encode_utf8(data) : to_uint8(data);
|
|
68
|
+
return pako.gzip(input, options);
|
|
69
|
+
}
|
|
70
|
+
Compression.compress = compress;
|
|
71
|
+
/** Compress a JSON object or array. */
|
|
72
|
+
async function compress_json(blob, options = { level: 9 }) {
|
|
73
|
+
return compress(encode_utf8(JSON.stringify(blob)), options);
|
|
74
|
+
}
|
|
75
|
+
Compression.compress_json = compress_json;
|
|
76
|
+
/** Compress a Blob/File using FileReader (browser-safe). */
|
|
77
|
+
async function compress_blob(blob, options = { level: 9 }) {
|
|
78
|
+
const ab = await new Promise((resolve, reject) => {
|
|
79
|
+
const r = new FileReader();
|
|
80
|
+
r.onerror = () => reject(r.error);
|
|
81
|
+
r.onload = () => resolve(r.result);
|
|
82
|
+
r.readAsArrayBuffer(blob);
|
|
83
|
+
});
|
|
84
|
+
return pako.gzip(new Uint8Array(ab), options);
|
|
85
|
+
}
|
|
86
|
+
Compression.compress_blob = compress_blob;
|
|
87
|
+
/** Decompress gzip to raw bytes (use decode_utf8 / json_from_bytes explicitly if needed). */
|
|
88
|
+
function decompress(data) {
|
|
89
|
+
return pako.ungzip(to_uint8(data));
|
|
90
|
+
}
|
|
91
|
+
Compression.decompress = decompress;
|
|
92
|
+
/** Decompress gzip and return a UTF-8 string. */
|
|
93
|
+
function decompress_to_string(data) {
|
|
94
|
+
return decode_utf8(decompress(data));
|
|
95
|
+
}
|
|
96
|
+
Compression.decompress_to_string = decompress_to_string;
|
|
97
|
+
/** Decompress gzip and return parsed JSON. */
|
|
98
|
+
function decompress_to_json(data) {
|
|
99
|
+
return JSON.parse(decode_utf8(decompress(data)));
|
|
100
|
+
}
|
|
101
|
+
Compression.decompress_to_json = decompress_to_json;
|
|
102
|
+
})(Compression || (Compression = {}));
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author Daan van den Bergh
|
|
3
|
+
* @copyright © 2022 - 2025 Daan van den Bergh. All rights reserved
|
|
4
|
+
*/
|
|
5
|
+
export declare namespace Cookies {
|
|
6
|
+
let enabled: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Checks if cookies need to be parsed again.
|
|
9
|
+
* @docs
|
|
10
|
+
*/
|
|
11
|
+
function is_parse_required(): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Get cookies or a specific cookie by name.
|
|
14
|
+
* @experimental true
|
|
15
|
+
* @param name The name of the cookie.
|
|
16
|
+
* @docs
|
|
17
|
+
*/
|
|
18
|
+
function get(name?: string | null): string | {
|
|
19
|
+
[key: string]: string;
|
|
20
|
+
} | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Checks if the user has set a cookie preference (enabled or disabled).
|
|
23
|
+
* @docs
|
|
24
|
+
*/
|
|
25
|
+
function has_preference(): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Checks if cookies are accepted by the user.
|
|
28
|
+
* @docs
|
|
29
|
+
*/
|
|
30
|
+
function is_accepted(): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Enables cookies (opt-in) and updates the user's preference.
|
|
33
|
+
* @param _set_storage Whether to update the localStorage preference (default: true).
|
|
34
|
+
* @docs
|
|
35
|
+
*/
|
|
36
|
+
function enable(_set_storage?: boolean): void;
|
|
37
|
+
/**
|
|
38
|
+
* Disables cookies (opt-out) and updates the user's preference.
|
|
39
|
+
* @param _set_storage Whether to update the localStorage preference (default: true).
|
|
40
|
+
* @docs
|
|
41
|
+
*/
|
|
42
|
+
function disable(_set_storage?: boolean): void;
|
|
43
|
+
}
|
|
44
|
+
export { Cookies as cookies };
|