@openclaw/slack 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 (255) hide show
  1. package/dist/account-configured-sUohAxZr.js +33 -0
  2. package/dist/account-inspect-C3sePHWa.js +87 -0
  3. package/dist/account-inspect-api.js +1 -1
  4. package/dist/{accounts-BlzxuYle.js → accounts-Dm_H77gH.js} +7 -10
  5. package/dist/{accounts.runtime-CbabBL8x.js → accounts.runtime-DRuEK6mL.js} +1 -1
  6. package/dist/{action-runtime-D6jg2CQd.js → action-runtime-B0kRJ69h.js} +90 -75
  7. package/dist/action-runtime.runtime-IuA14rev.js +2 -0
  8. package/dist/{actions-DFk0ANVB.js → actions-BOxiu2Vy.js} +278 -102
  9. package/dist/api.js +15 -15
  10. package/dist/{approval-handler.runtime-BNvAoKdK.js → approval-handler.runtime-l5_2JLqi.js} +58 -180
  11. package/dist/{channel-CA5w7qDF.js → channel-BguxhhNG.js} +97 -154
  12. package/dist/channel-config-api.js +1 -1
  13. package/dist/channel-plugin-api.js +1 -1
  14. package/dist/{channel-type-CZWv55Wu.js → channel-type-ChkODKBW.js} +3 -3
  15. package/dist/{channel.setup-CpyYsEXH.js → channel.setup-BJohRJha.js} +54 -68
  16. package/dist/{config-schema-CN3XZRX5.js → config-schema-B9GwoRlE.js} +24 -15
  17. package/dist/configured-state.js +34 -0
  18. package/dist/{conversation-binding-route-DFVLUdYF.js → conversation-binding-route-Vee8Dgbf.js} +2 -2
  19. package/dist/{directory-config-BGYyuzWh.js → directory-config-Bmw4ykSy.js} +5 -4
  20. package/dist/directory-contract-api.js +1 -1
  21. package/dist/{directory-live-DjUJQLbq.js → directory-live-BOILcXPo.js} +2 -2
  22. package/dist/{doctor-contract-BAy7-EUQ.js → doctor-contract-BNjw9bxb.js} +5 -4
  23. package/dist/doctor-contract-api.js +1 -1
  24. package/dist/{group-policy-DyfB_ZIE.js → group-policy-BYH74y50.js} +643 -774
  25. package/dist/{message-tool-api-CqMr5Rmc.js → message-tool-api-BsZbsulu.js} +23 -5
  26. package/dist/message-tool-api.js +1 -1
  27. package/dist/{monitor-Chrecrb9.js → monitor-B72wWXWg.js} +3 -3
  28. package/dist/{outbound-adapter-DuRqAQXK.js → outbound-adapter-CPgYQ-BM.js} +94 -69
  29. package/dist/{pipeline.runtime-Bbfd5VFW.js → pipeline.runtime-CcdujV99.js} +357 -544
  30. package/dist/{policy-BKXSxrIS.js → policy-CUpBeOt9.js} +7 -4
  31. package/dist/{probe-BVA65leh.js → probe-gj5yQgN2.js} +209 -21
  32. package/dist/{provider-CUUiwsg2.js → provider-DW9YC_no.js} +301 -179
  33. package/dist/{relay-source-mhpMMRG-.js → relay-source-BLMdBrAw.js} +6 -4
  34. package/dist/{replies-SnWyXcsL.js → replies-DLjQ8RYU.js} +25 -10
  35. package/dist/{resolve-channels-BSpqC8jU.js → resolve-channels-Bv6IiGZ4.js} +4 -3
  36. package/dist/{resolve-users-Dvz9pDe0.js → resolve-users-BXw2pA7y.js} +4 -3
  37. package/dist/runtime-api.js +11 -11
  38. package/dist/{scopes-BSk4GZvZ.js → scopes-B9HRguDe.js} +1 -1
  39. package/dist/{send-CtnOxKCc.js → send-GUz4_v2E.js} +58 -42
  40. package/dist/send-results-eeOu_HYm.js +23 -0
  41. package/dist/{send.runtime-kYctMHSd.js → send.runtime-rScD-UJi.js} +1 -1
  42. package/dist/setup-plugin-api.js +1 -1
  43. package/dist/{setup-surface-BPFfp6So.js → setup-surface-Cc3P-z35.js} +6 -6
  44. package/dist/{shared-DJBaslN7.js → shared-CQGVZ_8a.js} +28 -8
  45. package/dist/{slash-dispatch.runtime-Cf2FTrnf.js → slash-dispatch.runtime-C2015r6s.js} +3 -3
  46. package/dist/{target-parsing-BnMD2ZqZ.js → target-parsing-PbxGDbr9.js} +11 -6
  47. package/dist/{targets-Cx5W_n3W.js → targets-7FexXJ62.js} +1 -1
  48. package/node_modules/@slack/bolt/node_modules/@types/node/README.md +1 -1
  49. package/node_modules/@slack/bolt/node_modules/@types/node/child_process.d.ts +0 -1
  50. package/node_modules/@slack/bolt/node_modules/@types/node/crypto.d.ts +6 -6
  51. package/node_modules/@slack/bolt/node_modules/@types/node/dns/promises.d.ts +5 -5
  52. package/node_modules/@slack/bolt/node_modules/@types/node/dns.d.ts +5 -5
  53. package/node_modules/@slack/bolt/node_modules/@types/node/fs.d.ts +7 -0
  54. package/node_modules/@slack/bolt/node_modules/@types/node/http.d.ts +30 -0
  55. package/node_modules/@slack/bolt/node_modules/@types/node/http2.d.ts +4 -4
  56. package/node_modules/@slack/bolt/node_modules/@types/node/os.d.ts +30 -30
  57. package/node_modules/@slack/bolt/node_modules/@types/node/package.json +2 -2
  58. package/node_modules/@slack/bolt/node_modules/@types/node/perf_hooks.d.ts +2 -1
  59. package/node_modules/@slack/bolt/node_modules/@types/node/process.d.ts +42 -43
  60. package/node_modules/@slack/bolt/node_modules/@types/node/quic.d.ts +1049 -84
  61. package/node_modules/@slack/bolt/node_modules/@types/node/sqlite.d.ts +14 -1
  62. package/node_modules/@slack/bolt/node_modules/@types/node/stream/iter.d.ts +3 -2
  63. package/node_modules/@slack/bolt/node_modules/@types/node/test.d.ts +61 -0
  64. package/node_modules/@slack/bolt/node_modules/@types/node/v8.d.ts +20 -23
  65. package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/README.md +2 -0
  66. package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/dist/index.d.ts +20 -0
  67. package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/dist/index.js +20 -14
  68. package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/dist/index.js.map +1 -1
  69. package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/package.json +1 -1
  70. package/node_modules/@slack/bolt/node_modules/negotiator/lib/accept.js +54 -0
  71. package/node_modules/@slack/bolt/node_modules/negotiator/lib/charset.js +10 -34
  72. package/node_modules/@slack/bolt/node_modules/negotiator/lib/encoding.js +9 -30
  73. package/node_modules/@slack/bolt/node_modules/negotiator/lib/language.js +15 -36
  74. package/node_modules/@slack/bolt/node_modules/negotiator/lib/mediaType.js +16 -134
  75. package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/LICENSE +22 -0
  76. package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/README.md +71 -0
  77. package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/dist/index.d.ts +46 -0
  78. package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/dist/index.js +176 -0
  79. package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/dist/index.js.map +1 -0
  80. package/node_modules/@slack/bolt/node_modules/negotiator/node_modules/content-type/package.json +52 -0
  81. package/node_modules/@slack/bolt/node_modules/negotiator/package.json +16 -10
  82. package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/README.md +2 -0
  83. package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.d.ts +20 -0
  84. package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.js +20 -14
  85. package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -1
  86. package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/package.json +1 -1
  87. package/node_modules/@slack/socket-mode/node_modules/@types/node/README.md +1 -1
  88. package/node_modules/@slack/socket-mode/node_modules/@types/node/child_process.d.ts +0 -1
  89. package/node_modules/@slack/socket-mode/node_modules/@types/node/crypto.d.ts +6 -6
  90. package/node_modules/@slack/socket-mode/node_modules/@types/node/dns/promises.d.ts +5 -5
  91. package/node_modules/@slack/socket-mode/node_modules/@types/node/dns.d.ts +5 -5
  92. package/node_modules/@slack/socket-mode/node_modules/@types/node/fs.d.ts +7 -0
  93. package/node_modules/@slack/socket-mode/node_modules/@types/node/http.d.ts +30 -0
  94. package/node_modules/@slack/socket-mode/node_modules/@types/node/http2.d.ts +4 -4
  95. package/node_modules/@slack/socket-mode/node_modules/@types/node/os.d.ts +30 -30
  96. package/node_modules/@slack/socket-mode/node_modules/@types/node/package.json +2 -2
  97. package/node_modules/@slack/socket-mode/node_modules/@types/node/perf_hooks.d.ts +2 -1
  98. package/node_modules/@slack/socket-mode/node_modules/@types/node/process.d.ts +42 -43
  99. package/node_modules/@slack/socket-mode/node_modules/@types/node/quic.d.ts +1049 -84
  100. package/node_modules/@slack/socket-mode/node_modules/@types/node/sqlite.d.ts +14 -1
  101. package/node_modules/@slack/socket-mode/node_modules/@types/node/stream/iter.d.ts +3 -2
  102. package/node_modules/@slack/socket-mode/node_modules/@types/node/test.d.ts +61 -0
  103. package/node_modules/@slack/socket-mode/node_modules/@types/node/v8.d.ts +20 -23
  104. package/node_modules/@slack/web-api/node_modules/@types/node/README.md +1 -1
  105. package/node_modules/@slack/web-api/node_modules/@types/node/child_process.d.ts +0 -1
  106. package/node_modules/@slack/web-api/node_modules/@types/node/crypto.d.ts +6 -6
  107. package/node_modules/@slack/web-api/node_modules/@types/node/dns/promises.d.ts +5 -5
  108. package/node_modules/@slack/web-api/node_modules/@types/node/dns.d.ts +5 -5
  109. package/node_modules/@slack/web-api/node_modules/@types/node/fs.d.ts +7 -0
  110. package/node_modules/@slack/web-api/node_modules/@types/node/http.d.ts +30 -0
  111. package/node_modules/@slack/web-api/node_modules/@types/node/http2.d.ts +4 -4
  112. package/node_modules/@slack/web-api/node_modules/@types/node/os.d.ts +30 -30
  113. package/node_modules/@slack/web-api/node_modules/@types/node/package.json +2 -2
  114. package/node_modules/@slack/web-api/node_modules/@types/node/perf_hooks.d.ts +2 -1
  115. package/node_modules/@slack/web-api/node_modules/@types/node/process.d.ts +42 -43
  116. package/node_modules/@slack/web-api/node_modules/@types/node/quic.d.ts +1049 -84
  117. package/node_modules/@slack/web-api/node_modules/@types/node/sqlite.d.ts +14 -1
  118. package/node_modules/@slack/web-api/node_modules/@types/node/stream/iter.d.ts +3 -2
  119. package/node_modules/@slack/web-api/node_modules/@types/node/test.d.ts +61 -0
  120. package/node_modules/@slack/web-api/node_modules/@types/node/v8.d.ts +20 -23
  121. package/node_modules/typebox/build/format/date.d.mts +1 -1
  122. package/node_modules/typebox/build/format/date.mjs +1 -1
  123. package/node_modules/typebox/build/format/date_time.d.mts +2 -2
  124. package/node_modules/typebox/build/format/date_time.mjs +3 -3
  125. package/node_modules/typebox/build/format/email.d.mts +1 -1
  126. package/node_modules/typebox/build/format/email.mjs +2 -2
  127. package/node_modules/typebox/build/format/hostname.mjs +2 -10
  128. package/node_modules/typebox/build/format/idn_email.d.mts +1 -1
  129. package/node_modules/typebox/build/format/idn_email.mjs +3 -3
  130. package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -0
  131. package/node_modules/typebox/build/format/idn_hostname.mjs +3 -11
  132. package/node_modules/typebox/build/format/idna/format/bidi.d.mts +3 -0
  133. package/node_modules/typebox/build/format/idna/format/bidi.mjs +98 -0
  134. package/node_modules/typebox/build/format/idna/format/puny.d.mts +3 -0
  135. package/node_modules/typebox/build/format/idna/format/puny.mjs +144 -0
  136. package/node_modules/typebox/build/format/idna/hostname.d.mts +1 -0
  137. package/node_modules/typebox/build/format/idna/hostname.mjs +16 -0
  138. package/node_modules/typebox/build/format/idna/idn-hostname.d.mts +1 -0
  139. package/node_modules/typebox/build/format/idna/idn-hostname.mjs +41 -0
  140. package/node_modules/typebox/build/format/idna/index.d.mts +2 -0
  141. package/node_modules/typebox/build/format/idna/index.mjs +2 -0
  142. package/node_modules/typebox/build/format/idna/label/ascii.d.mts +1 -0
  143. package/node_modules/typebox/build/format/idna/label/ascii.mjs +9 -0
  144. package/node_modules/typebox/build/format/idna/label/puny.d.mts +1 -0
  145. package/node_modules/typebox/build/format/idna/label/puny.mjs +28 -0
  146. package/node_modules/typebox/build/format/idna/label/unicode.d.mts +1 -0
  147. package/node_modules/typebox/build/format/idna/label/unicode.mjs +106 -0
  148. package/node_modules/typebox/build/format/idna/pattern/pattern.d.mts +30 -0
  149. package/node_modules/typebox/build/format/idna/pattern/pattern.mjs +70 -0
  150. package/node_modules/typebox/build/format/ipv4.d.mts +0 -1
  151. package/node_modules/typebox/build/format/ipv4.mjs +2 -32
  152. package/node_modules/typebox/build/format/ipv6.mjs +2 -61
  153. package/node_modules/typebox/build/format/iri.d.mts +2 -2
  154. package/node_modules/typebox/build/format/iri.mjs +26 -8
  155. package/node_modules/typebox/build/format/iri_reference.d.mts +2 -2
  156. package/node_modules/typebox/build/format/iri_reference.mjs +9 -55
  157. package/node_modules/typebox/build/format/regex.d.mts +1 -2
  158. package/node_modules/typebox/build/format/regex.mjs +2 -6
  159. package/node_modules/typebox/build/format/time.d.mts +2 -2
  160. package/node_modules/typebox/build/format/time.mjs +19 -14
  161. package/node_modules/typebox/build/format/uri.d.mts +1 -1
  162. package/node_modules/typebox/build/format/uri.mjs +3 -130
  163. package/node_modules/typebox/build/format/uri_reference.d.mts +1 -1
  164. package/node_modules/typebox/build/format/uri_reference.mjs +2 -3
  165. package/node_modules/typebox/build/format/uri_template.d.mts +2 -3
  166. package/node_modules/typebox/build/format/uri_template.mjs +4 -5
  167. package/node_modules/typebox/build/format/url.d.mts +3 -3
  168. package/node_modules/typebox/build/format/url.mjs +4 -5
  169. package/node_modules/typebox/build/guard/emit.d.mts +3 -1
  170. package/node_modules/typebox/build/guard/emit.mjs +12 -5
  171. package/node_modules/typebox/build/guard/guard.d.mts +8 -2
  172. package/node_modules/typebox/build/guard/guard.mjs +25 -4
  173. package/node_modules/typebox/build/guard/string.d.mts +2 -2
  174. package/node_modules/typebox/build/guard/string.mjs +7 -7
  175. package/node_modules/typebox/build/schema/engine/_context.mjs +3 -3
  176. package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -2
  177. package/node_modules/typebox/build/schema/engine/_regexp.d.mts +2 -0
  178. package/node_modules/typebox/build/schema/engine/_regexp.mjs +4 -0
  179. package/node_modules/typebox/build/schema/engine/_stack.mjs +12 -13
  180. package/node_modules/typebox/build/schema/engine/additionalItems.mjs +17 -7
  181. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +4 -3
  182. package/node_modules/typebox/build/schema/engine/contains.mjs +18 -6
  183. package/node_modules/typebox/build/schema/engine/enum.mjs +1 -1
  184. package/node_modules/typebox/build/schema/engine/items.mjs +26 -6
  185. package/node_modules/typebox/build/schema/engine/maxContains.mjs +3 -3
  186. package/node_modules/typebox/build/schema/engine/minContains.mjs +14 -4
  187. package/node_modules/typebox/build/schema/engine/not.mjs +4 -2
  188. package/node_modules/typebox/build/schema/engine/oneOf.mjs +7 -6
  189. package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -2
  190. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +4 -3
  191. package/node_modules/typebox/build/schema/engine/ref.mjs +1 -7
  192. package/node_modules/typebox/build/schema/engine/schema.mjs +13 -4
  193. package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
  194. package/node_modules/typebox/build/schema/resolve/resolve.d.mts +4 -1
  195. package/node_modules/typebox/build/schema/resolve/resolve.mjs +202 -1
  196. package/node_modules/typebox/build/schema/static/propertyNames.d.mts +5 -0
  197. package/node_modules/typebox/build/schema/static/propertyNames.mjs +3 -0
  198. package/node_modules/typebox/build/schema/static/schema.d.mts +3 -0
  199. package/node_modules/typebox/build/schema/types/index.d.mts +0 -2
  200. package/node_modules/typebox/build/schema/types/index.mjs +0 -2
  201. package/node_modules/typebox/build/system/memory/clone.mjs +14 -11
  202. package/node_modules/typebox/build/system/memory/discard.mjs +6 -5
  203. package/node_modules/typebox/build/system/settings/settings.d.mts +9 -0
  204. package/node_modules/typebox/build/system/settings/settings.mjs +2 -0
  205. package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +6 -1
  206. package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +16 -3
  207. package/node_modules/typebox/build/type/engine/call/instantiate.mjs +34 -4
  208. package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +5 -5
  209. package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +20 -26
  210. package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +6 -10
  211. package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +9 -13
  212. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +7 -4
  213. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +12 -19
  214. package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +4 -20
  215. package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +8 -20
  216. package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +4 -4
  217. package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +11 -8
  218. package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +1 -1
  219. package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +3 -4
  220. package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +17 -2
  221. package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +26 -6
  222. package/node_modules/typebox/build/type/engine/exclude/operation.mjs +3 -4
  223. package/node_modules/typebox/build/type/engine/extract/operation.d.mts +1 -1
  224. package/node_modules/typebox/build/type/engine/extract/operation.mjs +3 -4
  225. package/node_modules/typebox/build/type/engine/priority/priority.d.mts +2 -2
  226. package/node_modules/typebox/build/type/engine/priority/priority.mjs +3 -4
  227. package/node_modules/typebox/build/type/script/mapping.d.mts +32 -29
  228. package/node_modules/typebox/build/type/script/mapping.mjs +18 -25
  229. package/node_modules/typebox/build/type/script/parser.d.mts +19 -25
  230. package/node_modules/typebox/build/type/script/parser.mjs +27 -23
  231. package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
  232. package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
  233. package/node_modules/typebox/package.json +27 -27
  234. package/node_modules/typebox/readme.md +79 -82
  235. package/node_modules/ws/lib/permessage-deflate.js +3 -1
  236. package/node_modules/ws/package.json +1 -1
  237. package/openclaw.plugin.json +14 -6
  238. package/package.json +9 -7
  239. package/dist/account-configured-BwfXBo_F.js +0 -14
  240. package/dist/account-inspect-YJvFBbCR.js +0 -89
  241. package/dist/action-runtime.runtime-JtoOK9l5.js +0 -2
  242. package/dist/actions.runtime-CYLsYRai.js +0 -2
  243. package/dist/runtime-api-DBi7xc_g.js +0 -10
  244. package/dist/slack-client-kind-BXyOOICI.js +0 -94
  245. package/node_modules/@slack/bolt/node_modules/negotiator/HISTORY.md +0 -114
  246. package/node_modules/typebox/build/format/_idna.d.mts +0 -2
  247. package/node_modules/typebox/build/format/_idna.mjs +0 -246
  248. package/node_modules/typebox/build/format/_puny.d.mts +0 -1
  249. package/node_modules/typebox/build/format/_puny.mjs +0 -77
  250. package/node_modules/typebox/build/schema/resolve/ref.d.mts +0 -3
  251. package/node_modules/typebox/build/schema/resolve/ref.mjs +0 -146
  252. package/node_modules/typebox/build/schema/types/contentEncoding.d.mts +0 -9
  253. package/node_modules/typebox/build/schema/types/contentEncoding.mjs +0 -13
  254. package/node_modules/typebox/build/schema/types/contentMediaType.d.mts +0 -9
  255. package/node_modules/typebox/build/schema/types/contentMediaType.mjs +0 -13
@@ -0,0 +1,41 @@
1
+ import * as FormatBidi from './format/bidi.mjs';
2
+ import * as LabelUnicode from './label/unicode.mjs';
3
+ import * as LabelPuny from './label/puny.mjs';
4
+ // ------------------------------------------------------------------
5
+ // IsLabel
6
+ // ------------------------------------------------------------------
7
+ function IsValidLabelLength(value) {
8
+ return value.length > 0 && value.length <= 63;
9
+ }
10
+ function IsLabel(value) {
11
+ return IsValidLabelLength(value) && (LabelPuny.IsPunyLabel(value) ||
12
+ LabelUnicode.IsUnicodeLabel(value));
13
+ }
14
+ // ------------------------------------------------------------------
15
+ // NormalizeHostname
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.
22
+ // ------------------------------------------------------------------
23
+ function NormalizeHostname(value) {
24
+ return value
25
+ .normalize('NFC')
26
+ .replace(/[\u00ad\u034f\u180b-\u180d\u200b\ufe00-\ufe0f\u{e0100}-\u{e01ef}]/gu, '') // RE_IGNORED_MAPPING
27
+ .replace(/[\u002E\u3002\uFF0E\uFF61]/g, '.'); // RE_FULL_STOP_MAPPING
28
+ }
29
+ // ------------------------------------------------------------------
30
+ // IsIdnHostname
31
+ // ------------------------------------------------------------------
32
+ export function IsIdnHostname(value) {
33
+ if (value.length === 0 || value.includes(' '))
34
+ return false;
35
+ const normalized = NormalizeHostname(value);
36
+ if (normalized.length > 253)
37
+ return false;
38
+ const labels = normalized.split('.');
39
+ const hasBidiChars = labels.some((label) => FormatBidi.HasBidiChars(label));
40
+ return labels.every((label) => IsLabel(label) && (!hasBidiChars || FormatBidi.SatisfiesBidiRule(label)));
41
+ }
@@ -0,0 +1,2 @@
1
+ export * from './hostname.mjs';
2
+ export * from './idn-hostname.mjs';
@@ -0,0 +1,2 @@
1
+ export * from './hostname.mjs';
2
+ export * from './idn-hostname.mjs';
@@ -0,0 +1 @@
1
+ export declare function IsAsciiLabel(value: string): boolean;
@@ -0,0 +1,9 @@
1
+ import * as Pattern from '../pattern/pattern.mjs';
2
+ // -------------------------------------------------------------------
3
+ // Validates an ASCII LDH label per RFC 5891 §4.2.3.1
4
+ // -------------------------------------------------------------------
5
+ export function IsAsciiLabel(value) {
6
+ return (Pattern.RE_RULE_HYPHEN_PLACEMENT.test(value) &&
7
+ Pattern.RE_RULE_NOT_RESERVED_ACE.test(value) &&
8
+ Pattern.RE_ASCII_LDH.test(value));
9
+ }
@@ -0,0 +1 @@
1
+ export declare function IsPunyLabel(value: string): boolean;
@@ -0,0 +1,28 @@
1
+ import * as FormatPuny from '../format/puny.mjs';
2
+ import * as LabelUnicode from './unicode.mjs';
3
+ import * as Pattern from '../pattern/pattern.mjs';
4
+ // ------------------------------------------------------------------
5
+ // IsPunyLabel
6
+ // ------------------------------------------------------------------
7
+ export function IsPunyLabel(value) {
8
+ if (!FormatPuny.IsAcePrefixed(value))
9
+ return false;
10
+ try {
11
+ const body = value.slice(4).toLowerCase();
12
+ // A payload consisting of only a hyphen, or starting with the delimiter
13
+ // (like "-9uc"), has 0 basic ASCII characters preceding it and is malformed.
14
+ if (body.lastIndexOf('-') === 0)
15
+ return false;
16
+ const decoded = FormatPuny.Decode(body);
17
+ // RFC 5890 §2.3.2.1 - a U-label must contain at least one non-ASCII
18
+ // character. Code-unit level check: any non-ASCII codepoint has at least
19
+ // one UTF-16 unit >= 0x80 (surrogate halves included), so no need to
20
+ // decode codepoints or allocate a character array to answer this.
21
+ if (!Pattern.RE_NON_ASCII.test(decoded))
22
+ return false;
23
+ return LabelUnicode.IsUnicodeLabel(decoded);
24
+ }
25
+ catch {
26
+ return false;
27
+ }
28
+ }
@@ -0,0 +1 @@
1
+ export declare function IsUnicodeLabel(value: string): boolean;
@@ -0,0 +1,106 @@
1
+ import * as Pattern from '../pattern/pattern.mjs';
2
+ import * as FormatBidi from '../format/bidi.mjs';
3
+ import * as FormatPuny from '../format/puny.mjs';
4
+ // ------------------------------------------------------------------
5
+ // ExceedsMaxALabelLength
6
+ //
7
+ // RFC 5890 §2.3.2.1: an A-label (the ACE-encoded form of a label,
8
+ // "xn--" + punycode) must not exceed 63 octets. Only labels
9
+ // containing non-ASCII characters need checking - a pure-ASCII label
10
+ // has no "xn--" prefix and is used as-is, so its punycode-encoded
11
+ // length is irrelevant. The ASCII check is a cheap short-circuit that
12
+ // avoids running the punycode encoder on labels that don't need it.
13
+ // ------------------------------------------------------------------
14
+ function ExceedsMaxALabelLength(value) {
15
+ return Pattern.RE_NON_ASCII.test(value) && FormatPuny.Encode(value).length + 4 > 63;
16
+ }
17
+ // ------------------------------------------------------------------
18
+ // HasInvalidHyphens
19
+ //
20
+ // RFC 5891 §4.2.3.2: label must not start or end with a hyphen, and
21
+ // must not have hyphens in the 3rd and 4th codepoint positions (the
22
+ // ACE prefix reservation, e.g. "xn--"). Operates on `chars` (the
23
+ // per-codepoint string array) rather than raw string indices so
24
+ // supplementary-plane characters earlier in the label don't throw
25
+ // off the codepoint-position count.
26
+ // ------------------------------------------------------------------
27
+ function HasInvalidHyphens(chars) {
28
+ if (chars[0] === '-' || chars[chars.length - 1] === '-')
29
+ return true;
30
+ return chars.slice(2).join('').startsWith('--');
31
+ }
32
+ // ------------------------------------------------------------------
33
+ // IsUnicodeLabel
34
+ // ------------------------------------------------------------------
35
+ export function IsUnicodeLabel(value) {
36
+ // RFC 5890 §2.3.2.1: Ensure Max Length
37
+ if (ExceedsMaxALabelLength(value))
38
+ return false;
39
+ // RFC 5893 - Bidi Rule (applies whenever this label itself is RTL)
40
+ if (FormatBidi.HasRightToLeftCharacters(value) && !FormatBidi.SatisfiesBidiRule(value))
41
+ return false;
42
+ const chars = [...value];
43
+ const codePoints = chars.map((c) => c.codePointAt(0));
44
+ const length = codePoints.length;
45
+ // RFC 5891 §4.2.3.2: Hyphen rules
46
+ if (HasInvalidHyphens(chars))
47
+ return false;
48
+ // RFC 5891 §4.2.3.2 - Must not begin with a combining mark
49
+ if (Pattern.RE_COMBINING_MARK.test(chars[0]))
50
+ return false;
51
+ let hasJapanese = false;
52
+ // let hasArabicIndic = false // (no-spec-coverage)
53
+ // let hasExtendedArabicIndic = false // (no-spec-coverage)
54
+ for (let i = 0; i < length; i++) {
55
+ const codePoint = codePoints[i];
56
+ const char = chars[i];
57
+ // 1. DISALLOWED exceptions
58
+ if (Pattern.RE_RFC5892_DISALLOWED.test(char))
59
+ return false;
60
+ // 1b. General category (PVALID) enforcement
61
+ if (!Pattern.RE_PERMITTED_CATEGORY.test(char))
62
+ return false;
63
+ // 2. Collect Flags
64
+ if (Pattern.RE_SCRIPT_JAPANESE.test(char))
65
+ hasJapanese = true;
66
+ // if (Pattern.RE_ARABIC_INDIC_DIGIT.test(char)) hasArabicIndic = true // (no-spec-coverage)
67
+ // if (Pattern.RE_EXT_ARABIC_INDIC_DIGIT.test(char)) hasExtendedArabicIndic = true // (no-spec-coverage)
68
+ // 3. CONTEXTO / CONTEXTJ Neighbor Rules
69
+ const prev = codePoints[i - 1], next = codePoints[i + 1];
70
+ switch (codePoint) {
71
+ case 0x00b7:
72
+ if (prev !== 0x006c || next !== 0x006c)
73
+ return false;
74
+ break; // MIDDLE DOT (Catalan)
75
+ case 0x0375:
76
+ if (!next || !Pattern.RE_SCRIPT_GREEK.test(chars[i + 1]))
77
+ return false;
78
+ break; // Greek KERAIA
79
+ case 0x05f3:
80
+ case 0x05f4:
81
+ if (!prev || !Pattern.RE_SCRIPT_HEBREW.test(chars[i - 1]))
82
+ return false;
83
+ break; // Hebrew GERESH
84
+ case 0x200c: // ZWNJ - RFC 5892 Appendix A.1
85
+ // Note: Full validation requires a Unicode joining type table. We reject
86
+ // only when preceded by ASCII (U+0000-U+007F), which can never satisfy
87
+ // the Virama or cursive-joining rules.
88
+ if (!prev || (prev < 0x0080 && !Pattern.RE_VIRAMA.test(chars[i - 1])))
89
+ return false;
90
+ break;
91
+ case 0x200d: // ZWJ: RFC 5892 Appendix A.2
92
+ if (!prev || !Pattern.RE_VIRAMA.test(chars[i - 1]))
93
+ return false;
94
+ break;
95
+ case 0x30fb: // Checked at end via hasJapanese
96
+ break; // KATAKANA MIDDLE DOT
97
+ }
98
+ }
99
+ // 4. Global Context Validations (Post-loop)
100
+ // RFC 5892 Appendix A.7 - Katakana Middle Dot requirement
101
+ if (value.includes('\u30fb') && !hasJapanese)
102
+ return false;
103
+ // RFC 5892 Appendix A.8/A.9 - Mixing Arabic Digits
104
+ // if (hasArabicIndic && hasExtendedArabicIndic) return false // (no-spec-coverage)
105
+ return true;
106
+ }
@@ -0,0 +1,30 @@
1
+ export declare const RE_RULE_HYPHEN_PLACEMENT: RegExp;
2
+ export declare const RE_RULE_NOT_RESERVED_ACE: RegExp;
3
+ export declare const RE_ASCII_LDH: RegExp;
4
+ export declare const RE_ASCII: RegExp;
5
+ export declare const RE_NON_ASCII: RegExp;
6
+ export declare const RE_HIGH_SURROGATE: RegExp;
7
+ export declare const RE_REGIONAL_INDICATOR: RegExp;
8
+ export declare const RE_VARIATION_SELECTOR: RegExp;
9
+ export declare const RE_ZERO_WIDTH_JOINER: RegExp;
10
+ export declare const RE_ASCII_DIGIT: RegExp;
11
+ export declare const RE_ARABIC_INDIC_DIGIT: RegExp;
12
+ export declare const RE_EXT_ARABIC_INDIC_DIGIT: RegExp;
13
+ export declare const RE_COMMON_SEPARATOR: RegExp;
14
+ export declare const RE_EUROPEAN_SEPARATOR: RegExp;
15
+ export declare const RE_MARK_NONSPACING: RegExp;
16
+ export declare const RE_MARK_SPACING_COMBINING: RegExp;
17
+ export declare const RE_MARK_ENCLOSING: RegExp;
18
+ export declare const RE_COMBINING_MARK: RegExp;
19
+ export declare const RE_LETTER: RegExp;
20
+ export declare const RE_NUMBER_DECIMAL: RegExp;
21
+ export declare const RE_SCRIPT_GREEK: RegExp;
22
+ export declare const RE_SCRIPT_HEBREW: RegExp;
23
+ export declare const RE_SCRIPT_JAPANESE: RegExp;
24
+ export declare const RE_SCRIPT_ARABIC_LETTER: RegExp;
25
+ export declare const RE_VIRAMA: RegExp;
26
+ export declare const RE_RFC5892_DISALLOWED: RegExp;
27
+ export declare const RE_CONTEXTO_EXCEPTIONS: RegExp;
28
+ export declare const RE_PVALID_EXCEPTIONS: RegExp;
29
+ export declare const RE_EUROPEAN_NUMBER: RegExp;
30
+ export declare const RE_PERMITTED_CATEGORY: RegExp;
@@ -0,0 +1,70 @@
1
+ // deno-fmt-ignore-file
2
+ // -------------------------------------------------------------------
3
+ // Validation Rules
4
+ // -------------------------------------------------------------------
5
+ export const RE_RULE_HYPHEN_PLACEMENT = /^(?!-).*(?<!-)$/;
6
+ export const RE_RULE_NOT_RESERVED_ACE = /^(?!..--)/;
7
+ export const RE_ASCII_LDH = /^[a-zA-Z0-9-]*$/;
8
+ // -------------------------------------------------------------------
9
+ // ASCII & Encoding
10
+ // -------------------------------------------------------------------
11
+ export const RE_ASCII = /^\p{ASCII}*$/u;
12
+ export const RE_NON_ASCII = /[^\p{ASCII}]/u;
13
+ // -------------------------------------------------------------------
14
+ // Structural & Unicode Controls
15
+ // -------------------------------------------------------------------
16
+ export const RE_HIGH_SURROGATE = /[\u{d800}-\u{dbff}]/u;
17
+ export const RE_REGIONAL_INDICATOR = /[\u{1f1e6}-\u{1f1ff}]/u;
18
+ export const RE_VARIATION_SELECTOR = /[\u{fe00}-\u{fe0f}]/u;
19
+ export const RE_ZERO_WIDTH_JOINER = /\u{200d}/u;
20
+ // -------------------------------------------------------------------
21
+ // Numbers & Digits
22
+ // -------------------------------------------------------------------
23
+ export const RE_ASCII_DIGIT = /[0-9]/;
24
+ export const RE_ARABIC_INDIC_DIGIT = /[\u{0660}-\u{0669}]/u;
25
+ export const RE_EXT_ARABIC_INDIC_DIGIT = /[\u{06f0}-\u{06f9}]/u;
26
+ // -------------------------------------------------------------------
27
+ // Separators
28
+ // -------------------------------------------------------------------
29
+ export const RE_COMMON_SEPARATOR = /[\u{002e}\u{002c}\u{003a}\u{002f}]/u;
30
+ export const RE_EUROPEAN_SEPARATOR = /[\u{002d}\u{002b}]/u;
31
+ // -------------------------------------------------------------------
32
+ // General Categories
33
+ // -------------------------------------------------------------------
34
+ export const RE_MARK_NONSPACING = /\p{Mn}/u;
35
+ export const RE_MARK_SPACING_COMBINING = /\p{Mc}/u;
36
+ export const RE_MARK_ENCLOSING = /\p{Me}/u;
37
+ export const RE_COMBINING_MARK = /[\p{Mn}\p{Mc}\p{Me}]/u;
38
+ export const RE_LETTER = /\p{L}/u;
39
+ export const RE_NUMBER_DECIMAL = /\p{Nd}/u;
40
+ // -------------------------------------------------------------------
41
+ // Scripts
42
+ // -------------------------------------------------------------------
43
+ export const RE_SCRIPT_GREEK = /\p{Script=Greek}/u;
44
+ export const RE_SCRIPT_HEBREW = /\p{Script=Hebrew}/u;
45
+ export const RE_SCRIPT_JAPANESE = /[\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Han}]/u;
46
+ export const RE_SCRIPT_ARABIC_LETTER = /[\p{Script=Arabic}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Mandaic}]/u;
47
+ // -------------------------------------------------------------------
48
+ // RFC Specifications & Context Exceptions
49
+ // -------------------------------------------------------------------
50
+ export const RE_VIRAMA = /[\u{094d}\u{09cd}\u{0a4d}\u{0acd}\u{0b4d}\u{0bcd}\u{0c4d}\u{0ccd}\u{0d3b}\u{0d3c}\u{0d4d}\u{0dca}\u{1b44}\u{1baa}\u{1bab}\u{a9c0}\u{11046}\u{1107f}\u{110b9}\u{11133}\u{11134}\u{111c0}\u{11235}\u{1134d}\u{11442}\u{114c2}\u{115bf}\u{1163f}\u{116b6}\u{11c3f}\u{11d44}\u{11d45}]/u;
51
+ export const RE_RFC5892_DISALLOWED = /[\u{0640}\u{07fa}\u{302e}\u{302f}\u{3031}\u{3032}\u{3033}\u{3034}\u{3035}\u{303b}]/u;
52
+ export const RE_CONTEXTO_EXCEPTIONS = /[\u{00b7}\u{0375}\u{05f3}\u{05f4}\u{200c}\u{200d}\u{30fb}]/u;
53
+ export const RE_PVALID_EXCEPTIONS = /[\u{00df}\u{03c2}\u{06fd}\u{06fe}\u{0f0b}\u{3007}]/u;
54
+ // -------------------------------------------------------------------
55
+ // Composite Patterns
56
+ // -------------------------------------------------------------------
57
+ export const RE_EUROPEAN_NUMBER = new RegExp([
58
+ RE_ASCII_DIGIT,
59
+ RE_EXT_ARABIC_INDIC_DIGIT
60
+ ].map((regexp) => regexp.source).join('|'), 'u');
61
+ export const RE_PERMITTED_CATEGORY = new RegExp([
62
+ RE_LETTER,
63
+ RE_EUROPEAN_SEPARATOR,
64
+ RE_COMMON_SEPARATOR,
65
+ RE_NUMBER_DECIMAL,
66
+ RE_MARK_NONSPACING,
67
+ RE_MARK_SPACING_COMBINING,
68
+ RE_CONTEXTO_EXCEPTIONS,
69
+ RE_PVALID_EXCEPTIONS
70
+ ].map((regexp) => regexp.source).join('|'), 'u');
@@ -1,4 +1,3 @@
1
- export declare function IsIPv4Internal(value: string, start: number, end: number): boolean;
2
1
  /**
3
2
  * Returns true if the value is a IPV4 address
4
3
  * @specification http://tools.ietf.org/html/rfc2673#section-3.2
@@ -1,38 +1,8 @@
1
- // ------------------------------------------------------------------
2
- // Ranged Fast Path
3
- // ------------------------------------------------------------------
4
- /* Returns true if the value is a IPV4 address from index range offsets */
5
- export function IsIPv4Internal(value, start, end) {
6
- let dots = 0;
7
- let num = 0;
8
- let digits = 0;
9
- let leading = 0;
10
- for (let i = start; i < end; i++) {
11
- const ch = value.charCodeAt(i);
12
- if (ch === 46) { // '.'
13
- if (digits === 0 || num > 255 || (leading === 48 && digits > 1))
14
- return false;
15
- dots++;
16
- num = 0;
17
- digits = 0;
18
- leading = 0;
19
- }
20
- else if (ch >= 48 && ch <= 57) { // '0'-'9'
21
- if (digits === 0)
22
- leading = ch;
23
- num = num * 10 + (ch - 48);
24
- digits++;
25
- }
26
- else {
27
- return false;
28
- }
29
- }
30
- return dots === 3 && digits > 0 && num <= 255 && !(leading === 48 && digits > 1);
31
- }
1
+ const IPv4 = /^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/;
32
2
  /**
33
3
  * Returns true if the value is a IPV4 address
34
4
  * @specification http://tools.ietf.org/html/rfc2673#section-3.2
35
5
  */
36
6
  export function IsIPv4(value) {
37
- return IsIPv4Internal(value, 0, value.length);
7
+ return IPv4.test(value);
38
8
  }
@@ -1,67 +1,8 @@
1
- import { IsIPv4Internal } from './ipv4.mjs';
2
- function InRange(ch) {
3
- return (ch >= 48 && ch <= 57) || // 0-9
4
- (ch >= 65 && ch <= 70) || // A-F
5
- (ch >= 97 && ch <= 102); // a-f
6
- }
1
+ const IPv6 = /^(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:)?[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)$/i;
7
2
  /**
8
3
  * Returns true if the value is an IPv6 address
9
4
  * @specification http://tools.ietf.org/html/rfc2373#section-2.2
10
5
  */
11
6
  export function IsIPv6(value) {
12
- const length = value.length;
13
- if (length === 0)
14
- return false;
15
- let groups = 0;
16
- let compressed = false;
17
- let i = 0;
18
- // handle leading '::'
19
- if (value.charCodeAt(0) === 58 && value.charCodeAt(1) === 58) {
20
- if (length === 2)
21
- return true; // '::' is valid
22
- compressed = true;
23
- i = 2;
24
- }
25
- while (i < length) {
26
- // read hex digits
27
- let digits = 0;
28
- const start = i;
29
- while (i < length && InRange(value.charCodeAt(i))) {
30
- i++;
31
- digits++;
32
- }
33
- if (digits === 0)
34
- return false;
35
- const next = value.charCodeAt(i);
36
- // check for embedded IPv4 at the end
37
- if (next === 46) { // '.'
38
- if (!IsIPv4Internal(value, start, length))
39
- return false;
40
- groups += 2;
41
- i = length;
42
- break;
43
- }
44
- if (digits > 4)
45
- return false;
46
- groups++;
47
- if (i === length)
48
- break;
49
- // expect ':' separator
50
- if (next !== 58)
51
- return false;
52
- i++;
53
- // check for '::' compression
54
- if (value.charCodeAt(i) === 58) {
55
- if (compressed)
56
- return false; // only one '::' allowed
57
- // check for ':::'
58
- if (value.charCodeAt(i + 1) === 58)
59
- return false;
60
- compressed = true;
61
- i++;
62
- if (i === length)
63
- break; // trailing '::'
64
- }
65
- }
66
- return compressed ? groups <= 7 : groups === 8;
7
+ return IPv6.test(value);
67
8
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Returns true if the value is a Iri
3
- * @specification
2
+ * Returns true if the value is a valid Internationalized Resource Identifier.
3
+ * @specification https://datatracker.ietf.org/doc/html/rfc3987
4
4
  */
5
5
  export declare function IsIri(value: string): boolean;
@@ -1,13 +1,31 @@
1
+ // deno-lint-ignore-file no-control-regex
2
+ const IpvFutureMatchMaxLength = 2048;
3
+ const IpvFutureMatch = /\[[vV][0-9a-fA-F]+\.[^\]]+\]/; // Guarded By IpvFutureMatchMaxLength
4
+ const InvalidIriChars = /[\x00-\x20<>\^`{|}\\]/;
5
+ // ------------------------------------------------------------------
6
+ // NarrowIpvFuture
7
+ //
8
+ // Substitutes an IPvFuture address with a standard IPv6 loopback
9
+ // address ([::1]). We do this because the native URL.canParse
10
+ // (WHATWG standard) rejects IPvFuture literals, which are
11
+ // otherwise valid in RFC 3987. Because regex substitution can
12
+ // be expensive on large strings, this operation is strictly
13
+ // limited to inputs under a defined length threshold.
14
+ //
15
+ // (review-optimization)
16
+ //
17
+ // ------------------------------------------------------------------
18
+ function NarrowIpvFuture(value) {
19
+ return value.length < IpvFutureMatchMaxLength ? value.replace(IpvFutureMatch, '[::1]') : value;
20
+ }
1
21
  /**
2
- * Returns true if the value is a Iri
3
- * @specification
22
+ * Returns true if the value is a valid Internationalized Resource Identifier.
23
+ * @specification https://datatracker.ietf.org/doc/html/rfc3987
4
24
  */
5
25
  export function IsIri(value) {
6
- try {
7
- new URL(value);
8
- return true;
9
- }
10
- catch {
26
+ // 1. Reject strings containing unencoded whitespace or illegal control characters.
27
+ if (InvalidIriChars.test(value))
11
28
  return false;
12
- }
29
+ // 2. Delegate to the native URL parser, patching the IPvFuture edge case beforehand.
30
+ return URL.canParse(NarrowIpvFuture(value));
13
31
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Returns true if the value is a Iri reference
3
- * @specification
2
+ * Returns true if the value is an IRI reference
3
+ * @specification https://tools.ietf.org/html/rfc3987
4
4
  */
5
5
  export declare function IsIriReference(value: string): boolean;
@@ -1,60 +1,14 @@
1
1
  // deno-lint-ignore-file no-control-regex
2
- // deno-coverage-ignore-start
3
- function TryUrl(value) {
4
- try {
5
- new URL(value, 'http://example.com'); // This handles relative paths correctly
6
- return true;
7
- }
8
- catch {
9
- return false;
10
- }
11
- }
12
- // deno-coverage-ignore-stop
2
+ // Rejects unencoded spaces (0x20), backslashes, control characters (0x00-0x1F, 0x7F), or malformed percent-encodings
3
+ const InvalidIriChars = /[\x00-\x20\x7F\\]|%(?![0-9a-fA-F]{2})/;
4
+ // Detects malformed scheme/authority patterns lacking a colon (e.g. "httpx//example.com")
5
+ const MalformedScheme = /^[a-zA-Z][a-zA-Z0-9+\-.]*\/\//;
13
6
  /**
14
- * Returns true if the value is a Iri reference
15
- * @specification
7
+ * Returns true if the value is an IRI reference
8
+ * @specification https://tools.ietf.org/html/rfc3987
16
9
  */
17
10
  export function IsIriReference(value) {
18
- // 1. Basic forbidden character checks (must be percent-encoded or not exist)
19
- // RFC 3987 excludes space, backslash, and control characters from being unencoded.
20
- if (value.includes(' ')) { // Unencoded space (U+0020)
21
- return false;
22
- }
23
- if (value.includes('\\')) { // Backslash (U+005C)
24
- return false;
25
- }
26
- // ASCII control characters (U+0000-U+001F and U+007F)
27
- if (/[\x00-\x1F\x7F]/.test(value)) {
28
- return false;
29
- }
30
- // 2. Check for invalid percent-encoding
31
- // A percent sign '%' must always be followed by exactly two hexadecimal characters.
32
- // This regex finds a '%' that is NOT followed by two hexadecimal characters.
33
- // - `%` matches a literal percent sign.
34
- // - `(?!...)` is a negative lookahead, asserting that what follows is NOT.
35
- // - `[0-9a-fA-F]{2}` matches exactly two hexadecimal digits.
36
- // So, if a '%' is found that is not immediately followed by two hex digits, this regex will match.
37
- if (/%(?![0-9a-fA-F]{2})/.test(value)) {
38
- return false;
39
- }
40
- // 3. Handle empty string (valid relative reference to the current document)
41
- if (value === '') {
42
- return true;
43
- }
44
- // 4. Determine if it's attempting to be an absolute IRI or a relative IRI, and parse.
45
- const colonIndex = value.indexOf(':');
46
- const hasValidSchemePrefix = colonIndex > 0 && // Colon must not be at the very beginning (e.g., ":foo")
47
- /^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(value.substring(0, colonIndex));
48
- if (hasValidSchemePrefix) {
49
- return TryUrl(value);
50
- }
51
- else {
52
- // This handles cases like `httpx//example.com/path` which look like malformed absolute URIs.
53
- const looksLikeMalformedSchemeAndAuthority = value.match(/^([a-zA-Z][a-zA-Z0-9+\-.]*)(\/\/)/);
54
- if (looksLikeMalformedSchemeAndAuthority && colonIndex === -1) {
55
- return false;
56
- }
57
- // Otherwise, it's a relative IRI reference.
58
- return TryUrl(value);
59
- }
11
+ return (!InvalidIriChars.test(value) &&
12
+ !MalformedScheme.test(value) &&
13
+ URL.canParse(value, 'http://example.com'));
60
14
  }
@@ -1,6 +1,5 @@
1
1
  /**
2
2
  * Returns true if the value is a regular expression string pattern
3
- * @specification
4
- * @source ajv-formats
3
+ * @specification https://ecma-international.org/ecma-262
5
4
  */
6
5
  export declare function IsRegex(value: string): boolean;
@@ -1,14 +1,10 @@
1
1
  /**
2
2
  * Returns true if the value is a regular expression string pattern
3
- * @specification
4
- * @source ajv-formats
3
+ * @specification https://ecma-international.org/ecma-262
5
4
  */
6
5
  export function IsRegex(value) {
7
- if (value.length === 0) {
8
- return false;
9
- }
10
6
  try {
11
- new RegExp(value);
7
+ new RegExp(value, 'u');
12
8
  return true;
13
9
  }
14
10
  catch {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Returns true if the value is a ISO time string
3
- * @specification
2
+ * Returns true if the value is an ISO time string
3
+ * @specification https://datatracker.ietf.org/doc/html/rfc3339
4
4
  */
5
5
  export declare function IsTime(value: string, strictTimeZone?: boolean): boolean;
@@ -1,27 +1,32 @@
1
- const TIME = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(?:Z|([+-])(\d\d):(\d\d))?$/i;
1
+ const TIME = /^(\d\d):(\d\d):(\d\d)(?:\.\d+)?(?:([Zz])|([+-])(\d\d):(\d\d))?$/;
2
2
  /**
3
- * Returns true if the value is a ISO time string
4
- * @specification
3
+ * Returns true if the value is an ISO time string
4
+ * @specification https://datatracker.ietf.org/doc/html/rfc3339
5
5
  */
6
6
  export function IsTime(value, strictTimeZone = true) {
7
7
  const matches = TIME.exec(value);
8
8
  if (!matches)
9
9
  return false;
10
+ // Require timezone offset or 'Z'/'z' when strictTimeZone is true
11
+ if (strictTimeZone && !matches[4] && !matches[5])
12
+ return false;
10
13
  const hr = +matches[1];
11
14
  const min = +matches[2];
12
15
  const sec = +matches[3];
13
- const tzSign = matches[4] === '-' ? -1 : 1; // Use matches[4] for sign
14
- const tzH = +(matches[5] || 0); // tzH is now matches[5]
15
- const tzM = +(matches[6] || 0); // tzM is now matches[6]
16
- if (tzH > 23 || tzM > 59)
17
- return false; // Check for valid hour/minute range in offset
18
- if (strictTimeZone && !matches[4] && value.toLowerCase().indexOf('z') === -1) {
19
- // If strictTimeZone is true, and neither 'Z' nor a '+/-' offset was found
16
+ if (hr > 23 || min > 59 || sec > 60)
20
17
  return false;
18
+ if (matches[5]) {
19
+ const tzH = +matches[6];
20
+ const tzM = +matches[7];
21
+ if (tzH > 23 || tzM > 59)
22
+ return false;
21
23
  }
22
- if (hr <= 23 && min <= 59 && sec < 60)
24
+ if (sec < 60)
23
25
  return true;
24
- const utcMin = min - tzM * tzSign;
25
- const utcHr = hr - tzH * tzSign - (utcMin < 0 ? 1 : 0);
26
- return (utcHr === 23 || utcHr === -1) && (utcMin === 59 || utcMin === -1) && sec < 61;
26
+ // Leap second handling: must normalize to 23:59:60 UTC (1439 total UTC minutes)
27
+ const tzSign = matches[5] === '-' ? -1 : 1;
28
+ const tzH = +(matches[6] || 0);
29
+ const tzM = +(matches[7] || 0);
30
+ const totalUtcMin = (hr * 60 + min) - tzSign * (tzH * 60 + tzM);
31
+ return (totalUtcMin % 1440 + 1440) % 1440 === 1439;
27
32
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Returns true if the value matches RFC 3986 URI syntax.
2
+ * Returns true if the value is a valid Uniform Resource Identifier.
3
3
  * @specification https://tools.ietf.org/html/rfc3986
4
4
  */
5
5
  export declare function IsUri(value: string): boolean;