cyberia 3.1.3 → 3.2.5

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 (208) 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 +13 -8
  10. package/CHANGELOG.md +433 -1
  11. package/CLI-HELP.md +57 -7
  12. package/Dockerfile +4 -2
  13. package/README.md +347 -22
  14. package/bin/build.js +5 -2
  15. package/bin/cyberia.js +1789 -112
  16. package/bin/deploy.js +177 -124
  17. package/bin/file.js +3 -0
  18. package/bin/index.js +1789 -112
  19. package/conf.js +64 -8
  20. package/deployment.yaml +92 -20
  21. package/hardhat/hardhat.config.js +13 -13
  22. package/hardhat/ignition/modules/ObjectLayerToken.js +1 -1
  23. package/hardhat/package-lock.json +2554 -5859
  24. package/hardhat/package.json +13 -22
  25. package/hardhat/scripts/deployObjectLayerToken.js +1 -1
  26. package/hardhat/test/ObjectLayerToken.js +4 -2
  27. package/hardhat/types/ethers-contracts/ObjectLayerToken.ts +690 -0
  28. package/hardhat/types/ethers-contracts/common.ts +92 -0
  29. package/hardhat/types/ethers-contracts/factories/ObjectLayerToken__factory.ts +1055 -0
  30. package/hardhat/types/ethers-contracts/factories/index.ts +4 -0
  31. package/hardhat/types/ethers-contracts/hardhat.d.ts +47 -0
  32. package/hardhat/types/ethers-contracts/index.ts +6 -0
  33. package/jsdoc.dd-cyberia.json +64 -55
  34. package/jsdoc.json +64 -55
  35. package/manifests/cronjobs/dd-cron/dd-cron-backup.yaml +5 -4
  36. package/manifests/cronjobs/dd-cron/dd-cron-dns.yaml +5 -4
  37. package/manifests/deployment/dd-cyberia-development/deployment.yaml +92 -20
  38. package/manifests/deployment/dd-cyberia-development/proxy.yaml +54 -18
  39. package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
  40. package/manifests/deployment/dd-test-development/deployment.yaml +88 -74
  41. package/manifests/deployment/dd-test-development/proxy.yaml +13 -4
  42. package/manifests/deployment/playwright/deployment.yaml +1 -1
  43. package/nodemon.json +1 -1
  44. package/package.json +22 -16
  45. package/proxy.yaml +54 -18
  46. package/scripts/rhel-grpc-setup.sh +56 -0
  47. package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.controller.js +44 -0
  48. package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.model.js +16 -0
  49. package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.router.js +5 -0
  50. package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.service.js +80 -7
  51. package/src/api/cyberia-dialogue/cyberia-dialogue.controller.js +93 -0
  52. package/src/api/cyberia-dialogue/cyberia-dialogue.model.js +36 -0
  53. package/src/api/cyberia-dialogue/cyberia-dialogue.router.js +29 -0
  54. package/src/api/cyberia-dialogue/cyberia-dialogue.service.js +51 -0
  55. package/src/api/cyberia-entity/cyberia-entity.controller.js +74 -0
  56. package/src/api/cyberia-entity/cyberia-entity.model.js +24 -0
  57. package/src/api/cyberia-entity/cyberia-entity.router.js +27 -0
  58. package/src/api/cyberia-entity/cyberia-entity.service.js +42 -0
  59. package/src/api/cyberia-instance/cyberia-fallback-world.js +368 -0
  60. package/src/api/cyberia-instance/cyberia-instance.controller.js +92 -0
  61. package/src/api/cyberia-instance/cyberia-instance.model.js +84 -0
  62. package/src/api/cyberia-instance/cyberia-instance.router.js +63 -0
  63. package/src/api/cyberia-instance/cyberia-instance.service.js +191 -0
  64. package/src/api/cyberia-instance/cyberia-portal-connector.js +486 -0
  65. package/src/api/cyberia-instance-conf/cyberia-instance-conf.controller.js +74 -0
  66. package/src/api/cyberia-instance-conf/cyberia-instance-conf.defaults.js +413 -0
  67. package/src/api/cyberia-instance-conf/cyberia-instance-conf.model.js +228 -0
  68. package/src/api/cyberia-instance-conf/cyberia-instance-conf.router.js +27 -0
  69. package/src/api/cyberia-instance-conf/cyberia-instance-conf.service.js +42 -0
  70. package/src/api/cyberia-map/cyberia-map.controller.js +79 -0
  71. package/src/api/cyberia-map/cyberia-map.model.js +30 -0
  72. package/src/api/cyberia-map/cyberia-map.router.js +40 -0
  73. package/src/api/cyberia-map/cyberia-map.service.js +74 -0
  74. package/src/api/file/file.ref.json +18 -0
  75. package/src/api/ipfs/ipfs.controller.js +4 -25
  76. package/src/api/ipfs/ipfs.model.js +43 -34
  77. package/src/api/ipfs/ipfs.router.js +8 -13
  78. package/src/api/ipfs/ipfs.service.js +54 -102
  79. package/src/api/object-layer/README.md +347 -22
  80. package/src/api/object-layer/object-layer.router.js +30 -0
  81. package/src/api/object-layer/object-layer.service.js +114 -31
  82. package/src/api/user/user.service.js +8 -7
  83. package/src/cli/cluster.js +7 -7
  84. package/src/cli/db.js +710 -827
  85. package/src/cli/deploy.js +151 -93
  86. package/src/cli/env.js +29 -0
  87. package/src/cli/fs.js +5 -2
  88. package/src/cli/index.js +48 -2
  89. package/src/cli/kubectl.js +211 -0
  90. package/src/cli/release.js +284 -0
  91. package/src/cli/repository.js +438 -75
  92. package/src/cli/run.js +195 -35
  93. package/src/cli/secrets.js +73 -0
  94. package/src/cli/test.js +3 -3
  95. package/src/client/Cryptokoyn.index.js +3 -4
  96. package/src/client/CyberiaPortal.index.js +3 -4
  97. package/src/client/Default.index.js +3 -4
  98. package/src/client/Itemledger.index.js +3 -4
  99. package/src/client/Underpost.index.js +3 -4
  100. package/src/client/components/core/AppStore.js +69 -0
  101. package/src/client/components/core/CalendarCore.js +2 -2
  102. package/src/client/components/core/DropDown.js +137 -17
  103. package/src/client/components/core/Keyboard.js +2 -2
  104. package/src/client/components/core/LogIn.js +2 -2
  105. package/src/client/components/core/LogOut.js +2 -2
  106. package/src/client/components/core/Modal.js +0 -1
  107. package/src/client/components/core/Panel.js +0 -1
  108. package/src/client/components/core/PanelForm.js +19 -19
  109. package/src/client/components/core/SocketIo.js +82 -29
  110. package/src/client/components/core/SocketIoHandler.js +75 -0
  111. package/src/client/components/core/Stream.js +143 -95
  112. package/src/client/components/core/Webhook.js +40 -7
  113. package/src/client/components/cryptokoyn/AppStoreCryptokoyn.js +5 -0
  114. package/src/client/components/cryptokoyn/LogInCryptokoyn.js +3 -3
  115. package/src/client/components/cryptokoyn/LogOutCryptokoyn.js +2 -2
  116. package/src/client/components/cryptokoyn/MenuCryptokoyn.js +3 -3
  117. package/src/client/components/cryptokoyn/SocketIoCryptokoyn.js +3 -51
  118. package/src/client/components/cyberia/InstanceEngineCyberia.js +700 -0
  119. package/src/client/components/cyberia/MapEngineCyberia.js +1359 -2
  120. package/src/client/components/cyberia/ObjectLayerEngineModal.js +17 -6
  121. package/src/client/components/cyberia/ObjectLayerEngineViewer.js +92 -54
  122. package/src/client/components/cyberia-portal/AppStoreCyberiaPortal.js +5 -0
  123. package/src/client/components/cyberia-portal/CommonCyberiaPortal.js +216 -30
  124. package/src/client/components/cyberia-portal/LogInCyberiaPortal.js +3 -3
  125. package/src/client/components/cyberia-portal/LogOutCyberiaPortal.js +2 -2
  126. package/src/client/components/cyberia-portal/MenuCyberiaPortal.js +40 -7
  127. package/src/client/components/cyberia-portal/RoutesCyberiaPortal.js +4 -0
  128. package/src/client/components/cyberia-portal/SocketIoCyberiaPortal.js +3 -49
  129. package/src/client/components/cyberia-portal/TranslateCyberiaPortal.js +4 -0
  130. package/src/client/components/default/AppStoreDefault.js +5 -0
  131. package/src/client/components/default/LogInDefault.js +3 -3
  132. package/src/client/components/default/LogOutDefault.js +2 -2
  133. package/src/client/components/default/MenuDefault.js +5 -5
  134. package/src/client/components/default/SocketIoDefault.js +3 -51
  135. package/src/client/components/itemledger/AppStoreItemledger.js +5 -0
  136. package/src/client/components/itemledger/LogInItemledger.js +3 -3
  137. package/src/client/components/itemledger/LogOutItemledger.js +2 -2
  138. package/src/client/components/itemledger/MenuItemledger.js +3 -3
  139. package/src/client/components/itemledger/SocketIoItemledger.js +3 -51
  140. package/src/client/components/underpost/AppStoreUnderpost.js +5 -0
  141. package/src/client/components/underpost/LogInUnderpost.js +3 -3
  142. package/src/client/components/underpost/LogOutUnderpost.js +2 -2
  143. package/src/client/components/underpost/MenuUnderpost.js +5 -5
  144. package/src/client/components/underpost/SocketIoUnderpost.js +3 -51
  145. package/src/client/services/core/core.service.js +20 -8
  146. package/src/client/services/cyberia-dialogue/cyberia-dialogue.service.js +105 -0
  147. package/src/client/services/cyberia-entity/cyberia-entity.management.js +57 -0
  148. package/src/client/services/cyberia-entity/cyberia-entity.service.js +105 -0
  149. package/src/client/services/cyberia-instance/cyberia-instance.management.js +194 -0
  150. package/src/client/services/cyberia-instance/cyberia-instance.service.js +122 -0
  151. package/src/client/services/cyberia-instance-conf/cyberia-instance-conf.service.js +105 -0
  152. package/src/client/services/cyberia-map/cyberia-map.management.js +193 -0
  153. package/src/client/services/cyberia-map/cyberia-map.service.js +126 -0
  154. package/src/client/services/instance/instance.management.js +2 -2
  155. package/src/client/services/ipfs/ipfs.service.js +3 -23
  156. package/src/client/services/object-layer/object-layer.management.js +3 -3
  157. package/src/client/services/object-layer/object-layer.service.js +21 -0
  158. package/src/client/services/user/user.management.js +2 -2
  159. package/src/client/ssr/pages/CyberiaServerMetrics.js +1 -1
  160. package/src/grpc/cyberia/OFF_CHAIN_ECONOMY.md +305 -0
  161. package/src/grpc/cyberia/README.md +326 -0
  162. package/src/grpc/cyberia/grpc-server.js +530 -0
  163. package/src/index.js +24 -1
  164. package/src/runtime/express/Dockerfile +4 -0
  165. package/src/runtime/express/Express.js +18 -1
  166. package/src/runtime/lampp/Dockerfile +13 -2
  167. package/src/runtime/lampp/Lampp.js +27 -4
  168. package/src/runtime/wp/Dockerfile +68 -0
  169. package/src/runtime/wp/Wp.js +639 -0
  170. package/src/server/auth.js +24 -1
  171. package/src/server/backup.js +37 -9
  172. package/src/server/client-build-docs.js +9 -2
  173. package/src/server/client-build.js +31 -31
  174. package/src/server/client-formatted.js +109 -57
  175. package/src/server/conf.js +24 -9
  176. package/src/server/cron.js +25 -23
  177. package/src/server/dns.js +2 -1
  178. package/src/server/ipfs-client.js +24 -1
  179. package/src/server/object-layer.js +149 -108
  180. package/src/server/peer.js +8 -0
  181. package/src/server/runtime.js +25 -1
  182. package/src/server/semantic-layer-generator-floor.js +359 -0
  183. package/src/server/semantic-layer-generator-skin.js +1294 -0
  184. package/src/server/semantic-layer-generator.js +116 -555
  185. package/src/server/start.js +2 -2
  186. package/src/ws/IoInterface.js +1 -10
  187. package/src/ws/IoServer.js +14 -33
  188. package/src/ws/core/channels/core.ws.chat.js +65 -20
  189. package/src/ws/core/channels/core.ws.mailer.js +113 -32
  190. package/src/ws/core/channels/core.ws.stream.js +90 -31
  191. package/src/ws/core/core.ws.connection.js +12 -33
  192. package/src/ws/core/core.ws.emit.js +10 -26
  193. package/src/ws/core/core.ws.server.js +25 -58
  194. package/src/ws/default/channels/default.ws.main.js +53 -12
  195. package/src/ws/default/default.ws.connection.js +26 -13
  196. package/src/ws/default/default.ws.server.js +30 -12
  197. package/src/client/components/cryptokoyn/CommonCryptokoyn.js +0 -29
  198. package/src/client/components/cryptokoyn/ElementsCryptokoyn.js +0 -38
  199. package/src/client/components/cyberia-portal/ElementsCyberiaPortal.js +0 -38
  200. package/src/client/components/default/ElementsDefault.js +0 -38
  201. package/src/client/components/itemledger/CommonItemledger.js +0 -29
  202. package/src/client/components/itemledger/ElementsItemledger.js +0 -38
  203. package/src/client/components/underpost/CommonUnderpost.js +0 -29
  204. package/src/client/components/underpost/ElementsUnderpost.js +0 -38
  205. package/src/ws/core/management/core.ws.chat.js +0 -8
  206. package/src/ws/core/management/core.ws.mailer.js +0 -16
  207. package/src/ws/core/management/core.ws.stream.js +0 -8
  208. package/src/ws/default/management/default.ws.main.js +0 -8
@@ -1,76 +1,43 @@
1
1
  /**
2
- * Module for creating and initializing the main WebSocket server instance.
3
- * @module ws/core.ws.server
4
- * @namespace CoreWsServer
2
+ * Core WebSocket server factory — initializes channels and creates the Socket.IO server.
3
+ * @module ws/core/core.ws.server
5
4
  */
6
5
 
7
6
  'use strict';
8
7
 
9
- import { IoServerClass } from '../IoServer.js';
10
- import { CoreWsConnection } from './core.ws.connection.js';
11
- import { CoreWsChatManagement } from './management/core.ws.chat.js';
12
- import { CoreWsMailerManagement } from './management/core.ws.mailer.js';
13
- import { CoreWsStreamManagement } from './management/core.ws.stream.js';
14
- import http from 'http'; // Added for JSDoc type hinting
15
-
16
- // https://socket.io/docs/v3/
8
+ import { IoServer } from '../IoServer.js';
9
+ import { CoreWsConnectionHandler } from './core.ws.connection.js';
10
+ import { CoreWsChatChannel } from './channels/core.ws.chat.js';
11
+ import { CoreWsMailerChannel } from './channels/core.ws.mailer.js';
12
+ import { CoreWsStreamChannel } from './channels/core.ws.stream.js';
17
13
 
18
14
  /**
19
- * @class CoreWsServerClass
20
- * @alias CoreWsServerClass
21
- * @memberof CoreWsServer
22
- * @classdesc Manages the creation and initialization of the main WebSocket server,
23
- * including setting up the management instances for all channels.
15
+ * @class CoreWsServer
16
+ * @classdesc Creates the core WebSocket server, initializing all channel state
17
+ * before attaching the connection handler.
24
18
  */
25
- class CoreWsServerClass {
19
+ class CoreWsServer {
26
20
  /**
27
- * Initializes channel management instances and creates the Socket.IO server.
28
- *
29
- * @static
30
- * @async
31
- * @param {http.Server} httpServer - The HTTP server instance to attach the WebSocket server to.
32
- * @param {Object} options - Configuration options for the WebSocket server.
33
- * @param {string} options.host - The host address.
34
- * @param {string} options.path - The base path for the API.
35
- * @returns {Promise<Object>} The result object from IoServer creation.
21
+ * Initializes channel state and creates the Socket.IO server.
22
+ * @param {import('http').Server} httpServer
23
+ * @param {Object} options
24
+ * @param {string} options.host
25
+ * @param {string} options.path
26
+ * @returns {{ options: import('socket.io').ServerOptions, ioServer: import('socket.io').Server, meta: ImportMeta }}
36
27
  */
37
- static async create(httpServer, options) {
28
+ static create(httpServer, options) {
38
29
  const { host, path } = options;
39
- if (!host || !path) {
40
- throw new Error('Host and path must be provided in server options.');
41
- }
42
-
43
- // Create a unique identifier for this server instance's management context
44
30
  const wsManagementId = `${host}${path}`;
45
31
 
46
- // Initialize/Retrieve singleton management instances for all channels
47
- CoreWsChatManagement.instance(wsManagementId);
48
- CoreWsMailerManagement.instance(wsManagementId);
49
- CoreWsStreamManagement.instance(wsManagementId);
32
+ CoreWsChatChannel.init(wsManagementId);
33
+ CoreWsMailerChannel.init(wsManagementId);
34
+ CoreWsStreamChannel.init(wsManagementId);
50
35
 
51
- // Use the IoServerClass factory to create the server, passing the connection handler
52
- return IoServerClass.create(httpServer, options, (socket) => CoreWsConnection(socket, wsManagementId));
36
+ return IoServer.create(httpServer, options, (socket) => CoreWsConnectionHandler.handle(socket, wsManagementId));
53
37
  }
54
38
  }
55
39
 
56
- /**
57
- * Backward compatibility export for the server creation function.
58
- * @memberof CoreWsServer
59
- * @function createIoServer
60
- * @param {http.Server} httpServer - The HTTP server instance.
61
- * @param {Object} options - Configuration options.
62
- * @returns {Promise<Object>} The server creation result.
63
- */
64
- const createIoServer = CoreWsServerClass.create;
65
-
66
- /**
67
- * Backward compatibility alias.
68
- * @memberof CoreWsServer
69
- * @function CoreWsServer
70
- * @param {import('http').Server} httpServer - The HTTP server instance.
71
- * @param {Object} options - Configuration options.
72
- * @returns {Promise<Object>} The server creation result.
73
- */
74
- const CoreWsServer = createIoServer;
40
+ /** Required by Express.js dynamic import: `const { createIoServer } = await import(...)` */
41
+ const createIoServer = CoreWsServer.create.bind(CoreWsServer);
75
42
 
76
- export { CoreWsServerClass, createIoServer, CoreWsServer };
43
+ export { CoreWsServer, createIoServer };
@@ -1,16 +1,57 @@
1
- import { loggerFactory } from '../../../server/logger.js';
2
- import { IoCreateChannel } from '../../IoInterface.js';
1
+ /**
2
+ * Default "main" WebSocket channel — minimal no-op channel.
3
+ * @module ws/default/channels/default.ws.main
4
+ */
3
5
 
4
- const channel = 'main';
5
- const logger = loggerFactory(import.meta);
6
+ import { IoChannel } from '../../IoInterface.js';
6
7
 
7
- const DefaultWsMainController = {
8
- channel,
9
- controller: function (socket, client, payload, wsManagementId) {},
10
- connection: function (socket, client, wsManagementId) {},
11
- disconnect: function (socket, client, reason, wsManagementId) {},
12
- };
8
+ /**
9
+ * @class DefaultWsMainChannel
10
+ * @classdesc Provides a no-op main channel for the default WebSocket server.
11
+ */
12
+ class DefaultWsMainChannel {
13
+ /** @type {Object.<string, Object>} Per-instance state keyed by wsManagementId. */
14
+ static #state = {};
13
15
 
14
- const DefaultWsMainChannel = IoCreateChannel(DefaultWsMainController);
16
+ /** @type {IoChannel} */
17
+ static #io = new IoChannel({ channel: 'main' });
15
18
 
16
- export { DefaultWsMainChannel, DefaultWsMainController };
19
+ /** @returns {Object.<string, import('socket.io').Socket>} Connected sockets map. */
20
+ static get client() {
21
+ return this.#io.client;
22
+ }
23
+
24
+ /** @returns {string} Channel name. */
25
+ static get channel() {
26
+ return this.#io.channel;
27
+ }
28
+
29
+ /**
30
+ * Initializes state for a server instance.
31
+ * @param {string} wsManagementId
32
+ */
33
+ static init(wsManagementId) {
34
+ this.#state[wsManagementId] = {};
35
+ }
36
+
37
+ /**
38
+ * Registers a socket connection.
39
+ * @param {import('socket.io').Socket} socket
40
+ * @param {string} wsManagementId
41
+ */
42
+ static connection(socket, wsManagementId) {
43
+ return this.#io.connection(socket, wsManagementId);
44
+ }
45
+
46
+ /**
47
+ * Handles socket disconnection.
48
+ * @param {import('socket.io').Socket} socket
49
+ * @param {string} reason
50
+ * @param {string} wsManagementId
51
+ */
52
+ static disconnect(socket, reason, wsManagementId) {
53
+ return this.#io.disconnect(socket, reason, wsManagementId);
54
+ }
55
+ }
56
+
57
+ export { DefaultWsMainChannel };
@@ -1,22 +1,35 @@
1
+ /**
2
+ * Default WebSocket connection handler — wires sockets to the main channel.
3
+ * @module ws/default/default.ws.connection
4
+ */
5
+
1
6
  import { loggerFactory } from '../../server/logger.js';
2
7
  import { DefaultWsMainChannel } from './channels/default.ws.main.js';
3
8
 
4
9
  const logger = loggerFactory(import.meta);
5
10
 
6
- const DefaultWsConnection = function (socket, wsManagementId) {
7
- // const headers = socket.handshake.headers;
8
- // const ip = socket.handshake.address;
9
- // const { query, auth } = socket.handshake;
10
-
11
- logger.info(`DefaultWsConnection ${socket.id}`);
11
+ /**
12
+ * @class DefaultWsConnectionHandler
13
+ * @classdesc Subscribes a new socket to the default main channel
14
+ * and delegates disconnect events.
15
+ */
16
+ class DefaultWsConnectionHandler {
17
+ /**
18
+ * Handles a new WebSocket connection.
19
+ * @param {import('socket.io').Socket} socket
20
+ * @param {string} wsManagementId
21
+ */
22
+ static handle(socket, wsManagementId) {
23
+ logger.info(`DefaultWsConnection ${socket.id}`);
12
24
 
13
- DefaultWsMainChannel.connection(socket, wsManagementId);
25
+ DefaultWsMainChannel.connection(socket, wsManagementId);
14
26
 
15
- socket.on('disconnect', (reason) => {
16
- logger.info(`DefaultWsConnection ${socket.id} due to reason: ${reason}`);
27
+ socket.on('disconnect', (reason) => {
28
+ logger.info(`DefaultWsConnection ${socket.id} due to reason: ${reason}`);
17
29
 
18
- DefaultWsMainChannel.disconnect(socket, reason, wsManagementId);
19
- });
20
- };
30
+ DefaultWsMainChannel.disconnect(socket, reason, wsManagementId);
31
+ });
32
+ }
33
+ }
21
34
 
22
- export { DefaultWsConnection };
35
+ export { DefaultWsConnectionHandler };
@@ -1,20 +1,38 @@
1
+ /**
2
+ * Default WebSocket server factory — initializes the main channel and creates the Socket.IO server.
3
+ * @module ws/default/default.ws.server
4
+ */
5
+
1
6
  'use strict';
2
7
 
3
8
  import { IoServer } from '../IoServer.js';
4
- import { DefaultWsConnection } from './default.ws.connection.js';
5
- import { DefaultWsMainManagement } from './management/default.ws.main.js';
6
-
7
- // https://socket.io/docs/v3/
9
+ import { DefaultWsConnectionHandler } from './default.ws.connection.js';
10
+ import { DefaultWsMainChannel } from './channels/default.ws.main.js';
8
11
 
9
- const createIoServer = async (httpServer, options) => {
10
- const { host, path } = options;
11
- const wsManagementId = `${host}${path}`;
12
+ /**
13
+ * @class DefaultWsServer
14
+ * @classdesc Creates the default WebSocket server with a single main channel.
15
+ */
16
+ class DefaultWsServer {
17
+ /**
18
+ * Initializes the main channel and creates the Socket.IO server.
19
+ * @param {import('http').Server} httpServer
20
+ * @param {Object} options
21
+ * @param {string} options.host
22
+ * @param {string} options.path
23
+ * @returns {{ options: import('socket.io').ServerOptions, ioServer: import('socket.io').Server, meta: ImportMeta }}
24
+ */
25
+ static create(httpServer, options) {
26
+ const { host, path } = options;
27
+ const wsManagementId = `${host}${path}`;
12
28
 
13
- DefaultWsMainManagement.instance(wsManagementId);
29
+ DefaultWsMainChannel.init(wsManagementId);
14
30
 
15
- return IoServer(httpServer, options, (socket) => DefaultWsConnection(socket, wsManagementId));
16
- };
31
+ return IoServer.create(httpServer, options, (socket) => DefaultWsConnectionHandler.handle(socket, wsManagementId));
32
+ }
33
+ }
17
34
 
18
- const DefaultWsServer = createIoServer;
35
+ /** Required by Express.js dynamic import: `const { createIoServer } = await import(...)` */
36
+ const createIoServer = DefaultWsServer.create.bind(DefaultWsServer);
19
37
 
20
- export { createIoServer, DefaultWsServer };
38
+ export { DefaultWsServer, createIoServer };
@@ -1,29 +0,0 @@
1
- const ModelElement = {
2
- user: () => {
3
- return {
4
- user: {
5
- _id: '',
6
- },
7
- };
8
- },
9
- };
10
-
11
- const BaseElement = () => {
12
- return {
13
- user: {
14
- main: {
15
- model: {
16
- ...ModelElement.user(),
17
- },
18
- },
19
- },
20
- chat: {},
21
- mailer: {},
22
- };
23
- };
24
-
25
- const CryptokoynParams = {
26
- EVENT_CALLBACK_TIME: 45,
27
- };
28
-
29
- export { BaseElement, ModelElement, CryptokoynParams };
@@ -1,38 +0,0 @@
1
- import { loggerFactory } from '../core/Logger.js';
2
- import { BaseElement } from './CommonCryptokoyn.js';
3
-
4
- const logger = loggerFactory(import.meta);
5
-
6
- const ElementsCryptokoyn = {
7
- Data: BaseElement(),
8
- Interval: {},
9
- LocalDataScope: {},
10
- Init: function (options = { type: 'user', id: 'main', element: {} }) {
11
- const { type, id, element } = options;
12
- this.Data[type][id] = {
13
- ...BaseElement()[type].main,
14
- ...this.Data[type][id],
15
- ...element,
16
- };
17
- if (!this.Interval[type]) this.Interval[type] = {};
18
- if (!this.Interval[type][id]) this.Interval[type][id] = {};
19
- if (!this.LocalDataScope[type]) this.LocalDataScope[type] = {};
20
- if (!this.LocalDataScope[type][id])
21
- this.LocalDataScope[type][id] = {
22
- path: [],
23
- };
24
- },
25
- removeAll: function () {
26
- for (const type of Object.keys(this.Data)) {
27
- for (const id of Object.keys(this.Data[type])) {
28
- if (this.Interval[type] && this.Interval[type][id]) {
29
- for (const interval of Object.keys(this.Interval[type][id])) clearInterval(this.Interval[type][id][interval]);
30
- }
31
- }
32
- }
33
- this.Interval = {};
34
- this.Data = BaseElement();
35
- },
36
- };
37
-
38
- export { ElementsCryptokoyn };
@@ -1,38 +0,0 @@
1
- import { loggerFactory } from '../core/Logger.js';
2
- import { BaseElement } from './CommonCyberiaPortal.js';
3
-
4
- const logger = loggerFactory(import.meta);
5
-
6
- const ElementsCyberiaPortal = {
7
- Data: BaseElement(),
8
- Interval: {},
9
- LocalDataScope: {},
10
- Init: function (options = { type: 'user', id: 'main', element: {} }) {
11
- const { type, id, element } = options;
12
- this.Data[type][id] = {
13
- ...BaseElement()[type].main,
14
- ...this.Data[type][id],
15
- ...element,
16
- };
17
- if (!this.Interval[type]) this.Interval[type] = {};
18
- if (!this.Interval[type][id]) this.Interval[type][id] = {};
19
- if (!this.LocalDataScope[type]) this.LocalDataScope[type] = {};
20
- if (!this.LocalDataScope[type][id])
21
- this.LocalDataScope[type][id] = {
22
- path: [],
23
- };
24
- },
25
- removeAll: function () {
26
- for (const type of Object.keys(this.Data)) {
27
- for (const id of Object.keys(this.Data[type])) {
28
- if (this.Interval[type] && this.Interval[type][id]) {
29
- for (const interval of Object.keys(this.Interval[type][id])) clearInterval(this.Interval[type][id][interval]);
30
- }
31
- }
32
- }
33
- this.Interval = {};
34
- this.Data = BaseElement();
35
- },
36
- };
37
-
38
- export { ElementsCyberiaPortal };
@@ -1,38 +0,0 @@
1
- import { loggerFactory } from '../core/Logger.js';
2
- import { BaseElement } from './CommonDefault.js';
3
-
4
- const logger = loggerFactory(import.meta);
5
-
6
- const ElementsDefault = {
7
- Data: BaseElement(),
8
- Interval: {},
9
- LocalDataScope: {},
10
- Init: function (options = { type: 'user', id: 'main', element: {} }) {
11
- const { type, id, element } = options;
12
- this.Data[type][id] = {
13
- ...BaseElement()[type].main,
14
- ...this.Data[type][id],
15
- ...element,
16
- };
17
- if (!this.Interval[type]) this.Interval[type] = {};
18
- if (!this.Interval[type][id]) this.Interval[type][id] = {};
19
- if (!this.LocalDataScope[type]) this.LocalDataScope[type] = {};
20
- if (!this.LocalDataScope[type][id])
21
- this.LocalDataScope[type][id] = {
22
- path: [],
23
- };
24
- },
25
- removeAll: function () {
26
- for (const type of Object.keys(this.Data)) {
27
- for (const id of Object.keys(this.Data[type])) {
28
- if (this.Interval[type] && this.Interval[type][id]) {
29
- for (const interval of Object.keys(this.Interval[type][id])) clearInterval(this.Interval[type][id][interval]);
30
- }
31
- }
32
- }
33
- this.Interval = {};
34
- this.Data = BaseElement();
35
- },
36
- };
37
-
38
- export { ElementsDefault };
@@ -1,29 +0,0 @@
1
- const ModelElement = {
2
- user: () => {
3
- return {
4
- user: {
5
- _id: '',
6
- },
7
- };
8
- },
9
- };
10
-
11
- const BaseElement = () => {
12
- return {
13
- user: {
14
- main: {
15
- model: {
16
- ...ModelElement.user(),
17
- },
18
- },
19
- },
20
- chat: {},
21
- mailer: {},
22
- };
23
- };
24
-
25
- const ItemledgerParams = {
26
- EVENT_CALLBACK_TIME: 45,
27
- };
28
-
29
- export { BaseElement, ModelElement, ItemledgerParams };
@@ -1,38 +0,0 @@
1
- import { loggerFactory } from '../core/Logger.js';
2
- import { BaseElement } from './CommonItemledger.js';
3
-
4
- const logger = loggerFactory(import.meta);
5
-
6
- const ElementsItemledger = {
7
- Data: BaseElement(),
8
- Interval: {},
9
- LocalDataScope: {},
10
- Init: function (options = { type: 'user', id: 'main', element: {} }) {
11
- const { type, id, element } = options;
12
- this.Data[type][id] = {
13
- ...BaseElement()[type].main,
14
- ...this.Data[type][id],
15
- ...element,
16
- };
17
- if (!this.Interval[type]) this.Interval[type] = {};
18
- if (!this.Interval[type][id]) this.Interval[type][id] = {};
19
- if (!this.LocalDataScope[type]) this.LocalDataScope[type] = {};
20
- if (!this.LocalDataScope[type][id])
21
- this.LocalDataScope[type][id] = {
22
- path: [],
23
- };
24
- },
25
- removeAll: function () {
26
- for (const type of Object.keys(this.Data)) {
27
- for (const id of Object.keys(this.Data[type])) {
28
- if (this.Interval[type] && this.Interval[type][id]) {
29
- for (const interval of Object.keys(this.Interval[type][id])) clearInterval(this.Interval[type][id][interval]);
30
- }
31
- }
32
- }
33
- this.Interval = {};
34
- this.Data = BaseElement();
35
- },
36
- };
37
-
38
- export { ElementsItemledger };
@@ -1,29 +0,0 @@
1
- const ModelElement = {
2
- user: () => {
3
- return {
4
- user: {
5
- _id: '',
6
- },
7
- };
8
- },
9
- };
10
-
11
- const BaseElement = () => {
12
- return {
13
- user: {
14
- main: {
15
- model: {
16
- ...ModelElement.user(),
17
- },
18
- },
19
- },
20
- chat: {},
21
- mailer: {},
22
- };
23
- };
24
-
25
- const UnderpostParams = {
26
- EVENT_CALLBACK_TIME: 45,
27
- };
28
-
29
- export { BaseElement, ModelElement, UnderpostParams };
@@ -1,38 +0,0 @@
1
- import { loggerFactory } from '../core/Logger.js';
2
- import { BaseElement } from './CommonUnderpost.js';
3
-
4
- const logger = loggerFactory(import.meta);
5
-
6
- const ElementsUnderpost = {
7
- Data: BaseElement(),
8
- Interval: {},
9
- LocalDataScope: {},
10
- Init: function (options = { type: 'user', id: 'main', element: {} }) {
11
- const { type, id, element } = options;
12
- this.Data[type][id] = {
13
- ...BaseElement()[type].main,
14
- ...this.Data[type][id],
15
- ...element,
16
- };
17
- if (!this.Interval[type]) this.Interval[type] = {};
18
- if (!this.Interval[type][id]) this.Interval[type][id] = {};
19
- if (!this.LocalDataScope[type]) this.LocalDataScope[type] = {};
20
- if (!this.LocalDataScope[type][id])
21
- this.LocalDataScope[type][id] = {
22
- path: [],
23
- };
24
- },
25
- removeAll: function () {
26
- for (const type of Object.keys(this.Data)) {
27
- for (const id of Object.keys(this.Data[type])) {
28
- if (this.Interval[type] && this.Interval[type][id]) {
29
- for (const interval of Object.keys(this.Interval[type][id])) clearInterval(this.Interval[type][id][interval]);
30
- }
31
- }
32
- }
33
- this.Interval = {};
34
- this.Data = BaseElement();
35
- },
36
- };
37
-
38
- export { ElementsUnderpost };
@@ -1,8 +0,0 @@
1
- const CoreWsChatManagement = {
2
- element: {},
3
- instance: function (wsManagementId = '') {
4
- this.element[wsManagementId] = {};
5
- },
6
- };
7
-
8
- export { CoreWsChatManagement };
@@ -1,16 +0,0 @@
1
- const CoreWsMailerManagement = {
2
- element: {},
3
- instance: function (wsManagementId = '') {
4
- this.element[wsManagementId] = {};
5
- },
6
- getUserWsId: function (wsManagementId = '', id = '') {
7
- for (const userWsId of Object.keys(this.element[wsManagementId])) {
8
- if (this.element[wsManagementId][userWsId].model.user._id === id) {
9
- return userWsId;
10
- }
11
- }
12
- return undefined;
13
- },
14
- };
15
-
16
- export { CoreWsMailerManagement };
@@ -1,8 +0,0 @@
1
- const CoreWsStreamManagement = {
2
- element: {},
3
- instance: function (wsManagementId = '') {
4
- this.element[wsManagementId] = {};
5
- },
6
- };
7
-
8
- export { CoreWsStreamManagement };
@@ -1,8 +0,0 @@
1
- const DefaultWsMainManagement = {
2
- element: {},
3
- instance: function (wsManagementId = '') {
4
- this.element[wsManagementId] = {};
5
- },
6
- };
7
-
8
- export { DefaultWsMainManagement };