@openclaw/whatsapp 2026.8.1-beta.3 → 2026.8.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 (263) hide show
  1. package/dist/{accounts-BX2fZUyR.js → accounts-CeKQbu_s.js} +9 -26
  2. package/dist/{action-runtime-pM-ExU0l.js → action-runtime-Bw0loEdy.js} +2 -2
  3. package/dist/action-runtime-api.js +1 -1
  4. package/dist/action-runtime.runtime.js +1 -1
  5. package/dist/{call-tool-api.js → agent-tools-api.js} +13 -6
  6. package/dist/{agent-tools-login-BjRpD-JQ.js → agent-tools-login-B-2qZPzc.js} +12 -3
  7. package/dist/api.js +10 -10
  8. package/dist/{approval-handler.runtime-CkMMvUjk.js → approval-handler.runtime-DeyPb57-.js} +3 -3
  9. package/dist/{approval-reactions-Jyr1JaAK.js → approval-reactions-DGDA6hQ7.js} +7 -5
  10. package/dist/{auth-store-CtpBqH5S.js → auth-store-DTj1H9pv.js} +5 -3
  11. package/dist/{channel-DRMYRfZ8.js → channel-DxMmDjqK.js} +26 -24
  12. package/dist/channel-config-api.js +1 -1
  13. package/dist/channel-plugin-api.js +1 -1
  14. package/dist/{channel-react-action-CstrR0CT.js → channel-react-action-BUp7Wbfr.js} +3 -3
  15. package/dist/{channel.runtime-X3JC2gaq.js → channel.runtime-BwSnyXRX.js} +4 -4
  16. package/dist/{channel.setup-DhBBhbQv.js → channel.setup-aOFLSQyw.js} +1 -1
  17. package/dist/{config-schema-BQP5YCeK.js → config-schema-BYA6e_Ii.js} +6 -4
  18. package/dist/{connection-controller-CIYuBJrs.js → connection-controller-BvkxsbWi.js} +2 -2
  19. package/dist/{constants-HU41RHGI.js → constants-C7m81BNe.js} +1 -1
  20. package/dist/{directory-config-P7_3U73Z.js → directory-config-LgxYJLWY.js} +3 -3
  21. package/dist/directory-contract-api.js +1 -1
  22. package/dist/{group-session-key-DmFc_Cqi.js → group-session-key-KUguLmSZ.js} +4 -4
  23. package/dist/index.js +4 -4
  24. package/dist/light-runtime-api.js +2 -2
  25. package/dist/{login-BkpKpndm.js → login-Bk_jiXKD.js} +6 -5
  26. package/dist/{login-qr-1dpv6jjT.js → login-qr-B3m61NqA.js} +43 -20
  27. package/dist/login-qr-runtime.js +1 -1
  28. package/dist/{monitor-IzwQKizW.js → monitor-CTsyo-HE.js} +185 -162
  29. package/dist/{question-reactions-D3eAeB0i.js → question-reactions-B9D6MHXZ.js} +1 -1
  30. package/dist/runtime-api.js +9 -9
  31. package/dist/{send-CwvTU4RI.js → send-DiPjiygK.js} +54 -29
  32. package/dist/{send-api-obOSm2cC.js → send-api-kFcuhSiY.js} +43 -41
  33. package/dist/{setup-finalize-n4K2I2gJ.js → setup-finalize-CqH5wTK5.js} +7 -6
  34. package/dist/setup-plugin-api.js +1 -1
  35. package/dist/{setup-surface-Cwn3zyxK.js → setup-surface-Dm3T6S8t.js} +3 -3
  36. package/dist/{shared-wg42NKFB.js → shared-DDjonGys.js} +7 -6
  37. package/dist/{socket-close-2T0_jZTN.js → socket-close-CpkkJZCU.js} +9 -6
  38. package/dist/{targets-runtime-TMk0lGuy.js → targets-runtime-RBjx3pg_.js} +1 -2
  39. package/dist/{text-runtime-CaKLhowd.js → text-runtime-DyfmcATV.js} +1 -1
  40. package/node_modules/baileys/lib/Defaults/index.js +1 -1
  41. package/node_modules/baileys/lib/Socket/business.d.ts.map +1 -1
  42. package/node_modules/baileys/lib/Socket/chats.d.ts +1 -0
  43. package/node_modules/baileys/lib/Socket/chats.d.ts.map +1 -1
  44. package/node_modules/baileys/lib/Socket/chats.js +10 -5
  45. package/node_modules/baileys/lib/Socket/chats.js.map +1 -1
  46. package/node_modules/baileys/lib/Socket/communities.d.ts.map +1 -1
  47. package/node_modules/baileys/lib/Socket/groups.d.ts.map +1 -1
  48. package/node_modules/baileys/lib/Socket/index.d.ts.map +1 -1
  49. package/node_modules/baileys/lib/Socket/messages-recv.d.ts.map +1 -1
  50. package/node_modules/baileys/lib/Socket/messages-send.d.ts.map +1 -1
  51. package/node_modules/baileys/lib/Socket/newsletter.d.ts.map +1 -1
  52. package/node_modules/baileys/lib/Socket/socket.d.ts.map +1 -1
  53. package/node_modules/baileys/lib/Socket/socket.js +3 -0
  54. package/node_modules/baileys/lib/Socket/socket.js.map +1 -1
  55. package/node_modules/baileys/lib/Types/index.d.ts +1 -0
  56. package/node_modules/baileys/lib/Types/index.d.ts.map +1 -1
  57. package/node_modules/baileys/lib/Types/index.js.map +1 -1
  58. package/node_modules/baileys/lib/Utils/browser-utils.d.ts.map +1 -1
  59. package/node_modules/baileys/lib/Utils/browser-utils.js +1 -0
  60. package/node_modules/baileys/lib/Utils/browser-utils.js.map +1 -1
  61. package/node_modules/baileys/lib/Utils/generics.d.ts +1 -0
  62. package/node_modules/baileys/lib/Utils/generics.d.ts.map +1 -1
  63. package/node_modules/baileys/lib/Utils/generics.js +1 -1
  64. package/node_modules/baileys/lib/Utils/generics.js.map +1 -1
  65. package/node_modules/baileys/lib/Utils/tc-token-utils.d.ts.map +1 -1
  66. package/node_modules/baileys/lib/Utils/tc-token-utils.js +3 -2
  67. package/node_modules/baileys/lib/Utils/tc-token-utils.js.map +1 -1
  68. package/node_modules/baileys/lib/Utils/validate-connection.d.ts.map +1 -1
  69. package/node_modules/baileys/lib/Utils/validate-connection.js +9 -2
  70. package/node_modules/baileys/lib/Utils/validate-connection.js.map +1 -1
  71. package/node_modules/baileys/node_modules/content-type/README.md +2 -0
  72. package/node_modules/baileys/node_modules/content-type/dist/index.d.ts +20 -0
  73. package/node_modules/baileys/node_modules/content-type/dist/index.js +20 -14
  74. package/node_modules/baileys/node_modules/content-type/dist/index.js.map +1 -1
  75. package/node_modules/baileys/node_modules/content-type/package.json +1 -1
  76. package/node_modules/baileys/node_modules/file-type/package.json +1 -1
  77. package/node_modules/baileys/node_modules/file-type/readme.md +3 -0
  78. package/node_modules/baileys/node_modules/file-type/source/detectors/zip.js +6 -1
  79. package/node_modules/baileys/node_modules/file-type/source/index.d.ts +3 -0
  80. package/node_modules/baileys/node_modules/file-type/source/index.js +25 -13
  81. package/node_modules/baileys/node_modules/music-metadata/LICENSE.txt +9 -9
  82. package/node_modules/baileys/node_modules/music-metadata/README.md +878 -878
  83. package/node_modules/baileys/node_modules/music-metadata/lib/ParseError.d.ts +1 -1
  84. package/node_modules/baileys/node_modules/music-metadata/lib/ParseError.js +1 -1
  85. package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfObject.d.ts +1 -4
  86. package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfObject.js +66 -30
  87. package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfParser.d.ts +5 -1
  88. package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfParser.js +94 -25
  89. package/node_modules/baileys/node_modules/music-metadata/lib/dsf/DsfChunk.js +2 -2
  90. package/node_modules/baileys/node_modules/music-metadata/lib/dsf/DsfParser.js +38 -13
  91. package/node_modules/baileys/node_modules/music-metadata/lib/mp4/AtomToken.js +2 -1
  92. package/node_modules/baileys/node_modules/music-metadata/lib/mp4/MP4Parser.js +34 -7
  93. package/node_modules/baileys/node_modules/music-metadata/lib/ogg/speex/SpeexStream.d.ts +7 -0
  94. package/node_modules/baileys/node_modules/music-metadata/lib/ogg/speex/SpeexStream.js +13 -0
  95. package/node_modules/baileys/node_modules/music-metadata/lib/riff/RiffChunk.js +1 -1
  96. package/node_modules/baileys/node_modules/music-metadata/package.json +156 -156
  97. package/node_modules/baileys/node_modules/process-warning/.github/dependabot.yml +42 -2
  98. package/node_modules/baileys/node_modules/process-warning/.github/workflows/ci.yml +12 -1
  99. package/node_modules/baileys/node_modules/process-warning/.github/workflows/lock-threads.yml +19 -0
  100. package/node_modules/baileys/node_modules/process-warning/LICENSE +1 -1
  101. package/node_modules/baileys/node_modules/process-warning/README.md +41 -2
  102. package/node_modules/baileys/node_modules/process-warning/index.js +85 -17
  103. package/node_modules/baileys/node_modules/process-warning/package.json +6 -7
  104. package/node_modules/baileys/node_modules/process-warning/test/emit-once-only.test.js +3 -3
  105. package/node_modules/baileys/node_modules/process-warning/test/emit-reset.test.js +4 -4
  106. package/node_modules/baileys/node_modules/process-warning/test/emit-unlimited.test.js +2 -2
  107. package/node_modules/baileys/node_modules/process-warning/test/spy-warning.test.js +143 -0
  108. package/node_modules/baileys/node_modules/process-warning/types/index.d.ts +15 -1
  109. package/node_modules/baileys/node_modules/process-warning/types/index.tst.ts +48 -0
  110. package/node_modules/baileys/node_modules/protobufjs/README.md +61 -84
  111. package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.js +66 -45
  112. package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
  113. package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
  114. package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
  115. package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.js +47 -40
  116. package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.js.map +1 -1
  117. package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.min.js +3 -3
  118. package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.min.js.map +1 -1
  119. package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.js +92 -68
  120. package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.js.map +1 -1
  121. package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.min.js +3 -3
  122. package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
  123. package/node_modules/baileys/node_modules/protobufjs/ext/descriptor.js +26 -10
  124. package/node_modules/baileys/node_modules/protobufjs/index.d.ts +3 -0
  125. package/node_modules/baileys/node_modules/protobufjs/package.json +1 -1
  126. package/node_modules/baileys/node_modules/protobufjs/src/converter.js +5 -1
  127. package/node_modules/baileys/node_modules/protobufjs/src/enum.js +5 -2
  128. package/node_modules/baileys/node_modules/protobufjs/src/field.js +6 -1
  129. package/node_modules/baileys/node_modules/protobufjs/src/parse.js +26 -23
  130. package/node_modules/baileys/node_modules/protobufjs/src/reader.js +36 -9
  131. package/node_modules/baileys/node_modules/protobufjs/src/util/codegen.js +3 -1
  132. package/node_modules/baileys/node_modules/protobufjs/src/util/utf8.js +2 -28
  133. package/node_modules/baileys/node_modules/protobufjs/src/writer.js +7 -1
  134. package/node_modules/baileys/node_modules/ws/lib/permessage-deflate.js +3 -1
  135. package/node_modules/baileys/node_modules/ws/package.json +1 -1
  136. package/node_modules/baileys/package.json +1 -1
  137. package/node_modules/typebox/build/format/date.d.mts +1 -1
  138. package/node_modules/typebox/build/format/date.mjs +1 -1
  139. package/node_modules/typebox/build/format/date_time.d.mts +2 -2
  140. package/node_modules/typebox/build/format/date_time.mjs +3 -3
  141. package/node_modules/typebox/build/format/email.d.mts +1 -1
  142. package/node_modules/typebox/build/format/email.mjs +2 -2
  143. package/node_modules/typebox/build/format/hostname.mjs +2 -10
  144. package/node_modules/typebox/build/format/idn_email.d.mts +1 -1
  145. package/node_modules/typebox/build/format/idn_email.mjs +3 -3
  146. package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -0
  147. package/node_modules/typebox/build/format/idn_hostname.mjs +3 -11
  148. package/node_modules/typebox/build/format/idna/format/bidi.d.mts +3 -0
  149. package/node_modules/typebox/build/format/idna/format/bidi.mjs +98 -0
  150. package/node_modules/typebox/build/format/idna/format/puny.d.mts +3 -0
  151. package/node_modules/typebox/build/format/idna/format/puny.mjs +144 -0
  152. package/node_modules/typebox/build/format/idna/hostname.d.mts +1 -0
  153. package/node_modules/typebox/build/format/idna/hostname.mjs +16 -0
  154. package/node_modules/typebox/build/format/idna/idn-hostname.d.mts +1 -0
  155. package/node_modules/typebox/build/format/idna/idn-hostname.mjs +41 -0
  156. package/node_modules/typebox/build/format/idna/index.d.mts +2 -0
  157. package/node_modules/typebox/build/format/idna/index.mjs +2 -0
  158. package/node_modules/typebox/build/format/idna/label/ascii.d.mts +1 -0
  159. package/node_modules/typebox/build/format/idna/label/ascii.mjs +9 -0
  160. package/node_modules/typebox/build/format/idna/label/puny.d.mts +1 -0
  161. package/node_modules/typebox/build/format/idna/label/puny.mjs +28 -0
  162. package/node_modules/typebox/build/format/idna/label/unicode.d.mts +1 -0
  163. package/node_modules/typebox/build/format/idna/label/unicode.mjs +106 -0
  164. package/node_modules/typebox/build/format/idna/pattern/pattern.d.mts +30 -0
  165. package/node_modules/typebox/build/format/idna/pattern/pattern.mjs +70 -0
  166. package/node_modules/typebox/build/format/ipv4.d.mts +0 -1
  167. package/node_modules/typebox/build/format/ipv4.mjs +2 -32
  168. package/node_modules/typebox/build/format/ipv6.mjs +2 -61
  169. package/node_modules/typebox/build/format/iri.d.mts +2 -2
  170. package/node_modules/typebox/build/format/iri.mjs +26 -8
  171. package/node_modules/typebox/build/format/iri_reference.d.mts +2 -2
  172. package/node_modules/typebox/build/format/iri_reference.mjs +9 -55
  173. package/node_modules/typebox/build/format/regex.d.mts +1 -2
  174. package/node_modules/typebox/build/format/regex.mjs +2 -6
  175. package/node_modules/typebox/build/format/time.d.mts +2 -2
  176. package/node_modules/typebox/build/format/time.mjs +19 -14
  177. package/node_modules/typebox/build/format/uri.d.mts +1 -1
  178. package/node_modules/typebox/build/format/uri.mjs +3 -130
  179. package/node_modules/typebox/build/format/uri_reference.d.mts +1 -1
  180. package/node_modules/typebox/build/format/uri_reference.mjs +2 -3
  181. package/node_modules/typebox/build/format/uri_template.d.mts +2 -3
  182. package/node_modules/typebox/build/format/uri_template.mjs +4 -5
  183. package/node_modules/typebox/build/format/url.d.mts +3 -3
  184. package/node_modules/typebox/build/format/url.mjs +4 -5
  185. package/node_modules/typebox/build/guard/emit.d.mts +3 -1
  186. package/node_modules/typebox/build/guard/emit.mjs +12 -5
  187. package/node_modules/typebox/build/guard/guard.d.mts +8 -2
  188. package/node_modules/typebox/build/guard/guard.mjs +25 -4
  189. package/node_modules/typebox/build/guard/string.d.mts +2 -2
  190. package/node_modules/typebox/build/guard/string.mjs +7 -7
  191. package/node_modules/typebox/build/schema/engine/_context.mjs +3 -3
  192. package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -2
  193. package/node_modules/typebox/build/schema/engine/_regexp.d.mts +2 -0
  194. package/node_modules/typebox/build/schema/engine/_regexp.mjs +4 -0
  195. package/node_modules/typebox/build/schema/engine/_stack.mjs +12 -13
  196. package/node_modules/typebox/build/schema/engine/additionalItems.mjs +17 -7
  197. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +4 -3
  198. package/node_modules/typebox/build/schema/engine/contains.mjs +18 -6
  199. package/node_modules/typebox/build/schema/engine/enum.mjs +1 -1
  200. package/node_modules/typebox/build/schema/engine/items.mjs +26 -6
  201. package/node_modules/typebox/build/schema/engine/maxContains.mjs +3 -3
  202. package/node_modules/typebox/build/schema/engine/minContains.mjs +14 -4
  203. package/node_modules/typebox/build/schema/engine/not.mjs +4 -2
  204. package/node_modules/typebox/build/schema/engine/oneOf.mjs +7 -6
  205. package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -2
  206. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +4 -3
  207. package/node_modules/typebox/build/schema/engine/ref.mjs +1 -7
  208. package/node_modules/typebox/build/schema/engine/schema.mjs +13 -4
  209. package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
  210. package/node_modules/typebox/build/schema/resolve/resolve.d.mts +4 -1
  211. package/node_modules/typebox/build/schema/resolve/resolve.mjs +202 -1
  212. package/node_modules/typebox/build/schema/static/propertyNames.d.mts +5 -0
  213. package/node_modules/typebox/build/schema/static/propertyNames.mjs +3 -0
  214. package/node_modules/typebox/build/schema/static/schema.d.mts +3 -0
  215. package/node_modules/typebox/build/schema/types/index.d.mts +0 -2
  216. package/node_modules/typebox/build/schema/types/index.mjs +0 -2
  217. package/node_modules/typebox/build/system/memory/clone.mjs +14 -11
  218. package/node_modules/typebox/build/system/memory/discard.mjs +6 -5
  219. package/node_modules/typebox/build/system/settings/settings.d.mts +9 -0
  220. package/node_modules/typebox/build/system/settings/settings.mjs +2 -0
  221. package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +6 -1
  222. package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +16 -3
  223. package/node_modules/typebox/build/type/engine/call/instantiate.mjs +34 -4
  224. package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +5 -5
  225. package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +20 -26
  226. package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +6 -10
  227. package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +9 -13
  228. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +7 -4
  229. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +12 -19
  230. package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +4 -20
  231. package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +8 -20
  232. package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +4 -4
  233. package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +11 -8
  234. package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +1 -1
  235. package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +3 -4
  236. package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +17 -2
  237. package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +26 -6
  238. package/node_modules/typebox/build/type/engine/exclude/operation.mjs +3 -4
  239. package/node_modules/typebox/build/type/engine/extract/operation.d.mts +1 -1
  240. package/node_modules/typebox/build/type/engine/extract/operation.mjs +3 -4
  241. package/node_modules/typebox/build/type/engine/priority/priority.d.mts +2 -2
  242. package/node_modules/typebox/build/type/engine/priority/priority.mjs +3 -4
  243. package/node_modules/typebox/build/type/script/mapping.d.mts +32 -29
  244. package/node_modules/typebox/build/type/script/mapping.mjs +18 -25
  245. package/node_modules/typebox/build/type/script/parser.d.mts +19 -25
  246. package/node_modules/typebox/build/type/script/parser.mjs +27 -23
  247. package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
  248. package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
  249. package/node_modules/typebox/package.json +27 -27
  250. package/node_modules/typebox/readme.md +79 -82
  251. package/openclaw.plugin.json +2 -1
  252. package/package.json +6 -6
  253. package/node_modules/baileys/node_modules/process-warning/types/index.test-d.ts +0 -36
  254. package/node_modules/typebox/build/format/_idna.d.mts +0 -2
  255. package/node_modules/typebox/build/format/_idna.mjs +0 -246
  256. package/node_modules/typebox/build/format/_puny.d.mts +0 -1
  257. package/node_modules/typebox/build/format/_puny.mjs +0 -77
  258. package/node_modules/typebox/build/schema/resolve/ref.d.mts +0 -3
  259. package/node_modules/typebox/build/schema/resolve/ref.mjs +0 -146
  260. package/node_modules/typebox/build/schema/types/contentEncoding.d.mts +0 -9
  261. package/node_modules/typebox/build/schema/types/contentEncoding.mjs +0 -13
  262. package/node_modules/typebox/build/schema/types/contentMediaType.d.mts +0 -9
  263. package/node_modules/typebox/build/schema/types/contentMediaType.mjs +0 -13
@@ -91,7 +91,7 @@ const User = Type.Object({ // const User = {
91
91
  // type: 'string',
92
92
  // format: 'email'
93
93
  // }
94
- // }
94
+ // },
95
95
  // required: [
96
96
  // 'id',
97
97
  // 'name',
@@ -111,24 +111,28 @@ type User = Type.Static<typeof User> // type User = {
111
111
 
112
112
  ## Script
113
113
 
114
- [Documentation](https://sinclairzx81.github.io/typebox/#/docs/script/overview) | [Example 1](https://www.typescriptlang.org/play/?target=99&module=7#code/JYWwDg9gTgLgBAFQJ5gKZwGZQiOByGFVAIwgA88AoSgehrgFkIATAVwBtVKBjCAOwDO8BgEMYACzgBeREQB0AZW5RgYGAAoABpThxCaOADVU3GNABM0uAG84ZAFxw+rEMVRQANHCSPnr93AAvjp6REYmZlAAzFa2Dk4ubp7evonuXgBeqf5QQSH66Mam0AAssXbZSV4+CTmZlelwAO4NucGaAJTUdHAAIqhofMyofMIsHFy8gvC2DKgCkoFWyGiKyqoaohJemrr5YcawqGSxIbqQAsAwwPyORZElHmdO0CAi7HcR0FFPurqsADdPsUoOYQsFdAU4ABxVA4VAwKBIU5-OAA9zXbjzT5HMgAbQAur8-sAhsAsQJWoTwfsDFt3MB3ii-iJXMARjBgQ9ibpmMAMBhWAJUFzSjy4AI0NwOCIoKKoCUaZCwnMFszdABzOEgBFIxyw+GIpDit4wBnvRz0lTvGmdbr0ABKrFGoHQDtQGE4phufEoqvEcjA2DQsHZAjkWsNSMDwYxYbk6NDFLkV1QIHDQYgIeu80DEEu134MazcdzZD98wDmez8cjOqNxZrucTmNzqfTjdL4b4r3endDZYrC37OfDdd1SBH8Zb5LbZo71a7ckBU8H-tX4dN5vYG7kfIFQtQu-L68XA83Ym3u9ZxHZo2PQ6rsfPci31p3Z9HcklJhlUAftD0AoMBiOScAAJJ8Bg7gjFilCCnw3r8HAUAjMMUDqDqCyOCsR7AaB3AADwFBAGCMJWAB8HQ2CEWEBuODYzhSeIAAwEnmBY+nI5a6HREbahOCZxsxbFyD2UBvDuPFwHxDHRkx8ysexK7SXxb6Mju+6CsK3G0ZWr6Xu+cg3neMC6bx+nqX2P7Suwsq6YEQA) | [Example 2](https://www.typescriptlang.org/play/?target=99&module=7#code/JYWwDg9gTgLgBAFQJ5gKZwGZQiOByGFVAIwgA88AoSgehrgFkIATAVwBtVKA7AQxFQBnMLwDG6BrxgALOAG9KcOKjKRYcURG6D4ANVSiY0AExwAvIiIA6APLEAVgZgAKOXDIAuS2isA5ViDEqFDOAJQANHBIXsg+-oHBYXAAvqGKyqrQ8Jraek7QAMzm3qi2Dk6u7jHW8UEhEVHVcQF1YZEAXk2ltYmhKWlKKmrZWjpw+obQACzFsaV2joaVniV+Lb2R0as99R1dawm7cADu+ztJqZTJ1HRwACKoaNzMqNzwTGyclDlj+rAqs2sCwqCiUkEEwBgwC0XkkMisEyMUCm4XS3GgIF47FhUmkCPyUAKqKUrAAbjj4YiTFc0j94ABxVA4VAwKBIQE+YFLUFwUnBKHiQT7ACCUCgvCQzj+MBUEXSwGewEFIrFEuccwOrVCaUudMYUmCwCxHPm5W56X4xGArxgFLxVORxLgzGAGAwrEEqDt+MmjvSwgMHF4UG9DqmNO+o3eQlkFg1XJcPIA5kyBKytozmemnZiZVAjdj9XmCxHaPQAEqsN6gdDl1AYTiGaHcSgMGNWMDYNCwa2CKwprNsjtd-m9qx8nuCqyQ1AgPudiDdqFCDsQCFQrTDxejldkVvthdLscDtNDw87vsTgUrmdzrdHlfoqCY9j3i9WPdtwR4889lcnlkzxHP9L1HKdb3nYDlz7Mk3xAj992-ODoKsXNDSxZCxxdN0PVKX8UM-A8oLHND8ww-Cx0ta03kw3dEJ-YiV1IgtaL7ANRCDKBWIQss4AAZRgKQlTgABJbgMGCV5xEod1uCbLQ4CgV4XhCARv32AShNEAAeQg0AgDBGBjAA+PoeTUvEAPTccwKEABtAAGABdVd12bBClAs-tU0ApAbMneznKsJ8Xw8uAvKsocryVQKXNgvdPPbZiMOw91PTCrzktfKibQypKDTI192M4hDkiAA) | [Challenge](test/typescript/readme.md)
114
+ [Documentation](https://sinclairzx81.github.io/typebox/#/docs/script/overview) | [Example 1](https://www.typescriptlang.org/play/?target=99&module=7#code/JYWwDg9gTgLgBAFQJ5gKZwGZQiOByGFVAIwgA88AoSgehrgFkBDGAC0YgBMBXAG1WoBjCADsAzvGZs4AXkREAdAGVBUYGBgAKAAaU4cQmjgA1VIJjQALLLgBvOGQBccEdxDFUUADRwkz1+6ePgBe-m4e3nAA7mGBUHAAvnoGRCZmFlAAzDb2Ti7hQb6xESHFnonJhuim5tAATDkOZZF++XEV2gCU1HRwAOJQTGCswIJiHDz8QqIS-YPDo+NyyGjKqupaUqw+uvpVabCoZDnJ+pBiwDDAos41GZZepy7QIEy8t+nQmY-6+twAbh9alA6skkntUn1UDhUDAoEgTr84P9PFdBKgxB9DmQANoAXR+v2AIk4owxzXxYMqqSknmAb0RvyY7mAqBEMCB90J+lJGAw3DEqE5Vm5cDEaEEfCYUGFUEsVIhRgYGPYclsTwA5tCQLD4c4oTC4UhRa8YHS3s5aWo3lSutR9sqxKr5KslDAWKMADxVCAYOZDEZjHF4R2sPB4gB8+l6DpVjKRCcTSeTKZTvX0WsNerscAUecSotTReLJfTcFN5veObzCgqJfrDeTvQSQA) | [Example 2](https://www.typescriptlang.org/play/?target=99&module=7#code/JYWwDg9gTgLgBAFQJ5gKZwGZQiOByGFVAIwgA88AoSgehrgFkBDGAC0YgBMBXAG1WoBjCADsAzvABqqQTGgAWOAF5ERAHQB5YgCsZMABQBvOGQBcqtGoBy3EMVRR9ASgA0cJOeSWbdh87cAXp7qPvaOrnAA7sHetmHOcAC+TpTC4lJ60ADMyhaomjp6RiYx+aF+ER551nEVgaU1vuFJKWkScNKy0ABMuV75WrqyxWbV5eFuVf2N8U4t1HRwAOJQTGCswIJiHDz8QqLt0rCoZH3qg0WGlHBwkGLAMMCi5p1yUPIu13Ai0CBMvC9MlAsp8btwAG6ArpQbqUZKpA7wJaoHCoGBQJBnSwXYZXG7ghyPQSoMQNACCUFWSH0RxgJ1cX2AIk4mxJ5MpTGp03GzhS8La8GYdKgwH+WIGhVxXyYdmAqBEMChbw+XxZGAw3DEqCVClBcDEaEEfCYUB170+-MRjBJ7BU0xxBjxcAA5iiQGiMeZkaj0Ug9X9haKAYwWA4g3CUpRCGhrWJbdUAMowFibAA80ZRGFjrAAfDd8wXC4sM9nck7CxXK1XqzX84sbq6fZ64MY1G2knra13u1363AA2H-uZW+3El8exPJ3X6IkgA)
115
115
 
116
- TypeBox includes a runtime scripting engine that can transform TypeScript definitions into JSON Schema. The engine is implemented symmetrically at runtime and inside TypeScript's type system. It supports many programmable type-level constructs such as Conditional, Mapped, Indexed, Generic, Distributive Conditional, and more. The engine is designed for TypeScript 7 but is supported in TypeScript 5 and above.
116
+ TypeBox includes a micro TypeScript engine that can transform TypeScript definitions to JSON Schema. The engine is fully type-safe and supports many programmable constructs including Conditional, Mapped, Indexed, Generics, Distributive Generics, and more.
117
117
 
118
118
  ### Example
119
119
 
120
- Syntax highlighting is available via the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=sinclairzx81.typebox-script)
120
+ Syntax highlighting is available via the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=sinclairzx81.typebox-script).
121
121
 
122
122
  ```typescript
123
- // Module
123
+ import Type from 'typebox'
124
+
125
+ // Math Module
126
+
124
127
  const Math = Type.Script(`
125
- type Vector2 = { x: number, y: number }
126
- type Vector3 = { x: number, y: number, z: number }
127
128
  type Vector4 = { x: number, y: number, z: number, w: number }
129
+ type Vector3 = { x: number, y: number, z: number }
130
+ type Vector2 = { x: number, y: number }
128
131
  `)
129
132
 
130
- // Dependent Module
131
- const { Mesh } = Type.Script(Math, `
133
+ // Graphics Module
134
+
135
+ const Graphics = Type.Script(Math, `
132
136
  type Vertex = {
133
137
  position: Vector4,
134
138
  normal: Vector3,
@@ -149,23 +153,10 @@ const { Mesh } = Type.Script(Math, `
149
153
  }
150
154
  `)
151
155
 
152
- // Runtime Reflection
153
- Mesh.properties.geometry.properties.vertices.items.properties.position.properties.x
154
- Mesh.properties.geometry.properties.vertices.items.properties.normal.properties.x
155
- Mesh.properties.geometry.properties.vertices.items.properties.uv.properties.x
156
- Mesh.properties.material.properties.diffuse.properties.x
157
- Mesh.properties.material.properties.ambient.properties.x
158
- Mesh.properties.material.properties.specular.properties.x
159
-
160
- // Static Inference
161
- function render(mesh: Type.Static<typeof Mesh>) {
162
- mesh.geometry.vertices[0].position.x
163
- mesh.geometry.vertices[0].normal.x
164
- mesh.geometry.vertices[0].uv.x
165
- mesh.material.diffuse.x
166
- mesh.material.ambient.x
167
- mesh.material.specular.x
168
- }
156
+ type Mesh = Type.Static<typeof Graphics['Mesh']> // type Mesh = {
157
+ // geometry: { ... },
158
+ // material: { ... }
159
+ // }
169
160
  ```
170
161
 
171
162
  <a name="Schema"></a>
@@ -184,18 +175,21 @@ import Schema from 'typebox/schema'
184
175
 
185
176
  ### Compile
186
177
 
187
- The compiler accepts JSON Schema and returns Validator instances.
178
+ The compiler accepts either TypeBox types or native JSON Schema.
188
179
 
189
180
  ```typescript
190
- const Vector = Schema.Compile(Type.Object({ // const Vector: Validator<TObject<{
181
+
182
+ // Type
183
+
184
+ const VectorA = Schema.Compile(Type.Object({ // const VectorA: Validator<TObject<{
191
185
  x: Type.Number(), // x: TNumber
192
186
  y: Type.Number(), // y: TNumber
193
187
  z: Type.Number() // z: TNumber
194
188
  })) // }>>
195
- ```
196
- With JSON Schema
197
- ```typescript
198
- const Vector = Schema.Compile({ // const Vector: Validator<{
189
+
190
+ // Schema
191
+
192
+ const VectorB = Schema.Compile({ // const VectorB: Validator<{
199
193
  type: 'object', // type: "object";
200
194
  required: ['x', 'y', 'z'], // required: ["x", "y", "z"];
201
195
  properties: { // properties: { ... };
@@ -208,35 +202,36 @@ const Vector = Schema.Compile({ // const Vector: Validator<{
208
202
 
209
203
  ### Validate
210
204
 
211
- Validator instances provide functions to Check and Parse values.
205
+ Compiled validator instances provide functions to Check and Parse values.
212
206
 
213
207
  ```typescript
208
+
209
+ // Compile
210
+
214
211
  const Vector = Schema.Compile(Type.Script(`{
215
212
  x: number
216
213
  y: number
217
214
  z: number
218
215
  }`))
219
216
 
220
- const valid = Vector.Check({ // const valid: boolean
221
- x: 1,
222
- y: 0,
223
- z: 0
224
- })
225
-
226
- const value = Vector.Parse({ // const value: {
227
- x: 1, // x: number
228
- y: 0, // y: number
229
- z: 0 // z: number
230
- }) // }
231
- ```
217
+ // Check
218
+
219
+ const valid = Vector.Check({ x: 1, y: 0, z: 0 }) // const valid: boolean
232
220
 
221
+ // Parse
233
222
 
223
+ const result = Vector.Parse({ x: 1, y: 0, z: 0 }) // const result: {
224
+ // x: number
225
+ // y: number
226
+ // z: number
227
+ // }
228
+ ```
234
229
 
235
230
  ### Coverage
236
231
 
237
- The following table shows specification coverage implemented by TypeBox.
232
+ [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)
238
233
 
239
- Ref: [JSON Schema Test Suite](https://github.com/json-schema-org/JSON-Schema-Test-Suite)
234
+ TypeBox supports all major JSON Schema draft versions and tracks compliance against the official JSON Schema Test Suite. It also maintains a separate JavaScript compliance suite to track ecosystem adoption as JSON Schema moves toward the V1 candidate. The following table shows TypeBox specification coverage.
240
235
 
241
236
  | Spec | 3 | 4 | 6 | 7 | 2019-09 | 2020-12 | v1 |
242
237
  |:-----|:--|:--|:--|:--|:--|:--|:--|
@@ -253,7 +248,7 @@ Ref: [JSON Schema Test Suite](https://github.com/json-schema-org/JSON-Schema-Tes
253
248
  | dependencies | 17/18 | ✅ | ✅ | ✅ | - | - | - |
254
249
  | dependentRequired | - | - | - | - | ✅ | ✅ | ✅ |
255
250
  | dependentSchemas | - | - | - | - | ✅ | ✅ | ✅ |
256
- | dynamicRef | - | - | - | - | - | 38/44 | 19/27 |
251
+ | dynamicRef | - | - | - | - | - | 40/44 | 21/27 |
257
252
  | enum | 14/16 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
258
253
  | exclusiveMaximum | - | - | ✅ | ✅ | ✅ | ✅ | ✅ |
259
254
  | exclusiveMinimum | - | - | ✅ | ✅ | ✅ | ✅ | ✅ |
@@ -279,50 +274,52 @@ Ref: [JSON Schema Test Suite](https://github.com/json-schema-org/JSON-Schema-Tes
279
274
  | properties | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
280
275
  | propertyNames | - | - | ✅ | ✅ | ✅ | ✅ | ✅ |
281
276
  | recursiveRef | - | - | - | - | ✅ | - | - |
282
- | ref | 23/27 | 37/45 | 67/70 | 75/78 | 79/81 | 77/79 | 77/79 |
277
+ | ref | 22/27 | 37/45 | 67/70 | 75/78 | 79/81 | 77/79 | 78/79 |
283
278
  | required | 3/4 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
284
279
  | type | 73/80 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
285
- | unevaluatedItems | - | - | - | - | ✅ | 65/71 | 64/71 |
286
- | unevaluatedProperties | - | - | - | - | ✅ | ✅ | 124/125 |
280
+ | unevaluatedItems | - | - | - | - | ✅ | ✅ | 70/71 |
281
+ | unevaluatedProperties | - | - | - | - | ✅ | ✅ | 128/129 |
287
282
  | uniqueItems | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
288
283
 
289
-
290
284
  ### Performance
291
285
 
292
- The following table shows compile performance for various JSON Schema structures using AJV8 as a basis for comparison.
286
+ TypeBox tracks comparative performance against AJV8 as the de facto performance standard. For broader comparative benchmarks, refer to the community maintained projects below.
287
+
288
+ [Runtime Benchmarks](https://moltar.github.io/typescript-runtime-type-benchmarks/) | [Schema Benchmarks](https://schemabenchmarks.dev/)
289
+
290
+ The following table shows compilation performance for various JSON Schema structures. These benchmarks measure the time required to JIT compile schematics, with faster compilation resulting in faster application startup.
293
291
 
294
292
  ```python
295
- ┌──────────────────────┬─────────────┬─────────────┐
296
- │ Compile │ TB1X │ AJV8 │
297
- ├──────────────────────┼─────────────┼─────────────┤
298
- │ Boolean │ 39.7K ops/s │ 6.8K ops/s │
299
- │ Number │ 86.2K ops/s │ 7.5K ops/s │
300
- │ String │ 82.6K ops/s │ 8.2K ops/s │
301
- │ Null │ 62K ops/s │ 7.3K ops/s │
302
- │ Literal_String │ 72.1K ops/s │ 5.7K ops/s │
303
- │ Literal_Number │ 72.7K ops/s │ 6.9K ops/s │
304
- │ Literal_Boolean │ 80.9K ops/s │ 7K ops/s │
305
- │ Pattern │ 38.7K ops/s │ 5.7K ops/s │
306
- │ Object_Open │ 16.3K ops/s │ 1.3K ops/s │
307
- │ Object_Close │ 15.7K ops/s │ 952 ops/s │
308
- │ Object_Vector3 │ 40.2K ops/s │ 3.2K ops/s │
309
- │ Object_Basis3 │ 16.1K ops/s │ 834 ops/s │
310
- │ Intersect_And │ 45.7K ops/s │ 3.5K ops/s │
311
- │ Intersect_Structural │ 21K ops/s │ 1.6K ops/s │
312
- │ Union_Or │ 45.1K ops/s │ 3.4K ops/s │
313
- │ Union_Structural │ 27.6K ops/s │ 2K ops/s │
314
- │ Tuple_Values │ 14.7K ops/s │ 2K ops/s │
315
- │ Tuple_Objects │ 3.7K ops/s │ 380 ops/s │
316
- │ Array_Numbers_4 │ 73.6K ops/s │ 4.3K ops/s │
317
- │ Array_Numbers_8 │ 50.9K ops/s │ 3.8K ops/s │
318
- │ Array_Numbers_16 │ 85K ops/s │ 3.9K ops/s │
319
- │ Array_Objects_Open │ 18.9K ops/s │ 789 ops/s │
320
- │ Array_Objects_Close │ 17.9K ops/s │ 909 ops/s │
321
- └──────────────────────┴─────────────┴─────────────┘
293
+ ┌──────────────────────┬──────────────┬──────────────┐
294
+ │ Compile │ TB1X │ AJV8 │
295
+ ├──────────────────────┼──────────────┼──────────────┤
296
+ │ Boolean │ 50.4K ops/s │ 7.1K ops/s │
297
+ │ Number │ 129.9K ops/s │ 7.9K ops/s │
298
+ │ String │ 128.9K ops/s │ 9.1K ops/s │
299
+ │ Null │ 91.3K ops/s │ 8.4K ops/s │
300
+ │ Literal_String │ 63.1K ops/s │ 7.4K ops/s │
301
+ │ Literal_Number │ 74.5K ops/s │ 7.6K ops/s │
302
+ │ Literal_Boolean │ 143.3K ops/s │ 7.7K ops/s │
303
+ │ Pattern │ 94.2K ops/s │ 6.4K ops/s │
304
+ │ Object_Open │ 19.4K ops/s │ 1.3K ops/s │
305
+ │ Object_Close │ 17.6K ops/s │ 991 ops/s │
306
+ │ Object_Vector3 │ 46.1K ops/s │ 3.3K ops/s │
307
+ │ Object_Basis3 │ 16K ops/s │ 848 ops/s │
308
+ │ Intersect_And │ 41.3K ops/s │ 4.2K ops/s │
309
+ │ Intersect_Structural │ 25.3K ops/s │ 1.5K ops/s │
310
+ │ Union_Or │ 58.6K ops/s │ 2.4K ops/s │
311
+ │ Union_Structural │ 31.5K ops/s │ 1.8K ops/s │
312
+ │ Tuple_Values │ 18.2K ops/s │ 1.9K ops/s │
313
+ │ Tuple_Objects │ 3.9K ops/s │ 437 ops/s │
314
+ │ Array_Numbers_4 │ 114.5K ops/s │ 4.2K ops/s │
315
+ │ Array_Numbers_8 │ 128.3K ops/s │ 3.9K ops/s │
316
+ │ Array_Numbers_16 │ 128.4K ops/s │ 4K ops/s │
317
+ │ Array_Objects_Open │ 22K ops/s │ 780 ops/s │
318
+ │ Array_Objects_Close │ 22K ops/s │ 1K ops/s │
319
+ └──────────────────────┴──────────────┴──────────────┘
322
320
  ```
323
321
 
324
-
325
- The following tables shows validation performance for various JSON Schema structures using AJV8 as a basis for comparison.
322
+ The following tables shows validation performance for various JSON Schema structures. These benchmarks measure overall validation throughput for JIT compiled schematics.
326
323
 
327
324
  ```python
328
325
  ┌──────────────────────┬──────────────┬──────────────┐
@@ -15,7 +15,8 @@
15
15
  },
16
16
  "contracts": {
17
17
  "tools": [
18
- "whatsapp_call"
18
+ "whatsapp_call",
19
+ "whatsapp_login"
19
20
  ]
20
21
  },
21
22
  "channels": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/whatsapp",
3
- "version": "2026.8.1-beta.3",
3
+ "version": "2026.8.2",
4
4
  "description": "OpenClaw WhatsApp channel plugin for WhatsApp Web chats.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,11 +9,11 @@
9
9
  "type": "module",
10
10
  "dependencies": {
11
11
  "audio-decode": "2.2.3",
12
- "baileys": "7.0.0-rc13",
13
- "typebox": "1.3.6"
12
+ "baileys": "7.0.0-rc14",
13
+ "typebox": "1.3.17"
14
14
  },
15
15
  "peerDependencies": {
16
- "openclaw": ">=2026.8.1-beta.3"
16
+ "openclaw": ">=2026.8.2"
17
17
  },
18
18
  "peerDependenciesMeta": {
19
19
  "openclaw": {
@@ -65,10 +65,10 @@
65
65
  "minHostVersion": ">=2026.4.25"
66
66
  },
67
67
  "compat": {
68
- "pluginApi": ">=2026.8.1-beta.3"
68
+ "pluginApi": ">=2026.8.2"
69
69
  },
70
70
  "build": {
71
- "openclawVersion": "2026.8.1-beta.3"
71
+ "openclawVersion": "2026.8.2"
72
72
  },
73
73
  "release": {
74
74
  "publishToClawHub": true,
@@ -1,36 +0,0 @@
1
- import { expectType } from 'tsd'
2
- import { createWarning, createDeprecation } from '..'
3
-
4
- const WarnInstance = createWarning({
5
- name: 'TypeScriptWarning',
6
- code: 'CODE',
7
- message: 'message'
8
- })
9
-
10
- expectType<string>(WarnInstance.code)
11
- expectType<string>(WarnInstance.message)
12
- expectType<string>(WarnInstance.name)
13
- expectType<boolean>(WarnInstance.emitted)
14
- expectType<boolean>(WarnInstance.unlimited)
15
-
16
- expectType<void>(WarnInstance())
17
- expectType<void>(WarnInstance('foo'))
18
- expectType<void>(WarnInstance('foo', 'bar'))
19
-
20
- const buildWarnUnlimited = createWarning({
21
- name: 'TypeScriptWarning',
22
- code: 'CODE',
23
- message: 'message',
24
- unlimited: true
25
- })
26
- expectType<boolean>(buildWarnUnlimited.unlimited)
27
-
28
- const DeprecationInstance = createDeprecation({
29
- code: 'CODE',
30
- message: 'message'
31
- })
32
- expectType<string>(DeprecationInstance.code)
33
-
34
- DeprecationInstance()
35
- DeprecationInstance('foo')
36
- DeprecationInstance('foo', 'bar')
@@ -1,2 +0,0 @@
1
- export declare function IsIdnLabel(value: string): boolean;
2
- export declare function IsLabel(value: string): boolean;
@@ -1,246 +0,0 @@
1
- import { Unreachable } from '../system/unreachable/index.mjs';
2
- import * as Puny from './_puny.mjs';
3
- // ------------------------------------------------------------------
4
- // Unicode General Category Helper (RFC 5892)
5
- // ------------------------------------------------------------------
6
- function IsNonspacingMark(cp) {
7
- return /\p{Mn}/u.test(String.fromCodePoint(cp));
8
- }
9
- function IsSpacingCombiningMark(cp) {
10
- return /\p{Mc}/u.test(String.fromCodePoint(cp));
11
- }
12
- function IsEnclosingMark(cp) {
13
- return /\p{Me}/u.test(String.fromCodePoint(cp));
14
- }
15
- function IsCombiningMark(cp) {
16
- return IsNonspacingMark(cp) || IsSpacingCombiningMark(cp) || IsEnclosingMark(cp);
17
- }
18
- // ------------------------------------------------------------------
19
- // RFC 5892 §2.6 DISALLOWED exceptions
20
- //
21
- // https://tools.ietf.org/html/rfc5892#section-2.6
22
- // ------------------------------------------------------------------
23
- const RFC5892_DISALLOWED = new Set([
24
- 0x0640, // ARABIC TATWEEL
25
- 0x07fa, // NKO LAJANYALAN
26
- 0x302e, // HANGUL SINGLE DOT TONE MARK
27
- 0x302f, // HANGUL DOUBLE DOT TONE MARK
28
- 0x3031, // VERTICAL KANA REPEAT MARK
29
- 0x3032, // VERTICAL KANA REPEAT WITH VOICED ITERATION MARK
30
- 0x3033, // VERTICAL KANA REPEAT MARK UPPER HALF
31
- 0x3034, // VERTICAL KANA REPEAT WITH VOICED ITERATION MARK UPPER HALF
32
- 0x3035, // VERTICAL KANA REPEAT MARK LOWER HALF
33
- 0x303b // VERTICAL IDEOGRAPHIC ITERATION MARK
34
- ]);
35
- // ------------------------------------------------------------------
36
- // A set of Virama (halant) code points used to validate CONTEXTJ
37
- // rules (RFC 5892 Appendix A.1). These characters allow a subsequent
38
- // Zero Width Non-Joiner (U+200C) or Zero Width Joiner (U+200D) to
39
- // be valid in a label.
40
- // ------------------------------------------------------------------
41
- const VIRAMA_CPS = new Set([
42
- 0x094d,
43
- 0x09cd,
44
- 0x0a4d,
45
- 0x0acd,
46
- 0x0b4d,
47
- 0x0bcd,
48
- 0x0c4d,
49
- 0x0ccd,
50
- 0x0d3b,
51
- 0x0d3c,
52
- 0x0d4d,
53
- 0x0dca,
54
- 0x1b44,
55
- 0x1baa,
56
- 0x1bab,
57
- 0xa9c0,
58
- 0x11046,
59
- 0x1107f,
60
- 0x110b9,
61
- 0x11133,
62
- 0x11134,
63
- 0x111c0,
64
- 0x11235,
65
- 0x1134d,
66
- 0x11442,
67
- 0x114c2,
68
- 0x115bf,
69
- 0x1163f,
70
- 0x116b6,
71
- 0x11c3f,
72
- 0x11d44,
73
- 0x11d45
74
- ]);
75
- // ------------------------------------------------------------------
76
- // Guards for CONTEXTO rules (RFC 5892 Appendix A)
77
- // ------------------------------------------------------------------
78
- function IsGreek(cp) {
79
- return /\p{Script=Greek}/u.test(String.fromCodePoint(cp));
80
- }
81
- function IsHebrew(cp) {
82
- return /\p{Script=Hebrew}/u.test(String.fromCodePoint(cp));
83
- }
84
- function IsHiragana(cp) {
85
- return /\p{Script=Hiragana}/u.test(String.fromCodePoint(cp));
86
- }
87
- function IsKatakana(cp) {
88
- return /\p{Script=Katakana}/u.test(String.fromCodePoint(cp));
89
- }
90
- function IsHan(cp) {
91
- return /\p{Script=Han}/u.test(String.fromCodePoint(cp));
92
- }
93
- function IsArabicIndicDigit(cp) {
94
- return cp >= 0x0660 && cp <= 0x0669;
95
- }
96
- function IsExtendedArabicIndicDigit(cp) {
97
- return cp >= 0x06f0 && cp <= 0x06f9;
98
- }
99
- function IsVirama(cp) {
100
- return VIRAMA_CPS.has(cp);
101
- }
102
- // ------------------------------------------------------------------
103
- // IsUnicodeLabel
104
- // ------------------------------------------------------------------
105
- function IsUnicodeLabel(value) {
106
- // deno-coverage-ignore-start - unable to reach via format guards
107
- if (value.length === 0)
108
- return Unreachable(); // false
109
- // deno-coverage-ignore-stop
110
- // Use spread to handle surrogate pairs and provide O(1) neighbor access
111
- const cps = [...value].map((c) => c.codePointAt(0));
112
- const len = cps.length;
113
- // RFC 5891 §4.2.3.2: Hyphen rules
114
- if (cps[0] === 0x2d || cps[len - 1] === 0x2d)
115
- return false;
116
- if (len >= 4 && cps[2] === 0x2d && cps[3] === 0x2d)
117
- return false;
118
- // RFC 5891 §4.2.3.2 - Must not begin with a combining mark
119
- if (IsCombiningMark(cps[0]))
120
- return false;
121
- let hasJapanese = false;
122
- let hasArabicIndic = false;
123
- let hasExtendedArabicIndic = false;
124
- for (let i = 0; i < len; i++) {
125
- const cp = cps[i];
126
- // 1. DISALLOWED exceptions
127
- if (RFC5892_DISALLOWED.has(cp))
128
- return false;
129
- // 2. Collect Flags
130
- if (IsHiragana(cp) || IsKatakana(cp) || IsHan(cp))
131
- hasJapanese = true;
132
- if (IsArabicIndicDigit(cp))
133
- hasArabicIndic = true;
134
- if (IsExtendedArabicIndicDigit(cp))
135
- hasExtendedArabicIndic = true;
136
- // 3. CONTEXTO / CONTEXTJ Neighbor Rules
137
- const prev = cps[i - 1], next = cps[i + 1];
138
- switch (cp) {
139
- case 0x00b7:
140
- if (prev !== 0x006c || next !== 0x006c)
141
- return false;
142
- break; // MIDDLE DOT (Catalan)
143
- case 0x0375:
144
- if (next === undefined || !IsGreek(next))
145
- return false;
146
- break; // Greek KERAIA
147
- case 0x05f3:
148
- case 0x05f4:
149
- if (prev === undefined || !IsHebrew(prev))
150
- return false;
151
- break; // Hebrew GERESH
152
- case 0x200c: // ZWNJ - RFC 5892 Appendix A.1
153
- // Note: Full validation requires a Unicode joining type table. We reject
154
- // only when preceded by ASCII (U+0000-U+007F), which can never satisfy
155
- // the Virama or cursive-joining rules.
156
- if (prev === undefined || (prev < 0x0080 && !IsVirama(prev)))
157
- return false;
158
- break;
159
- case 0x200d: // ZWJ - RFC 5892 Appendix A.2
160
- if (prev === undefined || !IsVirama(prev))
161
- return false;
162
- break;
163
- case 0x30fb: /* Checked at end via hasJapanese */
164
- break; // KATAKANA MIDDLE DOT
165
- }
166
- }
167
- // 4. Global Context Validations (Post-loop)
168
- // RFC 5892 Appendix A.7 - Katakana Middle Dot requirement
169
- if (value.includes('\u30fb') && !hasJapanese)
170
- return false;
171
- // RFC 5892 Appendix A.8/A.9 - Mixing Arabic Digits
172
- if (hasArabicIndic && hasExtendedArabicIndic)
173
- return false;
174
- return true;
175
- }
176
- // ------------------------------------------------------------------
177
- // IsAsciiLabel
178
- // ------------------------------------------------------------------
179
- function IsAsciiLabel(value) {
180
- // Must not start or end with a hyphen
181
- if (value.charCodeAt(0) === 45 || value.charCodeAt(value.length - 1) === 45)
182
- return false;
183
- // RFC 5891 §4.2.3.1 : "--" at positions 3-4 is reserved for A-labels only
184
- if (value.length >= 4 && value.charCodeAt(2) === 45 && value.charCodeAt(3) === 45)
185
- return false;
186
- // All characters must be alphanumeric or hyphen
187
- for (let i = 0; i < value.length; i++) {
188
- const ch = value.charCodeAt(i);
189
- if (!((ch >= 97 && ch <= 122) || // a-z
190
- (ch >= 65 && ch <= 90) || // A-Z
191
- (ch >= 48 && ch <= 57) || // 0-9
192
- ch === 45 // '-'
193
- ))
194
- return false;
195
- }
196
- return true;
197
- }
198
- // ------------------------------------------------------------------
199
- // IsPunyLabel
200
- // ------------------------------------------------------------------
201
- function IsPuny(value) {
202
- return value.toLowerCase().startsWith('xn--');
203
- }
204
- function IsPunyLabel(value) {
205
- try {
206
- const payload = value.slice(4).toLowerCase();
207
- // 1. Structural Validation (RFC 3492 syntax)
208
- //
209
- // If the payload contains a hyphen, it MUST be a delimiter separating basic
210
- // ASCII characters from the variable-length integers. A payload consisting
211
- // of ONLY a hyphen or starting with multiple hyphens without basic ASCII
212
- // characters (like "-9uc") is fundamentally malformed.
213
- //
214
- const lastHyphen = payload.lastIndexOf('-');
215
- if (lastHyphen === 0) {
216
- // Catches "-9uc" right here because the delimiter is at index 0, meaning 0
217
- // basic ASCII characters preceded it, which is non-canonical.
218
- return false;
219
- }
220
- // 2. Decode the payload
221
- const decoded = Puny.Decode(payload);
222
- if (!decoded)
223
- return false;
224
- // 3. Validate the output rules against RFC 5892
225
- return IsUnicodeLabel(decoded);
226
- }
227
- catch {
228
- return false;
229
- }
230
- }
231
- // ------------------------------------------------------------------
232
- // IsIdnLabel
233
- // ------------------------------------------------------------------
234
- export function IsIdnLabel(value) {
235
- if (value.length === 0 || value.length > 63)
236
- return false;
237
- return IsPuny(value) ? IsPunyLabel(value) : IsUnicodeLabel(value);
238
- }
239
- // ------------------------------------------------------------------
240
- // IsLabel
241
- // ------------------------------------------------------------------
242
- export function IsLabel(value) {
243
- if (value.length === 0 || value.length > 63)
244
- return false;
245
- return IsPuny(value) ? IsPunyLabel(value) : IsAsciiLabel(value);
246
- }
@@ -1 +0,0 @@
1
- export declare function Decode(value: string): string;