cyberia 3.2.5 → 3.2.12

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 (381) hide show
  1. package/.github/workflows/engine-cyberia.cd.yml +8 -2
  2. package/.github/workflows/npmpkg.ci.yml +1 -0
  3. package/.github/workflows/pwa-microservices-template-test.ci.yml +1 -1
  4. package/.github/workflows/release.cd.yml +2 -2
  5. package/.vscode/extensions.json +9 -9
  6. package/.vscode/settings.json +20 -4
  7. package/CHANGELOG.md +563 -1
  8. package/CLI-HELP.md +130 -34
  9. package/Dockerfile +0 -4
  10. package/README.md +194 -607
  11. package/bin/build.js +42 -12
  12. package/bin/build.template.js +187 -0
  13. package/bin/cyberia.js +1367 -281
  14. package/bin/deploy.js +582 -3
  15. package/bin/index.js +1367 -281
  16. package/bump.config.js +26 -0
  17. package/conf.js +195 -111
  18. package/deployment.yaml +6 -222
  19. package/hardhat/package-lock.json +118 -149
  20. package/hardhat/package.json +5 -4
  21. package/jsconfig.json +1 -1
  22. package/manifests/cronjobs/dd-cron/dd-cron-backup.yaml +2 -2
  23. package/manifests/cronjobs/dd-cron/dd-cron-dns.yaml +2 -2
  24. package/manifests/deployment/dd-cyberia-development/deployment.yaml +6 -222
  25. package/manifests/deployment/dd-cyberia-development/proxy.yaml +10 -118
  26. package/manifests/deployment/dd-default-development/deployment.yaml +2 -6
  27. package/manifests/deployment/dd-test-development/deployment.yaml +138 -66
  28. package/manifests/deployment/dd-test-development/proxy.yaml +41 -5
  29. package/manifests/kind-config-dev.yaml +8 -0
  30. package/manifests/lxd/lxd-admin-profile.yaml +12 -3
  31. package/manifests/mongodb/pv-pvc.yaml +44 -8
  32. package/manifests/mongodb/statefulset.yaml +55 -68
  33. package/manifests/mongodb-4.4/headless-service.yaml +10 -0
  34. package/manifests/mongodb-4.4/kustomization.yaml +3 -1
  35. package/manifests/mongodb-4.4/mongodb-nodeport.yaml +17 -0
  36. package/manifests/mongodb-4.4/pv-pvc.yaml +10 -14
  37. package/manifests/mongodb-4.4/statefulset.yaml +79 -0
  38. package/manifests/mongodb-4.4/storage-class.yaml +9 -0
  39. package/manifests/valkey/statefulset.yaml +1 -1
  40. package/manifests/valkey/valkey-nodeport.yaml +17 -0
  41. package/package.json +45 -24
  42. package/proxy.yaml +10 -118
  43. package/scripts/ipxe-setup.sh +52 -49
  44. package/scripts/k3s-node-setup.sh +83 -48
  45. package/scripts/lxd-vm-setup.sh +193 -8
  46. package/scripts/maas-nat-firewalld.sh +145 -0
  47. package/scripts/nat-iptables.sh +103 -18
  48. package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.controller.js +18 -18
  49. package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.model.js +7 -14
  50. package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.router.js +38 -33
  51. package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.service.js +91 -36
  52. package/src/api/core/core.controller.js +10 -10
  53. package/src/api/core/core.router.js +19 -14
  54. package/src/api/core/core.service.js +15 -15
  55. package/src/api/crypto/crypto.controller.js +8 -8
  56. package/src/api/crypto/crypto.router.js +18 -12
  57. package/src/api/crypto/crypto.service.js +11 -11
  58. package/src/api/cyberia-action/cyberia-action.controller.js +74 -0
  59. package/src/api/cyberia-action/cyberia-action.model.js +87 -0
  60. package/src/api/cyberia-action/cyberia-action.router.js +31 -0
  61. package/src/api/cyberia-action/cyberia-action.service.js +42 -0
  62. package/src/api/cyberia-client-hints/cyberia-client-hints.controller.js +74 -0
  63. package/src/api/cyberia-client-hints/cyberia-client-hints.model.js +99 -0
  64. package/src/api/cyberia-client-hints/cyberia-client-hints.router.js +98 -0
  65. package/src/api/cyberia-client-hints/cyberia-client-hints.service.js +152 -0
  66. package/src/api/cyberia-dialogue/cyberia-dialogue.controller.js +13 -13
  67. package/src/api/cyberia-dialogue/cyberia-dialogue.model.js +11 -11
  68. package/src/api/cyberia-dialogue/cyberia-dialogue.router.js +25 -20
  69. package/src/api/cyberia-dialogue/cyberia-dialogue.service.js +22 -22
  70. package/src/api/cyberia-entity/cyberia-entity.controller.js +10 -10
  71. package/src/api/cyberia-entity/cyberia-entity.router.js +22 -18
  72. package/src/api/cyberia-entity/cyberia-entity.service.js +15 -15
  73. package/src/api/cyberia-instance/cyberia-fallback-world.js +83 -198
  74. package/src/api/cyberia-instance/cyberia-instance.controller.js +14 -14
  75. package/src/api/cyberia-instance/cyberia-instance.model.js +3 -0
  76. package/src/api/cyberia-instance/cyberia-instance.router.js +57 -52
  77. package/src/api/cyberia-instance/cyberia-instance.service.js +32 -67
  78. package/src/api/cyberia-instance/cyberia-portal-connector.js +20 -246
  79. package/src/api/cyberia-instance/cyberia-world-generator.js +505 -0
  80. package/src/api/cyberia-instance-conf/cyberia-instance-conf.controller.js +10 -10
  81. package/src/api/cyberia-instance-conf/cyberia-instance-conf.model.js +18 -49
  82. package/src/api/cyberia-instance-conf/cyberia-instance-conf.router.js +22 -18
  83. package/src/api/cyberia-instance-conf/cyberia-instance-conf.service.js +19 -15
  84. package/src/api/cyberia-map/cyberia-map.controller.js +10 -10
  85. package/src/api/cyberia-map/cyberia-map.router.js +35 -30
  86. package/src/api/cyberia-map/cyberia-map.service.js +17 -17
  87. package/src/api/cyberia-quest/cyberia-quest.controller.js +74 -0
  88. package/src/api/cyberia-quest/cyberia-quest.model.js +67 -0
  89. package/src/api/cyberia-quest/cyberia-quest.router.js +31 -0
  90. package/src/api/cyberia-quest/cyberia-quest.service.js +42 -0
  91. package/src/api/cyberia-quest-progress/cyberia-quest-progress.controller.js +74 -0
  92. package/src/api/cyberia-quest-progress/cyberia-quest-progress.model.js +49 -0
  93. package/src/api/cyberia-quest-progress/cyberia-quest-progress.router.js +31 -0
  94. package/src/api/cyberia-quest-progress/cyberia-quest-progress.service.js +42 -0
  95. package/src/api/cyberia-server-defaults/cyberia-server-defaults.js +451 -0
  96. package/src/api/default/default.controller.js +10 -10
  97. package/src/api/default/default.router.js +22 -18
  98. package/src/api/default/default.service.js +15 -15
  99. package/src/api/document/document.controller.js +12 -12
  100. package/src/api/document/document.model.js +10 -16
  101. package/src/api/document/document.router.js +28 -23
  102. package/src/api/document/document.service.js +100 -23
  103. package/src/api/file/file.controller.js +8 -8
  104. package/src/api/file/file.model.js +10 -10
  105. package/src/api/file/file.router.js +19 -13
  106. package/src/api/file/file.service.js +45 -43
  107. package/src/api/instance/instance.controller.js +10 -10
  108. package/src/api/instance/instance.model.js +4 -10
  109. package/src/api/instance/instance.router.js +29 -24
  110. package/src/api/instance/instance.service.js +16 -16
  111. package/src/api/ipfs/ipfs.controller.js +12 -12
  112. package/src/api/ipfs/ipfs.model.js +4 -13
  113. package/src/api/ipfs/ipfs.router.js +21 -16
  114. package/src/api/ipfs/ipfs.service.js +22 -36
  115. package/src/api/object-layer/object-layer.controller.js +12 -12
  116. package/src/api/object-layer/object-layer.model.js +4 -17
  117. package/src/api/object-layer/object-layer.router.js +512 -507
  118. package/src/api/object-layer/object-layer.service.js +29 -26
  119. package/src/api/object-layer-render-frames/object-layer-render-frames.controller.js +10 -10
  120. package/src/api/object-layer-render-frames/object-layer-render-frames.model.js +6 -16
  121. package/src/api/object-layer-render-frames/object-layer-render-frames.router.js +22 -18
  122. package/src/api/object-layer-render-frames/object-layer-render-frames.service.js +19 -15
  123. package/src/api/test/test.controller.js +8 -8
  124. package/src/api/test/test.router.js +17 -12
  125. package/src/api/test/test.service.js +8 -8
  126. package/src/api/types.js +24 -0
  127. package/src/api/user/guest.service.js +100 -0
  128. package/src/api/user/user.controller.js +6 -6
  129. package/src/api/user/user.model.js +8 -13
  130. package/src/api/user/user.router.js +297 -288
  131. package/src/api/user/user.service.js +103 -55
  132. package/src/cli/baremetal.js +132 -101
  133. package/src/cli/cluster.js +732 -217
  134. package/src/cli/db.js +106 -62
  135. package/src/cli/deploy.js +260 -149
  136. package/src/cli/fs.js +90 -9
  137. package/src/cli/image.js +43 -1
  138. package/src/cli/index.js +106 -16
  139. package/src/cli/ipfs.js +4 -6
  140. package/src/cli/kubectl.js +4 -1
  141. package/src/cli/lxd.js +1099 -223
  142. package/src/cli/monitor.js +9 -3
  143. package/src/cli/release.js +336 -86
  144. package/src/cli/repository.js +136 -53
  145. package/src/cli/run.js +599 -76
  146. package/src/cli/secrets.js +11 -2
  147. package/src/cli/ssh.js +1 -1
  148. package/src/cli/static.js +43 -115
  149. package/src/cli/test.js +9 -3
  150. package/src/client/Cryptokoyn.index.js +18 -21
  151. package/src/client/CyberiaPortal.index.js +19 -23
  152. package/src/client/Default.index.js +30 -36
  153. package/src/client/Itemledger.index.js +20 -26
  154. package/src/client/Underpost.index.js +19 -23
  155. package/src/client/components/core/404.js +4 -4
  156. package/src/client/components/core/500.js +4 -4
  157. package/src/client/components/core/Account.js +73 -60
  158. package/src/client/components/core/AgGrid.js +23 -33
  159. package/src/client/components/core/Alert.js +12 -13
  160. package/src/client/components/core/AppStore.js +1 -1
  161. package/src/client/components/core/Auth.js +40 -37
  162. package/src/client/components/core/Badge.js +7 -13
  163. package/src/client/components/core/BtnIcon.js +15 -17
  164. package/src/client/components/core/CalendarCore.js +42 -63
  165. package/src/client/components/core/Chat.js +13 -15
  166. package/src/client/components/core/ClientEvents.js +163 -0
  167. package/src/client/components/core/ColorPaletteElement.js +309 -0
  168. package/src/client/components/core/Content.js +17 -14
  169. package/src/client/components/core/Css.js +15 -71
  170. package/src/client/components/core/CssCore.js +12 -16
  171. package/src/client/components/core/D3Chart.js +4 -4
  172. package/src/client/components/core/Docs.js +64 -91
  173. package/src/client/components/core/DropDown.js +69 -91
  174. package/src/client/components/core/EventBus.js +96 -0
  175. package/src/client/components/core/EventsUI.js +14 -17
  176. package/src/client/components/core/FileExplorer.js +96 -228
  177. package/src/client/components/core/FullScreen.js +47 -75
  178. package/src/client/components/core/Input.js +24 -69
  179. package/src/client/components/core/Keyboard.js +25 -18
  180. package/src/client/components/core/KeyboardAvoidance.js +145 -0
  181. package/src/client/components/core/LoadingAnimation.js +25 -31
  182. package/src/client/components/core/LogIn.js +41 -41
  183. package/src/client/components/core/LogOut.js +23 -14
  184. package/src/client/components/core/Modal.js +544 -219
  185. package/src/client/components/core/NotificationManager.js +14 -18
  186. package/src/client/components/core/Panel.js +54 -50
  187. package/src/client/components/core/PanelForm.js +81 -177
  188. package/src/client/components/core/Polyhedron.js +110 -214
  189. package/src/client/components/core/PublicProfile.js +39 -32
  190. package/src/client/components/core/Recover.js +48 -44
  191. package/src/client/components/core/Responsive.js +88 -32
  192. package/src/client/components/core/RichText.js +9 -18
  193. package/src/client/components/core/Router.js +24 -3
  194. package/src/client/components/core/SearchBox.js +37 -37
  195. package/src/client/components/core/SignUp.js +39 -30
  196. package/src/client/components/core/SocketIo.js +31 -2
  197. package/src/client/components/core/SocketIoHandler.js +6 -6
  198. package/src/client/components/core/ToggleSwitch.js +8 -20
  199. package/src/client/components/core/ToolTip.js +5 -17
  200. package/src/client/components/core/Translate.js +56 -59
  201. package/src/client/components/core/Validator.js +26 -16
  202. package/src/client/components/core/Wallet.js +15 -26
  203. package/src/client/components/core/Worker.js +211 -276
  204. package/src/client/components/core/windowGetDimensions.js +7 -7
  205. package/src/client/components/cryptokoyn/{MenuCryptokoyn.js → AppShellCryptokoyn.js} +57 -57
  206. package/src/client/components/cryptokoyn/CssCryptokoyn.js +15 -15
  207. package/src/client/components/cryptokoyn/LogInCryptokoyn.js +6 -4
  208. package/src/client/components/cryptokoyn/LogOutCryptokoyn.js +6 -4
  209. package/src/client/components/cryptokoyn/RouterCryptokoyn.js +37 -0
  210. package/src/client/components/cryptokoyn/SettingsCryptokoyn.js +4 -4
  211. package/src/client/components/cryptokoyn/SignUpCryptokoyn.js +6 -4
  212. package/src/client/components/cyberia/InstanceEngineCyberia.js +141 -60
  213. package/src/client/components/cyberia/MapEngineCyberia.js +691 -214
  214. package/src/client/components/cyberia/ObjectLayerEngine.js +19 -0
  215. package/src/client/components/cyberia/ObjectLayerEngineModal.js +1204 -94
  216. package/src/client/components/cyberia/ObjectLayerEngineViewer.js +196 -298
  217. package/src/client/components/cyberia/SharedDefaultsCyberia.js +330 -0
  218. package/src/client/components/cyberia-portal/{MenuCyberiaPortal.js → AppShellCyberiaPortal.js} +102 -102
  219. package/src/client/components/cyberia-portal/CssCyberiaPortal.js +15 -15
  220. package/src/client/components/cyberia-portal/LogInCyberiaPortal.js +6 -4
  221. package/src/client/components/cyberia-portal/LogOutCyberiaPortal.js +6 -4
  222. package/src/client/components/cyberia-portal/MainBodyCyberiaPortal.js +4 -4
  223. package/src/client/components/cyberia-portal/RouterCyberiaPortal.js +60 -0
  224. package/src/client/components/cyberia-portal/SettingsCyberiaPortal.js +4 -4
  225. package/src/client/components/cyberia-portal/SignUpCyberiaPortal.js +6 -4
  226. package/src/client/components/cyberia-portal/TranslateCyberiaPortal.js +4 -4
  227. package/src/client/components/default/{MenuDefault.js → AppShellDefault.js} +87 -87
  228. package/src/client/components/default/CssDefault.js +12 -12
  229. package/src/client/components/default/LogInDefault.js +6 -4
  230. package/src/client/components/default/LogOutDefault.js +6 -4
  231. package/src/client/components/default/RouterDefault.js +47 -0
  232. package/src/client/components/default/SettingsDefault.js +4 -4
  233. package/src/client/components/default/SignUpDefault.js +6 -4
  234. package/src/client/components/default/TranslateDefault.js +3 -3
  235. package/src/client/components/itemledger/{MenuItemledger.js → AppShellItemledger.js} +57 -57
  236. package/src/client/components/itemledger/CssItemledger.js +15 -15
  237. package/src/client/components/itemledger/LogInItemledger.js +6 -4
  238. package/src/client/components/itemledger/LogOutItemledger.js +6 -4
  239. package/src/client/components/itemledger/RouterItemledger.js +38 -0
  240. package/src/client/components/itemledger/SettingsItemledger.js +4 -4
  241. package/src/client/components/itemledger/SignUpItemledger.js +6 -4
  242. package/src/client/components/itemledger/TranslateItemledger.js +3 -3
  243. package/src/client/components/underpost/{MenuUnderpost.js → AppShellUnderpost.js} +88 -88
  244. package/src/client/components/underpost/CssUnderpost.js +14 -14
  245. package/src/client/components/underpost/CyberpunkBloggerUnderpost.js +4 -4
  246. package/src/client/components/underpost/DocumentSearchProvider.js +1 -1
  247. package/src/client/components/underpost/LabGalleryUnderpost.js +12 -15
  248. package/src/client/components/underpost/LogInUnderpost.js +6 -4
  249. package/src/client/components/underpost/LogOutUnderpost.js +6 -4
  250. package/src/client/components/underpost/RouterUnderpost.js +45 -0
  251. package/src/client/components/underpost/SettingsUnderpost.js +4 -4
  252. package/src/client/components/underpost/SignUpUnderpost.js +6 -4
  253. package/src/client/components/underpost/TranslateUnderpost.js +4 -4
  254. package/src/client/public/cyberia-docs/ACTION-SYSTEM.md +235 -0
  255. package/src/client/public/cyberia-docs/ARCHITECTURE.md +83 -0
  256. package/src/client/public/cyberia-docs/CYBERIA-CLI.md +204 -0
  257. package/src/client/public/cyberia-docs/CYBERIA-CLIENT.md +291 -0
  258. package/src/client/public/cyberia-docs/CYBERIA-SERVER.md +278 -0
  259. package/src/client/public/cyberia-docs/CYBERIA.md +259 -0
  260. package/src/client/public/cyberia-docs/ENTITY-PROFILE.md +241 -0
  261. package/src/client/public/cyberia-docs/HARDHAT-MODULE.md +300 -0
  262. package/src/client/public/cyberia-docs/OFF-CHAIN-ECONOMY.md +279 -0
  263. package/src/client/public/cyberia-docs/QUEST-SYSTEM.md +206 -0
  264. package/src/client/public/cyberia-docs/ROADMAP.md +240 -0
  265. package/src/client/public/cyberia-docs/UNDERPOST-PLATFORM.md +106 -0
  266. package/src/client/public/cyberia-docs/WHITE-PAPER.md +732 -0
  267. package/src/client/services/atlas-sprite-sheet/atlas-sprite-sheet.service.js +14 -20
  268. package/src/client/services/core/core.service.js +17 -49
  269. package/src/client/services/crypto/crypto.service.js +8 -13
  270. package/src/client/services/cyberia-action/cyberia-action.service.js +99 -0
  271. package/src/client/services/cyberia-client-hints/cyberia-client-hints.service.js +99 -0
  272. package/src/client/services/cyberia-dialogue/cyberia-dialogue.service.js +10 -16
  273. package/src/client/services/cyberia-entity/cyberia-entity.management.js +5 -5
  274. package/src/client/services/cyberia-entity/cyberia-entity.service.js +10 -16
  275. package/src/client/services/cyberia-instance/cyberia-instance.management.js +6 -6
  276. package/src/client/services/cyberia-instance/cyberia-instance.service.js +12 -18
  277. package/src/client/services/cyberia-instance-conf/cyberia-instance-conf.service.js +10 -16
  278. package/src/client/services/cyberia-map/cyberia-map.management.js +6 -6
  279. package/src/client/services/cyberia-map/cyberia-map.service.js +12 -18
  280. package/src/client/services/cyberia-quest/cyberia-quest.service.js +99 -0
  281. package/src/client/services/cyberia-quest-progress/cyberia-quest-progress.service.js +99 -0
  282. package/src/client/services/default/default.management.js +159 -267
  283. package/src/client/services/default/default.service.js +10 -16
  284. package/src/client/services/document/document.service.js +14 -19
  285. package/src/client/services/file/file.service.js +8 -13
  286. package/src/client/services/instance/instance.management.js +5 -5
  287. package/src/client/services/instance/instance.service.js +10 -15
  288. package/src/client/services/ipfs/ipfs.service.js +12 -18
  289. package/src/client/services/object-layer/object-layer.management.js +12 -12
  290. package/src/client/services/object-layer/object-layer.service.js +20 -26
  291. package/src/client/services/object-layer-render-frames/object-layer-render-frames.service.js +10 -16
  292. package/src/client/services/test/test.service.js +8 -13
  293. package/src/client/services/user/guest.service.js +86 -0
  294. package/src/client/services/user/user.management.js +5 -5
  295. package/src/client/services/user/user.service.js +14 -20
  296. package/src/client/ssr/body/404.js +3 -3
  297. package/src/client/ssr/body/500.js +3 -3
  298. package/src/client/ssr/body/CacheControl.js +5 -2
  299. package/src/client/ssr/body/DefaultSplashScreen.js +19 -12
  300. package/src/client/ssr/body/UnderpostDefaultSplashScreen.js +13 -6
  301. package/src/client/ssr/head/PwaItemledger.js +197 -60
  302. package/src/client/ssr/mailer/DefaultRecoverEmail.js +19 -20
  303. package/src/client/ssr/mailer/DefaultVerifyEmail.js +15 -16
  304. package/src/client/ssr/views/CyberiaServerMetrics.js +982 -0
  305. package/src/client/ssr/{offline → views}/Maintenance.js +12 -11
  306. package/src/client/ssr/{offline → views}/NoNetworkConnection.js +3 -3
  307. package/src/client/ssr/{pages → views}/Test.js +2 -2
  308. package/src/client/sw/core.sw.js +274 -0
  309. package/src/db/DataBaseProvider.js +115 -15
  310. package/src/db/mariadb/MariaDB.js +2 -1
  311. package/src/db/mongo/MongoBootstrap.js +657 -0
  312. package/src/db/mongo/MongooseDB.js +129 -21
  313. package/src/grpc/cyberia/grpc-server.js +185 -105
  314. package/src/index.js +1 -1
  315. package/src/runtime/cyberia-client/Dockerfile +101 -0
  316. package/src/runtime/cyberia-client/Dockerfile.dev +82 -0
  317. package/src/runtime/cyberia-server/Dockerfile +62 -0
  318. package/src/runtime/cyberia-server/Dockerfile.dev +71 -0
  319. package/src/runtime/express/Dockerfile +4 -4
  320. package/src/runtime/express/Express.js +2 -2
  321. package/src/runtime/lampp/Dockerfile +8 -7
  322. package/src/runtime/wp/Dockerfile +11 -17
  323. package/src/runtime/wp/Wp.js +8 -5
  324. package/src/server/atlas-sprite-sheet-generator.js +4 -2
  325. package/src/server/auth.js +2 -2
  326. package/src/server/client-build-docs.js +46 -47
  327. package/src/server/client-build.js +371 -132
  328. package/src/server/client-formatted.js +47 -16
  329. package/src/server/conf.js +91 -87
  330. package/src/server/data-query.js +32 -20
  331. package/src/server/dns.js +22 -0
  332. package/src/server/ipfs-client.js +232 -91
  333. package/src/server/object-layer.js +1 -6
  334. package/src/server/process.js +192 -45
  335. package/src/server/proxy.js +9 -2
  336. package/src/server/runtime.js +1 -1
  337. package/src/server/semantic-layer-generator-floor.js +11 -51
  338. package/src/server/semantic-layer-generator-resource.js +259 -0
  339. package/src/server/semantic-layer-generator-skin.js +41 -171
  340. package/src/server/semantic-layer-generator.js +122 -14
  341. package/src/server/shape-generator.js +108 -0
  342. package/src/server/start.js +34 -8
  343. package/src/server/valkey.js +143 -235
  344. package/src/ws/IoInterface.js +16 -16
  345. package/src/ws/core/channels/core.ws.chat.js +11 -11
  346. package/src/ws/core/channels/core.ws.mailer.js +29 -29
  347. package/src/ws/core/channels/core.ws.stream.js +19 -19
  348. package/src/ws/core/core.ws.connection.js +8 -8
  349. package/src/ws/core/core.ws.server.js +6 -5
  350. package/src/ws/default/channels/default.ws.main.js +10 -10
  351. package/src/ws/default/default.ws.connection.js +4 -4
  352. package/src/ws/default/default.ws.server.js +4 -3
  353. package/tsconfig.docs.json +15 -0
  354. package/typedoc.dd-cyberia.json +29 -0
  355. package/typedoc.json +29 -0
  356. package/WHITE-PAPER.md +0 -1540
  357. package/bin/file.js +0 -196
  358. package/bin/vs.js +0 -74
  359. package/bin/zed.js +0 -84
  360. package/hardhat/README.md +0 -531
  361. package/hardhat/WHITE-PAPER.md +0 -1540
  362. package/jsdoc.dd-cyberia.json +0 -68
  363. package/jsdoc.json +0 -68
  364. package/src/api/cyberia-instance-conf/cyberia-instance-conf.defaults.js +0 -413
  365. package/src/api/object-layer/README.md +0 -672
  366. package/src/client/components/core/ColorPalette.js +0 -5267
  367. package/src/client/components/core/JoyStick.js +0 -80
  368. package/src/client/components/cryptokoyn/RoutesCryptokoyn.js +0 -39
  369. package/src/client/components/cyberia-portal/CommonCyberiaPortal.js +0 -223
  370. package/src/client/components/cyberia-portal/RoutesCyberiaPortal.js +0 -62
  371. package/src/client/components/cyberia-portal/ServerCyberiaPortal.js +0 -136
  372. package/src/client/components/default/RoutesDefault.js +0 -49
  373. package/src/client/components/itemledger/RoutesItemledger.js +0 -40
  374. package/src/client/components/underpost/RoutesUnderpost.js +0 -47
  375. package/src/client/ssr/email/DefaultRecoverEmail.js +0 -21
  376. package/src/client/ssr/email/DefaultVerifyEmail.js +0 -17
  377. package/src/client/ssr/pages/CyberiaServerMetrics.js +0 -461
  378. package/src/client/sw/default.sw.js +0 -127
  379. package/src/client/sw/template.sw.js +0 -84
  380. package/src/grpc/cyberia/OFF_CHAIN_ECONOMY.md +0 -305
  381. package/src/grpc/cyberia/README.md +0 -326
@@ -1,293 +1,201 @@
1
1
  /**
2
- * Module for managing Valkey
2
+ * Valkey connection and key-value store module.
3
+ *
4
+ * Responsibilities:
5
+ * - Manage per-instance Valkey connections keyed by `${host}${path}`.
6
+ * - Provide a thin, typed CRUD surface: get / set / del / update.
7
+ * - Expose connection status helpers.
8
+ *
9
+ * Out of scope: domain model factories, DTO projection — those belong in
10
+ * their respective service modules (e.g. guest.service.js).
11
+ *
3
12
  * @module src/server/valkey.js
4
13
  * @namespace ValkeyService
5
14
  */
6
-
7
15
  import Valkey from 'iovalkey';
8
- import mongoose from 'mongoose';
9
- import { hashPassword } from './auth.js';
10
16
  import { loggerFactory } from './logger.js';
17
+ import Underpost from '../index.js';
11
18
 
12
19
  const logger = loggerFactory(import.meta);
13
20
 
14
- // Per-instance registries keyed by `${host}${path}`
21
+ // ─── Instance registry ────────────────────────────────────────────────────────
22
+
23
+ /** @type {Record<string, import('iovalkey').default>} */
15
24
  const ValkeyInstances = {};
16
- const DummyStores = {}; // in-memory Maps per instance
17
- const ValkeyStatus = {}; // 'connected' | 'dummy' | 'error' | undefined
25
+
26
+ /** @type {Record<string, 'connected' | 'reconnecting' | 'error'>} */
27
+ const ValkeyStatus = {};
18
28
 
19
29
  /**
20
- * Checks if any Valkey instance is connected.
21
- * This is a backward-compatible overall flag.
22
- * @returns {boolean} True if any instance has a 'connected' status.
23
- * @memberof ValkeyService
30
+ * Derives the registry key from an instance descriptor.
31
+ * @param {{ host?: string, path?: string }} opts
32
+ * @returns {string}
24
33
  */
25
- const isValkeyEnable = () => Object.values(ValkeyStatus).some((s) => s === 'connected');
34
+ const _instanceKey = (opts = {}) => `${opts.host || ''}${opts.path || ''}`;
35
+
36
+ // ─── Connection ───────────────────────────────────────────────────────────────
26
37
 
27
38
  /**
28
- * Generates a unique key for a Valkey instance based on its host and path.
29
- * @param {object} [opts={ host: '', path: '' }] - The instance options.
30
- * @param {string} [opts.host=''] - The host of the instance.
31
- * @param {string} [opts.path=''] - The path of the instance.
32
- * @returns {string} The instance key.
33
- * @private
39
+ * Returns true when at least one Valkey instance is connected.
40
+ * @returns {boolean}
34
41
  * @memberof ValkeyService
35
42
  */
36
- const _instanceKey = (opts = { host: '', path: '' }) => `${opts.host || ''}${opts.path || ''}`;
43
+ const isValkeyEnable = () => Object.values(ValkeyStatus).some((s) => s === 'connected');
37
44
 
38
45
  /**
39
- * Creates and manages a connection to a Valkey server for a given instance.
40
- * It sets up a client, attaches event listeners for connection status, and implements a fallback to an in-memory dummy store if the connection fails.
41
- * @param {object} [instance={ host: '', path: '' }] - The instance identifier.
42
- * @param {string} [instance.host=''] - The host of the instance.
43
- * @param {string} [instance.path=''] - The path of the instance.
44
- * @param {object} [valkeyServerConnectionOptions={ host: '', path: '' }] - Connection options for the iovalkey client.
45
- * @returns {Promise<Valkey|undefined>} A promise that resolves to the Valkey client instance, or undefined if creation fails.
46
+ * Creates a Valkey client for the given instance and waits for connectivity.
47
+ * Throws on connection failure callers decide whether to abort or continue
48
+ * without Valkey.
49
+ *
50
+ * @param {{ host?: string, path?: string }} instance - Registry key descriptor.
51
+ * @param {{ host?: string, port?: number }} connectionOptions - iovalkey connection options.
52
+ * @returns {Promise<import('iovalkey').default>}
46
53
  * @memberof ValkeyService
47
54
  */
48
- const createValkeyConnection = async (
49
- instance = { host: '', path: '' },
50
- valkeyServerConnectionOptions = { host: '', path: '' },
51
- ) => {
55
+ const createValkeyConnection = async (instance = {}, connectionOptions = {}) => {
52
56
  const key = _instanceKey(instance);
53
- // Initialize dummy store for the instance
54
- if (!DummyStores[key]) DummyStores[key] = new Map();
55
57
 
56
- try {
57
- const client = await ValkeyAPI.valkeyClientFactory(valkeyServerConnectionOptions);
58
-
59
- // Attach listeners for visibility
60
- client.on?.('ready', () => {
61
- ValkeyStatus[key] = 'connected';
62
- logger.info('Valkey connected', { instance, status: ValkeyStatus[key] });
63
- });
64
- client.on?.('error', (err) => {
65
- // Switch to dummy if not yet connected
66
- if (ValkeyStatus[key] !== 'connected') {
67
- ValkeyStatus[key] = 'dummy';
68
- } else {
69
- ValkeyStatus[key] = 'error';
70
- }
71
- logger.warn('Valkey error', { err: err?.message, instance, status: ValkeyStatus[key] });
72
- });
73
- client.on?.('end', () => {
74
- if (ValkeyStatus[key] !== 'dummy') ValkeyStatus[key] = 'error';
75
- logger.warn('Valkey connection ended', { instance, status: ValkeyStatus[key] });
76
- });
77
-
78
- // Probe connectivity with a short timeout
79
- const probe = async () => {
58
+ const client = new Valkey({
59
+ port: connectionOptions.port ?? undefined,
60
+ host: connectionOptions.host ?? undefined,
61
+ // Retry indefinitely with capped exponential backoff (1 s → 30 s)
62
+ retryStrategy: (attempt) => Math.min(attempt * 1000, 30000),
63
+ // Fail commands immediately when not connected; do NOT queue them
64
+ maxRetriesPerRequest: 0,
65
+ });
66
+
67
+ client.on('ready', () => {
68
+ ValkeyStatus[key] = 'connected';
69
+ logger.info('Valkey connected', { instance });
70
+ });
71
+ client.on('error', (err) => {
72
+ ValkeyStatus[key] = 'error';
73
+ logger.error('Valkey error', { err: err?.message, instance });
74
+ if (Underpost.env.isInsideContainer()) Underpost.env.set('container-status', 'error');
75
+ });
76
+ client.on('reconnecting', () => {
77
+ ValkeyStatus[key] = 'reconnecting';
78
+ logger.warn('Valkey reconnecting...', { instance });
79
+ });
80
+ client.on('end', () => {
81
+ ValkeyStatus[key] = 'error';
82
+ logger.warn('Valkey connection ended', { instance });
83
+ });
84
+
85
+ // Verify connectivity with a probe before marking ready
86
+ await Promise.race([
87
+ (async () => {
80
88
  try {
81
- // basic ping via SET/GET roundtrip
82
- const probeKey = `__vk_probe_${Date.now()}`;
83
- await client.set(probeKey, '1');
84
- await client.get(probeKey);
89
+ const probe = `__vk_probe_${Date.now()}`;
90
+ await client.set(probe, '1');
91
+ await client.get(probe);
92
+ await client.del(probe);
85
93
  ValkeyStatus[key] = 'connected';
86
- } catch (e) {
87
- ValkeyStatus[key] = 'dummy';
88
- logger.warn('Valkey probe failed, falling back to dummy', { instance, error: e?.message });
94
+ } catch {
95
+ ValkeyStatus[key] = 'error';
89
96
  }
90
- };
91
-
92
- // Race with timeout to avoid hanging
93
- await Promise.race([probe(), new Promise((resolve) => setTimeout(resolve, 1000))]);
97
+ })(),
98
+ new Promise((resolve) => setTimeout(resolve, 1500)),
99
+ ]);
94
100
 
95
- ValkeyInstances[key] = client;
96
- if (!ValkeyStatus[key]) ValkeyStatus[key] = 'dummy';
97
- } catch (err) {
98
- ValkeyStatus[key] = 'dummy';
99
- logger.warn('Valkey client creation failed, using dummy', { instance, error: err?.message });
100
- }
101
-
102
- return ValkeyInstances[key];
101
+ ValkeyInstances[key] = client;
102
+ logger.info('Valkey instance registered', { key, status: ValkeyStatus[key] });
103
+ return client;
103
104
  };
104
105
 
106
+ // ─── Internal client resolver ─────────────────────────────────────────────────
107
+
105
108
  /**
106
- * Factory function to create a Data Transfer Object (DTO) from a payload.
107
- * It filters the payload to include only the keys specified in the `select` object.
108
- * @param {object} payload - The source object.
109
- * @param {object} select - An object where keys are field names and values are 1 to include them.
110
- * @returns {object} A new object containing only the selected fields from the payload.
111
- * @memberof ValkeyService
109
+ * Resolves the connected client for an instance or throws.
110
+ * @param {{ host?: string, path?: string }} options
111
+ * @returns {import('iovalkey').default}
112
112
  */
113
- const selectDtoFactory = (payload, select) => {
114
- const result = {};
115
- for (const key of Object.keys(select)) {
116
- if (select[key] === 1 && key in payload) result[key] = payload[key];
113
+ const _client = (options) => {
114
+ const k = _instanceKey(options);
115
+ const client = ValkeyInstances[k];
116
+ if (!client || ValkeyStatus[k] !== 'connected') {
117
+ throw new Error(`Valkey instance not connected: ${k}`);
117
118
  }
118
- return result;
119
+ return client;
119
120
  };
120
121
 
121
- /**
122
- * Factory function to create a new Valkey client instance.
123
- * @param {object} options - Connection options for the iovalkey client.
124
- * @returns {Promise<Valkey>} A promise that resolves to a new Valkey client.
125
- * @memberof ValkeyService
126
- */
127
- const valkeyClientFactory = async (options) => {
128
- const valkey = new Valkey({
129
- port: options?.port ? options.port : undefined,
130
- host: options?.host ? options.host : undefined,
131
- // Keep retry strategy minimal; state handled in createValkeyConnection
132
- retryStrategy: (attempt) => {
133
- if (attempt === 1) return undefined; // stop aggressive retries early
134
- return 1000; // retry interval if library continues
135
- },
136
- }); // Connect to 127.0.0.1:6379
137
- // new Valkey(6380); // 127.0.0.1:6380
138
- // new Valkey(6379, '192.168.1.1'); // 192.168.1.1:6379
139
- // new Valkey('/tmp/redis.sock');
140
- // new Valkey({
141
- // port: 6379, // Valkey port
142
- // host: '127.0.0.1', // Valkey host
143
- // username: 'default', // needs Valkey >= 6
144
- // password: 'my-top-secret',
145
- // db: 0, // Defaults to 0
146
- // });
147
- return valkey;
148
- };
122
+ // ─── CRUD ─────────────────────────────────────────────────────────────────────
149
123
 
150
124
  /**
151
- * Retrieves an object from Valkey by key for a specific instance.
152
- * If the Valkey client is not connected or an error occurs, it falls back to the dummy in-memory store.
153
- * It automatically parses JSON strings.
154
- * @param {object} [options={ host: '', path: '' }] - The instance identifier.
155
- * @param {string} [key=''] - The key of the object to retrieve.
156
- * @returns {Promise<object|string|null>} A promise that resolves to the retrieved object, string, or null if not found.
125
+ * Retrieves and JSON-parses a value by key.
126
+ * Returns null when the key does not exist.
127
+ *
128
+ * @param {{ host?: string, path?: string }} options
129
+ * @param {string} key
130
+ * @returns {Promise<object | string | null>}
157
131
  * @memberof ValkeyService
158
132
  */
159
- const getValkeyObject = async (options = { host: '', path: '' }, key = '') => {
160
- const k = _instanceKey(options);
161
- const status = ValkeyStatus[k];
133
+ const get = async (options, key) => {
134
+ const raw = await _client(options).get(key);
135
+ if (raw == null) return null;
162
136
  try {
163
- if (status === 'connected' && ValkeyInstances[k]) {
164
- const value = await ValkeyInstances[k].get(key);
165
- if (value == null) return null;
166
- try {
167
- return JSON.parse(value);
168
- } catch {
169
- // not JSON, return raw string
170
- return value;
171
- }
172
- }
173
- } catch (err) {
174
- logger.warn('Valkey get failed, using dummy', { key, err: err?.message });
137
+ return JSON.parse(raw);
138
+ } catch {
139
+ return raw;
175
140
  }
176
- // Dummy fallback returns stored value as-is (string or object)
177
- return DummyStores[k]?.get(key) ?? null;
178
141
  };
179
142
 
180
143
  /**
181
- * Sets an object or string in Valkey for a specific instance.
182
- * If the Valkey client is not connected, it writes to the in-memory dummy store instead.
183
- * Objects are automatically stringified.
184
- * @param {object} [options={ host: '', path: '' }] - The instance identifier.
185
- * @param {string} [key=''] - The key under which to store the payload.
186
- * @param {object|string} [payload={}] - The data to store.
187
- * @returns {Promise<string>} A promise that resolves to 'OK' on success.
144
+ * Serialises and stores a value by key.
145
+ * Pass `ttlMs` to set an expiry in milliseconds.
146
+ *
147
+ * @param {{ host?: string, path?: string }} options
148
+ * @param {string} key
149
+ * @param {object | string} payload
150
+ * @param {number} [ttlMs]
151
+ * @returns {Promise<string>} Resolves to 'OK'.
188
152
  * @memberof ValkeyService
189
153
  */
190
- const setValkeyObject = async (options = { host: '', path: '' }, key = '', payload = {}) => {
191
- const k = _instanceKey(options);
192
- const isString = typeof payload === 'string';
193
- const value = isString ? payload : JSON.stringify(payload);
194
- try {
195
- if (ValkeyStatus[k] === 'connected' && ValkeyInstances[k]) {
196
- return await ValkeyInstances[k].set(key, value);
197
- }
198
- } catch (err) {
199
- logger.warn('Valkey set failed, writing to dummy', { key, err: err?.message });
200
- }
201
- if (!DummyStores[k]) DummyStores[k] = new Map();
202
- // Store raw string or object accordingly
203
- DummyStores[k].set(key, isString ? payload : payload);
204
- return 'OK';
154
+ const set = async (options, key, payload, ttlMs) => {
155
+ const value = typeof payload === 'string' ? payload : JSON.stringify(payload);
156
+ if (ttlMs) return _client(options).set(key, value, 'PX', ttlMs);
157
+ return _client(options).set(key, value);
205
158
  };
206
159
 
207
160
  /**
208
- * Updates an existing object in Valkey by merging it with a new payload.
209
- * It retrieves the current object, merges it with the new payload, and sets the updated object back.
210
- * It also updates the `updatedAt` timestamp.
211
- * @param {object} [options={ host: '', path: '' }] - The instance identifier.
212
- * @param {string} [key=''] - The key of the object to update.
213
- * @param {object} [payload={}] - The new data to merge into the object.
214
- * @returns {Promise<string>} A promise that resolves to the result of the set operation.
161
+ * Deletes a key.
162
+ *
163
+ * @param {{ host?: string, path?: string }} options
164
+ * @param {string} key
165
+ * @returns {Promise<number>}
215
166
  * @memberof ValkeyService
216
167
  */
217
- const updateValkeyObject = async (options = { host: '', path: '' }, key = '', payload = {}) => {
218
- let base = await getValkeyObject(options, key);
219
- if (typeof base !== 'object' || base === null) base = {};
220
- base.updatedAt = new Date().toISOString();
221
- return await setValkeyObject(options, key, { ...base, ...payload });
222
- };
168
+ const del = async (options, key) => _client(options).del(key);
223
169
 
224
170
  /**
225
- * Factory function to create a new object based on a model schema.
226
- * It generates a new object with default properties like `_id`, `createdAt`, and `updatedAt`,
227
- * and model-specific properties.
228
- * @param {object} [options={ host: 'localhost', path: '', object: {} }] - Options for object creation.
229
- * @param {string} [options.host='localhost'] - The host context for the object.
230
- * @param {object} [options.object={}] - An initial object to extend.
231
- * @param {string} [model=''] - The name of the model schema to use (e.g., 'user').
232
- * @returns {Promise<object>} A promise that resolves to the newly created object.
171
+ * Shallow-merges `payload` into the existing object stored at `key`
172
+ * and persists the result. The `updatedAt` timestamp is refreshed automatically.
173
+ *
174
+ * @param {{ host?: string, path?: string }} options
175
+ * @param {string} key
176
+ * @param {object} payload
177
+ * @returns {Promise<string>} Resolves to 'OK'.
233
178
  * @memberof ValkeyService
234
179
  */
235
- const valkeyObjectFactory = async (options = { host: 'localhost', path: '', object: {} }, model = '') => {
236
- const idoDate = new Date().toISOString();
237
- options.object = options.object || {};
238
- const { object } = options;
239
- const _id = new mongoose.Types.ObjectId().toString();
240
- object._id = _id;
241
- object.createdAt = idoDate;
242
- object.updatedAt = idoDate;
243
- switch (model) {
244
- case 'user': {
245
- const role = 'guest';
246
- object._id = `${role}${_id}`;
247
- return {
248
- ...object,
249
- username: `${role}${_id.slice(-5)}`,
250
- email: `${_id}@${options.host}`,
251
- password: hashPassword(process.env.JWT_SECRET),
252
- role,
253
- failedLoginAttempts: 0,
254
- phoneNumbers: [],
255
- publicKey: [],
256
- profileImageId: null,
257
- emailConfirmed: false,
258
- recoverTimeOut: null,
259
- lastLoginDate: null,
260
- activeSessions: [],
261
- };
262
- }
263
- default:
264
- throw new Error(`model schema not found: ${model}`);
265
- }
180
+ const update = async (options, key, payload) => {
181
+ const base = (await get(options, key)) ?? {};
182
+ return set(options, key, { ...base, ...payload, updatedAt: new Date().toISOString() });
266
183
  };
267
184
 
185
+ // ─── Public API class ─────────────────────────────────────────────────────────
186
+
268
187
  /**
269
- * A collection of Valkey-related API functions.
270
- * @type {object}
271
- * @memberof ValkeyServiceService
188
+ * Namespace grouping all Valkey operations.
189
+ * @memberof ValkeyService
272
190
  */
273
- const ValkeyAPI = {
274
- valkeyClientFactory,
275
- selectDtoFactory,
276
- getValkeyObject,
277
- setValkeyObject,
278
- valkeyObjectFactory,
279
- updateValkeyObject,
280
- createValkeyConnection,
281
- };
282
-
283
- export {
284
- valkeyClientFactory,
285
- selectDtoFactory,
286
- getValkeyObject,
287
- setValkeyObject,
288
- valkeyObjectFactory,
289
- updateValkeyObject,
290
- isValkeyEnable,
291
- createValkeyConnection,
292
- ValkeyAPI,
293
- };
191
+ class ValkeyAPI {
192
+ /** @param {{ host?: string, path?: string }} options */
193
+ static isConnected = (options) => ValkeyStatus[_instanceKey(options)] === 'connected';
194
+ static get = get;
195
+ static set = set;
196
+ static del = del;
197
+ static update = update;
198
+ static createValkeyConnection = createValkeyConnection;
199
+ }
200
+
201
+ export { isValkeyEnable, createValkeyConnection, get, set, del, update, ValkeyAPI };
@@ -46,9 +46,9 @@ class IoChannel {
46
46
  constructor(IoInterface) {
47
47
  this.#IoInterface = {
48
48
  channel: '',
49
- connection: async (socket = {}, client = {}, wsManagementId = '') => {},
50
- controller: async (socket = {}, client = {}, payload = {}, wsManagementId = '', args = []) => {},
51
- disconnect: async (socket = {}, client = {}, reason = '', wsManagementId = '') => {},
49
+ connection: async (socket = {}, client = {}, hostKeyContext = '') => { },
50
+ controller: async (socket = {}, client = {}, payload = {}, hostKeyContext = '', args = []) => { },
51
+ disconnect: async (socket = {}, client = {}, reason = '', hostKeyContext = '') => { },
52
52
  stream: false,
53
53
  ...IoInterface,
54
54
  };
@@ -68,18 +68,18 @@ class IoChannel {
68
68
  * Sets up the listener for the channel message.
69
69
  *
70
70
  * @param {Socket} socket - The Socket.IO socket object.
71
- * @param {string} wsManagementId - Unique identifier for the WebSocket management context.
71
+ * @param {string} hostKeyContext - Unique identifier for the WebSocket management context.
72
72
  * @returns {Promise<void>}
73
73
  */
74
- async connection(socket, wsManagementId) {
74
+ async connection(socket, hostKeyContext) {
75
75
  try {
76
76
  this.client[socket.id] = socket;
77
77
  // Use bind/arrow function to maintain 'this' context for the controller
78
- socket.on(this.channel, (...args) => this.controller(socket, args, wsManagementId));
79
- await this.#IoInterface.connection(socket, this.client, wsManagementId);
78
+ socket.on(this.channel, (...args) => this.controller(socket, args, hostKeyContext));
79
+ await this.#IoInterface.connection(socket, this.client, hostKeyContext);
80
80
  logger.debug(`Socket ${socket.id} connected to channel ${this.channel}`);
81
81
  } catch (error) {
82
- logger.error(error, { channel: this.channel, wsManagementId, stack: error.stack });
82
+ logger.error(error, { channel: this.channel, hostKeyContext, stack: error.stack });
83
83
  }
84
84
  }
85
85
 
@@ -89,10 +89,10 @@ class IoChannel {
89
89
  * @method
90
90
  * @param {Socket} socket - The Socket.IO socket object.
91
91
  * @param {any[]} args - The raw arguments received from the socket event.
92
- * @param {string} wsManagementId - Unique identifier for the WebSocket management context.
92
+ * @param {string} hostKeyContext - Unique identifier for the WebSocket management context.
93
93
  * @returns {Promise<void>}
94
94
  */
95
- async controller(socket, args, wsManagementId) {
95
+ async controller(socket, args, hostKeyContext) {
96
96
  try {
97
97
  if (!args || args.length === 0) {
98
98
  logger.warn(`No arguments received for channel: ${this.channel}`, { socketId: socket.id });
@@ -101,9 +101,9 @@ class IoChannel {
101
101
  // Determine if JSON parsing is needed based on the stream flag
102
102
  const payload = this.#IoInterface.stream ? args[0] : JSON.parse(args[0]);
103
103
 
104
- await this.#IoInterface.controller(socket, this.client, payload, wsManagementId, args);
104
+ await this.#IoInterface.controller(socket, this.client, payload, hostKeyContext, args);
105
105
  } catch (error) {
106
- logger.error(error, { channel: this.channel, wsManagementId, socketId: socket.id, args, stack: error.stack });
106
+ logger.error(error, { channel: this.channel, hostKeyContext, socketId: socket.id, args, stack: error.stack });
107
107
  }
108
108
  }
109
109
 
@@ -112,16 +112,16 @@ class IoChannel {
112
112
  *
113
113
  * @param {Socket} socket - The Socket.IO socket object.
114
114
  * @param {string} reason - The reason for disconnection (e.g., 'client namespace disconnect').
115
- * @param {string} wsManagementId - Unique identifier for the WebSocket management context.
115
+ * @param {string} hostKeyContext - Unique identifier for the WebSocket management context.
116
116
  * @returns {Promise<void>}
117
117
  */
118
- async disconnect(socket, reason, wsManagementId) {
118
+ async disconnect(socket, reason, hostKeyContext) {
119
119
  try {
120
- await this.#IoInterface.disconnect(socket, this.client, reason, wsManagementId);
120
+ await this.#IoInterface.disconnect(socket, this.client, reason, hostKeyContext);
121
121
  delete this.client[socket.id];
122
122
  logger.debug(`Socket ${socket.id} disconnected from channel ${this.channel}. Reason: ${reason}`);
123
123
  } catch (error) {
124
- logger.error(error, { channel: this.channel, wsManagementId, reason, socketId: socket.id, stack: error.stack });
124
+ logger.error(error, { channel: this.channel, hostKeyContext, reason, socketId: socket.id, stack: error.stack });
125
125
  }
126
126
  }
127
127
  }
@@ -12,13 +12,13 @@ import { CoreWsEmitter } from '../core.ws.emit.js';
12
12
  * Broadcasts incoming messages to all other connected sockets.
13
13
  */
14
14
  class CoreWsChatChannel {
15
- /** @type {Object.<string, Object>} Per-instance state keyed by wsManagementId. */
15
+ /** @type {Object.<string, Object>} Per-instance state keyed by hostKeyContext. */
16
16
  static #state = {};
17
17
 
18
18
  /** @type {IoChannel} */
19
19
  static #io = new IoChannel({
20
20
  channel: 'chat',
21
- controller(socket, client, payload, wsManagementId) {
21
+ controller(socket, client, payload, hostKeyContext) {
22
22
  for (const socketId of Object.keys(client)) {
23
23
  if (socketId !== socket.id) {
24
24
  CoreWsEmitter.emit('chat', client[socketId], { id: socket.id, ...payload });
@@ -39,29 +39,29 @@ class CoreWsChatChannel {
39
39
 
40
40
  /**
41
41
  * Initializes state for a server instance.
42
- * @param {string} wsManagementId - Unique server context ID.
42
+ * @param {string} hostKeyContext - Unique server context ID.
43
43
  */
44
- static init(wsManagementId) {
45
- this.#state[wsManagementId] = {};
44
+ static init(hostKeyContext) {
45
+ this.#state[hostKeyContext] = {};
46
46
  }
47
47
 
48
48
  /**
49
49
  * Registers a socket connection.
50
50
  * @param {import('socket.io').Socket} socket
51
- * @param {string} wsManagementId
51
+ * @param {string} hostKeyContext
52
52
  */
53
- static connection(socket, wsManagementId) {
54
- return this.#io.connection(socket, wsManagementId);
53
+ static connection(socket, hostKeyContext) {
54
+ return this.#io.connection(socket, hostKeyContext);
55
55
  }
56
56
 
57
57
  /**
58
58
  * Handles socket disconnection.
59
59
  * @param {import('socket.io').Socket} socket
60
60
  * @param {string} reason
61
- * @param {string} wsManagementId
61
+ * @param {string} hostKeyContext
62
62
  */
63
- static disconnect(socket, reason, wsManagementId) {
64
- return this.#io.disconnect(socket, reason, wsManagementId);
63
+ static disconnect(socket, reason, hostKeyContext) {
64
+ return this.#io.disconnect(socket, reason, hostKeyContext);
65
65
  }
66
66
  }
67
67