elysia 2.0.0-beta.2 → 2.0.0-beta.21

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 (339) hide show
  1. package/dist/adapter/bun/index.d.ts +18 -2
  2. package/dist/adapter/bun/index.js +467 -110
  3. package/dist/adapter/bun/index.mjs +467 -112
  4. package/dist/adapter/types.d.ts +2 -21
  5. package/dist/adapter/utils.d.ts +14 -3
  6. package/dist/adapter/utils.js +146 -87
  7. package/dist/adapter/utils.mjs +148 -90
  8. package/dist/adapter/web-standard/handler.d.ts +1 -1
  9. package/dist/adapter/web-standard/handler.js +47 -36
  10. package/dist/adapter/web-standard/handler.mjs +48 -37
  11. package/dist/adapter/web-standard/index.js +2 -30
  12. package/dist/adapter/web-standard/index.mjs +2 -30
  13. package/dist/adapter/web-standard/utils.js +5 -18
  14. package/dist/adapter/web-standard/utils.mjs +5 -18
  15. package/dist/base.d.ts +99 -67
  16. package/dist/base.js +678 -510
  17. package/dist/base.mjs +682 -514
  18. package/dist/compile/aot-capture.d.ts +2 -13
  19. package/dist/compile/aot-capture.js +26 -69
  20. package/dist/compile/aot-capture.mjs +28 -67
  21. package/dist/compile/aot-emit.d.ts +9 -7
  22. package/dist/compile/aot-emit.js +42 -19
  23. package/dist/compile/aot-emit.mjs +42 -20
  24. package/dist/compile/aot.d.ts +17 -19
  25. package/dist/compile/aot.js +41 -51
  26. package/dist/compile/aot.mjs +39 -49
  27. package/dist/compile/handler/descriptor.d.ts +9 -12
  28. package/dist/compile/handler/descriptor.js +19 -44
  29. package/dist/compile/handler/descriptor.mjs +20 -42
  30. package/dist/compile/handler/frozen-validator.d.ts +5 -10
  31. package/dist/compile/handler/frozen-validator.js +55 -105
  32. package/dist/compile/handler/frozen-validator.mjs +53 -105
  33. package/dist/compile/handler/index.d.ts +7 -5
  34. package/dist/compile/handler/index.js +270 -111
  35. package/dist/compile/handler/index.mjs +270 -113
  36. package/dist/compile/handler/jit.d.ts +19 -17
  37. package/dist/compile/handler/jit.js +222 -149
  38. package/dist/compile/handler/jit.mjs +224 -152
  39. package/dist/compile/handler/params.d.ts +1 -4
  40. package/dist/compile/handler/params.js +10 -5
  41. package/dist/compile/handler/params.mjs +14 -8
  42. package/dist/compile/handler/reconstruct.d.ts +2 -2
  43. package/dist/compile/handler/reconstruct.js +6 -4
  44. package/dist/compile/handler/reconstruct.mjs +6 -4
  45. package/dist/compile/handler/static-clone-resolver.d.ts +6 -0
  46. package/dist/compile/handler/static-clone-resolver.js +8 -0
  47. package/dist/compile/handler/static-clone-resolver.mjs +7 -0
  48. package/dist/compile/handler/utils.d.ts +22 -11
  49. package/dist/compile/handler/utils.js +159 -253
  50. package/dist/compile/handler/utils.mjs +155 -252
  51. package/dist/compile/jit-probe.d.ts +2 -2
  52. package/dist/compile/jit-probe.js +2 -3
  53. package/dist/compile/jit-probe.mjs +2 -3
  54. package/dist/compile/lexer.d.ts +7 -4
  55. package/dist/compile/lexer.js +268 -6
  56. package/dist/compile/lexer.mjs +268 -4
  57. package/dist/compile/utils.js +7 -4
  58. package/dist/compile/utils.mjs +7 -4
  59. package/dist/compiled.d.ts +0 -1
  60. package/dist/compiled.js +0 -1
  61. package/dist/compiled.mjs +0 -1
  62. package/dist/context.d.ts +14 -4
  63. package/dist/context.js +17 -32
  64. package/dist/context.mjs +19 -34
  65. package/dist/cookie/config.d.ts +7 -2
  66. package/dist/cookie/config.js +76 -16
  67. package/dist/cookie/config.mjs +77 -18
  68. package/dist/cookie/cookie.d.ts +1 -1
  69. package/dist/cookie/cookie.js +8 -10
  70. package/dist/cookie/cookie.mjs +8 -10
  71. package/dist/cookie/crypto.d.ts +8 -7
  72. package/dist/cookie/crypto.js +51 -40
  73. package/dist/cookie/crypto.mjs +51 -41
  74. package/dist/cookie/error.d.ts +1 -2
  75. package/dist/cookie/error.js +6 -4
  76. package/dist/cookie/error.mjs +6 -4
  77. package/dist/cookie/lib.js +7 -2
  78. package/dist/cookie/lib.mjs +7 -2
  79. package/dist/cookie/serialize.js +1 -1
  80. package/dist/cookie/serialize.mjs +1 -1
  81. package/dist/cookie/types.d.ts +10 -0
  82. package/dist/cookie/utils.d.ts +4 -8
  83. package/dist/cookie/utils.js +86 -52
  84. package/dist/cookie/utils.mjs +89 -54
  85. package/dist/error.d.ts +113 -103
  86. package/dist/error.js +181 -117
  87. package/dist/error.mjs +179 -118
  88. package/dist/generation.d.ts +2 -2
  89. package/dist/handler/error.d.ts +26 -15
  90. package/dist/handler/error.js +77 -96
  91. package/dist/handler/error.mjs +74 -97
  92. package/dist/handler/fetch.js +87 -108
  93. package/dist/handler/fetch.mjs +89 -110
  94. package/dist/handler/utils.d.ts +12 -6
  95. package/dist/handler/utils.js +84 -28
  96. package/dist/handler/utils.mjs +80 -28
  97. package/dist/index.d.ts +12 -12
  98. package/dist/index.js +2 -9
  99. package/dist/index.mjs +1 -1
  100. package/dist/memory.js +1 -1
  101. package/dist/memory.mjs +1 -1
  102. package/dist/package.js +1 -1
  103. package/dist/package.mjs +1 -1
  104. package/dist/plugin/aot/bun.d.ts +8 -1
  105. package/dist/plugin/aot/bun.js +16 -9
  106. package/dist/plugin/aot/bun.mjs +17 -10
  107. package/dist/plugin/aot/core.d.ts +52 -60
  108. package/dist/plugin/aot/core.js +208 -109
  109. package/dist/plugin/aot/core.mjs +205 -111
  110. package/dist/plugin/aot/esbuild.js +8 -5
  111. package/dist/plugin/aot/esbuild.mjs +9 -6
  112. package/dist/plugin/aot/hooks.d.ts +6 -17
  113. package/dist/plugin/aot/hooks.js +36 -14
  114. package/dist/plugin/aot/hooks.mjs +37 -16
  115. package/dist/plugin/aot/rspack-loader.d.ts +1 -5
  116. package/dist/plugin/aot/rspack-loader.js +1 -10
  117. package/dist/plugin/aot/rspack-loader.mjs +1 -10
  118. package/dist/plugin/aot/rspack.js +2 -5
  119. package/dist/plugin/aot/rspack.mjs +3 -6
  120. package/dist/plugin/aot/source.d.ts +6 -42
  121. package/dist/plugin/aot/source.js +71 -71
  122. package/dist/plugin/aot/source.mjs +72 -72
  123. package/dist/plugin/aot/treeshake.js +2 -6
  124. package/dist/plugin/aot/treeshake.mjs +2 -6
  125. package/dist/plugin/aot/unplugin.d.ts +1 -4
  126. package/dist/plugin/aot/unplugin.js +4 -13
  127. package/dist/plugin/aot/unplugin.mjs +4 -13
  128. package/dist/plugin/aot/vite.d.ts +2 -6
  129. package/dist/plugin/aot/worker.js +2 -2
  130. package/dist/plugin/aot/worker.mjs +2 -2
  131. package/dist/plugin/auto-head.js +1 -10
  132. package/dist/plugin/auto-head.mjs +1 -10
  133. package/dist/plugin/trace.d.ts +2 -1
  134. package/dist/route-table.d.ts +3 -0
  135. package/dist/route-table.js +16 -11
  136. package/dist/route-table.mjs +16 -11
  137. package/dist/schema-snapshot.d.ts +0 -4
  138. package/dist/schema-snapshot.js +32 -49
  139. package/dist/schema-snapshot.mjs +32 -49
  140. package/dist/sucrose.d.ts +6 -55
  141. package/dist/sucrose.js +103 -731
  142. package/dist/sucrose.mjs +102 -724
  143. package/dist/trace.d.ts +5 -8
  144. package/dist/trace.js +23 -134
  145. package/dist/trace.mjs +24 -135
  146. package/dist/type/bridge-live.d.ts +4 -2
  147. package/dist/type/bridge-live.js +6 -3
  148. package/dist/type/bridge-live.mjs +4 -2
  149. package/dist/type/bridge.d.ts +6 -4
  150. package/dist/type/bridge.js +17 -9
  151. package/dist/type/bridge.mjs +5 -3
  152. package/dist/type/coerce-plan.d.ts +5 -5
  153. package/dist/type/coerce-plan.js +41 -39
  154. package/dist/type/coerce-plan.mjs +43 -39
  155. package/dist/type/coerce.d.ts +3 -7
  156. package/dist/type/coerce.js +18 -75
  157. package/dist/type/coerce.mjs +19 -76
  158. package/dist/type/compat.d.ts +3 -0
  159. package/dist/type/compat.js +23 -14
  160. package/dist/type/compat.mjs +20 -10
  161. package/dist/type/elysia/array-buffer.d.ts +4 -1
  162. package/dist/type/elysia/array-buffer.js +17 -17
  163. package/dist/type/elysia/array-buffer.mjs +17 -17
  164. package/dist/type/elysia/array-string.js +2 -40
  165. package/dist/type/elysia/array-string.mjs +2 -39
  166. package/dist/type/elysia/array.js +5 -9
  167. package/dist/type/elysia/array.mjs +5 -9
  168. package/dist/type/elysia/boolean-string.js +2 -3
  169. package/dist/type/elysia/boolean-string.mjs +1 -1
  170. package/dist/type/elysia/boolean.js +3 -12
  171. package/dist/type/elysia/boolean.mjs +3 -11
  172. package/dist/type/elysia/cookie.d.ts +3 -4
  173. package/dist/type/elysia/cookie.js +5 -15
  174. package/dist/type/elysia/cookie.mjs +5 -15
  175. package/dist/type/elysia/date.js +13 -20
  176. package/dist/type/elysia/date.mjs +10 -16
  177. package/dist/type/elysia/file-type.d.ts +11 -4
  178. package/dist/type/elysia/file-type.js +17 -2
  179. package/dist/type/elysia/file-type.mjs +17 -3
  180. package/dist/type/elysia/file.d.ts +1 -3
  181. package/dist/type/elysia/file.js +11 -27
  182. package/dist/type/elysia/file.mjs +11 -12
  183. package/dist/type/elysia/files.js +7 -11
  184. package/dist/type/elysia/files.mjs +7 -10
  185. package/dist/type/elysia/form.js +2 -3
  186. package/dist/type/elysia/form.mjs +3 -3
  187. package/dist/type/elysia/integer-string.d.ts +1 -1
  188. package/dist/type/elysia/integer-string.js +4 -30
  189. package/dist/type/elysia/integer-string.mjs +5 -30
  190. package/dist/type/elysia/integer.js +3 -12
  191. package/dist/type/elysia/integer.mjs +3 -11
  192. package/dist/type/elysia/intersect.js +0 -5
  193. package/dist/type/elysia/intersect.mjs +0 -5
  194. package/dist/type/elysia/json-string.d.ts +7 -0
  195. package/dist/type/elysia/json-string.js +47 -0
  196. package/dist/type/elysia/json-string.mjs +46 -0
  197. package/dist/type/elysia/keep-config.d.ts +14 -0
  198. package/dist/type/elysia/keep-config.js +62 -0
  199. package/dist/type/elysia/keep-config.mjs +53 -0
  200. package/dist/type/elysia/maybe-empty.js +3 -4
  201. package/dist/type/elysia/maybe-empty.mjs +1 -1
  202. package/dist/type/elysia/nullable.js +2 -3
  203. package/dist/type/elysia/nullable.mjs +1 -1
  204. package/dist/type/elysia/number.d.ts +2 -1
  205. package/dist/type/elysia/number.js +19 -11
  206. package/dist/type/elysia/number.mjs +18 -10
  207. package/dist/type/elysia/numeric-enum.d.ts +1 -1
  208. package/dist/type/elysia/numeric-enum.js +4 -5
  209. package/dist/type/elysia/numeric-enum.mjs +3 -3
  210. package/dist/type/elysia/numeric.d.ts +4 -2
  211. package/dist/type/elysia/numeric.js +20 -17
  212. package/dist/type/elysia/numeric.mjs +19 -16
  213. package/dist/type/elysia/object-string.js +2 -37
  214. package/dist/type/elysia/object-string.mjs +2 -36
  215. package/dist/type/elysia/object.js +5 -9
  216. package/dist/type/elysia/object.mjs +5 -9
  217. package/dist/type/elysia/optional.js +8 -8
  218. package/dist/type/elysia/optional.mjs +7 -7
  219. package/dist/type/elysia/problem.d.ts +20 -0
  220. package/dist/type/elysia/problem.js +25 -0
  221. package/dist/type/elysia/problem.mjs +24 -0
  222. package/dist/type/elysia/string.js +4 -3
  223. package/dist/type/elysia/string.mjs +4 -2
  224. package/dist/type/elysia/uint8-array.d.ts +1 -1
  225. package/dist/type/elysia/uint8-array.js +5 -20
  226. package/dist/type/elysia/uint8-array.mjs +5 -19
  227. package/dist/type/elysia/union-enum.js +7 -8
  228. package/dist/type/elysia/union-enum.mjs +6 -6
  229. package/dist/type/elysia/union.js +0 -5
  230. package/dist/type/elysia/union.mjs +0 -5
  231. package/dist/type/elysia/utils.d.ts +2 -4
  232. package/dist/type/elysia/utils.js +10 -21
  233. package/dist/type/elysia/utils.mjs +7 -15
  234. package/dist/type/exports.d.ts +4 -2
  235. package/dist/type/exports.js +23 -2
  236. package/dist/type/exports.mjs +11 -2
  237. package/dist/type/index.d.ts +10 -2
  238. package/dist/type/index.js +62 -15
  239. package/dist/type/index.mjs +65 -11
  240. package/dist/type/shared.d.ts +3 -9
  241. package/dist/type/shared.js +44 -97
  242. package/dist/type/shared.mjs +43 -97
  243. package/dist/type/sync-require.d.ts +11 -0
  244. package/dist/type/sync-require.js +14 -0
  245. package/dist/type/sync-require.mjs +12 -0
  246. package/dist/type/typebox-system-lite.d.ts +2 -0
  247. package/dist/type/typebox-system-lite.js +34 -0
  248. package/dist/type/typebox-system-lite.mjs +3 -0
  249. package/dist/type/typebox-system-require.d.ts +7 -0
  250. package/dist/type/typebox-system-require.js +24 -0
  251. package/dist/type/typebox-system-require.mjs +23 -0
  252. package/dist/type/typebox-type-live.d.ts +11 -0
  253. package/dist/type/typebox-type-live.js +45 -0
  254. package/dist/type/typebox-type-live.mjs +20 -0
  255. package/dist/type/typebox-type.d.ts +34 -0
  256. package/dist/type/typebox-type.js +199 -0
  257. package/dist/type/typebox-type.mjs +86 -0
  258. package/dist/type/typebox-value-live.d.ts +11 -0
  259. package/dist/type/typebox-value-live.js +31 -0
  260. package/dist/type/typebox-value-live.mjs +13 -0
  261. package/dist/type/typebox-value-ops.d.ts +4 -0
  262. package/dist/type/typebox-value-ops.js +90 -0
  263. package/dist/type/typebox-value-ops.mjs +5 -0
  264. package/dist/type/typebox-value-require.d.ts +8 -0
  265. package/dist/type/typebox-value-require.js +28 -0
  266. package/dist/type/typebox-value-require.mjs +25 -0
  267. package/dist/type/typebox-value.d.ts +35 -0
  268. package/dist/type/typebox-value.js +161 -0
  269. package/dist/type/typebox-value.mjs +74 -0
  270. package/dist/type/utils.js +1 -10
  271. package/dist/type/utils.mjs +1 -10
  272. package/dist/type/validator/clean-safe.d.ts +2 -4
  273. package/dist/type/validator/clean-safe.js +15 -11
  274. package/dist/type/validator/clean-safe.mjs +16 -10
  275. package/dist/type/validator/custom-error.js +12 -16
  276. package/dist/type/validator/custom-error.mjs +11 -14
  277. package/dist/type/validator/default-precompute.d.ts +9 -1
  278. package/dist/type/validator/default-precompute.js +40 -77
  279. package/dist/type/validator/default-precompute.mjs +37 -74
  280. package/dist/type/validator/exact-mirror-live.d.ts +8 -0
  281. package/dist/type/validator/exact-mirror-live.js +22 -0
  282. package/dist/type/validator/exact-mirror-live.mjs +17 -0
  283. package/dist/type/validator/exact-mirror-require.d.ts +4 -0
  284. package/dist/type/validator/exact-mirror-require.js +11 -0
  285. package/dist/type/validator/exact-mirror-require.mjs +9 -0
  286. package/dist/type/validator/exact-mirror.js +8 -8
  287. package/dist/type/validator/exact-mirror.mjs +9 -8
  288. package/dist/type/validator/frozen-check.js +5 -6
  289. package/dist/type/validator/frozen-check.mjs +6 -7
  290. package/dist/type/validator/index.d.ts +1 -0
  291. package/dist/type/validator/index.js +169 -166
  292. package/dist/type/validator/index.mjs +162 -158
  293. package/dist/type/validator/string-codec-aot.d.ts +2 -1
  294. package/dist/type/validator/string-codec-aot.js +8 -2
  295. package/dist/type/validator/string-codec-aot.mjs +7 -2
  296. package/dist/type/validator/validator-cache.d.ts +5 -4
  297. package/dist/type/validator/validator-cache.js +41 -24
  298. package/dist/type/validator/validator-cache.mjs +40 -22
  299. package/dist/types.d.ts +263 -95
  300. package/dist/universal/constants.d.ts +2 -1
  301. package/dist/universal/constants.js +3 -1
  302. package/dist/universal/constants.mjs +2 -1
  303. package/dist/universal/env.js +2 -3
  304. package/dist/universal/env.mjs +2 -3
  305. package/dist/universal/file.d.ts +6 -4
  306. package/dist/universal/file.js +11 -16
  307. package/dist/universal/file.mjs +12 -16
  308. package/dist/universal/index.d.ts +2 -2
  309. package/dist/universal/is-production.d.ts +1 -2
  310. package/dist/universal/is-production.js +1 -3
  311. package/dist/universal/is-production.mjs +2 -3
  312. package/dist/universal/server.d.ts +0 -272
  313. package/dist/utils.d.ts +43 -7
  314. package/dist/utils.js +181 -126
  315. package/dist/utils.mjs +168 -126
  316. package/dist/validator/index.d.ts +1 -1
  317. package/dist/validator/index.js +17 -30
  318. package/dist/validator/index.mjs +18 -31
  319. package/dist/validator/route.js +2 -1
  320. package/dist/validator/route.mjs +2 -1
  321. package/dist/ws/context.d.ts +8 -1
  322. package/dist/ws/context.js +68 -44
  323. package/dist/ws/context.mjs +67 -44
  324. package/dist/ws/parser.js +10 -20
  325. package/dist/ws/parser.mjs +10 -20
  326. package/dist/ws/route.d.ts +2 -2
  327. package/dist/ws/route.js +249 -141
  328. package/dist/ws/route.mjs +254 -146
  329. package/dist/ws/types.d.ts +2 -2
  330. package/package.json +23 -49
  331. package/dist/compile/analysis-cache.d.ts +0 -6
  332. package/dist/compile/analysis-cache.js +0 -12
  333. package/dist/compile/analysis-cache.mjs +0 -11
  334. package/dist/cookie/index.d.ts +0 -7
  335. package/dist/cookie/index.js +0 -13
  336. package/dist/cookie/index.mjs +0 -7
  337. package/dist/handler/index.d.ts +0 -2
  338. package/dist/handler/index.js +0 -5
  339. package/dist/handler/index.mjs +0 -3
@@ -1,9 +1,9 @@
1
- import { Clone, Compile, Default, HasCodec, Intersect, TypeBoxValidator, TypeBoxValidatorCache, applyCoercions } from "../type/bridge.mjs";
1
+ import { assignOwn } from "../utils.mjs";
2
+ import { Clone, Compile, HasCodec, Intersect, TypeBoxValidator, TypeBoxValidatorCache, applyCoercions } from "../type/bridge.mjs";
2
3
  import { ValidationError } from "../error.mjs";
3
4
  import { Capture, Compiled } from "../compile/aot.mjs";
4
5
  import { isAsyncFunction } from "../compile/utils.mjs";
5
6
  import { clearCoerceLeafCache, clearSharedReferenceCaches, nonAdditionalProperties } from "../type/shared.mjs";
6
- import { isAsyncPredicate } from "../type/elysia/file-type.mjs";
7
7
  import { hasProperty } from "../type/utils.mjs";
8
8
 
9
9
  //#region src/validator/index.ts
@@ -34,11 +34,7 @@ var Validator = class Validator {
34
34
  schemas: options.schemas.map((v) => Validator.reference(v, models))
35
35
  };
36
36
  }
37
- if (isCompiledSchema(schema)) {
38
- const message = "[Elysia] Compiled schema detected. Please pass t.Schema instead.";
39
- if (Capture.isCapturing()) throw new Error(`${message} build plugin cannot serialize a pre-compiled schema.`);
40
- console.warn(message);
41
- }
37
+ if (schema != null && typeof schema.Check === "function" && "evaluateResult" in schema && !("~standard" in schema)) throw new Error("[Elysia] Compiled schema detected. Please pass t.Schema instead.");
42
38
  let isIntersectable = false;
43
39
  if (options?.schemas?.length) if ("~kind" in schema && options.schemas.every((v) => "~kind" in v || "~elyAcl" in v)) isIntersectable = true;
44
40
  else return new MultiValidator(schema, options);
@@ -98,7 +94,6 @@ var Validator = class Validator {
98
94
  clearSharedReferenceCaches();
99
95
  }
100
96
  };
101
- const isCompiledSchema = (schema) => schema != null && typeof schema.Check === "function" && "buildResult" in schema;
102
97
  const isSingleSchema = (schema) => "~kind" in schema || "~elyAcl" in schema || "~standard" in schema;
103
98
  const toStatusBased = (schema) => isSingleSchema(schema) ? { 200: schema } : schema;
104
99
  const isAsyncStandardSchema = (schema) => isAsyncFunction(schema["~standard"].validate);
@@ -142,7 +137,6 @@ var MultiValidator = class MultiValidator extends Validator {
142
137
  #schemas;
143
138
  #codecs;
144
139
  #hasDefaults;
145
- #tbSchemas;
146
140
  #asyncMembers;
147
141
  constructor(schema, options) {
148
142
  super();
@@ -151,7 +145,6 @@ var MultiValidator = class MultiValidator extends Validator {
151
145
  const schemas = [schema].concat(options.schemas);
152
146
  const codecs = [];
153
147
  const hasDefaults = [];
154
- const tbSchemas = [];
155
148
  const asyncMembers = [];
156
149
  const shouldClose = options?.normalize === false;
157
150
  const compileMember = (rawSchema, hd) => {
@@ -160,8 +153,7 @@ var MultiValidator = class MultiValidator extends Validator {
160
153
  const compiled = Compile(coercedSchema);
161
154
  codecs.push(HasCodec(coercedSchema));
162
155
  hasDefaults.push(hd);
163
- tbSchemas.push(hd ? coercedSchema : null);
164
- if (compiled.buildResult?.external?.variables?.some(isAsyncPredicate) ?? false) {
156
+ if (TypeBoxValidator.member(coercedSchema, compiled)) {
165
157
  this.isAsync = true;
166
158
  asyncMembers.push(Validator.create(rawSchema, {
167
159
  coerces: options?.coerces,
@@ -187,7 +179,6 @@ var MultiValidator = class MultiValidator extends Validator {
187
179
  if (isAsyncStandardSchema(schema)) this.isAsync = true;
188
180
  codecs.push(false);
189
181
  hasDefaults.push(false);
190
- tbSchemas.push(null);
191
182
  asyncMembers.push(null);
192
183
  }
193
184
  }
@@ -195,7 +186,6 @@ var MultiValidator = class MultiValidator extends Validator {
195
186
  this.#schemas = schemas;
196
187
  this.#codecs = codecs;
197
188
  this.#hasDefaults = hasDefaults;
198
- this.#tbSchemas = tbSchemas;
199
189
  this.#asyncMembers = asyncMembers;
200
190
  }
201
191
  static #merge(snapshot, result) {
@@ -204,7 +194,7 @@ var MultiValidator = class MultiValidator extends Validator {
204
194
  snapshot.push(...result);
205
195
  return snapshot;
206
196
  }
207
- if (typeof snapshot === "object" && typeof result === "object") return Object.assign(snapshot, result);
197
+ if (typeof snapshot === "object" && typeof result === "object") return assignOwn(snapshot, result);
208
198
  throw new Error("Unable to merged value with different type");
209
199
  }
210
200
  static #syncStandard(schema, value) {
@@ -246,20 +236,6 @@ var MultiValidator = class MultiValidator extends Validator {
246
236
  EncodeFrom(value) {
247
237
  return this.From(value);
248
238
  }
249
- #fromTypeBox(compiled, index, value, type) {
250
- let v = this.#cloneForMember(value);
251
- if (this.#hasDefaults[index]) v = compiled.Default ? compiled.Default(v) : Default(this.#tbSchemas[index], v);
252
- if (this.#codecs[index]) try {
253
- return compiled.Clean(compiled.Decode(v));
254
- } catch {
255
- throw new ValidationError(type, value, () => compiled.Errors(value));
256
- }
257
- if (!compiled.Check(v)) throw new ValidationError(type, value, () => compiled.Errors(v));
258
- return compiled.Clean(v);
259
- }
260
- #fromTypeBoxAsync(tbv, value, type) {
261
- return tbv.FromAsync(this.#cloneForMember(value), type);
262
- }
263
239
  From(value, type, allowAsync = this.isAsync) {
264
240
  return this.#fromLoop(value, 0, void 0, type, allowAsync);
265
241
  }
@@ -282,9 +258,20 @@ var MultiValidator = class MultiValidator extends Validator {
282
258
  const asyncTbv = this.#asyncMembers[i];
283
259
  if (asyncTbv) {
284
260
  if (!allowAsync) throw asyncStandardSchemaError();
285
- return this.#fromTypeBoxAsync(asyncTbv, value, type).then((result) => this.#fromLoop(value, i + 1, MultiValidator.#merge(snapshot, result), type, allowAsync));
261
+ return asyncTbv.FromAsync(this.#cloneForMember(value), type).then((result) => this.#fromLoop(value, i + 1, MultiValidator.#merge(snapshot, result), type, allowAsync));
262
+ }
263
+ const compiled = validator;
264
+ let v = this.#cloneForMember(value);
265
+ if (this.#hasDefaults[i]) v = compiled.Default(v);
266
+ let memberValue;
267
+ if (this.#codecs[i]) try {
268
+ memberValue = compiled.Clean(compiled.Decode(v));
269
+ } catch {
270
+ throw new ValidationError(type, value, () => compiled.Errors(value));
286
271
  }
287
- snapshot = MultiValidator.#merge(snapshot, this.#fromTypeBox(validator, i, value, type));
272
+ else if (!compiled.Check(v)) throw new ValidationError(type, value, () => compiled.Errors(v));
273
+ else memberValue = compiled.Clean(v);
274
+ snapshot = MultiValidator.#merge(snapshot, memberValue);
288
275
  }
289
276
  return snapshot;
290
277
  }
@@ -31,7 +31,8 @@ var RouteValidator = class {
31
31
  const merge = pickMerge(mergeSchemas, slot);
32
32
  if (!route[slot] && !merge?.length) continue;
33
33
  const reference = require_validator_index.Validator.reference(route[slot] ?? merge[0], options?.models);
34
- const coerces = isTb(reference) ? coerce(reference) : merge?.find(isTb) ? coerce(merge.find(isTb)) : void 0;
34
+ const tb = isTb(reference) ? reference : merge?.find(isTb);
35
+ const coerces = tb ? coerce(tb) : void 0;
35
36
  this[slot] = require_validator_index.Validator.create(route[slot], {
36
37
  ...options,
37
38
  slot,
@@ -30,7 +30,8 @@ var RouteValidator = class {
30
30
  const merge = pickMerge(mergeSchemas, slot);
31
31
  if (!route[slot] && !merge?.length) continue;
32
32
  const reference = Validator.reference(route[slot] ?? merge[0], options?.models);
33
- const coerces = isTb(reference) ? coerce(reference) : merge?.find(isTb) ? coerce(merge.find(isTb)) : void 0;
33
+ const tb = isTb(reference) ? reference : merge?.find(isTb);
34
+ const coerces = tb ? coerce(tb) : void 0;
34
35
  this[slot] = Validator.create(route[slot], {
35
36
  ...options,
36
37
  slot,
@@ -11,12 +11,19 @@ interface WSConnectionData {
11
11
  ping?: (elysia: ElysiaWS<any>, data: Buffer) => void | Promise<void>;
12
12
  pong?: (elysia: ElysiaWS<any>, data: Buffer) => void | Promise<void>;
13
13
  closeHandlerInvoked?: boolean;
14
+ /** in-flight `message` handlers, bounded by `MAX_INFLIGHT_MESSAGES` */
15
+ inflight?: number;
16
+ /** settles when an async `open` hook finished; dispatch chains onto it */
17
+ opening?: Promise<void>;
18
+ /** async socket lifecycle callbacks other than message/open */
19
+ settling?: number;
14
20
  elysia?: ElysiaWS<any>;
15
21
  context?: Record<string, unknown>;
16
22
  resumeWaiters?: Set<() => void>;
17
23
  validator?: WSResponseValidator;
18
24
  defaultValidator?: WSValidatorLike;
19
25
  }
26
+ declare function trackWSSettling(data: WSConnectionData, result: void | Promise<void>, onSettled?: () => void): void;
20
27
  declare class ElysiaWS<Route extends RouteSchema = {}> {
21
28
  #private;
22
29
  raw: ServerWebSocket<WSConnectionData>;
@@ -46,4 +53,4 @@ declare class ElysiaWS<Route extends RouteSchema = {}> {
46
53
  }
47
54
  declare function isGeneratorObject(value: unknown): boolean;
48
55
  //#endregion
49
- export { ElysiaWS, WSConnectionData, isGeneratorObject };
56
+ export { ElysiaWS, WSConnectionData, isGeneratorObject, trackWSSettling };
@@ -3,10 +3,14 @@ const require_utils = require('../utils.js');
3
3
  const require_error = require('../error.js');
4
4
 
5
5
  //#region src/ws/context.ts
6
- function pickValidator(validators, defaultValidator, data) {
7
- if (!validators) return;
8
- if (data instanceof require_error.ElysiaStatus) return validators[data.status];
9
- return defaultValidator;
6
+ function trackWSSettling(data, result, onSettled) {
7
+ if (!(result instanceof Promise)) return;
8
+ data.settling = (data.settling ?? 0) + 1;
9
+ const release = () => {
10
+ data.settling--;
11
+ onSettled?.();
12
+ };
13
+ result.then(release, release);
10
14
  }
11
15
  function memoize(view, key, value) {
12
16
  const self = view.raw.data.elysia ?? view;
@@ -24,6 +28,15 @@ var ElysiaWS = class {
24
28
  this.raw = raw;
25
29
  if (context) for (const key in context) {
26
30
  if (key === "ws" || key === "body") continue;
31
+ if (key === "__proto__") {
32
+ Object.defineProperty(this, key, {
33
+ value: context[key],
34
+ writable: true,
35
+ enumerable: true,
36
+ configurable: true
37
+ });
38
+ continue;
39
+ }
27
40
  this[key] = context[key];
28
41
  }
29
42
  }
@@ -36,11 +49,11 @@ var ElysiaWS = class {
36
49
  }
37
50
  get ping() {
38
51
  const self = this.raw.data.elysia ?? this;
39
- return memoize(this, "ping", self.#ping.bind(self));
52
+ return memoize(this, "ping", self.#control.bind(self, "ping"));
40
53
  }
41
54
  get pong() {
42
55
  const self = this.raw.data.elysia ?? this;
43
- return memoize(this, "pong", self.#pong.bind(self));
56
+ return memoize(this, "pong", self.#control.bind(self, "pong"));
44
57
  }
45
58
  get publish() {
46
59
  const self = this.raw.data.elysia ?? this;
@@ -62,58 +75,68 @@ var ElysiaWS = class {
62
75
  get data() {
63
76
  return this.raw.data;
64
77
  }
65
- #prepare(data) {
66
- if (data === void 0) return null;
67
- if (data instanceof require_error.ElysiaStatus) return JSON.stringify({
68
- status: data.status,
69
- error: data.response
70
- });
71
- if (typeof data === "object") return JSON.stringify(data);
72
- return data;
73
- }
74
- #validatedOrError(data) {
78
+ /**
79
+ * Validate, redact and serialize an outbound value, or return the
80
+ * `ValidationError` the payload was refused with.
81
+ */
82
+ #frame(data) {
75
83
  const connectionData = this.raw.data;
76
- const v = pickValidator(connectionData?.validator, connectionData?.defaultValidator, data);
77
- if (!v) return;
78
- const value = data instanceof require_error.ElysiaStatus ? data.response : data;
79
- if (v.Check(value)) return;
80
- return new require_error.ValidationError("message", value, v.Errors(value)).message;
84
+ const validators = connectionData?.validator;
85
+ const defaultValidator = connectionData?.defaultValidator;
86
+ const status = data instanceof require_error.ElysiaStatus ? data : void 0;
87
+ const v = validators && (status ? validators[status.status] : defaultValidator);
88
+ let value = status ? status.response : data;
89
+ if (v) {
90
+ const encode = v.EncodeFrom;
91
+ let redacted;
92
+ if (typeof encode === "function" && !v.hasCodec && !v.mayReturnPromise) try {
93
+ redacted = encode.call(v, value, "message");
94
+ } catch {}
95
+ if (redacted !== void 0) value = redacted;
96
+ else if (!v.Check(value)) return new require_error.ValidationError("message", value, v.Errors(value));
97
+ }
98
+ if (status) return JSON.stringify({
99
+ status: status.status,
100
+ error: value
101
+ });
102
+ if (value === void 0) return null;
103
+ if (typeof value === "object") return JSON.stringify(value);
104
+ return value;
81
105
  }
82
106
  #send(data, compress) {
83
107
  if (data === void 0) return 0;
84
108
  if (data instanceof ArrayBuffer || ArrayBuffer.isView(data)) return this.raw.send(data, compress);
85
- const err = this.#validatedOrError(data);
86
- if (err !== void 0) return this.raw.send(err);
87
- return this.raw.send(this.#prepare(data), compress);
88
- }
89
- #ping(data) {
90
- if (data === void 0) return this.raw.ping();
91
- if (data instanceof ArrayBuffer || ArrayBuffer.isView(data)) return this.raw.ping(data);
92
- const err = this.#validatedOrError(data);
93
- if (err !== void 0) return this.raw.send(err);
94
- return this.raw.ping(this.#prepare(data));
95
- }
96
- #pong(data) {
97
- if (data === void 0) return this.raw.pong();
98
- if (data instanceof ArrayBuffer || ArrayBuffer.isView(data)) return this.raw.pong(data);
99
- const err = this.#validatedOrError(data);
100
- if (err !== void 0) return this.raw.send(err);
101
- return this.raw.pong(this.#prepare(data));
109
+ const frame = this.#frame(data);
110
+ if (frame instanceof require_error.ValidationError) return this.raw.send(frame.message);
111
+ return this.raw.send(frame, compress);
112
+ }
113
+ #control(kind, data) {
114
+ if (data === void 0) return this.raw[kind]();
115
+ if (data instanceof ArrayBuffer || ArrayBuffer.isView(data)) return this.raw[kind](data);
116
+ const frame = this.#frame(data);
117
+ if (frame instanceof require_error.ValidationError) return this.raw.send(frame.message);
118
+ return this.raw[kind](frame);
102
119
  }
103
120
  #publish(topic, data, compress) {
104
121
  if (data === void 0) return 0;
105
122
  if (data instanceof ArrayBuffer || ArrayBuffer.isView(data)) return this.raw.publish(topic, data, compress);
106
- const err = this.#validatedOrError(data);
107
- if (err !== void 0) return this.raw.send(err);
108
- return this.raw.publish(topic, this.#prepare(data), compress);
123
+ const frame = this.#frame(data);
124
+ if (frame instanceof require_error.ValidationError) return this.raw.send(frame.message);
125
+ return this.raw.publish(topic, frame, compress);
109
126
  }
110
127
  #close(code, reason) {
111
128
  const data = this.raw.data;
112
129
  if (!data.closeHandlerInvoked && data.close) {
113
130
  data.closeHandlerInvoked = true;
114
131
  try {
115
- const result = data.close(this, code ?? 1e3, reason ?? "");
116
- if (result instanceof Promise) result.then(() => this.raw.close(code, reason)).catch(() => this.raw.close(code, reason));
132
+ const close = data.close;
133
+ const lifecycle = data["~lifecycleRun"];
134
+ const result = lifecycle ? lifecycle(close, this, code ?? 1e3, reason ?? "") : close(this, code ?? 1e3, reason ?? "");
135
+ if (result instanceof Promise) {
136
+ const closing = result.catch(() => {});
137
+ trackWSSettling(data, closing);
138
+ closing.then(() => this.raw.close(code, reason)).catch(() => this.raw.close(code, reason));
139
+ }
117
140
  return;
118
141
  } catch {}
119
142
  }
@@ -149,4 +172,5 @@ function isGeneratorObject(value) {
149
172
 
150
173
  //#endregion
151
174
  exports.ElysiaWS = ElysiaWS;
152
- exports.isGeneratorObject = isGeneratorObject;
175
+ exports.isGeneratorObject = isGeneratorObject;
176
+ exports.trackWSSettling = trackWSSettling;
@@ -2,10 +2,14 @@ import { requestId } from "../utils.mjs";
2
2
  import { ElysiaStatus, ValidationError } from "../error.mjs";
3
3
 
4
4
  //#region src/ws/context.ts
5
- function pickValidator(validators, defaultValidator, data) {
6
- if (!validators) return;
7
- if (data instanceof ElysiaStatus) return validators[data.status];
8
- return defaultValidator;
5
+ function trackWSSettling(data, result, onSettled) {
6
+ if (!(result instanceof Promise)) return;
7
+ data.settling = (data.settling ?? 0) + 1;
8
+ const release = () => {
9
+ data.settling--;
10
+ onSettled?.();
11
+ };
12
+ result.then(release, release);
9
13
  }
10
14
  function memoize(view, key, value) {
11
15
  const self = view.raw.data.elysia ?? view;
@@ -23,6 +27,15 @@ var ElysiaWS = class {
23
27
  this.raw = raw;
24
28
  if (context) for (const key in context) {
25
29
  if (key === "ws" || key === "body") continue;
30
+ if (key === "__proto__") {
31
+ Object.defineProperty(this, key, {
32
+ value: context[key],
33
+ writable: true,
34
+ enumerable: true,
35
+ configurable: true
36
+ });
37
+ continue;
38
+ }
26
39
  this[key] = context[key];
27
40
  }
28
41
  }
@@ -35,11 +48,11 @@ var ElysiaWS = class {
35
48
  }
36
49
  get ping() {
37
50
  const self = this.raw.data.elysia ?? this;
38
- return memoize(this, "ping", self.#ping.bind(self));
51
+ return memoize(this, "ping", self.#control.bind(self, "ping"));
39
52
  }
40
53
  get pong() {
41
54
  const self = this.raw.data.elysia ?? this;
42
- return memoize(this, "pong", self.#pong.bind(self));
55
+ return memoize(this, "pong", self.#control.bind(self, "pong"));
43
56
  }
44
57
  get publish() {
45
58
  const self = this.raw.data.elysia ?? this;
@@ -61,58 +74,68 @@ var ElysiaWS = class {
61
74
  get data() {
62
75
  return this.raw.data;
63
76
  }
64
- #prepare(data) {
65
- if (data === void 0) return null;
66
- if (data instanceof ElysiaStatus) return JSON.stringify({
67
- status: data.status,
68
- error: data.response
69
- });
70
- if (typeof data === "object") return JSON.stringify(data);
71
- return data;
72
- }
73
- #validatedOrError(data) {
77
+ /**
78
+ * Validate, redact and serialize an outbound value, or return the
79
+ * `ValidationError` the payload was refused with.
80
+ */
81
+ #frame(data) {
74
82
  const connectionData = this.raw.data;
75
- const v = pickValidator(connectionData?.validator, connectionData?.defaultValidator, data);
76
- if (!v) return;
77
- const value = data instanceof ElysiaStatus ? data.response : data;
78
- if (v.Check(value)) return;
79
- return new ValidationError("message", value, v.Errors(value)).message;
83
+ const validators = connectionData?.validator;
84
+ const defaultValidator = connectionData?.defaultValidator;
85
+ const status = data instanceof ElysiaStatus ? data : void 0;
86
+ const v = validators && (status ? validators[status.status] : defaultValidator);
87
+ let value = status ? status.response : data;
88
+ if (v) {
89
+ const encode = v.EncodeFrom;
90
+ let redacted;
91
+ if (typeof encode === "function" && !v.hasCodec && !v.mayReturnPromise) try {
92
+ redacted = encode.call(v, value, "message");
93
+ } catch {}
94
+ if (redacted !== void 0) value = redacted;
95
+ else if (!v.Check(value)) return new ValidationError("message", value, v.Errors(value));
96
+ }
97
+ if (status) return JSON.stringify({
98
+ status: status.status,
99
+ error: value
100
+ });
101
+ if (value === void 0) return null;
102
+ if (typeof value === "object") return JSON.stringify(value);
103
+ return value;
80
104
  }
81
105
  #send(data, compress) {
82
106
  if (data === void 0) return 0;
83
107
  if (data instanceof ArrayBuffer || ArrayBuffer.isView(data)) return this.raw.send(data, compress);
84
- const err = this.#validatedOrError(data);
85
- if (err !== void 0) return this.raw.send(err);
86
- return this.raw.send(this.#prepare(data), compress);
87
- }
88
- #ping(data) {
89
- if (data === void 0) return this.raw.ping();
90
- if (data instanceof ArrayBuffer || ArrayBuffer.isView(data)) return this.raw.ping(data);
91
- const err = this.#validatedOrError(data);
92
- if (err !== void 0) return this.raw.send(err);
93
- return this.raw.ping(this.#prepare(data));
94
- }
95
- #pong(data) {
96
- if (data === void 0) return this.raw.pong();
97
- if (data instanceof ArrayBuffer || ArrayBuffer.isView(data)) return this.raw.pong(data);
98
- const err = this.#validatedOrError(data);
99
- if (err !== void 0) return this.raw.send(err);
100
- return this.raw.pong(this.#prepare(data));
108
+ const frame = this.#frame(data);
109
+ if (frame instanceof ValidationError) return this.raw.send(frame.message);
110
+ return this.raw.send(frame, compress);
111
+ }
112
+ #control(kind, data) {
113
+ if (data === void 0) return this.raw[kind]();
114
+ if (data instanceof ArrayBuffer || ArrayBuffer.isView(data)) return this.raw[kind](data);
115
+ const frame = this.#frame(data);
116
+ if (frame instanceof ValidationError) return this.raw.send(frame.message);
117
+ return this.raw[kind](frame);
101
118
  }
102
119
  #publish(topic, data, compress) {
103
120
  if (data === void 0) return 0;
104
121
  if (data instanceof ArrayBuffer || ArrayBuffer.isView(data)) return this.raw.publish(topic, data, compress);
105
- const err = this.#validatedOrError(data);
106
- if (err !== void 0) return this.raw.send(err);
107
- return this.raw.publish(topic, this.#prepare(data), compress);
122
+ const frame = this.#frame(data);
123
+ if (frame instanceof ValidationError) return this.raw.send(frame.message);
124
+ return this.raw.publish(topic, frame, compress);
108
125
  }
109
126
  #close(code, reason) {
110
127
  const data = this.raw.data;
111
128
  if (!data.closeHandlerInvoked && data.close) {
112
129
  data.closeHandlerInvoked = true;
113
130
  try {
114
- const result = data.close(this, code ?? 1e3, reason ?? "");
115
- if (result instanceof Promise) result.then(() => this.raw.close(code, reason)).catch(() => this.raw.close(code, reason));
131
+ const close = data.close;
132
+ const lifecycle = data["~lifecycleRun"];
133
+ const result = lifecycle ? lifecycle(close, this, code ?? 1e3, reason ?? "") : close(this, code ?? 1e3, reason ?? "");
134
+ if (result instanceof Promise) {
135
+ const closing = result.catch(() => {});
136
+ trackWSSettling(data, closing);
137
+ closing.then(() => this.raw.close(code, reason)).catch(() => this.raw.close(code, reason));
138
+ }
116
139
  return;
117
140
  } catch {}
118
141
  }
@@ -147,4 +170,4 @@ function isGeneratorObject(value) {
147
170
  }
148
171
 
149
172
  //#endregion
150
- export { ElysiaWS, isGeneratorObject };
173
+ export { ElysiaWS, isGeneratorObject, trackWSSettling };
package/dist/ws/parser.js CHANGED
@@ -1,25 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  //#region src/ws/parser.ts
4
- function isNumericString(s) {
5
- if (s.length === 0) return false;
6
- let sawDigit = false;
7
- let sawDot = false;
8
- for (let i = 0; i < s.length; i++) {
9
- const c = s.charCodeAt(i);
10
- if (i === 0 && (c === 43 || c === 45)) continue;
11
- if (c >= 48 && c <= 57) {
12
- sawDigit = true;
13
- continue;
14
- }
15
- if (c === 46 && !sawDot) {
16
- sawDot = true;
17
- continue;
18
- }
19
- return false;
20
- }
21
- return sawDigit;
22
- }
23
4
  function defaultWSParse(message) {
24
5
  if (typeof message !== "string") return message;
25
6
  const start = message.charCodeAt(0);
@@ -28,7 +9,16 @@ function defaultWSParse(message) {
28
9
  } catch {
29
10
  return message;
30
11
  }
31
- if (isNumericString(message)) {
12
+ let i = start === 43 || start === 45 ? 1 : 0;
13
+ let sawDigit = false;
14
+ let sawDot = false;
15
+ for (; i < message.length; i++) {
16
+ const c = message.charCodeAt(i);
17
+ if (c >= 48 && c <= 57) sawDigit = true;
18
+ else if (c === 46 && !sawDot) sawDot = true;
19
+ else break;
20
+ }
21
+ if (sawDigit && i === message.length) {
32
22
  if (message.length < 16) return +message;
33
23
  const n = +message;
34
24
  if (message.length === 16 && String(n) === message) return n;
@@ -1,23 +1,4 @@
1
1
  //#region src/ws/parser.ts
2
- function isNumericString(s) {
3
- if (s.length === 0) return false;
4
- let sawDigit = false;
5
- let sawDot = false;
6
- for (let i = 0; i < s.length; i++) {
7
- const c = s.charCodeAt(i);
8
- if (i === 0 && (c === 43 || c === 45)) continue;
9
- if (c >= 48 && c <= 57) {
10
- sawDigit = true;
11
- continue;
12
- }
13
- if (c === 46 && !sawDot) {
14
- sawDot = true;
15
- continue;
16
- }
17
- return false;
18
- }
19
- return sawDigit;
20
- }
21
2
  function defaultWSParse(message) {
22
3
  if (typeof message !== "string") return message;
23
4
  const start = message.charCodeAt(0);
@@ -26,7 +7,16 @@ function defaultWSParse(message) {
26
7
  } catch {
27
8
  return message;
28
9
  }
29
- if (isNumericString(message)) {
10
+ let i = start === 43 || start === 45 ? 1 : 0;
11
+ let sawDigit = false;
12
+ let sawDot = false;
13
+ for (; i < message.length; i++) {
14
+ const c = message.charCodeAt(i);
15
+ if (c >= 48 && c <= 57) sawDigit = true;
16
+ else if (c === 46 && !sawDot) sawDot = true;
17
+ else break;
18
+ }
19
+ if (sawDigit && i === message.length) {
30
20
  if (message.length < 16) return +message;
31
21
  const n = +message;
32
22
  if (message.length === 16 && String(n) === message) return n;
@@ -1,5 +1,5 @@
1
- import { InternalRoute } from "../types.js";
2
1
  import { Context } from "../context.js";
2
+ import { InternalRoute } from "../types.js";
3
3
  import { WSOptions, WSOptionsEntry, WebSocketHandler } from "./types.js";
4
4
  import { AnyElysia } from "../base.js";
5
5
  import { ElysiaWS, WSConnectionData } from "./context.js";
@@ -10,7 +10,7 @@ declare function drainWaiters(ws: ElysiaWS<any>): void;
10
10
  declare function handleWSResponse(ws: ElysiaWS<any>, value: unknown, mapResponses: readonly AnyFn[]): Promise<void>;
11
11
  declare function buildWSRoute(route: InternalRoute, app: AnyElysia): [fetch: (context: Context) => Promise<Response | undefined> | Response | undefined, options: Partial<WebSocketHandler<any>>];
12
12
  declare function resolveWSOptions(entries: WSOptionsEntry[]): WSOptions | undefined;
13
- declare function accumulateWSOptions(target: WSOptions, routeOptions: WSOptions, _path: string): void;
13
+ declare function accumulateWSOptions(target: WSOptions, routeOptions: WSOptions): void;
14
14
  declare function buildGlobalWSHandler(): WebSocketHandler<WSConnectionData>;
15
15
  //#endregion
16
16
  export { accumulateWSOptions, buildGlobalWSHandler, buildWSRoute, drainWaiters, handleWSResponse, resolveWSOptions };