@openclaw/slack 2026.11.3 → 2026.11.5-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/dist/.setup/{account-inspect-CmkKiSb9.mjs → account-inspect-BLVha-ov.mjs} +11 -8
  2. package/dist/.setup/{accounts-msihSF3-.mjs → accounts-CGJScKtk.mjs} +10 -1
  3. package/dist/.setup/{action-runtime-ChRfnnBu.mjs → action-runtime-D01wBhx5.mjs} +38 -45
  4. package/dist/.setup/action-runtime.runtime-VQGaR6g8.mjs +1 -0
  5. package/dist/.setup/{actions-By7tvpvv.mjs → actions-D5S6D_BU.mjs} +89 -76
  6. package/dist/.setup/{approval-handler.runtime-D8ArtDQt.mjs → approval-handler.runtime-Buw5jh2Y.mjs} +26 -30
  7. package/dist/.setup/{approval-message-updates-DT7XBPbV.mjs → approval-message-updates-pmXcve5E.mjs} +1 -1
  8. package/dist/.setup/{channel-DLFiMJm2.mjs → channel-C_R98Nbv.mjs} +569 -339
  9. package/dist/.setup/{channel-type-BEFP2ORi.mjs → channel-type-B5P3w9eA.mjs} +4 -8
  10. package/dist/.setup/{channel.setup-CzFw73mU.mjs → channel.setup-Lq2OxKkF.mjs} +13 -13
  11. package/dist/.setup/{config-schema-DNnh6bWU.mjs → config-schema-BWAaa5au.mjs} +3 -7
  12. package/dist/.setup/cursor-pages-CATAzbTT.mjs +313 -0
  13. package/dist/.setup/{directory-config-Cjj0N8R0.mjs → directory-config-D-hf9KGQ.mjs} +3 -3
  14. package/dist/.setup/{directory-live-BIKD-5B_.mjs → directory-live-onKAFI1E.mjs} +4 -4
  15. package/dist/.setup/{doctor-contract-Cd4-VzIM.mjs → doctor-contract-9-QJRCXk.mjs} +37 -45
  16. package/dist/.setup/{message-tool-api-BS5ekEA_.mjs → message-tool-api-LGIgVXJf.mjs} +4 -3
  17. package/dist/.setup/{monitor-CV6Z6FKP.mjs → monitor-Cm1TuqxN.mjs} +3424 -3703
  18. package/dist/.setup/{outbound-adapter-9dbnYtL1.mjs → outbound-adapter-C-95EWl2.mjs} +30 -36
  19. package/dist/.setup/paths-B1u59oLK.mjs +8 -0
  20. package/dist/.setup/{pipeline.runtime-DLIQf1Bo.mjs → pipeline.runtime-DGnV6akc.mjs} +416 -534
  21. package/dist/.setup/{policy-yhn48xf5.mjs → policy-DxhGRvc2.mjs} +1 -2
  22. package/dist/.setup/{session-status-Dv8wNBEt.mjs → probe-DANukR3O.mjs} +1206 -839
  23. package/dist/.setup/question-delivery-CWC7sRhH.mjs +39 -0
  24. package/dist/.setup/{relay-source-CxDcrn16.mjs → relay-source-DoyOlTbK.mjs} +5 -3
  25. package/dist/.setup/{replies-MRkrg3rC.mjs → replies-BcmUKord.mjs} +34 -19
  26. package/dist/.setup/{reply-blocks-Ca-raz2z.mjs → reply-blocks-BzsXUUUL.mjs} +201 -206
  27. package/dist/.setup/{resolve-channels-DRRhElwz.mjs → resolve-channels-XDPgnesf.mjs} +4 -7
  28. package/dist/.setup/{resolve-users-Cz8e17ky.mjs → resolve-users-aDAv24U2.mjs} +8 -16
  29. package/dist/.setup/runtime-setter-api-Cx_PV-xu.mjs +2 -0
  30. package/dist/.setup/{scopes-DfQVi8Jw.mjs → scopes-BocHwImV.mjs} +2 -1
  31. package/dist/.setup/secret-contract-api-BlLz88mj.mjs +2 -0
  32. package/dist/.setup/{secret-contract-vVRMoE1D.mjs → secret-contract-uiQtoNlu.mjs} +2 -2
  33. package/dist/.setup/{send-results-eeOu_HYm.mjs → send-results-BGxlroJ-.mjs} +3 -4
  34. package/dist/.setup/{send-C-8wY0lK.mjs → send-yK6_-px6.mjs} +297 -334
  35. package/dist/.setup/setup-plugin-api-Cfz58xoh.mjs +2 -0
  36. package/dist/.setup/{setup-surface--n8VsDvV.mjs → setup-surface-C0KRtyqa.mjs} +5 -6
  37. package/dist/.setup/{slash-dispatch.runtime-D3Wq45ER.mjs → slash-dispatch.runtime-CyVC3bYx.mjs} +2 -2
  38. package/dist/.setup/{target-parsing-FFE26kOV.mjs → target-parsing-Bx2UZniD.mjs} +1 -2
  39. package/dist/.setup/{targets-C6LZQL1Q.mjs → targets-D-ASeWHy.mjs} +1 -1
  40. package/dist/.source-module-urls/c5ffd0957b234c7c12090e7de4eca2482ef339b8561e078da55b734211b0ba58.json +1 -0
  41. package/dist/account-inspect-api.js +1 -1
  42. package/dist/api.js +16 -17
  43. package/dist/channel-config-api.js +1 -2
  44. package/dist/channel-plugin-api.js +1 -2
  45. package/dist/directory-contract-api.js +1 -2
  46. package/dist/doctor-contract-api.js +1 -2
  47. package/dist/index.js +0 -6
  48. package/dist/message-tool-api.js +1 -2
  49. package/dist/runtime-api.js +10 -12
  50. package/dist/runtime-setter-api.js +1 -2
  51. package/dist/secret-contract-api.js +1 -2
  52. package/dist/security-contract-api.js +1 -2
  53. package/dist/setup-entry.js +3 -3
  54. package/dist/setup-plugin-api.js +1 -2
  55. package/node_modules/@slack/bolt/node_modules/@types/node/README.md +1 -1
  56. package/node_modules/@slack/bolt/node_modules/@types/node/package.json +2 -2
  57. package/node_modules/@slack/bolt/node_modules/@types/node/util.d.ts +6 -3
  58. package/node_modules/@slack/bolt/node_modules/content-disposition/README.md +105 -35
  59. package/node_modules/@slack/bolt/node_modules/content-disposition/dist/index.d.ts +72 -0
  60. package/node_modules/@slack/bolt/node_modules/content-disposition/dist/index.js +388 -0
  61. package/node_modules/@slack/bolt/node_modules/content-disposition/dist/index.js.map +1 -0
  62. package/node_modules/@slack/bolt/node_modules/content-disposition/package.json +31 -19
  63. package/node_modules/@slack/bolt/node_modules/content-type/README.md +34 -57
  64. package/node_modules/@slack/bolt/node_modules/content-type/package.json +35 -25
  65. package/node_modules/@slack/bolt/node_modules/express/Readme.md +15 -9
  66. package/node_modules/@slack/bolt/node_modules/express/lib/application.js +2 -2
  67. package/node_modules/@slack/bolt/node_modules/express/lib/request.js +32 -19
  68. package/node_modules/@slack/bolt/node_modules/express/lib/response.js +27 -30
  69. package/node_modules/@slack/bolt/node_modules/express/package.json +10 -10
  70. package/node_modules/@slack/bolt/node_modules/qs/.github/THREAT_MODEL.md +4 -2
  71. package/node_modules/@slack/bolt/node_modules/qs/CHANGELOG.md +38 -14
  72. package/node_modules/@slack/bolt/node_modules/qs/README.md +31 -3
  73. package/node_modules/@slack/bolt/node_modules/qs/dist/qs.js +20 -20
  74. package/node_modules/@slack/bolt/node_modules/qs/lib/parse.js +94 -4
  75. package/node_modules/@slack/bolt/node_modules/qs/lib/stringify.js +4 -4
  76. package/node_modules/@slack/bolt/node_modules/qs/lib/utils.js +130 -6
  77. package/node_modules/@slack/bolt/node_modules/qs/package.json +4 -4
  78. package/node_modules/@slack/bolt/node_modules/qs/test/parse.js +174 -0
  79. package/node_modules/@slack/bolt/node_modules/qs/test/stringify.js +263 -33
  80. package/node_modules/@slack/bolt/node_modules/qs/test/utils.js +184 -0
  81. package/node_modules/@slack/web-api/node_modules/@types/node/README.md +1 -1
  82. package/node_modules/@slack/web-api/node_modules/@types/node/package.json +2 -2
  83. package/node_modules/@slack/web-api/node_modules/@types/node/util.d.ts +6 -3
  84. package/node_modules/typebox/build/format/duration.d.mts +2 -2
  85. package/node_modules/typebox/build/format/duration.mjs +2 -2
  86. package/node_modules/typebox/build/format/idn_email.d.mts +1 -0
  87. package/node_modules/typebox/build/format/idn_email.mjs +1 -0
  88. package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -1
  89. package/node_modules/typebox/build/format/idn_hostname.mjs +1 -1
  90. package/node_modules/typebox/build/format/ipv4.d.mts +2 -2
  91. package/node_modules/typebox/build/format/ipv4.mjs +2 -2
  92. package/node_modules/typebox/build/format/ipv6.d.mts +1 -1
  93. package/node_modules/typebox/build/format/ipv6.mjs +1 -1
  94. package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
  95. package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
  96. package/node_modules/typebox/build/schema/build.mjs +1 -0
  97. package/node_modules/typebox/build/schema/engine/_unique.d.mts +4 -2
  98. package/node_modules/typebox/build/schema/engine/_unique.mjs +7 -3
  99. package/node_modules/typebox/build/schema/engine/additionalItems.mjs +3 -3
  100. package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +0 -3
  101. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +15 -17
  102. package/node_modules/typebox/build/schema/engine/contains.mjs +3 -3
  103. package/node_modules/typebox/build/schema/engine/index.d.mts +1 -0
  104. package/node_modules/typebox/build/schema/engine/index.mjs +1 -0
  105. package/node_modules/typebox/build/schema/engine/items.mjs +7 -4
  106. package/node_modules/typebox/build/schema/engine/maxContains.mjs +2 -2
  107. package/node_modules/typebox/build/schema/engine/minContains.mjs +3 -3
  108. package/node_modules/typebox/build/schema/engine/oneOf.mjs +2 -2
  109. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +2 -2
  110. package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -2
  111. package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +2 -2
  112. package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +2 -2
  113. package/node_modules/typebox/build/system/hashing/hash.mjs +63 -34
  114. package/node_modules/typebox/build/system/locale/en_US.mjs +2 -1
  115. package/node_modules/typebox/build/system/memory/assign.d.mts +2 -8
  116. package/node_modules/typebox/build/system/memory/assign.mjs +13 -6
  117. package/node_modules/typebox/build/system/memory/clone.d.mts +4 -5
  118. package/node_modules/typebox/build/system/memory/clone.mjs +8 -96
  119. package/node_modules/typebox/build/system/memory/create.d.mts +1 -5
  120. package/node_modules/typebox/build/system/memory/create.mjs +18 -13
  121. package/node_modules/typebox/build/system/memory/deep.d.mts +2 -0
  122. package/node_modules/typebox/build/system/memory/deep.mjs +108 -0
  123. package/node_modules/typebox/build/system/memory/discard.d.mts +1 -1
  124. package/node_modules/typebox/build/system/memory/discard.mjs +9 -8
  125. package/node_modules/typebox/build/system/memory/finalize.d.mts +4 -0
  126. package/node_modules/typebox/build/system/memory/finalize.mjs +30 -0
  127. package/node_modules/typebox/build/system/memory/keys.d.mts +2 -0
  128. package/node_modules/typebox/build/system/memory/keys.mjs +8 -0
  129. package/node_modules/typebox/build/system/memory/update.d.mts +1 -4
  130. package/node_modules/typebox/build/system/memory/update.mjs +43 -16
  131. package/node_modules/typebox/build/type/engine/call/index.d.mts +1 -0
  132. package/node_modules/typebox/build/type/engine/call/index.mjs +1 -0
  133. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +2 -24
  134. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +2 -29
  135. package/node_modules/typebox/build/type/engine/evaluate/index.d.mts +1 -0
  136. package/node_modules/typebox/build/type/engine/evaluate/index.mjs +1 -0
  137. package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +5 -1
  138. package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +6 -1
  139. package/node_modules/typebox/build/type/engine/evaluate/property.d.mts +30 -0
  140. package/node_modules/typebox/build/type/engine/evaluate/property.mjs +29 -0
  141. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +1 -3
  142. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +1 -4
  143. package/node_modules/typebox/build/type/engine/object/from_intersect.d.mts +2 -2
  144. package/node_modules/typebox/build/type/engine/object/from_intersect.mjs +2 -2
  145. package/node_modules/typebox/build/type/engine/object/from_union.d.mts +2 -2
  146. package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
  147. package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +1 -3
  148. package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +1 -4
  149. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +1 -3
  150. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +1 -4
  151. package/node_modules/typebox/build/type/engine/this/index.d.mts +1 -0
  152. package/node_modules/typebox/build/type/engine/this/index.mjs +1 -0
  153. package/node_modules/typebox/build/value/clone/clone.d.mts +4 -3
  154. package/node_modules/typebox/build/value/clone/clone.mjs +5 -7
  155. package/node_modules/typebox/build/value/repair/from_cyclic.d.mts +2 -0
  156. package/node_modules/typebox/build/value/repair/from_cyclic.mjs +6 -0
  157. package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +25 -14
  158. package/node_modules/typebox/package.json +1 -1
  159. package/node_modules/typebox/readme.md +1 -1
  160. package/node_modules/undici/docs/docs/api/Interceptors.md +15 -2
  161. package/node_modules/undici/lib/dispatcher/client-h2.js +78 -3
  162. package/node_modules/undici/lib/dispatcher/pool-base.js +20 -3
  163. package/node_modules/undici/package.json +3 -3
  164. package/node_modules/undici/types/api.d.ts +1 -1
  165. package/node_modules/undici/types/utility.d.ts +4 -4
  166. package/node_modules/zod/package.json +1 -1
  167. package/node_modules/zod/src/v4/classic/tests/array.test.ts +27 -0
  168. package/node_modules/zod/src/v4/classic/tests/map.test.ts +7 -0
  169. package/node_modules/zod/src/v4/classic/tests/set.test.ts +6 -0
  170. package/node_modules/zod/src/v4/core/compile.ts +9 -0
  171. package/node_modules/zod/src/v4/core/schemas.ts +35 -1
  172. package/node_modules/zod/src/v4/core/util.ts +13 -0
  173. package/node_modules/zod/src/v4/core/versions.ts +1 -1
  174. package/node_modules/zod/v4/core/compile.cjs +8 -0
  175. package/node_modules/zod/v4/core/compile.js +8 -0
  176. package/node_modules/zod/v4/core/schemas.cjs +30 -0
  177. package/node_modules/zod/v4/core/schemas.d.cts +3 -1
  178. package/node_modules/zod/v4/core/schemas.d.ts +3 -1
  179. package/node_modules/zod/v4/core/schemas.js +30 -0
  180. package/node_modules/zod/v4/core/util.cjs +15 -0
  181. package/node_modules/zod/v4/core/util.d.cts +2 -0
  182. package/node_modules/zod/v4/core/util.d.ts +2 -0
  183. package/node_modules/zod/v4/core/util.js +14 -0
  184. package/node_modules/zod/v4/core/versions.cjs +1 -1
  185. package/node_modules/zod/v4/core/versions.js +1 -1
  186. package/openclaw.plugin.json +6 -30
  187. package/package.json +7 -7
  188. package/dist/.setup/action-runtime.runtime-vLxx_7s2.mjs +0 -2
  189. package/dist/.setup/http-C9sM-FXe.mjs +0 -2
  190. package/dist/.setup/plugin-routes-D4qozHVn.mjs +0 -22
  191. package/dist/.setup/probe-IiHogLQN.mjs +0 -694
  192. package/dist/.setup/registry-DizWcnNp.mjs +0 -36
  193. package/dist/.setup/runtime-setter-api-CMFvhrAr.mjs +0 -3
  194. package/dist/.setup/secret-contract-api-DK9gZldc.mjs +0 -3
  195. package/dist/.setup/setup-plugin-api-BGD1TYnK.mjs +0 -3
  196. package/dist/.setup/shared-BhJHIZs1.mjs +0 -259
  197. package/dist/http-routes-api.js +0 -2
  198. package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/LICENSE +0 -22
  199. package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/README.md +0 -71
  200. package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/package.json +0 -52
  201. package/node_modules/@slack/bolt/node_modules/content-disposition/index.js +0 -536
  202. package/node_modules/@slack/bolt/node_modules/content-type/HISTORY.md +0 -29
  203. package/node_modules/@slack/bolt/node_modules/content-type/index.js +0 -225
  204. package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/LICENSE +0 -22
  205. package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/README.md +0 -71
  206. package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/dist/index.d.ts +0 -46
  207. package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/dist/index.js +0 -176
  208. package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/dist/index.js.map +0 -1
  209. package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/package.json +0 -52
  210. package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/LICENSE +0 -22
  211. package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/README.md +0 -71
  212. package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.d.ts +0 -46
  213. package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.js +0 -176
  214. package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.js.map +0 -1
  215. package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/package.json +0 -52
  216. package/node_modules/typebox/build/system/memory/freeze.d.mts +0 -4
  217. package/node_modules/typebox/build/system/memory/freeze.mjs +0 -6
  218. /package/node_modules/@slack/bolt/node_modules/{body-parser/node_modules/content-type → content-type}/dist/index.d.ts +0 -0
  219. /package/node_modules/@slack/bolt/node_modules/{body-parser/node_modules/content-type → content-type}/dist/index.js +0 -0
  220. /package/node_modules/@slack/bolt/node_modules/{body-parser/node_modules/content-type → content-type}/dist/index.js.map +0 -0
@@ -0,0 +1,29 @@
1
+ // deno-fmt-ignore-file
2
+ import { IsOptional } from '../../types/_optional.mjs';
3
+ import { IsReadonly } from '../../types/_readonly.mjs';
4
+ import { AddOptionalAction } from '../optional/instantiate_add.mjs';
5
+ import { AddReadonlyAction } from '../readonly/instantiate_add.mjs';
6
+ import { RemoveOptionalAction } from '../optional/instantiate_remove.mjs';
7
+ import { RemoveReadonlyAction } from '../readonly/instantiate_remove.mjs';
8
+ import { EvaluateIntersect, EvaluateUnion } from './evaluate.mjs';
9
+ export function EvaluatePropertyIntersect(left, right) {
10
+ const isReadonly = IsReadonly(left) && IsReadonly(right);
11
+ const isOptional = IsOptional(left) && IsOptional(right);
12
+ const evaluated = EvaluateIntersect([left, right]);
13
+ const property = RemoveReadonlyAction(RemoveOptionalAction(evaluated, {}), {});
14
+ return (isReadonly && isOptional ? AddReadonlyAction(AddOptionalAction(property, {}), {}) :
15
+ isReadonly ? AddReadonlyAction(property, {}) :
16
+ isOptional ? AddOptionalAction(property, {}) :
17
+ property);
18
+ }
19
+ export function EvaluatePropertyUnion(left, right) {
20
+ const isReadonly = IsReadonly(left) || IsReadonly(right);
21
+ const isOptional = IsOptional(left) || IsOptional(right);
22
+ const leftProperty = RemoveReadonlyAction(RemoveOptionalAction(left, {}), {});
23
+ const rightProperty = RemoveReadonlyAction(RemoveOptionalAction(right, {}), {});
24
+ const property = EvaluateUnion([leftProperty, rightProperty]);
25
+ return (isReadonly && isOptional ? AddReadonlyAction(AddOptionalAction(property, {}), {}) :
26
+ isReadonly ? AddReadonlyAction(property, {}) :
27
+ isOptional ? AddOptionalAction(property, {}) :
28
+ property);
29
+ }
@@ -2,9 +2,7 @@ import { type TSchema, type TSchemaOptions } from '../../types/schema.mjs';
2
2
  import { type TProperties } from '../../types/properties.mjs';
3
3
  import { type TImmutable } from '../../types/_immutable.mjs';
4
4
  import { type TState, type TInstantiateType } from '../instantiate.mjs';
5
- type TAddImmutableOperation<Type extends TSchema, Result extends TSchema = '~immutable' extends keyof Type ? Type : TImmutable<Type>> = Result;
6
- export type TAddImmutableAction<Type extends TSchema, Result extends TSchema = TAddImmutableOperation<Type>> = Result;
5
+ export type TAddImmutableAction<Type extends TSchema, Result extends TSchema = '~immutable' extends keyof Type ? Type : TImmutable<Type>> = Result;
7
6
  export declare function AddImmutableAction<Type extends TSchema>(type: Type, options: TSchemaOptions): TAddImmutableAction<Type>;
8
7
  export type TAddImmutableInstantiate<Context extends TProperties, State extends TState, Type extends TSchema, InstantiateType extends TSchema = TInstantiateType<Context, State, Type>> = TAddImmutableAction<InstantiateType>;
9
8
  export declare function AddImmutableInstantiate<Context extends TProperties, State extends TState, Type extends TSchema>(context: Context, state: State, type: Type, options: TSchemaOptions): TAddImmutableInstantiate<Context, State, Type>;
10
- export {};
@@ -1,11 +1,8 @@
1
1
  // deno-fmt-ignore-file
2
2
  import { Memory } from '../../../system/memory/index.mjs';
3
3
  import { InstantiateType } from '../instantiate.mjs';
4
- function AddImmutableOperation(type) {
5
- return Memory.Update(type, { '~immutable': true }, {});
6
- }
7
4
  export function AddImmutableAction(type, options) {
8
- const result = Memory.Update(AddImmutableOperation(type), {}, options);
5
+ const result = Memory.Update(type, { '~immutable': true }, options);
9
6
  return result;
10
7
  }
11
8
  export function AddImmutableInstantiate(context, state, type, options) {
@@ -2,13 +2,13 @@ import { Memory } from '../../../system/memory/index.mjs';
2
2
  import { type TSchema } from '../../types/schema.mjs';
3
3
  import { type TProperties } from '../../types/properties.mjs';
4
4
  import { type TFromType } from './from_type.mjs';
5
- import { type TEvaluateIntersect } from '../evaluate/evaluate.mjs';
5
+ import { type TEvaluatePropertyIntersect } from '../evaluate/property.mjs';
6
6
  type TCollapseIntersectProperties<Left extends TProperties, Right extends TProperties, LeftKeys extends keyof Left = Exclude<keyof Left, keyof Right>, RightKeys extends keyof Right = Exclude<keyof Right, keyof Left>, SharedKeys extends keyof Left & keyof Right = Extract<keyof Left, keyof Right>, LeftProperties extends TProperties = {
7
7
  [Key in LeftKeys]: Left[Key];
8
8
  }, RightProperties extends TProperties = {
9
9
  [Key in RightKeys]: Right[Key];
10
10
  }, SharedProperties extends TProperties = {
11
- [Key in SharedKeys]: TEvaluateIntersect<[Left[Key], Right[Key]]>;
11
+ [Key in SharedKeys]: TEvaluatePropertyIntersect<Left[Key], Right[Key]>;
12
12
  }, Unique extends TProperties = Memory.TAssign<LeftProperties, RightProperties>, Shared extends TProperties = Memory.TAssign<Unique, SharedProperties>> = Shared;
13
13
  export type TFromIntersect<Types extends TSchema[], Result extends TProperties = {}> = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? TFromIntersect<Right, TCollapseIntersectProperties<Result, TFromType<Left>>> : {
14
14
  [Key in keyof Result]: Result[Key];
@@ -3,14 +3,14 @@
3
3
  import { Memory } from '../../../system/memory/index.mjs';
4
4
  import { Guard } from '../../../guard/index.mjs';
5
5
  import { FromType } from './from_type.mjs';
6
- import { EvaluateIntersect } from '../evaluate/evaluate.mjs';
6
+ import { EvaluatePropertyIntersect } from '../evaluate/property.mjs';
7
7
  function CollapseIntersectProperties(left, right) {
8
8
  const leftKeys = Guard.Keys(left).filter((key) => !Guard.HasPropertyKey(right, key));
9
9
  const rightKeys = Guard.Keys(right).filter((key) => !Guard.HasPropertyKey(left, key));
10
10
  const sharedKeys = Guard.Keys(left).filter((key) => Guard.HasPropertyKey(right, key));
11
11
  const leftProperties = leftKeys.reduce((result, key) => ({ ...result, [key]: left[key] }), {});
12
12
  const rightProperties = rightKeys.reduce((result, key) => ({ ...result, [key]: right[key] }), {});
13
- const sharedProperties = sharedKeys.reduce((result, key) => ({ ...result, [key]: EvaluateIntersect([left[key], right[key]]) }), {});
13
+ const sharedProperties = sharedKeys.reduce((result, key) => ({ ...result, [key]: EvaluatePropertyIntersect(left[key], right[key]) }), {});
14
14
  const unique = Memory.Assign(leftProperties, rightProperties);
15
15
  const shared = Memory.Assign(unique, sharedProperties);
16
16
  return shared;
@@ -1,10 +1,10 @@
1
1
  import { type TUnreachable } from '../../../system/unreachable/index.mjs';
2
2
  import { type TSchema } from '../../types/schema.mjs';
3
3
  import { type TProperties } from '../../types/properties.mjs';
4
- import { type TEvaluateUnion } from '../evaluate/evaluate.mjs';
4
+ import { type TEvaluatePropertyUnion } from '../evaluate/property.mjs';
5
5
  import { type TFromType } from './from_type.mjs';
6
6
  type TCollapseUnionProperties<Left extends TProperties, Right extends TProperties, SharedKeys extends PropertyKey = keyof Left & keyof Right, Result extends TProperties = {
7
- [Key in SharedKeys]: TEvaluateUnion<[Left[Key], Right[Key]]>;
7
+ [Key in SharedKeys]: TEvaluatePropertyUnion<Left[Key], Right[Key]>;
8
8
  }> = Result;
9
9
  type TReduceVariants<Types extends TSchema[], Result extends TProperties> = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? TReduceVariants<Right, TCollapseUnionProperties<Result, TFromType<Left>>> : Result);
10
10
  export type TFromUnion<Types extends TSchema[]> = (Types extends [infer Left extends TSchema, ...infer Right extends TSchema[]] ? TReduceVariants<Right, TFromType<Left>> : TUnreachable);
@@ -1,12 +1,12 @@
1
1
  // deno-fmt-ignore-file
2
2
  import { Guard } from '../../../guard/index.mjs';
3
3
  import { Unreachable } from '../../../system/unreachable/index.mjs';
4
- import { EvaluateUnion } from '../evaluate/evaluate.mjs';
4
+ import { EvaluatePropertyUnion } from '../evaluate/property.mjs';
5
5
  import { FromType } from './from_type.mjs';
6
6
  function CollapseUnionProperties(left, right) {
7
7
  const sharedKeys = Guard.Keys(left).filter((key) => key in right);
8
8
  const result = sharedKeys.reduce((result, key) => {
9
- return { ...result, [key]: EvaluateUnion([left[key], right[key]]) };
9
+ return { ...result, [key]: EvaluatePropertyUnion(left[key], right[key]) };
10
10
  }, {});
11
11
  return result;
12
12
  }
@@ -2,9 +2,7 @@ import { type TSchema, type TSchemaOptions } from '../../types/schema.mjs';
2
2
  import { type TProperties } from '../../types/properties.mjs';
3
3
  import { type TOptional } from '../../types/_optional.mjs';
4
4
  import { type TState, type TInstantiateType } from '../instantiate.mjs';
5
- type TAddOptionalOperation<Type extends TSchema, Result extends TSchema = `~optional` extends keyof Type ? Type : TOptional<Type>> = Result;
6
- export type TAddOptionalAction<Type extends TSchema, Result extends TSchema = TAddOptionalOperation<Type>> = Result;
5
+ export type TAddOptionalAction<Type extends TSchema, Result extends TSchema = '~optional' extends keyof Type ? Type : TOptional<Type>> = Result;
7
6
  export declare function AddOptionalAction<Type extends TSchema>(type: Type, options: TSchemaOptions): TAddOptionalAction<Type>;
8
7
  export type TAddOptionalInstantiate<Context extends TProperties, State extends TState, Type extends TSchema, InstantiateType extends TSchema = TInstantiateType<Context, State, Type>> = TAddOptionalAction<InstantiateType>;
9
8
  export declare function AddOptionalInstantiate<Context extends TProperties, State extends TState, Type extends TSchema>(context: Context, state: State, type: Type, options: TSchemaOptions): TAddOptionalInstantiate<Context, State, Type>;
10
- export {};
@@ -1,11 +1,8 @@
1
1
  // deno-fmt-ignore-file
2
2
  import { Memory } from '../../../system/memory/index.mjs';
3
3
  import { InstantiateType } from '../instantiate.mjs';
4
- function AddOptionalOperation(type) {
5
- return Memory.Update(type, { '~optional': true }, {});
6
- }
7
4
  export function AddOptionalAction(type, options) {
8
- const result = Memory.Update(AddOptionalOperation(type), {}, options);
5
+ const result = Memory.Update(type, { '~optional': true }, options);
9
6
  return result;
10
7
  }
11
8
  export function AddOptionalInstantiate(context, state, type, options) {
@@ -2,9 +2,7 @@ import { type TSchema, type TSchemaOptions } from '../../types/schema.mjs';
2
2
  import { type TProperties } from '../../types/properties.mjs';
3
3
  import { type TReadonly } from '../../types/_readonly.mjs';
4
4
  import { type TState, type TInstantiateType } from '../instantiate.mjs';
5
- type TAddReadonlyOperation<Type extends TSchema, Result extends TSchema = `~readonly` extends keyof Type ? Type : TReadonly<Type>> = Result;
6
- export type TAddReadonlyAction<Type extends TSchema, Result extends TSchema = TAddReadonlyOperation<Type>> = Result;
5
+ export type TAddReadonlyAction<Type extends TSchema, Result extends TSchema = '~readonly' extends keyof Type ? Type : TReadonly<Type>> = Result;
7
6
  export declare function AddReadonlyAction<Type extends TSchema>(type: Type, options: TSchemaOptions): TAddReadonlyAction<Type>;
8
7
  export type TAddReadonlyInstantiate<Context extends TProperties, State extends TState, Type extends TSchema, InstantiateType extends TSchema = TInstantiateType<Context, State, Type>> = TAddReadonlyAction<InstantiateType>;
9
8
  export declare function AddReadonlyInstantiate<Context extends TProperties, State extends TState, Type extends TSchema>(context: Context, state: State, type: Type, options: TSchemaOptions): TAddReadonlyInstantiate<Context, State, Type>;
10
- export {};
@@ -1,11 +1,8 @@
1
1
  // deno-fmt-ignore-file
2
2
  import { Memory } from '../../../system/memory/index.mjs';
3
3
  import { InstantiateType } from '../instantiate.mjs';
4
- function AddReadonlyOperation(type) {
5
- return Memory.Update(type, { '~readonly': true }, {});
6
- }
7
4
  export function AddReadonlyAction(type, options) {
8
- const result = Memory.Update(AddReadonlyOperation(type), {}, options);
5
+ const result = Memory.Update(type, { '~readonly': true }, options);
9
6
  return result;
10
7
  }
11
8
  export function AddReadonlyInstantiate(context, state, type, options) {
@@ -0,0 +1 @@
1
+ export * from './expand_this.mjs';
@@ -0,0 +1 @@
1
+ export * from './expand_this.mjs';
@@ -1,5 +1,6 @@
1
1
  /**
2
- * Returns a Clone of the given value. This function is similar to structuredClone()
3
- * but also supports deep cloning instances of Map, Set and TypeArray.
2
+ * Returns a deep Clone of the given value. This function is similar to `structuredClone()`,
3
+ * but also supports deep cloning `Map`, `Set`, and `TypeArray` instances. This function can also be used
4
+ * to clone TypeBox types while retaining their enumerable and non-enumerable properties.
4
5
  */
5
- export declare function Clone<Value extends unknown>(value: Value): Value;
6
+ export declare function Clone<Value extends unknown = unknown>(value: Value): Value;
@@ -1,12 +1,10 @@
1
1
  // deno-fmt-ignore-file
2
- import { Clone as SystemClone } from '../../system/memory/clone.mjs';
3
- // ------------------------------------------------------------------
4
- // Clone
5
- // ------------------------------------------------------------------
2
+ import { Deep } from '../../system/memory/deep.mjs';
6
3
  /**
7
- * Returns a Clone of the given value. This function is similar to structuredClone()
8
- * but also supports deep cloning instances of Map, Set and TypeArray.
4
+ * Returns a deep Clone of the given value. This function is similar to `structuredClone()`,
5
+ * but also supports deep cloning `Map`, `Set`, and `TypeArray` instances. This function can also be used
6
+ * to clone TypeBox types while retaining their enumerable and non-enumerable properties.
9
7
  */
10
8
  export function Clone(value) {
11
- return SystemClone(value);
9
+ return Deep(value);
12
10
  }
@@ -0,0 +1,2 @@
1
+ import { type TProperties, type TCyclic } from '../../type/index.mjs';
2
+ export declare function FromCyclic(context: TProperties, type: TCyclic, value: unknown): unknown;
@@ -0,0 +1,6 @@
1
+ // deno-fmt-ignore-file
2
+ import { Ref } from '../../type/index.mjs';
3
+ import { FromType } from './from_type.mjs';
4
+ export function FromCyclic(context, type, value) {
5
+ return FromType({ ...context, ...type.$defs }, Ref(type.$ref), value);
6
+ }
@@ -1,28 +1,27 @@
1
1
  // deno-fmt-ignore-file
2
2
  import Guard from '../../guard/index.mjs';
3
- import { IsArray, Array as _Array_, ArrayOptions } from '../../type/index.mjs';
4
- import { IsUnion, Union } from '../../type/index.mjs';
3
+ import { Memory } from '../../system/memory/index.mjs';
4
+ import { Array as _Array_, ArrayOptions, IsArray } from '../../type/index.mjs';
5
+ import { Intersect, IsIntersect } from '../../type/index.mjs';
5
6
  import { IsObject, Object as _Object_ } from '../../type/index.mjs';
6
- import { IsRecord, Record, RecordKey, RecordValue } from '../../type/index.mjs';
7
+ import { IsRecord, Record, RecordPattern, RecordValue } from '../../type/index.mjs';
8
+ import { String } from '../../type/index.mjs';
7
9
  import { IsTuple, Tuple } from '../../type/index.mjs';
8
- import { IsIntersect, Intersect } from '../../type/index.mjs';
10
+ import { IsUnion, Union } from '../../type/index.mjs';
9
11
  import { Priority } from '../../type/index.mjs';
10
12
  // ------------------------------------------------------------------
11
13
  // Modifiers (Mutable)
12
14
  //
13
15
  // Prioritized types lose `~modifier` properties and additional constraints
14
16
  // (e.g. additionalProperties) during the mapping phase and need to be
15
- // reassigned afterward. This is a fast mutable assignment to handle that,
16
- // but we should consider a more general solution. (review)
17
+ // reassigned afterward. We previously used a mutable assignment on this
18
+ // function, however `immutableTypes: true` caused errors. We use the
19
+ // Memory.Assign to ensure modifiers are retained and we preserve type
20
+ // configurations (review)
17
21
  //
18
22
  // ------------------------------------------------------------------
19
23
  function Modifiers(type, next) {
20
- for (const key of Guard.Keys(type)) {
21
- if (Guard.HasPropertyKey(next, key))
22
- continue;
23
- next[key] = type[key];
24
- }
25
- return next;
24
+ return Memory.Assign(type, next);
26
25
  }
27
26
  // ------------------------------------------------------------------
28
27
  // Properties
@@ -34,6 +33,18 @@ function FromProperties(properties) {
34
33
  return result;
35
34
  }
36
35
  // ------------------------------------------------------------------
36
+ // FromRecordKey
37
+ //
38
+ // This is required because RecordKey(...) returns a canonical
39
+ // decoded type derived from the pattern. When the pattern is an
40
+ // unrecognized user-defined one, the result falls through to
41
+ // TString (^.*$) and the user-defined pattern is lost. This
42
+ // function ensures the exact pattern is retained.
43
+ // ------------------------------------------------------------------
44
+ function FromRecordKey(type) {
45
+ return String({ pattern: RecordPattern(type) });
46
+ }
47
+ // ------------------------------------------------------------------
37
48
  // PriorityTypes
38
49
  // ------------------------------------------------------------------
39
50
  function FromPriorityTypes(types) {
@@ -43,7 +54,7 @@ function FromPriorityTypes(types) {
43
54
  // Types
44
55
  // ------------------------------------------------------------------
45
56
  function FromTypes(types) {
46
- return types.map(type => FromType(type));
57
+ return types.map((type) => FromType(type));
47
58
  }
48
59
  // ------------------------------------------------------------------
49
60
  // Type
@@ -53,7 +64,7 @@ function FromType(type) {
53
64
  IsIntersect(type) ? Intersect(FromTypes(type.allOf)) :
54
65
  IsUnion(type) ? Union(FromPriorityTypes(type.anyOf)) :
55
66
  IsObject(type) ? _Object_(FromProperties(type.properties)) :
56
- IsRecord(type) ? Record(RecordKey(type), FromType(RecordValue(type))) :
67
+ IsRecord(type) ? Record(FromRecordKey(type), FromType(RecordValue(type))) :
57
68
  IsTuple(type) ? Tuple(FromTypes(type.items)) :
58
69
  type);
59
70
  return Modifiers(type, next);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "typebox",
3
3
  "description": "Json Schema Type Builder with Static Type Resolution for TypeScript",
4
- "version": "1.3.35",
4
+ "version": "1.4.2",
5
5
  "keywords": [
6
6
  "typescript",
7
7
  "jsonschema"
@@ -196,7 +196,7 @@ const result = Vector.Parse({ x: 1, y: 0, z: 0 }) // const result: {
196
196
 
197
197
  [JSON Schema Test Suite](https://github.com/json-schema-org/JSON-Schema-Test-Suite) | [JSON Schema Compliance Suite](https://github.com/sinclairzx81/json-schema-compliance-suite)
198
198
 
199
- TypeBox supports all versions of JSON Schema and is heavily tested against the official JSON Schema Test Suite. It prioritizes compatibility with modern specifications while also maintaining broad support for legacy versions provided their semantics are not in conflict with modern specifications.
199
+ TypeBox supports all versions of JSON Schema and is heavily tested against the official JSON Schema Test Suite. It has high compatibility with modern specifications while also offering broad support for legacy versions if their semantics are not in conflict with modern specifications.
200
200
 
201
201
  | Spec | 3 | 4 | 6 | 7 | 2019-09 | 2020-12 | v1 |
202
202
  |:-----|:--|:--|:--|:--|:--|:--|:--|
@@ -341,8 +341,21 @@ backing store.
341
341
 
342
342
  **Parameters**
343
343
 
344
- * `opts` {CacheHandler.CacheOptions} (optional) See the
345
- [`CacheStore`](./CacheStore.md) documentation for accepted fields.
344
+ * `opts` {Object} (optional)
345
+ * `store` {CacheStore} The store that cached responses are kept in. See
346
+ [`CacheStore`](./CacheStore.md). **Default:** a new `MemoryCacheStore`.
347
+ * `methods` {string[]} The HTTP methods to cache. Only safe methods are
348
+ allowed (`GET`, `HEAD`, `OPTIONS`, `TRACE`) and at least one is required.
349
+ **Default:** `['GET']`.
350
+ * `cacheByDefault` {number} RFC 9111 allows caching responses that are not
351
+ explicitly marked as cacheable or not cacheable. Set this to cache such
352
+ responses. **Default:** `undefined`.
353
+ * `type` {string} Whether the cache is `'shared'` or `'private'`, which
354
+ decides how directives such as `s-maxage` and `private` are applied.
355
+ **Default:** `'shared'`.
356
+ * `origins` {(string|RegExp)[]} Only requests to these origins are cached.
357
+ Strings are compared case-insensitively. **Default:** `undefined` (all
358
+ origins are cached).
346
359
 
347
360
  **Returns:** {Dispatcher.DispatcherComposeInterceptor}
348
361
 
@@ -61,6 +61,12 @@ const kRefusedStreamRetry = Symbol('refused stream retry')
61
61
  // event loop.
62
62
  const MAX_GOAWAY_REPLAY_ATTEMPTS = 1
63
63
 
64
+ // Lower bound on how long a liveness PING may take to be acked. Stream
65
+ // timeouts can be tiny (tens of ms), while an ack on a live connection can take
66
+ // longer than that on a loaded event loop; without a floor a slow but healthy
67
+ // connection would be torn down.
68
+ const MIN_PROBE_TIMEOUT = 1e3
69
+
64
70
  let extractBody
65
71
 
66
72
  /** @type {import('http2')} */
@@ -277,6 +283,9 @@ function connectH2 (client, socket) {
277
283
  // Armed while the peer advertises MAX_CONCURRENT_STREAMS = 0 and we have
278
284
  // work that cannot start. See setNoStreamsTimeout.
279
285
  noStreamsTimeout: null,
286
+ // Armed while a PING checks whether the peer is still there after a
287
+ // stream timed out. See probeHttp2Session.
288
+ probeTimeout: null,
280
289
  // Sockets start out ref'd. Session ref/unref proxies to the socket, so a
281
290
  // single cached flag lets us skip redundant uv ref/unref calls, provided
282
291
  // every ref/unref of the session or its socket goes through
@@ -361,6 +370,11 @@ function connectH2 (client, socket) {
361
370
  return true
362
371
  }
363
372
 
373
+ // Do not open streams on a connection that may be dead.
374
+ if (session[kHTTP2SessionState].probeTimeout != null) {
375
+ return true
376
+ }
377
+
364
378
  if (client[kRunning] >= client[kMaxConcurrentStreams]) {
365
379
  return true
366
380
  }
@@ -494,6 +508,60 @@ function onNoStreamsTimeout (session) {
494
508
  resetHttp2Session(session, err)
495
509
  }
496
510
 
511
+ // A stream timeout only resets that stream, unlike HTTP/1.1 which destroys the
512
+ // socket. If the connection itself silently died (dropped by a NAT or load
513
+ // balancer, a hung peer), every new stream would time out in turn and the
514
+ // session would never be replaced. Ask the peer for a PING ack within the
515
+ // timeout that just fired (but at least MIN_PROBE_TIMEOUT): if it answers, only
516
+ // that request was slow; if not, drop the session so queued requests move to a
517
+ // fresh connection.
518
+ function probeHttp2Session (session, timeout) {
519
+ const state = session[kHTTP2SessionState]
520
+
521
+ if (state.probeTimeout != null || session.closed || session.destroyed) {
522
+ return
523
+ }
524
+
525
+ try {
526
+ session.ping(onHttp2ProbeAck.bind(session))
527
+ } catch {
528
+ // The session is going away on its own.
529
+ return
530
+ }
531
+
532
+ state.probeTimeout = setTimeout(onHttp2ProbeTimeout, Math.max(timeout, MIN_PROBE_TIMEOUT), session).unref()
533
+ }
534
+
535
+ function clearHttp2ProbeTimeout (session) {
536
+ const state = session[kHTTP2SessionState]
537
+
538
+ if (state?.probeTimeout != null) {
539
+ clearTimeout(state.probeTimeout)
540
+ state.probeTimeout = null
541
+ }
542
+ }
543
+
544
+ function onHttp2ProbeAck () {
545
+ if (this[kHTTP2SessionState].probeTimeout == null) {
546
+ return
547
+ }
548
+
549
+ clearHttp2ProbeTimeout(this)
550
+ this[kClient][kResume]()
551
+ }
552
+
553
+ function onHttp2ProbeTimeout (session) {
554
+ session[kHTTP2SessionState].probeTimeout = null
555
+
556
+ if (session.closed || session.destroyed) {
557
+ return
558
+ }
559
+
560
+ const err = new SocketError('HTTP/2: connection unresponsive', util.getSocketInfo(session[kSocket]))
561
+ session[kError] = err
562
+ resetHttp2Session(session, err)
563
+ }
564
+
497
565
  function clearHttp2IdleTimeout (session) {
498
566
  const state = session[kHTTP2SessionState]
499
567
 
@@ -686,6 +754,7 @@ function onHttp2SessionGoAway (errorCode, lastStreamID) {
686
754
 
687
755
  clearHttp2IdleTimeout(this)
688
756
  clearNoStreamsTimeout(this)
757
+ clearHttp2ProbeTimeout(this)
689
758
 
690
759
  if (!this.closed && !this.destroyed) {
691
760
  this.close()
@@ -711,6 +780,7 @@ function onHttp2SessionClose () {
711
780
 
712
781
  clearHttp2IdleTimeout(this)
713
782
  clearNoStreamsTimeout(this)
783
+ clearHttp2ProbeTimeout(this)
714
784
 
715
785
  if (state.ping.interval != null) {
716
786
  clearInterval(state.ping.interval)
@@ -1610,9 +1680,14 @@ function onTimeout () {
1610
1680
  // Remove self so timeout doesn't fire again after we handle it
1611
1681
  stream.off('timeout', onTimeout)
1612
1682
 
1613
- const err = state.responseReceived
1614
- ? new BodyTimeoutError(`HTTP/2: "stream timeout after ${state.bodyTimeout}"`)
1615
- : new HeadersTimeoutError(`HTTP/2: "headers timeout after ${state.headersTimeout}"`)
1683
+ const { responseReceived, session, bodyTimeout, headersTimeout } = state
1684
+ const err = responseReceived
1685
+ ? new BodyTimeoutError(`HTTP/2: "stream timeout after ${bodyTimeout}"`)
1686
+ : new HeadersTimeoutError(`HTTP/2: "headers timeout after ${headersTimeout}"`)
1687
+
1688
+ // Probe before aborting: completing the request resumes the queue, which
1689
+ // must not open new streams until the peer has proven it is alive.
1690
+ probeHttp2Session(session, responseReceived ? bodyTimeout : headersTimeout)
1616
1691
  state.abort(err)
1617
1692
  }
1618
1693
 
@@ -1,5 +1,6 @@
1
1
  'use strict'
2
2
 
3
+ const { AsyncResource } = require('node:async_hooks')
3
4
  const { PoolStats } = require('../util/stats.js')
4
5
  const DispatcherBase = require('./dispatcher-base')
5
6
  const FixedQueue = require('./fixed-queue')
@@ -26,6 +27,22 @@ const kRetiring = Symbol('retiring clients')
26
27
  // Closes every live client, including clients that have been
27
28
  // taken out of rotation but are still finishing their own
28
29
  // requests.
30
+ // Requests that wait in the Pool queue are dispatched later from whichever
31
+ // callback drains the queue (another request's connect, drain, ...). Capture
32
+ // the caller's async context so Client#dispatch, and the diagnostics channel
33
+ // events it publishes, still run in it.
34
+ class QueuedRequest extends AsyncResource {
35
+ constructor (opts, handler) {
36
+ super('UNDICI_POOL_QUEUED_REQUEST')
37
+ this.opts = opts
38
+ this.handler = handler
39
+ }
40
+
41
+ dispatch (dispatcher) {
42
+ return this.runInAsyncScope(dispatcher.dispatch, dispatcher, this.opts, this.handler)
43
+ }
44
+ }
45
+
29
46
  function closeClients (pool) {
30
47
  const closeAll = []
31
48
  for (let i = 0; i < pool[kClients].length; i++) {
@@ -69,7 +86,7 @@ class PoolBase extends DispatcherBase {
69
86
  break
70
87
  }
71
88
  this[kQueued]--
72
- needDrain = !client.dispatch(item.opts, item.handler)
89
+ needDrain = !item.dispatch(client)
73
90
  }
74
91
 
75
92
  client[kNeedDrain] = needDrain
@@ -114,7 +131,7 @@ class PoolBase extends DispatcherBase {
114
131
  const item = queue.shift()
115
132
  this[kQueued]--
116
133
 
117
- if (!dispatcher.dispatch(item.opts, item.handler)) {
134
+ if (!item.dispatch(dispatcher)) {
118
135
  dispatcher[kNeedDrain] = true
119
136
  this[kOnClientBusy](dispatcher)
120
137
  hasDispatcher = this[kHasDispatcher]()
@@ -228,7 +245,7 @@ class PoolBase extends DispatcherBase {
228
245
 
229
246
  if (!dispatcher) {
230
247
  this[kNeedDrain] = true
231
- this[kQueue].push({ opts, handler })
248
+ this[kQueue].push(new QueuedRequest(opts, handler))
232
249
  this[kQueued]++
233
250
  } else if (!dispatcher.dispatch(opts, handler)) {
234
251
  dispatcher[kNeedDrain] = true
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "undici",
3
- "version": "8.12.2",
3
+ "version": "8.12.3",
4
4
  "description": "An HTTP/1.1 client, written from scratch for Node.js",
5
5
  "homepage": "https://undici.nodejs.org",
6
6
  "bugs": {
@@ -122,12 +122,12 @@
122
122
  "cross-env": "^10.0.0",
123
123
  "dns-packet": "^5.4.0",
124
124
  "esbuild": "^0.28.0",
125
- "eslint": "^9.9.0",
125
+ "eslint": "^10.12.0",
126
126
  "fast-check": "^4.1.1",
127
127
  "husky": "^9.0.7",
128
128
  "jest": "^30.0.5",
129
129
  "jsondiffpatch": "^0.7.3",
130
- "neostandard": "^0.13.0",
130
+ "neostandard": "^0.14.0",
131
131
  "node-forge": "^1.3.1",
132
132
  "proxy": "^4.0.0",
133
133
  "tsd": "^0.33.0",
@@ -5,7 +5,7 @@ import Dispatcher from './dispatcher'
5
5
  /** Performs an HTTP request. */
6
6
  declare function request<TOpaque = null> (
7
7
  url: string | URL | UrlObject,
8
- options?: { dispatcher?: Dispatcher } & Omit<Dispatcher.RequestOptions<TOpaque>, 'origin' | 'path' | 'method'> & Partial<Pick<Dispatcher.RequestOptions, 'method'>>,
8
+ options?: { dispatcher?: Dispatcher } & Omit<Dispatcher.RequestOptions<TOpaque>, 'origin' | 'path' | 'method'> & Partial<Pick<Dispatcher.RequestOptions, 'method'>>
9
9
  ): Promise<Dispatcher.ResponseData<TOpaque>>
10
10
 
11
11
  /** A faster version of `request`. */
@@ -1,7 +1,7 @@
1
1
  type AutocompletePrimitiveBaseType<T> =
2
- T extends string ? string :
3
- T extends number ? number :
4
- T extends boolean ? boolean :
5
- never
2
+ T extends string ? string
3
+ : T extends number ? number
4
+ : T extends boolean ? boolean
5
+ : never
6
6
 
7
7
  export type Autocomplete<T> = T | (AutocompletePrimitiveBaseType<T> & Record<never, never>)
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zod",
3
- "version": "4.6.5",
3
+ "version": "4.6.7",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Colin McDonnell <zod@colinhacks.com>",
@@ -140,6 +140,33 @@ test("continue parsing despite array size error", () => {
140
140
  `);
141
141
  });
142
142
 
143
+ test("an upper size bound fails before any element is parsed", () => {
144
+ let parsed = 0;
145
+ const el = z.string().refine(() => ++parsed);
146
+ let refined = 0;
147
+ const schema = z
148
+ .array(el)
149
+ .max(2, "too many")
150
+ .refine(() => ++refined);
151
+ expect(schema.safeParse([1, 2, 3]).error!.issues).toMatchObject([{ code: "too_big", path: [], message: "too many" }]);
152
+ expect(z.array(el).length(2).safeParse(["a", "b", "c"]).error!.issues).toMatchObject([
153
+ { code: "too_big", exact: true },
154
+ ]);
155
+ expect(z.object({ a: z.array(el).max(1) }).safeParse({ a: [1, 2] }).error!.issues).toMatchObject([
156
+ { code: "too_big", path: ["a"] },
157
+ ]);
158
+ expect([parsed, refined]).toEqual([0, 0]);
159
+
160
+ // a check that may rewrite the value ends the gate
161
+ expect(
162
+ z
163
+ .array(z.number())
164
+ .overwrite((a) => a.slice(0, 2))
165
+ .max(2)
166
+ .parse([1, 2, 3])
167
+ ).toEqual([1, 2]);
168
+ });
169
+
143
170
  test("parse should fail given sparse array", () => {
144
171
  const schema = z.array(z.string()).nonempty().min(1).max(3);
145
172
  const result = schema.safeParse(new Array(3));