@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
@@ -1,842 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var stdin_exports = {};
19
- __export(stdin_exports, {
20
- Collection: () => Collection
21
- });
22
- module.exports = __toCommonJS(stdin_exports);
23
- var import_bson = require("bson");
24
- var import_logger = require("../logger.js");
25
- var import_document = require("./document.js");
26
- const { log } = import_logger.logger;
27
- class Collection {
28
- // Static attributes.
29
- static chunk_size = 1024 * 1024 * 4;
30
- // 4MB chunks, lower is better for frequent updates.
31
- static constructor_scheme = {
32
- name: "string",
33
- ttl: { type: "number", default: null },
34
- // ttl in msec
35
- indexes: {
36
- type: "array",
37
- default: [],
38
- value_scheme: {
39
- type: ["string", "object"],
40
- scheme: {
41
- key: { type: "string", required: (data) => data.key == null && data.keys == null },
42
- keys: {
43
- type: ["array"],
44
- required: (data) => data.key == null && data.keys == null,
45
- value_scheme: "string",
46
- postprocess: (keys) => typeof keys === "string" ? [keys] : keys
47
- },
48
- options: { type: "object", required: false },
49
- forced: { type: "boolean", default: false }
50
- },
51
- postprocess: (info) => {
52
- if (typeof info === "string")
53
- return { keys: [info] };
54
- return info;
55
- }
56
- }
57
- }
58
- };
59
- /** Collection name */
60
- name;
61
- /** Time to live in msec for all documents. */
62
- ttl;
63
- ttl_enabled;
64
- /** The column. */
65
- _col;
66
- /**
67
- * The Database parent class, used to initialize the column on demand.
68
- * So the user can define collections at root level before the database is initialized. */
69
- db;
70
- /** Is initialized. */
71
- initialized = false;
72
- /** The temporary indexes passed to the constructor for the init method. */
73
- _init_indexes;
74
- /** Constructor. */
75
- constructor(opts) {
76
- this.name = opts.name;
77
- this._col = opts.col;
78
- this.ttl = opts.ttl;
79
- this.ttl_enabled = typeof opts.ttl === "number";
80
- this.db = opts.db;
81
- this._init_indexes = opts.indexes;
82
- }
83
- /** Initialize. */
84
- async init() {
85
- if (this.initialized === false) {
86
- if (this._col == null) {
87
- if (!this.db.server.production) {
88
- await this.db.ensure_connection();
89
- }
90
- if (!this.db.connected || !this.db._db) {
91
- throw new Error(`Database is not connected.`);
92
- }
93
- if (this.db._listed_cols == null) {
94
- this.db._listed_cols = await this.db._db.listCollections().toArray();
95
- }
96
- if (!this.db._listed_cols.find((x) => x.name === this.name)) {
97
- log(0, `Creating collection "${this.name}".`);
98
- await this.db._db.createCollection(this.name);
99
- }
100
- this._col = this.db._db.collection(this.name);
101
- }
102
- this.initialized = true;
103
- if (this.ttl_enabled) {
104
- await this._setup_ttl();
105
- }
106
- if (this._init_indexes?.length) {
107
- for (const item of this._init_indexes) {
108
- await this.create_index(item);
109
- }
110
- } else {
111
- await this.create_index({ key: "_path", options: { unique: false } });
112
- }
113
- }
114
- return this;
115
- }
116
- assert_init() {
117
- if (this._col == null) {
118
- throw new Error(`Collection "${this.name}" is not initialized.`);
119
- }
120
- }
121
- /** Setup the ttl configuration. */
122
- async _setup_ttl() {
123
- if (!this.initialized) {
124
- await this.init();
125
- }
126
- this.assert_init();
127
- if (this.ttl == null) {
128
- return;
129
- }
130
- const desired_seconds = Math.floor(this.ttl / 1e3);
131
- const indexes = await this._col.indexes();
132
- const ttl_index = indexes.find((ix) => ix.key._ttl_timestamp === 1 || ix.key instanceof Array && ix.key[0] === "_ttl_timestamp");
133
- if (!ttl_index) {
134
- await this._col.createIndex({ _ttl_timestamp: 1 }, { expireAfterSeconds: desired_seconds });
135
- return;
136
- }
137
- if (ttl_index.expireAfterSeconds !== desired_seconds) {
138
- if (!ttl_index.name) {
139
- return;
140
- }
141
- await this._col.dropIndex(ttl_index.name);
142
- await this._col.createIndex({ _ttl_timestamp: 1 }, { expireAfterSeconds: desired_seconds });
143
- }
144
- }
145
- _process_doc(doc) {
146
- if (doc == null) {
147
- return;
148
- } else if (doc._content != null) {
149
- return doc._content;
150
- }
151
- return doc;
152
- }
153
- // Chunked methods.
154
- async _load_chunked(path, find_opts) {
155
- if (!this.initialized) {
156
- await this.init();
157
- }
158
- this.assert_init();
159
- let query = typeof path === "string" ? { _path: path, chunk: { $gte: 0 } } : { ...path, chunk: { $gte: 0 } };
160
- const chunks_cursor = this._col.find(query, find_opts).sort({ chunk: 1 });
161
- const chunks = await chunks_cursor.toArray();
162
- if (chunks.length === 0) {
163
- return null;
164
- }
165
- const buffer = Buffer.concat(chunks.map((chunk) => chunk.data.buffer));
166
- return (0, import_bson.deserialize)(buffer);
167
- }
168
- async _save_chunked(path, content) {
169
- if (!this.initialized) {
170
- await this.init();
171
- }
172
- this.assert_init();
173
- const buffer = (0, import_bson.serialize)(content);
174
- const new_chunk_count = Math.ceil(buffer.length / Collection.chunk_size);
175
- const ref_query = typeof path === "string" ? { _path: path, chunk: -1 } : { ...path, chunk: -1 };
176
- const object_ref = await this._col.findOne(ref_query);
177
- const old_chunk_count = object_ref ? object_ref.chunks : 0;
178
- const bulk_ops = [];
179
- for (let i = 0; i < buffer.length; i += Collection.chunk_size) {
180
- let query, update;
181
- if (typeof path === "string") {
182
- query = {
183
- _path: path,
184
- chunk: i / Collection.chunk_size
185
- };
186
- update = {
187
- chunk: i / Collection.chunk_size,
188
- data: buffer.slice(i, i + Collection.chunk_size)
189
- };
190
- } else {
191
- query = {
192
- ...path,
193
- chunk: i / Collection.chunk_size
194
- };
195
- update = {
196
- chunk: i / Collection.chunk_size,
197
- data: buffer.slice(i, i + Collection.chunk_size)
198
- };
199
- }
200
- const full_update2 = {
201
- $set: update
202
- };
203
- if (this.ttl_enabled) {
204
- full_update2["$setOnInsert"] = { _ttl_timestamp: /* @__PURE__ */ new Date() };
205
- }
206
- bulk_ops.push({
207
- updateOne: {
208
- filter: query,
209
- update: full_update2,
210
- upsert: true
211
- }
212
- });
213
- }
214
- const full_update = {
215
- $set: {
216
- chunk: -1,
217
- chunks: new_chunk_count
218
- }
219
- };
220
- if (this.ttl_enabled) {
221
- full_update["$setOnInsert"] = { _ttl_timestamp: /* @__PURE__ */ new Date() };
222
- }
223
- bulk_ops.push({
224
- updateOne: {
225
- filter: ref_query,
226
- update: full_update,
227
- upsert: true
228
- }
229
- });
230
- await this._col.bulkWrite(bulk_ops, { ordered: true });
231
- if (new_chunk_count < old_chunk_count) {
232
- ref_query.chunk = { $gte: new_chunk_count };
233
- await this._col.deleteMany(ref_query);
234
- }
235
- }
236
- // Get the raw and initialized mongo collection.
237
- async col() {
238
- await this.init();
239
- return this._col;
240
- }
241
- /** Create a reference. */
242
- ref(query, opts) {
243
- return new import_document.Document.Ref(query, opts ? { ...opts, col: this } : { col: this });
244
- }
245
- reference(query, opts) {
246
- return new import_document.Document.Ref(query, opts ? { ...opts, col: this } : { col: this });
247
- }
248
- /** Has index. */
249
- async has_index(index) {
250
- if (!this.initialized) {
251
- await this.init();
252
- }
253
- this.assert_init();
254
- return (await this._col.listIndexes().toArray()).some((x) => x.name === index);
255
- }
256
- /* @docs:
257
- @title: Create index
258
- @description: Creates indexes on collections.
259
- @return:
260
- Returns the document that was found or `null` when no document is found.
261
- @parameter:
262
- @name: keys
263
- @desc: The `keys` argument for the orignal mongodb `createIndex()` function.
264
- @parameter:
265
- @name: options
266
- @desc: The `options` argument for the orignal mongodb `createIndex()` function.
267
- @parameter:
268
- @name: commitQuorum
269
- @desc: The `commitQuorum` argument for the orignal mongodb `createIndex()` function.
270
- */
271
- async create_index(opts) {
272
- if (!this.initialized) {
273
- await this.init();
274
- }
275
- this.assert_init();
276
- let key, keys;
277
- let options;
278
- let forced = false;
279
- if (typeof opts === "string") {
280
- key = opts;
281
- } else {
282
- ({
283
- key,
284
- keys,
285
- options,
286
- forced = false
287
- } = opts);
288
- }
289
- let keys_obj = {};
290
- if (key) {
291
- keys_obj = {};
292
- keys_obj[key] = 1;
293
- } else if (Array.isArray(keys) && keys.length > 0) {
294
- keys_obj = {};
295
- for (const key2 of keys) {
296
- keys_obj[key2] = 1;
297
- }
298
- } else {
299
- throw new Error("Define one of the following parameters: [key, keys].");
300
- }
301
- if (forced) {
302
- try {
303
- await this._col.dropIndex(options?.name ?? Object.entries(keys_obj).map(([key2, value]) => `${key2}_${value}`).join("_"));
304
- } catch (err) {
305
- if (err.codeName !== "IndexNotFound") {
306
- throw err;
307
- }
308
- }
309
- }
310
- return await this._col.createIndex(keys_obj, options || {});
311
- }
312
- /* @docs:
313
- * @title: Find
314
- * @description: Find a document by a query.
315
- * @return:
316
- * Returns the document that was found or `null` when no document is found.
317
- * @parameter:
318
- * @name: query
319
- * @desc: The query options.
320
- * @type: object
321
- */
322
- async find(query) {
323
- if (!this.initialized) {
324
- await this.init();
325
- }
326
- this.assert_init();
327
- try {
328
- return this._process_doc(await this._col.findOne(query));
329
- } catch (error) {
330
- console.error(error);
331
- throw new Error("Encountered an error while finding the document.");
332
- }
333
- }
334
- async find_many(query) {
335
- if (!this.initialized) {
336
- await this.init();
337
- }
338
- this.assert_init();
339
- try {
340
- const list = await this._col.find(query).toArray();
341
- return list.map((i) => this._process_doc(i));
342
- } catch (error) {
343
- console.error(error);
344
- throw new Error("Encountered an error while finding the document.");
345
- }
346
- }
347
- /* @docs:
348
- * @title: Exists
349
- * @description: Check if a document exists.
350
- * @parameter:
351
- * @name: path
352
- * @description: The database path to the document.
353
- * @type: string
354
- */
355
- async exists(path) {
356
- if (!this.initialized) {
357
- await this.init();
358
- }
359
- this.assert_init();
360
- if (typeof path !== "string" && (typeof path !== "object" || path == null)) {
361
- throw Error(`Parameter "path" has an invalid type "${typeof path}", the valid type is "string".`);
362
- }
363
- try {
364
- const doc = await this._col.findOne(typeof path === "object" ? path : { _path: path }, { projection: { _id: 1 } });
365
- return doc != null;
366
- } catch (error) {
367
- console.error(error);
368
- throw new Error("Encountered an error while checking if the document exists.");
369
- }
370
- }
371
- /* @docs:
372
- * @title: Load
373
- * @description: Load data by path.
374
- * @return:
375
- * Returns the loaded document.
376
- *
377
- * Returns the `def` parameter when the data does not exist, keep in mind that when parameter `def` is an object it could be a reference to a defined variable.
378
- * @parameter:
379
- * @name: path
380
- * @description: The database path to the document.
381
- * @type: string
382
- * @parameter:
383
- * @name: opts
384
- * @desc: Additional options.
385
- * @type: null, object
386
- * @attribute:
387
- * @name: default
388
- * @description:
389
- * The default data to be returned when the data does not exist.
390
- *
391
- * When the type of attribute `default` is `object` then the keys that do not exist in the loaded object, but do exist in the default object will be inserted into the loaded object.
392
- * @type: null, object
393
- * @attribute:
394
- * @name: chunked
395
- * @description: Load a chunked document.
396
- * @type: null, object
397
- * @attribute:
398
- * @name: attributes
399
- * @description: The attributes to load.
400
- * @type: null, string[]
401
- */
402
- async load(path, opts = null) {
403
- if (!this.initialized) {
404
- await this.init();
405
- }
406
- this.assert_init();
407
- if (typeof path !== "string" && (typeof path !== "object" || path == null)) {
408
- throw Error(`Parameter "path" has an invalid type "${typeof path}", the valid type is "string".`);
409
- }
410
- if (opts && opts.projection && opts.chunked) {
411
- throw new Error("The `projection` and `chunked` options cannot be used together.");
412
- }
413
- try {
414
- let find_opts;
415
- if (opts) {
416
- if (opts.projection) {
417
- find_opts = { projection: opts.projection };
418
- } else if (opts.attributes) {
419
- find_opts = { projection: {
420
- _id: 1,
421
- _path: 1,
422
- _uid: 1
423
- } };
424
- opts.attributes.forEach((i) => {
425
- if (find_opts?.projection) {
426
- find_opts.projection[i] = 1;
427
- }
428
- });
429
- }
430
- }
431
- let doc;
432
- if (opts != null && opts.chunked === true) {
433
- doc = await this._load_chunked(path, find_opts);
434
- } else {
435
- doc = await this._col.findOne(typeof path === "object" ? path : { _path: path }, find_opts);
436
- }
437
- doc = this._process_doc(doc);
438
- if (doc == null) {
439
- if (opts != null && opts.default !== void 0) {
440
- return opts.default;
441
- }
442
- return;
443
- } else if (opts != null && typeof opts.default === "object" && opts.default != null && Array.isArray(opts.default) === false) {
444
- const set_defaults = (obj, defaults) => {
445
- Object.keys(defaults).forEach((key) => {
446
- if (obj[key] === void 0) {
447
- obj[key] = defaults[key];
448
- } else if (typeof obj[key] === "object" && !Array.isArray(obj[key]) && obj[key] != null && typeof defaults[key] === "object" && !Array.isArray(defaults[key]) && defaults[key] != null) {
449
- set_defaults(obj[key], defaults[key]);
450
- }
451
- });
452
- };
453
- set_defaults(doc, opts.default);
454
- }
455
- return doc;
456
- } catch (error) {
457
- console.error(error);
458
- throw new Error("Encountered an error while loading the document.");
459
- }
460
- }
461
- /* @docs:
462
- * @title: Save
463
- * @description: Save data by path. When the document already exists this function only updates the specified content attributes.
464
- * @return:
465
- * Returns the updated document.
466
- * @parameter:
467
- * @name: path
468
- * @description: The database path to the document.
469
- * @type: string
470
- * @parameter:
471
- * @name: data
472
- * @description: The data to save.
473
- * @type: null, boolean, number, string, array, object
474
- * @parameter:
475
- * @name: opts
476
- * @desc: Additional options.
477
- * @type: null, object
478
- * @attribute:
479
- * @name: chunked
480
- * @description: Chunk the document into multiple documents, therefore documents larger than 16MB are supported.
481
- * @warning: Currently this option is only supported for types `object` and `array`.
482
- * @default: false
483
- * @type: boolean
484
- * @attribute:
485
- * @name: bulk
486
- * @description: Get a bulk operation object, so several operations can be executed in bulk.
487
- * @default: false
488
- * @type: boolean
489
- * @attribute:
490
- * @name: set
491
- * @description: By default the $set attribute is used for the content, with `opts.set` disabled you can create your own instructions. The `content` attribute must reflect this.
492
- * @warning: This does not work in combination with `opts.chunked`.
493
- * @default: true
494
- * @type: boolean
495
- */
496
- async save(path, content, opts = null) {
497
- if (!this.initialized) {
498
- await this.init();
499
- }
500
- this.assert_init();
501
- if (typeof path !== "string" && (typeof path !== "object" || path == null)) {
502
- throw Error(`Parameter "path" has an invalid type "${typeof path}", the valid type is "string".`);
503
- }
504
- try {
505
- let doc, set;
506
- if (typeof content === "object" && Array.isArray(content) == false && content != null) {
507
- delete content._id;
508
- delete content._path;
509
- delete content._uid;
510
- delete content._ttl_timestamp;
511
- set = content;
512
- } else {
513
- set = { _content: content };
514
- }
515
- if (opts != null && opts.chunked === true) {
516
- await this._save_chunked(path, set);
517
- } else {
518
- if (opts == null || opts.set !== false) {
519
- set = { $set: set };
520
- }
521
- if (this.ttl_enabled) {
522
- if (set["$setOnInsert"] === void 0) {
523
- set["$setOnInsert"] = {};
524
- set["$setOnInsert"]._ttl_timestamp = /* @__PURE__ */ new Date();
525
- } else if (set["$setOnInsert"] != null && typeof set["$setOnInsert"] === "object") {
526
- set["$setOnInsert"]._ttl_timestamp = /* @__PURE__ */ new Date();
527
- } else {
528
- throw new Error(`Undefined behaviour: Unable to assign the $setOnInsert data for ttl control.`);
529
- }
530
- }
531
- if (opts != null && opts.bulk) {
532
- return {
533
- updateOne: {
534
- filter: typeof path === "object" ? path : { _path: path },
535
- update: set,
536
- upsert: true
537
- }
538
- };
539
- } else {
540
- await this._col.updateOne(typeof path === "object" ? path : { _path: path }, set, { upsert: true });
541
- }
542
- }
543
- return content;
544
- } catch (error) {
545
- console.error(error);
546
- throw new Error("Encountered an error while updating the document.");
547
- }
548
- }
549
- /** Update many. */
550
- async update_many(...args) {
551
- if (!this.initialized) {
552
- await this.init();
553
- }
554
- this.assert_init();
555
- return this._col.updateMany(...args);
556
- }
557
- // List.
558
- /* @docs:
559
- * @title: List
560
- * @description: List all child documents of directory path.
561
- * @parameter:
562
- * @name: path
563
- * @description: The database directory path.
564
- * @type: string
565
- * @parameter:
566
- * @name: options
567
- * @description: List options.
568
- * @type: object
569
- * @attribute:
570
- * @name: process
571
- * @description: Process the document. By default saved non object data will be stored under `_content`. Processing checks this attribute and uses that content instead when it is detected.
572
- * @type: boolean
573
- * @default: true
574
- * @attribute:
575
- * @name: projection
576
- * @description: The data attributes to retrieve, when left undefined all attributes are retrieved.
577
- * @type: object
578
- * @default: undefined
579
- */
580
- async list(path, options = {}) {
581
- if (!this.initialized) {
582
- await this.init();
583
- }
584
- this.assert_init();
585
- if (typeof path !== "string" && (typeof path !== "object" || path == null)) {
586
- throw Error(`Parameter "path" has an invalid type "${typeof path}", the valid type is "string".`);
587
- }
588
- if (typeof path === "string") {
589
- while (path.length > 0 && path.charAt(path.length - 1) === "/") {
590
- path = path.substr(0, path.length - 1);
591
- }
592
- if (path.length == 0) {
593
- throw Error("Invalid path.");
594
- }
595
- path = { _path: { $regex: `^${path}/` } };
596
- } else if (path._path) {
597
- let _path = path._path;
598
- while (_path.length > 0 && _path.charAt(_path.length - 1) === "/") {
599
- _path = _path.substr(0, _path.length - 1);
600
- }
601
- if (_path.length == 0) {
602
- throw Error("Invalid path.");
603
- }
604
- path._path = { $regex: `^${_path}/` };
605
- }
606
- try {
607
- const docs = await this._col.find(path, { projection: options.projection }).toArray();
608
- if (options.process === false) {
609
- return docs;
610
- }
611
- return docs.map((doc) => this._process_doc(doc));
612
- } catch (error) {
613
- console.error(error);
614
- throw new Error("Encountered an error while listing all documents.");
615
- }
616
- }
617
- /* @docs:
618
- * @title: List Query
619
- * @description: List all documents of the collection based on a query.
620
- * @parameter:
621
- * @name: query
622
- * @desc: The query options.
623
- * @type: object
624
- * @parameter:
625
- * @name: options
626
- * @description: List options.
627
- * @type: object
628
- * @attribute:
629
- * @name: process
630
- * @description: Process the document. By default saved non object data will be stored under `_content`. Processing checks this attribute and uses that content instead when it is detected.
631
- * @type: boolean
632
- * @default: true
633
- * @attribute:
634
- * @name: projection
635
- * @description: The data attributes to retrieve, when left undefined all attributes are retrieved.
636
- * @type: object
637
- * @default: undefined
638
- */
639
- async list_query(query = {}, options = {}) {
640
- if (!this.initialized) {
641
- await this.init();
642
- }
643
- this.assert_init();
644
- try {
645
- const docs = await this._col.find(query, { projection: options.projection }).toArray();
646
- if (options.process === false) {
647
- return docs;
648
- }
649
- return docs.map((doc) => this._process_doc(doc));
650
- } catch (error) {
651
- console.error(error);
652
- throw new Error("Encountered an error while listing all documents.");
653
- }
654
- }
655
- /* @docs:
656
- * @title: List All
657
- * @description: List all documents of the collection, optionally per uid.
658
- * @parameter:
659
- * @name: query
660
- * @ignore: true
661
- * @parameter:
662
- * @name: options
663
- * @description: List options.
664
- * @type: object
665
- * @attribute:
666
- * @name: process
667
- * @description: Process the document. By default saved non object data will be stored under `_content`. Processing checks this attribute and uses that content instead when it is detected.
668
- * @type: boolean
669
- * @default: true
670
- * @attribute:
671
- * @name: projection
672
- * @description: The data attributes to retrieve, when left undefined all attributes are retrieved.
673
- * @type: object
674
- * @default: undefined
675
- */
676
- async list_all(query = {}, options = {}) {
677
- if (!this.initialized) {
678
- await this.init();
679
- }
680
- this.assert_init();
681
- let docs;
682
- docs = await this._col.find(query, { projection: options.projection }).toArray();
683
- if (options.process === false) {
684
- return docs;
685
- }
686
- return docs.map((doc) => this._process_doc(doc));
687
- }
688
- /* @docs:
689
- * @title: Delete
690
- * @description: Delete a document of the collection by path.
691
- * @parameter:
692
- * @name: path
693
- * @description: The database path to the document.
694
- * @type: string
695
- * @parameter:
696
- * @name: opts
697
- * @desc: Additional options.
698
- * @type: null, object
699
- * @attribute:
700
- * @name: chunked
701
- * @description: Delete a chunked document.
702
- * @default: false
703
- * @type: boolean
704
- * @attribute:
705
- * @name: bulk
706
- * @description: Get a bulk operation object, so several operations can be executed in bulk.
707
- * @default: false
708
- * @type: boolean
709
- */
710
- async delete(path, opts) {
711
- if (!this.initialized) {
712
- await this.init();
713
- }
714
- this.assert_init();
715
- if (typeof path !== "string" && (typeof path !== "object" || path == null)) {
716
- throw Error(`Parameter "path" has an invalid type "${typeof path}", the valid type is "string".`);
717
- }
718
- try {
719
- if (opts != null && opts.chunked === true) {
720
- if (opts.bulk) {
721
- return { deleteMany: { filter: typeof path === "object" ? path : { _path: path } } };
722
- } else {
723
- await this._col.deleteMany(typeof path === "object" ? path : { _path: path });
724
- }
725
- } else {
726
- if (opts != null && opts.bulk) {
727
- return { deleteOne: { filter: typeof path === "object" ? path : { _path: path } } };
728
- } else {
729
- await this._col.deleteOne(typeof path === "object" ? path : { _path: path });
730
- }
731
- }
732
- } catch (error) {
733
- console.error(error);
734
- throw new Error("Encountered an error while deleting.");
735
- }
736
- }
737
- /* @docs:
738
- * @title: Delete Query
739
- * @description: Delete a document of the collection by query.
740
- * @parameter:
741
- * @name: query
742
- * @description: The query object.
743
- * @type: object
744
- */
745
- async delete_query(query = {}) {
746
- if (!this.initialized) {
747
- await this.init();
748
- }
749
- this.assert_init();
750
- if (typeof query !== "object" || query == null || Object.keys(query).length === 0) {
751
- throw Error(`Parameter "query" has an invalid type "${typeof query}", the valid type is "object".`);
752
- }
753
- if (Object.keys(query).length === 0) {
754
- throw Error(`Parameter "query" is an empty object.`);
755
- }
756
- await this._col.deleteMany(query);
757
- }
758
- // Delete all.
759
- async delete_all(path) {
760
- if (!this.initialized) {
761
- await this.init();
762
- }
763
- this.assert_init();
764
- if (typeof path !== "string" && (typeof path !== "object" || path == null)) {
765
- throw Error(`Parameter "path" has an invalid type "${typeof path}", the valid type is "string".`);
766
- }
767
- try {
768
- await this._col.deleteMany(typeof path === "object" ? path : { _path: path });
769
- } catch (error) {
770
- console.error(error);
771
- throw new Error("Encountered an error while deleting.");
772
- }
773
- }
774
- async delete_many(query) {
775
- if (!this.initialized) {
776
- await this.init();
777
- }
778
- this.assert_init();
779
- try {
780
- await this._col.deleteMany(query);
781
- } catch (error) {
782
- console.error(error);
783
- throw new Error("Encountered an error while deleting.");
784
- }
785
- }
786
- /* @docs:
787
- * @title: Delete Collection
788
- * @description: Delete all documents of from the collection.
789
- */
790
- async delete_collection() {
791
- if (!this.initialized) {
792
- await this.init();
793
- }
794
- this.assert_init();
795
- await this._col.deleteMany();
796
- await this._col.drop();
797
- }
798
- /* @docs:
799
- // * @title: Clean document
800
- // * @description: Clean a document from all default system attributes.
801
- // */
802
- clean(doc) {
803
- if (doc == null) {
804
- return doc;
805
- }
806
- if (typeof doc === "object") {
807
- delete doc._id;
808
- delete doc._path;
809
- if (this.ttl_enabled) {
810
- delete doc._ttl_timestamp;
811
- }
812
- }
813
- return doc;
814
- }
815
- /** Write bulk operations. */
816
- async bulk_operations(operations = []) {
817
- if (!this.initialized) {
818
- await this.init();
819
- }
820
- this.assert_init();
821
- return await this._col.bulkWrite(operations, { ordered: true });
822
- }
823
- async aggregate(pipeline, opts) {
824
- if (!this.initialized) {
825
- await this.init();
826
- }
827
- this.assert_init();
828
- const out = this._col.aggregate(pipeline);
829
- if (opts?.cursor) {
830
- return out;
831
- }
832
- const arr = await out.toArray();
833
- if (opts?.clean === true) {
834
- return arr.map((doc) => this.clean(doc)).filter((x) => x != null);
835
- }
836
- return arr;
837
- }
838
- }
839
- // Annotate the CommonJS export names for ESM import in node:
840
- 0 && (module.exports = {
841
- Collection
842
- });