@openclaw/whatsapp 2026.9.3 → 2026.9.5

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 (269) hide show
  1. package/assets/activity.svg +40 -0
  2. package/assets/icon.png +0 -0
  3. package/dist/{accounts-CiKHiuEe.js → .setup/accounts-D_NGDjCx.mjs} +2 -2
  4. package/dist/{action-runtime-CRZLhN3f.js → .setup/action-runtime-DZZFamfl.mjs} +3 -3
  5. package/dist/{active-listener-BEjWsCNM.js → .setup/active-listener-CDjoX9QR.mjs} +2 -2
  6. package/dist/{agent-tools-login-B-2qZPzc.js → .setup/agent-tools-login-B6MAs75N.mjs} +2 -2
  7. package/dist/{approval-handler.runtime-DGJEaoqh.js → .setup/approval-handler.runtime-C0hzmMSj.mjs} +12 -12
  8. package/dist/{approval-reactions-DSFH6Mtx.js → .setup/approval-reactions-BnXw-UZI.mjs} +13 -13
  9. package/dist/{auth-store-ZWaclAbd.js → .setup/auth-store-Dh8a3cba.mjs} +5 -5
  10. package/dist/{channel-BeBrHPVa.js → .setup/channel-CSclZYjU.mjs} +21 -29
  11. package/dist/{channel-react-action-CHeJSG9F.js → .setup/channel-react-action-1iBiEnq7.mjs} +5 -5
  12. package/dist/.setup/channel.runtime-ddGY37w8.mjs +16 -0
  13. package/dist/.setup/channel.setup-CqUl8COe.mjs +5 -0
  14. package/dist/{connection-controller-DNp6U1NN.js → .setup/connection-controller-C60mU7j7.mjs} +5 -5
  15. package/dist/{connection-controller-runtime-context-DG0tuYuw.js → .setup/connection-controller-runtime-context-hgLJoRc8.mjs} +1 -1
  16. package/dist/{directory-config-CoWFw1zn.js → .setup/directory-config-BHPoBklt.mjs} +8 -8
  17. package/dist/{group-session-key-BmVDSPr1.js → .setup/group-session-key-D22hYMdE.mjs} +5 -5
  18. package/dist/.setup/legacy-session-surface-api-B2szjq4r.mjs +2 -0
  19. package/dist/{login-6j2iP9nR.js → .setup/login-2dmd1TfE.mjs} +5 -5
  20. package/dist/{login-qr-DRFgI6k1.js → .setup/login-qr-CgKtO_ef.mjs} +6 -6
  21. package/dist/{monitor-DNGfO3k0.js → .setup/monitor-BblvzLpX.mjs} +72 -89
  22. package/dist/.setup/normalize-DdsROMMa.mjs +2 -0
  23. package/dist/{normalize-target-CugRyONv.js → .setup/normalize-target-BGra1ZnM.mjs} +8 -30
  24. package/dist/{question-reactions-bbe0Qnjn.js → .setup/question-reactions-D3Zq9Gbn.mjs} +2 -2
  25. package/dist/{resolve-outbound-target-1GqbT1uX.js → .setup/resolve-outbound-target-C2eUvsTc.mjs} +1 -1
  26. package/dist/{send-BDDGPxav.js → .setup/send-C6jDmcL9.mjs} +7 -7
  27. package/dist/{send-api-C_Zn4Ij-.js → .setup/send-api-B4DOt2RJ.mjs} +7 -7
  28. package/dist/{session.runtime-Nsqaehbd.js → .setup/session.runtime-DcJuO42v.mjs} +1 -1
  29. package/dist/{setup-finalize-Bp-4QnVw.js → .setup/setup-finalize-BYEgU0hb.mjs} +6 -6
  30. package/dist/.setup/setup-plugin-api-CXfU-7vN.mjs +3 -0
  31. package/dist/{setup-surface-B5UnuLT_.js → .setup/setup-surface-Cd3wN5HD.mjs} +4 -4
  32. package/dist/{shared-D6cUWXiq.js → .setup/shared-C9OEtKgc.mjs} +48 -60
  33. package/dist/{socket-close-B3X9uerq.js → .setup/socket-close-CCVSFufF.mjs} +4 -4
  34. package/dist/{text-runtime-DyfmcATV.js → .setup/text-runtime-CHl0iPYe.mjs} +1 -1
  35. package/dist/action-runtime-api.js +1 -1
  36. package/dist/action-runtime.runtime.js +1 -1
  37. package/dist/agent-tools-api.js +4 -4
  38. package/dist/api.js +15 -15
  39. package/dist/auth-presence.js +1 -1
  40. package/dist/channel-config-api.js +1 -1
  41. package/dist/channel-plugin-api.js +1 -1
  42. package/dist/contract-api.js +5 -5
  43. package/dist/directory-contract-api.js +1 -1
  44. package/dist/doctor-contract-api.js +2 -2
  45. package/dist/legacy-session-surface-api.js +1 -1
  46. package/dist/light-runtime-api.js +4 -4
  47. package/dist/login-qr-runtime.js +1 -1
  48. package/dist/runtime-api.js +13 -13
  49. package/dist/runtime-setter-api.js +1 -1
  50. package/dist/security-contract-api.js +1 -1
  51. package/dist/setup-entry.js +3 -2
  52. package/dist/setup-plugin-api.js +1 -1
  53. package/node_modules/audio-decode/node_modules/@thi.ng/bitstream/README.md +1 -1
  54. package/node_modules/audio-decode/node_modules/@thi.ng/bitstream/package.json +5 -5
  55. package/node_modules/audio-decode/node_modules/@thi.ng/errors/README.md +1 -1
  56. package/node_modules/audio-decode/node_modules/@thi.ng/errors/package.json +5 -5
  57. package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/flac/dist/flac-decoder.min.js +1 -1
  58. package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/flac/dist/flac-decoder.min.js.map +1 -1
  59. package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/flac/package.json +1 -1
  60. package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/flac/src/FLACDecoder.js +6 -6
  61. package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/flac/src/FLACDecoderWebWorker.js +2 -2
  62. package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/dist/opus-ml-decoder.min.js +11603 -11540
  63. package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/dist/opus-ml-decoder.min.js.map +1 -1
  64. package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/package.json +1 -1
  65. package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/src/EmscriptenWasm.js +0 -0
  66. package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/types.d.ts +1 -5
  67. package/node_modules/audio-decode/node_modules/audio-type/audio-type.js +156 -2
  68. package/node_modules/audio-decode/node_modules/audio-type/package.json +23 -2
  69. package/node_modules/audio-decode/node_modules/audio-type/readme.md +40 -2
  70. package/node_modules/audio-decode/node_modules/ogg-opus-decoder/README.md +1 -1
  71. package/node_modules/audio-decode/node_modules/ogg-opus-decoder/dist/ogg-opus-decoder.min.js +3 -3
  72. package/node_modules/audio-decode/node_modules/ogg-opus-decoder/dist/ogg-opus-decoder.min.js.map +1 -1
  73. package/node_modules/audio-decode/node_modules/ogg-opus-decoder/dist/ogg-opus-decoder.opus-ml.min.js +0 -0
  74. package/node_modules/audio-decode/node_modules/ogg-opus-decoder/dist/ogg-opus-decoder.opus-ml.min.js.map +1 -1
  75. package/node_modules/audio-decode/node_modules/ogg-opus-decoder/package.json +8 -8
  76. package/node_modules/audio-decode/node_modules/ogg-opus-decoder/src/OggOpusDecoder.js +1 -1
  77. package/node_modules/audio-decode/node_modules/opus-decoder/README.md +1 -1
  78. package/node_modules/audio-decode/node_modules/opus-decoder/dist/opus-decoder.min.js +3 -3
  79. package/node_modules/audio-decode/node_modules/opus-decoder/dist/opus-decoder.min.js.map +1 -1
  80. package/node_modules/audio-decode/node_modules/opus-decoder/package.json +1 -1
  81. package/node_modules/audio-decode/node_modules/opus-decoder/types.d.ts +1 -5
  82. package/node_modules/baileys/node_modules/protobufjs/README.md +24 -17
  83. package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.js +124 -14
  84. package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
  85. package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
  86. package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
  87. package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.js +63 -9
  88. package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.js.map +1 -1
  89. package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.min.js +3 -3
  90. package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.min.js.map +1 -1
  91. package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.js +133 -18
  92. package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.js.map +1 -1
  93. package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.min.js +3 -3
  94. package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
  95. package/node_modules/baileys/node_modules/protobufjs/ext/descriptor.generated.d.ts +7 -0
  96. package/node_modules/baileys/node_modules/protobufjs/ext/descriptor.js +24 -0
  97. package/node_modules/baileys/node_modules/protobufjs/ext/protojson.js +14 -4
  98. package/node_modules/baileys/node_modules/protobufjs/ext/textformat.js +8 -4
  99. package/node_modules/baileys/node_modules/protobufjs/google/protobuf/descriptor.json +20 -1
  100. package/node_modules/baileys/node_modules/protobufjs/google/protobuf/descriptor.proto +14 -1
  101. package/node_modules/baileys/node_modules/protobufjs/index.d.ts +12 -0
  102. package/node_modules/baileys/node_modules/protobufjs/package.json +1 -1
  103. package/node_modules/baileys/node_modules/protobufjs/src/decoder.js +31 -2
  104. package/node_modules/baileys/node_modules/protobufjs/src/enum.js +10 -0
  105. package/node_modules/baileys/node_modules/protobufjs/src/object.js +5 -2
  106. package/node_modules/baileys/node_modules/protobufjs/src/parse.js +9 -4
  107. package/node_modules/baileys/node_modules/protobufjs/src/reader.js +61 -7
  108. package/node_modules/baileys/node_modules/protobufjs/src/type.js +10 -0
  109. package/node_modules/baileys/node_modules/protobufjs/src/wrappers.js +5 -1
  110. package/node_modules/typebox/build/compile/validator.d.mts +1 -1
  111. package/node_modules/typebox/build/compile/validator.mjs +1 -1
  112. package/node_modules/typebox/build/format/idna/idn-hostname.mjs +7 -5
  113. package/node_modules/typebox/build/format/iri.mjs +5 -1
  114. package/node_modules/typebox/build/guard/emit.mjs +2 -4
  115. package/node_modules/typebox/build/guard/guard.mjs +6 -18
  116. package/node_modules/typebox/build/guard/string.mjs +16 -24
  117. package/node_modules/typebox/build/schema/build.mjs +2 -2
  118. package/node_modules/typebox/build/schema/check.mjs +1 -1
  119. package/node_modules/typebox/build/schema/compile.d.mts +3 -2
  120. package/node_modules/typebox/build/schema/compile.mjs +8 -8
  121. package/node_modules/typebox/build/schema/engine/_context.d.mts +6 -7
  122. package/node_modules/typebox/build/schema/engine/_context.mjs +23 -15
  123. package/node_modules/typebox/build/schema/engine/_functions.d.mts +2 -2
  124. package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -1
  125. package/node_modules/typebox/build/schema/engine/_reducer.d.mts +3 -3
  126. package/node_modules/typebox/build/schema/engine/_refine.d.mts +5 -5
  127. package/node_modules/typebox/build/schema/engine/_refine.mjs +4 -7
  128. package/node_modules/typebox/build/schema/engine/_stack.d.mts +34 -16
  129. package/node_modules/typebox/build/schema/engine/_stack.mjs +148 -104
  130. package/node_modules/typebox/build/schema/engine/additionalItems.d.mts +4 -4
  131. package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +8 -8
  132. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +26 -18
  133. package/node_modules/typebox/build/schema/engine/allOf.d.mts +4 -4
  134. package/node_modules/typebox/build/schema/engine/allOf.mjs +3 -3
  135. package/node_modules/typebox/build/schema/engine/anyOf.d.mts +4 -4
  136. package/node_modules/typebox/build/schema/engine/anyOf.mjs +5 -10
  137. package/node_modules/typebox/build/schema/engine/boolean.d.mts +4 -4
  138. package/node_modules/typebox/build/schema/engine/boolean.mjs +2 -6
  139. package/node_modules/typebox/build/schema/engine/const.d.mts +4 -4
  140. package/node_modules/typebox/build/schema/engine/const.mjs +2 -6
  141. package/node_modules/typebox/build/schema/engine/contains.d.mts +4 -4
  142. package/node_modules/typebox/build/schema/engine/contains.mjs +2 -6
  143. package/node_modules/typebox/build/schema/engine/dependencies.d.mts +4 -4
  144. package/node_modules/typebox/build/schema/engine/dependencies.mjs +3 -6
  145. package/node_modules/typebox/build/schema/engine/dependentRequired.d.mts +4 -4
  146. package/node_modules/typebox/build/schema/engine/dependentRequired.mjs +2 -6
  147. package/node_modules/typebox/build/schema/engine/dependentSchemas.d.mts +4 -4
  148. package/node_modules/typebox/build/schema/engine/dynamicRef.d.mts +4 -4
  149. package/node_modules/typebox/build/schema/engine/dynamicRef.mjs +11 -7
  150. package/node_modules/typebox/build/schema/engine/enum.d.mts +4 -4
  151. package/node_modules/typebox/build/schema/engine/enum.mjs +2 -6
  152. package/node_modules/typebox/build/schema/engine/exclusiveMaximum.d.mts +4 -4
  153. package/node_modules/typebox/build/schema/engine/exclusiveMaximum.mjs +2 -6
  154. package/node_modules/typebox/build/schema/engine/exclusiveMinimum.d.mts +4 -4
  155. package/node_modules/typebox/build/schema/engine/exclusiveMinimum.mjs +2 -6
  156. package/node_modules/typebox/build/schema/engine/format.d.mts +4 -4
  157. package/node_modules/typebox/build/schema/engine/format.mjs +2 -6
  158. package/node_modules/typebox/build/schema/engine/if.d.mts +4 -4
  159. package/node_modules/typebox/build/schema/engine/if.mjs +7 -15
  160. package/node_modules/typebox/build/schema/engine/items.d.mts +4 -4
  161. package/node_modules/typebox/build/schema/engine/items.mjs +1 -1
  162. package/node_modules/typebox/build/schema/engine/maxContains.d.mts +4 -4
  163. package/node_modules/typebox/build/schema/engine/maxContains.mjs +2 -6
  164. package/node_modules/typebox/build/schema/engine/maxItems.d.mts +4 -4
  165. package/node_modules/typebox/build/schema/engine/maxItems.mjs +2 -6
  166. package/node_modules/typebox/build/schema/engine/maxLength.d.mts +4 -4
  167. package/node_modules/typebox/build/schema/engine/maxLength.mjs +2 -6
  168. package/node_modules/typebox/build/schema/engine/maxProperties.d.mts +4 -4
  169. package/node_modules/typebox/build/schema/engine/maxProperties.mjs +2 -6
  170. package/node_modules/typebox/build/schema/engine/maximum.d.mts +4 -4
  171. package/node_modules/typebox/build/schema/engine/maximum.mjs +2 -6
  172. package/node_modules/typebox/build/schema/engine/minContains.d.mts +4 -4
  173. package/node_modules/typebox/build/schema/engine/minContains.mjs +2 -6
  174. package/node_modules/typebox/build/schema/engine/minItems.d.mts +5 -5
  175. package/node_modules/typebox/build/schema/engine/minItems.mjs +2 -6
  176. package/node_modules/typebox/build/schema/engine/minLength.d.mts +4 -4
  177. package/node_modules/typebox/build/schema/engine/minLength.mjs +2 -6
  178. package/node_modules/typebox/build/schema/engine/minProperties.d.mts +4 -4
  179. package/node_modules/typebox/build/schema/engine/minProperties.mjs +2 -6
  180. package/node_modules/typebox/build/schema/engine/minimum.d.mts +4 -4
  181. package/node_modules/typebox/build/schema/engine/minimum.mjs +2 -6
  182. package/node_modules/typebox/build/schema/engine/multipleOf.d.mts +4 -4
  183. package/node_modules/typebox/build/schema/engine/multipleOf.mjs +2 -6
  184. package/node_modules/typebox/build/schema/engine/not.d.mts +4 -4
  185. package/node_modules/typebox/build/schema/engine/not.mjs +4 -8
  186. package/node_modules/typebox/build/schema/engine/oneOf.d.mts +4 -4
  187. package/node_modules/typebox/build/schema/engine/oneOf.mjs +6 -11
  188. package/node_modules/typebox/build/schema/engine/pattern.d.mts +4 -4
  189. package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -7
  190. package/node_modules/typebox/build/schema/engine/patternProperties.d.mts +4 -4
  191. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +1 -1
  192. package/node_modules/typebox/build/schema/engine/prefixItems.d.mts +4 -4
  193. package/node_modules/typebox/build/schema/engine/prefixItems.mjs +1 -1
  194. package/node_modules/typebox/build/schema/engine/properties.d.mts +4 -4
  195. package/node_modules/typebox/build/schema/engine/properties.mjs +1 -1
  196. package/node_modules/typebox/build/schema/engine/propertyNames.d.mts +4 -4
  197. package/node_modules/typebox/build/schema/engine/propertyNames.mjs +4 -10
  198. package/node_modules/typebox/build/schema/engine/recursiveRef.d.mts +4 -4
  199. package/node_modules/typebox/build/schema/engine/recursiveRef.mjs +11 -7
  200. package/node_modules/typebox/build/schema/engine/ref.d.mts +4 -4
  201. package/node_modules/typebox/build/schema/engine/ref.mjs +19 -15
  202. package/node_modules/typebox/build/schema/engine/required.d.mts +4 -4
  203. package/node_modules/typebox/build/schema/engine/required.mjs +2 -6
  204. package/node_modules/typebox/build/schema/engine/schema.d.mts +7 -7
  205. package/node_modules/typebox/build/schema/engine/schema.mjs +137 -133
  206. package/node_modules/typebox/build/schema/engine/type.d.mts +4 -4
  207. package/node_modules/typebox/build/schema/engine/type.mjs +2 -6
  208. package/node_modules/typebox/build/schema/engine/unevaluatedItems.d.mts +4 -4
  209. package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +5 -9
  210. package/node_modules/typebox/build/schema/engine/unevaluatedProperties.d.mts +4 -4
  211. package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +5 -9
  212. package/node_modules/typebox/build/schema/engine/uniqueItems.d.mts +4 -4
  213. package/node_modules/typebox/build/schema/engine/uniqueItems.mjs +2 -6
  214. package/node_modules/typebox/build/schema/errors.d.mts +2 -2
  215. package/node_modules/typebox/build/schema/errors.mjs +8 -14
  216. package/node_modules/typebox/build/schema/intern/index.d.mts +1 -0
  217. package/node_modules/typebox/build/schema/intern/index.mjs +1 -0
  218. package/node_modules/typebox/build/schema/intern/intern.d.mts +11 -0
  219. package/node_modules/typebox/build/schema/intern/intern.mjs +293 -0
  220. package/node_modules/typebox/build/schema/meta/draft_2019_09.d.mts +2 -0
  221. package/node_modules/typebox/build/schema/meta/draft_2019_09.mjs +288 -0
  222. package/node_modules/typebox/build/schema/meta/draft_2020_12.d.mts +2 -0
  223. package/node_modules/typebox/build/schema/meta/draft_2020_12.mjs +300 -0
  224. package/node_modules/typebox/build/schema/meta/draft_3.d.mts +2 -0
  225. package/node_modules/typebox/build/schema/meta/draft_3.mjs +143 -0
  226. package/node_modules/typebox/build/schema/meta/draft_4.d.mts +2 -0
  227. package/node_modules/typebox/build/schema/meta/draft_4.mjs +149 -0
  228. package/node_modules/typebox/build/schema/meta/draft_6.d.mts +2 -0
  229. package/node_modules/typebox/build/schema/meta/draft_6.mjs +155 -0
  230. package/node_modules/typebox/build/schema/meta/draft_7.d.mts +2 -0
  231. package/node_modules/typebox/build/schema/meta/draft_7.mjs +172 -0
  232. package/node_modules/typebox/build/schema/meta/index.d.mts +2 -0
  233. package/node_modules/typebox/build/schema/meta/index.mjs +2 -0
  234. package/node_modules/typebox/build/schema/meta/meta.d.mts +9 -0
  235. package/node_modules/typebox/build/schema/meta/meta.mjs +15 -0
  236. package/node_modules/typebox/build/schema/meta/schema.d.mts +6 -0
  237. package/node_modules/typebox/build/schema/meta/schema.mjs +1 -0
  238. package/node_modules/typebox/build/schema/parse.d.mts +1 -0
  239. package/node_modules/typebox/build/schema/parse.mjs +10 -5
  240. package/node_modules/typebox/build/schema/resolve/resolve.d.mts +8 -3
  241. package/node_modules/typebox/build/schema/resolve/resolve.mjs +268 -139
  242. package/node_modules/typebox/build/schema/schema.d.mts +2 -0
  243. package/node_modules/typebox/build/schema/schema.mjs +2 -0
  244. package/node_modules/typebox/build/value/errors/errors.d.mts +2 -12
  245. package/node_modules/typebox/build/value/errors/errors.mjs +2 -7
  246. package/node_modules/typebox/package.json +1 -1
  247. package/node_modules/typebox/readme.md +59 -89
  248. package/openclaw.plugin.json +13 -0
  249. package/package.json +7 -5
  250. package/dist/channel.runtime-qi6Zbi9p.js +0 -55
  251. package/dist/channel.setup-DhuZ51Kg.js +0 -14
  252. package/dist/normalize-C7Hkc_vE.js +0 -2
  253. /package/dist/{account-ids-CB5SOWjc.js → .setup/account-ids-CB5SOWjc.mjs} +0 -0
  254. /package/dist/{audio-preflight.runtime-C_glQhZY.js → .setup/audio-preflight.runtime-C_glQhZY.mjs} +0 -0
  255. /package/dist/{command-policy-BIOSHySD.js → .setup/command-policy-BIOSHySD.mjs} +0 -0
  256. /package/dist/{config-schema-BYA6e_Ii.js → .setup/config-schema-BYA6e_Ii.mjs} +0 -0
  257. /package/dist/{constants-C7m81BNe.js → .setup/constants-C7m81BNe.mjs} +0 -0
  258. /package/dist/{creds-files-Drg3usj1.js → .setup/creds-files-Drg3usj1.mjs} +0 -0
  259. /package/dist/{doctor-BPb-SjdE.js → .setup/doctor-BPb-SjdE.mjs} +0 -0
  260. /package/dist/{group-config-path-BGyzT9Lg.js → .setup/group-config-path-BGyzT9Lg.mjs} +0 -0
  261. /package/dist/{group-session-contract-DDnZSsJ1.js → .setup/group-session-contract-DDnZSsJ1.mjs} +0 -0
  262. /package/dist/{reply-resolver.runtime-Ded8D58Y.js → .setup/reply-resolver.runtime-Ded8D58Y.mjs} +0 -0
  263. /package/dist/{rolldown-runtime-D7D4PA-g.js → .setup/rolldown-runtime-D7D4PA-g.mjs} +0 -0
  264. /package/dist/{runtime-BLlToOi6.js → .setup/runtime-BLlToOi6.mjs} +0 -0
  265. /package/dist/{runtime-group-policy-DeSRFXEV.js → .setup/runtime-group-policy-DeSRFXEV.mjs} +0 -0
  266. /package/dist/{security-contract-nAzD945y.js → .setup/security-contract-nAzD945y.mjs} +0 -0
  267. /package/dist/{session-contract-DMTm6Q_L.js → .setup/session-contract-DMTm6Q_L.mjs} +0 -0
  268. /package/dist/{session-errors-JuazczrA.js → .setup/session-errors-JuazczrA.mjs} +0 -0
  269. /package/dist/{targets-runtime-RBjx3pg_.js → .setup/targets-runtime-RBjx3pg_.mjs} +0 -0
@@ -94,12 +94,32 @@ Reader.prototype.raw = function read_raw(start, end) {
94
94
  return this.buf.subarray(start, end);
95
95
  };
96
96
 
97
+ function readVarint32NearEnd(reader) {
98
+ // Safely read up to four bytes of a varint32 near the reader limit
99
+ var value = 0;
100
+ for (var i = 0; i < 4; ++i) {
101
+ if (reader.pos >= reader.len)
102
+ throw indexOutOfRange(reader);
103
+ var b = reader.buf[reader.pos++];
104
+ value = (value | (b & 127) << i * 7) >>> 0;
105
+ if (b < 128)
106
+ return value;
107
+ }
108
+ throw indexOutOfRange(reader);
109
+ }
110
+
97
111
  /**
98
112
  * Reads a varint as an unsigned 32 bit value.
99
113
  * @function
100
114
  * @returns {number} Value read
101
115
  */
102
116
  Reader.prototype.uint32 = function read_uint32() {
117
+ if (this.len - this.pos < 5) {
118
+ if (this.pos >= this.len)
119
+ throw indexOutOfRange(this);
120
+ if (this.buf[this.pos] >= 128)
121
+ return readVarint32NearEnd(this);
122
+ }
103
123
  var buf = this.buf,
104
124
  pos = this.pos,
105
125
  value = (buf[pos] & 127) >>> 0;
@@ -150,6 +170,12 @@ Reader.prototype.uint32 = function read_uint32() {
150
170
  * @returns {number} Tag read
151
171
  */
152
172
  Reader.prototype.tag = function read_tag() {
173
+ if (this.len - this.pos < 5) {
174
+ if (this.pos >= this.len)
175
+ throw indexOutOfRange(this);
176
+ if (this.buf[this.pos] >= 128)
177
+ return readVarint32NearEnd(this);
178
+ }
153
179
  var buf = this.buf,
154
180
  pos = this.pos,
155
181
  value = (buf[pos] & 127) >>> 0;
@@ -395,7 +421,9 @@ Reader.prototype.double = function read_double() {
395
421
  */
396
422
  Reader.prototype.uint32s = function read_uint32s(array) {
397
423
  if (array === undefined) array = [];
398
- var end = this.uint32() + this.pos, buf = this.buf, pos = this.pos, value;
424
+ var end = this.uint32() + this.pos, len = this.len, buf = this.buf, pos = this.pos, value;
425
+ if (end > len) throw indexOutOfRange(this, end - this.pos);
426
+ this.len = end;
399
427
  while (pos < end) {
400
428
  value = buf[pos++];
401
429
  if (value < 128)
@@ -407,6 +435,8 @@ Reader.prototype.uint32s = function read_uint32s(array) {
407
435
  }
408
436
  }
409
437
  this.pos = pos;
438
+ if (pos !== end) throw RangeError("index out of range");
439
+ this.len = len;
410
440
  return array;
411
441
  };
412
442
 
@@ -417,7 +447,9 @@ Reader.prototype.uint32s = function read_uint32s(array) {
417
447
  */
418
448
  Reader.prototype.int32s = function read_int32s(array) {
419
449
  if (array === undefined) array = [];
420
- var end = this.uint32() + this.pos, buf = this.buf, pos = this.pos, value;
450
+ var end = this.uint32() + this.pos, len = this.len, buf = this.buf, pos = this.pos, value;
451
+ if (end > len) throw indexOutOfRange(this, end - this.pos);
452
+ this.len = end;
421
453
  while (pos < end) {
422
454
  value = buf[pos++];
423
455
  if (value < 128)
@@ -429,6 +461,8 @@ Reader.prototype.int32s = function read_int32s(array) {
429
461
  }
430
462
  }
431
463
  this.pos = pos;
464
+ if (pos !== end) throw RangeError("index out of range");
465
+ this.len = len;
432
466
  return array;
433
467
  };
434
468
 
@@ -439,9 +473,13 @@ Reader.prototype.int32s = function read_int32s(array) {
439
473
  */
440
474
  Reader.prototype.sint32s = function read_sint32s(array) {
441
475
  if (array === undefined) array = [];
442
- var end = this.uint32() + this.pos;
476
+ var end = this.uint32() + this.pos, len = this.len;
477
+ if (end > len) throw indexOutOfRange(this, end - this.pos);
478
+ this.len = end;
443
479
  while (this.pos < end)
444
480
  array.push(this.sint32());
481
+ if (this.pos !== end) throw RangeError("index out of range");
482
+ this.len = len;
445
483
  return array;
446
484
  };
447
485
 
@@ -452,7 +490,9 @@ Reader.prototype.sint32s = function read_sint32s(array) {
452
490
  */
453
491
  Reader.prototype.bools = function read_bools(array) {
454
492
  if (array === undefined) array = [];
455
- var end = this.uint32() + this.pos, buf = this.buf, pos = this.pos, value;
493
+ var end = this.uint32() + this.pos, len = this.len, buf = this.buf, pos = this.pos, value;
494
+ if (end > len) throw indexOutOfRange(this, end - this.pos);
495
+ this.len = end;
456
496
  while (pos < end) {
457
497
  value = buf[pos++];
458
498
  if (value < 128)
@@ -464,6 +504,8 @@ Reader.prototype.bools = function read_bools(array) {
464
504
  }
465
505
  }
466
506
  this.pos = pos;
507
+ if (pos !== end) throw RangeError("index out of range");
508
+ this.len = len;
467
509
  return array;
468
510
  };
469
511
 
@@ -582,9 +624,13 @@ Reader.prototype.doubles = function read_doubles(array) {
582
624
  */
583
625
  Reader.prototype.uint64s = function read_uint64s(array) {
584
626
  if (array === undefined) array = [];
585
- var end = this.uint32() + this.pos;
627
+ var end = this.uint32() + this.pos, len = this.len;
628
+ if (end > len) throw indexOutOfRange(this, end - this.pos);
629
+ this.len = end;
586
630
  while (this.pos < end)
587
631
  array.push(this.uint64());
632
+ if (this.pos !== end) throw RangeError("index out of range");
633
+ this.len = len;
588
634
  return array;
589
635
  };
590
636
 
@@ -595,9 +641,13 @@ Reader.prototype.uint64s = function read_uint64s(array) {
595
641
  */
596
642
  Reader.prototype.int64s = function read_int64s(array) {
597
643
  if (array === undefined) array = [];
598
- var end = this.uint32() + this.pos;
644
+ var end = this.uint32() + this.pos, len = this.len;
645
+ if (end > len) throw indexOutOfRange(this, end - this.pos);
646
+ this.len = end;
599
647
  while (this.pos < end)
600
648
  array.push(this.int64());
649
+ if (this.pos !== end) throw RangeError("index out of range");
650
+ this.len = len;
601
651
  return array;
602
652
  };
603
653
 
@@ -608,9 +658,13 @@ Reader.prototype.int64s = function read_int64s(array) {
608
658
  */
609
659
  Reader.prototype.sint64s = function read_sint64s(array) {
610
660
  if (array === undefined) array = [];
611
- var end = this.uint32() + this.pos;
661
+ var end = this.uint32() + this.pos, len = this.len;
662
+ if (end > len) throw indexOutOfRange(this, end - this.pos);
663
+ this.len = end;
612
664
  while (this.pos < end)
613
665
  array.push(this.sint64());
666
+ if (this.pos !== end) throw RangeError("index out of range");
667
+ this.len = len;
614
668
  return array;
615
669
  };
616
670
 
@@ -70,6 +70,12 @@ function Type(name, options) {
70
70
  */
71
71
  this.group = undefined; // toJSON
72
72
 
73
+ /**
74
+ * Declared symbol visibility, if any.
75
+ * @type {"local"|"export"|undefined}
76
+ */
77
+ this.visibility = undefined; // toJSON
78
+
73
79
  /**
74
80
  * Cached fields by id.
75
81
  * @type {Object.<number,Field>|null}
@@ -254,6 +260,7 @@ function clearCache(type) {
254
260
  * @property {number[][]} [extensions] Extension ranges
255
261
  * @property {Array.<number[]|string>} [reserved] Reserved ranges
256
262
  * @property {boolean} [group=false] Whether a legacy group or not
263
+ * @property {"local"|"export"} [visibility] Declared symbol visibility
257
264
  * @property {string|null} [comment] Message type comment
258
265
  */
259
266
 
@@ -304,6 +311,8 @@ Type.fromJSON = function fromJSON(name, json, depth) {
304
311
  type.reserved = json.reserved;
305
312
  if (json.group)
306
313
  type.group = true;
314
+ if (json.visibility)
315
+ type.visibility = json.visibility;
307
316
  if (json.comment)
308
317
  type.comment = json.comment;
309
318
  if (json.edition)
@@ -328,6 +337,7 @@ Type.prototype.toJSON = function toJSON(toJSONOptions) {
328
337
  "extensions" , this.extensions && this.extensions.length ? this.extensions : undefined,
329
338
  "reserved" , this.reserved && this.reserved.length ? this.reserved : undefined,
330
339
  "group" , this.group || undefined,
340
+ "visibility" , this.visibility,
331
341
  "nested" , inherited && inherited.nested || undefined,
332
342
  "comment" , keepComments ? this.comment : undefined
333
343
  ]);
@@ -40,6 +40,10 @@ var Message = require("./message"),
40
40
  wrappers[".google.protobuf.Any"] = {
41
41
 
42
42
  fromObject: function(object, depth) {
43
+ if (depth === undefined)
44
+ depth = 0;
45
+ if (depth > util.recursionLimit)
46
+ throw Error("max depth exceeded");
43
47
 
44
48
  // unwrap value type if mapped
45
49
  if (object && object["@type"]) {
@@ -57,7 +61,7 @@ wrappers[".google.protobuf.Any"] = {
57
61
  }
58
62
  return this.create({
59
63
  type_url: type_url,
60
- value: type.encode(type.fromObject(object, depth === undefined ? 1 : depth + 1)).finish()
64
+ value: type.encode(type.fromObject(object, depth + 1)).finish()
61
65
  });
62
66
  }
63
67
  }
@@ -18,7 +18,7 @@ export declare class Validator<Context extends TProperties = TProperties, Type e
18
18
  Check(value: unknown): value is Encode;
19
19
  /** Validates a value and returns it. Will throw if invalid. */
20
20
  Parse(value: unknown): Encode;
21
- /** Inspects a value and returns a detailed list of validation errors. */
21
+ /** Returns an array of validation errors for the given value. */
22
22
  Errors(value: unknown): TLocalizedValidationError[];
23
23
  /** Cleans a value using the Validator type. */
24
24
  Clean(value: unknown): unknown;
@@ -53,7 +53,7 @@ export class Validator {
53
53
  return Parser(this.Context(), this.Type(), value);
54
54
  throw new ParseError(value, this.Errors(value));
55
55
  }
56
- /** Inspects a value and returns a detailed list of validation errors. */
56
+ /** Returns an array of validation errors for the given value. */
57
57
  Errors(value) {
58
58
  if (this.IsAccelerated() && this.Check(value))
59
59
  return [];
@@ -14,14 +14,16 @@ function IsLabel(value) {
14
14
  // ------------------------------------------------------------------
15
15
  // NormalizeHostname
16
16
  //
17
- // Normalizes a hostname for label validation. Normalizes for NFC
18
- // such that equivalent codepoint sequences can be uniformly
19
- // compared. It also removes codepoints that IDNA mapping ignores,
20
- // and converts full stop variants to ASCII '.' so the hostname can
21
- // be split into labels.
17
+ // Normalizes a hostname for label validation. Maps fullwidth
18
+ // codepoints to their ASCII equivalent (e.g. 'a' U+FF41 maps to
19
+ // 'a'), then normalizes for NFC such that equivalent codepoint
20
+ // sequences can be uniformly compared. It also removes codepoints
21
+ // that IDNA mapping ignores, and converts full stop variants to
22
+ // ASCII '.' so the hostname can be split into labels.
22
23
  // ------------------------------------------------------------------
23
24
  function NormalizeHostname(value) {
24
25
  return value
26
+ .replace(/[\uff01-\uff5e]/g, (char) => String.fromCharCode(char.charCodeAt(0) - 0xfee0)) // RE_FULLWIDTH_MAPPING
25
27
  .normalize('NFC')
26
28
  .replace(/[\u00ad\u034f\u180b-\u180d\u200b\ufe00-\ufe0f\u{e0100}-\u{e01ef}]/gu, '') // RE_IGNORED_MAPPING
27
29
  .replace(/[\u002E\u3002\uFF0E\uFF61]/g, '.'); // RE_FULL_STOP_MAPPING
@@ -2,6 +2,7 @@
2
2
  const IpvFutureMatchMaxLength = 2048;
3
3
  const IpvFutureMatch = /\[[vV][0-9a-fA-F]+\.[^\]]+\]/; // Guarded By IpvFutureMatchMaxLength
4
4
  const InvalidIriChars = /[\x00-\x20<>\^`{|}\\]/;
5
+ const InvalidPercentEncoding = /%(?![0-9a-fA-F]{2})/;
5
6
  // ------------------------------------------------------------------
6
7
  // NarrowIpvFuture
7
8
  //
@@ -26,6 +27,9 @@ export function IsIri(value) {
26
27
  // 1. Reject strings containing unencoded whitespace or illegal control characters.
27
28
  if (InvalidIriChars.test(value))
28
29
  return false;
29
- // 2. Delegate to the native URL parser, patching the IPvFuture edge case beforehand.
30
+ // 2. Reject malformed percent-encoding triplets.
31
+ if (InvalidPercentEncoding.test(value))
32
+ return false;
33
+ // 3. Delegate to the native URL parser, patching the IPvFuture edge case beforehand.
30
34
  return URL.canParse(NarrowIpvFuture(value));
31
35
  }
@@ -106,15 +106,13 @@ export function IsMaxLength(value, length) {
106
106
  // Array
107
107
  // --------------------------------------------------------------------------
108
108
  export function Every(value, offset, params, expression) {
109
- return G.IsEqual(offset, '0')
110
- ? `${value}.every((${params[0]}, ${params[1]}) => ${expression})`
111
- : `((value, callback) => { for(let index = ${offset}; index < value.length; index++) if (!callback(value[index], index)) return false; return true })(${value}, (${params[0]}, ${params[1]}) => ${expression})`;
109
+ return G.IsEqual(offset, '0') ? `${value}.every((${params[0]}, ${params[1]}) => (${expression}))` : `${value}.every((${params[0]}, ${params[1]}) => (${params[1]} < ${offset}) || (${expression}))`;
112
110
  }
113
111
  export function Some(value, params, expression) {
114
112
  return `${value}.some((${params[0]}, ${params[1]}) => ${expression})`;
115
113
  }
116
114
  export function SomeAll(value, params, expression) {
117
- return `((value, callback) => { let result = false; for(let index = 0; index < value.length; index++) if (callback(value[index], index)) result = true; return result })(${value}, (${params[0]}, ${params[1]}) => ${expression})`;
115
+ return `((value) => { let result = false; value.forEach((${params[0]}, ${params[1]}) => { if (${expression}) result = true }); return result })(${value})`;
118
116
  }
119
117
  export function Counted(value, params, expression) {
120
118
  return `${value}.reduce((result, ${params[0]}, ${params[1]}) => (${expression}) ? ++result : result, 0)`;
@@ -140,36 +140,24 @@ export function IsMinLength(value, length) {
140
140
  // --------------------------------------------------------------------------
141
141
  /** Returns true if every element from offset satisfies the callback, short-circuiting on the first failure */
142
142
  export function Every(value, offset, callback) {
143
- for (let index = offset; index < value.length; index++) {
144
- if (!callback(value[index], index))
145
- return false;
146
- }
147
- return true;
143
+ return value.every((item, index) => (index < offset) || callback(item, index));
148
144
  }
149
145
  /** Returns true if every element from offset satisfies the callback, using exhaustive enumeration */
150
146
  export function EveryAll(value, offset, callback) {
151
147
  let result = true;
152
- for (let index = offset; index < value.length; index++) {
153
- if (!callback(value[index], index))
154
- result = false;
155
- }
148
+ value.forEach((item, index) => { if ((index >= offset) && !callback(item, index))
149
+ result = false; });
156
150
  return result;
157
151
  }
158
152
  /** Returns true if some element satisfies the callback, short-circuiting on the first success */
159
153
  export function Some(value, callback) {
160
- for (let index = 0; index < value.length; index++) {
161
- if (callback(value[index], index))
162
- return true;
163
- }
164
- return false;
154
+ return value.some((value, index) => callback(value, index));
165
155
  }
166
156
  /** Returns true if some element satisfies the callback, using exhaustive enumeration */
167
157
  export function SomeAll(value, callback) {
168
158
  let result = false;
169
- for (let index = 0; index < value.length; index++) {
170
- if (callback(value[index], index))
171
- result = true;
172
- }
159
+ value.forEach((item, index) => { if (callback(item, index))
160
+ result = true; });
173
161
  return result;
174
162
  }
175
163
  /** Returns the count of elements that satisfy the callback */
@@ -84,10 +84,11 @@ function NextGraphemeClusterIndex(value, clusterStart) {
84
84
  // IsGraphemeCodePoint
85
85
  // --------------------------------------------------------------------------
86
86
  function IsGraphemeCodePoint(value) {
87
- return (IsHighSurrogate(value) ||
87
+ return ((value >= 0x0300) && ( // above special range
88
+ IsHighSurrogate(value) ||
88
89
  IsCombiningMark(value) ||
89
90
  IsVariationSelector(value) ||
90
- IsZeroWidthJoiner(value));
91
+ IsZeroWidthJoiner(value)));
91
92
  }
92
93
  // --------------------------------------------------------------------------
93
94
  // GraphemeCount
@@ -103,30 +104,22 @@ export function GraphemeCount(value) {
103
104
  return count;
104
105
  }
105
106
  // --------------------------------------------------------------------------
106
- // IsMinLength
107
+ // IsMinLengthSegmented
107
108
  // --------------------------------------------------------------------------
108
109
  /** Checks if a string has at least a minimum number of grapheme clusters */
109
110
  function IsMinLengthSegmented(value, minLength) {
110
- // ----------------------------------------------------------------
111
- // Inaccessible via public interface (review)
112
- //
113
- // deno-coverage-ignore-start
114
- // ----------------------------------------------------------------
115
- if (minLength === 0)
116
- return true; // 0-length
117
- // deno-coverage-ignore-stop
111
+ // if (minLength === 0) return true // 0-length (unreachable)
118
112
  let count = 0;
119
113
  let index = 0;
120
114
  while (index < value.length) {
121
115
  index = NextGraphemeClusterIndex(value, index);
122
- count++;
123
- if (count >= minLength)
116
+ if ((++count) >= minLength)
124
117
  return true;
125
118
  }
126
119
  return false;
127
120
  }
128
121
  // --------------------------------------------------------------------------
129
- // IsMaxLength
122
+ // IsMaxLengthSegmented
130
123
  // --------------------------------------------------------------------------
131
124
  /** Checks if a string has at most a maximum number of grapheme clusters */
132
125
  function IsMaxLengthSegmented(value, maxLength) {
@@ -134,8 +127,7 @@ function IsMaxLengthSegmented(value, maxLength) {
134
127
  let index = 0;
135
128
  while (index < value.length) {
136
129
  index = NextGraphemeClusterIndex(value, index);
137
- count++;
138
- if (count > maxLength)
130
+ if ((++count) > maxLength)
139
131
  return false;
140
132
  }
141
133
  return true;
@@ -147,30 +139,30 @@ function IsMaxLengthSegmented(value, maxLength) {
147
139
  export function IsMinLength(value, minLength) {
148
140
  if (minLength === 0)
149
141
  return true; // 0-length
142
+ if (value.length < minLength)
143
+ return false; // length is upper bound on grapheme count
150
144
  let index = 0;
151
- while (index < value.length) {
145
+ while (true) {
152
146
  if (IsGraphemeCodePoint(value.charCodeAt(index))) {
153
147
  return IsMinLengthSegmented(value, minLength);
154
148
  }
155
- index++;
156
- if (index >= minLength)
149
+ if ((++index) >= minLength)
157
150
  return true;
158
151
  }
159
- return false;
160
152
  }
161
153
  // --------------------------------------------------------------------------
162
154
  // IsMaxLengthFast
163
155
  // --------------------------------------------------------------------------
164
156
  /** Fast check for maximum grapheme length, falls back to full check if needed */
165
157
  export function IsMaxLength(value, maxLength) {
158
+ if (value.length <= maxLength)
159
+ return true; // length is upper bound on grapheme count
166
160
  let index = 0;
167
- while (index < value.length) {
161
+ while (true) {
168
162
  if (IsGraphemeCodePoint(value.charCodeAt(index))) {
169
163
  return IsMaxLengthSegmented(value, maxLength);
170
164
  }
171
- index++;
172
- if (index > maxLength)
165
+ if ((++index) > maxLength)
173
166
  return false;
174
167
  }
175
- return true;
176
168
  }
@@ -27,7 +27,7 @@ function CreateEvaluatedCheck(build, code) {
27
27
  // CreateDynamicCheck
28
28
  // ------------------------------------------------------------------
29
29
  function CreateDynamicCheck(build) {
30
- const stack = new Engine.Stack(build.Context(), build.Schema());
30
+ const stack = Engine.Stack(build.Context(), build.Schema());
31
31
  const context = new Engine.CheckContext();
32
32
  return (value) => Engine.CheckSchema(stack, context, build.Schema(), value);
33
33
  }
@@ -109,7 +109,7 @@ export function Build(...args) {
109
109
  });
110
110
  Engine.ResetExternal();
111
111
  Engine.ResetFunctions();
112
- const stack = new Engine.Stack(context, schema);
112
+ const stack = Engine.Stack(context, schema);
113
113
  const build = new Engine.BuildContext(Engine.HasUnevaluated(context, schema));
114
114
  const call = Engine.CreateFunction(stack, build, schema, 'value');
115
115
  const functions = Engine.GetFunctions();
@@ -8,7 +8,7 @@ export function Check(...args) {
8
8
  3: (context, schema, value) => [context, schema, value],
9
9
  2: (schema, value) => [{}, schema, value]
10
10
  });
11
- const stack = new Engine.Stack(context, schema);
11
+ const stack = Engine.Stack(context, schema);
12
12
  const checkContext = new Engine.CheckContext();
13
13
  return Engine.CheckSchema(stack, checkContext, schema, value);
14
14
  }
@@ -2,8 +2,9 @@ import { type TLocalizedValidationError } from '../error/index.mjs';
2
2
  import { type Static } from '../type/types/static.mjs';
3
3
  import * as Schema from './types/index.mjs';
4
4
  export declare class Validator<const Schema extends Schema.XSchema = Schema.XSchema, Value extends unknown = Static<Schema>> {
5
- private readonly buildResult;
6
5
  private readonly evaluateResult;
6
+ private readonly context;
7
+ private readonly schema;
7
8
  constructor(context: Record<string, Schema.XSchema>, schema: Schema);
8
9
  /** Returns true if this Validator is using JIT acceleration. */
9
10
  IsAccelerated(): boolean;
@@ -13,7 +14,7 @@ export declare class Validator<const Schema extends Schema.XSchema = Schema.XSch
13
14
  Check(value: unknown): value is Value;
14
15
  /** Validates a value and returns it. Will throw if invalid. */
15
16
  Parse(value: unknown): Value;
16
- /** Inspects a value and returns a detailed list of validation errors. */
17
+ /** Returns an array of validation errors for the given value. */
17
18
  Errors(value: unknown): [result: boolean, errors: TLocalizedValidationError[]];
18
19
  }
19
20
  /** Compiles this schema into a high performance Validator */
@@ -3,14 +3,15 @@
3
3
  import { Arguments } from '../system/arguments/index.mjs';
4
4
  import * as Build from './build.mjs';
5
5
  import { Errors } from './errors.mjs';
6
- import { ParseError } from './parse.mjs';
6
+ import { ThrowParseError } from './parse.mjs';
7
7
  // ------------------------------------------------------------------
8
8
  // Validator
9
9
  // ------------------------------------------------------------------
10
10
  export class Validator {
11
11
  constructor(context, schema) {
12
- this.buildResult = Build.Build(context, schema);
13
- this.evaluateResult = this.buildResult.Evaluate();
12
+ this.evaluateResult = Build.Build(context, schema).Evaluate();
13
+ this.context = context;
14
+ this.schema = schema;
14
15
  }
15
16
  /** Returns true if this Validator is using JIT acceleration. */
16
17
  IsAccelerated() {
@@ -18,7 +19,7 @@ export class Validator {
18
19
  }
19
20
  /** Returns the underlying Schema used to construct this Validator. */
20
21
  Schema() {
21
- return this.buildResult.Schema();
22
+ return this.schema;
22
23
  }
23
24
  /** Performs a type-guard check on the provided value. */
24
25
  Check(value) {
@@ -28,12 +29,11 @@ export class Validator {
28
29
  Parse(value) {
29
30
  if (this.evaluateResult.Check(value))
30
31
  return value;
31
- const [_result, errors] = Errors(this.buildResult.Context(), this.buildResult.Schema(), value);
32
- throw new ParseError(this.buildResult.Schema(), value, errors);
32
+ ThrowParseError(this.context, this.schema, value);
33
33
  }
34
- /** Inspects a value and returns a detailed list of validation errors. */
34
+ /** Returns an array of validation errors for the given value. */
35
35
  Errors(value) {
36
- return Errors(this.buildResult.Context(), this.buildResult.Schema(), value);
36
+ return Errors(this.context, this.schema, value);
37
37
  }
38
38
  }
39
39
  /** Compiles this schema into a high performance Validator */
@@ -21,15 +21,14 @@ export declare class CheckContext {
21
21
  GetKeys(): Set<string>;
22
22
  Merge(results: CheckContext[]): true;
23
23
  }
24
- export type ErrorContextCallback = (error: TValidationError) => unknown;
25
24
  export declare class ErrorContext extends CheckContext {
26
- private readonly callback;
27
- constructor(callback: ErrorContextCallback);
28
- AddError(error: TValidationError): false;
29
- }
30
- export declare class AccumulatedErrorContext extends ErrorContext {
31
25
  private readonly errors;
32
26
  constructor();
33
- AddError(error: TValidationError): false;
27
+ AtCapacity(): boolean;
28
+ AddError<Keyword extends TValidationError['keyword']>(keyword: Keyword, schemaPath: string, instancePath: string, params: Extract<TValidationError, {
29
+ keyword: Keyword;
30
+ }>['params']): false;
31
+ AddErrors(error: TValidationError[]): false;
34
32
  GetErrors(): TValidationError[];
33
+ private AddErrorObject;
35
34
  }
@@ -1,4 +1,5 @@
1
1
  // deno-fmt-ignore-file
2
+ import { Settings } from '../../system/settings/index.mjs';
2
3
  import * as Schema from '../types/index.mjs';
3
4
  import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
4
5
  // ------------------------------------------------------------------
@@ -101,29 +102,36 @@ export class CheckContext {
101
102
  return true;
102
103
  }
103
104
  }
104
- export class ErrorContext extends CheckContext {
105
- constructor(callback) {
106
- super();
107
- this.callback = callback;
108
- }
109
- AddError(error) {
110
- this.callback(error);
111
- return false;
112
- }
113
- }
114
105
  // ------------------------------------------------------------------
115
- // AccumulatedErrorContext
106
+ // ErrorContext
116
107
  // ------------------------------------------------------------------
117
- export class AccumulatedErrorContext extends ErrorContext {
108
+ export class ErrorContext extends CheckContext {
118
109
  constructor() {
119
- super(error => this.errors.push(error));
110
+ super();
120
111
  this.errors = [];
121
112
  }
122
- AddError(error) {
123
- this.errors.push(error);
113
+ // ----------------------------------------------------------------
114
+ // Public
115
+ // ----------------------------------------------------------------
116
+ AtCapacity() {
117
+ return this.errors.length >= Settings.Get().maxErrors;
118
+ }
119
+ AddError(keyword, schemaPath, instancePath, params) {
120
+ return this.AddErrorObject({ keyword, schemaPath, instancePath, params });
121
+ }
122
+ AddErrors(error) {
123
+ error.forEach(error => this.AddErrorObject(error));
124
124
  return false;
125
125
  }
126
126
  GetErrors() {
127
127
  return this.errors;
128
128
  }
129
+ // ----------------------------------------------------------------
130
+ // Private
131
+ // ----------------------------------------------------------------
132
+ AddErrorObject(error) {
133
+ if (!this.AtCapacity())
134
+ this.errors.push(error);
135
+ return false;
136
+ }
129
137
  }
@@ -1,6 +1,6 @@
1
1
  import * as Schema from '../types/index.mjs';
2
- import { Stack } from './_stack.mjs';
2
+ import * as Stack from './_stack.mjs';
3
3
  import { BuildContext } from './_context.mjs';
4
4
  export declare function ResetFunctions(): void;
5
5
  export declare function GetFunctions(): string[];
6
- export declare function CreateFunction(stack: Stack, context: BuildContext, schema: Schema.XSchema, value: string): string;
6
+ export declare function CreateFunction(stack: Stack.XStack, context: BuildContext, schema: Schema.XSchema, value: string): string;
@@ -55,7 +55,7 @@ export function GetFunctions() {
55
55
  // CreateFunction
56
56
  // ------------------------------------------------------------------
57
57
  export function CreateFunction(stack, context, schema, value) {
58
- const name = CreateName(schema, stack.BaseURL().href);
58
+ const name = CreateName(schema, stack.lexicalBase);
59
59
  const call = CreateCallExpression(context, schema, name, value);
60
60
  if (funcs.has(name))
61
61
  return call;
@@ -1,4 +1,4 @@
1
- import * as S from '../types/index.mjs';
2
- import { Stack } from './_stack.mjs';
1
+ import * as Schema from '../types/index.mjs';
2
+ import * as Stack from './_stack.mjs';
3
3
  import { BuildContext } from './_context.mjs';
4
- export declare function Reducer(stack: Stack, context: BuildContext, schemas: S.XSchema[], value: string, check: string): string;
4
+ export declare function Reducer(stack: Stack.XStack, context: BuildContext, schemas: Schema.XSchema[], value: string, check: string): string;