cyberia 3.1.3 → 3.2.9

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 (377) hide show
  1. package/.env.example +0 -2
  2. package/.github/workflows/engine-cyberia.cd.yml +10 -8
  3. package/.github/workflows/engine-cyberia.ci.yml +12 -29
  4. package/.github/workflows/ghpkg.ci.yml +4 -4
  5. package/.github/workflows/npmpkg.ci.yml +28 -11
  6. package/.github/workflows/publish.ci.yml +21 -2
  7. package/.github/workflows/pwa-microservices-template-page.cd.yml +4 -5
  8. package/.github/workflows/pwa-microservices-template-test.ci.yml +3 -3
  9. package/.github/workflows/release.cd.yml +14 -10
  10. package/CHANGELOG.md +783 -1
  11. package/CLI-HELP.md +95 -18
  12. package/Dockerfile +0 -2
  13. package/README.md +290 -220
  14. package/bin/build.js +24 -7
  15. package/bin/cyberia.js +2838 -252
  16. package/bin/deploy.js +747 -125
  17. package/bin/file.js +9 -0
  18. package/bin/index.js +2838 -252
  19. package/bin/vs.js +1 -1
  20. package/conf.js +99 -65
  21. package/deployment.yaml +18 -164
  22. package/hardhat/hardhat.config.js +13 -13
  23. package/hardhat/ignition/modules/ObjectLayerToken.js +1 -1
  24. package/hardhat/package-lock.json +2559 -5864
  25. package/hardhat/package.json +14 -23
  26. package/hardhat/scripts/deployObjectLayerToken.js +1 -1
  27. package/hardhat/test/ObjectLayerToken.js +4 -2
  28. package/hardhat/types/ethers-contracts/ObjectLayerToken.ts +690 -0
  29. package/hardhat/types/ethers-contracts/common.ts +92 -0
  30. package/hardhat/types/ethers-contracts/factories/ObjectLayerToken__factory.ts +1055 -0
  31. package/hardhat/types/ethers-contracts/factories/index.ts +4 -0
  32. package/hardhat/types/ethers-contracts/hardhat.d.ts +47 -0
  33. package/hardhat/types/ethers-contracts/index.ts +6 -0
  34. package/jsconfig.json +1 -1
  35. package/manifests/cronjobs/dd-cron/dd-cron-backup.yaml +6 -5
  36. package/manifests/cronjobs/dd-cron/dd-cron-dns.yaml +6 -5
  37. package/manifests/deployment/dd-cyberia-development/deployment.yaml +18 -164
  38. package/manifests/deployment/dd-cyberia-development/proxy.yaml +7 -79
  39. package/manifests/deployment/dd-default-development/deployment.yaml +2 -6
  40. package/manifests/deployment/dd-test-development/deployment.yaml +112 -28
  41. package/manifests/deployment/dd-test-development/proxy.yaml +46 -1
  42. package/manifests/deployment/playwright/deployment.yaml +1 -1
  43. package/nodemon.json +1 -1
  44. package/package.json +39 -24
  45. package/proxy.yaml +7 -79
  46. package/scripts/k3s-node-setup.sh +2 -2
  47. package/scripts/nat-iptables.sh +103 -18
  48. package/scripts/rhel-grpc-setup.sh +56 -0
  49. package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.controller.js +58 -14
  50. package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.model.js +23 -14
  51. package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.router.js +5 -0
  52. package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.service.js +148 -20
  53. package/src/api/core/core.controller.js +10 -10
  54. package/src/api/core/core.service.js +10 -10
  55. package/src/api/crypto/crypto.controller.js +8 -8
  56. package/src/api/crypto/crypto.service.js +8 -8
  57. package/src/api/cyberia-action/cyberia-action.controller.js +74 -0
  58. package/src/api/cyberia-action/cyberia-action.model.js +87 -0
  59. package/src/api/cyberia-action/cyberia-action.router.js +27 -0
  60. package/src/api/cyberia-action/cyberia-action.service.js +42 -0
  61. package/src/api/cyberia-dialogue/cyberia-dialogue.controller.js +93 -0
  62. package/src/api/cyberia-dialogue/cyberia-dialogue.model.js +36 -0
  63. package/src/api/cyberia-dialogue/cyberia-dialogue.router.js +29 -0
  64. package/src/api/cyberia-dialogue/cyberia-dialogue.service.js +51 -0
  65. package/src/api/cyberia-entity/cyberia-entity.controller.js +74 -0
  66. package/src/api/cyberia-entity/cyberia-entity.model.js +24 -0
  67. package/src/api/cyberia-entity/cyberia-entity.router.js +27 -0
  68. package/src/api/cyberia-entity/cyberia-entity.service.js +42 -0
  69. package/src/api/cyberia-instance/cyberia-fallback-world.js +178 -0
  70. package/src/api/cyberia-instance/cyberia-instance.controller.js +92 -0
  71. package/src/api/cyberia-instance/cyberia-instance.model.js +87 -0
  72. package/src/api/cyberia-instance/cyberia-instance.router.js +63 -0
  73. package/src/api/cyberia-instance/cyberia-instance.service.js +156 -0
  74. package/src/api/cyberia-instance/cyberia-portal-connector.js +260 -0
  75. package/src/api/cyberia-instance/cyberia-world-generator.js +505 -0
  76. package/src/api/cyberia-instance-conf/cyberia-instance-conf.controller.js +74 -0
  77. package/src/api/cyberia-instance-conf/cyberia-instance-conf.defaults.js +574 -0
  78. package/src/api/cyberia-instance-conf/cyberia-instance-conf.model.js +231 -0
  79. package/src/api/cyberia-instance-conf/cyberia-instance-conf.router.js +27 -0
  80. package/src/api/cyberia-instance-conf/cyberia-instance-conf.service.js +46 -0
  81. package/src/api/cyberia-map/cyberia-map.controller.js +79 -0
  82. package/src/api/cyberia-map/cyberia-map.model.js +30 -0
  83. package/src/api/cyberia-map/cyberia-map.router.js +40 -0
  84. package/src/api/cyberia-map/cyberia-map.service.js +74 -0
  85. package/src/api/cyberia-quest/cyberia-quest.controller.js +74 -0
  86. package/src/api/cyberia-quest/cyberia-quest.model.js +67 -0
  87. package/src/api/cyberia-quest/cyberia-quest.router.js +27 -0
  88. package/src/api/cyberia-quest/cyberia-quest.service.js +42 -0
  89. package/src/api/cyberia-quest-progress/cyberia-quest-progress.controller.js +74 -0
  90. package/src/api/cyberia-quest-progress/cyberia-quest-progress.model.js +49 -0
  91. package/src/api/cyberia-quest-progress/cyberia-quest-progress.router.js +27 -0
  92. package/src/api/cyberia-quest-progress/cyberia-quest-progress.service.js +42 -0
  93. package/src/api/default/default.controller.js +10 -10
  94. package/src/api/default/default.service.js +10 -10
  95. package/src/api/document/document.controller.js +12 -12
  96. package/src/api/document/document.model.js +10 -16
  97. package/src/api/file/file.controller.js +8 -8
  98. package/src/api/file/file.model.js +10 -10
  99. package/src/api/file/file.ref.json +18 -0
  100. package/src/api/file/file.service.js +36 -36
  101. package/src/api/instance/instance.controller.js +10 -10
  102. package/src/api/instance/instance.model.js +4 -10
  103. package/src/api/instance/instance.service.js +10 -10
  104. package/src/api/ipfs/ipfs.controller.js +15 -36
  105. package/src/api/ipfs/ipfs.model.js +47 -47
  106. package/src/api/ipfs/ipfs.router.js +8 -13
  107. package/src/api/ipfs/ipfs.service.js +67 -129
  108. package/src/api/object-layer/object-layer.controller.js +12 -12
  109. package/src/api/object-layer/object-layer.model.js +4 -17
  110. package/src/api/object-layer/object-layer.router.js +30 -0
  111. package/src/api/object-layer/object-layer.service.js +126 -43
  112. package/src/api/object-layer-render-frames/object-layer-render-frames.controller.js +10 -10
  113. package/src/api/object-layer-render-frames/object-layer-render-frames.model.js +6 -16
  114. package/src/api/object-layer-render-frames/object-layer-render-frames.service.js +18 -14
  115. package/src/api/test/test.controller.js +8 -8
  116. package/src/api/test/test.service.js +8 -8
  117. package/src/api/user/guest.service.js +99 -0
  118. package/src/api/user/user.controller.js +6 -6
  119. package/src/api/user/user.model.js +8 -13
  120. package/src/api/user/user.service.js +11 -27
  121. package/src/cli/cluster.js +68 -21
  122. package/src/cli/db.js +753 -825
  123. package/src/cli/deploy.js +215 -125
  124. package/src/cli/env.js +29 -0
  125. package/src/cli/fs.js +82 -8
  126. package/src/cli/image.js +43 -1
  127. package/src/cli/index.js +74 -3
  128. package/src/cli/kubectl.js +211 -0
  129. package/src/cli/release.js +340 -0
  130. package/src/cli/repository.js +475 -74
  131. package/src/cli/run.js +582 -43
  132. package/src/cli/secrets.js +73 -0
  133. package/src/cli/ssh.js +1 -1
  134. package/src/cli/static.js +43 -115
  135. package/src/cli/test.js +3 -3
  136. package/src/client/Cryptokoyn.index.js +18 -22
  137. package/src/client/CyberiaPortal.index.js +19 -24
  138. package/src/client/Default.index.js +21 -34
  139. package/src/client/Itemledger.index.js +20 -27
  140. package/src/client/Underpost.index.js +19 -24
  141. package/src/client/components/core/404.js +4 -4
  142. package/src/client/components/core/500.js +4 -4
  143. package/src/client/components/core/Account.js +73 -60
  144. package/src/client/components/core/AgGrid.js +23 -33
  145. package/src/client/components/core/Alert.js +12 -13
  146. package/src/client/components/core/AppStore.js +69 -0
  147. package/src/client/components/core/Auth.js +35 -37
  148. package/src/client/components/core/Badge.js +7 -13
  149. package/src/client/components/core/BtnIcon.js +15 -17
  150. package/src/client/components/core/CalendarCore.js +43 -64
  151. package/src/client/components/core/Chat.js +13 -15
  152. package/src/client/components/core/ClientEvents.js +87 -0
  153. package/src/client/components/core/ColorPaletteElement.js +309 -0
  154. package/src/client/components/core/Content.js +17 -14
  155. package/src/client/components/core/Css.js +15 -71
  156. package/src/client/components/core/CssCore.js +12 -16
  157. package/src/client/components/core/D3Chart.js +4 -4
  158. package/src/client/components/core/Docs.js +64 -91
  159. package/src/client/components/core/DropDown.js +194 -96
  160. package/src/client/components/core/EventBus.js +92 -0
  161. package/src/client/components/core/EventsUI.js +14 -17
  162. package/src/client/components/core/FileExplorer.js +96 -228
  163. package/src/client/components/core/FullScreen.js +47 -75
  164. package/src/client/components/core/Input.js +24 -69
  165. package/src/client/components/core/Keyboard.js +26 -19
  166. package/src/client/components/core/KeyboardAvoidance.js +145 -0
  167. package/src/client/components/core/LoadingAnimation.js +25 -31
  168. package/src/client/components/core/LogIn.js +43 -43
  169. package/src/client/components/core/LogOut.js +25 -16
  170. package/src/client/components/core/Modal.js +462 -179
  171. package/src/client/components/core/NotificationManager.js +14 -18
  172. package/src/client/components/core/Panel.js +54 -51
  173. package/src/client/components/core/PanelForm.js +44 -144
  174. package/src/client/components/core/Polyhedron.js +110 -214
  175. package/src/client/components/core/PublicProfile.js +39 -32
  176. package/src/client/components/core/Recover.js +48 -44
  177. package/src/client/components/core/Responsive.js +88 -32
  178. package/src/client/components/core/RichText.js +9 -18
  179. package/src/client/components/core/Router.js +24 -3
  180. package/src/client/components/core/SearchBox.js +37 -37
  181. package/src/client/components/core/SignUp.js +39 -30
  182. package/src/client/components/core/SocketIo.js +112 -30
  183. package/src/client/components/core/SocketIoHandler.js +75 -0
  184. package/src/client/components/core/Stream.js +143 -95
  185. package/src/client/components/core/ToggleSwitch.js +8 -20
  186. package/src/client/components/core/ToolTip.js +5 -17
  187. package/src/client/components/core/Translate.js +56 -59
  188. package/src/client/components/core/Validator.js +26 -16
  189. package/src/client/components/core/Wallet.js +15 -26
  190. package/src/client/components/core/Webhook.js +40 -7
  191. package/src/client/components/core/Worker.js +163 -27
  192. package/src/client/components/core/windowGetDimensions.js +7 -7
  193. package/src/client/components/cryptokoyn/{MenuCryptokoyn.js → AppShellCryptokoyn.js} +59 -59
  194. package/src/client/components/cryptokoyn/AppStoreCryptokoyn.js +5 -0
  195. package/src/client/components/cryptokoyn/CssCryptokoyn.js +15 -15
  196. package/src/client/components/cryptokoyn/LogInCryptokoyn.js +9 -7
  197. package/src/client/components/cryptokoyn/LogOutCryptokoyn.js +8 -6
  198. package/src/client/components/cryptokoyn/RouterCryptokoyn.js +37 -0
  199. package/src/client/components/cryptokoyn/SettingsCryptokoyn.js +4 -4
  200. package/src/client/components/cryptokoyn/SignUpCryptokoyn.js +6 -4
  201. package/src/client/components/cryptokoyn/SocketIoCryptokoyn.js +3 -51
  202. package/src/client/components/cyberia/InstanceEngineCyberia.js +781 -0
  203. package/src/client/components/cyberia/MapEngineCyberia.js +1836 -2
  204. package/src/client/components/cyberia/ObjectLayerEngine.js +19 -0
  205. package/src/client/components/cyberia/ObjectLayerEngineModal.js +1220 -99
  206. package/src/client/components/cyberia/ObjectLayerEngineViewer.js +252 -316
  207. package/src/client/components/cyberia-portal/{MenuCyberiaPortal.js → AppShellCyberiaPortal.js} +136 -103
  208. package/src/client/components/cyberia-portal/AppStoreCyberiaPortal.js +5 -0
  209. package/src/client/components/cyberia-portal/CommonCyberiaPortal.js +462 -32
  210. package/src/client/components/cyberia-portal/CssCyberiaPortal.js +15 -15
  211. package/src/client/components/cyberia-portal/LogInCyberiaPortal.js +9 -7
  212. package/src/client/components/cyberia-portal/LogOutCyberiaPortal.js +8 -6
  213. package/src/client/components/cyberia-portal/MainBodyCyberiaPortal.js +4 -4
  214. package/src/client/components/cyberia-portal/RouterCyberiaPortal.js +60 -0
  215. package/src/client/components/cyberia-portal/SettingsCyberiaPortal.js +4 -4
  216. package/src/client/components/cyberia-portal/SignUpCyberiaPortal.js +6 -4
  217. package/src/client/components/cyberia-portal/SocketIoCyberiaPortal.js +3 -49
  218. package/src/client/components/cyberia-portal/TranslateCyberiaPortal.js +8 -4
  219. package/src/client/components/default/{MenuDefault.js → AppShellDefault.js} +91 -91
  220. package/src/client/components/default/AppStoreDefault.js +5 -0
  221. package/src/client/components/default/CssDefault.js +12 -12
  222. package/src/client/components/default/LogInDefault.js +9 -7
  223. package/src/client/components/default/LogOutDefault.js +8 -6
  224. package/src/client/components/default/RouterDefault.js +47 -0
  225. package/src/client/components/default/SettingsDefault.js +4 -4
  226. package/src/client/components/default/SignUpDefault.js +6 -4
  227. package/src/client/components/default/SocketIoDefault.js +3 -51
  228. package/src/client/components/default/TranslateDefault.js +3 -3
  229. package/src/client/components/itemledger/{MenuItemledger.js → AppShellItemledger.js} +59 -59
  230. package/src/client/components/itemledger/AppStoreItemledger.js +5 -0
  231. package/src/client/components/itemledger/CssItemledger.js +15 -15
  232. package/src/client/components/itemledger/LogInItemledger.js +9 -7
  233. package/src/client/components/itemledger/LogOutItemledger.js +8 -6
  234. package/src/client/components/itemledger/RouterItemledger.js +38 -0
  235. package/src/client/components/itemledger/SettingsItemledger.js +4 -4
  236. package/src/client/components/itemledger/SignUpItemledger.js +6 -4
  237. package/src/client/components/itemledger/SocketIoItemledger.js +3 -51
  238. package/src/client/components/itemledger/TranslateItemledger.js +3 -3
  239. package/src/client/components/underpost/{MenuUnderpost.js → AppShellUnderpost.js} +92 -92
  240. package/src/client/components/underpost/AppStoreUnderpost.js +5 -0
  241. package/src/client/components/underpost/CssUnderpost.js +14 -14
  242. package/src/client/components/underpost/CyberpunkBloggerUnderpost.js +4 -4
  243. package/src/client/components/underpost/DocumentSearchProvider.js +1 -1
  244. package/src/client/components/underpost/LabGalleryUnderpost.js +12 -15
  245. package/src/client/components/underpost/LogInUnderpost.js +9 -7
  246. package/src/client/components/underpost/LogOutUnderpost.js +8 -6
  247. package/src/client/components/underpost/RouterUnderpost.js +45 -0
  248. package/src/client/components/underpost/SettingsUnderpost.js +4 -4
  249. package/src/client/components/underpost/SignUpUnderpost.js +6 -4
  250. package/src/client/components/underpost/SocketIoUnderpost.js +3 -51
  251. package/src/client/components/underpost/TranslateUnderpost.js +4 -4
  252. package/src/client/public/cyberia-docs/ACTION-SYSTEM.md +235 -0
  253. package/src/client/public/cyberia-docs/ARCHITECTURE.md +443 -0
  254. package/src/client/public/cyberia-docs/CYBERIA-CLI.md +417 -0
  255. package/src/client/public/cyberia-docs/CYBERIA-CLIENT.md +313 -0
  256. package/src/client/public/cyberia-docs/CYBERIA-SERVER.md +260 -0
  257. package/src/client/public/cyberia-docs/ENTITY-PROFILE.md +241 -0
  258. package/src/client/public/cyberia-docs/HARDHAT-MODULE.md +300 -0
  259. package/src/client/public/cyberia-docs/OFF-CHAIN-ECONOMY.md +279 -0
  260. package/src/client/public/cyberia-docs/QUEST-SYSTEM.md +206 -0
  261. package/src/client/public/cyberia-docs/ROADMAP.md +240 -0
  262. package/src/client/public/cyberia-docs/WHITE-PAPER.md +732 -0
  263. package/src/client/services/atlas-sprite-sheet/atlas-sprite-sheet.service.js +14 -20
  264. package/src/client/services/core/core.service.js +35 -55
  265. package/src/client/services/crypto/crypto.service.js +8 -13
  266. package/src/client/services/cyberia-action/cyberia-action.service.js +99 -0
  267. package/src/client/services/cyberia-dialogue/cyberia-dialogue.service.js +99 -0
  268. package/src/client/services/cyberia-entity/cyberia-entity.management.js +57 -0
  269. package/src/client/services/cyberia-entity/cyberia-entity.service.js +99 -0
  270. package/src/client/services/cyberia-instance/cyberia-instance.management.js +194 -0
  271. package/src/client/services/cyberia-instance/cyberia-instance.service.js +116 -0
  272. package/src/client/services/cyberia-instance-conf/cyberia-instance-conf.service.js +99 -0
  273. package/src/client/services/cyberia-map/cyberia-map.management.js +193 -0
  274. package/src/client/services/cyberia-map/cyberia-map.service.js +120 -0
  275. package/src/client/services/cyberia-quest/cyberia-quest.service.js +99 -0
  276. package/src/client/services/cyberia-quest-progress/cyberia-quest-progress.service.js +99 -0
  277. package/src/client/services/default/default.management.js +159 -267
  278. package/src/client/services/default/default.service.js +10 -16
  279. package/src/client/services/document/document.service.js +14 -19
  280. package/src/client/services/file/file.service.js +8 -13
  281. package/src/client/services/instance/instance.management.js +6 -6
  282. package/src/client/services/instance/instance.service.js +10 -15
  283. package/src/client/services/ipfs/ipfs.service.js +14 -40
  284. package/src/client/services/object-layer/object-layer.management.js +14 -14
  285. package/src/client/services/object-layer/object-layer.service.js +39 -24
  286. package/src/client/services/object-layer-render-frames/object-layer-render-frames.service.js +10 -16
  287. package/src/client/services/test/test.service.js +8 -13
  288. package/src/client/services/user/guest.service.js +86 -0
  289. package/src/client/services/user/user.management.js +6 -6
  290. package/src/client/services/user/user.service.js +14 -20
  291. package/src/client/ssr/body/404.js +3 -3
  292. package/src/client/ssr/body/500.js +3 -3
  293. package/src/client/ssr/body/CacheControl.js +5 -2
  294. package/src/client/ssr/body/DefaultSplashScreen.js +19 -12
  295. package/src/client/ssr/body/UnderpostDefaultSplashScreen.js +13 -6
  296. package/src/client/ssr/head/PwaItemledger.js +197 -60
  297. package/src/client/ssr/mailer/DefaultRecoverEmail.js +19 -20
  298. package/src/client/ssr/mailer/DefaultVerifyEmail.js +15 -16
  299. package/src/client/ssr/offline/Maintenance.js +12 -11
  300. package/src/client/ssr/offline/NoNetworkConnection.js +3 -3
  301. package/src/client/ssr/pages/CyberiaServerMetrics.js +1 -1
  302. package/src/client/ssr/pages/Test.js +2 -2
  303. package/src/client/sw/core.sw.js +212 -0
  304. package/src/grpc/cyberia/grpc-server.js +642 -0
  305. package/src/index.js +24 -1
  306. package/src/runtime/cyberia-client/Dockerfile +80 -0
  307. package/src/runtime/cyberia-server/Dockerfile +37 -0
  308. package/src/runtime/express/Dockerfile +5 -1
  309. package/src/runtime/express/Express.js +18 -1
  310. package/src/runtime/lampp/Dockerfile +17 -5
  311. package/src/runtime/lampp/Lampp.js +27 -4
  312. package/src/runtime/wp/Dockerfile +62 -0
  313. package/src/runtime/wp/Wp.js +639 -0
  314. package/src/server/atlas-sprite-sheet-generator.js +4 -2
  315. package/src/server/auth.js +24 -1
  316. package/src/server/backup.js +37 -9
  317. package/src/server/client-build-docs.js +52 -46
  318. package/src/server/client-build.js +356 -82
  319. package/src/server/client-formatted.js +140 -57
  320. package/src/server/conf.js +29 -13
  321. package/src/server/cron.js +25 -23
  322. package/src/server/data-query.js +32 -20
  323. package/src/server/dns.js +24 -1
  324. package/src/server/ipfs-client.js +253 -89
  325. package/src/server/object-layer.js +150 -114
  326. package/src/server/peer.js +8 -0
  327. package/src/server/process.js +13 -27
  328. package/src/server/runtime.js +25 -1
  329. package/src/server/semantic-layer-generator-floor.js +319 -0
  330. package/src/server/semantic-layer-generator-resource.js +259 -0
  331. package/src/server/semantic-layer-generator-skin.js +1164 -0
  332. package/src/server/semantic-layer-generator.js +211 -542
  333. package/src/server/shape-generator.js +108 -0
  334. package/src/server/start.js +19 -5
  335. package/src/server/valkey.js +141 -235
  336. package/src/ws/IoInterface.js +1 -10
  337. package/src/ws/IoServer.js +14 -33
  338. package/src/ws/core/channels/core.ws.chat.js +65 -20
  339. package/src/ws/core/channels/core.ws.mailer.js +113 -32
  340. package/src/ws/core/channels/core.ws.stream.js +90 -31
  341. package/src/ws/core/core.ws.connection.js +12 -33
  342. package/src/ws/core/core.ws.emit.js +10 -26
  343. package/src/ws/core/core.ws.server.js +25 -58
  344. package/src/ws/default/channels/default.ws.main.js +53 -12
  345. package/src/ws/default/default.ws.connection.js +26 -13
  346. package/src/ws/default/default.ws.server.js +30 -12
  347. package/tsconfig.docs.json +15 -0
  348. package/typedoc.dd-cyberia.json +29 -0
  349. package/typedoc.json +29 -0
  350. package/WHITE-PAPER.md +0 -1540
  351. package/hardhat/README.md +0 -531
  352. package/hardhat/WHITE-PAPER.md +0 -1540
  353. package/jsdoc.dd-cyberia.json +0 -59
  354. package/jsdoc.json +0 -59
  355. package/src/api/object-layer/README.md +0 -347
  356. package/src/client/components/core/ColorPalette.js +0 -5267
  357. package/src/client/components/core/JoyStick.js +0 -80
  358. package/src/client/components/cryptokoyn/CommonCryptokoyn.js +0 -29
  359. package/src/client/components/cryptokoyn/ElementsCryptokoyn.js +0 -38
  360. package/src/client/components/cryptokoyn/RoutesCryptokoyn.js +0 -39
  361. package/src/client/components/cyberia-portal/ElementsCyberiaPortal.js +0 -38
  362. package/src/client/components/cyberia-portal/RoutesCyberiaPortal.js +0 -58
  363. package/src/client/components/cyberia-portal/ServerCyberiaPortal.js +0 -136
  364. package/src/client/components/default/ElementsDefault.js +0 -38
  365. package/src/client/components/default/RoutesDefault.js +0 -49
  366. package/src/client/components/itemledger/CommonItemledger.js +0 -29
  367. package/src/client/components/itemledger/ElementsItemledger.js +0 -38
  368. package/src/client/components/itemledger/RoutesItemledger.js +0 -40
  369. package/src/client/components/underpost/CommonUnderpost.js +0 -29
  370. package/src/client/components/underpost/ElementsUnderpost.js +0 -38
  371. package/src/client/components/underpost/RoutesUnderpost.js +0 -47
  372. package/src/client/sw/default.sw.js +0 -127
  373. package/src/client/sw/template.sw.js +0 -84
  374. package/src/ws/core/management/core.ws.chat.js +0 -8
  375. package/src/ws/core/management/core.ws.mailer.js +0 -16
  376. package/src/ws/core/management/core.ws.stream.js +0 -8
  377. package/src/ws/default/management/default.ws.main.js +0 -8
@@ -1,87 +1,170 @@
1
1
  /**
2
- * Module for formatting client-side code
2
+ * Module for formatting client-side code using esbuild for import rewriting and minification.
3
3
  * @module src/server/client-formatted.js
4
4
  * @namespace clientFormatted
5
5
  */
6
6
 
7
7
  'use strict';
8
8
 
9
+ import * as esbuild from 'esbuild';
10
+ import fs from 'fs-extra';
11
+ import * as path from 'path';
12
+
13
+ /**
14
+ * Escapes a string for safe use inside a RegExp.
15
+ * @param {string} s - The string to escape.
16
+ * @returns {string} The escaped string.
17
+ * @memberof clientFormatted
18
+ */
19
+ const escapeRegExp = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
20
+
9
21
  /**
10
- * Formats a source code string by removing 'html`' and 'css`' tags from template literals.
22
+ * Formats a source code string by removing 'html`' and 'css`' tagged template prefixes.
23
+ * Used for SSR VM execution where the full esbuild pipeline is not needed.
11
24
  * @param {string} src - The source code string.
12
25
  * @returns {string} The formatted source code.
13
26
  * @memberof clientFormatted
14
27
  */
15
- const srcFormatted = (src) =>
16
- src
17
- .replaceAll(' html`', '`')
18
- .replaceAll(' css`', '`')
19
- .replaceAll('{html`', '{`')
20
- .replaceAll('{css`', '{`')
21
- .replaceAll('(html`', '(`')
22
- .replaceAll('(css`', '(`')
23
- .replaceAll('[html`', '[`')
24
- .replaceAll('[css`', '[`');
28
+ const srcFormatted = (src) => src.replace(/(?<=[\s({[,;=+!?:^])(html|css)`/g, '`');
29
+
30
+ const resolveBrowserImportPath = (basePrefix, relativePath) => {
31
+ if (/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(basePrefix)) {
32
+ return new URL(relativePath, basePrefix.endsWith('/') ? basePrefix : `${basePrefix}/`).toString();
33
+ }
34
+ return path.posix.normalize(`${basePrefix}${relativePath}`);
35
+ };
25
36
 
26
37
  /**
27
38
  * Converts a JavaScript object into a string that can be embedded in client-side code
28
39
  * and parsed back into an object (e.g., 'JSON.parse(`{...}`)').
40
+ * Escapes backticks and template expression markers for safe template literal embedding.
29
41
  * @param {*} data - The data to be stringified.
30
42
  * @returns {string} A string representing the code to parse the JSON data.
31
43
  * @memberof clientFormatted
32
44
  */
33
- const JSONweb = (data) => 'JSON.parse(`' + JSON.stringify(data) + '`)';
45
+ const JSONweb = (data) => {
46
+ const json = JSON.stringify(data).replace(/`/g, '\\`').replace(/\$\{/g, '\\${');
47
+ return 'JSON.parse(`' + json + '`)';
48
+ };
34
49
 
35
50
  /**
36
- * Formats a component's source code by rewriting its import paths to be absolute for browser consumption.
37
- * @param {string} src - The source code of the component.
38
- * @param {string} module - The name of the module/component.
39
- * @param {Array<object>} dists - An array of distribution objects with import names.
40
- * @param {string} proxyPath - The proxy path for the application.
41
- * @param {string} [componentBasePath=''] - The base path for components.
42
- * @param {string} [baseHost=''] - The base host URL.
43
- * @returns {string} The formatted source code with updated import paths.
51
+ * Creates an esbuild plugin that rewrites import paths for browser consumption.
52
+ * Handles dist library imports, relative imports, and marks all remaining imports as external.
53
+ * @param {object} options
54
+ * @param {Array<object>} [options.dists=[]] - Distribution objects with import_name and import_name_build.
55
+ * @param {string} options.proxyPath - The proxy path for the application.
56
+ * @param {string} [options.basePath=''] - The base path for the module type (e.g., 'components', 'services').
57
+ * @param {string} [options.module=''] - The module/component name for relative import resolution.
58
+ * @param {string} [options.baseHost=''] - The base host URL.
59
+ * @returns {import('esbuild').Plugin}
44
60
  * @memberof clientFormatted
45
61
  */
46
- const componentFormatted = (src, module, dists, proxyPath, componentBasePath = '', baseHost = '') => {
47
- dists.map(
48
- (dist) =>
49
- (src = src.replaceAll(
50
- `from '${dist.import_name}'`,
51
- `from '${baseHost}${proxyPath !== '/' ? `${proxyPath}` : ''}${dist.import_name_build}'`,
52
- )),
53
- );
54
- return src
55
- .replaceAll(
56
- `from '../`,
57
- `from '${baseHost}${proxyPath !== '/' ? `${proxyPath}/` : '/'}${
58
- componentBasePath === '' ? `` : `${componentBasePath}/`
59
- }`,
60
- )
61
- .replaceAll(
62
- `from './`,
63
- `from '${baseHost}${proxyPath !== '/' ? `${proxyPath}/` : '/'}${
64
- componentBasePath === '' ? `` : `${componentBasePath}/`
65
- }${module}/`,
66
- );
67
- };
62
+ const importRewritePlugin = ({
63
+ dists = [],
64
+ proxyPath,
65
+ basePath = '',
66
+ module = '',
67
+ baseHost = '',
68
+ externalizeBareImports = true,
69
+ }) => ({
70
+ name: 'import-rewrite',
71
+ setup(build) {
72
+ const prefix = `${baseHost}${proxyPath !== '/' ? `${proxyPath}/` : '/'}`;
73
+
74
+ // Rewrite dist library imports (e.g., '@neodrag/vanilla' '/proxyPath/dist/@neodrag-vanilla/index.js')
75
+ if (dists) {
76
+ for (const dist of dists) {
77
+ if (!dist.import_name) continue;
78
+ const filter = new RegExp(`^${escapeRegExp(dist.import_name)}$`);
79
+ build.onResolve({ filter }, () => ({
80
+ path: `${baseHost}${proxyPath !== '/' ? proxyPath : ''}${dist.import_name_build}`,
81
+ external: true,
82
+ }));
83
+ }
84
+ }
85
+
86
+ // Rewrite app-relative imports to absolute paths based on proxy path and module.
87
+ // Do not touch node_modules relative imports so esbuild can bundle package internals.
88
+ build.onResolve({ filter: /^\.\.?\// }, (args) => {
89
+ const normalizedImporter = (args.importer || '').replace(/\\/g, '/');
90
+ if (!normalizedImporter.includes('/src/client/')) {
91
+ return;
92
+ }
93
+
94
+ // Extract the path relative to /src/client/
95
+ // Handle cases where the path might have duplicates or be in various formats
96
+ const srcClientIndex = normalizedImporter.lastIndexOf('/src/client/');
97
+ if (srcClientIndex === -1) {
98
+ return;
99
+ }
100
+ const importerFromClientRoot = normalizedImporter.substring(srcClientIndex + '/src/client/'.length);
101
+ const importerDir = path.posix.dirname(importerFromClientRoot);
102
+ const resolvedFromClientRoot = path.posix.normalize(path.posix.join(importerDir, args.path));
103
+ const result = resolveBrowserImportPath(prefix, resolvedFromClientRoot);
104
+
105
+ return {
106
+ path: result,
107
+ external: true,
108
+ };
109
+ });
110
+
111
+ // For client app modules we externalize bare imports; for SW builds we let esbuild bundle them.
112
+ build.onResolve({ filter: /.*/ }, (args) => {
113
+ if (args.kind === 'entry-point') return;
114
+ if (!externalizeBareImports) return;
115
+ return { path: args.path, external: true };
116
+ });
117
+ },
118
+ });
68
119
 
69
120
  /**
70
- * Formats a view's source code by rewriting its import paths.
71
- * @param {string} src - The source code of the view.
72
- * @param {Array<object>} dists - An array of distribution objects with import names.
73
- * @param {string} proxyPath - The proxy path for the application.
74
- * @param {string} [baseHost=''] - The base host URL.
75
- * @returns {string} The formatted source code with updated import paths.
121
+ * Transforms a JavaScript source file using esbuild with import path rewriting,
122
+ * tagged template stripping, and optional minification.
123
+ * Replaces the previous srcFormatted + componentFormatted/viewFormatted + UglifyJS pipeline.
124
+ * @param {string} srcPath - Path to the source file.
125
+ * @param {object} options
126
+ * @param {Array<object>} [options.dists=[]] - Distribution objects with import names.
127
+ * @param {string} options.proxyPath - The proxy path for the application.
128
+ * @param {string} [options.basePath=''] - Base path for the module type (e.g., 'components', 'services').
129
+ * @param {string} [options.module=''] - Module name for relative import resolution.
130
+ * @param {string} [options.baseHost=''] - Base host URL.
131
+ * @param {boolean} [options.minify=false] - Whether to minify the output.
132
+ * @returns {Promise<string>} The transformed source code.
76
133
  * @memberof clientFormatted
77
134
  */
78
- const viewFormatted = (src, dists, proxyPath, baseHost = '') => {
79
- dists.map(
80
- (dist) =>
81
- (src = src.replaceAll(dist.import_name, `${proxyPath !== '/' ? `${proxyPath}` : ''}${dist.import_name_build}`)),
82
- );
83
- const componentFromFormatted = `from '${baseHost}${proxyPath !== '/' ? `${proxyPath}/` : '/'}`;
84
- return src.replaceAll(`from './`, componentFromFormatted).replaceAll(`from '../`, componentFromFormatted);
135
+ const transformClientJs = async (
136
+ srcPath,
137
+ {
138
+ dists = [],
139
+ proxyPath,
140
+ basePath = '',
141
+ module = '',
142
+ baseHost = '',
143
+ minify: shouldMinify = false,
144
+ externalizeBareImports = true,
145
+ } = {},
146
+ ) => {
147
+ const src = fs.readFileSync(srcPath, 'utf8');
148
+ const stripped = srcFormatted(src);
149
+
150
+ const result = await esbuild.build({
151
+ stdin: {
152
+ contents: stripped,
153
+ loader: 'js',
154
+ resolveDir: path.dirname(path.resolve(srcPath)),
155
+ sourcefile: srcPath,
156
+ },
157
+ bundle: true,
158
+ write: false,
159
+ format: 'esm',
160
+ platform: 'browser',
161
+ target: 'esnext',
162
+ minify: shouldMinify,
163
+ logLevel: 'warning',
164
+ plugins: [importRewritePlugin({ dists, proxyPath, basePath, module, baseHost, externalizeBareImports })],
165
+ });
166
+
167
+ return result.outputFiles[0].text;
85
168
  };
86
169
 
87
- export { srcFormatted, JSONweb, componentFormatted, viewFormatted };
170
+ export { srcFormatted, JSONweb, transformClientJs };
@@ -148,6 +148,23 @@ const getConfFolder = (deployId) => {
148
148
  : `./engine-private/conf/${deployId}`;
149
149
  };
150
150
 
151
+ /**
152
+ * Reads `engine-private/deploy/dd.cron` and returns the deploy-id string,
153
+ * or `null` if the file does not exist or is empty.
154
+ *
155
+ * @method cronDeployIdResolve
156
+ * @returns {string|null} The deploy-id from dd.cron, or null.
157
+ * @memberof ServerConfBuilder
158
+ */
159
+ const cronDeployIdResolve = () => {
160
+ const cronDeployFile = './engine-private/deploy/dd.cron';
161
+ if (fs.existsSync(cronDeployFile)) {
162
+ const id = fs.readFileSync(cronDeployFile, 'utf8').trim();
163
+ return id || null;
164
+ }
165
+ return null;
166
+ };
167
+
151
168
  /**
152
169
  * Loads the deployment-specific `.env` file referenced by `engine-private/deploy/dd.cron`
153
170
  * into `process.env`. Uses `NODE_ENV` to select the environment variant
@@ -162,15 +179,12 @@ function loadCronDeployEnv() {
162
179
  const envName = process.env.NODE_ENV || 'production';
163
180
 
164
181
  // 1) Load dd.cron env (takes full precedence)
165
- const cronDeployFile = './engine-private/deploy/dd.cron';
166
- if (fs.existsSync(cronDeployFile)) {
167
- const cronDeployId = fs.readFileSync(cronDeployFile, 'utf8').trim();
168
- if (cronDeployId) {
169
- const cronEnvPath = `./engine-private/conf/${cronDeployId}/.env.${envName}`;
170
- if (fs.existsSync(cronEnvPath)) {
171
- const cronEnv = dotenv.parse(fs.readFileSync(cronEnvPath, 'utf8'));
172
- process.env = { ...process.env, ...cronEnv };
173
- }
182
+ const cronDeployId = cronDeployIdResolve();
183
+ if (cronDeployId) {
184
+ const cronEnvPath = `./engine-private/conf/${cronDeployId}/.env.${envName}`;
185
+ if (fs.existsSync(cronEnvPath)) {
186
+ const cronEnv = dotenv.parse(fs.readFileSync(cronEnvPath, 'utf8'));
187
+ process.env = { ...process.env, ...cronEnv };
174
188
  }
175
189
  }
176
190
 
@@ -443,7 +457,7 @@ const loadConf = (deployId = DEFAULT_DEPLOY_ID, subConf) => {
443
457
  fs.removeSync(`${path}/.env.production`);
444
458
  fs.removeSync(`${path}/.env.development`);
445
459
  fs.removeSync(`${path}/.env.test`);
446
- if (fs.existsSync(`${path}/jsdoc.json`)) shellExec(`git checkout ${path}/jsdoc.json`);
460
+ if (fs.existsSync(`${path}/typedoc.json`)) shellExec(`git checkout ${path}/typedoc.json`);
447
461
  shellExec(`git checkout ${path}/package.json`);
448
462
  shellExec(`git checkout ${path}/package-lock.json`);
449
463
  return;
@@ -1142,6 +1156,7 @@ const getDataDeploy = async (
1142
1156
 
1143
1157
  let buildDataDeploy = [];
1144
1158
  for (const deployObj of dataDeploy) {
1159
+ const isReplicaDeploy = fs.existsSync(`./engine-private/replica/${deployObj.deployId}`);
1145
1160
  const serverConf = loadReplicas(
1146
1161
  deployObj.deployId,
1147
1162
  loadConfServerJson(`./engine-private/conf/${deployObj.deployId}/conf.server.json`),
@@ -1149,7 +1164,7 @@ const getDataDeploy = async (
1149
1164
  let replicaDataDeploy = [];
1150
1165
  for (const host of Object.keys(serverConf))
1151
1166
  for (const path of Object.keys(serverConf[host])) {
1152
- if (serverConf[host][path].replicas && serverConf[host][path].singleReplica) {
1167
+ if (!isReplicaDeploy && serverConf[host][path].replicas && serverConf[host][path].singleReplica) {
1153
1168
  if (options && options.buildSingleReplica)
1154
1169
  await Underpost.repo.client(deployObj.deployId, '', host, path, {
1155
1170
  singleReplica: true,
@@ -1197,7 +1212,7 @@ const validateTemplatePath = (absolutePath = '') => {
1197
1212
  return false;
1198
1213
  }
1199
1214
  if (absolutePath.match('conf.dd-') && absolutePath.match('.js')) return false;
1200
- if (absolutePath.match('jsdoc.dd-') && absolutePath.match('.json')) return false;
1215
+ if (absolutePath.match('typedoc.dd-') && absolutePath.match('.json')) return false;
1201
1216
  if (
1202
1217
  absolutePath.match('src/client/services/') &&
1203
1218
  !clients.find((p) => absolutePath.match(`src/client/services/${p}/`))
@@ -1213,7 +1228,7 @@ const validateTemplatePath = (absolutePath = '') => {
1213
1228
  ) {
1214
1229
  return false;
1215
1230
  }
1216
- if (absolutePath.match('src/client/sw/') && !clients.find((p) => absolutePath.match(`src/client/sw/${p}.sw.js`))) {
1231
+ if (absolutePath.match('src/client/sw/') && !absolutePath.match('src/client/sw/core.sw.js')) {
1217
1232
  return false;
1218
1233
  }
1219
1234
  if (
@@ -1776,4 +1791,5 @@ export {
1776
1791
  readConfJson,
1777
1792
  DEFAULT_DEPLOY_ID,
1778
1793
  loadCronDeployEnv,
1794
+ cronDeployIdResolve,
1779
1795
  };
@@ -16,7 +16,7 @@ const volumeHostPath = '/home/dd';
16
16
  const enginePath = '/home/dd/engine';
17
17
  const cronVolumeName = 'underpost-cron-container-volume';
18
18
  const shareEnvVolumeName = 'underpost-share-env';
19
- const underpostContainerEnvPath = '/usr/lib/node_modules/underpost/.env';
19
+ const underpostContainerEnvDir = '/usr/lib/node_modules/underpost';
20
20
 
21
21
  /**
22
22
  * Generates a Kubernetes CronJob YAML manifest string.
@@ -33,7 +33,9 @@ const underpostContainerEnvPath = '/usr/lib/node_modules/underpost/.env';
33
33
  * @param {string} [params.cmd] - Optional pre-script commands to run before cron execution
34
34
  * @param {boolean} [params.suspend=false] - Whether the CronJob is suspended
35
35
  * @param {boolean} [params.dryRun=false] - Pass --dry-run flag to the cron command inside the container
36
- * @param {boolean} [params.ssh=false] - Execute backup commands via SSH on the remote node
36
+ * @param {boolean} [params.k3s=false] - Pass --k3s flag to the cron command inside the container
37
+ * @param {boolean} [params.kind=false] - Pass --kind flag to the cron command inside the container
38
+ * @param {boolean} [params.kubeadm=false] - Pass --kubeadm flag to the cron command inside the container
37
39
  * @returns {string} Kubernetes CronJob YAML manifest
38
40
  * @memberof UnderpostCron
39
41
  */
@@ -49,7 +51,9 @@ const cronJobYamlFactory = ({
49
51
  cmd,
50
52
  suspend = false,
51
53
  dryRun = false,
52
- ssh = false,
54
+ k3s = false,
55
+ kind = false,
56
+ kubeadm = false,
53
57
  }) => {
54
58
  const containerImage = image || `underpost/underpost-engine:${Underpost.version}`;
55
59
 
@@ -60,10 +64,12 @@ const cronJobYamlFactory = ({
60
64
  .replace(/^-|-$/g, '')
61
65
  .substring(0, 52);
62
66
 
63
- const cmdPart = cmd ? `${cmd} && ` : '';
64
- const cronBin = dev ? 'node bin' : 'underpost';
65
- const flags = `${git ? '--git ' : ''}${dev ? '--dev ' : ''}${dryRun ? '--dry-run ' : ''}${ssh ? '--ssh ' : ''}`;
66
- const cronCommand = `${cmdPart}${cronBin} cron ${flags}${deployList} ${jobList}`;
67
+ const cronBin = 'node bin'; // dev ? 'node bin' : 'underpost';
68
+ const flags = `${git ? '--git ' : ''}${dev ? '--dev ' : ''}${dryRun ? '--dry-run ' : ''}${k3s ? '--k3s ' : ''}${kind ? '--kind ' : ''}${kubeadm ? '--kubeadm ' : ''}`;
69
+ const commands = [`cd ${enginePath}`]; // `node bin run secret`
70
+ if (cmd) commands.push(cmd);
71
+ commands.push(`${cronBin} cron ${deployList} ${jobList} ${flags}`);
72
+ const fullCommand = commands.join(' &&\n ');
67
73
 
68
74
  return `apiVersion: batch/v1
69
75
  kind: CronJob
@@ -95,13 +101,12 @@ spec:
95
101
  - /bin/sh
96
102
  - -c
97
103
  - >
98
- ${cronCommand}
104
+ ${fullCommand}
99
105
  volumeMounts:
100
106
  - mountPath: ${enginePath}
101
107
  name: ${cronVolumeName}
102
- - mountPath: ${underpostContainerEnvPath}
108
+ - mountPath: ${underpostContainerEnvDir}
103
109
  name: ${shareEnvVolumeName}
104
- subPath: .env
105
110
  volumes:
106
111
  - hostPath:
107
112
  path: ${enginePath}
@@ -183,7 +188,6 @@ class UnderpostCron {
183
188
  * @param {boolean} [options.kubeadm] - Use kubeadm cluster context (apply directly on host)
184
189
  * @param {boolean} [options.dryRun] - Preview cron jobs without executing them
185
190
  * @param {boolean} [options.createJobNow] - After applying, immediately create a Job from each CronJob (requires --apply)
186
- * @param {boolean} [options.ssh] - Execute backup commands via SSH on the remote node
187
191
  * @memberof UnderpostCron
188
192
  */
189
193
  callback: async function (
@@ -227,7 +231,6 @@ class UnderpostCron {
227
231
  * @param {boolean} [options.k3s] - k3s cluster context (apply directly on host)
228
232
  * @param {boolean} [options.kind] - kind cluster context (apply via kind-worker container)
229
233
  * @param {boolean} [options.kubeadm] - kubeadm cluster context (apply directly on host)
230
- * @param {boolean} [options.ssh] - Execute backup commands via SSH on the remote node
231
234
  * @memberof UnderpostCron
232
235
  */
233
236
  setupDeployStart: async function (deployId, options = {}) {
@@ -269,21 +272,19 @@ class UnderpostCron {
269
272
  logger.warn(`package.json not found for deploy-id: ${deployId}`, { path: packageJsonPath });
270
273
  }
271
274
 
272
- // Generate and apply cron job manifests for this deploy-id
273
275
  await Underpost.cron.generateK8sCronJobs({
274
276
  deployId,
275
277
  namespace: options.namespace,
276
278
  image: options.image,
277
279
  apply: options.apply,
278
280
  createJobNow: options.createJobNow,
279
- git: true,
280
- dev: true,
281
- kubeadm: true,
282
- ssh: true,
283
- cmd: ` cd ${enginePath} && node bin env ${deployId} production`,
284
- k3s: false,
285
- kind: false,
286
- dryRun: false,
281
+ git: !!options.git,
282
+ dev: !!options.dev,
283
+ kubeadm: !!options.kubeadm,
284
+ cmd: options.cmd || `node bin env ${deployId} production`,
285
+ k3s: !!options.k3s,
286
+ kind: !!options.kind,
287
+ dryRun: !!options.dryRun,
287
288
  });
288
289
  },
289
290
 
@@ -305,7 +306,6 @@ class UnderpostCron {
305
306
  * @param {boolean} [options.kubeadm=false] - kubeadm cluster context (apply directly on host)
306
307
  * @param {boolean} [options.createJobNow=false] - After applying, create a Job from each CronJob immediately
307
308
  * @param {boolean} [options.dryRun=false] - Pass --dry-run=client to kubectl commands
308
- * @param {boolean} [options.ssh=false] - Execute backup commands via SSH on the remote node
309
309
  * @memberof UnderpostCron
310
310
  */
311
311
  generateK8sCronJobs: async function (options = {}) {
@@ -362,7 +362,9 @@ class UnderpostCron {
362
362
  cmd: options.cmd,
363
363
  suspend: false,
364
364
  dryRun: !!options.dryRun,
365
- ssh: !!options.ssh,
365
+ k3s: !!options.k3s,
366
+ kind: !!options.kind,
367
+ kubeadm: !!options.kubeadm,
366
368
  });
367
369
 
368
370
  const yamlFilePath = `${outputDir}/${cronJobName}.yaml`;
@@ -5,7 +5,16 @@
5
5
  * @namespace DataQuery
6
6
  */
7
7
 
8
- export const DataQuery = {
8
+ /**
9
+ * @class DataQuery
10
+ * @description Utility class for parsing request query parameters into Mongoose query options,
11
+ * including support for AG Grid filterModel and sortModel. Provides a static `parse`
12
+ * method that takes in request query parameters and returns an object containing the MongoDB
13
+ * query, sort options, pagination skip/limit, and page number. Designed to be used in API
14
+ * controllers to handle complex querying needs from the frontend.
15
+ * @memberof DataQuery
16
+ */
17
+ class DataQuery {
9
18
  /**
10
19
  * Parse request query parameters into Mongoose query options
11
20
  * @param {Object} params - The request query parameters (req.query)
@@ -20,7 +29,7 @@ export const DataQuery = {
20
29
  * @memberof DataQuery
21
30
  * @returns {Object} { query, sort, skip, limit, page }
22
31
  */
23
- parse: (params = {}) => {
32
+ static parse(params = {}) {
24
33
  let { filterModel, sortModel, page, limit, sort: sortParam, asc, order, query: defaultQuery } = params;
25
34
 
26
35
  // === 1. Pagination ===
@@ -35,7 +44,7 @@ export const DataQuery = {
35
44
  const query = DataQuery._parseFilter(filterModel, defaultQuery);
36
45
 
37
46
  return { query, sort, skip, limit, page };
38
- },
47
+ }
39
48
 
40
49
  /**
41
50
  * Parse sort parameters from AG Grid sortModel or simple sort params
@@ -47,7 +56,7 @@ export const DataQuery = {
47
56
  * @return {Object} sort object for Mongoose
48
57
  * @memberof DataQuery
49
58
  */
50
- _parseSort: (sortModel, sortParam, asc, order) => {
59
+ static _parseSort(sortModel, sortParam, asc, order) {
51
60
  const sort = {};
52
61
 
53
62
  // Parse sortModel from string if needed
@@ -90,7 +99,7 @@ export const DataQuery = {
90
99
  }
91
100
 
92
101
  return sort;
93
- },
102
+ }
94
103
 
95
104
  /**
96
105
  * Parse filter parameters from AG Grid filterModel
@@ -100,7 +109,7 @@ export const DataQuery = {
100
109
  * @return {Object} query object for Mongoose
101
110
  * @memberof DataQuery
102
111
  */
103
- _parseFilter: (filterModel, defaultQuery) => {
112
+ static _parseFilter(filterModel, defaultQuery) {
104
113
  let query = defaultQuery ? { ...defaultQuery } : {};
105
114
 
106
115
  // Parse filterModel from string if needed
@@ -127,7 +136,7 @@ export const DataQuery = {
127
136
  });
128
137
 
129
138
  return query;
130
- },
139
+ }
131
140
 
132
141
  /**
133
142
  * Parse a single field filter
@@ -137,7 +146,7 @@ export const DataQuery = {
137
146
  * @return {Object|null} query condition for the field or null if invalid
138
147
  * @memberof DataQuery
139
148
  */
140
- _parseFieldFilter: (field, filter) => {
149
+ static _parseFieldFilter(field, filter) {
141
150
  if (!filter || !filter.filterType) {
142
151
  return null;
143
152
  }
@@ -158,7 +167,7 @@ export const DataQuery = {
158
167
  default:
159
168
  return null;
160
169
  }
161
- },
170
+ }
162
171
 
163
172
  /**
164
173
  * Parse text filter
@@ -168,7 +177,7 @@ export const DataQuery = {
168
177
  * @return {Object|null} query condition for the text field or null if invalid
169
178
  * @memberof DataQuery
170
179
  */
171
- _parseTextFilter: (field, filter) => {
180
+ static _parseTextFilter(field, filter) {
172
181
  const { type, filter: filterValue } = filter;
173
182
 
174
183
  if (filterValue === null || filterValue === undefined || filterValue === '') {
@@ -219,7 +228,7 @@ export const DataQuery = {
219
228
  }
220
229
 
221
230
  return query;
222
- },
231
+ }
223
232
 
224
233
  /**
225
234
  * Parse number filter
@@ -229,7 +238,7 @@ export const DataQuery = {
229
238
  * @return {Object|null} query condition for the number field or null if invalid
230
239
  * @memberof DataQuery
231
240
  */
232
- _parseNumberFilter: (field, filter) => {
241
+ static _parseNumberFilter(field, filter) {
233
242
  const { type, filter: filterValue, filterTo } = filter;
234
243
 
235
244
  if (filterValue === null || filterValue === undefined) {
@@ -281,7 +290,7 @@ export const DataQuery = {
281
290
  }
282
291
 
283
292
  return query;
284
- },
293
+ }
285
294
 
286
295
  /**
287
296
  * Parse date filter
@@ -291,7 +300,7 @@ export const DataQuery = {
291
300
  * @return {Object|null} query condition for the date field or null if invalid
292
301
  * @memberof DataQuery
293
302
  */
294
- _parseDateFilter: (field, filter) => {
303
+ static _parseDateFilter(field, filter) {
295
304
  const { type, dateFrom, dateTo } = filter;
296
305
 
297
306
  // Handle blank/notBlank without dates
@@ -391,7 +400,7 @@ export const DataQuery = {
391
400
  }
392
401
 
393
402
  return query;
394
- },
403
+ }
395
404
 
396
405
  /**
397
406
  * Parse set filter
@@ -401,7 +410,7 @@ export const DataQuery = {
401
410
  * @return {Object|null} query condition for the set field or null if invalid
402
411
  * @memberof DataQuery
403
412
  */
404
- _parseSetFilter: (field, filter) => {
413
+ static _parseSetFilter(field, filter) {
405
414
  const { values } = filter;
406
415
 
407
416
  if (!Array.isArray(values) || values.length === 0) {
@@ -409,7 +418,7 @@ export const DataQuery = {
409
418
  }
410
419
 
411
420
  return { [field]: { $in: values } };
412
- },
421
+ }
413
422
 
414
423
  /**
415
424
  * Parse multi filter (combines multiple filters with AND/OR)
@@ -419,7 +428,7 @@ export const DataQuery = {
419
428
  * @return {Object|null} query condition for the multi filter or null if invalid
420
429
  * @memberof DataQuery
421
430
  */
422
- _parseMultiFilter: (field, filter) => {
431
+ static _parseMultiFilter(field, filter) {
423
432
  const { filterModels, operator } = filter;
424
433
 
425
434
  if (!Array.isArray(filterModels) || filterModels.length === 0) {
@@ -445,5 +454,8 @@ export const DataQuery = {
445
454
  // AND operator (default)
446
455
  return { $and: conditions };
447
456
  }
448
- },
449
- };
457
+ }
458
+ }
459
+
460
+ export { DataQuery };
461
+ export default DataQuery;
package/src/server/dns.js CHANGED
@@ -101,6 +101,22 @@ class Dns {
101
101
  return ipv4.address;
102
102
  }
103
103
 
104
+ /**
105
+ * Gets the MAC address of the main (default route) network interface.
106
+ * @static
107
+ * @memberof UnderpostDns
108
+ * @returns {string|null} The MAC address, or null if not found.
109
+ */
110
+ static getMainInterfaceMac() {
111
+ const interfaceName = Dns.getDefaultNetworkInterface();
112
+ const networkInfo = os.networkInterfaces()[interfaceName];
113
+ if (!networkInfo || networkInfo.length === 0) {
114
+ logger.error(`Could not find network interface: ${interfaceName}`);
115
+ return null;
116
+ }
117
+ return networkInfo[0].mac;
118
+ }
119
+
104
120
  /**
105
121
  * Setup nftables tables and chains if they don't exist.
106
122
  * @static
@@ -265,7 +281,8 @@ class Dns {
265
281
  * @returns {Promise<void>}
266
282
  */
267
283
  static async callback(deployList) {
268
- loadCronDeployEnv();
284
+ // loadCronDeployEnv();
285
+
269
286
  const isOnline = await Dns.isInternetConnection();
270
287
 
271
288
  if (!isOnline) return;
@@ -490,6 +507,12 @@ class Dns {
490
507
  });
491
508
  }
492
509
 
510
+ if (options.mac) {
511
+ const mac = Dns.getMainInterfaceMac();
512
+ console.log(mac);
513
+ return mac;
514
+ }
515
+
493
516
  let ip;
494
517
  if (options.dhcp) ip = Dns.getLocalIPv4Address();
495
518
  else ip = await Dns.getPublicIp();