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,804 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.Namespace = exports.Socket = exports.Server = void 0;
30
- const http = require("http");
31
- const fs_1 = require("fs");
32
- const zlib_1 = require("zlib");
33
- const accepts = require("accepts");
34
- const stream_1 = require("stream");
35
- const path = require("path");
36
- const engine_io_1 = require("engine.io");
37
- const client_1 = require("./client");
38
- const events_1 = require("events");
39
- const namespace_1 = require("./namespace");
40
- Object.defineProperty(exports, "Namespace", { enumerable: true, get: function () { return namespace_1.Namespace; } });
41
- const parent_namespace_1 = require("./parent-namespace");
42
- const socket_io_adapter_1 = require("socket.io-adapter");
43
- const parser = __importStar(require("socket.io-parser"));
44
- const debug_1 = __importDefault(require("debug"));
45
- const socket_1 = require("./socket");
46
- Object.defineProperty(exports, "Socket", { enumerable: true, get: function () { return socket_1.Socket; } });
47
- const typed_events_1 = require("./typed-events");
48
- const uws_1 = require("./uws");
49
- const cors_1 = __importDefault(require("cors"));
50
- const debug = (0, debug_1.default)("socket.io:server");
51
- const clientVersion = require("../package.json").version;
52
- const dotMapRegex = /\.map/;
53
- /**
54
- * Represents a Socket.IO server.
55
- *
56
- * @example
57
- * import { Server } from "socket.io";
58
- *
59
- * const io = new Server();
60
- *
61
- * io.on("connection", (socket) => {
62
- * console.log(`socket ${socket.id} connected`);
63
- *
64
- * // send an event to the client
65
- * socket.emit("foo", "bar");
66
- *
67
- * socket.on("foobar", () => {
68
- * // an event was received from the client
69
- * });
70
- *
71
- * // upon disconnection
72
- * socket.on("disconnect", (reason) => {
73
- * console.log(`socket ${socket.id} disconnected due to ${reason}`);
74
- * });
75
- * });
76
- *
77
- * io.listen(3000);
78
- */
79
- class Server extends typed_events_1.StrictEventEmitter {
80
- constructor(srv, opts = {}) {
81
- super();
82
- /**
83
- * @private
84
- */
85
- this._nsps = new Map();
86
- this.parentNsps = new Map();
87
- /**
88
- * A subset of the {@link parentNsps} map, only containing {@link ParentNamespace} which are based on a regular
89
- * expression.
90
- *
91
- * @private
92
- */
93
- this.parentNamespacesFromRegExp = new Map();
94
- if ("object" === typeof srv &&
95
- srv instanceof Object &&
96
- !srv.listen) {
97
- opts = srv;
98
- srv = undefined;
99
- }
100
- this.path(opts.path || "/socket.io");
101
- this.connectTimeout(opts.connectTimeout || 45000);
102
- this.serveClient(false !== opts.serveClient);
103
- this._parser = opts.parser || parser;
104
- this.encoder = new this._parser.Encoder();
105
- this.opts = opts;
106
- if (opts.connectionStateRecovery) {
107
- opts.connectionStateRecovery = Object.assign({
108
- maxDisconnectionDuration: 2 * 60 * 1000,
109
- skipMiddlewares: true,
110
- }, opts.connectionStateRecovery);
111
- this.adapter(opts.adapter || socket_io_adapter_1.SessionAwareAdapter);
112
- }
113
- else {
114
- this.adapter(opts.adapter || socket_io_adapter_1.Adapter);
115
- }
116
- opts.cleanupEmptyChildNamespaces = !!opts.cleanupEmptyChildNamespaces;
117
- this.sockets = this.of("/");
118
- if (srv || typeof srv == "number")
119
- this.attach(srv);
120
- if (this.opts.cors) {
121
- this._corsMiddleware = (0, cors_1.default)(this.opts.cors);
122
- }
123
- }
124
- get _opts() {
125
- return this.opts;
126
- }
127
- serveClient(v) {
128
- if (!arguments.length)
129
- return this._serveClient;
130
- this._serveClient = v;
131
- return this;
132
- }
133
- /**
134
- * Executes the middleware for an incoming namespace not already created on the server.
135
- *
136
- * @param name - name of incoming namespace
137
- * @param auth - the auth parameters
138
- * @param fn - callback
139
- *
140
- * @private
141
- */
142
- _checkNamespace(name, auth, fn) {
143
- if (this.parentNsps.size === 0)
144
- return fn(false);
145
- const keysIterator = this.parentNsps.keys();
146
- const run = () => {
147
- const nextFn = keysIterator.next();
148
- if (nextFn.done) {
149
- return fn(false);
150
- }
151
- nextFn.value(name, auth, (err, allow) => {
152
- if (err || !allow) {
153
- return run();
154
- }
155
- if (this._nsps.has(name)) {
156
- // the namespace was created in the meantime
157
- debug("dynamic namespace %s already exists", name);
158
- return fn(this._nsps.get(name));
159
- }
160
- const namespace = this.parentNsps.get(nextFn.value).createChild(name);
161
- debug("dynamic namespace %s was created", name);
162
- fn(namespace);
163
- });
164
- };
165
- run();
166
- }
167
- path(v) {
168
- if (!arguments.length)
169
- return this._path;
170
- this._path = v.replace(/\/$/, "");
171
- const escapedPath = this._path.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
172
- this.clientPathRegex = new RegExp("^" +
173
- escapedPath +
174
- "/socket\\.io(\\.msgpack|\\.esm)?(\\.min)?\\.js(\\.map)?(?:\\?|$)");
175
- return this;
176
- }
177
- connectTimeout(v) {
178
- if (v === undefined)
179
- return this._connectTimeout;
180
- this._connectTimeout = v;
181
- return this;
182
- }
183
- adapter(v) {
184
- if (!arguments.length)
185
- return this._adapter;
186
- this._adapter = v;
187
- for (const nsp of this._nsps.values()) {
188
- nsp._initAdapter();
189
- }
190
- return this;
191
- }
192
- /**
193
- * Attaches socket.io to a server or port.
194
- *
195
- * @param srv - server or port
196
- * @param opts - options passed to engine.io
197
- * @return self
198
- */
199
- listen(srv, opts = {}) {
200
- return this.attach(srv, opts);
201
- }
202
- /**
203
- * Attaches socket.io to a server or port.
204
- *
205
- * @param srv - server or port
206
- * @param opts - options passed to engine.io
207
- * @return self
208
- */
209
- attach(srv, opts = {}) {
210
- if ("function" == typeof srv) {
211
- const msg = "You are trying to attach socket.io to an express " +
212
- "request handler function. Please pass a http.Server instance.";
213
- throw new Error(msg);
214
- }
215
- // handle a port as a string
216
- if (Number(srv) == srv) {
217
- srv = Number(srv);
218
- }
219
- if ("number" == typeof srv) {
220
- debug("creating http server and binding to %d", srv);
221
- const port = srv;
222
- srv = http.createServer((req, res) => {
223
- res.writeHead(404);
224
- res.end();
225
- });
226
- srv.listen(port);
227
- }
228
- // merge the options passed to the Socket.IO server
229
- Object.assign(opts, this.opts);
230
- // set engine.io path to `/socket.io`
231
- opts.path = opts.path || this._path;
232
- this.initEngine(srv, opts);
233
- return this;
234
- }
235
- attachApp(app /*: TemplatedApp */, opts = {}) {
236
- // merge the options passed to the Socket.IO server
237
- Object.assign(opts, this.opts);
238
- // set engine.io path to `/socket.io`
239
- opts.path = opts.path || this._path;
240
- // initialize engine
241
- debug("creating uWebSockets.js-based engine with opts %j", opts);
242
- const engine = new engine_io_1.uServer(opts);
243
- engine.attach(app, opts);
244
- // bind to engine events
245
- this.bind(engine);
246
- if (this._serveClient) {
247
- // attach static file serving
248
- app.get(`${this._path}/*`, (res, req) => {
249
- if (!this.clientPathRegex.test(req.getUrl())) {
250
- req.setYield(true);
251
- return;
252
- }
253
- const filename = req
254
- .getUrl()
255
- .replace(this._path, "")
256
- .replace(/\?.*$/, "")
257
- .replace(/^\//, "");
258
- const isMap = dotMapRegex.test(filename);
259
- const type = isMap ? "map" : "source";
260
- // Per the standard, ETags must be quoted:
261
- // https://tools.ietf.org/html/rfc7232#section-2.3
262
- const expectedEtag = '"' + clientVersion + '"';
263
- const weakEtag = "W/" + expectedEtag;
264
- const etag = req.getHeader("if-none-match");
265
- if (etag) {
266
- if (expectedEtag === etag || weakEtag === etag) {
267
- debug("serve client %s 304", type);
268
- res.writeStatus("304 Not Modified");
269
- res.end();
270
- return;
271
- }
272
- }
273
- debug("serve client %s", type);
274
- res.writeHeader("cache-control", "public, max-age=0");
275
- res.writeHeader("content-type", "application/" + (isMap ? "json" : "javascript") + "; charset=utf-8");
276
- res.writeHeader("etag", expectedEtag);
277
- const filepath = path.join(__dirname, "../client-dist/", filename);
278
- (0, uws_1.serveFile)(res, filepath);
279
- });
280
- }
281
- (0, uws_1.patchAdapter)(app);
282
- }
283
- /**
284
- * Initialize engine
285
- *
286
- * @param srv - the server to attach to
287
- * @param opts - options passed to engine.io
288
- * @private
289
- */
290
- initEngine(srv, opts) {
291
- // initialize engine
292
- debug("creating engine.io instance with opts %j", opts);
293
- this.eio = (0, engine_io_1.attach)(srv, opts);
294
- // attach static file serving
295
- if (this._serveClient)
296
- this.attachServe(srv);
297
- // Export http server
298
- this.httpServer = srv;
299
- // bind to engine events
300
- this.bind(this.eio);
301
- }
302
- /**
303
- * Attaches the static file serving.
304
- *
305
- * @param srv http server
306
- * @private
307
- */
308
- attachServe(srv) {
309
- debug("attaching client serving req handler");
310
- const evs = srv.listeners("request").slice(0);
311
- srv.removeAllListeners("request");
312
- srv.on("request", (req, res) => {
313
- if (this.clientPathRegex.test(req.url)) {
314
- if (this._corsMiddleware) {
315
- this._corsMiddleware(req, res, () => {
316
- this.serve(req, res);
317
- });
318
- }
319
- else {
320
- this.serve(req, res);
321
- }
322
- }
323
- else {
324
- for (let i = 0; i < evs.length; i++) {
325
- evs[i].call(srv, req, res);
326
- }
327
- }
328
- });
329
- }
330
- /**
331
- * Handles a request serving of client source and map
332
- *
333
- * @param req
334
- * @param res
335
- * @private
336
- */
337
- serve(req, res) {
338
- const filename = req.url.replace(this._path, "").replace(/\?.*$/, "");
339
- const isMap = dotMapRegex.test(filename);
340
- const type = isMap ? "map" : "source";
341
- // Per the standard, ETags must be quoted:
342
- // https://tools.ietf.org/html/rfc7232#section-2.3
343
- const expectedEtag = '"' + clientVersion + '"';
344
- const weakEtag = "W/" + expectedEtag;
345
- const etag = req.headers["if-none-match"];
346
- if (etag) {
347
- if (expectedEtag === etag || weakEtag === etag) {
348
- debug("serve client %s 304", type);
349
- res.writeHead(304);
350
- res.end();
351
- return;
352
- }
353
- }
354
- debug("serve client %s", type);
355
- res.setHeader("Cache-Control", "public, max-age=0");
356
- res.setHeader("Content-Type", "application/" + (isMap ? "json" : "javascript") + "; charset=utf-8");
357
- res.setHeader("ETag", expectedEtag);
358
- Server.sendFile(filename, req, res);
359
- }
360
- /**
361
- * @param filename
362
- * @param req
363
- * @param res
364
- * @private
365
- */
366
- static sendFile(filename, req, res) {
367
- const readStream = (0, fs_1.createReadStream)(path.join(__dirname, "../client-dist/", filename));
368
- const encoding = accepts(req).encodings(["br", "gzip", "deflate"]);
369
- const onError = (err) => {
370
- if (err) {
371
- res.end();
372
- }
373
- };
374
- switch (encoding) {
375
- case "br":
376
- res.writeHead(200, { "content-encoding": "br" });
377
- (0, stream_1.pipeline)(readStream, (0, zlib_1.createBrotliCompress)(), res, onError);
378
- break;
379
- case "gzip":
380
- res.writeHead(200, { "content-encoding": "gzip" });
381
- (0, stream_1.pipeline)(readStream, (0, zlib_1.createGzip)(), res, onError);
382
- break;
383
- case "deflate":
384
- res.writeHead(200, { "content-encoding": "deflate" });
385
- (0, stream_1.pipeline)(readStream, (0, zlib_1.createDeflate)(), res, onError);
386
- break;
387
- default:
388
- res.writeHead(200);
389
- (0, stream_1.pipeline)(readStream, res, onError);
390
- }
391
- }
392
- /**
393
- * Binds socket.io to an engine.io instance.
394
- *
395
- * @param engine engine.io (or compatible) server
396
- * @return self
397
- */
398
- bind(engine) {
399
- // TODO apply strict types to the engine: "connection" event, `close()` and a method to serve static content
400
- // this would allow to provide any custom engine, like one based on Deno or Bun built-in HTTP server
401
- this.engine = engine;
402
- this.engine.on("connection", this.onconnection.bind(this));
403
- return this;
404
- }
405
- /**
406
- * Called with each incoming transport connection.
407
- *
408
- * @param {engine.Socket} conn
409
- * @return self
410
- * @private
411
- */
412
- onconnection(conn) {
413
- debug("incoming connection with id %s", conn.id);
414
- const client = new client_1.Client(this, conn);
415
- if (conn.protocol === 3) {
416
- // @ts-ignore
417
- client.connect("/");
418
- }
419
- return this;
420
- }
421
- /**
422
- * Looks up a namespace.
423
- *
424
- * @example
425
- * // with a simple string
426
- * const myNamespace = io.of("/my-namespace");
427
- *
428
- * // with a regex
429
- * const dynamicNsp = io.of(/^\/dynamic-\d+$/).on("connection", (socket) => {
430
- * const namespace = socket.nsp; // newNamespace.name === "/dynamic-101"
431
- *
432
- * // broadcast to all clients in the given sub-namespace
433
- * namespace.emit("hello");
434
- * });
435
- *
436
- * @param name - nsp name
437
- * @param fn optional, nsp `connection` ev handler
438
- */
439
- of(name, fn) {
440
- if (typeof name === "function" || name instanceof RegExp) {
441
- const parentNsp = new parent_namespace_1.ParentNamespace(this);
442
- debug("initializing parent namespace %s", parentNsp.name);
443
- if (typeof name === "function") {
444
- this.parentNsps.set(name, parentNsp);
445
- }
446
- else {
447
- this.parentNsps.set((nsp, conn, next) => next(null, name.test(nsp)), parentNsp);
448
- this.parentNamespacesFromRegExp.set(name, parentNsp);
449
- }
450
- if (fn) {
451
- // @ts-ignore
452
- parentNsp.on("connect", fn);
453
- }
454
- return parentNsp;
455
- }
456
- if (String(name)[0] !== "/")
457
- name = "/" + name;
458
- let nsp = this._nsps.get(name);
459
- if (!nsp) {
460
- for (const [regex, parentNamespace] of this.parentNamespacesFromRegExp) {
461
- if (regex.test(name)) {
462
- debug("attaching namespace %s to parent namespace %s", name, regex);
463
- return parentNamespace.createChild(name);
464
- }
465
- }
466
- debug("initializing namespace %s", name);
467
- nsp = new namespace_1.Namespace(this, name);
468
- this._nsps.set(name, nsp);
469
- if (name !== "/") {
470
- // @ts-ignore
471
- this.sockets.emitReserved("new_namespace", nsp);
472
- }
473
- }
474
- if (fn)
475
- nsp.on("connect", fn);
476
- return nsp;
477
- }
478
- /**
479
- * Closes server connection
480
- *
481
- * @param [fn] optional, called as `fn([err])` on error OR all conns closed
482
- */
483
- async close(fn) {
484
- await Promise.allSettled([...this._nsps.values()].map(async (nsp) => {
485
- nsp.sockets.forEach((socket) => {
486
- socket._onclose("server shutting down");
487
- });
488
- await nsp.adapter.close();
489
- }));
490
- this.engine.close();
491
- // restore the Adapter prototype, when the Socket.IO server was attached to a uWebSockets.js server
492
- (0, uws_1.restoreAdapter)();
493
- if (this.httpServer) {
494
- this.httpServer.close(fn);
495
- }
496
- else {
497
- fn && fn();
498
- }
499
- }
500
- /**
501
- * Registers a middleware, which is a function that gets executed for every incoming {@link Socket}.
502
- *
503
- * @example
504
- * io.use((socket, next) => {
505
- * // ...
506
- * next();
507
- * });
508
- *
509
- * @param fn - the middleware function
510
- */
511
- use(fn) {
512
- this.sockets.use(fn);
513
- return this;
514
- }
515
- /**
516
- * Targets a room when emitting.
517
- *
518
- * @example
519
- * // the “foo” event will be broadcast to all connected clients in the “room-101” room
520
- * io.to("room-101").emit("foo", "bar");
521
- *
522
- * // with an array of rooms (a client will be notified at most once)
523
- * io.to(["room-101", "room-102"]).emit("foo", "bar");
524
- *
525
- * // with multiple chained calls
526
- * io.to("room-101").to("room-102").emit("foo", "bar");
527
- *
528
- * @param room - a room, or an array of rooms
529
- * @return a new {@link BroadcastOperator} instance for chaining
530
- */
531
- to(room) {
532
- return this.sockets.to(room);
533
- }
534
- /**
535
- * Targets a room when emitting. Similar to `to()`, but might feel clearer in some cases:
536
- *
537
- * @example
538
- * // disconnect all clients in the "room-101" room
539
- * io.in("room-101").disconnectSockets();
540
- *
541
- * @param room - a room, or an array of rooms
542
- * @return a new {@link BroadcastOperator} instance for chaining
543
- */
544
- in(room) {
545
- return this.sockets.in(room);
546
- }
547
- /**
548
- * Excludes a room when emitting.
549
- *
550
- * @example
551
- * // the "foo" event will be broadcast to all connected clients, except the ones that are in the "room-101" room
552
- * io.except("room-101").emit("foo", "bar");
553
- *
554
- * // with an array of rooms
555
- * io.except(["room-101", "room-102"]).emit("foo", "bar");
556
- *
557
- * // with multiple chained calls
558
- * io.except("room-101").except("room-102").emit("foo", "bar");
559
- *
560
- * @param room - a room, or an array of rooms
561
- * @return a new {@link BroadcastOperator} instance for chaining
562
- */
563
- except(room) {
564
- return this.sockets.except(room);
565
- }
566
- /**
567
- * Sends a `message` event to all clients.
568
- *
569
- * This method mimics the WebSocket.send() method.
570
- *
571
- * @see https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/send
572
- *
573
- * @example
574
- * io.send("hello");
575
- *
576
- * // this is equivalent to
577
- * io.emit("message", "hello");
578
- *
579
- * @return self
580
- */
581
- send(...args) {
582
- // This type-cast is needed because EmitEvents likely doesn't have `message` as a key.
583
- // if you specify the EmitEvents, the type of args will be never.
584
- this.sockets.emit("message", ...args);
585
- return this;
586
- }
587
- /**
588
- * Sends a `message` event to all clients. Alias of {@link send}.
589
- *
590
- * @return self
591
- */
592
- write(...args) {
593
- // This type-cast is needed because EmitEvents likely doesn't have `message` as a key.
594
- // if you specify the EmitEvents, the type of args will be never.
595
- this.sockets.emit("message", ...args);
596
- return this;
597
- }
598
- /**
599
- * Sends a message to the other Socket.IO servers of the cluster.
600
- *
601
- * @example
602
- * io.serverSideEmit("hello", "world");
603
- *
604
- * io.on("hello", (arg1) => {
605
- * console.log(arg1); // prints "world"
606
- * });
607
- *
608
- * // acknowledgements (without binary content) are supported too:
609
- * io.serverSideEmit("ping", (err, responses) => {
610
- * if (err) {
611
- * // some servers did not acknowledge the event in the given delay
612
- * } else {
613
- * console.log(responses); // one response per server (except the current one)
614
- * }
615
- * });
616
- *
617
- * io.on("ping", (cb) => {
618
- * cb("pong");
619
- * });
620
- *
621
- * @param ev - the event name
622
- * @param args - an array of arguments, which may include an acknowledgement callback at the end
623
- */
624
- serverSideEmit(ev, ...args) {
625
- return this.sockets.serverSideEmit(ev, ...args);
626
- }
627
- /**
628
- * Sends a message and expect an acknowledgement from the other Socket.IO servers of the cluster.
629
- *
630
- * @example
631
- * try {
632
- * const responses = await io.serverSideEmitWithAck("ping");
633
- * console.log(responses); // one response per server (except the current one)
634
- * } catch (e) {
635
- * // some servers did not acknowledge the event in the given delay
636
- * }
637
- *
638
- * @param ev - the event name
639
- * @param args - an array of arguments
640
- *
641
- * @return a Promise that will be fulfilled when all servers have acknowledged the event
642
- */
643
- serverSideEmitWithAck(ev, ...args) {
644
- return this.sockets.serverSideEmitWithAck(ev, ...args);
645
- }
646
- /**
647
- * Gets a list of socket ids.
648
- *
649
- * @deprecated this method will be removed in the next major release, please use {@link Server#serverSideEmit} or
650
- * {@link Server#fetchSockets} instead.
651
- */
652
- allSockets() {
653
- return this.sockets.allSockets();
654
- }
655
- /**
656
- * Sets the compress flag.
657
- *
658
- * @example
659
- * io.compress(false).emit("hello");
660
- *
661
- * @param compress - if `true`, compresses the sending data
662
- * @return a new {@link BroadcastOperator} instance for chaining
663
- */
664
- compress(compress) {
665
- return this.sockets.compress(compress);
666
- }
667
- /**
668
- * Sets a modifier for a subsequent event emission that the event data may be lost if the client is not ready to
669
- * receive messages (because of network slowness or other issues, or because they’re connected through long polling
670
- * and is in the middle of a request-response cycle).
671
- *
672
- * @example
673
- * io.volatile.emit("hello"); // the clients may or may not receive it
674
- *
675
- * @return a new {@link BroadcastOperator} instance for chaining
676
- */
677
- get volatile() {
678
- return this.sockets.volatile;
679
- }
680
- /**
681
- * Sets a modifier for a subsequent event emission that the event data will only be broadcast to the current node.
682
- *
683
- * @example
684
- * // the “foo” event will be broadcast to all connected clients on this node
685
- * io.local.emit("foo", "bar");
686
- *
687
- * @return a new {@link BroadcastOperator} instance for chaining
688
- */
689
- get local() {
690
- return this.sockets.local;
691
- }
692
- /**
693
- * Adds a timeout in milliseconds for the next operation.
694
- *
695
- * @example
696
- * io.timeout(1000).emit("some-event", (err, responses) => {
697
- * if (err) {
698
- * // some clients did not acknowledge the event in the given delay
699
- * } else {
700
- * console.log(responses); // one response per client
701
- * }
702
- * });
703
- *
704
- * @param timeout
705
- */
706
- timeout(timeout) {
707
- return this.sockets.timeout(timeout);
708
- }
709
- /**
710
- * Returns the matching socket instances.
711
- *
712
- * Note: this method also works within a cluster of multiple Socket.IO servers, with a compatible {@link Adapter}.
713
- *
714
- * @example
715
- * // return all Socket instances
716
- * const sockets = await io.fetchSockets();
717
- *
718
- * // return all Socket instances in the "room1" room
719
- * const sockets = await io.in("room1").fetchSockets();
720
- *
721
- * for (const socket of sockets) {
722
- * console.log(socket.id);
723
- * console.log(socket.handshake);
724
- * console.log(socket.rooms);
725
- * console.log(socket.data);
726
- *
727
- * socket.emit("hello");
728
- * socket.join("room1");
729
- * socket.leave("room2");
730
- * socket.disconnect();
731
- * }
732
- */
733
- fetchSockets() {
734
- return this.sockets.fetchSockets();
735
- }
736
- /**
737
- * Makes the matching socket instances join the specified rooms.
738
- *
739
- * Note: this method also works within a cluster of multiple Socket.IO servers, with a compatible {@link Adapter}.
740
- *
741
- * @example
742
- *
743
- * // make all socket instances join the "room1" room
744
- * io.socketsJoin("room1");
745
- *
746
- * // make all socket instances in the "room1" room join the "room2" and "room3" rooms
747
- * io.in("room1").socketsJoin(["room2", "room3"]);
748
- *
749
- * @param room - a room, or an array of rooms
750
- */
751
- socketsJoin(room) {
752
- return this.sockets.socketsJoin(room);
753
- }
754
- /**
755
- * Makes the matching socket instances leave the specified rooms.
756
- *
757
- * Note: this method also works within a cluster of multiple Socket.IO servers, with a compatible {@link Adapter}.
758
- *
759
- * @example
760
- * // make all socket instances leave the "room1" room
761
- * io.socketsLeave("room1");
762
- *
763
- * // make all socket instances in the "room1" room leave the "room2" and "room3" rooms
764
- * io.in("room1").socketsLeave(["room2", "room3"]);
765
- *
766
- * @param room - a room, or an array of rooms
767
- */
768
- socketsLeave(room) {
769
- return this.sockets.socketsLeave(room);
770
- }
771
- /**
772
- * Makes the matching socket instances disconnect.
773
- *
774
- * Note: this method also works within a cluster of multiple Socket.IO servers, with a compatible {@link Adapter}.
775
- *
776
- * @example
777
- * // make all socket instances disconnect (the connections might be kept alive for other namespaces)
778
- * io.disconnectSockets();
779
- *
780
- * // make all socket instances in the "room1" room disconnect and close the underlying connections
781
- * io.in("room1").disconnectSockets(true);
782
- *
783
- * @param close - whether to close the underlying connection
784
- */
785
- disconnectSockets(close = false) {
786
- return this.sockets.disconnectSockets(close);
787
- }
788
- }
789
- exports.Server = Server;
790
- /**
791
- * Expose main namespace (/).
792
- */
793
- const emitterMethods = Object.keys(events_1.EventEmitter.prototype).filter(function (key) {
794
- return typeof events_1.EventEmitter.prototype[key] === "function";
795
- });
796
- emitterMethods.forEach(function (fn) {
797
- Server.prototype[fn] = function () {
798
- return this.sockets[fn].apply(this.sockets, arguments);
799
- };
800
- });
801
- module.exports = (srv, opts) => new Server(srv, opts);
802
- module.exports.Server = Server;
803
- module.exports.Namespace = namespace_1.Namespace;
804
- module.exports.Socket = socket_1.Socket;