openportal 0.1.1 → 0.1.2

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 (181) hide show
  1. package/package.json +1 -1
  2. package/web/.next/static/{A7pW-dtFIbPCSkvE8uenX → XI6khKkj1If5Kb4-eJQ2z}/_buildManifest.js +4 -9
  3. package/web/.next/static/chunks/{2e7bfb90c343ca96.js → 35cc9dbdc670c73c.js} +4 -4
  4. package/web/.next/static/chunks/4147ffc67a7b837c.css +1 -0
  5. package/web/.next/static/chunks/{21ab2574b84ad2d1.js → 52b90bc1740162c2.js} +2 -2
  6. package/web/.next/static/chunks/{9b265e2198b5525f.js → 8644d68bf325ff24.js} +3 -3
  7. package/web/.next/static/chunks/{03e1846335a31354.js → 9865709466b09f79.js} +3 -3
  8. package/web/.next/static/chunks/{c20ae04df8cc28be.js → 9ba9a5774c9421bd.js} +3 -3
  9. package/web/.next/static/chunks/{967a1e0002fe9ae6.js → b5caad256518cb33.js} +3 -3
  10. package/web/.next/static/chunks/{turbopack-27558c851386934e.js → turbopack-26af71e419c11487.js} +1 -1
  11. package/web/.next/static/chunks/{turbopack-f4c0881f9723f5a5.js → turbopack-4ad0df7330c00c8d.js} +1 -1
  12. package/web/.next/static/chunks/{turbopack-26688626142ac58f.js → turbopack-8e653f3ad3a8ed18.js} +1 -1
  13. package/web/.next/static/chunks/{turbopack-c40ec6674624f1d7.js → turbopack-d5098189d63fd7b8.js} +1 -1
  14. package/web/apps/web/.next/BUILD_ID +1 -1
  15. package/web/apps/web/.next/build-manifest.json +14 -24
  16. package/web/apps/web/.next/routes-manifest.json +0 -12
  17. package/web/apps/web/.next/server/chunks/[root-of-the-server]__f366ca98._.js +358 -0
  18. package/web/apps/web/.next/server/chunks/ssr/{[root-of-the-server]__dfeaf8cf._.js → [root-of-the-server]__1a54ba1e._.js} +3 -3
  19. package/web/apps/web/.next/server/middleware-build-manifest.js +12 -22
  20. package/web/apps/web/.next/server/next-font-manifest.js +1 -1
  21. package/web/apps/web/.next/server/next-font-manifest.json +0 -4
  22. package/web/apps/web/.next/server/pages/404.html +1 -1
  23. package/web/apps/web/.next/server/pages/500.html +1 -1
  24. package/web/apps/web/.next/server/pages/_app/build-manifest.json +3 -3
  25. package/web/apps/web/.next/server/pages/_app/client-build-manifest.json +1 -1
  26. package/web/apps/web/.next/server/pages/api/[[...slugs]].js +1 -2
  27. package/web/apps/web/.next/server/pages/api/[[...slugs]].js.nft.json +1 -1
  28. package/web/apps/web/.next/server/pages/index/build-manifest.json +3 -3
  29. package/web/apps/web/.next/server/pages/index/client-build-manifest.json +1 -1
  30. package/web/apps/web/.next/server/pages/index.html +1 -1
  31. package/web/apps/web/.next/server/pages/index.js.nft.json +1 -1
  32. package/web/apps/web/.next/server/pages/session/[id]/build-manifest.json +4 -4
  33. package/web/apps/web/.next/server/pages/session/[id]/client-build-manifest.json +1 -1
  34. package/web/apps/web/.next/server/pages/session/[id].html +1 -1
  35. package/web/apps/web/.next/server/pages/session/[id].js.nft.json +1 -1
  36. package/web/apps/web/.next/server/pages/settings/build-manifest.json +3 -3
  37. package/web/apps/web/.next/server/pages/settings/client-build-manifest.json +1 -1
  38. package/web/apps/web/.next/server/pages/settings.html +1 -1
  39. package/web/apps/web/.next/server/pages/settings.js.nft.json +1 -1
  40. package/web/apps/web/.next/server/pages-manifest.json +0 -2
  41. package/web/apps/web/package.json +1 -9
  42. package/web/.next/static/chunks/04d4692d75696297.css +0 -1
  43. package/web/.next/static/chunks/553710f60e2f2b11.js +0 -1
  44. package/web/.next/static/chunks/58acbbb4090e3362.js +0 -3
  45. package/web/.next/static/chunks/6ce1e2f08f961db5.js +0 -2
  46. package/web/.next/static/chunks/d316d63225992c76.js +0 -10
  47. package/web/.next/static/chunks/e0c97552ba7a9e3d.js +0 -1
  48. package/web/.next/static/chunks/fc9c4f2dabfb4e0e.css +0 -1
  49. package/web/.next/static/chunks/turbopack-1837909a677d116b.js +0 -3
  50. package/web/apps/web/.next/server/chunks/[root-of-the-server]__0f75905d._.js +0 -3
  51. package/web/apps/web/.next/server/chunks/[root-of-the-server]__89e85365._.js +0 -358
  52. package/web/apps/web/.next/server/chunks/[root-of-the-server]__ae1361d0._.js +0 -3
  53. package/web/apps/web/.next/server/pages/api/terminal/ws/pages-manifest.json +0 -3
  54. package/web/apps/web/.next/server/pages/api/terminal/ws.js +0 -5
  55. package/web/apps/web/.next/server/pages/api/terminal/ws.js.map +0 -5
  56. package/web/apps/web/.next/server/pages/api/terminal/ws.js.nft.json +0 -1
  57. package/web/apps/web/.next/server/pages/terminal/build-manifest.json +0 -20
  58. package/web/apps/web/.next/server/pages/terminal/client-build-manifest.json +0 -5
  59. package/web/apps/web/.next/server/pages/terminal/next-font-manifest.json +0 -11
  60. package/web/apps/web/.next/server/pages/terminal/pages-manifest.json +0 -3
  61. package/web/apps/web/.next/server/pages/terminal/react-loadable-manifest.json +0 -1
  62. package/web/apps/web/.next/server/pages/terminal.html +0 -1
  63. package/web/apps/web/.next/server/pages/terminal.js.map +0 -5
  64. package/web/apps/web/.next/server/pages/terminal.js.nft.json +0 -1
  65. package/web/node_modules/.bun/@socket.io+component-emitter@3.1.2/node_modules/@socket.io/component-emitter/lib/cjs/index.js +0 -176
  66. package/web/node_modules/.bun/@socket.io+component-emitter@3.1.2/node_modules/@socket.io/component-emitter/lib/cjs/package.json +0 -4
  67. package/web/node_modules/.bun/@socket.io+component-emitter@3.1.2/node_modules/@socket.io/component-emitter/package.json +0 -28
  68. package/web/node_modules/.bun/accepts@1.3.8/node_modules/accepts/index.js +0 -238
  69. package/web/node_modules/.bun/accepts@1.3.8/node_modules/accepts/package.json +0 -47
  70. package/web/node_modules/.bun/base64id@2.0.0/node_modules/base64id/lib/base64id.js +0 -103
  71. package/web/node_modules/.bun/base64id@2.0.0/node_modules/base64id/package.json +0 -13
  72. package/web/node_modules/.bun/cookie@0.7.2/node_modules/cookie/index.js +0 -335
  73. package/web/node_modules/.bun/cookie@0.7.2/node_modules/cookie/package.json +0 -44
  74. package/web/node_modules/.bun/cookie@1.1.1/node_modules/cookie/package.json +0 -47
  75. package/web/node_modules/.bun/cors@2.8.5/node_modules/cors/lib/index.js +0 -238
  76. package/web/node_modules/.bun/cors@2.8.5/node_modules/cors/package.json +0 -41
  77. package/web/node_modules/.bun/debug@4.3.7/node_modules/debug/package.json +0 -60
  78. package/web/node_modules/.bun/debug@4.3.7/node_modules/debug/src/browser.js +0 -271
  79. package/web/node_modules/.bun/debug@4.3.7/node_modules/debug/src/common.js +0 -274
  80. package/web/node_modules/.bun/debug@4.3.7/node_modules/debug/src/index.js +0 -10
  81. package/web/node_modules/.bun/debug@4.3.7/node_modules/debug/src/node.js +0 -263
  82. package/web/node_modules/.bun/engine.io-parser@5.2.3/node_modules/engine.io-parser/build/cjs/commons.js +0 -19
  83. package/web/node_modules/.bun/engine.io-parser@5.2.3/node_modules/engine.io-parser/build/cjs/decodePacket.js +0 -59
  84. package/web/node_modules/.bun/engine.io-parser@5.2.3/node_modules/engine.io-parser/build/cjs/encodePacket.js +0 -38
  85. package/web/node_modules/.bun/engine.io-parser@5.2.3/node_modules/engine.io-parser/build/cjs/index.js +0 -164
  86. package/web/node_modules/.bun/engine.io-parser@5.2.3/node_modules/engine.io-parser/build/cjs/package.json +0 -8
  87. package/web/node_modules/.bun/engine.io-parser@5.2.3/node_modules/engine.io-parser/package.json +0 -46
  88. package/web/node_modules/.bun/engine.io@6.6.4/node_modules/engine.io/build/engine.io.js +0 -54
  89. package/web/node_modules/.bun/engine.io@6.6.4/node_modules/engine.io/build/parser-v3/index.js +0 -424
  90. package/web/node_modules/.bun/engine.io@6.6.4/node_modules/engine.io/build/parser-v3/utf8.js +0 -187
  91. package/web/node_modules/.bun/engine.io@6.6.4/node_modules/engine.io/build/server.js +0 -786
  92. package/web/node_modules/.bun/engine.io@6.6.4/node_modules/engine.io/build/socket.js +0 -460
  93. package/web/node_modules/.bun/engine.io@6.6.4/node_modules/engine.io/build/transport.js +0 -117
  94. package/web/node_modules/.bun/engine.io@6.6.4/node_modules/engine.io/build/transports/index.js +0 -23
  95. package/web/node_modules/.bun/engine.io@6.6.4/node_modules/engine.io/build/transports/polling-jsonp.js +0 -41
  96. package/web/node_modules/.bun/engine.io@6.6.4/node_modules/engine.io/build/transports/polling.js +0 -332
  97. package/web/node_modules/.bun/engine.io@6.6.4/node_modules/engine.io/build/transports/websocket.js +0 -94
  98. package/web/node_modules/.bun/engine.io@6.6.4/node_modules/engine.io/build/transports/webtransport.js +0 -63
  99. package/web/node_modules/.bun/engine.io@6.6.4/node_modules/engine.io/build/transports-uws/index.js +0 -8
  100. package/web/node_modules/.bun/engine.io@6.6.4/node_modules/engine.io/build/transports-uws/polling.js +0 -364
  101. package/web/node_modules/.bun/engine.io@6.6.4/node_modules/engine.io/build/transports-uws/websocket.js +0 -73
  102. package/web/node_modules/.bun/engine.io@6.6.4/node_modules/engine.io/build/userver.js +0 -279
  103. package/web/node_modules/.bun/engine.io@6.6.4/node_modules/engine.io/package.json +0 -70
  104. package/web/node_modules/.bun/has-flag@4.0.0/node_modules/has-flag/index.js +0 -8
  105. package/web/node_modules/.bun/has-flag@4.0.0/node_modules/has-flag/package.json +0 -46
  106. package/web/node_modules/.bun/mime-db@1.52.0/node_modules/mime-db/db.json +0 -8519
  107. package/web/node_modules/.bun/mime-db@1.52.0/node_modules/mime-db/index.js +0 -12
  108. package/web/node_modules/.bun/mime-db@1.52.0/node_modules/mime-db/package.json +0 -60
  109. package/web/node_modules/.bun/mime-types@2.1.35/node_modules/mime-types/index.js +0 -188
  110. package/web/node_modules/.bun/mime-types@2.1.35/node_modules/mime-types/package.json +0 -44
  111. package/web/node_modules/.bun/ms@2.1.3/node_modules/ms/index.js +0 -162
  112. package/web/node_modules/.bun/ms@2.1.3/node_modules/ms/package.json +0 -38
  113. package/web/node_modules/.bun/negotiator@0.6.3/node_modules/negotiator/index.js +0 -82
  114. package/web/node_modules/.bun/negotiator@0.6.3/node_modules/negotiator/lib/charset.js +0 -169
  115. package/web/node_modules/.bun/negotiator@0.6.3/node_modules/negotiator/lib/encoding.js +0 -184
  116. package/web/node_modules/.bun/negotiator@0.6.3/node_modules/negotiator/lib/language.js +0 -179
  117. package/web/node_modules/.bun/negotiator@0.6.3/node_modules/negotiator/lib/mediaType.js +0 -294
  118. package/web/node_modules/.bun/negotiator@0.6.3/node_modules/negotiator/package.json +0 -42
  119. package/web/node_modules/.bun/object-assign@4.1.1/node_modules/object-assign/index.js +0 -90
  120. package/web/node_modules/.bun/object-assign@4.1.1/node_modules/object-assign/package.json +0 -42
  121. package/web/node_modules/.bun/socket.io-adapter@2.5.5/node_modules/socket.io-adapter/dist/cluster-adapter.js +0 -674
  122. package/web/node_modules/.bun/socket.io-adapter@2.5.5/node_modules/socket.io-adapter/dist/contrib/yeast.js +0 -55
  123. package/web/node_modules/.bun/socket.io-adapter@2.5.5/node_modules/socket.io-adapter/dist/in-memory-adapter.js +0 -394
  124. package/web/node_modules/.bun/socket.io-adapter@2.5.5/node_modules/socket.io-adapter/dist/index.js +0 -10
  125. package/web/node_modules/.bun/socket.io-adapter@2.5.5/node_modules/socket.io-adapter/package.json +0 -39
  126. package/web/node_modules/.bun/socket.io-parser@4.2.4/node_modules/socket.io-parser/build/cjs/binary.js +0 -88
  127. package/web/node_modules/.bun/socket.io-parser@4.2.4/node_modules/socket.io-parser/build/cjs/index.js +0 -321
  128. package/web/node_modules/.bun/socket.io-parser@4.2.4/node_modules/socket.io-parser/build/cjs/is-binary.js +0 -55
  129. package/web/node_modules/.bun/socket.io-parser@4.2.4/node_modules/socket.io-parser/build/cjs/package.json +0 -3
  130. package/web/node_modules/.bun/socket.io-parser@4.2.4/node_modules/socket.io-parser/package.json +0 -58
  131. package/web/node_modules/.bun/socket.io@4.8.1/node_modules/socket.io/client-dist/socket.io.esm.min.js +0 -7
  132. package/web/node_modules/.bun/socket.io@4.8.1/node_modules/socket.io/client-dist/socket.io.js +0 -4908
  133. package/web/node_modules/.bun/socket.io@4.8.1/node_modules/socket.io/client-dist/socket.io.min.js +0 -7
  134. package/web/node_modules/.bun/socket.io@4.8.1/node_modules/socket.io/client-dist/socket.io.msgpack.min.js +0 -7
  135. package/web/node_modules/.bun/socket.io@4.8.1/node_modules/socket.io/dist/broadcast-operator.js +0 -436
  136. package/web/node_modules/.bun/socket.io@4.8.1/node_modules/socket.io/dist/client.js +0 -268
  137. package/web/node_modules/.bun/socket.io@4.8.1/node_modules/socket.io/dist/index.js +0 -804
  138. package/web/node_modules/.bun/socket.io@4.8.1/node_modules/socket.io/dist/namespace.js +0 -581
  139. package/web/node_modules/.bun/socket.io@4.8.1/node_modules/socket.io/dist/parent-namespace.js +0 -88
  140. package/web/node_modules/.bun/socket.io@4.8.1/node_modules/socket.io/dist/socket-types.js +0 -11
  141. package/web/node_modules/.bun/socket.io@4.8.1/node_modules/socket.io/dist/socket.js +0 -977
  142. package/web/node_modules/.bun/socket.io@4.8.1/node_modules/socket.io/dist/typed-events.js +0 -81
  143. package/web/node_modules/.bun/socket.io@4.8.1/node_modules/socket.io/dist/uws.js +0 -136
  144. package/web/node_modules/.bun/socket.io@4.8.1/node_modules/socket.io/package.json +0 -85
  145. package/web/node_modules/.bun/socket.io@4.8.1/node_modules/socket.io/wrapper.mjs +0 -3
  146. package/web/node_modules/.bun/supports-color@7.2.0/node_modules/supports-color/index.js +0 -135
  147. package/web/node_modules/.bun/supports-color@7.2.0/node_modules/supports-color/package.json +0 -53
  148. package/web/node_modules/.bun/vary@1.1.2/node_modules/vary/index.js +0 -149
  149. package/web/node_modules/.bun/vary@1.1.2/node_modules/vary/package.json +0 -43
  150. package/web/node_modules/.bun/ws@8.17.1/node_modules/ws/index.js +0 -13
  151. package/web/node_modules/.bun/ws@8.17.1/node_modules/ws/lib/buffer-util.js +0 -131
  152. package/web/node_modules/.bun/ws@8.17.1/node_modules/ws/lib/constants.js +0 -12
  153. package/web/node_modules/.bun/ws@8.17.1/node_modules/ws/lib/event-target.js +0 -292
  154. package/web/node_modules/.bun/ws@8.17.1/node_modules/ws/lib/extension.js +0 -203
  155. package/web/node_modules/.bun/ws@8.17.1/node_modules/ws/lib/limiter.js +0 -55
  156. package/web/node_modules/.bun/ws@8.17.1/node_modules/ws/lib/permessage-deflate.js +0 -514
  157. package/web/node_modules/.bun/ws@8.17.1/node_modules/ws/lib/receiver.js +0 -704
  158. package/web/node_modules/.bun/ws@8.17.1/node_modules/ws/lib/sender.js +0 -497
  159. package/web/node_modules/.bun/ws@8.17.1/node_modules/ws/lib/stream.js +0 -159
  160. package/web/node_modules/.bun/ws@8.17.1/node_modules/ws/lib/subprotocol.js +0 -62
  161. package/web/node_modules/.bun/ws@8.17.1/node_modules/ws/lib/validation.js +0 -130
  162. package/web/node_modules/.bun/ws@8.17.1/node_modules/ws/lib/websocket-server.js +0 -540
  163. package/web/node_modules/.bun/ws@8.17.1/node_modules/ws/lib/websocket.js +0 -1338
  164. package/web/node_modules/.bun/ws@8.17.1/node_modules/ws/package.json +0 -69
  165. package/web/node_modules/.bun/ws@8.18.3/node_modules/ws/lib/buffer-util.js +0 -131
  166. package/web/node_modules/.bun/ws@8.18.3/node_modules/ws/lib/constants.js +0 -18
  167. package/web/node_modules/.bun/ws@8.18.3/node_modules/ws/lib/event-target.js +0 -292
  168. package/web/node_modules/.bun/ws@8.18.3/node_modules/ws/lib/extension.js +0 -203
  169. package/web/node_modules/.bun/ws@8.18.3/node_modules/ws/lib/limiter.js +0 -55
  170. package/web/node_modules/.bun/ws@8.18.3/node_modules/ws/lib/permessage-deflate.js +0 -528
  171. package/web/node_modules/.bun/ws@8.18.3/node_modules/ws/lib/receiver.js +0 -706
  172. package/web/node_modules/.bun/ws@8.18.3/node_modules/ws/lib/sender.js +0 -602
  173. package/web/node_modules/.bun/ws@8.18.3/node_modules/ws/lib/stream.js +0 -161
  174. package/web/node_modules/.bun/ws@8.18.3/node_modules/ws/lib/subprotocol.js +0 -62
  175. package/web/node_modules/.bun/ws@8.18.3/node_modules/ws/lib/validation.js +0 -152
  176. package/web/node_modules/.bun/ws@8.18.3/node_modules/ws/lib/websocket-server.js +0 -550
  177. package/web/node_modules/.bun/ws@8.18.3/node_modules/ws/lib/websocket.js +0 -1388
  178. package/web/node_modules/.bun/ws@8.18.3/node_modules/ws/package.json +0 -69
  179. package/web/node_modules/.bun/ws@8.18.3/node_modules/ws/wrapper.mjs +0 -8
  180. /package/web/.next/static/{A7pW-dtFIbPCSkvE8uenX → XI6khKkj1If5Kb4-eJQ2z}/_clientMiddlewareManifest.json +0 -0
  181. /package/web/.next/static/{A7pW-dtFIbPCSkvE8uenX → XI6khKkj1If5Kb4-eJQ2z}/_ssgManifest.js +0 -0
@@ -1,581 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Namespace = exports.RESERVED_EVENTS = void 0;
7
- const socket_1 = require("./socket");
8
- const typed_events_1 = require("./typed-events");
9
- const debug_1 = __importDefault(require("debug"));
10
- const broadcast_operator_1 = require("./broadcast-operator");
11
- const debug = (0, debug_1.default)("socket.io:namespace");
12
- exports.RESERVED_EVENTS = new Set(["connect", "connection", "new_namespace"]);
13
- /**
14
- * A Namespace is a communication channel that allows you to split the logic of your application over a single shared
15
- * connection.
16
- *
17
- * Each namespace has its own:
18
- *
19
- * - event handlers
20
- *
21
- * ```
22
- * io.of("/orders").on("connection", (socket) => {
23
- * socket.on("order:list", () => {});
24
- * socket.on("order:create", () => {});
25
- * });
26
- *
27
- * io.of("/users").on("connection", (socket) => {
28
- * socket.on("user:list", () => {});
29
- * });
30
- * ```
31
- *
32
- * - rooms
33
- *
34
- * ```
35
- * const orderNamespace = io.of("/orders");
36
- *
37
- * orderNamespace.on("connection", (socket) => {
38
- * socket.join("room1");
39
- * orderNamespace.to("room1").emit("hello");
40
- * });
41
- *
42
- * const userNamespace = io.of("/users");
43
- *
44
- * userNamespace.on("connection", (socket) => {
45
- * socket.join("room1"); // distinct from the room in the "orders" namespace
46
- * userNamespace.to("room1").emit("holà");
47
- * });
48
- * ```
49
- *
50
- * - middlewares
51
- *
52
- * ```
53
- * const orderNamespace = io.of("/orders");
54
- *
55
- * orderNamespace.use((socket, next) => {
56
- * // ensure the socket has access to the "orders" namespace
57
- * });
58
- *
59
- * const userNamespace = io.of("/users");
60
- *
61
- * userNamespace.use((socket, next) => {
62
- * // ensure the socket has access to the "users" namespace
63
- * });
64
- * ```
65
- */
66
- class Namespace extends typed_events_1.StrictEventEmitter {
67
- /**
68
- * Namespace constructor.
69
- *
70
- * @param server instance
71
- * @param name
72
- */
73
- constructor(server, name) {
74
- super();
75
- /**
76
- * A map of currently connected sockets.
77
- */
78
- this.sockets = new Map();
79
- /**
80
- * A map of currently connecting sockets.
81
- */
82
- this._preConnectSockets = new Map();
83
- this._fns = [];
84
- /** @private */
85
- this._ids = 0;
86
- this.server = server;
87
- this.name = name;
88
- this._initAdapter();
89
- }
90
- /**
91
- * Initializes the `Adapter` for this nsp.
92
- * Run upon changing adapter by `Server#adapter`
93
- * in addition to the constructor.
94
- *
95
- * @private
96
- */
97
- _initAdapter() {
98
- // @ts-ignore
99
- this.adapter = new (this.server.adapter())(this);
100
- }
101
- /**
102
- * Registers a middleware, which is a function that gets executed for every incoming {@link Socket}.
103
- *
104
- * @example
105
- * const myNamespace = io.of("/my-namespace");
106
- *
107
- * myNamespace.use((socket, next) => {
108
- * // ...
109
- * next();
110
- * });
111
- *
112
- * @param fn - the middleware function
113
- */
114
- use(fn) {
115
- this._fns.push(fn);
116
- return this;
117
- }
118
- /**
119
- * Executes the middleware for an incoming client.
120
- *
121
- * @param socket - the socket that will get added
122
- * @param fn - last fn call in the middleware
123
- * @private
124
- */
125
- run(socket, fn) {
126
- if (!this._fns.length)
127
- return fn();
128
- const fns = this._fns.slice(0);
129
- function run(i) {
130
- fns[i](socket, (err) => {
131
- // upon error, short-circuit
132
- if (err)
133
- return fn(err);
134
- // if no middleware left, summon callback
135
- if (!fns[i + 1])
136
- return fn();
137
- // go on to next
138
- run(i + 1);
139
- });
140
- }
141
- run(0);
142
- }
143
- /**
144
- * Targets a room when emitting.
145
- *
146
- * @example
147
- * const myNamespace = io.of("/my-namespace");
148
- *
149
- * // the “foo” event will be broadcast to all connected clients in the “room-101” room
150
- * myNamespace.to("room-101").emit("foo", "bar");
151
- *
152
- * // with an array of rooms (a client will be notified at most once)
153
- * myNamespace.to(["room-101", "room-102"]).emit("foo", "bar");
154
- *
155
- * // with multiple chained calls
156
- * myNamespace.to("room-101").to("room-102").emit("foo", "bar");
157
- *
158
- * @param room - a room, or an array of rooms
159
- * @return a new {@link BroadcastOperator} instance for chaining
160
- */
161
- to(room) {
162
- return new broadcast_operator_1.BroadcastOperator(this.adapter).to(room);
163
- }
164
- /**
165
- * Targets a room when emitting. Similar to `to()`, but might feel clearer in some cases:
166
- *
167
- * @example
168
- * const myNamespace = io.of("/my-namespace");
169
- *
170
- * // disconnect all clients in the "room-101" room
171
- * myNamespace.in("room-101").disconnectSockets();
172
- *
173
- * @param room - a room, or an array of rooms
174
- * @return a new {@link BroadcastOperator} instance for chaining
175
- */
176
- in(room) {
177
- return new broadcast_operator_1.BroadcastOperator(this.adapter).in(room);
178
- }
179
- /**
180
- * Excludes a room when emitting.
181
- *
182
- * @example
183
- * const myNamespace = io.of("/my-namespace");
184
- *
185
- * // the "foo" event will be broadcast to all connected clients, except the ones that are in the "room-101" room
186
- * myNamespace.except("room-101").emit("foo", "bar");
187
- *
188
- * // with an array of rooms
189
- * myNamespace.except(["room-101", "room-102"]).emit("foo", "bar");
190
- *
191
- * // with multiple chained calls
192
- * myNamespace.except("room-101").except("room-102").emit("foo", "bar");
193
- *
194
- * @param room - a room, or an array of rooms
195
- * @return a new {@link BroadcastOperator} instance for chaining
196
- */
197
- except(room) {
198
- return new broadcast_operator_1.BroadcastOperator(this.adapter).except(room);
199
- }
200
- /**
201
- * Adds a new client.
202
- *
203
- * @return {Socket}
204
- * @private
205
- */
206
- async _add(client, auth, fn) {
207
- var _a;
208
- debug("adding socket to nsp %s", this.name);
209
- const socket = await this._createSocket(client, auth);
210
- this._preConnectSockets.set(socket.id, socket);
211
- if (
212
- // @ts-ignore
213
- ((_a = this.server.opts.connectionStateRecovery) === null || _a === void 0 ? void 0 : _a.skipMiddlewares) &&
214
- socket.recovered &&
215
- client.conn.readyState === "open") {
216
- return this._doConnect(socket, fn);
217
- }
218
- this.run(socket, (err) => {
219
- process.nextTick(() => {
220
- if ("open" !== client.conn.readyState) {
221
- debug("next called after client was closed - ignoring socket");
222
- socket._cleanup();
223
- return;
224
- }
225
- if (err) {
226
- debug("middleware error, sending CONNECT_ERROR packet to the client");
227
- socket._cleanup();
228
- if (client.conn.protocol === 3) {
229
- return socket._error(err.data || err.message);
230
- }
231
- else {
232
- return socket._error({
233
- message: err.message,
234
- data: err.data,
235
- });
236
- }
237
- }
238
- this._doConnect(socket, fn);
239
- });
240
- });
241
- }
242
- async _createSocket(client, auth) {
243
- const sessionId = auth.pid;
244
- const offset = auth.offset;
245
- if (
246
- // @ts-ignore
247
- this.server.opts.connectionStateRecovery &&
248
- typeof sessionId === "string" &&
249
- typeof offset === "string") {
250
- let session;
251
- try {
252
- session = await this.adapter.restoreSession(sessionId, offset);
253
- }
254
- catch (e) {
255
- debug("error while restoring session: %s", e);
256
- }
257
- if (session) {
258
- debug("connection state recovered for sid %s", session.sid);
259
- return new socket_1.Socket(this, client, auth, session);
260
- }
261
- }
262
- return new socket_1.Socket(this, client, auth);
263
- }
264
- _doConnect(socket, fn) {
265
- this._preConnectSockets.delete(socket.id);
266
- this.sockets.set(socket.id, socket);
267
- // it's paramount that the internal `onconnect` logic
268
- // fires before user-set events to prevent state order
269
- // violations (such as a disconnection before the connection
270
- // logic is complete)
271
- socket._onconnect();
272
- if (fn)
273
- fn(socket);
274
- // fire user-set events
275
- this.emitReserved("connect", socket);
276
- this.emitReserved("connection", socket);
277
- }
278
- /**
279
- * Removes a client. Called by each `Socket`.
280
- *
281
- * @private
282
- */
283
- _remove(socket) {
284
- this.sockets.delete(socket.id) || this._preConnectSockets.delete(socket.id);
285
- }
286
- /**
287
- * Emits to all connected clients.
288
- *
289
- * @example
290
- * const myNamespace = io.of("/my-namespace");
291
- *
292
- * myNamespace.emit("hello", "world");
293
- *
294
- * // all serializable datastructures are supported (no need to call JSON.stringify)
295
- * myNamespace.emit("hello", 1, "2", { 3: ["4"], 5: Uint8Array.from([6]) });
296
- *
297
- * // with an acknowledgement from the clients
298
- * myNamespace.timeout(1000).emit("some-event", (err, responses) => {
299
- * if (err) {
300
- * // some clients did not acknowledge the event in the given delay
301
- * } else {
302
- * console.log(responses); // one response per client
303
- * }
304
- * });
305
- *
306
- * @return Always true
307
- */
308
- emit(ev, ...args) {
309
- return new broadcast_operator_1.BroadcastOperator(this.adapter).emit(ev, ...args);
310
- }
311
- /**
312
- * Sends a `message` event to all clients.
313
- *
314
- * This method mimics the WebSocket.send() method.
315
- *
316
- * @see https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/send
317
- *
318
- * @example
319
- * const myNamespace = io.of("/my-namespace");
320
- *
321
- * myNamespace.send("hello");
322
- *
323
- * // this is equivalent to
324
- * myNamespace.emit("message", "hello");
325
- *
326
- * @return self
327
- */
328
- send(...args) {
329
- // This type-cast is needed because EmitEvents likely doesn't have `message` as a key.
330
- // if you specify the EmitEvents, the type of args will be never.
331
- this.emit("message", ...args);
332
- return this;
333
- }
334
- /**
335
- * Sends a `message` event to all clients. Sends a `message` event. Alias of {@link send}.
336
- *
337
- * @return self
338
- */
339
- write(...args) {
340
- // This type-cast is needed because EmitEvents likely doesn't have `message` as a key.
341
- // if you specify the EmitEvents, the type of args will be never.
342
- this.emit("message", ...args);
343
- return this;
344
- }
345
- /**
346
- * Sends a message to the other Socket.IO servers of the cluster.
347
- *
348
- * @example
349
- * const myNamespace = io.of("/my-namespace");
350
- *
351
- * myNamespace.serverSideEmit("hello", "world");
352
- *
353
- * myNamespace.on("hello", (arg1) => {
354
- * console.log(arg1); // prints "world"
355
- * });
356
- *
357
- * // acknowledgements (without binary content) are supported too:
358
- * myNamespace.serverSideEmit("ping", (err, responses) => {
359
- * if (err) {
360
- * // some servers did not acknowledge the event in the given delay
361
- * } else {
362
- * console.log(responses); // one response per server (except the current one)
363
- * }
364
- * });
365
- *
366
- * myNamespace.on("ping", (cb) => {
367
- * cb("pong");
368
- * });
369
- *
370
- * @param ev - the event name
371
- * @param args - an array of arguments, which may include an acknowledgement callback at the end
372
- */
373
- serverSideEmit(ev, ...args) {
374
- if (exports.RESERVED_EVENTS.has(ev)) {
375
- throw new Error(`"${String(ev)}" is a reserved event name`);
376
- }
377
- args.unshift(ev);
378
- this.adapter.serverSideEmit(args);
379
- return true;
380
- }
381
- /**
382
- * Sends a message and expect an acknowledgement from the other Socket.IO servers of the cluster.
383
- *
384
- * @example
385
- * const myNamespace = io.of("/my-namespace");
386
- *
387
- * try {
388
- * const responses = await myNamespace.serverSideEmitWithAck("ping");
389
- * console.log(responses); // one response per server (except the current one)
390
- * } catch (e) {
391
- * // some servers did not acknowledge the event in the given delay
392
- * }
393
- *
394
- * @param ev - the event name
395
- * @param args - an array of arguments
396
- *
397
- * @return a Promise that will be fulfilled when all servers have acknowledged the event
398
- */
399
- serverSideEmitWithAck(ev, ...args) {
400
- return new Promise((resolve, reject) => {
401
- args.push((err, responses) => {
402
- if (err) {
403
- err.responses = responses;
404
- return reject(err);
405
- }
406
- else {
407
- return resolve(responses);
408
- }
409
- });
410
- this.serverSideEmit(ev, ...args);
411
- });
412
- }
413
- /**
414
- * Called when a packet is received from another Socket.IO server
415
- *
416
- * @param args - an array of arguments, which may include an acknowledgement callback at the end
417
- *
418
- * @private
419
- */
420
- _onServerSideEmit(args) {
421
- super.emitUntyped.apply(this, args);
422
- }
423
- /**
424
- * Gets a list of clients.
425
- *
426
- * @deprecated this method will be removed in the next major release, please use {@link Namespace#serverSideEmit} or
427
- * {@link Namespace#fetchSockets} instead.
428
- */
429
- allSockets() {
430
- return new broadcast_operator_1.BroadcastOperator(this.adapter).allSockets();
431
- }
432
- /**
433
- * Sets the compress flag.
434
- *
435
- * @example
436
- * const myNamespace = io.of("/my-namespace");
437
- *
438
- * myNamespace.compress(false).emit("hello");
439
- *
440
- * @param compress - if `true`, compresses the sending data
441
- * @return self
442
- */
443
- compress(compress) {
444
- return new broadcast_operator_1.BroadcastOperator(this.adapter).compress(compress);
445
- }
446
- /**
447
- * Sets a modifier for a subsequent event emission that the event data may be lost if the client is not ready to
448
- * receive messages (because of network slowness or other issues, or because they’re connected through long polling
449
- * and is in the middle of a request-response cycle).
450
- *
451
- * @example
452
- * const myNamespace = io.of("/my-namespace");
453
- *
454
- * myNamespace.volatile.emit("hello"); // the clients may or may not receive it
455
- *
456
- * @return self
457
- */
458
- get volatile() {
459
- return new broadcast_operator_1.BroadcastOperator(this.adapter).volatile;
460
- }
461
- /**
462
- * Sets a modifier for a subsequent event emission that the event data will only be broadcast to the current node.
463
- *
464
- * @example
465
- * const myNamespace = io.of("/my-namespace");
466
- *
467
- * // the “foo” event will be broadcast to all connected clients on this node
468
- * myNamespace.local.emit("foo", "bar");
469
- *
470
- * @return a new {@link BroadcastOperator} instance for chaining
471
- */
472
- get local() {
473
- return new broadcast_operator_1.BroadcastOperator(this.adapter).local;
474
- }
475
- /**
476
- * Adds a timeout in milliseconds for the next operation.
477
- *
478
- * @example
479
- * const myNamespace = io.of("/my-namespace");
480
- *
481
- * myNamespace.timeout(1000).emit("some-event", (err, responses) => {
482
- * if (err) {
483
- * // some clients did not acknowledge the event in the given delay
484
- * } else {
485
- * console.log(responses); // one response per client
486
- * }
487
- * });
488
- *
489
- * @param timeout
490
- */
491
- timeout(timeout) {
492
- return new broadcast_operator_1.BroadcastOperator(this.adapter).timeout(timeout);
493
- }
494
- /**
495
- * Returns the matching socket instances.
496
- *
497
- * Note: this method also works within a cluster of multiple Socket.IO servers, with a compatible {@link Adapter}.
498
- *
499
- * @example
500
- * const myNamespace = io.of("/my-namespace");
501
- *
502
- * // return all Socket instances
503
- * const sockets = await myNamespace.fetchSockets();
504
- *
505
- * // return all Socket instances in the "room1" room
506
- * const sockets = await myNamespace.in("room1").fetchSockets();
507
- *
508
- * for (const socket of sockets) {
509
- * console.log(socket.id);
510
- * console.log(socket.handshake);
511
- * console.log(socket.rooms);
512
- * console.log(socket.data);
513
- *
514
- * socket.emit("hello");
515
- * socket.join("room1");
516
- * socket.leave("room2");
517
- * socket.disconnect();
518
- * }
519
- */
520
- fetchSockets() {
521
- return new broadcast_operator_1.BroadcastOperator(this.adapter).fetchSockets();
522
- }
523
- /**
524
- * Makes the matching socket instances join the specified rooms.
525
- *
526
- * Note: this method also works within a cluster of multiple Socket.IO servers, with a compatible {@link Adapter}.
527
- *
528
- * @example
529
- * const myNamespace = io.of("/my-namespace");
530
- *
531
- * // make all socket instances join the "room1" room
532
- * myNamespace.socketsJoin("room1");
533
- *
534
- * // make all socket instances in the "room1" room join the "room2" and "room3" rooms
535
- * myNamespace.in("room1").socketsJoin(["room2", "room3"]);
536
- *
537
- * @param room - a room, or an array of rooms
538
- */
539
- socketsJoin(room) {
540
- return new broadcast_operator_1.BroadcastOperator(this.adapter).socketsJoin(room);
541
- }
542
- /**
543
- * Makes the matching socket instances leave the specified rooms.
544
- *
545
- * Note: this method also works within a cluster of multiple Socket.IO servers, with a compatible {@link Adapter}.
546
- *
547
- * @example
548
- * const myNamespace = io.of("/my-namespace");
549
- *
550
- * // make all socket instances leave the "room1" room
551
- * myNamespace.socketsLeave("room1");
552
- *
553
- * // make all socket instances in the "room1" room leave the "room2" and "room3" rooms
554
- * myNamespace.in("room1").socketsLeave(["room2", "room3"]);
555
- *
556
- * @param room - a room, or an array of rooms
557
- */
558
- socketsLeave(room) {
559
- return new broadcast_operator_1.BroadcastOperator(this.adapter).socketsLeave(room);
560
- }
561
- /**
562
- * Makes the matching socket instances disconnect.
563
- *
564
- * Note: this method also works within a cluster of multiple Socket.IO servers, with a compatible {@link Adapter}.
565
- *
566
- * @example
567
- * const myNamespace = io.of("/my-namespace");
568
- *
569
- * // make all socket instances disconnect (the connections might be kept alive for other namespaces)
570
- * myNamespace.disconnectSockets();
571
- *
572
- * // make all socket instances in the "room1" room disconnect and close the underlying connections
573
- * myNamespace.in("room1").disconnectSockets(true);
574
- *
575
- * @param close - whether to close the underlying connection
576
- */
577
- disconnectSockets(close = false) {
578
- return new broadcast_operator_1.BroadcastOperator(this.adapter).disconnectSockets(close);
579
- }
580
- }
581
- exports.Namespace = Namespace;
@@ -1,88 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ParentNamespace = void 0;
7
- const namespace_1 = require("./namespace");
8
- const socket_io_adapter_1 = require("socket.io-adapter");
9
- const debug_1 = __importDefault(require("debug"));
10
- const debug = (0, debug_1.default)("socket.io:parent-namespace");
11
- /**
12
- * A parent namespace is a special {@link Namespace} that holds a list of child namespaces which were created either
13
- * with a regular expression or with a function.
14
- *
15
- * @example
16
- * const parentNamespace = io.of(/\/dynamic-\d+/);
17
- *
18
- * parentNamespace.on("connection", (socket) => {
19
- * const childNamespace = socket.nsp;
20
- * }
21
- *
22
- * // will reach all the clients that are in one of the child namespaces, like "/dynamic-101"
23
- * parentNamespace.emit("hello", "world");
24
- *
25
- */
26
- class ParentNamespace extends namespace_1.Namespace {
27
- constructor(server) {
28
- super(server, "/_" + ParentNamespace.count++);
29
- this.children = new Set();
30
- }
31
- /**
32
- * @private
33
- */
34
- _initAdapter() {
35
- this.adapter = new ParentBroadcastAdapter(this);
36
- }
37
- emit(ev, ...args) {
38
- this.children.forEach((nsp) => {
39
- nsp.emit(ev, ...args);
40
- });
41
- return true;
42
- }
43
- createChild(name) {
44
- debug("creating child namespace %s", name);
45
- const namespace = new namespace_1.Namespace(this.server, name);
46
- this["_fns"].forEach((fn) => namespace.use(fn));
47
- this.listeners("connect").forEach((listener) => namespace.on("connect", listener));
48
- this.listeners("connection").forEach((listener) => namespace.on("connection", listener));
49
- this.children.add(namespace);
50
- if (this.server._opts.cleanupEmptyChildNamespaces) {
51
- const remove = namespace._remove;
52
- namespace._remove = (socket) => {
53
- remove.call(namespace, socket);
54
- if (namespace.sockets.size === 0) {
55
- debug("closing child namespace %s", name);
56
- namespace.adapter.close();
57
- this.server._nsps.delete(namespace.name);
58
- this.children.delete(namespace);
59
- }
60
- };
61
- }
62
- this.server._nsps.set(name, namespace);
63
- // @ts-ignore
64
- this.server.sockets.emitReserved("new_namespace", namespace);
65
- return namespace;
66
- }
67
- fetchSockets() {
68
- // note: we could make the fetchSockets() method work for dynamic namespaces created with a regex (by sending the
69
- // regex to the other Socket.IO servers, and returning the sockets of each matching namespace for example), but
70
- // the behavior for namespaces created with a function is less clear
71
- // note²: we cannot loop over each children namespace, because with multiple Socket.IO servers, a given namespace
72
- // may exist on one node but not exist on another (since it is created upon client connection)
73
- throw new Error("fetchSockets() is not supported on parent namespaces");
74
- }
75
- }
76
- exports.ParentNamespace = ParentNamespace;
77
- ParentNamespace.count = 0;
78
- /**
79
- * A dummy adapter that only supports broadcasting to child (concrete) namespaces.
80
- * @private file
81
- */
82
- class ParentBroadcastAdapter extends socket_io_adapter_1.Adapter {
83
- broadcast(packet, opts) {
84
- this.nsp.children.forEach((nsp) => {
85
- nsp.adapter.broadcast(packet, opts);
86
- });
87
- }
88
- }
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RESERVED_EVENTS = void 0;
4
- exports.RESERVED_EVENTS = new Set([
5
- "connect",
6
- "connect_error",
7
- "disconnect",
8
- "disconnecting",
9
- "newListener",
10
- "removeListener",
11
- ]);