@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.
Files changed (502) hide show
  1. package/backend/dist/cjs/{blacklist.d.ts → backend/src/blacklist.d.ts} +5 -3
  2. package/backend/dist/cjs/{blacklist.js → backend/src/blacklist.js} +8 -5
  3. package/backend/dist/cjs/{cli.js → backend/src/cli.js} +29 -47
  4. package/backend/dist/cjs/backend/src/database/collection.d.ts +1543 -0
  5. package/backend/dist/cjs/backend/src/database/collection.js +3042 -0
  6. package/backend/dist/cjs/backend/src/database/database.d.ts +66 -0
  7. package/backend/dist/cjs/{database → backend/src/database}/database.js +48 -43
  8. package/backend/dist/cjs/backend/src/database/filters/filters.d.ts +6 -0
  9. package/backend/dist/cjs/backend/src/database/filters/filters.js +15 -0
  10. package/backend/dist/cjs/backend/src/database/filters/strict_filter.d.ts +223 -0
  11. package/backend/dist/cjs/backend/src/database/filters/strict_filter.js +15 -0
  12. package/backend/dist/cjs/backend/src/database/filters/strict_filter_test.js +443 -0
  13. package/backend/dist/cjs/backend/src/database/filters/strict_filter_test_v0.js +15 -0
  14. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v0.d.ts +50 -0
  15. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v0.js +15 -0
  16. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v1.d.ts +76 -0
  17. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v1.js +15 -0
  18. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v2.d.ts +75 -0
  19. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v2.js +15 -0
  20. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v3.d.ts +219 -0
  21. package/backend/dist/cjs/backend/src/database/filters/strict_filter_v3.js +15 -0
  22. package/backend/dist/cjs/backend/src/database/filters/strict_update_filter.d.ts +165 -0
  23. package/backend/dist/cjs/backend/src/database/filters/strict_update_filter.js +15 -0
  24. package/backend/dist/cjs/backend/src/database/filters/strict_update_filter_test.d.ts +5 -0
  25. package/backend/dist/cjs/backend/src/database/filters/strict_update_filter_test.js +355 -0
  26. package/backend/dist/cjs/backend/src/database/flatten.d.ts +75 -0
  27. package/backend/dist/cjs/{logger.js → backend/src/database/flatten.js} +18 -7
  28. package/backend/dist/cjs/backend/src/database/flatten_test.js +175 -0
  29. package/backend/dist/cjs/backend/src/database/quota/quota.d.ts +461 -0
  30. package/backend/dist/cjs/backend/src/database/quota/quota.js +1014 -0
  31. package/backend/dist/cjs/backend/src/database/quota/quota_v1.d.ts +534 -0
  32. package/backend/dist/cjs/backend/src/database/quota/quota_v1.js +1087 -0
  33. package/backend/dist/cjs/backend/src/database/quota/safe_int.d.ts +293 -0
  34. package/backend/dist/cjs/backend/src/database/quota/safe_int.js +573 -0
  35. package/backend/dist/{esm → cjs/backend/src}/endpoint.d.ts +69 -46
  36. package/backend/dist/cjs/{endpoint.js → backend/src/endpoint.js} +87 -101
  37. package/backend/dist/cjs/backend/src/errors/index.d.ts +7 -0
  38. package/backend/dist/cjs/backend/src/errors/index.js +25 -0
  39. package/backend/dist/{esm/utils.d.ts → cjs/backend/src/errors/internal_external.d.ts} +14 -22
  40. package/backend/dist/cjs/backend/src/errors/internal_external.js +85 -0
  41. package/backend/dist/cjs/backend/src/errors/invalid_usage_error.d.ts +38 -0
  42. package/backend/dist/cjs/{mutex.js → backend/src/errors/invalid_usage_error.js} +20 -37
  43. package/backend/dist/cjs/backend/src/errors/system_error.d.ts +230 -0
  44. package/backend/dist/cjs/backend/src/errors/system_error.js +393 -0
  45. package/backend/dist/cjs/backend/src/events.d.ts +54 -0
  46. package/backend/dist/cjs/backend/src/events.js +15 -0
  47. package/backend/dist/cjs/{frontend.js → backend/src/frontend.js} +1 -1
  48. package/backend/dist/cjs/{image_endpoint.d.ts → backend/src/image_endpoint.d.ts} +16 -1
  49. package/backend/dist/cjs/{image_endpoint.js → backend/src/image_endpoint.js} +3 -5
  50. package/backend/dist/cjs/backend/src/logger.d.ts +5 -0
  51. package/backend/dist/cjs/backend/src/logger.js +15 -0
  52. package/backend/dist/cjs/backend/src/meta.d.ts +64 -0
  53. package/backend/dist/cjs/{meta.js → backend/src/meta.js} +9 -12
  54. package/backend/dist/cjs/backend/src/payments/paddle.d.ts +326 -0
  55. package/backend/dist/cjs/{payments → backend/src/payments}/paddle.js +377 -327
  56. package/backend/dist/cjs/backend/src/plugins/browser.d.ts +1 -0
  57. package/backend/dist/cjs/backend/src/plugins/browser.js +15 -0
  58. package/backend/dist/cjs/backend/src/plugins/mail/mail.d.ts +248 -0
  59. package/backend/dist/cjs/backend/src/plugins/mail/mail.js +379 -0
  60. package/backend/dist/{esm → cjs/backend/src}/plugins/mail/ui.d.ts +23 -0
  61. package/backend/dist/cjs/backend/src/plugins/pdf.d.ts +1 -0
  62. package/backend/dist/cjs/backend/src/rate_limit.d.ts +145 -0
  63. package/backend/dist/cjs/backend/src/rate_limit.js +549 -0
  64. package/backend/dist/cjs/{route.d.ts → backend/src/route.d.ts} +3 -10
  65. package/backend/dist/cjs/{route.js → backend/src/route.js} +23 -21
  66. package/backend/dist/cjs/backend/src/server.d.ts +485 -0
  67. package/backend/dist/cjs/{server.js → backend/src/server.js} +688 -873
  68. package/backend/dist/cjs/backend/src/splash_screen.d.ts +80 -0
  69. package/backend/dist/cjs/{splash_screen.js → backend/src/splash_screen.js} +24 -3
  70. package/backend/dist/cjs/backend/src/status.d.ts +74 -0
  71. package/backend/dist/cjs/{status.js → backend/src/status.js} +64 -64
  72. package/backend/dist/cjs/backend/src/stream.d.ts +376 -0
  73. package/backend/dist/cjs/{stream.js → backend/src/stream.js} +299 -276
  74. package/backend/dist/cjs/backend/src/users.d.ts +807 -0
  75. package/backend/dist/cjs/backend/src/users.js +1971 -0
  76. package/backend/dist/cjs/backend/src/utils.d.ts +16 -0
  77. package/backend/dist/cjs/{utils.js → backend/src/utils.js} +14 -77
  78. package/backend/dist/{esm → cjs/backend/src}/view.d.ts +33 -11
  79. package/backend/dist/cjs/backend/src/view.js +508 -0
  80. package/backend/dist/{esm → cjs/backend/src}/volt.d.ts +10 -1
  81. package/backend/dist/cjs/{volt.js → backend/src/volt.js} +8 -5
  82. package/backend/dist/cjs/frontend/src/modules/request.d.ts +70 -0
  83. package/backend/dist/cjs/frontend/src/modules/request.js +99 -0
  84. package/backend/dist/esm/{blacklist.d.ts → backend/src/blacklist.d.ts} +5 -3
  85. package/backend/dist/esm/{blacklist.js → backend/src/blacklist.js} +9 -6
  86. package/backend/dist/esm/{cli.js → backend/src/cli.js} +43 -60
  87. package/backend/dist/esm/backend/src/database/collection.d.ts +1543 -0
  88. package/backend/dist/esm/backend/src/database/collection.js +3510 -0
  89. package/backend/dist/esm/backend/src/database/database.d.ts +66 -0
  90. package/backend/dist/esm/{database → backend/src/database}/database.js +62 -103
  91. package/backend/dist/esm/backend/src/database/document.d.ts +1 -0
  92. package/backend/dist/esm/backend/src/database/document.js +558 -0
  93. package/backend/dist/esm/backend/src/database/filters/filters.d.ts +6 -0
  94. package/backend/dist/esm/backend/src/database/filters/filters.js +1 -0
  95. package/backend/dist/esm/backend/src/database/filters/strict_filter.d.ts +223 -0
  96. package/backend/dist/esm/backend/src/database/filters/strict_filter.js +3 -0
  97. package/backend/dist/esm/backend/src/database/filters/strict_filter_test.d.ts +1 -0
  98. package/backend/dist/esm/backend/src/database/filters/strict_filter_test.js +505 -0
  99. package/backend/dist/esm/backend/src/database/filters/strict_filter_test_v0.d.ts +1 -0
  100. package/backend/dist/esm/backend/src/database/filters/strict_filter_test_v0.js +712 -0
  101. package/backend/dist/esm/backend/src/database/filters/strict_filter_v0.d.ts +50 -0
  102. package/backend/dist/esm/backend/src/database/filters/strict_filter_v0.js +5 -0
  103. package/backend/dist/esm/backend/src/database/filters/strict_filter_v1.d.ts +76 -0
  104. package/backend/dist/esm/backend/src/database/filters/strict_filter_v1.js +44 -0
  105. package/backend/dist/esm/backend/src/database/filters/strict_filter_v2.d.ts +75 -0
  106. package/backend/dist/esm/backend/src/database/filters/strict_filter_v2.js +5 -0
  107. package/backend/dist/esm/backend/src/database/filters/strict_filter_v3.d.ts +219 -0
  108. package/backend/dist/esm/backend/src/database/filters/strict_filter_v3.js +1 -0
  109. package/backend/dist/esm/backend/src/database/filters/strict_update_filter.d.ts +165 -0
  110. package/backend/dist/esm/backend/src/database/filters/strict_update_filter.js +5 -0
  111. package/backend/dist/esm/backend/src/database/filters/strict_update_filter_test.d.ts +5 -0
  112. package/backend/dist/esm/backend/src/database/filters/strict_update_filter_test.js +405 -0
  113. package/backend/dist/esm/backend/src/database/flatten.d.ts +75 -0
  114. package/backend/dist/esm/backend/src/database/flatten.js +22 -0
  115. package/backend/dist/esm/backend/src/database/flatten_test.d.ts +1 -0
  116. package/backend/dist/esm/backend/src/database/flatten_test.js +174 -0
  117. package/backend/dist/esm/backend/src/database/quota/quota.d.ts +461 -0
  118. package/backend/dist/esm/backend/src/database/quota/quota.js +1118 -0
  119. package/backend/dist/esm/backend/src/database/quota/quota_v1.d.ts +534 -0
  120. package/backend/dist/esm/backend/src/database/quota/quota_v1.js +1242 -0
  121. package/backend/dist/esm/backend/src/database/quota/safe_int.d.ts +293 -0
  122. package/backend/dist/esm/backend/src/database/quota/safe_int.js +602 -0
  123. package/backend/dist/{cjs → esm/backend/src}/endpoint.d.ts +69 -46
  124. package/backend/dist/esm/{endpoint.js → backend/src/endpoint.js} +136 -127
  125. package/backend/dist/esm/backend/src/errors/index.d.ts +7 -0
  126. package/backend/dist/esm/backend/src/errors/index.js +7 -0
  127. package/backend/dist/{cjs/utils.d.ts → esm/backend/src/errors/internal_external.d.ts} +14 -22
  128. package/backend/dist/esm/backend/src/errors/internal_external.js +70 -0
  129. package/backend/dist/esm/backend/src/errors/invalid_usage_error.d.ts +38 -0
  130. package/backend/dist/esm/backend/src/errors/invalid_usage_error.js +30 -0
  131. package/backend/dist/esm/backend/src/errors/system_error.d.ts +230 -0
  132. package/backend/dist/esm/backend/src/errors/system_error.js +402 -0
  133. package/backend/dist/esm/backend/src/events.d.ts +54 -0
  134. package/backend/dist/esm/backend/src/events.js +5 -0
  135. package/backend/dist/esm/{frontend.js → backend/src/frontend.js} +1 -1
  136. package/backend/dist/esm/{image_endpoint.d.ts → backend/src/image_endpoint.d.ts} +16 -1
  137. package/backend/dist/esm/{image_endpoint.js → backend/src/image_endpoint.js} +16 -20
  138. package/backend/dist/esm/backend/src/logger.d.ts +5 -0
  139. package/backend/dist/esm/backend/src/logger.js +8 -0
  140. package/backend/dist/esm/backend/src/meta.d.ts +64 -0
  141. package/backend/dist/esm/{meta.js → backend/src/meta.js} +15 -54
  142. package/backend/dist/esm/backend/src/payments/paddle.d.ts +326 -0
  143. package/backend/dist/esm/{payments → backend/src/payments}/paddle.js +417 -452
  144. package/backend/dist/esm/backend/src/plugins/browser.d.ts +1 -0
  145. package/backend/dist/esm/backend/src/plugins/browser.js +170 -0
  146. package/backend/dist/esm/backend/src/plugins/mail/mail.d.ts +248 -0
  147. package/backend/dist/esm/backend/src/plugins/mail/mail.js +389 -0
  148. package/backend/dist/{cjs → esm/backend/src}/plugins/mail/ui.d.ts +23 -0
  149. package/backend/dist/esm/{plugins → backend/src/plugins}/mail/ui.js +3 -6
  150. package/backend/dist/esm/backend/src/plugins/pdf.d.ts +1 -0
  151. package/backend/dist/esm/{plugins → backend/src/plugins}/pdf.js +3 -3
  152. package/backend/dist/esm/backend/src/rate_limit.d.ts +145 -0
  153. package/backend/dist/esm/backend/src/rate_limit.js +667 -0
  154. package/backend/dist/esm/{route.d.ts → backend/src/route.d.ts} +3 -10
  155. package/backend/dist/esm/{route.js → backend/src/route.js} +26 -21
  156. package/backend/dist/esm/backend/src/server.d.ts +485 -0
  157. package/backend/dist/esm/{server.js → backend/src/server.js} +891 -1441
  158. package/backend/dist/esm/backend/src/splash_screen.d.ts +80 -0
  159. package/backend/dist/esm/{splash_screen.js → backend/src/splash_screen.js} +42 -55
  160. package/backend/dist/esm/backend/src/status.d.ts +74 -0
  161. package/backend/dist/esm/backend/src/status.js +199 -0
  162. package/backend/dist/esm/backend/src/stream.d.ts +376 -0
  163. package/backend/dist/esm/{stream.js → backend/src/stream.js} +327 -292
  164. package/backend/dist/esm/backend/src/users.d.ts +809 -0
  165. package/backend/dist/esm/backend/src/users.js +2140 -0
  166. package/backend/dist/esm/backend/src/utils.d.ts +16 -0
  167. package/backend/dist/esm/{utils.js → backend/src/utils.js} +20 -81
  168. package/backend/dist/{cjs → esm/backend/src}/view.d.ts +33 -11
  169. package/backend/dist/esm/{view.js → backend/src/view.js} +266 -86
  170. package/backend/dist/{cjs → esm/backend/src}/volt.d.ts +10 -1
  171. package/backend/dist/esm/{volt.js → backend/src/volt.js} +7 -4
  172. package/backend/dist/esm/frontend/src/modules/request.d.ts +70 -0
  173. package/backend/dist/esm/frontend/src/modules/request.js +117 -0
  174. package/frontend/dist/backend/src/database/collection.d.ts +1543 -0
  175. package/frontend/dist/backend/src/database/collection.js +3510 -0
  176. package/frontend/dist/backend/src/database/database.d.ts +66 -0
  177. package/frontend/dist/backend/src/database/database.js +196 -0
  178. package/frontend/dist/backend/src/database/filters/filters.d.ts +6 -0
  179. package/frontend/dist/backend/src/database/filters/filters.js +1 -0
  180. package/frontend/dist/backend/src/database/filters/strict_filter.d.ts +223 -0
  181. package/frontend/dist/backend/src/database/filters/strict_filter.js +3 -0
  182. package/frontend/dist/backend/src/database/filters/strict_update_filter.d.ts +165 -0
  183. package/frontend/dist/backend/src/database/filters/strict_update_filter.js +5 -0
  184. package/frontend/dist/backend/src/database/flatten.d.ts +75 -0
  185. package/frontend/dist/backend/src/database/flatten.js +22 -0
  186. package/frontend/dist/backend/src/endpoint.d.ts +204 -0
  187. package/frontend/dist/backend/src/endpoint.js +570 -0
  188. package/frontend/dist/backend/src/errors/index.d.ts +7 -0
  189. package/frontend/dist/backend/src/errors/index.js +7 -0
  190. package/frontend/dist/backend/src/errors/internal_external.d.ts +38 -0
  191. package/frontend/dist/backend/src/errors/internal_external.js +70 -0
  192. package/frontend/dist/backend/src/errors/invalid_usage_error.d.ts +38 -0
  193. package/frontend/dist/backend/src/errors/invalid_usage_error.js +30 -0
  194. package/frontend/dist/backend/src/errors/system_error.d.ts +230 -0
  195. package/frontend/dist/backend/src/errors/system_error.js +402 -0
  196. package/frontend/dist/backend/src/events.d.ts +54 -0
  197. package/frontend/dist/backend/src/events.js +5 -0
  198. package/frontend/dist/backend/src/frontend.d.ts +11 -0
  199. package/frontend/dist/backend/src/frontend.js +12 -0
  200. package/frontend/dist/backend/src/image_endpoint.d.ts +39 -0
  201. package/frontend/dist/backend/src/image_endpoint.js +202 -0
  202. package/frontend/dist/backend/src/meta.d.ts +64 -0
  203. package/frontend/dist/backend/src/meta.js +110 -0
  204. package/frontend/dist/backend/src/payments/paddle.d.ts +326 -0
  205. package/frontend/dist/backend/src/payments/paddle.js +2256 -0
  206. package/frontend/dist/backend/src/plugins/mail/mail.d.ts +248 -0
  207. package/frontend/dist/backend/src/plugins/mail/mail.js +389 -0
  208. package/{backend/dist/esm/plugins/mail.d.ts → frontend/dist/backend/src/plugins/mail/ui.d.ts} +23 -0
  209. package/{backend/dist/esm/plugins/mail.js → frontend/dist/backend/src/plugins/mail/ui.js} +3 -6
  210. package/frontend/dist/backend/src/rate_limit.d.ts +145 -0
  211. package/frontend/dist/backend/src/rate_limit.js +673 -0
  212. package/frontend/dist/backend/src/route.d.ts +35 -0
  213. package/frontend/dist/backend/src/route.js +212 -0
  214. package/frontend/dist/backend/src/server.d.ts +485 -0
  215. package/frontend/dist/backend/src/server.js +2670 -0
  216. package/frontend/dist/backend/src/splash_screen.d.ts +80 -0
  217. package/frontend/dist/backend/src/splash_screen.js +135 -0
  218. package/frontend/dist/backend/src/status.d.ts +74 -0
  219. package/frontend/dist/backend/src/status.js +199 -0
  220. package/frontend/dist/backend/src/stream.d.ts +376 -0
  221. package/frontend/dist/backend/src/stream.js +1007 -0
  222. package/frontend/dist/backend/src/users.d.ts +807 -0
  223. package/frontend/dist/backend/src/users.js +2118 -0
  224. package/frontend/dist/backend/src/utils.d.ts +16 -0
  225. package/frontend/dist/backend/src/utils.js +241 -0
  226. package/frontend/dist/backend/src/view.d.ts +162 -0
  227. package/frontend/dist/backend/src/view.js +720 -0
  228. package/frontend/dist/frontend/src/elements/base.d.ts +4414 -0
  229. package/frontend/dist/{elements → frontend/src/elements}/base.js +3624 -260
  230. package/frontend/dist/frontend/src/elements/module.d.ts +95 -0
  231. package/frontend/dist/{elements → frontend/src/elements}/module.js +53 -52
  232. package/frontend/dist/frontend/src/elements/types.d.ts +52 -0
  233. package/frontend/dist/frontend/src/elements/types.js +5 -0
  234. package/frontend/dist/frontend/src/modules/attachment.d.ts +126 -0
  235. package/frontend/dist/frontend/src/modules/attachment.js +306 -0
  236. package/frontend/dist/frontend/src/modules/auth.d.ts +44 -0
  237. package/frontend/dist/frontend/src/modules/auth.js +80 -0
  238. package/frontend/dist/{modules → frontend/src/modules}/color.js +2 -2
  239. package/frontend/dist/frontend/src/modules/compression.d.ts +39 -0
  240. package/frontend/dist/frontend/src/modules/compression.js +102 -0
  241. package/frontend/dist/frontend/src/modules/cookies.d.ts +44 -0
  242. package/frontend/dist/frontend/src/modules/cookies.js +143 -0
  243. package/frontend/dist/frontend/src/modules/events.d.ts +31 -0
  244. package/frontend/dist/frontend/src/modules/events.js +74 -0
  245. package/frontend/dist/frontend/src/modules/google.d.ts +23 -0
  246. package/frontend/dist/frontend/src/modules/google.js +52 -0
  247. package/frontend/dist/frontend/src/modules/meta.d.ts +14 -0
  248. package/frontend/dist/{modules → frontend/src/modules}/meta.js +9 -7
  249. package/frontend/dist/{modules → frontend/src/modules}/paddle.d.ts +37 -134
  250. package/frontend/dist/{modules → frontend/src/modules}/paddle.js +620 -568
  251. package/frontend/dist/frontend/src/modules/request.d.ts +70 -0
  252. package/frontend/dist/frontend/src/modules/request.js +117 -0
  253. package/frontend/dist/frontend/src/modules/settings.d.ts +3 -0
  254. package/frontend/dist/frontend/src/modules/settings.js +5 -0
  255. package/frontend/dist/frontend/src/modules/statics.d.ts +21 -0
  256. package/frontend/dist/{modules → frontend/src/modules}/statics.js +15 -18
  257. package/frontend/dist/frontend/src/modules/support.d.ts +30 -0
  258. package/frontend/dist/frontend/src/modules/support.js +53 -0
  259. package/frontend/dist/{modules → frontend/src/modules}/theme.d.ts +67 -0
  260. package/frontend/dist/{modules → frontend/src/modules}/theme.js +68 -38
  261. package/frontend/dist/frontend/src/modules/themes.d.ts +12 -0
  262. package/frontend/dist/frontend/src/modules/themes.js +22 -0
  263. package/frontend/dist/frontend/src/modules/user.d.ts +164 -0
  264. package/frontend/dist/frontend/src/modules/user.js +268 -0
  265. package/frontend/dist/frontend/src/modules/utils.d.ts +176 -0
  266. package/frontend/dist/frontend/src/modules/utils.js +569 -0
  267. package/frontend/dist/frontend/src/types/gradient.d.ts +29 -0
  268. package/frontend/dist/{types → frontend/src/types}/gradient.js +14 -18
  269. package/frontend/dist/frontend/src/ui/border_button.d.ts +94 -0
  270. package/frontend/dist/{ui → frontend/src/ui}/border_button.js +7 -13
  271. package/frontend/dist/frontend/src/ui/button.d.ts +28 -0
  272. package/frontend/dist/{ui → frontend/src/ui}/button.js +21 -12
  273. package/frontend/dist/frontend/src/ui/canvas.d.ts +138 -0
  274. package/frontend/dist/{ui → frontend/src/ui}/canvas.js +88 -55
  275. package/frontend/dist/frontend/src/ui/checkbox.d.ts +74 -0
  276. package/frontend/dist/{ui → frontend/src/ui}/checkbox.js +80 -41
  277. package/frontend/dist/{ui → frontend/src/ui}/code.d.ts +73 -6
  278. package/frontend/dist/{ui → frontend/src/ui}/code.js +55 -52
  279. package/frontend/dist/{ui → frontend/src/ui}/context_menu.d.ts +4 -0
  280. package/frontend/dist/{ui → frontend/src/ui}/context_menu.js +12 -17
  281. package/frontend/dist/{ui → frontend/src/ui}/css.d.ts +4 -0
  282. package/frontend/dist/{ui → frontend/src/ui}/css.js +3 -3
  283. package/frontend/dist/{ui → frontend/src/ui}/divider.d.ts +4 -0
  284. package/frontend/dist/{ui → frontend/src/ui}/divider.js +3 -3
  285. package/frontend/dist/{ui → frontend/src/ui}/dropdown.d.ts +57 -2
  286. package/frontend/dist/{ui → frontend/src/ui}/dropdown.js +87 -94
  287. package/frontend/dist/{ui → frontend/src/ui}/for_each.d.ts +4 -0
  288. package/frontend/dist/{ui → frontend/src/ui}/for_each.js +3 -3
  289. package/frontend/dist/{ui → frontend/src/ui}/form.d.ts +6 -2
  290. package/frontend/dist/{ui → frontend/src/ui}/form.js +10 -7
  291. package/frontend/dist/frontend/src/ui/frame_modes.d.ts +37 -0
  292. package/frontend/dist/{ui → frontend/src/ui}/frame_modes.js +16 -22
  293. package/frontend/dist/{ui → frontend/src/ui}/google_map.d.ts +4 -0
  294. package/frontend/dist/{ui → frontend/src/ui}/google_map.js +4 -4
  295. package/frontend/dist/{ui → frontend/src/ui}/gradient.d.ts +4 -0
  296. package/frontend/dist/{ui → frontend/src/ui}/gradient.js +3 -3
  297. package/frontend/dist/{ui → frontend/src/ui}/image.d.ts +4 -0
  298. package/frontend/dist/{ui → frontend/src/ui}/image.js +5 -5
  299. package/frontend/dist/frontend/src/ui/input.d.ts +392 -0
  300. package/frontend/dist/{ui → frontend/src/ui}/input.js +346 -360
  301. package/frontend/dist/{ui → frontend/src/ui}/link.d.ts +4 -0
  302. package/frontend/dist/{ui → frontend/src/ui}/link.js +3 -3
  303. package/frontend/dist/{ui → frontend/src/ui}/list.d.ts +4 -0
  304. package/frontend/dist/{ui → frontend/src/ui}/list.js +12 -6
  305. package/frontend/dist/frontend/src/ui/loader_button.d.ts +80 -0
  306. package/frontend/dist/{ui → frontend/src/ui}/loader_button.js +35 -47
  307. package/frontend/dist/frontend/src/ui/loaders.d.ts +57 -0
  308. package/frontend/dist/{ui → frontend/src/ui}/loaders.js +11 -11
  309. package/frontend/dist/{ui → frontend/src/ui}/popup.d.ts +11 -6
  310. package/frontend/dist/{ui → frontend/src/ui}/popup.js +32 -18
  311. package/frontend/dist/frontend/src/ui/pseudo.d.ts +44 -0
  312. package/frontend/dist/{ui → frontend/src/ui}/pseudo.js +84 -8
  313. package/frontend/dist/{ui → frontend/src/ui}/scroller.d.ts +14 -2
  314. package/frontend/dist/{ui → frontend/src/ui}/scroller.js +37 -43
  315. package/frontend/dist/{ui → frontend/src/ui}/slider.d.ts +5 -1
  316. package/frontend/dist/{ui → frontend/src/ui}/slider.js +4 -4
  317. package/frontend/dist/{ui → frontend/src/ui}/spacer.d.ts +4 -0
  318. package/frontend/dist/{ui → frontend/src/ui}/spacer.js +3 -3
  319. package/frontend/dist/{ui → frontend/src/ui}/span.d.ts +4 -0
  320. package/frontend/dist/{ui → frontend/src/ui}/span.js +3 -3
  321. package/frontend/dist/{ui → frontend/src/ui}/stack.d.ts +4 -0
  322. package/frontend/dist/{ui → frontend/src/ui}/stack.js +3 -9
  323. package/frontend/dist/frontend/src/ui/steps.d.ts +131 -0
  324. package/frontend/dist/{ui → frontend/src/ui}/steps.js +30 -45
  325. package/frontend/dist/{ui → frontend/src/ui}/style.d.ts +4 -0
  326. package/frontend/dist/{ui → frontend/src/ui}/style.js +3 -3
  327. package/frontend/dist/{ui → frontend/src/ui}/switch.d.ts +5 -1
  328. package/frontend/dist/{ui → frontend/src/ui}/switch.js +4 -4
  329. package/frontend/dist/{ui → frontend/src/ui}/table.d.ts +4 -0
  330. package/frontend/dist/{ui → frontend/src/ui}/table.js +6 -6
  331. package/frontend/dist/{ui → frontend/src/ui}/tabs.d.ts +45 -3
  332. package/frontend/dist/{ui → frontend/src/ui}/tabs.js +65 -40
  333. package/frontend/dist/{ui → frontend/src/ui}/text.d.ts +4 -0
  334. package/frontend/dist/{ui → frontend/src/ui}/text.js +3 -3
  335. package/frontend/dist/frontend/src/ui/title.d.ts +91 -0
  336. package/frontend/dist/frontend/src/ui/title.js +272 -0
  337. package/frontend/dist/{ui → frontend/src/ui}/view.d.ts +4 -0
  338. package/frontend/dist/{ui → frontend/src/ui}/view.js +3 -3
  339. package/frontend/dist/{volt.d.ts → frontend/src/volt.d.ts} +3 -0
  340. package/frontend/dist/{volt.js → frontend/src/volt.js} +4 -0
  341. package/frontend/tools/bundle_d_ts.js +71 -0
  342. package/frontend/tools/convert_to_jsdoc_input.txt +9452 -0
  343. package/frontend/tools/convert_to_jsdoc_output.txt +7626 -0
  344. package/frontend/tools/convert_to_jsdoc_tmp.js +345 -0
  345. package/package.json +11 -12
  346. package/backend/dist/cjs/database/collection.d.ts +0 -160
  347. package/backend/dist/cjs/database/collection.js +0 -842
  348. package/backend/dist/cjs/database/database.d.ts +0 -121
  349. package/backend/dist/cjs/database/document.d.ts +0 -131
  350. package/backend/dist/cjs/database/document.js +0 -224
  351. package/backend/dist/cjs/database.d.ts +0 -502
  352. package/backend/dist/cjs/database.js +0 -2248
  353. package/backend/dist/cjs/logger.d.ts +0 -3
  354. package/backend/dist/cjs/meta.d.ts +0 -50
  355. package/backend/dist/cjs/mutex.d.ts +0 -24
  356. package/backend/dist/cjs/payments/paddle.d.ts +0 -160
  357. package/backend/dist/cjs/plugins/browser.d.ts +0 -36
  358. package/backend/dist/cjs/plugins/browser.js +0 -198
  359. package/backend/dist/cjs/plugins/css.d.ts +0 -11
  360. package/backend/dist/cjs/plugins/css.js +0 -80
  361. package/backend/dist/cjs/plugins/mail.d.ts +0 -277
  362. package/backend/dist/cjs/plugins/mail.js +0 -1370
  363. package/backend/dist/cjs/plugins/ts/compiler.d.ts +0 -139
  364. package/backend/dist/cjs/plugins/ts/compiler.js +0 -750
  365. package/backend/dist/cjs/plugins/ts/preprocessing.d.ts +0 -14
  366. package/backend/dist/cjs/plugins/ts/preprocessing.js +0 -440
  367. package/backend/dist/cjs/rate_limit.d.ts +0 -63
  368. package/backend/dist/cjs/rate_limit.js +0 -348
  369. package/backend/dist/cjs/request.deprc.d.ts +0 -48
  370. package/backend/dist/cjs/request.deprc.js +0 -572
  371. package/backend/dist/cjs/response.deprc.d.ts +0 -55
  372. package/backend/dist/cjs/response.deprc.js +0 -275
  373. package/backend/dist/cjs/server.d.ts +0 -342
  374. package/backend/dist/cjs/splash_screen.d.ts +0 -35
  375. package/backend/dist/cjs/status.d.ts +0 -61
  376. package/backend/dist/cjs/stream.d.ts +0 -79
  377. package/backend/dist/cjs/users.d.ts +0 -111
  378. package/backend/dist/cjs/users.js +0 -1817
  379. package/backend/dist/cjs/view.js +0 -352
  380. package/backend/dist/cjs/vinc.dev.d.ts +0 -3
  381. package/backend/dist/cjs/vinc.dev.js +0 -7
  382. package/backend/dist/css/adyen.css +0 -92
  383. package/backend/dist/css/volt.css +0 -70
  384. package/backend/dist/esm/database/collection.d.ts +0 -160
  385. package/backend/dist/esm/database/collection.js +0 -1328
  386. package/backend/dist/esm/database/database.d.ts +0 -121
  387. package/backend/dist/esm/database/document.d.ts +0 -131
  388. package/backend/dist/esm/database/document.js +0 -247
  389. package/backend/dist/esm/database.d.ts +0 -502
  390. package/backend/dist/esm/database.js +0 -2423
  391. package/backend/dist/esm/file_watcher.js +0 -329
  392. package/backend/dist/esm/logger.d.ts +0 -3
  393. package/backend/dist/esm/logger.js +0 -11
  394. package/backend/dist/esm/meta.d.ts +0 -50
  395. package/backend/dist/esm/mutex.d.ts +0 -24
  396. package/backend/dist/esm/mutex.js +0 -48
  397. package/backend/dist/esm/payments/paddle.d.ts +0 -160
  398. package/backend/dist/esm/plugins/browser.d.ts +0 -36
  399. package/backend/dist/esm/plugins/browser.js +0 -176
  400. package/backend/dist/esm/plugins/css.d.ts +0 -11
  401. package/backend/dist/esm/plugins/css.js +0 -90
  402. package/backend/dist/esm/plugins/ts/compiler.d.ts +0 -139
  403. package/backend/dist/esm/plugins/ts/compiler.js +0 -1194
  404. package/backend/dist/esm/plugins/ts/preprocessing.d.ts +0 -14
  405. package/backend/dist/esm/plugins/ts/preprocessing.js +0 -726
  406. package/backend/dist/esm/rate_limit.d.ts +0 -63
  407. package/backend/dist/esm/rate_limit.js +0 -417
  408. package/backend/dist/esm/request.deprc.d.ts +0 -48
  409. package/backend/dist/esm/request.deprc.js +0 -572
  410. package/backend/dist/esm/response.deprc.d.ts +0 -55
  411. package/backend/dist/esm/response.deprc.js +0 -275
  412. package/backend/dist/esm/server.d.ts +0 -342
  413. package/backend/dist/esm/splash_screen.d.ts +0 -35
  414. package/backend/dist/esm/status.d.ts +0 -61
  415. package/backend/dist/esm/status.js +0 -197
  416. package/backend/dist/esm/stream.d.ts +0 -79
  417. package/backend/dist/esm/users.d.ts +0 -111
  418. package/backend/dist/esm/users.js +0 -1935
  419. package/backend/dist/esm/vinc.dev.d.ts +0 -3
  420. package/backend/dist/esm/vinc.dev.js +0 -7
  421. package/frontend/dist/elements/base.d.ts +0 -9889
  422. package/frontend/dist/elements/module.d.ts +0 -30
  423. package/frontend/dist/modules/array.d.ts +0 -94
  424. package/frontend/dist/modules/array.js +0 -634
  425. package/frontend/dist/modules/auth.d.ts +0 -46
  426. package/frontend/dist/modules/auth.js +0 -139
  427. package/frontend/dist/modules/colors.d.ts +0 -1
  428. package/frontend/dist/modules/colors.js +0 -417
  429. package/frontend/dist/modules/compression.d.ts +0 -6
  430. package/frontend/dist/modules/compression.js +0 -999
  431. package/frontend/dist/modules/cookies.d.ts +0 -18
  432. package/frontend/dist/modules/cookies.js +0 -167
  433. package/frontend/dist/modules/date.d.ts +0 -142
  434. package/frontend/dist/modules/date.js +0 -493
  435. package/frontend/dist/modules/events.d.ts +0 -8
  436. package/frontend/dist/modules/events.js +0 -91
  437. package/frontend/dist/modules/google.d.ts +0 -11
  438. package/frontend/dist/modules/google.js +0 -54
  439. package/frontend/dist/modules/meta.d.ts +0 -10
  440. package/frontend/dist/modules/mutex.d.ts +0 -7
  441. package/frontend/dist/modules/mutex.js +0 -51
  442. package/frontend/dist/modules/number.d.ts +0 -16
  443. package/frontend/dist/modules/number.js +0 -23
  444. package/frontend/dist/modules/object.d.ts +0 -52
  445. package/frontend/dist/modules/object.js +0 -383
  446. package/frontend/dist/modules/scheme.d.ts +0 -227
  447. package/frontend/dist/modules/scheme.js +0 -531
  448. package/frontend/dist/modules/settings.d.ts +0 -3
  449. package/frontend/dist/modules/settings.js +0 -4
  450. package/frontend/dist/modules/statics.d.ts +0 -5
  451. package/frontend/dist/modules/string.d.ts +0 -124
  452. package/frontend/dist/modules/string.js +0 -745
  453. package/frontend/dist/modules/support.d.ts +0 -19
  454. package/frontend/dist/modules/support.js +0 -103
  455. package/frontend/dist/modules/themes.d.ts +0 -8
  456. package/frontend/dist/modules/themes.js +0 -18
  457. package/frontend/dist/modules/user.d.ts +0 -59
  458. package/frontend/dist/modules/user.js +0 -280
  459. package/frontend/dist/modules/utils.d.ts +0 -87
  460. package/frontend/dist/modules/utils.js +0 -923
  461. package/frontend/dist/types/gradient.d.ts +0 -12
  462. package/frontend/dist/ui/border_button.d.ts +0 -152
  463. package/frontend/dist/ui/button.d.ts +0 -21
  464. package/frontend/dist/ui/canvas.d.ts +0 -56
  465. package/frontend/dist/ui/checkbox.d.ts +0 -52
  466. package/frontend/dist/ui/frame_modes.d.ts +0 -25
  467. package/frontend/dist/ui/input.d.ts +0 -241
  468. package/frontend/dist/ui/loader_button.d.ts +0 -93
  469. package/frontend/dist/ui/loaders.d.ts +0 -57
  470. package/frontend/dist/ui/pseudo.d.ts +0 -16
  471. package/frontend/dist/ui/steps.d.ts +0 -59
  472. package/frontend/dist/ui/title.d.ts +0 -21
  473. package/frontend/dist/ui/title.js +0 -121
  474. package/frontend/examples/dashboard/dashboard.ts +0 -776
  475. /package/backend/dist/cjs/{cli.d.ts → backend/src/cli.d.ts} +0 -0
  476. /package/backend/dist/cjs/{file_watcher.d.ts → backend/src/database/document.d.ts} +0 -0
  477. /package/backend/dist/cjs/{file_watcher.js → backend/src/database/document.js} +0 -0
  478. /package/backend/dist/cjs/{plugins/pdf.d.ts → backend/src/database/filters/strict_filter_test.d.ts} +0 -0
  479. /package/backend/dist/{esm/file_watcher.d.ts → cjs/backend/src/database/filters/strict_filter_test_v0.d.ts} +0 -0
  480. /package/backend/dist/{esm/plugins/pdf.d.ts → cjs/backend/src/database/flatten_test.d.ts} +0 -0
  481. /package/backend/dist/cjs/{frontend.d.ts → backend/src/frontend.d.ts} +0 -0
  482. /package/backend/dist/cjs/{plugins → backend/src/plugins}/communication.d.ts +0 -0
  483. /package/backend/dist/cjs/{plugins → backend/src/plugins}/communication.js +0 -0
  484. /package/backend/dist/cjs/{plugins → backend/src/plugins}/mail/ui.js +0 -0
  485. /package/backend/dist/cjs/{plugins → backend/src/plugins}/pdf.js +0 -0
  486. /package/backend/dist/cjs/{plugins → backend/src/plugins}/thread_monitor.d.ts +0 -0
  487. /package/backend/dist/cjs/{plugins → backend/src/plugins}/thread_monitor.js +0 -0
  488. /package/backend/dist/cjs/{vinc.d.ts → backend/src/vinc.d.ts} +0 -0
  489. /package/backend/dist/cjs/{vinc.js → backend/src/vinc.js} +0 -0
  490. /package/backend/dist/esm/{cli.d.ts → backend/src/cli.d.ts} +0 -0
  491. /package/backend/dist/esm/{frontend.d.ts → backend/src/frontend.d.ts} +0 -0
  492. /package/backend/dist/esm/{plugins → backend/src/plugins}/communication.d.ts +0 -0
  493. /package/backend/dist/esm/{plugins → backend/src/plugins}/communication.js +0 -0
  494. /package/backend/dist/esm/{plugins → backend/src/plugins}/thread_monitor.d.ts +0 -0
  495. /package/backend/dist/esm/{plugins → backend/src/plugins}/thread_monitor.js +0 -0
  496. /package/backend/dist/esm/{vinc.d.ts → backend/src/vinc.d.ts} +0 -0
  497. /package/backend/dist/esm/{vinc.js → backend/src/vinc.js} +0 -0
  498. /package/frontend/dist/{elements → frontend/src/elements}/register_element.d.ts +0 -0
  499. /package/frontend/dist/{elements → frontend/src/elements}/register_element.js +0 -0
  500. /package/frontend/dist/{modules → frontend/src/modules}/color.d.ts +0 -0
  501. /package/frontend/dist/{ui → frontend/src/ui}/ui.d.ts +0 -0
  502. /package/frontend/dist/{ui → frontend/src/ui}/ui.js +0 -0
@@ -33,6 +33,7 @@ __export(stdin_exports, {
33
33
  module.exports = __toCommonJS(stdin_exports);
34
34
  var import_zlib = __toESM(require("zlib"));
35
35
  var vlib = __toESM(require("@vandenberghinc/vlib"));
36
+ var import_rate_limit = __toESM(require("./rate_limit.js"));
36
37
  const { debug } = vlib;
37
38
  class Stream {
38
39
  s;
@@ -56,6 +57,16 @@ class Stream {
56
57
  res_headers;
57
58
  body;
58
59
  promise;
60
+ /** The cached value of {@link normalize_ip} */
61
+ _normalized_ip;
62
+ /**
63
+ * Create a new Stream wrapper for HTTP/1.1 or HTTP/2.
64
+ *
65
+ * @param stream The HTTP/2 stream (when using HTTP/2).
66
+ * @param headers The request headers.
67
+ * @param req The HTTP/1.1 request (when using HTTP/1.1).
68
+ * @param res The HTTP/1.1/HTTP/2 response object.
69
+ */
59
70
  constructor(stream, headers, req, res) {
60
71
  this.s = stream;
61
72
  this.headers = headers ?? {};
@@ -74,8 +85,8 @@ class Stream {
74
85
  this._endpoint = void 0;
75
86
  this._query_string = void 0;
76
87
  this._cookies = void 0;
77
- this._uid = null;
78
- this.status_code = null;
88
+ this._uid = void 0;
89
+ this.status_code = void 0;
79
90
  this.finished = false;
80
91
  this.res_cookies = [];
81
92
  this.res_headers = this.http1 ? [] : {};
@@ -83,7 +94,11 @@ class Stream {
83
94
  this.promise = void 0;
84
95
  this._recv_body();
85
96
  }
86
- // Receve the body.
97
+ /**
98
+ * Receive and buffer the request body, handling optional gzip/deflate decompression.
99
+ * Sets {@link body} and resolves the internal promise used by {@link join}.
100
+ * @private
101
+ */
87
102
  _recv_body() {
88
103
  this.promise = new Promise((resolve, reject) => {
89
104
  const buffs = [];
@@ -137,7 +152,11 @@ class Stream {
137
152
  }
138
153
  });
139
154
  }
140
- // Parse endpoint.
155
+ /**
156
+ * Parse and cache the request endpoint and query string.
157
+ * Populates {@link _endpoint} and {@link _query_string}.
158
+ * @private
159
+ */
141
160
  _parse_endoint() {
142
161
  if (this._endpoint !== void 0) {
143
162
  return;
@@ -153,7 +172,10 @@ class Stream {
153
172
  this._endpoint = this._endpoint.substr(0, this._endpoint.length - 1);
154
173
  }
155
174
  }
156
- // Parse the parameters.
175
+ /**
176
+ * Parse and cache request parameters from the query string or JSON body.
177
+ * Returns the parsed params map.
178
+ */
157
179
  _parse_params() {
158
180
  this._parse_endoint();
159
181
  if (this._params !== void 0) {
@@ -231,12 +253,17 @@ class Stream {
231
253
  }
232
254
  return this._params;
233
255
  }
234
- // Parse cookies.
256
+ /**
257
+ * Parses & returns the cookies cookies,
258
+ * while assigning it to {@link _cookies}
259
+ *
260
+ * @warning On subsequent calls cookies will be parsed again.
261
+ */
235
262
  _parse_cookies() {
236
263
  this._cookies = {};
237
264
  const cookie_str = this.http2 ? this.headers["cookie"] : this.req.headers.cookie;
238
- if (cookie_str === void 0) {
239
- return null;
265
+ if (cookie_str == null) {
266
+ return this._cookies;
240
267
  }
241
268
  let key = "";
242
269
  let value = "";
@@ -297,58 +324,76 @@ class Stream {
297
324
  }
298
325
  append_to_cookie();
299
326
  append_cookie();
327
+ return this._cookies;
300
328
  }
301
329
  // ---------------------------------------------------------
302
330
  // Functions.
303
- // Wait till the request body is fully received.
331
+ /**
332
+ * Wait until the request body is fully received.
333
+ * Resolves when the internal receive promise completes.
334
+ */
304
335
  async join() {
305
336
  await this.promise;
306
337
  }
307
338
  // Get the requests ip.
308
- /* @docs:
309
- * @title: IP
310
- * @description: Get the request's ip.
311
- * @property: true
312
- * @usage:
313
- * ...
314
- * const ip = stream.ip;
339
+ /**
340
+ * Get the request's ip.
341
+ *
342
+ * @example
343
+ * ```ts
344
+ * const ip = stream.ip;
345
+ * ```
346
+ * @docs
315
347
  */
316
348
  get ip() {
317
349
  return this._ip;
318
350
  }
351
+ /**
352
+ * Retrieve the normalized IP address, suitable for rate limiting and logging.
353
+ * @throws {Error} If the IP is invalid.
354
+ * @returns The normalized IP.
355
+ */
356
+ normalized_ip() {
357
+ if (this._normalized_ip != null) {
358
+ return this._normalized_ip;
359
+ }
360
+ return this._normalized_ip = import_rate_limit.default.normalize_ip(this._ip);
361
+ }
319
362
  // Get the requests port.
320
- /* @docs:
321
- * @title: Port
322
- * @description: Get the request's port.
323
- * @property: true
324
- * @usage:
325
- * ...
326
- * const port = stream.port;
363
+ /**
364
+ * Get the request's port.
365
+ *
366
+ * @example
367
+ * ```ts
368
+ * const port = stream.port;
369
+ * ```
370
+ * @docs
327
371
  */
328
372
  get port() {
329
373
  return this._port;
330
374
  }
331
375
  // Get the method.
332
- /* @docs:
333
- * @title: Method
334
- * @description: Get the request method.
335
- * @property: true
336
- * @usage:
337
- * ...
338
- * const method = stream.method;
376
+ /**
377
+ * Get the request method.
378
+ *
379
+ * @example
380
+ * ```ts
381
+ * const method = stream.method;
382
+ * ```
383
+ * @docs
339
384
  */
340
385
  get method() {
341
386
  return this._method;
342
387
  }
343
388
  // Get the endpoint.
344
- /* @docs:
345
- * @title: Endpoint
346
- * @description: Get the request's endpoint. This will not include the query string.
347
- * @property: true
348
- * @type: string
349
- * @usage:
350
- * ...
351
- * const endpoint = stream.endpoint;
389
+ /**
390
+ * Get the request's endpoint. This will not include the query string.
391
+ *
392
+ * @example
393
+ * ```ts
394
+ * const endpoint = stream.endpoint;
395
+ * ```
396
+ * @docs
352
397
  */
353
398
  get endpoint() {
354
399
  if (this._endpoint !== void 0) {
@@ -358,14 +403,14 @@ class Stream {
358
403
  return this._endpoint;
359
404
  }
360
405
  // Get the params.
361
- /* @docs:
362
- * @title: Parameters
363
- * @description: Get the request's query or body params.
364
- * property: true
365
- * @type: object
366
- * @usage:
367
- * ...
368
- * const params = stream.params;
406
+ /**
407
+ * Get the request's query or body params.
408
+ *
409
+ * @example
410
+ * ```ts
411
+ * const params = stream.params;
412
+ * ```
413
+ * @docs
369
414
  */
370
415
  get params() {
371
416
  if (this._params !== void 0) {
@@ -382,31 +427,25 @@ class Stream {
382
427
  this._params[name] = value;
383
428
  }
384
429
  // Get a param by name and optionally by type.
385
- /* @docs:
386
- * @title: Parameter
387
- * @description: Get a single query or body parameter with an optional type cast.
388
- * @warning: Throws an error when the parameter does not exist or when the type is different from the specified type(s), unless parameter `def` is defined.
389
- * @param:
390
- * @name: name
391
- * @desc: The name of the parameter.
392
- * @type: string
393
- * @param:
394
- * @name: type
395
- * @desc: The type cast of the parameters, valid types are `[null, "boolean", "number", "string", "array", "object"]`.
396
- * @type: string
397
- * @param:
398
- * @name: def
399
- * @desc:
430
+ /**
431
+ * Get a single query or body parameter with an optional type cast.
432
+ *
433
+ * @warning Throws an error when the parameter does not exist or when the type is different from the specified type(s), unless parameter `def` is defined.
434
+ *
435
+ * @param name The name of the parameter.
436
+ * @param type The type cast of the parameters, valid types are `[null, "boolean", "number", "string", "array", "object"]`.
437
+ * @param def
400
438
  * The default value to return when the parameter does not exist.
401
439
  *
402
440
  * If the parameter is not defined and `def` is `undefined` then this function will throw an error.
403
441
  * When `def` is `undefined` errors will be thrown, when `def` is `null` and the parameter is undefined then `null` will be returned as the default value.
404
442
  *
405
443
  * Errors will always be thrown when the incorrect type has been sent by the user.
406
- * @type: any
407
- * @usage:
408
- * ...
409
- * const param = stream.param("myparameter", "number", 10);
444
+ * @example
445
+ * ```ts
446
+ * const param = stream.param("myparameter", "number", 10);
447
+ * ```
448
+ * @docs
410
449
  */
411
450
  param(name, type = null, def = void 0) {
412
451
  this._parse_params();
@@ -518,45 +557,43 @@ class Stream {
518
557
  return value;
519
558
  }
520
559
  // Get the request cookies.
521
- /* @docs:
522
- * @title: Cookies
523
- * @description: Get the request's cookies
524
- * property: true
525
- * @type: object
526
- * @usage:
527
- * ...
528
- * const cookies = stream.cookies;
560
+ /**
561
+ * Get the request's cookies
562
+ *
563
+ * @example
564
+ * ```ts
565
+ * const cookies = stream.cookies;
566
+ * ```
567
+ * @docs
529
568
  */
530
569
  get cookies() {
531
- if (this._cookies !== void 0) {
570
+ if (this._cookies != null)
532
571
  return this._cookies;
533
- }
534
- this._parse_cookies();
535
- return this._cookies;
536
- }
537
- // Check if the stream is closed
538
- /* @docs:
539
- * @title: Closed
540
- * @description: Check if the stream is closed.
541
- * @property: true
542
- * @usage:
543
- * ...
544
- * const ip = stream.closed;
545
- */
546
- get closed() {
547
- if (!this.http2) {
548
- throw new Error("This function is only supported for http2 streams.");
549
- }
550
- return this.s.closed;
572
+ return this._parse_cookies();
551
573
  }
574
+ // DEPRECATED since its only available for http2.
575
+ // /**
576
+ // * Check if the stream is closed.
577
+ // *
578
+ // * @example
579
+ // * ```ts
580
+ // * const ip = stream.closed;
581
+ // * ```
582
+ // * @docs
583
+ // */
584
+ // get closed(): boolean {
585
+ // if (!this.http2) { throw new Error("This function is only supported for http2 streams."); }
586
+ // return this.s!.closed;
587
+ // }
552
588
  // Check if the stream is destroyed
553
- /* @docs:
554
- * @title: Destroyed
555
- * @description: Check if the stream is destroyed.
556
- * @property: true
557
- * @usage:
558
- * ...
559
- * const ip = stream.destroyed;
589
+ /**
590
+ * Check if the stream is destroyed.
591
+ *
592
+ * @example
593
+ * ```ts
594
+ * const ip = stream.destroyed;
595
+ * ```
596
+ * @docs
560
597
  */
561
598
  get destroyed() {
562
599
  if (this.http2) {
@@ -568,14 +605,14 @@ class Stream {
568
605
  // ---------------------------------------------------------
569
606
  // Functions.
570
607
  // Get the authenticated uid.
571
- /* @docs:
572
- * @title: UID
573
- * @description: Get the authenticated uid, is `null` when the request was not authenticated.
574
- * @property: true
575
- * @type: string
576
- * @usage:
577
- * ...
578
- * const uid = stream.uid;
608
+ /**
609
+ * Get the authenticated uid; `undefined` when the request was not authenticated.
610
+ *
611
+ * @example
612
+ * ```ts
613
+ * const uid = stream.uid;
614
+ * ```
615
+ * @docs
579
616
  */
580
617
  get uid() {
581
618
  return this._uid;
@@ -584,48 +621,26 @@ class Stream {
584
621
  this._uid = value;
585
622
  }
586
623
  // Send a response.
587
- /* @docs:
588
- * @title: Send
589
- * @description: Send a response
590
- * @parameter:
591
- * @name: status
592
- * @description: The response status.
593
- * @type: number
594
- * @parameter:
595
- * @name: headers
596
- * @description: The response headers.
597
- * @type: object
598
- * @parameter:
599
- * @name: body
600
- * @description: The response body.
601
- * @type: any
602
- * @parameter:
603
- * @name: data
604
- * @description: The response data.
605
- * @type: undefined, string
606
- * @deprecated: true
607
- * @parameter:
608
- * @name: compress
609
- * @description: A boolean indicating if the response data should be compressed.
610
- * @type: boolean
611
- * @usage:
612
- * ...
613
- * stream.send({status: 200, data: "Hello World!"});
624
+ /**
625
+ * Send a response.
626
+ *
627
+ * @param options The response options.
628
+ * @param options.status The response status.
629
+ * @param options.headers The response headers.
630
+ * @param options.data The data of the response body to send.
631
+ * @param options.compress Whether the response should be gzip-compressed.
632
+ * @example
633
+ * ```ts
634
+ * stream.send({status: 200, data: "Hello World!"});
635
+ * ```
636
+ * @docs
614
637
  */
615
- send({
616
- status = 200,
617
- headers = {},
618
- // data,
619
- // body = data, // zero-copy pull in data
620
- body,
621
- data,
622
- compress = false
623
- } = {}) {
624
- if (data) {
625
- body = data;
626
- }
638
+ send({ status = 200, headers = {}, data, compress = false } = {}) {
627
639
  this.status_code = status;
628
- const has_body = body != null && body !== "";
640
+ let body = data;
641
+ if (typeof body === "boolean" || typeof body === "number") {
642
+ body = body.toString();
643
+ }
629
644
  if (this.http2) {
630
645
  const stream = this.s;
631
646
  this.res_headers[":status"] = status;
@@ -633,21 +648,32 @@ class Stream {
633
648
  if (this.res_cookies.length > 0) {
634
649
  this.res_headers["set-cookie"] = this.res_cookies;
635
650
  }
636
- if (compress && has_body) {
651
+ if (compress && body) {
637
652
  this.res_headers["Content-Encoding"] = "gzip";
638
653
  this.res_headers["Vary"] = "Accept-Encoding";
639
654
  }
640
- if (has_body && typeof body === "object" && Buffer.isBuffer(body) === false && body instanceof Uint8Array === false) {
655
+ if (body && typeof body === "object" && Buffer.isBuffer(body) === false && body instanceof Uint8Array === false) {
641
656
  this.res_headers["Content-Type"] = "application/json";
642
657
  body = JSON.stringify(body);
643
658
  }
644
- if (compress && has_body) {
645
- body = import_zlib.default.gzipSync(body, { level: import_zlib.default.constants.Z_BEST_COMPRESSION });
659
+ if (body && typeof body === "object" && !(body instanceof Buffer) && !(body instanceof Uint8Array)) {
660
+ body = JSON.stringify(body);
661
+ }
662
+ if (compress && body) {
663
+ if (typeof body === "string" || Buffer.isBuffer(body) || body instanceof Uint8Array) {
664
+ body = import_zlib.default.gzipSync(body, { level: import_zlib.default.constants.Z_BEST_COMPRESSION });
665
+ } else {
666
+ body = import_zlib.default.gzipSync(JSON.stringify(body), { level: import_zlib.default.constants.Z_BEST_COMPRESSION });
667
+ }
646
668
  }
647
669
  stream.respond(this.res_headers);
648
- debug(3, "Sending response: ", status, " - has body: ", has_body);
649
- if (has_body) {
650
- stream.end(Buffer.from(body));
670
+ debug(3, "Sending response: ", status, " - has body: ", !!body);
671
+ if (body) {
672
+ if (Buffer.isBuffer(body) || body instanceof Uint8Array) {
673
+ stream.end(body);
674
+ } else {
675
+ stream.end(Buffer.from(body));
676
+ }
651
677
  } else {
652
678
  stream.end();
653
679
  }
@@ -659,21 +685,28 @@ class Stream {
659
685
  res.setHeader(this.res_headers[i][0], this.res_headers[i][1]);
660
686
  }
661
687
  Object.keys(headers).forEach((key) => {
662
- res.setHeader(key, headers[key]);
688
+ const v = headers[key];
689
+ if (v != null) {
690
+ if (typeof v === "boolean") {
691
+ res.setHeader(key, v.toString());
692
+ } else {
693
+ res.setHeader(key, v);
694
+ }
695
+ }
663
696
  });
664
697
  if (this.cookies.length > 0) {
665
698
  res.setHeader("Set-Cookie", this.res_cookies);
666
699
  }
667
- if (has_body && typeof body === "object" && Buffer.isBuffer(body) === false && body instanceof Uint8Array === false) {
700
+ if (body && typeof body === "object" && Buffer.isBuffer(body) === false && body instanceof Uint8Array === false) {
668
701
  res.setHeader("Content-Type", "application/json");
669
702
  body = JSON.stringify(body);
670
703
  }
671
- if (compress && has_body) {
704
+ if (compress && body) {
672
705
  res.setHeader("Content-Encoding", "gzip");
673
706
  res.setHeader("Vary", "Accept-Encoding");
674
707
  body = import_zlib.default.gzipSync(body, { level: import_zlib.default.constants.Z_BEST_COMPRESSION });
675
708
  }
676
- if (has_body) {
709
+ if (body) {
677
710
  res.end(body);
678
711
  } else {
679
712
  res.end();
@@ -683,70 +716,45 @@ class Stream {
683
716
  return this;
684
717
  }
685
718
  // Send a successs response.
686
- /* @docs:
687
- * @title: Send Successs
688
- * @description: Send a response
689
- * @parameter:
690
- * @name: status
691
- * @description: The response status.
692
- * @type: number
693
- * @parameter:
694
- * @name: headers
695
- * @description: The response headers.
696
- * @type: object
697
- * @parameter:
698
- * @name: body
699
- * @description: The response data.
700
- * @type: any
701
- * @parameter:
702
- * @name: data
703
- * @description: The response data.
704
- * @type: undefined, string
705
- * @deprecated: true
706
- * @parameter:
707
- * @name: compress
708
- * @description: A boolean indicating if the response data should be compressed.
709
- * @type: boolean
710
- * @usage:
711
- * ...
712
- * stream.success({data: "Hello World!"});
719
+ /**
720
+ * Send a response
721
+ *
722
+ * @param options The response options.
723
+ * @param options.status The response status.
724
+ * @param options.headers The response headers.
725
+ * @param options.data The data of the response body to send.
726
+ * @param options.compress Whether the response should be gzip-compressed.
727
+ * @example
728
+ * ```ts
729
+ * stream.success({data: "Hello World!"});
730
+ * ```
731
+ * @docs
713
732
  */
714
- success({ status = 200, headers = {}, body = void 0, data = void 0, compress = false } = {}) {
715
- debug(3, "Sending [success] response: ", status, " - body: ", body ?? data);
716
- return this.send({ status, headers, body: body ?? data, compress });
733
+ success({ status = 200, headers = {}, data, compress = false } = {}) {
734
+ debug(3, "Sending [success] response: ", status, " - body: ", data);
735
+ return this.send({ status, headers, data, compress });
717
736
  }
718
737
  // Send an error response.
719
- /* @docs:
720
- * @title: Send Error
721
- * @description: Send an error response
722
- * @parameter:
723
- * @name: status
724
- * @description: The response status.
725
- * @type: number
726
- * @parameter:
727
- * @name: headers
728
- * @description: The response headers.
729
- * @type: object
730
- * @parameter:
731
- * @name: body
732
- * @description: The response data.
733
- * @type: any
734
- * @parameter:
735
- * @name: data
736
- * @description: The response data.
737
- * @type: undefined, string
738
- * @deprecated: true
739
- * @parameter:
740
- * @name: compress
741
- * @description: A boolean indicating if the response data should be compressed.
742
- * @type: boolean
743
- * @usage:
744
- * ...
745
- * stream.error({data: "Some error occured"});
738
+ /**
739
+ * Send an error response
740
+ *
741
+ * @param options The error response options.
742
+ * @param options.message The error message.
743
+ * @param options.type The error type.
744
+ * @param options.invalid_fields The invalid fields when validation fails.
745
+ * @param options.status The response status.
746
+ * @param options.headers The response headers.
747
+ * @param options.compress Whether the response should be gzip-compressed.
748
+ * @param options.data Optional data to include in the error response, nested in the JSON response under field `data`.
749
+ * @example
750
+ * ```ts
751
+ * stream.error({ message: "Some error occurred", status: 400 });
752
+ * ```
753
+ * @docs
746
754
  */
747
- error({ message, type = "APIError", invalid_fields = {}, status = 500, headers = {}, compress = false, data = void 0 }) {
755
+ error({ message, type = "APIError", invalid_fields = {}, status = 500, headers = {}, compress = false, data }) {
748
756
  debug(3, "Sending [error] response: ", status, " - message: ", message);
749
- return this.send({ status, headers, compress, body: {
757
+ const api_error = {
750
758
  error: {
751
759
  type,
752
760
  message,
@@ -754,23 +762,20 @@ class Stream {
754
762
  invalid_fields
755
763
  },
756
764
  data
757
- } });
765
+ };
766
+ return this.send({ status, headers, compress, data: api_error });
758
767
  }
759
768
  // Set headers.
760
- /* @docs:
761
- * @title: Set header
762
- * @description: Add a new header to the response data.
763
- * @parameter:
764
- * @name: name
765
- * @description: The header name.
766
- * @type: string
767
- * @parameter:
768
- * @name: value
769
- * @description: The header value.
770
- * @type: string
771
- * @usage:
772
- * ...
773
- * stream.set_header("Connection", "close");
769
+ /**
770
+ * Add a new header to the response data.
771
+ *
772
+ * @param name The header name.
773
+ * @param value The header value.
774
+ * @example
775
+ * ```ts
776
+ * stream.set_header("Connection", "close");
777
+ * ```
778
+ * @docs
774
779
  */
775
780
  set_header(name, value) {
776
781
  if (this.http2) {
@@ -781,16 +786,15 @@ class Stream {
781
786
  return this;
782
787
  }
783
788
  // Set headers.
784
- /* @docs:
785
- * @title: Set headers
786
- * @description: Add new headers to the response data.
787
- * @parameter:
788
- * @name: headers
789
- * @description: The new response headers.
790
- * @type: object
791
- * @usage:
792
- * ...
793
- * stream.set_headers({"Connection": "close"});
789
+ /**
790
+ * Add new headers to the response data.
791
+ *
792
+ * @param headers The new response headers.
793
+ * @example
794
+ * ```ts
795
+ * stream.set_headers({"Connection": "close"});
796
+ * ```
797
+ * @docs
794
798
  */
795
799
  set_headers(headers = {}) {
796
800
  if (headers == null) {
@@ -807,18 +811,32 @@ class Stream {
807
811
  }
808
812
  return this;
809
813
  }
810
- // Remove header.
811
- /* @docs:
812
- * @title: Remove headers
813
- * @description: Remove header names from the response data.
814
- * @parameter:
815
- * @name: ...names
816
- * @description: The header names to remove.
817
- * @type: ...string
818
- * @usage:
819
- * ...
820
- * stream.remove_header("Connection", "User-Agent");
821
- * @funcs: 2
814
+ /**
815
+ * Get an added header.
816
+ *
817
+ * @param name The header name.
818
+ * @example
819
+ * ```ts
820
+ * stream.get_header("Connection");
821
+ * ```
822
+ * @docs
823
+ */
824
+ get_header(name) {
825
+ if (this.http2) {
826
+ return this.res_headers[name];
827
+ } else {
828
+ return this.res_headers.find((header) => header[0] === name)?.[1];
829
+ }
830
+ }
831
+ /**
832
+ * Remove header names from the response data.
833
+ *
834
+ * @param names The header names to remove.
835
+ * @example
836
+ * ```ts
837
+ * stream.remove_header("Connection", "User-Agent");
838
+ * ```
839
+ * @docs
822
840
  */
823
841
  remove_header(...names) {
824
842
  if (this.http1) {
@@ -836,21 +854,25 @@ class Stream {
836
854
  }
837
855
  return this;
838
856
  }
857
+ /**
858
+ * Alias of {@link remove_header}.
859
+ *
860
+ * @param names The header names to remove.
861
+ */
839
862
  remove_headers(...names) {
840
863
  return this.remove_header(...names);
841
864
  }
842
865
  // Set a cookie.
843
- /* @docs:
844
- * @title: Set cookie.
845
- * @description: Set a cookie that will be sent with the response.
846
- * @warning: Will only be added to the response when the user uses `send()`, `success()` or `error()`.
847
- * @parameter:
848
- * @name: cookie
849
- * @description: The cookie string.
850
- * @type: string
851
- * @usage:
852
- * ...
853
- * stream.set_cookie("MyCookie=Hello World;");
866
+ /**
867
+ * Set a cookie that will be sent with the response.
868
+ *
869
+ * @warning Will only be added to the response when the user uses `send()`, `success()` or `error()`.
870
+ * @param cookie The cookie string.
871
+ * @example
872
+ * ```ts
873
+ * stream.set_cookie("MyCookie=Hello World;");
874
+ * ```
875
+ * @docs
854
876
  */
855
877
  set_cookie(cookie) {
856
878
  cookie = cookie.trim();
@@ -868,17 +890,16 @@ class Stream {
868
890
  return this;
869
891
  }
870
892
  // Set cookies.
871
- /* @docs:
872
- * @title: Set Cookies
873
- * @description: Set a cookie that will be sent with the response.
874
- * @warning: Will only be added to the response when the user uses `send()`, `success()` or `error()`.
875
- * @parameter:
876
- * @name: cookies
877
- * @description: The cookie strings.
878
- * @type: ...string
879
- * @usage:
880
- * ...
881
- * stream.set_cookies("MyCookie1=Hello World;", "MyCookie2=Hello Universe;");
893
+ /**
894
+ * Set cookies that will be sent with the response.
895
+ *
896
+ * @warning Will only be added to the response when the user uses `send()`, `success()` or `error()`.
897
+ * @param cookies The cookie strings.
898
+ * @example
899
+ * ```ts
900
+ * stream.set_cookies("MyCookie1=Hello World;", "MyCookie2=Hello Universe;");
901
+ * ```
902
+ * @docs
882
903
  */
883
904
  set_cookies(...cookies) {
884
905
  for (let i = 0; i < cookies.length; i++) {
@@ -887,6 +908,8 @@ class Stream {
887
908
  return this;
888
909
  }
889
910
  }
911
+ ;
912
+ ;
890
913
  var stdin_default = Stream;
891
914
  // Annotate the CommonJS export names for ESM import in node:
892
915
  0 && (module.exports = {