@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,248 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author Daan van den Bergh
|
|
3
|
+
* @copyright © 2022 - 2025 Daan van den Bergh.
|
|
4
|
+
*/
|
|
5
|
+
import * as nodemailer from "nodemailer";
|
|
6
|
+
import * as vlib from "@vandenberghinc/vlib";
|
|
7
|
+
import { Readable } from "stream";
|
|
8
|
+
import { Url } from "url";
|
|
9
|
+
import * as UI from "./ui.js";
|
|
10
|
+
/**
|
|
11
|
+
* mail module.
|
|
12
|
+
*/
|
|
13
|
+
export declare class Mail {
|
|
14
|
+
/** the smpt mailer. */
|
|
15
|
+
private smtp;
|
|
16
|
+
/** the smtp sender address. */
|
|
17
|
+
sender: Mail.Address;
|
|
18
|
+
/** the default mail style. */
|
|
19
|
+
style: Mail.Style;
|
|
20
|
+
/** construct a new server instance. */
|
|
21
|
+
constructor({ smtp, style, }: Mail.Opts);
|
|
22
|
+
/**
|
|
23
|
+
* send one or multiple mails.
|
|
24
|
+
*
|
|
25
|
+
* @note ensure SPF/DKIM are configured when sending attachments.
|
|
26
|
+
* @returns resolves/rejects when the mail has been sent.
|
|
27
|
+
*
|
|
28
|
+
* @param sender optional sender override.
|
|
29
|
+
* @param recipients recipient addresses.
|
|
30
|
+
* @param subject subject line.
|
|
31
|
+
* @param body html string or `UI.MailElement`.
|
|
32
|
+
* @param attachments supported inputs (paths, backend model, REST model, or nodemailer attachment).
|
|
33
|
+
* @param max_attachments limit on number of attachments; -1 disables.
|
|
34
|
+
* @param max_attachment_size max size (bytes) per attachment; -1 disables.
|
|
35
|
+
* @param max_attachments_size max total size (bytes) across attachments; -1 disables.
|
|
36
|
+
*/
|
|
37
|
+
send({ sender, recipients, subject, body, attachments, max_attachments, max_attachment_size, max_attachments_size, allow_untrusted_urls, }: {
|
|
38
|
+
sender?: Mail.Address;
|
|
39
|
+
recipients?: Mail.Address[];
|
|
40
|
+
subject?: string;
|
|
41
|
+
body?: string | UI.MailElement;
|
|
42
|
+
attachments?: Mail.Attachment.Any[];
|
|
43
|
+
} & Mail.Attachment.Limits): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* convert a single generic attachment input into a nodemailer attachment.
|
|
46
|
+
*/
|
|
47
|
+
private build_attachment;
|
|
48
|
+
/** returns true when url starts with http:// or https:// */
|
|
49
|
+
private is_http_url;
|
|
50
|
+
/**
|
|
51
|
+
* normalize and validate a mixed attachment input into nodemailer attachments.
|
|
52
|
+
* @param input mixed list of attachments.
|
|
53
|
+
* @param limits size/count validation limits.
|
|
54
|
+
* @returns normalized nodemailer attachments.
|
|
55
|
+
* @throws {ExternalError} when limits are exceeded.
|
|
56
|
+
*/
|
|
57
|
+
private normalize_and_validate_attachments;
|
|
58
|
+
/**
|
|
59
|
+
* measure the on-wire payload size (approx) of a nodemailer attachment content.
|
|
60
|
+
* note: if `encoding: "base64"` is set, we decode to compute raw byte size.
|
|
61
|
+
*/
|
|
62
|
+
private measure_attachment_bytes;
|
|
63
|
+
/**
|
|
64
|
+
* normalize a base64 or url-safe base64 string to standard base64 (no decoding).
|
|
65
|
+
* trims whitespace and converts url-safe chars.
|
|
66
|
+
*/
|
|
67
|
+
private normalize_base64;
|
|
68
|
+
/**
|
|
69
|
+
* optional content headers for charset/compression hints.
|
|
70
|
+
* email clients usually ignore custom headers; added for traceability.
|
|
71
|
+
*/
|
|
72
|
+
private build_content_headers;
|
|
73
|
+
}
|
|
74
|
+
/** nested types for the mail module. */
|
|
75
|
+
export declare namespace Mail {
|
|
76
|
+
/** a mail address, either a string or an array of [name, email]. */
|
|
77
|
+
type Address = string | [string, string];
|
|
78
|
+
/** options for the smtp mailer. */
|
|
79
|
+
interface Opts {
|
|
80
|
+
/**
|
|
81
|
+
* the smtp nodemailer arguments object.
|
|
82
|
+
* more information can be found at the nodemailer documentation.
|
|
83
|
+
*/
|
|
84
|
+
smtp: {
|
|
85
|
+
/** the smtp sender address; either a string email, e.g. `your@email.com`, or`[name, email]`. */
|
|
86
|
+
sender: Address;
|
|
87
|
+
/** the mail server's host address. */
|
|
88
|
+
host?: string;
|
|
89
|
+
/** the mail server's port. */
|
|
90
|
+
port?: number;
|
|
91
|
+
/** enable secure options. */
|
|
92
|
+
secure?: boolean;
|
|
93
|
+
/** the authentication settings. */
|
|
94
|
+
auth?: {
|
|
95
|
+
/** the email used for authentication. */
|
|
96
|
+
user: string;
|
|
97
|
+
/** the password used for authentication. */
|
|
98
|
+
pass: string;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* the smtp `nodemailer.createTransport` argument that overrides the other {@link Mail.Opts.smtp} options.
|
|
102
|
+
* use this to supply vendor-specific transport options.
|
|
103
|
+
*/
|
|
104
|
+
override?: nodemailer.TransportOptions;
|
|
105
|
+
};
|
|
106
|
+
/** the default mail style. */
|
|
107
|
+
style?: Style;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* style tokens used to theme automatically generated emails.
|
|
111
|
+
*/
|
|
112
|
+
interface Style {
|
|
113
|
+
/** the font family. */
|
|
114
|
+
font: string;
|
|
115
|
+
/** the title foreground color. */
|
|
116
|
+
title_fg: string;
|
|
117
|
+
/** the subtitle foreground color. */
|
|
118
|
+
subtitle_fg: string;
|
|
119
|
+
/** the body text foreground color. */
|
|
120
|
+
text_fg: string;
|
|
121
|
+
/** the foreground color used for buttons. */
|
|
122
|
+
button_fg: string;
|
|
123
|
+
/** the footer foreground color. */
|
|
124
|
+
footer_fg: string;
|
|
125
|
+
/** page background color. */
|
|
126
|
+
bg: string;
|
|
127
|
+
/** widget background color. */
|
|
128
|
+
widget_bg: string;
|
|
129
|
+
/** widget border color. */
|
|
130
|
+
widget_border: string;
|
|
131
|
+
/** button background color. */
|
|
132
|
+
button_bg: string;
|
|
133
|
+
/** divider color. */
|
|
134
|
+
divider_bg: string;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* stable backend attachment model.
|
|
138
|
+
* mirrors the frontend Attachment; provide either raw `bytes` or `{ content, encoding }`.
|
|
139
|
+
* encoding is only used when `content` is a string.
|
|
140
|
+
*/
|
|
141
|
+
interface Attachment {
|
|
142
|
+
/** file or directory name. */
|
|
143
|
+
name: string;
|
|
144
|
+
/** path relative to a logical root (optional). */
|
|
145
|
+
path?: string;
|
|
146
|
+
/** mime type of the data. */
|
|
147
|
+
mime_type?: string;
|
|
148
|
+
/** charset used for text decoding (if applicable). */
|
|
149
|
+
charset?: string;
|
|
150
|
+
/** raw bytes buffer. */
|
|
151
|
+
bytes?: Buffer | Uint8Array;
|
|
152
|
+
/** textual payload to be decoded using `encoding`. */
|
|
153
|
+
content?: string;
|
|
154
|
+
/** encoding used to decode `content` into bytes (e.g. base64, hex, utf8, binary, latin1). */
|
|
155
|
+
encoding?: "base64" | "hex" | "utf8" | "utf-8" | "binary" | "latin1";
|
|
156
|
+
/** whether bytes are gzip-compressed (metadata only). */
|
|
157
|
+
compressed?: boolean;
|
|
158
|
+
}
|
|
159
|
+
/** Nested attachment types. */
|
|
160
|
+
namespace Attachment {
|
|
161
|
+
/** The possible encodings. */
|
|
162
|
+
type Encoding = "base64" | "hex" | "utf8" | "utf-8" | "binary" | "latin1";
|
|
163
|
+
const encodings: Set<Encoding>;
|
|
164
|
+
/** Attachment validation limits. */
|
|
165
|
+
interface Limits {
|
|
166
|
+
/** Maximum number of attachments allowed (unset means no limit). */
|
|
167
|
+
max_attachments?: number;
|
|
168
|
+
/** Maximum size in bytes per attachment (unset means no limit). */
|
|
169
|
+
max_attachment_size?: number;
|
|
170
|
+
/** Maximum cumulative size in bytes across all attachments (unset means no limit). */
|
|
171
|
+
max_attachments_size?: number;
|
|
172
|
+
/** Allow loading http/https urls as attachments (default: false). */
|
|
173
|
+
allow_untrusted_urls?: boolean;
|
|
174
|
+
}
|
|
175
|
+
/** Type guard. */
|
|
176
|
+
function is(a: any): a is Attachment;
|
|
177
|
+
/**
|
|
178
|
+
* user-friendly REST attachment payload.
|
|
179
|
+
* choose one of:
|
|
180
|
+
* - `{ content, encoding }` for inline payloads (encoding: base64/hex/utf8/binary/latin1).
|
|
181
|
+
* - `{ url }` for http(s) or data: urls (streamed by nodemailer).
|
|
182
|
+
*/
|
|
183
|
+
interface RestAPI {
|
|
184
|
+
/** file name to display to the recipient. */
|
|
185
|
+
name: string;
|
|
186
|
+
/** relative path inside a bundle/archive (metadata only, optional). */
|
|
187
|
+
path?: string;
|
|
188
|
+
/** mime type of the data. */
|
|
189
|
+
mime_type?: string;
|
|
190
|
+
/** charset used for text decoding (if applicable). */
|
|
191
|
+
charset?: string;
|
|
192
|
+
/** whether the provided bytes are gzip-compressed (metadata only). */
|
|
193
|
+
compressed?: boolean;
|
|
194
|
+
/** textual payload to be decoded using `encoding`. */
|
|
195
|
+
content?: string;
|
|
196
|
+
/** encoding used to decode `content` into bytes. */
|
|
197
|
+
encoding?: "base64" | "hex" | "utf8" | "utf-8" | "binary" | "latin1";
|
|
198
|
+
/** http(s) url or data: url to stream. */
|
|
199
|
+
url?: string;
|
|
200
|
+
}
|
|
201
|
+
namespace RestAPI {
|
|
202
|
+
/** Type guard. */
|
|
203
|
+
function is(a: any): a is RestAPI;
|
|
204
|
+
/** Schema validation. */
|
|
205
|
+
const Schema: vlib.Schema.Opts;
|
|
206
|
+
}
|
|
207
|
+
/** A native nodemailer attachment. */
|
|
208
|
+
interface Native {
|
|
209
|
+
/** String, Buffer or a Stream contents for the attachment */
|
|
210
|
+
content?: string | Buffer | Readable | undefined;
|
|
211
|
+
/** path to a file or an URL (data uris are allowed as well) if you want to stream the file instead of including it (better for larger attachments) */
|
|
212
|
+
path?: string | Url | undefined;
|
|
213
|
+
/** filename to be reported as the name of the attached file, use of unicode is allowed. If you do not want to use a filename, set this value as false, otherwise a filename is generated automatically */
|
|
214
|
+
filename?: string | false | undefined;
|
|
215
|
+
/** optional content id for using inline images in HTML message source. Using cid sets the default contentDisposition to 'inline' and moves the attachment into a multipart/related mime node, so use it only if you actually want to use this attachment as an embedded image */
|
|
216
|
+
cid?: string | undefined;
|
|
217
|
+
/** If set and content is string, then encodes the content to a Buffer using the specified encoding. Example values: base64, hex, binary etc. Useful if you want to use binary attachments in a JSON formatted e-mail object */
|
|
218
|
+
encoding?: string | undefined;
|
|
219
|
+
/** optional content type for the attachment, if not set will be derived from the filename property */
|
|
220
|
+
contentType?: string | undefined;
|
|
221
|
+
/** optional transfer encoding for the attachment, if not set it will be derived from the contentType property. Example values: quoted-printable, base64. If it is unset then base64 encoding is used for the attachment. If it is set to false then previous default applies (base64 for most, 7bit for text). */
|
|
222
|
+
contentTransferEncoding?: "7bit" | "base64" | "quoted-printable" | false | undefined;
|
|
223
|
+
/** optional content disposition type for the attachment, defaults to ‘attachment’ */
|
|
224
|
+
contentDisposition?: "attachment" | "inline" | undefined;
|
|
225
|
+
/** is an object of additional headers */
|
|
226
|
+
headers?: {
|
|
227
|
+
[key: string]: string | string[] | {
|
|
228
|
+
prepared: boolean;
|
|
229
|
+
value: string;
|
|
230
|
+
};
|
|
231
|
+
} | Array<{
|
|
232
|
+
key: string;
|
|
233
|
+
value: string;
|
|
234
|
+
}>;
|
|
235
|
+
/** an optional value that overrides entire node content in the mime message. If used then all other options set for this node are ignored. */
|
|
236
|
+
raw?: string | Buffer | Readable | Native | undefined;
|
|
237
|
+
}
|
|
238
|
+
/** Nested native types. */
|
|
239
|
+
namespace Native {
|
|
240
|
+
/** Simple type guard. */
|
|
241
|
+
function is(a: any): a is Native;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Unified attachment input accepted by {@link Mail.send}.
|
|
245
|
+
*/
|
|
246
|
+
type Any = string | vlib.Path | Attachment | RestAPI | Native;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author Daan van den Bergh
|
|
3
|
+
* @copyright © 2022 - 2025 Daan van den Bergh.
|
|
4
|
+
*/
|
|
5
|
+
// imports.
|
|
6
|
+
import * as nodemailer from "nodemailer";
|
|
7
|
+
import * as vlib from "@vandenberghinc/vlib";
|
|
8
|
+
// imports.
|
|
9
|
+
import * as UI from "./ui.js";
|
|
10
|
+
import { ExternalError } from "../../errors/index.js";
|
|
11
|
+
import { Status } from "../../status.js";
|
|
12
|
+
/**
|
|
13
|
+
* mail module.
|
|
14
|
+
*/
|
|
15
|
+
export class Mail {
|
|
16
|
+
/** the smpt mailer. */
|
|
17
|
+
smtp;
|
|
18
|
+
/** the smtp sender address. */
|
|
19
|
+
sender; // is defined when `smtp` is defined.
|
|
20
|
+
/** the default mail style. */
|
|
21
|
+
style;
|
|
22
|
+
/** construct a new server instance. */
|
|
23
|
+
constructor({ smtp, style = {
|
|
24
|
+
font: '"Helvetica", sans-serif',
|
|
25
|
+
title_fg: "#121B23",
|
|
26
|
+
subtitle_fg: "#121B23",
|
|
27
|
+
text_fg: "#1F2F3D",
|
|
28
|
+
button_fg: "#FFFFFF",
|
|
29
|
+
footer_fg: "#686B80",
|
|
30
|
+
bg: "#EEEEEE",
|
|
31
|
+
widget_bg: "#FFFFFF",
|
|
32
|
+
widget_border: "#E6E6E6",
|
|
33
|
+
button_bg: "#1F2F3D",
|
|
34
|
+
divider_bg: "#706780",
|
|
35
|
+
}, }) {
|
|
36
|
+
this.style = style;
|
|
37
|
+
this.sender = smtp.sender;
|
|
38
|
+
this.smtp = nodemailer.createTransport({
|
|
39
|
+
...smtp,
|
|
40
|
+
...(smtp.override ?? {}),
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
// ---------------------------------------------------------
|
|
44
|
+
// public methods.
|
|
45
|
+
/**
|
|
46
|
+
* send one or multiple mails.
|
|
47
|
+
*
|
|
48
|
+
* @note ensure SPF/DKIM are configured when sending attachments.
|
|
49
|
+
* @returns resolves/rejects when the mail has been sent.
|
|
50
|
+
*
|
|
51
|
+
* @param sender optional sender override.
|
|
52
|
+
* @param recipients recipient addresses.
|
|
53
|
+
* @param subject subject line.
|
|
54
|
+
* @param body html string or `UI.MailElement`.
|
|
55
|
+
* @param attachments supported inputs (paths, backend model, REST model, or nodemailer attachment).
|
|
56
|
+
* @param max_attachments limit on number of attachments; -1 disables.
|
|
57
|
+
* @param max_attachment_size max size (bytes) per attachment; -1 disables.
|
|
58
|
+
* @param max_attachments_size max total size (bytes) across attachments; -1 disables.
|
|
59
|
+
*/
|
|
60
|
+
async send({ sender = undefined, recipients = [], subject = undefined, body = "", attachments = [], max_attachments = -1, max_attachment_size = -1, max_attachments_size = -1, allow_untrusted_urls = false, }) {
|
|
61
|
+
if (!this.smtp) {
|
|
62
|
+
throw new Error("smtp is not enabled, define the required server argument on initialization to enable smtp.");
|
|
63
|
+
}
|
|
64
|
+
if (body instanceof UI.MailElement) {
|
|
65
|
+
body = body.html();
|
|
66
|
+
}
|
|
67
|
+
if ((sender == null) && (this.sender != null)) {
|
|
68
|
+
sender = this.sender;
|
|
69
|
+
}
|
|
70
|
+
if (!recipients || recipients.length === 0) {
|
|
71
|
+
throw new Error("the mail has no recipients.");
|
|
72
|
+
}
|
|
73
|
+
if (sender == null) {
|
|
74
|
+
throw new Error('parameter "sender" should be a defined value of type "string" or "array".');
|
|
75
|
+
}
|
|
76
|
+
const format_address = (address) => {
|
|
77
|
+
if (Array.isArray(address))
|
|
78
|
+
return `${address[0]} <${address[1]}>`;
|
|
79
|
+
return address;
|
|
80
|
+
};
|
|
81
|
+
const to = [];
|
|
82
|
+
recipients.forEach((address) => to.push(format_address(address)));
|
|
83
|
+
const { nodemailer_attachments } = this.normalize_and_validate_attachments(attachments, {
|
|
84
|
+
max_attachments,
|
|
85
|
+
max_attachment_size,
|
|
86
|
+
max_attachments_size,
|
|
87
|
+
allow_untrusted_urls,
|
|
88
|
+
});
|
|
89
|
+
try {
|
|
90
|
+
await this.smtp.sendMail({
|
|
91
|
+
from: format_address(sender),
|
|
92
|
+
to,
|
|
93
|
+
subject,
|
|
94
|
+
html: body,
|
|
95
|
+
attachments: nodemailer_attachments,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
throw new Error(error?.message ?? String(error));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
// ---------------------------------------------------------
|
|
103
|
+
// attachment handling (normalization + validation).
|
|
104
|
+
// ---------------------------------------------------------
|
|
105
|
+
/**
|
|
106
|
+
* convert a single generic attachment input into a nodemailer attachment.
|
|
107
|
+
*/
|
|
108
|
+
build_attachment(it, opts = {}) {
|
|
109
|
+
// filesystem path inputs (string | vlib.Path).
|
|
110
|
+
if (typeof it === "string" || (it instanceof vlib.Path)) {
|
|
111
|
+
const path = (it instanceof vlib.Path) ? it : new vlib.Path(it);
|
|
112
|
+
const file_name = path.full_name();
|
|
113
|
+
const buf = path.load_sync();
|
|
114
|
+
return {
|
|
115
|
+
filename: file_name,
|
|
116
|
+
path: path.str(),
|
|
117
|
+
content: buf,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
// rest payload: either { content + encoding } or { url }.
|
|
121
|
+
if (Mail.Attachment.RestAPI.is(it)) {
|
|
122
|
+
const { name, mime_type, charset, compressed } = it;
|
|
123
|
+
// a) content + encoding -> to content Buffer/string for nodemailer.
|
|
124
|
+
if (typeof it.content === "string") {
|
|
125
|
+
const enc = (it.encoding ?? "base64").toLowerCase();
|
|
126
|
+
let payload = it.content;
|
|
127
|
+
if (enc === "base64") {
|
|
128
|
+
payload = Buffer.from(this.normalize_base64(it.content), "base64");
|
|
129
|
+
}
|
|
130
|
+
else if (enc === "hex" || enc === "latin1" || enc === "binary" || enc === "utf8" || enc === "utf-8") {
|
|
131
|
+
const node_enc = enc === "utf-8" ? "utf8" : enc;
|
|
132
|
+
payload = Buffer.from(it.content, node_enc);
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
throw new ExternalError({
|
|
136
|
+
status: Status.bad_request,
|
|
137
|
+
type: "InvalidAttachment",
|
|
138
|
+
message: `Unsupported encoding '${it.encoding}'.`,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
return {
|
|
142
|
+
filename: name ?? "attachment",
|
|
143
|
+
content: payload,
|
|
144
|
+
contentType: mime_type,
|
|
145
|
+
headers: this.build_content_headers({ charset, compressed }),
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
// b) url (http/https/data) -> nodemailer streams from path.
|
|
149
|
+
if (it.url) {
|
|
150
|
+
if (!opts.allow_untrusted_urls && this.is_http_url(it.url)) {
|
|
151
|
+
throw new ExternalError({
|
|
152
|
+
status: Status.bad_request,
|
|
153
|
+
type: "UntrustedUrlBlocked",
|
|
154
|
+
message: "http/https attachment urls are blocked by default. set 'allow_untrusted_urls' to true to allow.",
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
return {
|
|
158
|
+
filename: name ?? "attachment",
|
|
159
|
+
path: it.url,
|
|
160
|
+
contentType: mime_type,
|
|
161
|
+
headers: this.build_content_headers({ charset, compressed }),
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
throw new ExternalError({
|
|
165
|
+
status: Status.bad_request,
|
|
166
|
+
type: "InvalidAttachment",
|
|
167
|
+
message: "Attachment payload missing { content, encoding } or { url }.",
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
// backend model: { bytes } or { content + encoding }.
|
|
171
|
+
if (Mail.Attachment.is(it)) {
|
|
172
|
+
const { name, mime_type, charset, compressed } = it;
|
|
173
|
+
if (it.bytes) {
|
|
174
|
+
const buf = Buffer.isBuffer(it.bytes) ? it.bytes : Buffer.from(it.bytes);
|
|
175
|
+
return {
|
|
176
|
+
filename: name ?? "attachment",
|
|
177
|
+
content: buf,
|
|
178
|
+
contentType: mime_type,
|
|
179
|
+
headers: this.build_content_headers({ charset, compressed }),
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
if (typeof it.content === "string") {
|
|
183
|
+
const enc = (it.encoding ?? "base64").toLowerCase();
|
|
184
|
+
let payload;
|
|
185
|
+
if (enc === "base64") {
|
|
186
|
+
payload = Buffer.from(this.normalize_base64(it.content), "base64");
|
|
187
|
+
}
|
|
188
|
+
else if (enc === "hex" || enc === "latin1" || enc === "binary" || enc === "utf8" || enc === "utf-8") {
|
|
189
|
+
const node_enc = enc === "utf-8" ? "utf8" : enc;
|
|
190
|
+
payload = Buffer.from(it.content, node_enc);
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
throw new ExternalError({
|
|
194
|
+
status: Status.bad_request,
|
|
195
|
+
type: "InvalidAttachment",
|
|
196
|
+
message: `Unsupported encoding '${it.encoding}'.`,
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
return {
|
|
200
|
+
filename: name ?? "attachment",
|
|
201
|
+
content: payload,
|
|
202
|
+
contentType: mime_type,
|
|
203
|
+
headers: this.build_content_headers({ charset, compressed }),
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
// passthrough for pre-built nodemailer attachments.
|
|
207
|
+
if (Mail.Attachment.Native.is(it)) {
|
|
208
|
+
return { ...it };
|
|
209
|
+
}
|
|
210
|
+
throw new ExternalError({
|
|
211
|
+
status: Status.bad_request,
|
|
212
|
+
type: "InvalidAttachment",
|
|
213
|
+
message: "Attachment missing content: provide bytes or { content, encoding }.",
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
throw new ExternalError({
|
|
217
|
+
status: Status.bad_request,
|
|
218
|
+
type: "InvalidAttachment",
|
|
219
|
+
message: "Unsupported attachment input.",
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
/** returns true when url starts with http:// or https:// */
|
|
223
|
+
is_http_url(u) {
|
|
224
|
+
const s = typeof u === "string" ? u : String(u);
|
|
225
|
+
return /^https?:\/\//i.test(s);
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* normalize and validate a mixed attachment input into nodemailer attachments.
|
|
229
|
+
* @param input mixed list of attachments.
|
|
230
|
+
* @param limits size/count validation limits.
|
|
231
|
+
* @returns normalized nodemailer attachments.
|
|
232
|
+
* @throws {ExternalError} when limits are exceeded.
|
|
233
|
+
*/
|
|
234
|
+
normalize_and_validate_attachments(input, limits = {}) {
|
|
235
|
+
const items = input ?? [];
|
|
236
|
+
const nm_attachments = [];
|
|
237
|
+
for (const it of items) {
|
|
238
|
+
const built = this.build_attachment(it, limits);
|
|
239
|
+
nm_attachments.push(built);
|
|
240
|
+
}
|
|
241
|
+
const { max_attachments, max_attachment_size, max_attachments_size, } = limits;
|
|
242
|
+
if (typeof max_attachments === "number" && max_attachments !== -1 && nm_attachments.length > max_attachments) {
|
|
243
|
+
throw new ExternalError({
|
|
244
|
+
status: Status.bad_request,
|
|
245
|
+
type: "TooManyAttachments",
|
|
246
|
+
message: `Too many attachments. max is ${max_attachments}.`,
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
if (typeof max_attachment_size === "number" && max_attachment_size !== -1) {
|
|
250
|
+
for (const a of nm_attachments) {
|
|
251
|
+
const size = this.measure_attachment_bytes(a);
|
|
252
|
+
if (size > max_attachment_size) {
|
|
253
|
+
throw new ExternalError({
|
|
254
|
+
status: Status.bad_request,
|
|
255
|
+
type: "AttachmentTooLarge",
|
|
256
|
+
message: `Attachment '${a.filename ?? "unnamed"}' exceeds max size of ${max_attachment_size} bytes.`,
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
if (typeof max_attachments_size === "number" && max_attachments_size !== -1) {
|
|
262
|
+
let total = 0;
|
|
263
|
+
for (const a of nm_attachments)
|
|
264
|
+
total += this.measure_attachment_bytes(a);
|
|
265
|
+
if (total > max_attachments_size) {
|
|
266
|
+
throw new ExternalError({
|
|
267
|
+
status: Status.bad_request,
|
|
268
|
+
type: "AttachmentsTooLarge",
|
|
269
|
+
message: `Total attachments size ${total} bytes exceeds max of ${max_attachments_size} bytes.`,
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return { nodemailer_attachments: nm_attachments };
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* measure the on-wire payload size (approx) of a nodemailer attachment content.
|
|
277
|
+
* note: if `encoding: "base64"` is set, we decode to compute raw byte size.
|
|
278
|
+
*/
|
|
279
|
+
measure_attachment_bytes(a) {
|
|
280
|
+
if (a.content) {
|
|
281
|
+
if (Buffer.isBuffer(a.content))
|
|
282
|
+
return a.content.length;
|
|
283
|
+
if (typeof a.content === "string") {
|
|
284
|
+
if (a.encoding === "base64") {
|
|
285
|
+
try {
|
|
286
|
+
return Buffer.from(a.content, "base64").length;
|
|
287
|
+
}
|
|
288
|
+
catch {
|
|
289
|
+
return a.content.length;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return Buffer.byteLength(a.content);
|
|
293
|
+
}
|
|
294
|
+
// stream size unknown beforehand.
|
|
295
|
+
return 0;
|
|
296
|
+
}
|
|
297
|
+
if (a.path) {
|
|
298
|
+
try {
|
|
299
|
+
const p = new vlib.Path(String(a.path));
|
|
300
|
+
return p.size ?? 0;
|
|
301
|
+
}
|
|
302
|
+
catch {
|
|
303
|
+
return 0;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
return 0;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* normalize a base64 or url-safe base64 string to standard base64 (no decoding).
|
|
310
|
+
* trims whitespace and converts url-safe chars.
|
|
311
|
+
*/
|
|
312
|
+
normalize_base64(b64) {
|
|
313
|
+
let t = String(b64).trim().replace(/-/g, "+").replace(/_/g, "/");
|
|
314
|
+
const mod = t.length % 4;
|
|
315
|
+
if (mod)
|
|
316
|
+
t += "=".repeat(4 - mod);
|
|
317
|
+
return t;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* optional content headers for charset/compression hints.
|
|
321
|
+
* email clients usually ignore custom headers; added for traceability.
|
|
322
|
+
*/
|
|
323
|
+
build_content_headers({ charset, compressed }) {
|
|
324
|
+
const headers = {};
|
|
325
|
+
if (charset)
|
|
326
|
+
headers["X-Attachment-Charset"] = charset;
|
|
327
|
+
if (typeof compressed === "boolean")
|
|
328
|
+
headers["X-Attachment-Compressed"] = compressed ? "gzip" : "none";
|
|
329
|
+
return Object.keys(headers).length ? headers : undefined;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
/** nested types for the mail module. */
|
|
333
|
+
(function (Mail) {
|
|
334
|
+
/** Nested attachment types. */
|
|
335
|
+
let Attachment;
|
|
336
|
+
(function (Attachment) {
|
|
337
|
+
Attachment.encodings = new Set(["base64", "hex", "utf8", "utf-8", "binary", "latin1"]);
|
|
338
|
+
/** Type guard. */
|
|
339
|
+
function is(a) {
|
|
340
|
+
return a && typeof a === "object"
|
|
341
|
+
&& ("name" in a)
|
|
342
|
+
&& (!("path" in a) || typeof a.path === "string")
|
|
343
|
+
&& (!("mime_type" in a) || typeof a.mime_type === "string")
|
|
344
|
+
&& (!("charset" in a) || typeof a.charset === "string")
|
|
345
|
+
&& (!("bytes" in a) || (Buffer.isBuffer(a.bytes) || a.bytes instanceof Uint8Array))
|
|
346
|
+
&& (!("content" in a) || typeof a.content === "string")
|
|
347
|
+
&& (!("encoding" in a) || Attachment.encodings.has(a.encoding))
|
|
348
|
+
&& (!("compressed" in a) || typeof a.compressed === "boolean");
|
|
349
|
+
}
|
|
350
|
+
Attachment.is = is;
|
|
351
|
+
let RestAPI;
|
|
352
|
+
(function (RestAPI) {
|
|
353
|
+
/** Type guard. */
|
|
354
|
+
function is(a) {
|
|
355
|
+
return a && typeof a === "object"
|
|
356
|
+
&& ("name" in a)
|
|
357
|
+
&& (!("path" in a) || typeof a.path === "string")
|
|
358
|
+
&& (!("mime_type" in a) || typeof a.mime_type === "string")
|
|
359
|
+
&& (!("charset" in a) || typeof a.charset === "string")
|
|
360
|
+
&& (!("compressed" in a) || typeof a.compressed === "boolean")
|
|
361
|
+
&& (!("content" in a) || typeof a.content === "string")
|
|
362
|
+
&& (!("encoding" in a) || Attachment.encodings.has(a.encoding))
|
|
363
|
+
&& (!("url" in a) || typeof a.url === "string");
|
|
364
|
+
}
|
|
365
|
+
RestAPI.is = is;
|
|
366
|
+
/** Schema validation. */
|
|
367
|
+
RestAPI.Schema = {
|
|
368
|
+
name: { type: "string", required: true },
|
|
369
|
+
path: { type: "string", required: false },
|
|
370
|
+
mime_type: { type: "string", required: false },
|
|
371
|
+
charset: { type: "string", required: false },
|
|
372
|
+
compressed: { type: "boolean", required: false },
|
|
373
|
+
content: { type: "string", required: false },
|
|
374
|
+
encoding: { type: "string", enum: Array.from(Attachment.encodings), required: false },
|
|
375
|
+
url: { type: "string", required: false },
|
|
376
|
+
};
|
|
377
|
+
})(RestAPI = Attachment.RestAPI || (Attachment.RestAPI = {}));
|
|
378
|
+
/** Nested native types. */
|
|
379
|
+
let Native;
|
|
380
|
+
(function (Native) {
|
|
381
|
+
/** Simple type guard. */
|
|
382
|
+
function is(a) {
|
|
383
|
+
return a && typeof a === "object"
|
|
384
|
+
&& ("content" in a || "path" in a || "filename" in a);
|
|
385
|
+
}
|
|
386
|
+
Native.is = is;
|
|
387
|
+
})(Native = Attachment.Native || (Attachment.Native = {}));
|
|
388
|
+
})(Attachment = Mail.Attachment || (Mail.Attachment = {}));
|
|
389
|
+
})(Mail || (Mail = {}));
|
package/{backend/dist/esm/plugins/mail.d.ts → frontend/dist/backend/src/plugins/mail/ui.d.ts}
RENAMED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author Daan van den Bergh
|
|
3
|
+
* @copyright © 2022 - 2025 Daan van den Bergh. All rights reserved
|
|
4
|
+
*/
|
|
5
|
+
type none = undefined | null;
|
|
1
6
|
export declare class Element {
|
|
2
7
|
type: string;
|
|
3
8
|
element_type: string;
|
|
@@ -23,10 +28,27 @@ export declare class Element {
|
|
|
23
28
|
pad_numeric(value: string | number, padding?: string): string;
|
|
24
29
|
html(): string;
|
|
25
30
|
links(links: (string | Record<string, string>)[]): this;
|
|
31
|
+
/**
|
|
32
|
+
* Get or set the background color of the element.
|
|
33
|
+
* @param value The color value to set.
|
|
34
|
+
* @returns The current value when getting, or the element instance when setting.
|
|
35
|
+
* @funcs 3
|
|
36
|
+
* @docs
|
|
37
|
+
*/
|
|
26
38
|
background_color(): string | undefined;
|
|
27
39
|
background_color(value: string): this;
|
|
40
|
+
/**
|
|
41
|
+
* Get or set the display property.
|
|
42
|
+
* @funcs 3
|
|
43
|
+
* @docs
|
|
44
|
+
*/
|
|
28
45
|
display(): string | undefined;
|
|
29
46
|
display(value: string): this;
|
|
47
|
+
/**
|
|
48
|
+
* Get or set the background image.
|
|
49
|
+
* @funcs 3
|
|
50
|
+
* @docs
|
|
51
|
+
*/
|
|
30
52
|
background_image(): string | undefined;
|
|
31
53
|
background_image(value: string): this;
|
|
32
54
|
background_repeat(): string | undefined;
|
|
@@ -275,3 +297,4 @@ export declare class MailElement extends Element {
|
|
|
275
297
|
}
|
|
276
298
|
export declare const Mail: <Extensions extends object = {}>(...args: any[]) => MailElement & Extensions;
|
|
277
299
|
export declare const NullMailElement: <Extensions extends object = {}>() => MailElement & Extensions;
|
|
300
|
+
export {};
|