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
@@ -0,0 +1,505 @@
1
+ /**
2
+ * Procedural World Generator — pure-function module.
3
+ *
4
+ * Centralises every procedural entity generator used by the Cyberia Online
5
+ * engine (obstacles, foreground, resources, floors, portals, bots) together
6
+ * with the shared helpers they need (colour conversion, random numbers,
7
+ * occupancy-grid placement).
8
+ *
9
+ * Consumers:
10
+ * - cyberia-fallback-world.js (full fallback world)
11
+ * - cyberia-portal-connector.js (no generators — uses colour/random helpers only)
12
+ * - cyberia-instance.service.js (optional entity back-fill in portalConnect endpoint)
13
+ *
14
+ * All exported functions are stateless and synchronous.
15
+ *
16
+ * @module src/api/cyberia-instance/cyberia-world-generator
17
+ */
18
+
19
+ import {
20
+ ENTITY_TYPE_DEFAULTS,
21
+ RESOURCE_ENTITY_TYPE_DEFAULTS,
22
+ } from '../cyberia-instance-conf/cyberia-instance-conf.defaults.js';
23
+
24
+ import { DefaultCyberiaItems, ITEM_TYPES } from '../../client/components/cyberia-portal/CommonCyberiaPortal.js';
25
+
26
+ import { PORTAL_MODES, PORTAL_MODE_COLOR_KEY, EXTRA_PORTAL_MODES } from './cyberia-portal-connector.js';
27
+
28
+ // ── Color helpers ────────────────────────────────────────────────────────────
29
+
30
+ /**
31
+ * Convert a { r, g, b, a } palette entry to an `rgba(…)` CSS string.
32
+ * @param {{ r: number, g: number, b: number, a: number }} c
33
+ * @returns {string}
34
+ */
35
+ const colorToRgba = (c) => `rgba(${c.r}, ${c.g}, ${c.b}, ${c.a / 255})`;
36
+
37
+ /**
38
+ * Look up a palette entry by key from a colours array.
39
+ * @param {Array<{ key: string, r: number, g: number, b: number, a: number }>} colors
40
+ * @param {string} key
41
+ * @returns {{ r: number, g: number, b: number, a: number } | undefined}
42
+ */
43
+ const findColor = (colors, key) => colors.find((c) => c.key === key);
44
+
45
+ // ── Random helpers ───────────────────────────────────────────────────────────
46
+
47
+ /**
48
+ * Return a random integer in [min, max] (inclusive).
49
+ * @param {number} min
50
+ * @param {number} max
51
+ * @returns {number}
52
+ */
53
+ const randInt = (min, max) => min + Math.floor(Math.random() * (max - min + 1));
54
+
55
+ // ── Entity count ranges ──────────────────────────────────────────────────────
56
+ // [min, max] — actual count is random within range on each generation call.
57
+
58
+ const OBSTACLE_RANGE = [20, 35];
59
+ const FOREGROUND_RANGE = [10, 20];
60
+ const BOT_RANGE = [8, 16];
61
+ const RESOURCE_RANGE = [6, 12];
62
+ const BOT_WEAPON_CHANCE = 0.6;
63
+ const PORTAL_DIM_RANGE = [2, 3];
64
+ const PORTAL_COUNT_RANGE = [2, 4];
65
+
66
+ // ── Bot defaults ─────────────────────────────────────────────────────────────
67
+
68
+ const DEFAULT_BOT_DIM_RANGE = [2, 3];
69
+ const DEFAULT_FLOOR_TILE_DIM = 4;
70
+
71
+ function pickDefaultResourceItemIds() {
72
+ const resourceBuilds = RESOURCE_ENTITY_TYPE_DEFAULTS.filter((build) => build.liveItemIds?.length);
73
+ if (resourceBuilds.length === 0) {
74
+ return ['wood'];
75
+ }
76
+ const build = resourceBuilds[randInt(0, resourceBuilds.length - 1)];
77
+ return [...build.liveItemIds];
78
+ }
79
+
80
+ /** NPC skin pool — all items with type 'skin' from DefaultCyberiaItems. */
81
+ const BOT_SKIN_POOL = DefaultCyberiaItems.filter((e) => e.item.type === ITEM_TYPES.skin).map((e) => e.item.id);
82
+
83
+ // ── Occupancy grid ───────────────────────────────────────────────────────────
84
+
85
+ /**
86
+ * 2D boolean grid that tracks which cells are blocked (obstacle / placed entity).
87
+ * Used to find valid walkable positions when placing portals and bots.
88
+ */
89
+ class OccupancyGrid {
90
+ /**
91
+ * @param {number} width Grid columns.
92
+ * @param {number} height Grid rows.
93
+ */
94
+ constructor(width, height) {
95
+ this.width = width;
96
+ this.height = height;
97
+ // false = walkable, true = blocked
98
+ this.cells = Array.from({ length: height }, () => new Array(width).fill(false));
99
+ }
100
+
101
+ /**
102
+ * Mark a rectangular region as blocked.
103
+ * @param {number} x
104
+ * @param {number} y
105
+ * @param {number} w
106
+ * @param {number} h
107
+ */
108
+ block(x, y, w, h) {
109
+ for (let row = y; row < y + h && row < this.height; row++) {
110
+ for (let col = x; col < x + w && col < this.width; col++) {
111
+ if (row >= 0 && col >= 0) this.cells[row][col] = true;
112
+ }
113
+ }
114
+ }
115
+
116
+ /**
117
+ * Check whether a rectangle fits entirely within walkable (unblocked) cells.
118
+ * @param {number} x
119
+ * @param {number} y
120
+ * @param {number} w
121
+ * @param {number} h
122
+ * @returns {boolean}
123
+ */
124
+ fits(x, y, w, h) {
125
+ if (x < 0 || y < 0 || x + w > this.width || y + h > this.height) return false;
126
+ for (let row = y; row < y + h; row++) {
127
+ for (let col = x; col < x + w; col++) {
128
+ if (this.cells[row][col]) return false;
129
+ }
130
+ }
131
+ return true;
132
+ }
133
+
134
+ /**
135
+ * Find a random walkable position for a rectangle of given dimensions.
136
+ * Tries up to `maxAttempts` random positions before giving up.
137
+ * @param {number} w
138
+ * @param {number} h
139
+ * @param {number} [maxAttempts=200]
140
+ * @returns {{ x: number, y: number } | null} Position or null if no fit found.
141
+ */
142
+ findPosition(w, h, maxAttempts = 200) {
143
+ const maxX = Math.max(0, this.width - w);
144
+ const maxY = Math.max(0, this.height - h);
145
+ for (let i = 0; i < maxAttempts; i++) {
146
+ const x = randInt(0, maxX);
147
+ const y = randInt(0, maxY);
148
+ if (this.fits(x, y, w, h)) return { x, y };
149
+ }
150
+ return null;
151
+ }
152
+
153
+ /**
154
+ * Populate the grid from an array of obstacle entities.
155
+ * @param {Array<{ initCellX: number, initCellY: number, dimX: number, dimY: number }>} obstacles
156
+ */
157
+ addObstacles(obstacles) {
158
+ for (const o of obstacles) {
159
+ this.block(o.initCellX, o.initCellY, o.dimX, o.dimY);
160
+ }
161
+ }
162
+ }
163
+
164
+ // ── Procedural entity generators ─────────────────────────────────────────────
165
+
166
+ /**
167
+ * Generate floor tiles that cover the entire map grid.
168
+ * Floor is NOT random — it tiles deterministically so every cell is covered.
169
+ *
170
+ * @param {{ gridX: number, gridY: number }} mapDims
171
+ * @param {Array<{ key: string, r: number, g: number, b: number, a: number }>} colors
172
+ * @param {object} [opts]
173
+ * @param {number} [opts.tileDim=4] Floor tile size in cells.
174
+ * @returns {object[]}
175
+ */
176
+ function generateFloorEntities(mapDims, colors, opts = {}) {
177
+ const { tileDim = DEFAULT_FLOOR_TILE_DIM } = opts;
178
+ const floorDefault = ENTITY_TYPE_DEFAULTS.find((d) => d.entityType === 'floor');
179
+ const floorItemIds = floorDefault?.liveItemIds?.length ? [...floorDefault.liveItemIds] : [];
180
+ const floorColor = findColor(colors, 'FLOOR');
181
+ const rgba = floorColor ? colorToRgba(floorColor) : '';
182
+
183
+ const entities = [];
184
+ for (let y = 0; y < mapDims.gridY; y += tileDim) {
185
+ for (let x = 0; x < mapDims.gridX; x += tileDim) {
186
+ entities.push({
187
+ entityType: 'floor',
188
+ initCellX: x,
189
+ initCellY: y,
190
+ dimX: Math.min(tileDim, mapDims.gridX - x),
191
+ dimY: Math.min(tileDim, mapDims.gridY - y),
192
+ color: rgba,
193
+ objectLayerItemIds: floorItemIds,
194
+ });
195
+ }
196
+ }
197
+ return entities;
198
+ }
199
+
200
+ /**
201
+ * Generate procedural obstacle entities for a map.
202
+ *
203
+ * @param {{ gridX: number, gridY: number }} mapDims Map grid dimensions.
204
+ * @param {Array<{ key: string, r: number, g: number, b: number, a: number }>} colors Palette.
205
+ * @param {object} [opts]
206
+ * @param {number} [opts.count] Override count (ignores range).
207
+ * @param {number} [opts.minDim=1] Minimum obstacle width/height (cells).
208
+ * @param {number} [opts.maxDim=4] Maximum obstacle width/height (cells).
209
+ * @returns {object[]} Array of CyberiaEntity plain objects.
210
+ */
211
+ function generateObstacles(mapDims, colors, opts = {}) {
212
+ const { minDim = 1, maxDim = 4 } = opts;
213
+ const count = opts.count ?? randInt(OBSTACLE_RANGE[0], OBSTACLE_RANGE[1]);
214
+ const { gridX, gridY } = mapDims;
215
+
216
+ const obstacleColor = findColor(colors, 'OBSTACLE');
217
+ const rgba = obstacleColor ? colorToRgba(obstacleColor) : 'rgba(80, 80, 80, 1)';
218
+
219
+ const entities = [];
220
+ for (let i = 0; i < count; i++) {
221
+ const dimX = randInt(minDim, maxDim);
222
+ const dimY = randInt(minDim, maxDim);
223
+ const maxX = Math.max(0, gridX - dimX);
224
+ const maxY = Math.max(0, gridY - dimY);
225
+ entities.push({
226
+ entityType: 'obstacle',
227
+ initCellX: randInt(0, maxX),
228
+ initCellY: randInt(0, maxY),
229
+ dimX,
230
+ dimY,
231
+ color: rgba,
232
+ objectLayerItemIds: [],
233
+ });
234
+ }
235
+ return entities;
236
+ }
237
+
238
+ /**
239
+ * Generate procedural foreground entities for a map.
240
+ *
241
+ * @param {{ gridX: number, gridY: number }} mapDims Map grid dimensions.
242
+ * @param {Array<{ key: string, r: number, g: number, b: number, a: number }>} colors Palette.
243
+ * @param {object} [opts]
244
+ * @param {number} [opts.count] Override count (ignores range).
245
+ * @param {number} [opts.minDim=2] Minimum foreground width/height (cells).
246
+ * @param {number} [opts.maxDim=6] Maximum foreground width/height (cells).
247
+ * @returns {object[]} Array of CyberiaEntity plain objects.
248
+ */
249
+ function generateForeground(mapDims, colors, opts = {}) {
250
+ const { minDim = 2, maxDim = 6 } = opts;
251
+ const count = opts.count ?? randInt(FOREGROUND_RANGE[0], FOREGROUND_RANGE[1]);
252
+ const { gridX, gridY } = mapDims;
253
+
254
+ const fgColor = findColor(colors, 'FOREGROUND');
255
+ const rgba = fgColor ? colorToRgba(fgColor) : 'rgba(200, 200, 200, 0.31)';
256
+
257
+ const entities = [];
258
+ for (let i = 0; i < count; i++) {
259
+ const dimX = randInt(minDim, maxDim);
260
+ const dimY = randInt(minDim, maxDim);
261
+ const maxX = Math.max(0, gridX - dimX);
262
+ const maxY = Math.max(0, gridY - dimY);
263
+ entities.push({
264
+ entityType: 'foreground',
265
+ initCellX: randInt(0, maxX),
266
+ initCellY: randInt(0, maxY),
267
+ dimX,
268
+ dimY,
269
+ color: rgba,
270
+ objectLayerItemIds: [],
271
+ });
272
+ }
273
+ return entities;
274
+ }
275
+
276
+ /**
277
+ * Generate procedural resource entities for a map.
278
+ *
279
+ * Resources are static, exploitable entities (wood, minerals, etc.).
280
+ * They use the RESOURCE palette colour as fallback and are placed
281
+ * on walkable cells via the occupancy grid when provided.
282
+ *
283
+ * @param {{ gridX: number, gridY: number }} mapDims Map grid dimensions.
284
+ * @param {Array<{ key: string, r: number, g: number, b: number, a: number }>} colors Palette.
285
+ * @param {object} [opts]
286
+ * @param {number} [opts.count] Override count (ignores range).
287
+ * @param {number} [opts.dim=2] Resource width/height (cells).
288
+ * @param {number} [opts.maxLife=80] Hit-points before destruction.
289
+ * @param {string[]} [opts.itemIds] Object layer item IDs (default: resource liveItemIds from instance defaults).
290
+ * @param {OccupancyGrid} [opts.grid] If provided, places resources only on walkable cells.
291
+ * @returns {object[]} Array of CyberiaEntity plain objects.
292
+ */
293
+ function generateResources(mapDims, colors, opts = {}) {
294
+ const { dim = 2, maxLife = 80 } = opts;
295
+ const count = opts.count ?? randInt(RESOURCE_RANGE[0], RESOURCE_RANGE[1]);
296
+ const fixedItemIds = opts.itemIds != null ? [...opts.itemIds] : null;
297
+ const resColor = findColor(colors, 'RESOURCE');
298
+ const rgba = resColor ? colorToRgba(resColor) : 'rgba(100, 180, 80, 1)';
299
+
300
+ const entities = [];
301
+ for (let i = 0; i < count; i++) {
302
+ let cellX, cellY;
303
+ if (opts.grid) {
304
+ const pos = opts.grid.findPosition(dim, dim);
305
+ if (!pos) continue;
306
+ opts.grid.block(pos.x, pos.y, dim, dim);
307
+ cellX = pos.x;
308
+ cellY = pos.y;
309
+ } else {
310
+ const maxX = Math.max(0, mapDims.gridX - dim);
311
+ const maxY = Math.max(0, mapDims.gridY - dim);
312
+ cellX = randInt(0, maxX);
313
+ cellY = randInt(0, maxY);
314
+ }
315
+
316
+ entities.push({
317
+ entityType: 'resource',
318
+ initCellX: cellX,
319
+ initCellY: cellY,
320
+ dimX: dim,
321
+ dimY: dim,
322
+ color: rgba,
323
+ objectLayerItemIds: fixedItemIds ? [...fixedItemIds] : pickDefaultResourceItemIds(),
324
+ maxLife,
325
+ });
326
+ }
327
+ return entities;
328
+ }
329
+
330
+ /**
331
+ * Generate a portal entity at a random walkable position with random dimensions.
332
+ *
333
+ * @param {{ gridX: number, gridY: number }} mapDims
334
+ * @param {Array<{ key: string, r: number, g: number, b: number, a: number }>} colors
335
+ * @param {OccupancyGrid} [grid] If provided, places portal only on walkable cells and marks them blocked.
336
+ * @param {string} [portalSubtype] One of PORTAL_MODE_LIST values. Determines the portal colour.
337
+ * @returns {object|null} Portal entity or null if no valid position found.
338
+ */
339
+ function generatePortalEntity(mapDims, colors, grid, portalSubtype) {
340
+ const colorKey = portalSubtype ? PORTAL_MODE_COLOR_KEY[portalSubtype] : 'PORTAL';
341
+ const portalColor = findColor(colors, colorKey) || findColor(colors, 'PORTAL');
342
+ const rgba = portalColor ? colorToRgba(portalColor) : 'rgba(0, 200, 200, 1)';
343
+ const dimX = randInt(PORTAL_DIM_RANGE[0], PORTAL_DIM_RANGE[1]);
344
+ const dimY = randInt(PORTAL_DIM_RANGE[0], PORTAL_DIM_RANGE[1]);
345
+
346
+ if (grid) {
347
+ const pos = grid.findPosition(dimX, dimY);
348
+ if (!pos) return null;
349
+ grid.block(pos.x, pos.y, dimX, dimY);
350
+ return {
351
+ entityType: 'portal',
352
+ portalSubtype: portalSubtype || 'inter-portal',
353
+ initCellX: pos.x,
354
+ initCellY: pos.y,
355
+ dimX,
356
+ dimY,
357
+ color: rgba,
358
+ objectLayerItemIds: [],
359
+ };
360
+ }
361
+
362
+ const maxX = Math.max(0, mapDims.gridX - dimX);
363
+ const maxY = Math.max(0, mapDims.gridY - dimY);
364
+ return {
365
+ entityType: 'portal',
366
+ portalSubtype: portalSubtype || 'inter-portal',
367
+ initCellX: randInt(0, maxX),
368
+ initCellY: randInt(0, maxY),
369
+ dimX,
370
+ dimY,
371
+ color: rgba,
372
+ objectLayerItemIds: [],
373
+ };
374
+ }
375
+
376
+ /**
377
+ * Generate a random number of portal entities for a map, each with a
378
+ * randomly assigned portal subtype (and corresponding colour).
379
+ *
380
+ * @param {{ gridX: number, gridY: number }} mapDims
381
+ * @param {Array<{ key: string, r: number, g: number, b: number, a: number }>} colors
382
+ * @param {object} [opts]
383
+ * @param {number} [opts.count] Override count (ignores range).
384
+ * @param {OccupancyGrid} [opts.grid] If provided, places portals only on walkable cells.
385
+ * @returns {object[]}
386
+ */
387
+ function generatePortalEntities(mapDims, colors, opts = {}) {
388
+ const count = opts.count ?? randInt(PORTAL_COUNT_RANGE[0], PORTAL_COUNT_RANGE[1]);
389
+ const entities = [];
390
+ for (let i = 0; i < count; i++) {
391
+ // First portal is always inter-portal (reserved for the ring topology);
392
+ // extra portals get a random non-ring subtype.
393
+ const subtype =
394
+ i === 0 ? PORTAL_MODES.INTER_PORTAL : EXTRA_PORTAL_MODES[Math.floor(Math.random() * EXTRA_PORTAL_MODES.length)];
395
+ const portal = generatePortalEntity(mapDims, colors, opts.grid, subtype);
396
+ if (portal) entities.push(portal);
397
+ }
398
+ return entities;
399
+ }
400
+
401
+ /**
402
+ * Generate bot entities for a map.
403
+ *
404
+ * @param {{ gridX: number, gridY: number }} mapDims
405
+ * @param {Array<{ key: string, r: number, g: number, b: number, a: number }>} colors
406
+ * @param {object} [opts]
407
+ * @param {number} [opts.count] Override count (ignores range).
408
+ * @param {number} [opts.spawnRadius]
409
+ * @param {number} [opts.aggroRange]
410
+ * @param {number} [opts.maxLife]
411
+ * @param {OccupancyGrid} [opts.grid] If provided, places bots only on walkable cells.
412
+ * @returns {object[]}
413
+ */
414
+ function generateBots(mapDims, colors, opts = {}) {
415
+ const count = opts.count ?? randInt(BOT_RANGE[0], BOT_RANGE[1]);
416
+ const { spawnRadius = 5, aggroRange = 10, maxLife = 100 } = opts;
417
+ const botColor = findColor(colors, 'BOT');
418
+ const rgba = botColor ? colorToRgba(botColor) : 'rgba(255, 128, 0, 1)';
419
+
420
+ const entities = [];
421
+ for (let i = 0; i < count; i++) {
422
+ const dim = randInt(DEFAULT_BOT_DIM_RANGE[0], DEFAULT_BOT_DIM_RANGE[1]);
423
+
424
+ let cellX, cellY;
425
+ if (opts.grid) {
426
+ const pos = opts.grid.findPosition(dim, dim);
427
+ if (!pos) continue;
428
+ opts.grid.block(pos.x, pos.y, dim, dim);
429
+ cellX = pos.x;
430
+ cellY = pos.y;
431
+ } else {
432
+ const maxX = Math.max(0, mapDims.gridX - dim);
433
+ const maxY = Math.max(0, mapDims.gridY - dim);
434
+ cellX = randInt(0, maxX);
435
+ cellY = randInt(0, maxY);
436
+ }
437
+
438
+ const skin = BOT_SKIN_POOL[Math.floor(Math.random() * BOT_SKIN_POOL.length)];
439
+ const hasWeapon = Math.random() < BOT_WEAPON_CHANCE;
440
+ const itemIds = hasWeapon ? [skin, 'atlas_pistol_mk2'] : [skin];
441
+
442
+ entities.push({
443
+ entityType: 'bot',
444
+ initCellX: cellX,
445
+ initCellY: cellY,
446
+ dimX: dim,
447
+ dimY: dim,
448
+ color: rgba,
449
+ objectLayerItemIds: itemIds,
450
+ spawnRadius,
451
+ aggroRange,
452
+ maxLife,
453
+ lifeRegen: 0,
454
+ });
455
+ }
456
+ return entities;
457
+ }
458
+
459
+ /**
460
+ * Generate all procedural fallback entities (obstacles + foreground + resources) for a map.
461
+ *
462
+ * @param {{ gridX: number, gridY: number }} mapDims
463
+ * @param {Array<{ key: string, r: number, g: number, b: number, a: number }>} colors
464
+ * @param {object} [opts]
465
+ * @param {number} [opts.obstacleCount]
466
+ * @param {number} [opts.foregroundCount]
467
+ * @param {number} [opts.resourceCount]
468
+ * @param {OccupancyGrid} [opts.grid]
469
+ * @returns {{ obstacles: object[], foreground: object[], resources: object[] }}
470
+ */
471
+ function generateProceduralEntities(mapDims, colors, opts = {}) {
472
+ return {
473
+ obstacles: generateObstacles(mapDims, colors, { count: opts.obstacleCount }),
474
+ foreground: generateForeground(mapDims, colors, { count: opts.foregroundCount }),
475
+ resources: generateResources(mapDims, colors, { count: opts.resourceCount, grid: opts.grid }),
476
+ };
477
+ }
478
+
479
+ // ── Public API ───────────────────────────────────────────────────────────────
480
+
481
+ export {
482
+ // Helpers
483
+ colorToRgba,
484
+ findColor,
485
+ randInt,
486
+ // Placement
487
+ OccupancyGrid,
488
+ // Generators
489
+ generateFloorEntities,
490
+ generateObstacles,
491
+ generateForeground,
492
+ generateResources,
493
+ generatePortalEntity,
494
+ generatePortalEntities,
495
+ generateBots,
496
+ generateProceduralEntities,
497
+ // Ranges
498
+ OBSTACLE_RANGE,
499
+ FOREGROUND_RANGE,
500
+ BOT_RANGE,
501
+ RESOURCE_RANGE,
502
+ BOT_WEAPON_CHANCE,
503
+ PORTAL_DIM_RANGE,
504
+ PORTAL_COUNT_RANGE,
505
+ };
@@ -0,0 +1,74 @@
1
+ import { loggerFactory } from '../../server/logger.js';
2
+ import { CyberiaInstanceConfService } from './cyberia-instance-conf.service.js';
3
+
4
+ const logger = loggerFactory(import.meta);
5
+
6
+ class CyberiaInstanceConfController {
7
+ static post = async (req, res, options) => {
8
+ try {
9
+ const result = await CyberiaInstanceConfService.post(req, res, options);
10
+ return res.status(200).json({
11
+ status: 'success',
12
+ data: result,
13
+ });
14
+ } catch (error) {
15
+ logger.error(error, error.stack);
16
+ return res.status(400).json({
17
+ status: 'error',
18
+ message: error.message,
19
+ });
20
+ }
21
+ };
22
+ static get = async (req, res, options) => {
23
+ try {
24
+ const { page, limit } = req.query;
25
+ const result = await CyberiaInstanceConfService.get(
26
+ { ...req, query: { ...req.query, page: parseInt(page), limit: parseInt(limit) } },
27
+ res,
28
+ options,
29
+ );
30
+ return res.status(200).json({
31
+ status: 'success',
32
+ data: result,
33
+ });
34
+ } catch (error) {
35
+ logger.error(error, error.stack);
36
+ return res.status(400).json({
37
+ status: 'error',
38
+ message: error.message,
39
+ });
40
+ }
41
+ };
42
+ static put = async (req, res, options) => {
43
+ try {
44
+ const result = await CyberiaInstanceConfService.put(req, res, options);
45
+ return res.status(200).json({
46
+ status: 'success',
47
+ data: result,
48
+ });
49
+ } catch (error) {
50
+ logger.error(error, error.stack);
51
+ return res.status(400).json({
52
+ status: 'error',
53
+ message: error.message,
54
+ });
55
+ }
56
+ };
57
+ static delete = async (req, res, options) => {
58
+ try {
59
+ const result = await CyberiaInstanceConfService.delete(req, res, options);
60
+ return res.status(200).json({
61
+ status: 'success',
62
+ data: result,
63
+ });
64
+ } catch (error) {
65
+ logger.error(error, error.stack);
66
+ return res.status(400).json({
67
+ status: 'error',
68
+ message: error.message,
69
+ });
70
+ }
71
+ };
72
+ }
73
+
74
+ export { CyberiaInstanceConfController };