@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,807 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author Daan van den Bergh
|
|
3
|
+
* @copyright © 2022 - 2025 Daan van den Bergh.
|
|
4
|
+
*/
|
|
5
|
+
import { Mail } from "./plugins/mail/mail.js";
|
|
6
|
+
import { Stream } from "./stream.js";
|
|
7
|
+
import { Server } from "./server.js";
|
|
8
|
+
import { Collection } from "./database/collection.js";
|
|
9
|
+
import { Request } from "../../frontend/src/modules/request.js";
|
|
10
|
+
/** The user object / document. */
|
|
11
|
+
export type User = {
|
|
12
|
+
/** The user identifier (unique index). */
|
|
13
|
+
uid: string;
|
|
14
|
+
/** The users username (unique index). */
|
|
15
|
+
username: string;
|
|
16
|
+
/** The users email address (unique index). */
|
|
17
|
+
email: string;
|
|
18
|
+
/** The users first name. */
|
|
19
|
+
first_name: string;
|
|
20
|
+
/** The users last name. */
|
|
21
|
+
last_name: string;
|
|
22
|
+
/** The hashed password. */
|
|
23
|
+
password: string;
|
|
24
|
+
/** The users phone number. */
|
|
25
|
+
phone_number?: string;
|
|
26
|
+
/** The created at unix msec timestamp. */
|
|
27
|
+
created_at: number;
|
|
28
|
+
/** The hashed api key (only defined once generated) (non unique index). */
|
|
29
|
+
api_key?: string;
|
|
30
|
+
/** The users support pin, used for support contact validation. */
|
|
31
|
+
support_pin: string;
|
|
32
|
+
/** Whether the user is activated. */
|
|
33
|
+
is_activated: boolean;
|
|
34
|
+
};
|
|
35
|
+
/** Nested types for the {@link User} interface */
|
|
36
|
+
export declare namespace User {
|
|
37
|
+
/** The frontend representation of a user. */
|
|
38
|
+
type Frontend = {
|
|
39
|
+
uid: string;
|
|
40
|
+
username: string;
|
|
41
|
+
email: string;
|
|
42
|
+
first_name: string;
|
|
43
|
+
last_name: string;
|
|
44
|
+
phone_number?: string;
|
|
45
|
+
created_at: number;
|
|
46
|
+
has_api_key: boolean;
|
|
47
|
+
support_pin: string;
|
|
48
|
+
is_activated: boolean;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/** The token object / document. */
|
|
52
|
+
export type Token = {
|
|
53
|
+
/** The user id. */
|
|
54
|
+
uid: string;
|
|
55
|
+
/** Expiration unix timestamp */
|
|
56
|
+
expiration: number;
|
|
57
|
+
/** The hashed token. */
|
|
58
|
+
token: string;
|
|
59
|
+
/** Is token still active. */
|
|
60
|
+
active: boolean;
|
|
61
|
+
};
|
|
62
|
+
/** The token object / document. */
|
|
63
|
+
export type TwoFactorAuthToken = {
|
|
64
|
+
/** The user id. */
|
|
65
|
+
uid: string;
|
|
66
|
+
/** Expiration unix timestamp */
|
|
67
|
+
expiration: number;
|
|
68
|
+
/** The correct 2fa code. */
|
|
69
|
+
code: string;
|
|
70
|
+
/** Is token still active. */
|
|
71
|
+
active: boolean;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* The users class, accessible under `Server.users`.
|
|
75
|
+
*/
|
|
76
|
+
export declare class Users {
|
|
77
|
+
/**
|
|
78
|
+
* Number of random characters after `<prefix>_<uid>_`.
|
|
79
|
+
* @warning If you change this, also update:
|
|
80
|
+
* - {@link Users.LEGACY_TOKEN_SUFFIX_LENS} to include old size(s).
|
|
81
|
+
* - Generators {@link _generate_api_key} and {@link _generate_token}.
|
|
82
|
+
* - Parser {@link _parse_uid_from_token_api_key}.
|
|
83
|
+
*/
|
|
84
|
+
private static readonly TOKEN_SUFFIX_LEN;
|
|
85
|
+
/** Accepted legacy suffix lengths; add old sizes here when rotating. */
|
|
86
|
+
private static readonly LEGACY_TOKEN_SUFFIX_LENS;
|
|
87
|
+
/**
|
|
88
|
+
* Allowed characters for the random suffix.
|
|
89
|
+
* @warning MUST NOT include `_` (delimiter). ASCII only for fast-path validation.
|
|
90
|
+
*/
|
|
91
|
+
private static readonly TOKEN_SUFFIX_CHARSET;
|
|
92
|
+
/**
|
|
93
|
+
* UID length used by the generator.
|
|
94
|
+
* @warning If you change this, add the old value to {@link Users.LEGACY_UID_LENGTHS}.
|
|
95
|
+
*/
|
|
96
|
+
private static readonly UID_LENGTH;
|
|
97
|
+
/** Accepted legacy UID lengths; add old sizes here when rotating. */
|
|
98
|
+
private static readonly LEGACY_UID_LENGTHS;
|
|
99
|
+
/**
|
|
100
|
+
* UID character set (ASCII). MUST NOT include `_`.
|
|
101
|
+
*/
|
|
102
|
+
private static readonly UID_CHARSET;
|
|
103
|
+
/**
|
|
104
|
+
* Build an ASCII allow table for fast membership checks.
|
|
105
|
+
* Index is charCode (0..127), value is 1 if allowed else 0.
|
|
106
|
+
*/
|
|
107
|
+
private static _build_ascii_allow;
|
|
108
|
+
/** ASCII allow table for token suffix validation (built from TOKEN_SUFFIX_CHARSET). */
|
|
109
|
+
private static readonly TOKEN_SUFFIX_ALLOW;
|
|
110
|
+
/** ASCII allow table for UID validation (built from UID_CHARSET). */
|
|
111
|
+
private static readonly UID_ALLOW;
|
|
112
|
+
/** The parent server instance. */
|
|
113
|
+
private server;
|
|
114
|
+
/** The recipient email for support submit emails, defaults to `Server.smtp_sender`. */
|
|
115
|
+
private support_recipient?;
|
|
116
|
+
/** The avg wait time when sending 2FA codes. */
|
|
117
|
+
private avg_send_2fa_time;
|
|
118
|
+
/** The database collection for token documents. */
|
|
119
|
+
private _tokens_db;
|
|
120
|
+
/** The database collection for 2fa token documents. */
|
|
121
|
+
private _2fa_tokens_db;
|
|
122
|
+
/** The database collection for user documents. */
|
|
123
|
+
private _users_db;
|
|
124
|
+
/** Enable 2FA for user sign in. */
|
|
125
|
+
private enable_2fa;
|
|
126
|
+
/** Enable 2FA account activation for user sign up. */
|
|
127
|
+
private enable_account_activation;
|
|
128
|
+
/** The token expiration in seconds */
|
|
129
|
+
private token_expiration;
|
|
130
|
+
/** Database collection for public (read:public, write:public) user documents. */
|
|
131
|
+
public: Collection<{
|
|
132
|
+
uid: string;
|
|
133
|
+
query?: string;
|
|
134
|
+
data: Users.Endpoints.JsonValue;
|
|
135
|
+
}>;
|
|
136
|
+
/** Database collection for protected (read:public, write:private) user documents. */
|
|
137
|
+
protected: Collection<{
|
|
138
|
+
uid: string;
|
|
139
|
+
query?: string;
|
|
140
|
+
data: Users.Endpoints.JsonValue;
|
|
141
|
+
}>;
|
|
142
|
+
/** Database collection for private (read:private, write:private) user documents. */
|
|
143
|
+
private: Collection<{
|
|
144
|
+
uid: string;
|
|
145
|
+
query?: string;
|
|
146
|
+
data: Users.Endpoints.JsonValue;
|
|
147
|
+
}>;
|
|
148
|
+
/** Construct the server. */
|
|
149
|
+
constructor(opts: Users.Opts & {
|
|
150
|
+
_server: Server;
|
|
151
|
+
});
|
|
152
|
+
/** Generate a code. */
|
|
153
|
+
private _generate_code;
|
|
154
|
+
/**
|
|
155
|
+
* Generate a crypto str.
|
|
156
|
+
* @warning ENSURE this does not add `_` to the charset, as this is used as a delimiter for tokens/api keys.
|
|
157
|
+
*/
|
|
158
|
+
private _generate_crypto_str;
|
|
159
|
+
/**
|
|
160
|
+
* Derive a key with the async `crypto.scrypt` to avoid blocking the event loop.
|
|
161
|
+
* Using the sync variant is CPU-bound and can stall Node’s main thread, enabling
|
|
162
|
+
* trivial DoS via many concurrent hash ops. The async call runs in libuv’s
|
|
163
|
+
* thread pool, preserving responsiveness under load with the same security.
|
|
164
|
+
*
|
|
165
|
+
* @param password - Secret/password or input buffer.
|
|
166
|
+
* @param salt - Per-secret random salt.
|
|
167
|
+
* @param keylen - Desired key length in bytes (default 64).
|
|
168
|
+
* @returns Promise resolving to the derived key buffer.
|
|
169
|
+
*/
|
|
170
|
+
private _crypto_scrypt;
|
|
171
|
+
/** Hash a password. */
|
|
172
|
+
private _hash_password;
|
|
173
|
+
/** Verify a plain password vs stored hashed password. */
|
|
174
|
+
private _verify_password;
|
|
175
|
+
/** Generate a unique user ID. */
|
|
176
|
+
private _generate_uid;
|
|
177
|
+
/** Generate an API key. Format: `ak_<uid>_<suffix>` */
|
|
178
|
+
private _generate_api_key;
|
|
179
|
+
/** Generate a token. Format: `tk_<uid>_<suffix>` */
|
|
180
|
+
private _generate_token;
|
|
181
|
+
/**
|
|
182
|
+
* Parse the uid from `<prefix>_<uid>_<suffix>`, where prefix is `ak_` or `tk_`,
|
|
183
|
+
* `<uid>` passes {@link Users.is_valid_uid}, and `<suffix>`:
|
|
184
|
+
* - length equals {@link Users.TOKEN_SUFFIX_LEN} or a legacy size; and
|
|
185
|
+
* - every char is in {@link Users.TOKEN_SUFFIX_CHARSET} (ASCII).
|
|
186
|
+
*
|
|
187
|
+
* @warning If you change suffix length, add old sizes to
|
|
188
|
+
* {@link Users.LEGACY_TOKEN_SUFFIX_LENS}. If you change charset, update
|
|
189
|
+
* {@link Users.TOKEN_SUFFIX_CHARSET} (this table rebuilds automatically).
|
|
190
|
+
* If you change delimiters/prefixes, update this and the generators together.
|
|
191
|
+
*/
|
|
192
|
+
private _parse_uid_from_token_api_key;
|
|
193
|
+
/**
|
|
194
|
+
* Validate a proposed new password against basic rules and confirmation.
|
|
195
|
+
* @param pass The new password to validate.
|
|
196
|
+
* @param verify_pass The repeated password to confirm.
|
|
197
|
+
* @returns An object with optional error message and invalid_fields mapping.
|
|
198
|
+
*/
|
|
199
|
+
private _verify_new_pass;
|
|
200
|
+
/**
|
|
201
|
+
* Generate and persist a new auth token for the given uid.
|
|
202
|
+
* @param uid The user ID.
|
|
203
|
+
* @returns The plaintext token string.
|
|
204
|
+
*/
|
|
205
|
+
_create_token(uid: string): Promise<string>;
|
|
206
|
+
/**
|
|
207
|
+
* Deactivate the current token for the given uid.
|
|
208
|
+
* @param uid The user ID.
|
|
209
|
+
*/
|
|
210
|
+
_deactivate_token(uid: string): Promise<void>;
|
|
211
|
+
/**
|
|
212
|
+
* Create and store a short-lived 2FA token (code).
|
|
213
|
+
* @param uid_or_email The uid or email key used for the 2FA record.
|
|
214
|
+
* @param expiration Expiration in seconds from now.
|
|
215
|
+
* @returns The generated 2FA code.
|
|
216
|
+
*/
|
|
217
|
+
_create_2fa_token(uid_or_email: string, expiration: number): Promise<string>;
|
|
218
|
+
/**
|
|
219
|
+
* Deactivate a stored 2FA token by uid/email key.
|
|
220
|
+
* @param uid_or_email The uid or email key used for the 2FA record.
|
|
221
|
+
*/
|
|
222
|
+
_deactivate_2fa_token(uid_or_email: string): Promise<void>;
|
|
223
|
+
/**
|
|
224
|
+
* Perform authentication on a request.
|
|
225
|
+
* @returns An object on refusal, undefined on success.
|
|
226
|
+
*/
|
|
227
|
+
_authenticate(stream: Stream): Promise<{
|
|
228
|
+
status: number;
|
|
229
|
+
headers?: {
|
|
230
|
+
[key: string]: string;
|
|
231
|
+
};
|
|
232
|
+
data: string;
|
|
233
|
+
} | undefined>;
|
|
234
|
+
/**
|
|
235
|
+
* Sign a user in, set cookies, and optionally send the success response.
|
|
236
|
+
* @param stream The request stream.
|
|
237
|
+
* @param uid The authenticated user's ID.
|
|
238
|
+
* @param opts Optional settings (e.g., send: false to skip sending the response).
|
|
239
|
+
*/
|
|
240
|
+
_sign_in_response(stream: Stream, uid: string, opts?: {
|
|
241
|
+
/** Send the response (defaults to true). */
|
|
242
|
+
send: boolean;
|
|
243
|
+
}): Promise<void>;
|
|
244
|
+
/**
|
|
245
|
+
* Create the auth token cookie on the response.
|
|
246
|
+
* @param stream The request stream.
|
|
247
|
+
* @param token The token string or Token object.
|
|
248
|
+
*/
|
|
249
|
+
_create_token_cookie(stream: Stream, token: string | Token): void;
|
|
250
|
+
/**
|
|
251
|
+
* Create user cookies (id and activation flag).
|
|
252
|
+
* @param stream The request stream.
|
|
253
|
+
* @param uid The user ID, or invalid to clear.
|
|
254
|
+
*/
|
|
255
|
+
_create_user_cookie(stream: Stream, uid: string): Promise<void>;
|
|
256
|
+
/**
|
|
257
|
+
* Create non-HTTP-only cookies with detailed user info for the frontend.
|
|
258
|
+
* @param stream The request stream.
|
|
259
|
+
* @param uid The user ID.
|
|
260
|
+
*/
|
|
261
|
+
_create_detailed_user_cookie(stream: Stream, uid: string): Promise<void>;
|
|
262
|
+
/**
|
|
263
|
+
* Clear all default auth/user cookies.
|
|
264
|
+
* @param stream The request stream.
|
|
265
|
+
*/
|
|
266
|
+
_reset_cookies(stream: Stream): void;
|
|
267
|
+
/**
|
|
268
|
+
* Initialize default authentication, user, and support endpoints.
|
|
269
|
+
*/
|
|
270
|
+
_initialize(): Promise<void>;
|
|
271
|
+
/**
|
|
272
|
+
* DEVELOPMENT:
|
|
273
|
+
* @warning
|
|
274
|
+
* If you change {@link Users.UID_CHARSET} or {@link Users.UID_LENGTH},
|
|
275
|
+
* update {@link Users.LEGACY_UID_LENGTHS} for backward compatibility.
|
|
276
|
+
*/
|
|
277
|
+
/**
|
|
278
|
+
* Validate a UID against ASCII charset and allowed lengths (current + legacy).
|
|
279
|
+
*/
|
|
280
|
+
is_valid_uid(uid: string): boolean;
|
|
281
|
+
/**
|
|
282
|
+
* Check if a uid exists.
|
|
283
|
+
* @param uid The user ID to check.
|
|
284
|
+
* @returns True if a user with the given uid exists.
|
|
285
|
+
*/
|
|
286
|
+
uid_exists(uid: string): Promise<boolean>;
|
|
287
|
+
/**
|
|
288
|
+
* Check if a username exists.
|
|
289
|
+
* @returns Returns a boolean indicating whether the username exists or not.
|
|
290
|
+
* @param username The username to check.
|
|
291
|
+
* @example
|
|
292
|
+
* const exists = await server.users.username_exists("someusername");
|
|
293
|
+
*/
|
|
294
|
+
username_exists(username: string): Promise<boolean>;
|
|
295
|
+
/**
|
|
296
|
+
* Check if an email exists.
|
|
297
|
+
* @returns Returns a boolean indicating whether the email exists or not.
|
|
298
|
+
* @param email The email to check.
|
|
299
|
+
* @example
|
|
300
|
+
* const exists = await server.users.email_exists("some@email.com");
|
|
301
|
+
*/
|
|
302
|
+
email_exists(email: string): Promise<boolean>;
|
|
303
|
+
/**
|
|
304
|
+
* Check if a user account is activated.
|
|
305
|
+
* @returns Returns a boolean indicating whether the account is activated or not.
|
|
306
|
+
* @param uid The id of the user.
|
|
307
|
+
* @example
|
|
308
|
+
* const activated = await server.users.is_activated("0");
|
|
309
|
+
*/
|
|
310
|
+
is_activated(uid: string): Promise<boolean>;
|
|
311
|
+
/**
|
|
312
|
+
* Set the activated status of a user account.
|
|
313
|
+
* @param uid The user id.
|
|
314
|
+
* @param is_activated The boolean with the new activated status.
|
|
315
|
+
* @example
|
|
316
|
+
* await server.users.set_activated("1", true);
|
|
317
|
+
*/
|
|
318
|
+
set_activated(uid: string, is_activated: boolean): Promise<void>;
|
|
319
|
+
/**
|
|
320
|
+
* Create a user account. Only the hashed password will be saved.
|
|
321
|
+
* @returns Returns the uid of the newly created user.
|
|
322
|
+
* @param first_name The user's first name.
|
|
323
|
+
* @param last_name The user's last name.
|
|
324
|
+
* @param username The username of the new account.
|
|
325
|
+
* @param email The email of the new account.
|
|
326
|
+
* @param password The password of the new account.
|
|
327
|
+
* @param phone_number The phone number of the user account.
|
|
328
|
+
* @param is_activated Whether the account should be set to activated; by default `!Server.enable_account_activation`.
|
|
329
|
+
* @example
|
|
330
|
+
* const uid = await server.users.create({
|
|
331
|
+
* first_name: "John",
|
|
332
|
+
* last_name: "Doe",
|
|
333
|
+
* username: "johndoe",
|
|
334
|
+
* email: "johndoe@email.com",
|
|
335
|
+
* password: "HelloWorld!"
|
|
336
|
+
* });
|
|
337
|
+
*/
|
|
338
|
+
create({ first_name, last_name, username, email, password, phone_number, is_activated, _check_username_email, }: {
|
|
339
|
+
first_name: string;
|
|
340
|
+
last_name: string;
|
|
341
|
+
username: string;
|
|
342
|
+
email: string;
|
|
343
|
+
password: string;
|
|
344
|
+
phone_number?: string;
|
|
345
|
+
is_activated?: boolean;
|
|
346
|
+
_check_username_email?: boolean;
|
|
347
|
+
}): Promise<string>;
|
|
348
|
+
/**
|
|
349
|
+
* Delete a user account and associated data.
|
|
350
|
+
* @param uid The user id.
|
|
351
|
+
* @example
|
|
352
|
+
* await server.users.delete("0");
|
|
353
|
+
*/
|
|
354
|
+
delete(uid: string): Promise<void>;
|
|
355
|
+
/**
|
|
356
|
+
* Set a user's first name. Throws if uid does not exist.
|
|
357
|
+
* @param uid The user id.
|
|
358
|
+
* @param first_name The new first name.
|
|
359
|
+
* @example
|
|
360
|
+
* await server.users.set_first_name("1", "John");
|
|
361
|
+
*/
|
|
362
|
+
set_first_name(uid: string, first_name: string): Promise<void>;
|
|
363
|
+
/**
|
|
364
|
+
* Set a user's last name. Throws if uid does not exist.
|
|
365
|
+
* @param uid The user id.
|
|
366
|
+
* @param last_name The new last name.
|
|
367
|
+
* @example
|
|
368
|
+
* await server.users.set_last_name("1", "Doe");
|
|
369
|
+
*/
|
|
370
|
+
set_last_name(uid: string, last_name: string): Promise<void>;
|
|
371
|
+
/**
|
|
372
|
+
* Set a user's username. Throws if uid does not exist.
|
|
373
|
+
* @param uid The user id.
|
|
374
|
+
* @param username The new username.
|
|
375
|
+
* @example
|
|
376
|
+
* await server.users.set_username("1", "newusername");
|
|
377
|
+
*/
|
|
378
|
+
set_username(uid: string, username: string): Promise<void>;
|
|
379
|
+
/**
|
|
380
|
+
* Set a user's email. Throws if uid does not exist.
|
|
381
|
+
* @param uid The user id.
|
|
382
|
+
* @param email The new email.
|
|
383
|
+
* @example
|
|
384
|
+
* await server.users.set_email("1", "new@email.com");
|
|
385
|
+
*/
|
|
386
|
+
set_email(uid: string, email: string): Promise<void>;
|
|
387
|
+
/**
|
|
388
|
+
* Set a user's password. Throws on invalid input or unknown uid.
|
|
389
|
+
* @param uid The user id.
|
|
390
|
+
* @param password The new password.
|
|
391
|
+
* @example
|
|
392
|
+
* await server.users.set_password("1", "XXXXXX");
|
|
393
|
+
*/
|
|
394
|
+
set_password(uid: string, password: string, verify_password?: string): Promise<void>;
|
|
395
|
+
/**
|
|
396
|
+
* Update an existing user object.
|
|
397
|
+
*
|
|
398
|
+
* This function only updates the passed user attributes, unpresent attributes will not be deleted.
|
|
399
|
+
*
|
|
400
|
+
* If the uid does not exist an `Error` will be thrown.
|
|
401
|
+
*
|
|
402
|
+
* A password will automatically be hashed if passed.
|
|
403
|
+
*
|
|
404
|
+
* Updating the API key through this function is not allowed (wont work).
|
|
405
|
+
*
|
|
406
|
+
* @warning Does not upsert documents.
|
|
407
|
+
*/
|
|
408
|
+
set(uid: string, data: {
|
|
409
|
+
first_name?: User["first_name"];
|
|
410
|
+
last_name?: User["last_name"];
|
|
411
|
+
phone_number?: User["phone_number"];
|
|
412
|
+
is_activated?: User["is_activated"];
|
|
413
|
+
password?: User["password"];
|
|
414
|
+
username?: User["username"];
|
|
415
|
+
email?: User["email"];
|
|
416
|
+
}): Promise<void>;
|
|
417
|
+
/**
|
|
418
|
+
* Insert new data into an EXISTING user.
|
|
419
|
+
* @warning Does not upsert documents.
|
|
420
|
+
*/
|
|
421
|
+
private _sys_set;
|
|
422
|
+
/**
|
|
423
|
+
* Get a user by uid. Throws if the uid does not exist.
|
|
424
|
+
* @returns Returns a User object.
|
|
425
|
+
* @param uid The user id.
|
|
426
|
+
* @throws {Collection.NotFoundError} If the user id does not exist.
|
|
427
|
+
* @example
|
|
428
|
+
* const user = await server.users.get("0");
|
|
429
|
+
*/
|
|
430
|
+
get(uid: string): Promise<User>;
|
|
431
|
+
/**
|
|
432
|
+
* Get a user by username. Throws if the username does not exist.
|
|
433
|
+
* @returns Returns a User object.
|
|
434
|
+
* @param username The username of the user to fetch.
|
|
435
|
+
* @throws {Collection.NotFoundError} If the username does not exist.
|
|
436
|
+
* @example
|
|
437
|
+
* const user = await server.users.get_by_username("myusername");
|
|
438
|
+
*/
|
|
439
|
+
get_by_username(username: string): Promise<User>;
|
|
440
|
+
/**
|
|
441
|
+
* Get a user by email. Throws if the email does not exist.
|
|
442
|
+
* @returns Returns a User object.
|
|
443
|
+
* @param email The email of the user to fetch.
|
|
444
|
+
* @throws {Collection.NotFoundError} If the email does not exist.
|
|
445
|
+
* @example
|
|
446
|
+
* const user = await server.users.get_by_email("my@email.com");
|
|
447
|
+
*/
|
|
448
|
+
get_by_email(email: string): Promise<User>;
|
|
449
|
+
/**
|
|
450
|
+
* Get a user by API key. Throws if invalid.
|
|
451
|
+
* @returns Returns a User object.
|
|
452
|
+
* @param api_key The API key of the user to fetch.
|
|
453
|
+
* @example
|
|
454
|
+
* const user = await server.users.get_by_api_key("XXXXXX");
|
|
455
|
+
*/
|
|
456
|
+
get_by_api_key(api_key: string): Promise<User>;
|
|
457
|
+
/**
|
|
458
|
+
* Get a user by token. Throws if invalid.
|
|
459
|
+
* @returns Returns a User object.
|
|
460
|
+
* @param token The authentication token of the user to fetch.
|
|
461
|
+
* @example
|
|
462
|
+
* const user = await server.users.get_by_token("XXXXXX");
|
|
463
|
+
*/
|
|
464
|
+
get_by_token(token: string): Promise<User>;
|
|
465
|
+
/**
|
|
466
|
+
* Get a uid by username.
|
|
467
|
+
* @returns Returns the uid of the username, or undefined if not found.
|
|
468
|
+
* @param username The username of the uid to fetch.
|
|
469
|
+
* @example
|
|
470
|
+
* const uid = await server.users.get_uid("myusername");
|
|
471
|
+
*/
|
|
472
|
+
get_uid(username: string): Promise<string | undefined>;
|
|
473
|
+
/**
|
|
474
|
+
* Get a uid by username.
|
|
475
|
+
* @returns Returns the uid of the username, or undefined if not found.
|
|
476
|
+
* @param username The username of the uid to fetch.
|
|
477
|
+
* @example
|
|
478
|
+
* const uid = await server.users.get_uid_by_username("myuser");
|
|
479
|
+
*/
|
|
480
|
+
get_uid_by_username(username: string): Promise<string | undefined>;
|
|
481
|
+
/**
|
|
482
|
+
* Get a uid by email.
|
|
483
|
+
* @returns Returns the uid of the email, or undefined if not found.
|
|
484
|
+
* @param email The email of the uid to fetch.
|
|
485
|
+
* @example
|
|
486
|
+
* const uid = await server.users.get_uid_by_email("my@email.com");
|
|
487
|
+
*/
|
|
488
|
+
get_uid_by_email(email: string): Promise<string | undefined>;
|
|
489
|
+
/**
|
|
490
|
+
* Get a uid by API key.
|
|
491
|
+
* @returns Returns the uid for the API key, or undefined if not valid.
|
|
492
|
+
* @param api_key The API key to parse.
|
|
493
|
+
* @example
|
|
494
|
+
* const uid = server.users.get_uid_by_api_key("XXXXXXXXXX");
|
|
495
|
+
*/
|
|
496
|
+
get_uid_by_api_key(api_key: string): string | undefined;
|
|
497
|
+
/**
|
|
498
|
+
* Get a uid by token.
|
|
499
|
+
* @returns Returns the uid for the token, or undefined if not valid.
|
|
500
|
+
* @param token The token to parse.
|
|
501
|
+
* @example
|
|
502
|
+
* const uid = server.users.get_uid_by_token("XXXXXXXXXX");
|
|
503
|
+
*/
|
|
504
|
+
get_uid_by_token(token: string): string | undefined;
|
|
505
|
+
/**
|
|
506
|
+
* Get a user's support pin by uid.
|
|
507
|
+
* @returns Returns the support PIN string.
|
|
508
|
+
* @param uid The user id.
|
|
509
|
+
* @example
|
|
510
|
+
* const pin = await server.users.get_support_pin("1");
|
|
511
|
+
*/
|
|
512
|
+
get_support_pin(uid: string): Promise<string>;
|
|
513
|
+
/**
|
|
514
|
+
* Generate an API key for a user and store its hash. Overwrites existing keys.
|
|
515
|
+
* @returns Returns the API key string (plaintext).
|
|
516
|
+
* @param uid The user id.
|
|
517
|
+
* @example
|
|
518
|
+
* const api_key = await server.users.generate_api_key("0");
|
|
519
|
+
*/
|
|
520
|
+
generate_api_key(uid: string): Promise<string>;
|
|
521
|
+
/**
|
|
522
|
+
* Check if a user has a generated API key.
|
|
523
|
+
* @returns Returns a boolean indicating whether the user has an API key.
|
|
524
|
+
* @param uid The user id.
|
|
525
|
+
* @throws {Collection.NotFoundError} If the user id does not exist.
|
|
526
|
+
* @example
|
|
527
|
+
* const has_api_key = await server.users.has_api_key("0");
|
|
528
|
+
*/
|
|
529
|
+
has_api_key(uid: string): Promise<boolean>;
|
|
530
|
+
/**
|
|
531
|
+
* Revoke the API key of a user.
|
|
532
|
+
* @param uid The user id.
|
|
533
|
+
* @example
|
|
534
|
+
* await server.users.revoke_api_key("0");
|
|
535
|
+
*/
|
|
536
|
+
revoke_api_key(uid: string): Promise<void>;
|
|
537
|
+
/**
|
|
538
|
+
* Verify a plaintext password.
|
|
539
|
+
* @returns Returns a boolean indicating whether the verification was successful.
|
|
540
|
+
* @param uid The user id.
|
|
541
|
+
* @param password The plaintext password.
|
|
542
|
+
* @example
|
|
543
|
+
* const success = await server.users.verify_password("1", "XXXXXX");
|
|
544
|
+
*/
|
|
545
|
+
verify_password(uid: string, password: string): Promise<boolean>;
|
|
546
|
+
/**
|
|
547
|
+
* Verify a plaintext API key.
|
|
548
|
+
* @returns Returns a boolean indicating whether the verification was successful.
|
|
549
|
+
* @param api_key The api key to verify.
|
|
550
|
+
* @example
|
|
551
|
+
* const success = await server.users.verify_api_key("XXXXXX");
|
|
552
|
+
*/
|
|
553
|
+
verify_api_key(api_key: string): Promise<boolean>;
|
|
554
|
+
/**
|
|
555
|
+
* Verify a plaintext API key by uid.
|
|
556
|
+
* @returns Returns a boolean indicating whether the verification was successful.
|
|
557
|
+
* @param uid The user id.
|
|
558
|
+
* @param api_key The api key to verify.
|
|
559
|
+
* @example
|
|
560
|
+
* const success = await server.users.verify_api_key_by_uid("1", "XXXXXX");
|
|
561
|
+
*/
|
|
562
|
+
verify_api_key_by_uid(uid: string | undefined | null, api_key: string): Promise<boolean>;
|
|
563
|
+
/**
|
|
564
|
+
* Verify a plaintext token.
|
|
565
|
+
* @returns Returns a boolean indicating whether the verification was successful.
|
|
566
|
+
* @param token The token to verify.
|
|
567
|
+
* @example
|
|
568
|
+
* const success = await server.users.verify_token("XXXXXX");
|
|
569
|
+
*/
|
|
570
|
+
verify_token(token: string): Promise<boolean>;
|
|
571
|
+
/**
|
|
572
|
+
* Verify a plaintext token by uid.
|
|
573
|
+
* @returns Returns a boolean indicating whether the verification was successful.
|
|
574
|
+
* @param uid The user id.
|
|
575
|
+
* @param token The token to verify.
|
|
576
|
+
* @example
|
|
577
|
+
* const success = await server.users.verify_token_by_uid("1", "XXXXXX");
|
|
578
|
+
*/
|
|
579
|
+
verify_token_by_uid(uid: string | undefined | null, token: string): Promise<boolean>;
|
|
580
|
+
/**
|
|
581
|
+
* Verify a 2FA code by user id/email key.
|
|
582
|
+
* @param uid The UID or email used when creating the 2FA token.
|
|
583
|
+
* @param code The 2FA code.
|
|
584
|
+
* @returns Returns undefined on success, otherwise a string describing the error.
|
|
585
|
+
* @example
|
|
586
|
+
* await server.users.verify_2fa("1", "123456");
|
|
587
|
+
*/
|
|
588
|
+
verify_2fa(uid: string, code: string): Promise<string | undefined>;
|
|
589
|
+
/**
|
|
590
|
+
* Send a 2FA code to a user by user id.
|
|
591
|
+
* By default the 2FA code will be valid for 5 minutes.
|
|
592
|
+
* The mail body is generated via `Server.on_2fa_mail({code, username, email, date, ip, device})`.
|
|
593
|
+
* @returns Returns a promise that resolves when the 2FA mail has been sent.
|
|
594
|
+
* @param uid The user id (or use _email with internal flow).
|
|
595
|
+
* @param stream The stream object from the client request.
|
|
596
|
+
* @param expiration The amount of seconds in which the code will expire.
|
|
597
|
+
* @example
|
|
598
|
+
* await server.users.send_2fa({ uid: "0", stream });
|
|
599
|
+
*/
|
|
600
|
+
send_2fa({ uid, stream, expiration, _user_agent, _username, _email, }: {
|
|
601
|
+
uid: string;
|
|
602
|
+
stream: Stream;
|
|
603
|
+
expiration?: number;
|
|
604
|
+
_user_agent?: string;
|
|
605
|
+
_username?: string;
|
|
606
|
+
_email?: string;
|
|
607
|
+
}): Promise<void>;
|
|
608
|
+
/**
|
|
609
|
+
* List all users.
|
|
610
|
+
* @returns An array of User objects.
|
|
611
|
+
*/
|
|
612
|
+
list(): Promise<User[]>;
|
|
613
|
+
}
|
|
614
|
+
/** Nested types for the {@link User} class. */
|
|
615
|
+
export declare namespace Users {
|
|
616
|
+
/** Constructor options. */
|
|
617
|
+
interface Opts {
|
|
618
|
+
/** The number of seconds a sign-in token will be valid. */
|
|
619
|
+
token_expiration?: number;
|
|
620
|
+
/** Enable 2FA for user authentication. */
|
|
621
|
+
enable_2fa?: boolean;
|
|
622
|
+
/** Enable account activation by email after a user signs up. */
|
|
623
|
+
enable_account_activation?: boolean;
|
|
624
|
+
/** The email address to send support requests to, defaults to {@link Server.Opts.smtp.sender} if defined */
|
|
625
|
+
support_recipient?: Mail.Address;
|
|
626
|
+
}
|
|
627
|
+
/** The types for the frontend endpoints. */
|
|
628
|
+
namespace Endpoints {
|
|
629
|
+
/** The get user endpoint. */
|
|
630
|
+
type GetUser = Request.Info<"GET", "/volt/api/v1/user", undefined, User.Frontend, undefined>;
|
|
631
|
+
/** The update user endpoint. */
|
|
632
|
+
type UpdateUser = Request.Info<"POST", "/volt/api/v1/user", {
|
|
633
|
+
first_name?: string;
|
|
634
|
+
last_name?: string;
|
|
635
|
+
phone_number?: string;
|
|
636
|
+
username?: string;
|
|
637
|
+
email?: string;
|
|
638
|
+
}, {
|
|
639
|
+
message: string;
|
|
640
|
+
}, undefined>;
|
|
641
|
+
/** The activate user endpoint. */
|
|
642
|
+
type ActivateUser = Request.Info<"POST", "/volt/api/v1/auth/activate", {
|
|
643
|
+
code: string;
|
|
644
|
+
}, {
|
|
645
|
+
message: string;
|
|
646
|
+
}, undefined>;
|
|
647
|
+
/** The change password endpoint. */
|
|
648
|
+
type ChangePassword = Request.Info<"POST", "/volt/api/v1/user/change_password", {
|
|
649
|
+
current_password: string;
|
|
650
|
+
password: string;
|
|
651
|
+
verify_password: string;
|
|
652
|
+
}, {
|
|
653
|
+
message: string;
|
|
654
|
+
}, undefined>;
|
|
655
|
+
/** The delete user endpoint. */
|
|
656
|
+
type DeleteUser = Request.Info<"DELETE", "/volt/api/v1/user", undefined, {
|
|
657
|
+
message: string;
|
|
658
|
+
}, undefined>;
|
|
659
|
+
/** The generate api key endpoint. */
|
|
660
|
+
type GenerateAPIKey = Request.Info<"POST", "/volt/api/v1/user/api_key", undefined, {
|
|
661
|
+
message: string;
|
|
662
|
+
api_key: string;
|
|
663
|
+
}, undefined>;
|
|
664
|
+
/** The has api key endpoint. */
|
|
665
|
+
type HasAPIKey = Request.Info<"GET", "/volt/api/v1/user/has_api_key", undefined, {
|
|
666
|
+
message: string;
|
|
667
|
+
has_api_key: boolean;
|
|
668
|
+
}, undefined>;
|
|
669
|
+
/** The revoke api key endpoint. */
|
|
670
|
+
type RevokeAPIKey = Request.Info<"DELETE", "/volt/api/v1/user/api_key", undefined, {
|
|
671
|
+
message: string;
|
|
672
|
+
}, undefined>;
|
|
673
|
+
/** JSON values for LoadUserData data field etc. */
|
|
674
|
+
type JsonValue = string | number | boolean | null | JsonArray | JsonObject;
|
|
675
|
+
type JsonArray = Array<JsonValue>;
|
|
676
|
+
type JsonObject = {
|
|
677
|
+
[key: string]: JsonValue;
|
|
678
|
+
};
|
|
679
|
+
const JsonValueSchemaType: readonly ["string", "number", "boolean", "null", "array", "object"];
|
|
680
|
+
/** The load public user data endpoint. */
|
|
681
|
+
type LoadUserData = Request.Info<"GET", "/volt/api/v1/user/data", {
|
|
682
|
+
/**
|
|
683
|
+
* The document query.
|
|
684
|
+
* @note The object form query may not include system
|
|
685
|
+
* reserved fields `_id`, `uid`, `query` and `data`.
|
|
686
|
+
*/
|
|
687
|
+
query: string | Record<string, any>;
|
|
688
|
+
/**
|
|
689
|
+
* The default value for document field `data`,
|
|
690
|
+
* see {@link Collection.LoadOpts.default}.
|
|
691
|
+
*/
|
|
692
|
+
default?: JsonValue;
|
|
693
|
+
}, {
|
|
694
|
+
message: string;
|
|
695
|
+
data: JsonValue;
|
|
696
|
+
}, undefined>;
|
|
697
|
+
/** The set public user data endpoint. */
|
|
698
|
+
type SetUserData = Request.Info<"POST", "/volt/api/v1/user/data", {
|
|
699
|
+
/**
|
|
700
|
+
* The document query.
|
|
701
|
+
* @note The object form query may not include system
|
|
702
|
+
* reserved fields `_id`, `uid`, `query` and `data`.
|
|
703
|
+
*/
|
|
704
|
+
query: string | Record<string, any>;
|
|
705
|
+
/** The data to save. */
|
|
706
|
+
data: JsonValue;
|
|
707
|
+
}, {
|
|
708
|
+
message: string;
|
|
709
|
+
}, undefined>;
|
|
710
|
+
/** The delete public user data endpoint. */
|
|
711
|
+
type DeleteUserData = Request.Info<"DELETE", "/volt/api/v1/user/data", {
|
|
712
|
+
/**
|
|
713
|
+
* The document query.
|
|
714
|
+
* @note The object form query may not include system
|
|
715
|
+
* reserved fields `_id`, `uid`, `query` and `data`.
|
|
716
|
+
*/
|
|
717
|
+
query: string | Record<string, any>;
|
|
718
|
+
/** The data to save. */
|
|
719
|
+
data: JsonValue;
|
|
720
|
+
}, {
|
|
721
|
+
message: string;
|
|
722
|
+
}, undefined>;
|
|
723
|
+
/** The load protected user data endpoint. */
|
|
724
|
+
type LoadProtectedUserData = Request.Info<"GET", "/volt/api/v1/user/data/protected", {
|
|
725
|
+
/**
|
|
726
|
+
* The document query.
|
|
727
|
+
* @note The object form query may not include system
|
|
728
|
+
* reserved fields `_id`, `uid`, `query` and `data`.
|
|
729
|
+
*/
|
|
730
|
+
query: string | Record<string, any>;
|
|
731
|
+
/** The default value for document field `data`. */
|
|
732
|
+
default?: JsonValue;
|
|
733
|
+
}, {
|
|
734
|
+
message: string;
|
|
735
|
+
data: JsonValue;
|
|
736
|
+
}, undefined>;
|
|
737
|
+
/** The sign in endpoint. */
|
|
738
|
+
type SignIn = Request.Info<"POST", "/volt/api/v1/auth/signin", {
|
|
739
|
+
username: string;
|
|
740
|
+
email: string;
|
|
741
|
+
password: string;
|
|
742
|
+
code?: string;
|
|
743
|
+
}, {
|
|
744
|
+
message: string;
|
|
745
|
+
}, undefined>;
|
|
746
|
+
/** The sign up endpoint. */
|
|
747
|
+
type SignUp = Request.Info<"POST", "/volt/api/v1/auth/signup", {
|
|
748
|
+
username: string;
|
|
749
|
+
email: string;
|
|
750
|
+
first_name: string;
|
|
751
|
+
last_name: string;
|
|
752
|
+
password: string;
|
|
753
|
+
verify_password: string;
|
|
754
|
+
phone_number?: string;
|
|
755
|
+
code?: string;
|
|
756
|
+
}, {
|
|
757
|
+
message: string;
|
|
758
|
+
}, undefined>;
|
|
759
|
+
/** The sign out endpoint. */
|
|
760
|
+
type SignOut = Request.Info<"POST", "/volt/api/v1/auth/signout", undefined, {
|
|
761
|
+
message: string;
|
|
762
|
+
}, undefined>;
|
|
763
|
+
/** The send 2fa endpoint. */
|
|
764
|
+
type Send2FA = Request.Info<"POST", "/volt/api/v1/auth/2fa", {
|
|
765
|
+
email: string;
|
|
766
|
+
}, {
|
|
767
|
+
message: string;
|
|
768
|
+
}, undefined>;
|
|
769
|
+
/** The send forgot password endpoint. */
|
|
770
|
+
type ForgotPassword = Request.Info<"POST", "/volt/api/v1/auth/forgot_password", {
|
|
771
|
+
email: string;
|
|
772
|
+
password: string;
|
|
773
|
+
verify_password: string;
|
|
774
|
+
code: string;
|
|
775
|
+
}, {
|
|
776
|
+
message: string;
|
|
777
|
+
}, undefined>;
|
|
778
|
+
/** The submit support endpoint. */
|
|
779
|
+
type SubmitSupport = Request.Info<"POST", "/volt/api/v1/support/submit", {
|
|
780
|
+
/** The support subject. */
|
|
781
|
+
subject?: string;
|
|
782
|
+
/** The support type for internal purpose only. */
|
|
783
|
+
type?: string;
|
|
784
|
+
/** The user's support pin. This parameter will automatically be assigned when the user is authenticated. */
|
|
785
|
+
support_pin?: string;
|
|
786
|
+
/** The user's email. This parameter will automatically be assigned when the user is authenticated. */
|
|
787
|
+
email?: string;
|
|
788
|
+
/** The user's first name. This parameter will automatically be assigned when the user is authenticated. */
|
|
789
|
+
first_name?: string;
|
|
790
|
+
/** The user's last name. This parameter will automatically be assigned when the user is authenticated. */
|
|
791
|
+
last_name?: string;
|
|
792
|
+
/** A summary of the support request. */
|
|
793
|
+
summary: string;
|
|
794
|
+
/** A detailed description of the support request. */
|
|
795
|
+
detailed?: string;
|
|
796
|
+
/** An object with attachments, assigned as `{file_name: raw_file_data}`. */
|
|
797
|
+
attachments?: Mail.Attachment.RestAPI[];
|
|
798
|
+
}, {
|
|
799
|
+
message: string;
|
|
800
|
+
}, undefined>;
|
|
801
|
+
/** The get support pin endpoint. */
|
|
802
|
+
type GetSupportPin = Request.Info<"GET", "/volt/api/v1/support/pin", undefined, {
|
|
803
|
+
message: string;
|
|
804
|
+
pin: string;
|
|
805
|
+
}, undefined>;
|
|
806
|
+
}
|
|
807
|
+
}
|