openportal 0.1.1 → 0.1.3

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 (182) hide show
  1. package/README.md +113 -0
  2. package/package.json +1 -1
  3. package/web/.next/static/{A7pW-dtFIbPCSkvE8uenX → Im7EdK1Q3oOmTznohTOr5}/_buildManifest.js +4 -9
  4. package/web/.next/static/chunks/{2e7bfb90c343ca96.js → 35cc9dbdc670c73c.js} +4 -4
  5. package/web/.next/static/chunks/4147ffc67a7b837c.css +1 -0
  6. package/web/.next/static/chunks/{21ab2574b84ad2d1.js → 52b90bc1740162c2.js} +2 -2
  7. package/web/.next/static/chunks/{9b265e2198b5525f.js → 8644d68bf325ff24.js} +3 -3
  8. package/web/.next/static/chunks/{03e1846335a31354.js → 9865709466b09f79.js} +3 -3
  9. package/web/.next/static/chunks/{c20ae04df8cc28be.js → 9ba9a5774c9421bd.js} +3 -3
  10. package/web/.next/static/chunks/{967a1e0002fe9ae6.js → b5caad256518cb33.js} +3 -3
  11. package/web/.next/static/chunks/{turbopack-27558c851386934e.js → turbopack-26af71e419c11487.js} +1 -1
  12. package/web/.next/static/chunks/{turbopack-f4c0881f9723f5a5.js → turbopack-4ad0df7330c00c8d.js} +1 -1
  13. package/web/.next/static/chunks/{turbopack-26688626142ac58f.js → turbopack-8e653f3ad3a8ed18.js} +1 -1
  14. package/web/.next/static/chunks/{turbopack-c40ec6674624f1d7.js → turbopack-d5098189d63fd7b8.js} +1 -1
  15. package/web/apps/web/.next/BUILD_ID +1 -1
  16. package/web/apps/web/.next/build-manifest.json +14 -24
  17. package/web/apps/web/.next/routes-manifest.json +0 -12
  18. package/web/apps/web/.next/server/chunks/[root-of-the-server]__f366ca98._.js +358 -0
  19. package/web/apps/web/.next/server/chunks/ssr/{[root-of-the-server]__dfeaf8cf._.js → [root-of-the-server]__1a54ba1e._.js} +3 -3
  20. package/web/apps/web/.next/server/middleware-build-manifest.js +12 -22
  21. package/web/apps/web/.next/server/next-font-manifest.js +1 -1
  22. package/web/apps/web/.next/server/next-font-manifest.json +0 -4
  23. package/web/apps/web/.next/server/pages/404.html +1 -1
  24. package/web/apps/web/.next/server/pages/500.html +1 -1
  25. package/web/apps/web/.next/server/pages/_app/build-manifest.json +3 -3
  26. package/web/apps/web/.next/server/pages/_app/client-build-manifest.json +1 -1
  27. package/web/apps/web/.next/server/pages/api/[[...slugs]].js +1 -2
  28. package/web/apps/web/.next/server/pages/api/[[...slugs]].js.nft.json +1 -1
  29. package/web/apps/web/.next/server/pages/index/build-manifest.json +3 -3
  30. package/web/apps/web/.next/server/pages/index/client-build-manifest.json +1 -1
  31. package/web/apps/web/.next/server/pages/index.html +1 -1
  32. package/web/apps/web/.next/server/pages/index.js.nft.json +1 -1
  33. package/web/apps/web/.next/server/pages/session/[id]/build-manifest.json +4 -4
  34. package/web/apps/web/.next/server/pages/session/[id]/client-build-manifest.json +1 -1
  35. package/web/apps/web/.next/server/pages/session/[id].html +1 -1
  36. package/web/apps/web/.next/server/pages/session/[id].js.nft.json +1 -1
  37. package/web/apps/web/.next/server/pages/settings/build-manifest.json +3 -3
  38. package/web/apps/web/.next/server/pages/settings/client-build-manifest.json +1 -1
  39. package/web/apps/web/.next/server/pages/settings.html +1 -1
  40. package/web/apps/web/.next/server/pages/settings.js.nft.json +1 -1
  41. package/web/apps/web/.next/server/pages-manifest.json +0 -2
  42. package/web/apps/web/package.json +1 -9
  43. package/web/.next/static/chunks/04d4692d75696297.css +0 -1
  44. package/web/.next/static/chunks/553710f60e2f2b11.js +0 -1
  45. package/web/.next/static/chunks/58acbbb4090e3362.js +0 -3
  46. package/web/.next/static/chunks/6ce1e2f08f961db5.js +0 -2
  47. package/web/.next/static/chunks/d316d63225992c76.js +0 -10
  48. package/web/.next/static/chunks/e0c97552ba7a9e3d.js +0 -1
  49. package/web/.next/static/chunks/fc9c4f2dabfb4e0e.css +0 -1
  50. package/web/.next/static/chunks/turbopack-1837909a677d116b.js +0 -3
  51. package/web/apps/web/.next/server/chunks/[root-of-the-server]__0f75905d._.js +0 -3
  52. package/web/apps/web/.next/server/chunks/[root-of-the-server]__89e85365._.js +0 -358
  53. package/web/apps/web/.next/server/chunks/[root-of-the-server]__ae1361d0._.js +0 -3
  54. package/web/apps/web/.next/server/pages/api/terminal/ws/pages-manifest.json +0 -3
  55. package/web/apps/web/.next/server/pages/api/terminal/ws.js +0 -5
  56. package/web/apps/web/.next/server/pages/api/terminal/ws.js.map +0 -5
  57. package/web/apps/web/.next/server/pages/api/terminal/ws.js.nft.json +0 -1
  58. package/web/apps/web/.next/server/pages/terminal/build-manifest.json +0 -20
  59. package/web/apps/web/.next/server/pages/terminal/client-build-manifest.json +0 -5
  60. package/web/apps/web/.next/server/pages/terminal/next-font-manifest.json +0 -11
  61. package/web/apps/web/.next/server/pages/terminal/pages-manifest.json +0 -3
  62. package/web/apps/web/.next/server/pages/terminal/react-loadable-manifest.json +0 -1
  63. package/web/apps/web/.next/server/pages/terminal.html +0 -1
  64. package/web/apps/web/.next/server/pages/terminal.js.map +0 -5
  65. package/web/apps/web/.next/server/pages/terminal.js.nft.json +0 -1
  66. package/web/node_modules/.bun/@socket.io+component-emitter@3.1.2/node_modules/@socket.io/component-emitter/lib/cjs/index.js +0 -176
  67. package/web/node_modules/.bun/@socket.io+component-emitter@3.1.2/node_modules/@socket.io/component-emitter/lib/cjs/package.json +0 -4
  68. package/web/node_modules/.bun/@socket.io+component-emitter@3.1.2/node_modules/@socket.io/component-emitter/package.json +0 -28
  69. package/web/node_modules/.bun/accepts@1.3.8/node_modules/accepts/index.js +0 -238
  70. package/web/node_modules/.bun/accepts@1.3.8/node_modules/accepts/package.json +0 -47
  71. package/web/node_modules/.bun/base64id@2.0.0/node_modules/base64id/lib/base64id.js +0 -103
  72. package/web/node_modules/.bun/base64id@2.0.0/node_modules/base64id/package.json +0 -13
  73. package/web/node_modules/.bun/cookie@0.7.2/node_modules/cookie/index.js +0 -335
  74. package/web/node_modules/.bun/cookie@0.7.2/node_modules/cookie/package.json +0 -44
  75. package/web/node_modules/.bun/cookie@1.1.1/node_modules/cookie/package.json +0 -47
  76. package/web/node_modules/.bun/cors@2.8.5/node_modules/cors/lib/index.js +0 -238
  77. package/web/node_modules/.bun/cors@2.8.5/node_modules/cors/package.json +0 -41
  78. package/web/node_modules/.bun/debug@4.3.7/node_modules/debug/package.json +0 -60
  79. package/web/node_modules/.bun/debug@4.3.7/node_modules/debug/src/browser.js +0 -271
  80. package/web/node_modules/.bun/debug@4.3.7/node_modules/debug/src/common.js +0 -274
  81. package/web/node_modules/.bun/debug@4.3.7/node_modules/debug/src/index.js +0 -10
  82. package/web/node_modules/.bun/debug@4.3.7/node_modules/debug/src/node.js +0 -263
  83. package/web/node_modules/.bun/engine.io-parser@5.2.3/node_modules/engine.io-parser/build/cjs/commons.js +0 -19
  84. package/web/node_modules/.bun/engine.io-parser@5.2.3/node_modules/engine.io-parser/build/cjs/decodePacket.js +0 -59
  85. package/web/node_modules/.bun/engine.io-parser@5.2.3/node_modules/engine.io-parser/build/cjs/encodePacket.js +0 -38
  86. package/web/node_modules/.bun/engine.io-parser@5.2.3/node_modules/engine.io-parser/build/cjs/index.js +0 -164
  87. package/web/node_modules/.bun/engine.io-parser@5.2.3/node_modules/engine.io-parser/build/cjs/package.json +0 -8
  88. package/web/node_modules/.bun/engine.io-parser@5.2.3/node_modules/engine.io-parser/package.json +0 -46
  89. package/web/node_modules/.bun/engine.io@6.6.4/node_modules/engine.io/build/engine.io.js +0 -54
  90. package/web/node_modules/.bun/engine.io@6.6.4/node_modules/engine.io/build/parser-v3/index.js +0 -424
  91. package/web/node_modules/.bun/engine.io@6.6.4/node_modules/engine.io/build/parser-v3/utf8.js +0 -187
  92. package/web/node_modules/.bun/engine.io@6.6.4/node_modules/engine.io/build/server.js +0 -786
  93. package/web/node_modules/.bun/engine.io@6.6.4/node_modules/engine.io/build/socket.js +0 -460
  94. package/web/node_modules/.bun/engine.io@6.6.4/node_modules/engine.io/build/transport.js +0 -117
  95. package/web/node_modules/.bun/engine.io@6.6.4/node_modules/engine.io/build/transports/index.js +0 -23
  96. package/web/node_modules/.bun/engine.io@6.6.4/node_modules/engine.io/build/transports/polling-jsonp.js +0 -41
  97. package/web/node_modules/.bun/engine.io@6.6.4/node_modules/engine.io/build/transports/polling.js +0 -332
  98. package/web/node_modules/.bun/engine.io@6.6.4/node_modules/engine.io/build/transports/websocket.js +0 -94
  99. package/web/node_modules/.bun/engine.io@6.6.4/node_modules/engine.io/build/transports/webtransport.js +0 -63
  100. package/web/node_modules/.bun/engine.io@6.6.4/node_modules/engine.io/build/transports-uws/index.js +0 -8
  101. package/web/node_modules/.bun/engine.io@6.6.4/node_modules/engine.io/build/transports-uws/polling.js +0 -364
  102. package/web/node_modules/.bun/engine.io@6.6.4/node_modules/engine.io/build/transports-uws/websocket.js +0 -73
  103. package/web/node_modules/.bun/engine.io@6.6.4/node_modules/engine.io/build/userver.js +0 -279
  104. package/web/node_modules/.bun/engine.io@6.6.4/node_modules/engine.io/package.json +0 -70
  105. package/web/node_modules/.bun/has-flag@4.0.0/node_modules/has-flag/index.js +0 -8
  106. package/web/node_modules/.bun/has-flag@4.0.0/node_modules/has-flag/package.json +0 -46
  107. package/web/node_modules/.bun/mime-db@1.52.0/node_modules/mime-db/db.json +0 -8519
  108. package/web/node_modules/.bun/mime-db@1.52.0/node_modules/mime-db/index.js +0 -12
  109. package/web/node_modules/.bun/mime-db@1.52.0/node_modules/mime-db/package.json +0 -60
  110. package/web/node_modules/.bun/mime-types@2.1.35/node_modules/mime-types/index.js +0 -188
  111. package/web/node_modules/.bun/mime-types@2.1.35/node_modules/mime-types/package.json +0 -44
  112. package/web/node_modules/.bun/ms@2.1.3/node_modules/ms/index.js +0 -162
  113. package/web/node_modules/.bun/ms@2.1.3/node_modules/ms/package.json +0 -38
  114. package/web/node_modules/.bun/negotiator@0.6.3/node_modules/negotiator/index.js +0 -82
  115. package/web/node_modules/.bun/negotiator@0.6.3/node_modules/negotiator/lib/charset.js +0 -169
  116. package/web/node_modules/.bun/negotiator@0.6.3/node_modules/negotiator/lib/encoding.js +0 -184
  117. package/web/node_modules/.bun/negotiator@0.6.3/node_modules/negotiator/lib/language.js +0 -179
  118. package/web/node_modules/.bun/negotiator@0.6.3/node_modules/negotiator/lib/mediaType.js +0 -294
  119. package/web/node_modules/.bun/negotiator@0.6.3/node_modules/negotiator/package.json +0 -42
  120. package/web/node_modules/.bun/object-assign@4.1.1/node_modules/object-assign/index.js +0 -90
  121. package/web/node_modules/.bun/object-assign@4.1.1/node_modules/object-assign/package.json +0 -42
  122. package/web/node_modules/.bun/socket.io-adapter@2.5.5/node_modules/socket.io-adapter/dist/cluster-adapter.js +0 -674
  123. package/web/node_modules/.bun/socket.io-adapter@2.5.5/node_modules/socket.io-adapter/dist/contrib/yeast.js +0 -55
  124. package/web/node_modules/.bun/socket.io-adapter@2.5.5/node_modules/socket.io-adapter/dist/in-memory-adapter.js +0 -394
  125. package/web/node_modules/.bun/socket.io-adapter@2.5.5/node_modules/socket.io-adapter/dist/index.js +0 -10
  126. package/web/node_modules/.bun/socket.io-adapter@2.5.5/node_modules/socket.io-adapter/package.json +0 -39
  127. package/web/node_modules/.bun/socket.io-parser@4.2.4/node_modules/socket.io-parser/build/cjs/binary.js +0 -88
  128. package/web/node_modules/.bun/socket.io-parser@4.2.4/node_modules/socket.io-parser/build/cjs/index.js +0 -321
  129. package/web/node_modules/.bun/socket.io-parser@4.2.4/node_modules/socket.io-parser/build/cjs/is-binary.js +0 -55
  130. package/web/node_modules/.bun/socket.io-parser@4.2.4/node_modules/socket.io-parser/build/cjs/package.json +0 -3
  131. package/web/node_modules/.bun/socket.io-parser@4.2.4/node_modules/socket.io-parser/package.json +0 -58
  132. package/web/node_modules/.bun/socket.io@4.8.1/node_modules/socket.io/client-dist/socket.io.esm.min.js +0 -7
  133. package/web/node_modules/.bun/socket.io@4.8.1/node_modules/socket.io/client-dist/socket.io.js +0 -4908
  134. package/web/node_modules/.bun/socket.io@4.8.1/node_modules/socket.io/client-dist/socket.io.min.js +0 -7
  135. package/web/node_modules/.bun/socket.io@4.8.1/node_modules/socket.io/client-dist/socket.io.msgpack.min.js +0 -7
  136. package/web/node_modules/.bun/socket.io@4.8.1/node_modules/socket.io/dist/broadcast-operator.js +0 -436
  137. package/web/node_modules/.bun/socket.io@4.8.1/node_modules/socket.io/dist/client.js +0 -268
  138. package/web/node_modules/.bun/socket.io@4.8.1/node_modules/socket.io/dist/index.js +0 -804
  139. package/web/node_modules/.bun/socket.io@4.8.1/node_modules/socket.io/dist/namespace.js +0 -581
  140. package/web/node_modules/.bun/socket.io@4.8.1/node_modules/socket.io/dist/parent-namespace.js +0 -88
  141. package/web/node_modules/.bun/socket.io@4.8.1/node_modules/socket.io/dist/socket-types.js +0 -11
  142. package/web/node_modules/.bun/socket.io@4.8.1/node_modules/socket.io/dist/socket.js +0 -977
  143. package/web/node_modules/.bun/socket.io@4.8.1/node_modules/socket.io/dist/typed-events.js +0 -81
  144. package/web/node_modules/.bun/socket.io@4.8.1/node_modules/socket.io/dist/uws.js +0 -136
  145. package/web/node_modules/.bun/socket.io@4.8.1/node_modules/socket.io/package.json +0 -85
  146. package/web/node_modules/.bun/socket.io@4.8.1/node_modules/socket.io/wrapper.mjs +0 -3
  147. package/web/node_modules/.bun/supports-color@7.2.0/node_modules/supports-color/index.js +0 -135
  148. package/web/node_modules/.bun/supports-color@7.2.0/node_modules/supports-color/package.json +0 -53
  149. package/web/node_modules/.bun/vary@1.1.2/node_modules/vary/index.js +0 -149
  150. package/web/node_modules/.bun/vary@1.1.2/node_modules/vary/package.json +0 -43
  151. package/web/node_modules/.bun/ws@8.17.1/node_modules/ws/index.js +0 -13
  152. package/web/node_modules/.bun/ws@8.17.1/node_modules/ws/lib/buffer-util.js +0 -131
  153. package/web/node_modules/.bun/ws@8.17.1/node_modules/ws/lib/constants.js +0 -12
  154. package/web/node_modules/.bun/ws@8.17.1/node_modules/ws/lib/event-target.js +0 -292
  155. package/web/node_modules/.bun/ws@8.17.1/node_modules/ws/lib/extension.js +0 -203
  156. package/web/node_modules/.bun/ws@8.17.1/node_modules/ws/lib/limiter.js +0 -55
  157. package/web/node_modules/.bun/ws@8.17.1/node_modules/ws/lib/permessage-deflate.js +0 -514
  158. package/web/node_modules/.bun/ws@8.17.1/node_modules/ws/lib/receiver.js +0 -704
  159. package/web/node_modules/.bun/ws@8.17.1/node_modules/ws/lib/sender.js +0 -497
  160. package/web/node_modules/.bun/ws@8.17.1/node_modules/ws/lib/stream.js +0 -159
  161. package/web/node_modules/.bun/ws@8.17.1/node_modules/ws/lib/subprotocol.js +0 -62
  162. package/web/node_modules/.bun/ws@8.17.1/node_modules/ws/lib/validation.js +0 -130
  163. package/web/node_modules/.bun/ws@8.17.1/node_modules/ws/lib/websocket-server.js +0 -540
  164. package/web/node_modules/.bun/ws@8.17.1/node_modules/ws/lib/websocket.js +0 -1338
  165. package/web/node_modules/.bun/ws@8.17.1/node_modules/ws/package.json +0 -69
  166. package/web/node_modules/.bun/ws@8.18.3/node_modules/ws/lib/buffer-util.js +0 -131
  167. package/web/node_modules/.bun/ws@8.18.3/node_modules/ws/lib/constants.js +0 -18
  168. package/web/node_modules/.bun/ws@8.18.3/node_modules/ws/lib/event-target.js +0 -292
  169. package/web/node_modules/.bun/ws@8.18.3/node_modules/ws/lib/extension.js +0 -203
  170. package/web/node_modules/.bun/ws@8.18.3/node_modules/ws/lib/limiter.js +0 -55
  171. package/web/node_modules/.bun/ws@8.18.3/node_modules/ws/lib/permessage-deflate.js +0 -528
  172. package/web/node_modules/.bun/ws@8.18.3/node_modules/ws/lib/receiver.js +0 -706
  173. package/web/node_modules/.bun/ws@8.18.3/node_modules/ws/lib/sender.js +0 -602
  174. package/web/node_modules/.bun/ws@8.18.3/node_modules/ws/lib/stream.js +0 -161
  175. package/web/node_modules/.bun/ws@8.18.3/node_modules/ws/lib/subprotocol.js +0 -62
  176. package/web/node_modules/.bun/ws@8.18.3/node_modules/ws/lib/validation.js +0 -152
  177. package/web/node_modules/.bun/ws@8.18.3/node_modules/ws/lib/websocket-server.js +0 -550
  178. package/web/node_modules/.bun/ws@8.18.3/node_modules/ws/lib/websocket.js +0 -1388
  179. package/web/node_modules/.bun/ws@8.18.3/node_modules/ws/package.json +0 -69
  180. package/web/node_modules/.bun/ws@8.18.3/node_modules/ws/wrapper.mjs +0 -8
  181. /package/web/.next/static/{A7pW-dtFIbPCSkvE8uenX → Im7EdK1Q3oOmTznohTOr5}/_clientMiddlewareManifest.json +0 -0
  182. /package/web/.next/static/{A7pW-dtFIbPCSkvE8uenX → Im7EdK1Q3oOmTznohTOr5}/_ssgManifest.js +0 -0
@@ -1,55 +0,0 @@
1
- // imported from https://github.com/unshiftio/yeast
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.yeast = exports.decode = exports.encode = void 0;
5
- const alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""), length = 64, map = {};
6
- let seed = 0, i = 0, prev;
7
- /**
8
- * Return a string representing the specified number.
9
- *
10
- * @param {Number} num The number to convert.
11
- * @returns {String} The string representation of the number.
12
- * @api public
13
- */
14
- function encode(num) {
15
- let encoded = "";
16
- do {
17
- encoded = alphabet[num % length] + encoded;
18
- num = Math.floor(num / length);
19
- } while (num > 0);
20
- return encoded;
21
- }
22
- exports.encode = encode;
23
- /**
24
- * Return the integer value specified by the given string.
25
- *
26
- * @param {String} str The string to convert.
27
- * @returns {Number} The integer value represented by the string.
28
- * @api public
29
- */
30
- function decode(str) {
31
- let decoded = 0;
32
- for (i = 0; i < str.length; i++) {
33
- decoded = decoded * length + map[str.charAt(i)];
34
- }
35
- return decoded;
36
- }
37
- exports.decode = decode;
38
- /**
39
- * Yeast: A tiny growing id generator.
40
- *
41
- * @returns {String} A unique id.
42
- * @api public
43
- */
44
- function yeast() {
45
- const now = encode(+new Date());
46
- if (now !== prev)
47
- return (seed = 0), (prev = now);
48
- return now + "." + encode(seed++);
49
- }
50
- exports.yeast = yeast;
51
- //
52
- // Map each character to its index.
53
- //
54
- for (; i < length; i++)
55
- map[alphabet[i]] = i;
@@ -1,394 +0,0 @@
1
- "use strict";
2
- var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.SessionAwareAdapter = exports.Adapter = void 0;
5
- const events_1 = require("events");
6
- const yeast_1 = require("./contrib/yeast");
7
- const WebSocket = require("ws");
8
- const canPreComputeFrame = typeof ((_a = WebSocket === null || WebSocket === void 0 ? void 0 : WebSocket.Sender) === null || _a === void 0 ? void 0 : _a.frame) === "function";
9
- class Adapter extends events_1.EventEmitter {
10
- /**
11
- * In-memory adapter constructor.
12
- *
13
- * @param {Namespace} nsp
14
- */
15
- constructor(nsp) {
16
- super();
17
- this.nsp = nsp;
18
- this.rooms = new Map();
19
- this.sids = new Map();
20
- this.encoder = nsp.server.encoder;
21
- }
22
- /**
23
- * To be overridden
24
- */
25
- init() { }
26
- /**
27
- * To be overridden
28
- */
29
- close() { }
30
- /**
31
- * Returns the number of Socket.IO servers in the cluster
32
- *
33
- * @public
34
- */
35
- serverCount() {
36
- return Promise.resolve(1);
37
- }
38
- /**
39
- * Adds a socket to a list of room.
40
- *
41
- * @param {SocketId} id the socket id
42
- * @param {Set<Room>} rooms a set of rooms
43
- * @public
44
- */
45
- addAll(id, rooms) {
46
- if (!this.sids.has(id)) {
47
- this.sids.set(id, new Set());
48
- }
49
- for (const room of rooms) {
50
- this.sids.get(id).add(room);
51
- if (!this.rooms.has(room)) {
52
- this.rooms.set(room, new Set());
53
- this.emit("create-room", room);
54
- }
55
- if (!this.rooms.get(room).has(id)) {
56
- this.rooms.get(room).add(id);
57
- this.emit("join-room", room, id);
58
- }
59
- }
60
- }
61
- /**
62
- * Removes a socket from a room.
63
- *
64
- * @param {SocketId} id the socket id
65
- * @param {Room} room the room name
66
- */
67
- del(id, room) {
68
- if (this.sids.has(id)) {
69
- this.sids.get(id).delete(room);
70
- }
71
- this._del(room, id);
72
- }
73
- _del(room, id) {
74
- const _room = this.rooms.get(room);
75
- if (_room != null) {
76
- const deleted = _room.delete(id);
77
- if (deleted) {
78
- this.emit("leave-room", room, id);
79
- }
80
- if (_room.size === 0 && this.rooms.delete(room)) {
81
- this.emit("delete-room", room);
82
- }
83
- }
84
- }
85
- /**
86
- * Removes a socket from all rooms it's joined.
87
- *
88
- * @param {SocketId} id the socket id
89
- */
90
- delAll(id) {
91
- if (!this.sids.has(id)) {
92
- return;
93
- }
94
- for (const room of this.sids.get(id)) {
95
- this._del(room, id);
96
- }
97
- this.sids.delete(id);
98
- }
99
- /**
100
- * Broadcasts a packet.
101
- *
102
- * Options:
103
- * - `flags` {Object} flags for this packet
104
- * - `except` {Array} sids that should be excluded
105
- * - `rooms` {Array} list of rooms to broadcast to
106
- *
107
- * @param {Object} packet the packet object
108
- * @param {Object} opts the options
109
- * @public
110
- */
111
- broadcast(packet, opts) {
112
- const flags = opts.flags || {};
113
- const packetOpts = {
114
- preEncoded: true,
115
- volatile: flags.volatile,
116
- compress: flags.compress,
117
- };
118
- packet.nsp = this.nsp.name;
119
- const encodedPackets = this._encode(packet, packetOpts);
120
- this.apply(opts, (socket) => {
121
- if (typeof socket.notifyOutgoingListeners === "function") {
122
- socket.notifyOutgoingListeners(packet);
123
- }
124
- socket.client.writeToEngine(encodedPackets, packetOpts);
125
- });
126
- }
127
- /**
128
- * Broadcasts a packet and expects multiple acknowledgements.
129
- *
130
- * Options:
131
- * - `flags` {Object} flags for this packet
132
- * - `except` {Array} sids that should be excluded
133
- * - `rooms` {Array} list of rooms to broadcast to
134
- *
135
- * @param {Object} packet the packet object
136
- * @param {Object} opts the options
137
- * @param clientCountCallback - the number of clients that received the packet
138
- * @param ack - the callback that will be called for each client response
139
- *
140
- * @public
141
- */
142
- broadcastWithAck(packet, opts, clientCountCallback, ack) {
143
- const flags = opts.flags || {};
144
- const packetOpts = {
145
- preEncoded: true,
146
- volatile: flags.volatile,
147
- compress: flags.compress,
148
- };
149
- packet.nsp = this.nsp.name;
150
- // we can use the same id for each packet, since the _ids counter is common (no duplicate)
151
- packet.id = this.nsp._ids++;
152
- const encodedPackets = this._encode(packet, packetOpts);
153
- let clientCount = 0;
154
- this.apply(opts, (socket) => {
155
- // track the total number of acknowledgements that are expected
156
- clientCount++;
157
- // call the ack callback for each client response
158
- socket.acks.set(packet.id, ack);
159
- if (typeof socket.notifyOutgoingListeners === "function") {
160
- socket.notifyOutgoingListeners(packet);
161
- }
162
- socket.client.writeToEngine(encodedPackets, packetOpts);
163
- });
164
- clientCountCallback(clientCount);
165
- }
166
- _encode(packet, packetOpts) {
167
- const encodedPackets = this.encoder.encode(packet);
168
- if (canPreComputeFrame &&
169
- encodedPackets.length === 1 &&
170
- typeof encodedPackets[0] === "string") {
171
- // "4" being the "message" packet type in the Engine.IO protocol
172
- const data = Buffer.from("4" + encodedPackets[0]);
173
- // see https://github.com/websockets/ws/issues/617#issuecomment-283002469
174
- packetOpts.wsPreEncodedFrame = WebSocket.Sender.frame(data, {
175
- readOnly: false,
176
- mask: false,
177
- rsv1: false,
178
- opcode: 1,
179
- fin: true,
180
- });
181
- }
182
- return encodedPackets;
183
- }
184
- /**
185
- * Gets a list of sockets by sid.
186
- *
187
- * @param {Set<Room>} rooms the explicit set of rooms to check.
188
- */
189
- sockets(rooms) {
190
- const sids = new Set();
191
- this.apply({ rooms }, (socket) => {
192
- sids.add(socket.id);
193
- });
194
- return Promise.resolve(sids);
195
- }
196
- /**
197
- * Gets the list of rooms a given socket has joined.
198
- *
199
- * @param {SocketId} id the socket id
200
- */
201
- socketRooms(id) {
202
- return this.sids.get(id);
203
- }
204
- /**
205
- * Returns the matching socket instances
206
- *
207
- * @param opts - the filters to apply
208
- */
209
- fetchSockets(opts) {
210
- const sockets = [];
211
- this.apply(opts, (socket) => {
212
- sockets.push(socket);
213
- });
214
- return Promise.resolve(sockets);
215
- }
216
- /**
217
- * Makes the matching socket instances join the specified rooms
218
- *
219
- * @param opts - the filters to apply
220
- * @param rooms - the rooms to join
221
- */
222
- addSockets(opts, rooms) {
223
- this.apply(opts, (socket) => {
224
- socket.join(rooms);
225
- });
226
- }
227
- /**
228
- * Makes the matching socket instances leave the specified rooms
229
- *
230
- * @param opts - the filters to apply
231
- * @param rooms - the rooms to leave
232
- */
233
- delSockets(opts, rooms) {
234
- this.apply(opts, (socket) => {
235
- rooms.forEach((room) => socket.leave(room));
236
- });
237
- }
238
- /**
239
- * Makes the matching socket instances disconnect
240
- *
241
- * @param opts - the filters to apply
242
- * @param close - whether to close the underlying connection
243
- */
244
- disconnectSockets(opts, close) {
245
- this.apply(opts, (socket) => {
246
- socket.disconnect(close);
247
- });
248
- }
249
- apply(opts, callback) {
250
- const rooms = opts.rooms;
251
- const except = this.computeExceptSids(opts.except);
252
- if (rooms.size) {
253
- const ids = new Set();
254
- for (const room of rooms) {
255
- if (!this.rooms.has(room))
256
- continue;
257
- for (const id of this.rooms.get(room)) {
258
- if (ids.has(id) || except.has(id))
259
- continue;
260
- const socket = this.nsp.sockets.get(id);
261
- if (socket) {
262
- callback(socket);
263
- ids.add(id);
264
- }
265
- }
266
- }
267
- }
268
- else {
269
- for (const [id] of this.sids) {
270
- if (except.has(id))
271
- continue;
272
- const socket = this.nsp.sockets.get(id);
273
- if (socket)
274
- callback(socket);
275
- }
276
- }
277
- }
278
- computeExceptSids(exceptRooms) {
279
- const exceptSids = new Set();
280
- if (exceptRooms && exceptRooms.size > 0) {
281
- for (const room of exceptRooms) {
282
- if (this.rooms.has(room)) {
283
- this.rooms.get(room).forEach((sid) => exceptSids.add(sid));
284
- }
285
- }
286
- }
287
- return exceptSids;
288
- }
289
- /**
290
- * Send a packet to the other Socket.IO servers in the cluster
291
- * @param packet - an array of arguments, which may include an acknowledgement callback at the end
292
- */
293
- serverSideEmit(packet) {
294
- console.warn("this adapter does not support the serverSideEmit() functionality");
295
- }
296
- /**
297
- * Save the client session in order to restore it upon reconnection.
298
- */
299
- persistSession(session) { }
300
- /**
301
- * Restore the session and find the packets that were missed by the client.
302
- * @param pid
303
- * @param offset
304
- */
305
- restoreSession(pid, offset) {
306
- return null;
307
- }
308
- }
309
- exports.Adapter = Adapter;
310
- class SessionAwareAdapter extends Adapter {
311
- constructor(nsp) {
312
- super(nsp);
313
- this.nsp = nsp;
314
- this.sessions = new Map();
315
- this.packets = [];
316
- this.maxDisconnectionDuration =
317
- nsp.server.opts.connectionStateRecovery.maxDisconnectionDuration;
318
- const timer = setInterval(() => {
319
- const threshold = Date.now() - this.maxDisconnectionDuration;
320
- this.sessions.forEach((session, sessionId) => {
321
- const hasExpired = session.disconnectedAt < threshold;
322
- if (hasExpired) {
323
- this.sessions.delete(sessionId);
324
- }
325
- });
326
- for (let i = this.packets.length - 1; i >= 0; i--) {
327
- const hasExpired = this.packets[i].emittedAt < threshold;
328
- if (hasExpired) {
329
- this.packets.splice(0, i + 1);
330
- break;
331
- }
332
- }
333
- }, 60 * 1000);
334
- // prevents the timer from keeping the process alive
335
- timer.unref();
336
- }
337
- persistSession(session) {
338
- session.disconnectedAt = Date.now();
339
- this.sessions.set(session.pid, session);
340
- }
341
- restoreSession(pid, offset) {
342
- const session = this.sessions.get(pid);
343
- if (!session) {
344
- // the session may have expired
345
- return null;
346
- }
347
- const hasExpired = session.disconnectedAt + this.maxDisconnectionDuration < Date.now();
348
- if (hasExpired) {
349
- // the session has expired
350
- this.sessions.delete(pid);
351
- return null;
352
- }
353
- const index = this.packets.findIndex((packet) => packet.id === offset);
354
- if (index === -1) {
355
- // the offset may be too old
356
- return null;
357
- }
358
- const missedPackets = [];
359
- for (let i = index + 1; i < this.packets.length; i++) {
360
- const packet = this.packets[i];
361
- if (shouldIncludePacket(session.rooms, packet.opts)) {
362
- missedPackets.push(packet.data);
363
- }
364
- }
365
- return Promise.resolve(Object.assign(Object.assign({}, session), { missedPackets }));
366
- }
367
- broadcast(packet, opts) {
368
- var _a;
369
- const isEventPacket = packet.type === 2;
370
- // packets with acknowledgement are not stored because the acknowledgement function cannot be serialized and
371
- // restored on another server upon reconnection
372
- const withoutAcknowledgement = packet.id === undefined;
373
- const notVolatile = ((_a = opts.flags) === null || _a === void 0 ? void 0 : _a.volatile) === undefined;
374
- if (isEventPacket && withoutAcknowledgement && notVolatile) {
375
- const id = (0, yeast_1.yeast)();
376
- // the offset is stored at the end of the data array, so the client knows the ID of the last packet it has
377
- // processed (and the format is backward-compatible)
378
- packet.data.push(id);
379
- this.packets.push({
380
- id,
381
- opts,
382
- data: packet.data,
383
- emittedAt: Date.now(),
384
- });
385
- }
386
- super.broadcast(packet, opts);
387
- }
388
- }
389
- exports.SessionAwareAdapter = SessionAwareAdapter;
390
- function shouldIncludePacket(sessionRooms, opts) {
391
- const included = opts.rooms.size === 0 || sessionRooms.some((room) => opts.rooms.has(room));
392
- const notExcluded = sessionRooms.every((room) => !opts.except.has(room));
393
- return included && notExcluded;
394
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MessageType = exports.ClusterAdapterWithHeartbeat = exports.ClusterAdapter = exports.SessionAwareAdapter = exports.Adapter = void 0;
4
- var in_memory_adapter_1 = require("./in-memory-adapter");
5
- Object.defineProperty(exports, "Adapter", { enumerable: true, get: function () { return in_memory_adapter_1.Adapter; } });
6
- Object.defineProperty(exports, "SessionAwareAdapter", { enumerable: true, get: function () { return in_memory_adapter_1.SessionAwareAdapter; } });
7
- var cluster_adapter_1 = require("./cluster-adapter");
8
- Object.defineProperty(exports, "ClusterAdapter", { enumerable: true, get: function () { return cluster_adapter_1.ClusterAdapter; } });
9
- Object.defineProperty(exports, "ClusterAdapterWithHeartbeat", { enumerable: true, get: function () { return cluster_adapter_1.ClusterAdapterWithHeartbeat; } });
10
- Object.defineProperty(exports, "MessageType", { enumerable: true, get: function () { return cluster_adapter_1.MessageType; } });
@@ -1,39 +0,0 @@
1
- {
2
- "name": "socket.io-adapter",
3
- "version": "2.5.5",
4
- "license": "MIT",
5
- "repository": {
6
- "type": "git",
7
- "url": "git://github.com/socketio/socket.io-adapter.git"
8
- },
9
- "files": [
10
- "dist/"
11
- ],
12
- "main": "./dist/index.js",
13
- "types": "./dist/index.d.ts",
14
- "description": "default socket.io in-memory adapter",
15
- "dependencies": {
16
- "debug": "~4.3.4",
17
- "ws": "~8.17.1"
18
- },
19
- "devDependencies": {
20
- "@types/debug": "^4.1.12",
21
- "@types/expect.js": "^0.3.32",
22
- "@types/mocha": "^10.0.1",
23
- "@types/node": "^14.11.2",
24
- "expect.js": "^0.3.1",
25
- "mocha": "^10.2.0",
26
- "nyc": "^15.1.0",
27
- "prettier": "^2.8.1",
28
- "socket.io": "^4.7.4",
29
- "socket.io-client": "^4.7.4",
30
- "ts-node": "^10.9.1",
31
- "typescript": "^4.9.4"
32
- },
33
- "scripts": {
34
- "test": "npm run format:check && tsc && nyc mocha --require ts-node/register test/*.ts",
35
- "format:check": "prettier --parser typescript --check 'lib/**/*.ts' 'test/**/*.ts'",
36
- "format:fix": "prettier --parser typescript --write 'lib/**/*.ts' 'test/**/*.ts'",
37
- "prepack": "tsc"
38
- }
39
- }
@@ -1,88 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.reconstructPacket = exports.deconstructPacket = void 0;
4
- const is_binary_js_1 = require("./is-binary.js");
5
- /**
6
- * Replaces every Buffer | ArrayBuffer | Blob | File in packet with a numbered placeholder.
7
- *
8
- * @param {Object} packet - socket.io event packet
9
- * @return {Object} with deconstructed packet and list of buffers
10
- * @public
11
- */
12
- function deconstructPacket(packet) {
13
- const buffers = [];
14
- const packetData = packet.data;
15
- const pack = packet;
16
- pack.data = _deconstructPacket(packetData, buffers);
17
- pack.attachments = buffers.length; // number of binary 'attachments'
18
- return { packet: pack, buffers: buffers };
19
- }
20
- exports.deconstructPacket = deconstructPacket;
21
- function _deconstructPacket(data, buffers) {
22
- if (!data)
23
- return data;
24
- if ((0, is_binary_js_1.isBinary)(data)) {
25
- const placeholder = { _placeholder: true, num: buffers.length };
26
- buffers.push(data);
27
- return placeholder;
28
- }
29
- else if (Array.isArray(data)) {
30
- const newData = new Array(data.length);
31
- for (let i = 0; i < data.length; i++) {
32
- newData[i] = _deconstructPacket(data[i], buffers);
33
- }
34
- return newData;
35
- }
36
- else if (typeof data === "object" && !(data instanceof Date)) {
37
- const newData = {};
38
- for (const key in data) {
39
- if (Object.prototype.hasOwnProperty.call(data, key)) {
40
- newData[key] = _deconstructPacket(data[key], buffers);
41
- }
42
- }
43
- return newData;
44
- }
45
- return data;
46
- }
47
- /**
48
- * Reconstructs a binary packet from its placeholder packet and buffers
49
- *
50
- * @param {Object} packet - event packet with placeholders
51
- * @param {Array} buffers - binary buffers to put in placeholder positions
52
- * @return {Object} reconstructed packet
53
- * @public
54
- */
55
- function reconstructPacket(packet, buffers) {
56
- packet.data = _reconstructPacket(packet.data, buffers);
57
- delete packet.attachments; // no longer useful
58
- return packet;
59
- }
60
- exports.reconstructPacket = reconstructPacket;
61
- function _reconstructPacket(data, buffers) {
62
- if (!data)
63
- return data;
64
- if (data && data._placeholder === true) {
65
- const isIndexValid = typeof data.num === "number" &&
66
- data.num >= 0 &&
67
- data.num < buffers.length;
68
- if (isIndexValid) {
69
- return buffers[data.num]; // appropriate buffer (should be natural order anyway)
70
- }
71
- else {
72
- throw new Error("illegal attachments");
73
- }
74
- }
75
- else if (Array.isArray(data)) {
76
- for (let i = 0; i < data.length; i++) {
77
- data[i] = _reconstructPacket(data[i], buffers);
78
- }
79
- }
80
- else if (typeof data === "object") {
81
- for (const key in data) {
82
- if (Object.prototype.hasOwnProperty.call(data, key)) {
83
- data[key] = _reconstructPacket(data[key], buffers);
84
- }
85
- }
86
- }
87
- return data;
88
- }