elysia 2.0.0-beta.2 → 2.0.0-beta.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 (145) hide show
  1. package/dist/adapter/utils.js +3 -3
  2. package/dist/adapter/utils.mjs +4 -4
  3. package/dist/adapter/web-standard/handler.js +5 -2
  4. package/dist/adapter/web-standard/handler.mjs +5 -2
  5. package/dist/base.d.ts +2 -2
  6. package/dist/base.js +42 -27
  7. package/dist/base.mjs +43 -28
  8. package/dist/compile/aot.d.ts +4 -4
  9. package/dist/compile/aot.js +14 -9
  10. package/dist/compile/aot.mjs +15 -9
  11. package/dist/compile/handler/descriptor.js +1 -1
  12. package/dist/compile/handler/descriptor.mjs +1 -1
  13. package/dist/compile/handler/index.d.ts +2 -2
  14. package/dist/compile/handler/index.js +6 -4
  15. package/dist/compile/handler/index.mjs +6 -4
  16. package/dist/compile/handler/utils.js +2 -2
  17. package/dist/compile/handler/utils.mjs +3 -3
  18. package/dist/context.js +3 -4
  19. package/dist/context.mjs +3 -4
  20. package/dist/cookie/config.d.ts +1 -0
  21. package/dist/cookie/config.js +3 -2
  22. package/dist/cookie/config.mjs +3 -2
  23. package/dist/cookie/cookie.d.ts +1 -0
  24. package/dist/cookie/cookie.js +6 -5
  25. package/dist/cookie/cookie.mjs +6 -5
  26. package/dist/cookie/crypto.d.ts +8 -7
  27. package/dist/cookie/crypto.js +38 -31
  28. package/dist/cookie/crypto.mjs +38 -32
  29. package/dist/cookie/error.js +1 -2
  30. package/dist/cookie/error.mjs +1 -2
  31. package/dist/cookie/lib.js +5 -1
  32. package/dist/cookie/lib.mjs +5 -1
  33. package/dist/cookie/serialize.js +1 -1
  34. package/dist/cookie/serialize.mjs +1 -1
  35. package/dist/cookie/types.d.ts +10 -0
  36. package/dist/cookie/utils.js +28 -14
  37. package/dist/cookie/utils.mjs +29 -15
  38. package/dist/handler/error.d.ts +23 -12
  39. package/dist/handler/error.js +24 -21
  40. package/dist/handler/error.mjs +20 -21
  41. package/dist/handler/fetch.js +6 -7
  42. package/dist/handler/fetch.mjs +7 -8
  43. package/dist/handler/utils.js +4 -2
  44. package/dist/handler/utils.mjs +5 -3
  45. package/dist/index.js +1 -8
  46. package/dist/package.js +1 -1
  47. package/dist/package.mjs +1 -1
  48. package/dist/plugin/aot/core.d.ts +22 -1
  49. package/dist/plugin/aot/core.js +35 -3
  50. package/dist/plugin/aot/core.mjs +35 -3
  51. package/dist/route-table.js +12 -10
  52. package/dist/route-table.mjs +12 -10
  53. package/dist/type/bridge-live.d.ts +1 -1
  54. package/dist/type/bridge-live.js +1 -1
  55. package/dist/type/bridge-live.mjs +1 -1
  56. package/dist/type/bridge.d.ts +1 -1
  57. package/dist/type/coerce-plan.js +3 -4
  58. package/dist/type/coerce-plan.mjs +1 -1
  59. package/dist/type/compat.d.ts +3 -0
  60. package/dist/type/compat.js +32 -14
  61. package/dist/type/compat.mjs +27 -8
  62. package/dist/type/elysia/array-buffer.js +2 -3
  63. package/dist/type/elysia/array-buffer.mjs +1 -1
  64. package/dist/type/elysia/array-string.js +7 -4
  65. package/dist/type/elysia/array-string.mjs +9 -5
  66. package/dist/type/elysia/boolean-string.js +2 -3
  67. package/dist/type/elysia/boolean-string.mjs +1 -1
  68. package/dist/type/elysia/boolean.js +4 -3
  69. package/dist/type/elysia/boolean.mjs +4 -2
  70. package/dist/type/elysia/cookie.js +2 -1
  71. package/dist/type/elysia/cookie.mjs +2 -1
  72. package/dist/type/elysia/date.js +7 -7
  73. package/dist/type/elysia/date.mjs +3 -2
  74. package/dist/type/elysia/file-type.d.ts +9 -2
  75. package/dist/type/elysia/file-type.js +16 -1
  76. package/dist/type/elysia/file-type.mjs +16 -2
  77. package/dist/type/elysia/file.js +8 -4
  78. package/dist/type/elysia/file.mjs +8 -3
  79. package/dist/type/elysia/files.js +6 -4
  80. package/dist/type/elysia/files.mjs +5 -2
  81. package/dist/type/elysia/form.js +2 -3
  82. package/dist/type/elysia/form.mjs +3 -3
  83. package/dist/type/elysia/integer-string.js +4 -5
  84. package/dist/type/elysia/integer-string.mjs +3 -3
  85. package/dist/type/elysia/integer.js +4 -3
  86. package/dist/type/elysia/integer.mjs +4 -2
  87. package/dist/type/elysia/maybe-empty.js +3 -4
  88. package/dist/type/elysia/maybe-empty.mjs +1 -1
  89. package/dist/type/elysia/nullable.js +2 -3
  90. package/dist/type/elysia/nullable.mjs +1 -1
  91. package/dist/type/elysia/number.js +4 -3
  92. package/dist/type/elysia/number.mjs +4 -2
  93. package/dist/type/elysia/numeric-enum.js +2 -3
  94. package/dist/type/elysia/numeric-enum.mjs +1 -1
  95. package/dist/type/elysia/numeric.js +5 -5
  96. package/dist/type/elysia/numeric.mjs +3 -2
  97. package/dist/type/elysia/object-string.js +7 -4
  98. package/dist/type/elysia/object-string.mjs +9 -5
  99. package/dist/type/elysia/string.js +4 -3
  100. package/dist/type/elysia/string.mjs +4 -2
  101. package/dist/type/elysia/uint8-array.js +2 -3
  102. package/dist/type/elysia/uint8-array.mjs +1 -1
  103. package/dist/type/elysia/union-enum.js +2 -3
  104. package/dist/type/elysia/union-enum.mjs +1 -1
  105. package/dist/type/elysia/utils.js +2 -3
  106. package/dist/type/elysia/utils.mjs +1 -1
  107. package/dist/type/exports.js +10 -1
  108. package/dist/type/exports.mjs +7 -0
  109. package/dist/type/index.d.ts +9 -1
  110. package/dist/type/index.js +41 -13
  111. package/dist/type/index.mjs +44 -9
  112. package/dist/type/typebox-type-live.d.ts +9 -0
  113. package/dist/type/typebox-type-live.js +31 -0
  114. package/dist/type/typebox-type-live.mjs +16 -0
  115. package/dist/type/typebox-type.d.ts +24 -0
  116. package/dist/type/typebox-type.js +130 -0
  117. package/dist/type/typebox-type.mjs +66 -0
  118. package/dist/type/typebox-value-live.d.ts +9 -0
  119. package/dist/type/typebox-value-live.js +27 -0
  120. package/dist/type/typebox-value-live.mjs +11 -0
  121. package/dist/type/typebox-value.d.ts +30 -0
  122. package/dist/type/typebox-value.js +147 -0
  123. package/dist/type/typebox-value.mjs +62 -0
  124. package/dist/type/validator/custom-error.js +4 -5
  125. package/dist/type/validator/custom-error.mjs +3 -3
  126. package/dist/type/validator/default-precompute.js +4 -5
  127. package/dist/type/validator/default-precompute.mjs +1 -1
  128. package/dist/type/validator/index.js +41 -35
  129. package/dist/type/validator/index.mjs +23 -16
  130. package/dist/type/validator/validator-cache.js +10 -5
  131. package/dist/type/validator/validator-cache.mjs +10 -4
  132. package/dist/universal/constants.d.ts +2 -1
  133. package/dist/universal/constants.js +3 -1
  134. package/dist/universal/constants.mjs +2 -1
  135. package/dist/utils.d.ts +10 -1
  136. package/dist/utils.js +18 -3
  137. package/dist/utils.mjs +14 -3
  138. package/dist/validator/index.js +2 -1
  139. package/dist/validator/index.mjs +2 -1
  140. package/dist/ws/context.d.ts +4 -0
  141. package/dist/ws/context.js +44 -26
  142. package/dist/ws/context.mjs +44 -26
  143. package/dist/ws/route.js +126 -23
  144. package/dist/ws/route.mjs +128 -25
  145. package/package.json +4 -2
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../../_virtual/_rolldown/runtime.js');
3
2
  const require_utils = require('../../utils.js');
4
3
  const require_type_constants = require('../constants.js');
5
4
  const require_error = require('../../error.js');
@@ -9,14 +8,13 @@ const require_type_elysia_file_type = require('../elysia/file-type.js');
9
8
  const require_type_validator_clean_safe = require('./clean-safe.js');
10
9
  const require_type_utils = require('../utils.js');
11
10
  const require_validator_index = require('../../validator/index.js');
11
+ const require_type_typebox_type = require('../typebox-type.js');
12
+ const require_type_typebox_value = require('../typebox-value.js');
12
13
  const require_type_coerce = require('../coerce.js');
13
14
  const require_type_validator_default_precompute = require('./default-precompute.js');
14
15
  const require_type_validator_custom_error = require('./custom-error.js');
15
16
  const require_type_validator_exact_mirror = require('./exact-mirror.js');
16
17
  const require_type_validator_validator_cache = require('./validator-cache.js');
17
- let typebox_type = require("typebox/type");
18
- let typebox_value = require("typebox/value");
19
- let typebox_schema = require("typebox/schema");
20
18
 
21
19
  //#region src/type/validator/index.ts
22
20
  const moduleCache = /* @__PURE__ */ new WeakMap();
@@ -206,6 +204,18 @@ function findInstancePath(value, target, path = "") {
206
204
  if (found !== void 0) return found;
207
205
  }
208
206
  }
207
+ function reportSchema(schema) {
208
+ try {
209
+ return JSON.stringify(schema, (key, value) => key === "secrets" ? "[redacted]" : value);
210
+ } catch {
211
+ return "[unserializable schema]";
212
+ }
213
+ }
214
+ function warnMirrorFailure(schema, error) {
215
+ console.warn("Failed to create exactMirror. Please report the following code to https://github.com/elysiajs/elysia/issues");
216
+ console.warn(reportSchema(schema));
217
+ console.warn(error);
218
+ }
209
219
  var TypeBoxValidator = class extends require_validator_index.Validator {
210
220
  #decodeMirror;
211
221
  #encodeMirror;
@@ -229,23 +239,23 @@ var TypeBoxValidator = class extends require_validator_index.Validator {
229
239
  this.#hits = 0;
230
240
  if (isIntersectable) {
231
241
  const members = [schema, ...options.schemas];
232
- schema = shallowMergeObjects(members) ?? (0, typebox_type.Evaluate)((0, typebox_type.Intersect)(members));
242
+ schema = shallowMergeObjects(members) ?? require_type_typebox_type.Evaluate(require_type_typebox_type.Intersect(members));
233
243
  }
234
244
  const originalElyTyp = schema?.["~elyTyp"];
235
245
  const rawSchema = schema;
236
246
  const frozen = options?.aot && options.slot ? require_compile_aot.Compiled.getValidator(options.aot.method, options.aot.path, options.slot, options.app?.["~programId"]) : void 0;
237
247
  let schemaHasRef = false;
238
248
  if (name && options?.models) {
239
- schema = moduleCache.getOrInsertComputed(options.models, () => (0, typebox_type.Module)(materializeModels(options.models)))[name];
249
+ schema = moduleCache.getOrInsertComputed(options.models, () => require_type_typebox_type.Module(materializeModels(options.models)))[name];
240
250
  if (isIntersectable) {
241
251
  const members = [schema, ...options.schemas];
242
- schema = shallowMergeObjects(members) ?? (0, typebox_type.Evaluate)((0, typebox_type.Intersect)(members));
252
+ schema = shallowMergeObjects(members) ?? require_type_typebox_type.Evaluate(require_type_typebox_type.Intersect(members));
243
253
  }
244
254
  } else if (options?.models && typeof name !== "string") {
245
255
  schemaHasRef = frozen ? frozen.r === 1 : require_type_validator_clean_safe.schemaContainsRef(schema);
246
256
  if (schemaHasRef) {
247
257
  const id = `inline@${++inlineRefId}`;
248
- schema = (0, typebox_type.Module)({
258
+ schema = require_type_typebox_type.Module({
249
259
  ...options.models,
250
260
  [id]: schema
251
261
  })[id];
@@ -256,13 +266,13 @@ var TypeBoxValidator = class extends require_validator_index.Validator {
256
266
  if (options?.normalize === false && options.slot !== "headers" && options.slot !== "cookie") this.schema = require_type_shared.nonAdditionalProperties(this.schema);
257
267
  if (!isFrozen) {
258
268
  const capturing = require_compile_aot.Capture.isCapturing();
259
- this.hasCodec = (0, typebox_value.HasCodec)(this.schema);
269
+ this.hasCodec = require_type_typebox_value.HasCodec(this.schema);
260
270
  this.hasDefault = require_type_utils.hasProperty("default", this.schema);
261
271
  if (!capturing && !options?.eager && !schemaMayHaveAsyncRefine(this.schema) && !schemaHasCustomError(this.schema)) {
262
272
  this.#deferred = true;
263
273
  this.isAsync = false;
264
274
  } else {
265
- this.tb = capturing && require_compile_aot.captureImpl ? require_compile_aot.captureImpl.sourceOnlyValidator(this.schema) : (0, typebox_schema.Compile)(this.schema);
275
+ this.tb = capturing && require_compile_aot.captureImpl ? require_compile_aot.captureImpl.sourceOnlyValidator(this.schema) : require_type_typebox_value.SchemaCompile(this.schema);
266
276
  this.isAsync = this.tb.buildResult.external.variables.some(require_type_elysia_file_type.isAsyncPredicate) ?? false;
267
277
  if (capturing && require_compile_aot.captureImpl && options?.aot && options.slot) require_compile_aot.captureImpl.maybeCapture({
268
278
  aot: options.aot,
@@ -318,17 +328,15 @@ var TypeBoxValidator = class extends require_validator_index.Validator {
318
328
  if (isFrozen && frozen.cm) {
319
329
  const both = require_compile_aot.reconstruct().instantiateFrozenBoth(frozen, this.schema, schema);
320
330
  this.reconstructedCheck = both.check;
321
- this.Clean = options?.normalize === false ? void 0 : require_type_validator_clean_safe.schemaHasDangerousProperties(this.schema) ? (value) => (0, typebox_value.Clean)(this.schema, value) : both.clean;
331
+ this.Clean = options?.normalize === false ? void 0 : require_type_validator_clean_safe.schemaHasDangerousProperties(this.schema) ? (value) => require_type_typebox_value.Clean(this.schema, value) : both.clean;
322
332
  } else {
323
333
  if (isFrozen) this.reconstructedCheck = frozen.c(frozen.e ? require_compile_aot.reconstruct().collectExternals(this.schema) : require_compile_aot.EMPTY_EXTERNALS);
324
334
  if (!require_type_validator_exact_mirror.getExactMirror() && !frozen?.m && !require_type_validator_clean_safe.schemaHasDangerousProperties(this.schema) && options?.normalize !== false && options?.normalize !== "typebox" && (options?.normalize === true || options?.normalize === "exactMirror" || !!options?.sanitize)) throw require_type_validator_exact_mirror.exactMirrorRequired();
325
335
  try {
326
- this.Clean = options?.normalize === false ? void 0 : options?.normalize === "typebox" ? (value) => (0, typebox_value.Clean)(this.schema, value) : this.#setupMirror(schema, options, frozen);
336
+ this.Clean = options?.normalize === false ? void 0 : options?.normalize === "typebox" ? (value) => require_type_typebox_value.Clean(this.schema, value) : this.#setupMirror(schema, options, frozen);
327
337
  } catch (error) {
328
- console.warn("Failed to create exactMirror. Please report the following code to https://github.com/elysiajs/elysia/issues");
329
- console.warn(schema);
330
- console.warn(error);
331
- if (options?.normalize !== false) this.Clean = (value) => (0, typebox_value.Clean)(this.schema, value);
338
+ warnMirrorFailure(schema, error);
339
+ if (options?.normalize !== false) this.Clean = (value) => require_type_typebox_value.Clean(this.schema, value);
332
340
  }
333
341
  }
334
342
  this.#cleanRedundant = !!this.Clean && !options?.sanitize && options?.normalize !== "typebox" && require_type_validator_clean_safe.isFullyClosedObject(this.schema);
@@ -361,7 +369,7 @@ var TypeBoxValidator = class extends require_validator_index.Validator {
361
369
  }
362
370
  }
363
371
  #setupMirror(schema, options, frozen) {
364
- if (require_type_validator_clean_safe.schemaHasDangerousProperties(this.schema)) return (value) => (0, typebox_value.Clean)(this.schema, value);
372
+ if (require_type_validator_clean_safe.schemaHasDangerousProperties(this.schema)) return (value) => require_type_typebox_value.Clean(this.schema, value);
365
373
  const aot = options?.aot;
366
374
  const slot = options?.slot;
367
375
  if (aot && slot && frozen?.m) {
@@ -371,9 +379,7 @@ var TypeBoxValidator = class extends require_validator_index.Validator {
371
379
  if (clean === void 0) try {
372
380
  clean = require_compile_aot.reconstruct().instantiateFrozenMirror(m, schema);
373
381
  } catch (error) {
374
- console.warn("Failed to create exactMirror. Please report the following code to https://github.com/elysiajs/elysia/issues");
375
- console.warn(schema);
376
- console.warn(error);
382
+ warnMirrorFailure(schema, error);
377
383
  clean = (v) => v;
378
384
  }
379
385
  return clean(value);
@@ -381,9 +387,9 @@ var TypeBoxValidator = class extends require_validator_index.Validator {
381
387
  }
382
388
  if (aot && slot && require_compile_aot.Capture.isCapturing() && require_compile_aot.captureImpl) require_compile_aot.captureImpl.captureMirror(schema, aot, slot, options?.sanitize);
383
389
  const createMirror = require_type_validator_exact_mirror.getExactMirror();
384
- if (!createMirror) return (value) => (0, typebox_value.Clean)(this.schema, value);
390
+ if (!createMirror) return (value) => require_type_typebox_value.Clean(this.schema, value);
385
391
  return createMirror(schema, {
386
- Compile: typebox_schema.Compile,
392
+ Compile: require_type_typebox_value.SchemaCompile,
387
393
  sanitize: options?.sanitize
388
394
  });
389
395
  }
@@ -400,10 +406,10 @@ var TypeBoxValidator = class extends require_validator_index.Validator {
400
406
  run = require_compile_aot.reconstruct().instantiateFrozenDecodeMirror(m, schema, dir);
401
407
  } catch {
402
408
  run = dir === "decode" ? (v) => {
403
- const decoded = (0, typebox_value.DecodeUnsafe)(require_utils.nullObject(), schema, v);
409
+ const decoded = require_type_typebox_value.DecodeUnsafe(require_utils.nullObject(), schema, v);
404
410
  return this.Clean ? this.Clean(decoded) : decoded;
405
411
  } : (v) => {
406
- const out = (0, typebox_value.Encode)(schema, v);
412
+ const out = require_type_typebox_value.Encode(schema, v);
407
413
  return this.Clean ? this.Clean(out) : out;
408
414
  };
409
415
  }
@@ -417,7 +423,7 @@ var TypeBoxValidator = class extends require_validator_index.Validator {
417
423
  if (!createMirror) return;
418
424
  try {
419
425
  return createMirror(schema, {
420
- Compile: typebox_schema.Compile,
426
+ Compile: require_type_typebox_value.SchemaCompile,
421
427
  sanitize: options?.sanitize,
422
428
  ...dirOpt
423
429
  });
@@ -447,7 +453,7 @@ var TypeBoxValidator = class extends require_validator_index.Validator {
447
453
  }
448
454
  #rawCheck(value) {
449
455
  if (this.reconstructedCheck) return this.reconstructedCheck(value);
450
- if (this.#deferred) return (0, typebox_value.Check)(this.schema, value);
456
+ if (this.#deferred) return require_type_typebox_value.Check(this.schema, value);
451
457
  return this.tb.Check(value);
452
458
  }
453
459
  #tick() {
@@ -457,7 +463,7 @@ var TypeBoxValidator = class extends require_validator_index.Validator {
457
463
  * Promote a deferred validator to the compiled `Check` fast path
458
464
  */
459
465
  #materialize() {
460
- const tb = (0, typebox_schema.Compile)(this.schema);
466
+ const tb = require_type_typebox_value.SchemaCompile(this.schema);
461
467
  this.tb = tb;
462
468
  this.#dropCompiledSource();
463
469
  this.#deferred = false;
@@ -477,13 +483,13 @@ var TypeBoxValidator = class extends require_validator_index.Validator {
477
483
  if (tb.buildResult) tb.buildResult.functions = void 0;
478
484
  }
479
485
  Errors(value) {
480
- return (0, typebox_value.Errors)(this.schema, value);
486
+ return require_type_typebox_value.Errors(this.schema, value);
481
487
  }
482
488
  Decode(value) {
483
- return (0, typebox_value.Decode)(this.schema, value);
489
+ return require_type_typebox_value.Decode(this.schema, value);
484
490
  }
485
491
  Encode(value) {
486
- return this.hasCodec ? (0, typebox_value.Encode)(this.schema, value) : value;
492
+ return this.hasCodec ? require_type_typebox_value.Encode(this.schema, value) : value;
487
493
  }
488
494
  EncodeFrom(value, type) {
489
495
  this.#tick();
@@ -505,7 +511,7 @@ var TypeBoxValidator = class extends require_validator_index.Validator {
505
511
  if (errors) throw new require_error.ValidationError(type, out, errors.length ? errors : () => this.Errors(out), this.schema);
506
512
  return out;
507
513
  }
508
- const out = this.#noValidate ? (0, typebox_value.EncodeUnsafe)(require_utils.nullObject(), this.schema, value) : (0, typebox_value.Encode)(this.schema, value);
514
+ const out = this.#noValidate ? require_type_typebox_value.EncodeUnsafe(require_utils.nullObject(), this.schema, value) : require_type_typebox_value.Encode(this.schema, value);
509
515
  return this.Clean ? this.Clean(out) : out;
510
516
  } catch (e) {
511
517
  if (this.#noValidate) return this.Clean ? this.Clean(value) : value;
@@ -559,7 +565,7 @@ var TypeBoxValidator = class extends require_validator_index.Validator {
559
565
  if (defaults) {
560
566
  if (value === void 0 || value === null && defaults.appliesToNull) value = this.#cloneSharedDefault();
561
567
  else if (value !== null && typeof value === "object" && (defaults.merge !== void 0 || defaults.objectTemplate !== void 0)) value = this.#applyPrecomputedObjectDefault(value);
562
- } else value = (0, typebox_value.Default)(this.schema, value);
568
+ } else value = require_type_typebox_value.Default(this.schema, value);
563
569
  }
564
570
  if (this.#hasOptional) {
565
571
  const bypass = this.optionalBypass(value);
@@ -583,7 +589,7 @@ var TypeBoxValidator = class extends require_validator_index.Validator {
583
589
  }
584
590
  if (this.#decodeMirror) value = this.#decodeMirror(value);
585
591
  else try {
586
- value = (0, typebox_value.DecodeUnsafe)(require_utils.nullObject(), this.schema, value);
592
+ value = require_type_typebox_value.DecodeUnsafe(require_utils.nullObject(), this.schema, value);
587
593
  } catch (e) {
588
594
  if (e instanceof require_error.ValidationError) throw e;
589
595
  if (e?.error) throw e.error;
@@ -614,7 +620,7 @@ var TypeBoxValidator = class extends require_validator_index.Validator {
614
620
  if (defaults) {
615
621
  if (value === void 0 || value === null && defaults.appliesToNull) value = this.#cloneSharedDefault();
616
622
  else if (value !== null && typeof value === "object" && (defaults.merge !== void 0 || defaults.objectTemplate !== void 0)) value = this.#applyPrecomputedObjectDefault(value);
617
- } else value = (0, typebox_value.Default)(this.schema, value);
623
+ } else value = require_type_typebox_value.Default(this.schema, value);
618
624
  }
619
625
  if (this.#hasOptional) {
620
626
  const bypass = this.optionalBypass(value);
@@ -628,7 +634,7 @@ var TypeBoxValidator = class extends require_validator_index.Validator {
628
634
  if (errors) throw this.#error(value, type, errors.length ? errors : void 0);
629
635
  if (this.#decodeMirror) value = this.#decodeMirror(value);
630
636
  else try {
631
- value = (0, typebox_value.DecodeUnsafe)(require_utils.nullObject(), this.schema, value);
637
+ value = require_type_typebox_value.DecodeUnsafe(require_utils.nullObject(), this.schema, value);
632
638
  } catch (e) {
633
639
  if (e instanceof require_error.ValidationError) throw e;
634
640
  if (e?.error) throw e.error;
@@ -6,15 +6,14 @@ import { isPureRefinement, nonAdditionalProperties } from "../shared.mjs";
6
6
  import { collectFileTypeChecks, isAsyncPredicate, takeFileTypeChecks } from "../elysia/file-type.mjs";
7
7
  import { isFullyClosedObject, schemaContainsRef, schemaHasDangerousProperties, schemaSome } from "./clean-safe.mjs";
8
8
  import { hasProperty } from "../utils.mjs";
9
- import { Validator as Validator$1 } from "../../validator/index.mjs";
9
+ import { Validator } from "../../validator/index.mjs";
10
+ import { Evaluate, Intersect, Module } from "../typebox-type.mjs";
11
+ import { Check, Clean, Decode, DecodeUnsafe, Default, Encode, EncodeUnsafe, Errors, HasCodec, SchemaCompile } from "../typebox-value.mjs";
10
12
  import { applyCoercions, buildCoercedFromPlan } from "../coerce.mjs";
11
13
  import { applyPrecomputed, createDefaultCloner, createMergerFromSource, createObjectDefaultMerger, verifyPreallocatableDefault } from "./default-precompute.mjs";
12
14
  import { buildFindCustomError } from "./custom-error.mjs";
13
15
  import { exactMirrorRequired, getExactMirror } from "./exact-mirror.mjs";
14
16
  import { TypeBoxValidatorCache, mayHaveFileType } from "./validator-cache.mjs";
15
- import { Evaluate, Intersect, Module } from "typebox/type";
16
- import { Check, Clean, Decode as Decode$1, DecodeUnsafe, Default, Encode, EncodeUnsafe, Errors, HasCodec } from "typebox/value";
17
- import { Compile } from "typebox/schema";
18
17
 
19
18
  //#region src/type/validator/index.ts
20
19
  const moduleCache = /* @__PURE__ */ new WeakMap();
@@ -204,7 +203,19 @@ function findInstancePath(value, target, path = "") {
204
203
  if (found !== void 0) return found;
205
204
  }
206
205
  }
207
- var TypeBoxValidator = class extends Validator$1 {
206
+ function reportSchema(schema) {
207
+ try {
208
+ return JSON.stringify(schema, (key, value) => key === "secrets" ? "[redacted]" : value);
209
+ } catch {
210
+ return "[unserializable schema]";
211
+ }
212
+ }
213
+ function warnMirrorFailure(schema, error) {
214
+ console.warn("Failed to create exactMirror. Please report the following code to https://github.com/elysiajs/elysia/issues");
215
+ console.warn(reportSchema(schema));
216
+ console.warn(error);
217
+ }
218
+ var TypeBoxValidator = class extends Validator {
208
219
  #decodeMirror;
209
220
  #encodeMirror;
210
221
  #refinements;
@@ -260,7 +271,7 @@ var TypeBoxValidator = class extends Validator$1 {
260
271
  this.#deferred = true;
261
272
  this.isAsync = false;
262
273
  } else {
263
- this.tb = capturing && captureImpl ? captureImpl.sourceOnlyValidator(this.schema) : Compile(this.schema);
274
+ this.tb = capturing && captureImpl ? captureImpl.sourceOnlyValidator(this.schema) : SchemaCompile(this.schema);
264
275
  this.isAsync = this.tb.buildResult.external.variables.some(isAsyncPredicate) ?? false;
265
276
  if (capturing && captureImpl && options?.aot && options.slot) captureImpl.maybeCapture({
266
277
  aot: options.aot,
@@ -323,9 +334,7 @@ var TypeBoxValidator = class extends Validator$1 {
323
334
  try {
324
335
  this.Clean = options?.normalize === false ? void 0 : options?.normalize === "typebox" ? (value) => Clean(this.schema, value) : this.#setupMirror(schema, options, frozen);
325
336
  } catch (error) {
326
- console.warn("Failed to create exactMirror. Please report the following code to https://github.com/elysiajs/elysia/issues");
327
- console.warn(schema);
328
- console.warn(error);
337
+ warnMirrorFailure(schema, error);
329
338
  if (options?.normalize !== false) this.Clean = (value) => Clean(this.schema, value);
330
339
  }
331
340
  }
@@ -369,9 +378,7 @@ var TypeBoxValidator = class extends Validator$1 {
369
378
  if (clean === void 0) try {
370
379
  clean = reconstruct().instantiateFrozenMirror(m, schema);
371
380
  } catch (error) {
372
- console.warn("Failed to create exactMirror. Please report the following code to https://github.com/elysiajs/elysia/issues");
373
- console.warn(schema);
374
- console.warn(error);
381
+ warnMirrorFailure(schema, error);
375
382
  clean = (v) => v;
376
383
  }
377
384
  return clean(value);
@@ -381,7 +388,7 @@ var TypeBoxValidator = class extends Validator$1 {
381
388
  const createMirror = getExactMirror();
382
389
  if (!createMirror) return (value) => Clean(this.schema, value);
383
390
  return createMirror(schema, {
384
- Compile,
391
+ Compile: SchemaCompile,
385
392
  sanitize: options?.sanitize
386
393
  });
387
394
  }
@@ -415,7 +422,7 @@ var TypeBoxValidator = class extends Validator$1 {
415
422
  if (!createMirror) return;
416
423
  try {
417
424
  return createMirror(schema, {
418
- Compile,
425
+ Compile: SchemaCompile,
419
426
  sanitize: options?.sanitize,
420
427
  ...dirOpt
421
428
  });
@@ -455,7 +462,7 @@ var TypeBoxValidator = class extends Validator$1 {
455
462
  * Promote a deferred validator to the compiled `Check` fast path
456
463
  */
457
464
  #materialize() {
458
- const tb = Compile(this.schema);
465
+ const tb = SchemaCompile(this.schema);
459
466
  this.tb = tb;
460
467
  this.#dropCompiledSource();
461
468
  this.#deferred = false;
@@ -478,7 +485,7 @@ var TypeBoxValidator = class extends Validator$1 {
478
485
  return Errors(this.schema, value);
479
486
  }
480
487
  Decode(value) {
481
- return Decode$1(this.schema, value);
488
+ return Decode(this.schema, value);
482
489
  }
483
490
  Encode(value) {
484
491
  return this.hasCodec ? Encode(this.schema, value) : value;
@@ -1,10 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../../_virtual/_rolldown/runtime.js');
3
2
  const require_universal_constants = require('../../universal/constants.js');
4
3
  const require_utils = require('../../utils.js');
5
4
  const require_type_constants = require('../constants.js');
6
5
  const require_type_coerce = require('../coerce.js');
7
- let typebox_value = require("typebox/value");
8
6
 
9
7
  //#region src/type/validator/validator-cache.ts
10
8
  const DEFAULT_CACHE_LIMIT = 1024;
@@ -46,6 +44,13 @@ function walk(value, key, mode, state) {
46
44
  if (!state.hasRef && value["$ref"]) state.hasRef = true;
47
45
  }
48
46
  if (!state.hasFileType && (elyTyp === require_type_constants.ELYSIA_TYPES.File || elyTyp === require_type_constants.ELYSIA_TYPES.Files)) state.hasFileType = true;
47
+ if (!state.hasCodec) {
48
+ const codec = value["~codec"];
49
+ if (codec !== null && typeof codec === "object" && "encode" in codec && "decode" in codec) {
50
+ state.hasCodec = true;
51
+ if (!state.forceKey) state.buildKey = false;
52
+ }
53
+ }
49
54
  const toJSON = value.toJSON;
50
55
  if (typeof toJSON === "function") value = toJSON.call(value, typeof key === "number" ? "" + key : key);
51
56
  }
@@ -119,17 +124,17 @@ function walkArray(value, mode, state) {
119
124
  return serialized + "]";
120
125
  }
121
126
  function computeSchemaMeta(schema, forceKey) {
122
- const hasCodec = (0, typebox_value.HasCodec)(schema);
123
127
  const state = {
124
128
  isOpaque: false,
125
129
  hasRef: false,
126
130
  hasFileType: false,
131
+ hasCodec: false,
127
132
  forceKey,
128
- buildKey: forceKey || !hasCodec,
133
+ buildKey: true,
129
134
  depth: 0
130
135
  };
131
136
  const key = walk(schema, "", NODE, state);
132
- const special = hasCodec || state.isOpaque;
137
+ const special = state.hasCodec || state.isOpaque;
133
138
  return {
134
139
  special,
135
140
  hasRef: state.hasRef,
@@ -2,7 +2,6 @@ import { isCloudflareWorker } from "../../universal/constants.mjs";
2
2
  import { evictOldestHalf, nullObject } from "../../utils.mjs";
3
3
  import { ELYSIA_TYPES } from "../constants.mjs";
4
4
  import { deferCoercions } from "../coerce.mjs";
5
- import { HasCodec } from "typebox/value";
6
5
 
7
6
  //#region src/type/validator/validator-cache.ts
8
7
  const DEFAULT_CACHE_LIMIT = 1024;
@@ -44,6 +43,13 @@ function walk(value, key, mode, state) {
44
43
  if (!state.hasRef && value["$ref"]) state.hasRef = true;
45
44
  }
46
45
  if (!state.hasFileType && (elyTyp === ELYSIA_TYPES.File || elyTyp === ELYSIA_TYPES.Files)) state.hasFileType = true;
46
+ if (!state.hasCodec) {
47
+ const codec = value["~codec"];
48
+ if (codec !== null && typeof codec === "object" && "encode" in codec && "decode" in codec) {
49
+ state.hasCodec = true;
50
+ if (!state.forceKey) state.buildKey = false;
51
+ }
52
+ }
47
53
  const toJSON = value.toJSON;
48
54
  if (typeof toJSON === "function") value = toJSON.call(value, typeof key === "number" ? "" + key : key);
49
55
  }
@@ -117,17 +123,17 @@ function walkArray(value, mode, state) {
117
123
  return serialized + "]";
118
124
  }
119
125
  function computeSchemaMeta(schema, forceKey) {
120
- const hasCodec = HasCodec(schema);
121
126
  const state = {
122
127
  isOpaque: false,
123
128
  hasRef: false,
124
129
  hasFileType: false,
130
+ hasCodec: false,
125
131
  forceKey,
126
- buildKey: forceKey || !hasCodec,
132
+ buildKey: true,
127
133
  depth: 0
128
134
  };
129
135
  const key = walk(schema, "", NODE, state);
130
- const special = hasCodec || state.isOpaque;
136
+ const special = state.hasCodec || state.isOpaque;
131
137
  return {
132
138
  special,
133
139
  hasRef: state.hasRef,
@@ -1,6 +1,7 @@
1
1
  //#region src/universal/constants.d.ts
2
2
  declare const isBun: boolean;
3
+ declare const isFastly: boolean;
3
4
  declare const isCloudflareWorker: boolean;
4
5
  declare const hasHeaderShorthand: boolean;
5
6
  //#endregion
6
- export { hasHeaderShorthand, isBun, isCloudflareWorker };
7
+ export { hasHeaderShorthand, isBun, isCloudflareWorker, isFastly };
@@ -2,6 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  //#region src/universal/constants.ts
4
4
  const isBun = typeof Bun !== "undefined";
5
+ const isFastly = typeof fastly !== "undefined";
5
6
  const isCloudflareWorker = (() => {
6
7
  try {
7
8
  if (typeof caches !== "undefined" && typeof caches.default !== "undefined") return true;
@@ -16,4 +17,5 @@ const hasHeaderShorthand = isBun ? "toJSON" in new Headers() : false;
16
17
  //#endregion
17
18
  exports.hasHeaderShorthand = hasHeaderShorthand;
18
19
  exports.isBun = isBun;
19
- exports.isCloudflareWorker = isCloudflareWorker;
20
+ exports.isCloudflareWorker = isCloudflareWorker;
21
+ exports.isFastly = isFastly;
@@ -1,5 +1,6 @@
1
1
  //#region src/universal/constants.ts
2
2
  const isBun = typeof Bun !== "undefined";
3
+ const isFastly = typeof fastly !== "undefined";
3
4
  const isCloudflareWorker = (() => {
4
5
  try {
5
6
  if (typeof caches !== "undefined" && typeof caches.default !== "undefined") return true;
@@ -12,4 +13,4 @@ const isCloudflareWorker = (() => {
12
13
  const hasHeaderShorthand = isBun ? "toJSON" in new Headers() : false;
13
14
 
14
15
  //#endregion
15
- export { hasHeaderShorthand, isBun, isCloudflareWorker };
16
+ export { hasHeaderShorthand, isBun, isCloudflareWorker, isFastly };
package/dist/utils.d.ts CHANGED
@@ -116,6 +116,7 @@ declare function formToFormData(value: Record<keyof any, unknown>): FormData;
116
116
  * ```
117
117
  */
118
118
  declare const form: <const T extends Record<keyof any, unknown>>(value: T) => ElysiaFormData<T>;
119
+ declare const assignOwn: <T extends object>(target: T, source: any) => T;
119
120
  declare const getLoosePath: (path: string) => string;
120
121
  /**
121
122
  * Certify a byte stream for direct Response body pass-through.
@@ -129,6 +130,7 @@ declare const isByteStream: (value: unknown) => value is ReadableStream<Uint8Arr
129
130
  type FormatSSEPayload<T = unknown> = T extends string ? {
130
131
  readonly data: T;
131
132
  } : Prettify<SSEPayload<T>>;
133
+ declare const sseData: (value: string) => string;
132
134
  declare const sse: <const T extends string | SSEPayload | Generator | AsyncGenerator | ReadableStream>(_payload: T) => T extends string ? {
133
135
  readonly data: T;
134
136
  } : T extends SSEPayload ? T : T extends ReadableStream<infer A> ? ReadableStream<FormatSSEPayload<A>> : T extends Generator<infer A, infer B, infer C> ? Generator<FormatSSEPayload<A>, B, C> : T extends AsyncGenerator<infer A, infer B_1, infer C_1> ? AsyncGenerator<FormatSSEPayload<A>, B_1, C_1> : T;
@@ -166,7 +168,14 @@ declare function clonePlainDeep<T>(value: T, seen?: WeakMap<object, any>): T;
166
168
  declare function guardNonPlainLeaves(target: Record<string, unknown>, source: Record<string, unknown>): void;
167
169
  declare function joinPath(base: string, path: string): string;
168
170
  declare function pushField<K extends keyof any>(target: Record<K, unknown>, key: K, item: unknown, defaultArray?: boolean): void;
171
+ declare const fallbackRequestId: () => string;
169
172
  declare const requestId: any;
173
+ /**
174
+ * Offset of the first byte after `://`, so the authority is never scanned as
175
+ * path. A fixed offset would let the client-supplied `Host` decide how many
176
+ * leading path bytes are dropped
177
+ */
178
+ declare function authorityEnd(url: string): number;
170
179
  declare function replaceUrlPath(url: string, path: string): string;
171
180
  declare function clonePlainDecorators<T extends Record<string, unknown>>(source: T, seen?: WeakMap<object, any>): T;
172
181
  declare function prefix<T extends string, Models extends Record<string, AnySchema>>(prefix: T, models: Models): { [k in keyof Models as `${T}.${k & string}`]: Models[k] };
@@ -175,4 +184,4 @@ declare namespace prefix {
175
184
  }
176
185
  declare function serializeMacroSeed(_key: string, value: unknown): unknown;
177
186
  //#endregion
178
- export { ChainNode, CompactBeforeHandleChunk, CompactBeforeHandlePrefix, DeriveEntry, ELYSIA_FORM_PROTOTYPE, bytes, clearFlattenChainMemo, cloneHook, clonePlainDecorators, clonePlainDeep, coalesceSchemas, compactBeforeHandleConflicts, compactBeforeHandlePrefix, constantTimeEqual, createErrorEventHandler, deriveEntryFn, eventProperties, evictOldestHalf, flattenChain, flattenChainMemo, flattenChainMemoReadonly, fnOrigin, fnv1a, form, formToFormData, getLoosePath, guardNonPlainLeaves, hookToGuard, invalidateMacroEpoch, isBlob, isByteStream, isCompactBeforeHandleOnly, isElysiaForm, isEmpty, isLocalScope, isMapDeriveEntry, isNotEmpty, isRecordNumber, joinPath, macroEpoch, macroOrigin, mapDeriveEntry, mergeArray, mergeDeep, mergeHook, mergeResponse, nullObject, prefix, pushField, redirect, replaceUrlPath, requestId, schemaProperties, serializeMacroSeed, sse };
187
+ export { ChainNode, CompactBeforeHandleChunk, CompactBeforeHandlePrefix, DeriveEntry, ELYSIA_FORM_PROTOTYPE, assignOwn, authorityEnd, bytes, clearFlattenChainMemo, cloneHook, clonePlainDecorators, clonePlainDeep, coalesceSchemas, compactBeforeHandleConflicts, compactBeforeHandlePrefix, constantTimeEqual, createErrorEventHandler, deriveEntryFn, eventProperties, evictOldestHalf, fallbackRequestId, flattenChain, flattenChainMemo, flattenChainMemoReadonly, fnOrigin, fnv1a, form, formToFormData, getLoosePath, guardNonPlainLeaves, hookToGuard, invalidateMacroEpoch, isBlob, isByteStream, isCompactBeforeHandleOnly, isElysiaForm, isEmpty, isLocalScope, isMapDeriveEntry, isNotEmpty, isRecordNumber, joinPath, macroEpoch, macroOrigin, mapDeriveEntry, mergeArray, mergeDeep, mergeHook, mergeResponse, nullObject, prefix, pushField, redirect, replaceUrlPath, requestId, schemaProperties, serializeMacroSeed, sse, sseData };
package/dist/utils.js CHANGED
@@ -287,6 +287,7 @@ function formToFormData(value) {
287
287
  * ```
288
288
  */
289
289
  const form = (value) => Object.setPrototypeOf({ ...value }, ELYSIA_FORM_PROTOTYPE);
290
+ const assignOwn = (target, source) => source != null && Object.hasOwn(source, "__proto__") ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : Object.assign(target, source);
290
291
  const getLoosePath = (path) => path.charCodeAt(path.length - 1) === 47 ? path.slice(0, -1) : path + "/";
291
292
  const byteStreams = /* @__PURE__ */ new WeakSet();
292
293
  /**
@@ -625,9 +626,19 @@ function pushField(target, key, item, defaultArray = false) {
625
626
  else target[key] = [v, item];
626
627
  else target[key] = defaultArray ? [item] : item;
627
628
  }
628
- const requestId = require_universal_constants.isBun ? Bun.randomUUIDv7 : crypto.randomUUIDv7?.bind(crypto) ?? crypto.randomUUID?.bind(crypto);
629
+ let fallbackRequestIdCounter = 0;
630
+ const fallbackRequestId = () => Date.now().toString(36) + "-" + (++fallbackRequestIdCounter).toString(36);
631
+ const requestId = require_universal_constants.isBun ? Bun.randomUUIDv7 : typeof crypto !== "undefined" ? crypto.randomUUIDv7?.bind(crypto) ?? crypto.randomUUID?.bind(crypto) ?? fallbackRequestId : fallbackRequestId;
632
+ /**
633
+ * Offset of the first byte after `://`, so the authority is never scanned as
634
+ * path. A fixed offset would let the client-supplied `Host` decide how many
635
+ * leading path bytes are dropped
636
+ */
637
+ function authorityEnd(url) {
638
+ return url.charCodeAt(4) === 58 ? 7 : url.charCodeAt(5) === 58 ? 8 : url.indexOf("://") + 3;
639
+ }
629
640
  function replaceUrlPath(url, path) {
630
- const i = url.indexOf("/", 11);
641
+ const i = url.indexOf("/", authorityEnd(url));
631
642
  const qs = url.indexOf("?", i);
632
643
  return `${url.slice(0, i)}${path.charCodeAt(0) === 47 ? "" : "/"}${path}${qs === -1 ? "" : url.slice(qs)}`;
633
644
  }
@@ -682,6 +693,8 @@ function serializeMacroSeed(_key, value) {
682
693
 
683
694
  //#endregion
684
695
  exports.ELYSIA_FORM_PROTOTYPE = ELYSIA_FORM_PROTOTYPE;
696
+ exports.assignOwn = assignOwn;
697
+ exports.authorityEnd = authorityEnd;
685
698
  exports.bytes = bytes;
686
699
  exports.clearFlattenChainMemo = clearFlattenChainMemo;
687
700
  exports.cloneHook = cloneHook;
@@ -695,6 +708,7 @@ exports.createErrorEventHandler = createErrorEventHandler;
695
708
  exports.deriveEntryFn = deriveEntryFn;
696
709
  exports.eventProperties = eventProperties;
697
710
  exports.evictOldestHalf = evictOldestHalf;
711
+ exports.fallbackRequestId = fallbackRequestId;
698
712
  exports.flattenChain = flattenChain;
699
713
  exports.flattenChainMemo = flattenChainMemo;
700
714
  exports.flattenChainMemoReadonly = flattenChainMemoReadonly;
@@ -731,4 +745,5 @@ exports.replaceUrlPath = replaceUrlPath;
731
745
  exports.requestId = requestId;
732
746
  exports.schemaProperties = schemaProperties;
733
747
  exports.serializeMacroSeed = serializeMacroSeed;
734
- exports.sse = sse;
748
+ exports.sse = sse;
749
+ exports.sseData = sseData;
package/dist/utils.mjs CHANGED
@@ -286,6 +286,7 @@ function formToFormData(value) {
286
286
  * ```
287
287
  */
288
288
  const form = (value) => Object.setPrototypeOf({ ...value }, ELYSIA_FORM_PROTOTYPE);
289
+ const assignOwn = (target, source) => source != null && Object.hasOwn(source, "__proto__") ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : Object.assign(target, source);
289
290
  const getLoosePath = (path) => path.charCodeAt(path.length - 1) === 47 ? path.slice(0, -1) : path + "/";
290
291
  const byteStreams = /* @__PURE__ */ new WeakSet();
291
292
  /**
@@ -624,9 +625,19 @@ function pushField(target, key, item, defaultArray = false) {
624
625
  else target[key] = [v, item];
625
626
  else target[key] = defaultArray ? [item] : item;
626
627
  }
627
- const requestId = isBun ? Bun.randomUUIDv7 : crypto.randomUUIDv7?.bind(crypto) ?? crypto.randomUUID?.bind(crypto);
628
+ let fallbackRequestIdCounter = 0;
629
+ const fallbackRequestId = () => Date.now().toString(36) + "-" + (++fallbackRequestIdCounter).toString(36);
630
+ const requestId = isBun ? Bun.randomUUIDv7 : typeof crypto !== "undefined" ? crypto.randomUUIDv7?.bind(crypto) ?? crypto.randomUUID?.bind(crypto) ?? fallbackRequestId : fallbackRequestId;
631
+ /**
632
+ * Offset of the first byte after `://`, so the authority is never scanned as
633
+ * path. A fixed offset would let the client-supplied `Host` decide how many
634
+ * leading path bytes are dropped
635
+ */
636
+ function authorityEnd(url) {
637
+ return url.charCodeAt(4) === 58 ? 7 : url.charCodeAt(5) === 58 ? 8 : url.indexOf("://") + 3;
638
+ }
628
639
  function replaceUrlPath(url, path) {
629
- const i = url.indexOf("/", 11);
640
+ const i = url.indexOf("/", authorityEnd(url));
630
641
  const qs = url.indexOf("?", i);
631
642
  return `${url.slice(0, i)}${path.charCodeAt(0) === 47 ? "" : "/"}${path}${qs === -1 ? "" : url.slice(qs)}`;
632
643
  }
@@ -680,4 +691,4 @@ function serializeMacroSeed(_key, value) {
680
691
  }
681
692
 
682
693
  //#endregion
683
- export { ELYSIA_FORM_PROTOTYPE, bytes, clearFlattenChainMemo, cloneHook, clonePlainDecorators, clonePlainDeep, coalesceSchemas, compactBeforeHandleConflicts, compactBeforeHandlePrefix, constantTimeEqual, createErrorEventHandler, deriveEntryFn, eventProperties, evictOldestHalf, flattenChain, flattenChainMemo, flattenChainMemoReadonly, fnOrigin, fnv1a, form, formToFormData, getLoosePath, guardNonPlainLeaves, hookToGuard, invalidateMacroEpoch, isBlob, isByteStream, isCompactBeforeHandleOnly, isElysiaForm, isEmpty, isLocalScope, isMapDeriveEntry, isNotEmpty, isRecordNumber, joinPath, macroEpoch, macroOrigin, mapDeriveEntry, mergeArray, mergeDeep, mergeHook, mergeResponse, nullObject, prefix, pushField, redirect, replaceUrlPath, requestId, schemaProperties, serializeMacroSeed, sse };
694
+ export { ELYSIA_FORM_PROTOTYPE, assignOwn, authorityEnd, bytes, clearFlattenChainMemo, cloneHook, clonePlainDecorators, clonePlainDeep, coalesceSchemas, compactBeforeHandleConflicts, compactBeforeHandlePrefix, constantTimeEqual, createErrorEventHandler, deriveEntryFn, eventProperties, evictOldestHalf, fallbackRequestId, flattenChain, flattenChainMemo, flattenChainMemoReadonly, fnOrigin, fnv1a, form, formToFormData, getLoosePath, guardNonPlainLeaves, hookToGuard, invalidateMacroEpoch, isBlob, isByteStream, isCompactBeforeHandleOnly, isElysiaForm, isEmpty, isLocalScope, isMapDeriveEntry, isNotEmpty, isRecordNumber, joinPath, macroEpoch, macroOrigin, mapDeriveEntry, mergeArray, mergeDeep, mergeHook, mergeResponse, nullObject, prefix, pushField, redirect, replaceUrlPath, requestId, schemaProperties, serializeMacroSeed, sse, sseData };
@@ -1,4 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_utils = require('../utils.js');
2
3
  const require_type_bridge = require('../type/bridge.js');
3
4
  const require_error = require('../error.js');
4
5
  const require_compile_aot = require('../compile/aot.js');
@@ -205,7 +206,7 @@ var MultiValidator = class MultiValidator extends Validator {
205
206
  snapshot.push(...result);
206
207
  return snapshot;
207
208
  }
208
- if (typeof snapshot === "object" && typeof result === "object") return Object.assign(snapshot, result);
209
+ if (typeof snapshot === "object" && typeof result === "object") return require_utils.assignOwn(snapshot, result);
209
210
  throw new Error("Unable to merged value with different type");
210
211
  }
211
212
  static #syncStandard(schema, value) {
@@ -1,3 +1,4 @@
1
+ import { assignOwn } from "../utils.mjs";
1
2
  import { Clone, Compile, Default, 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";
@@ -204,7 +205,7 @@ var MultiValidator = class MultiValidator extends Validator {
204
205
  snapshot.push(...result);
205
206
  return snapshot;
206
207
  }
207
- if (typeof snapshot === "object" && typeof result === "object") return Object.assign(snapshot, result);
208
+ if (typeof snapshot === "object" && typeof result === "object") return assignOwn(snapshot, result);
208
209
  throw new Error("Unable to merged value with different type");
209
210
  }
210
211
  static #syncStandard(schema, value) {
@@ -11,6 +11,10 @@ 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>;
14
18
  elysia?: ElysiaWS<any>;
15
19
  context?: Record<string, unknown>;
16
20
  resumeWaiters?: Set<() => void>;