@openclaw/slack 2026.8.1-beta.2 → 2026.8.1

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 (246) hide show
  1. package/dist/account-configured-sUohAxZr.js +33 -0
  2. package/dist/account-inspect-CN2hBsim.js +87 -0
  3. package/dist/account-inspect-api.js +1 -1
  4. package/dist/{accounts-CK4AVI2_.js → accounts-Dm_H77gH.js} +12 -11
  5. package/dist/{accounts.runtime-Cb7QwWBz.js → accounts.runtime-DRuEK6mL.js} +1 -1
  6. package/dist/{action-runtime-BkGe7ny_.js → action-runtime-044ldvNL.js} +80 -79
  7. package/dist/action-runtime.runtime-BL3KzX13.js +2 -0
  8. package/dist/{actions-BTDXwwE3.js → actions-BI7JkfVm.js} +273 -263
  9. package/dist/api.js +14 -14
  10. package/dist/{approval-handler.runtime-CJaNzAq2.js → approval-handler.runtime-DYv0UIZS.js} +53 -174
  11. package/dist/{channel-D_tovcUL.js → channel-1vIJOzPx.js} +134 -160
  12. package/dist/channel-config-api.js +1 -1
  13. package/dist/channel-plugin-api.js +1 -1
  14. package/dist/{channel-type-B9MSdoGN.js → channel-type-DlFSKeIZ.js} +3 -7
  15. package/dist/{channel.setup-Bch9dYmA.js → channel.setup-ofDi3_Pu.js} +34 -49
  16. package/dist/{config-schema-xto5jFIx.js → config-schema-BVIMyiDN.js} +42 -19
  17. package/dist/configured-state.js +34 -0
  18. package/dist/conversation-binding-route-DFVLUdYF.js +115 -0
  19. package/dist/{directory-config-CNBz8lJa.js → directory-config-DqfQ42OV.js} +1 -1
  20. package/dist/directory-contract-api.js +1 -1
  21. package/dist/{directory-live-CFKUtW9E.js → directory-live-BPaNHjmP.js} +2 -2
  22. package/dist/{group-policy-c4RP9bjc.js → group-policy-BdwszjYn.js} +625 -773
  23. package/dist/{message-tool-api-BykQB4AU.js → message-tool-api-CJ0kjcg5.js} +23 -5
  24. package/dist/message-tool-api.js +1 -1
  25. package/dist/{monitor-1nF1NtqT.js → monitor-Dq5Cmrvp.js} +3 -3
  26. package/dist/{outbound-adapter-S81tsswN.js → outbound-adapter-DYaI8ThX.js} +101 -66
  27. package/dist/{pipeline.runtime-BvYsM5JO.js → pipeline.runtime-Bd22U0ga.js} +494 -474
  28. package/dist/{policy-TapwbeaT.js → policy-CtQVbde1.js} +2 -1
  29. package/dist/{probe-HoEg_WxB.js → probe-0usmAb0i.js} +209 -22
  30. package/dist/{provider-CDNvBXUi.js → provider-CN_8hFv2.js} +296 -178
  31. package/dist/{relay-source-C9leF11u.js → relay-source-BNGpsdwV.js} +1 -1
  32. package/dist/{replies-CeOfv82I.js → replies-BSiRQOJ1.js} +48 -27
  33. package/dist/{resolve-channels-CNPrxaXY.js → resolve-channels-Czheznc8.js} +1 -1
  34. package/dist/{resolve-users-Dzomuwnr.js → resolve-users-BAOlNimr.js} +1 -1
  35. package/dist/runtime-api.js +11 -11
  36. package/dist/{scopes-cYXKkrRD.js → scopes-COSlmhnH.js} +1 -1
  37. package/dist/security-contract-api.js +1 -1
  38. package/dist/{send-Nor0iBwY.js → send-DS9ICrBI.js} +88 -100
  39. package/dist/send-results-eeOu_HYm.js +23 -0
  40. package/dist/{send.runtime-BmgNe6S9.js → send.runtime-D_Bb6IuH.js} +1 -1
  41. package/dist/setup-plugin-api.js +1 -1
  42. package/dist/{setup-surface-CbX1-Knh.js → setup-surface-BGnd2pSe.js} +6 -6
  43. package/dist/{shared-zdT5AMp-.js → shared-D5B-5hBg.js} +35 -9
  44. package/dist/{slash-dispatch.runtime-Bnr9GR1S.js → slash-dispatch.runtime-CilDmI0c.js} +2 -2
  45. package/node_modules/@slack/bolt/node_modules/@types/node/README.md +1 -1
  46. package/node_modules/@slack/bolt/node_modules/@types/node/child_process.d.ts +0 -1
  47. package/node_modules/@slack/bolt/node_modules/@types/node/crypto.d.ts +6 -6
  48. package/node_modules/@slack/bolt/node_modules/@types/node/dns/promises.d.ts +5 -5
  49. package/node_modules/@slack/bolt/node_modules/@types/node/dns.d.ts +5 -5
  50. package/node_modules/@slack/bolt/node_modules/@types/node/fs.d.ts +7 -0
  51. package/node_modules/@slack/bolt/node_modules/@types/node/http.d.ts +30 -0
  52. package/node_modules/@slack/bolt/node_modules/@types/node/http2.d.ts +4 -4
  53. package/node_modules/@slack/bolt/node_modules/@types/node/os.d.ts +30 -30
  54. package/node_modules/@slack/bolt/node_modules/@types/node/package.json +2 -2
  55. package/node_modules/@slack/bolt/node_modules/@types/node/perf_hooks.d.ts +2 -1
  56. package/node_modules/@slack/bolt/node_modules/@types/node/process.d.ts +42 -43
  57. package/node_modules/@slack/bolt/node_modules/@types/node/quic.d.ts +1049 -84
  58. package/node_modules/@slack/bolt/node_modules/@types/node/sqlite.d.ts +14 -1
  59. package/node_modules/@slack/bolt/node_modules/@types/node/stream/iter.d.ts +3 -2
  60. package/node_modules/@slack/bolt/node_modules/@types/node/test.d.ts +61 -0
  61. package/node_modules/@slack/bolt/node_modules/@types/node/v8.d.ts +20 -23
  62. package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/README.md +2 -0
  63. package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/dist/index.d.ts +20 -0
  64. package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/dist/index.js +20 -14
  65. package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/dist/index.js.map +1 -1
  66. package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/package.json +1 -1
  67. package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/README.md +2 -0
  68. package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.d.ts +20 -0
  69. package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.js +20 -14
  70. package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -1
  71. package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/package.json +1 -1
  72. package/node_modules/@slack/socket-mode/node_modules/@types/node/README.md +1 -1
  73. package/node_modules/@slack/socket-mode/node_modules/@types/node/child_process.d.ts +0 -1
  74. package/node_modules/@slack/socket-mode/node_modules/@types/node/crypto.d.ts +6 -6
  75. package/node_modules/@slack/socket-mode/node_modules/@types/node/dns/promises.d.ts +5 -5
  76. package/node_modules/@slack/socket-mode/node_modules/@types/node/dns.d.ts +5 -5
  77. package/node_modules/@slack/socket-mode/node_modules/@types/node/fs.d.ts +7 -0
  78. package/node_modules/@slack/socket-mode/node_modules/@types/node/http.d.ts +30 -0
  79. package/node_modules/@slack/socket-mode/node_modules/@types/node/http2.d.ts +4 -4
  80. package/node_modules/@slack/socket-mode/node_modules/@types/node/os.d.ts +30 -30
  81. package/node_modules/@slack/socket-mode/node_modules/@types/node/package.json +2 -2
  82. package/node_modules/@slack/socket-mode/node_modules/@types/node/perf_hooks.d.ts +2 -1
  83. package/node_modules/@slack/socket-mode/node_modules/@types/node/process.d.ts +42 -43
  84. package/node_modules/@slack/socket-mode/node_modules/@types/node/quic.d.ts +1049 -84
  85. package/node_modules/@slack/socket-mode/node_modules/@types/node/sqlite.d.ts +14 -1
  86. package/node_modules/@slack/socket-mode/node_modules/@types/node/stream/iter.d.ts +3 -2
  87. package/node_modules/@slack/socket-mode/node_modules/@types/node/test.d.ts +61 -0
  88. package/node_modules/@slack/socket-mode/node_modules/@types/node/v8.d.ts +20 -23
  89. package/node_modules/@slack/web-api/node_modules/@types/node/README.md +1 -1
  90. package/node_modules/@slack/web-api/node_modules/@types/node/child_process.d.ts +0 -1
  91. package/node_modules/@slack/web-api/node_modules/@types/node/crypto.d.ts +6 -6
  92. package/node_modules/@slack/web-api/node_modules/@types/node/dns/promises.d.ts +5 -5
  93. package/node_modules/@slack/web-api/node_modules/@types/node/dns.d.ts +5 -5
  94. package/node_modules/@slack/web-api/node_modules/@types/node/fs.d.ts +7 -0
  95. package/node_modules/@slack/web-api/node_modules/@types/node/http.d.ts +30 -0
  96. package/node_modules/@slack/web-api/node_modules/@types/node/http2.d.ts +4 -4
  97. package/node_modules/@slack/web-api/node_modules/@types/node/os.d.ts +30 -30
  98. package/node_modules/@slack/web-api/node_modules/@types/node/package.json +2 -2
  99. package/node_modules/@slack/web-api/node_modules/@types/node/perf_hooks.d.ts +2 -1
  100. package/node_modules/@slack/web-api/node_modules/@types/node/process.d.ts +42 -43
  101. package/node_modules/@slack/web-api/node_modules/@types/node/quic.d.ts +1049 -84
  102. package/node_modules/@slack/web-api/node_modules/@types/node/sqlite.d.ts +14 -1
  103. package/node_modules/@slack/web-api/node_modules/@types/node/stream/iter.d.ts +3 -2
  104. package/node_modules/@slack/web-api/node_modules/@types/node/test.d.ts +61 -0
  105. package/node_modules/@slack/web-api/node_modules/@types/node/v8.d.ts +20 -23
  106. package/node_modules/typebox/build/format/date.d.mts +1 -1
  107. package/node_modules/typebox/build/format/date.mjs +1 -1
  108. package/node_modules/typebox/build/format/date_time.d.mts +2 -2
  109. package/node_modules/typebox/build/format/date_time.mjs +3 -3
  110. package/node_modules/typebox/build/format/email.d.mts +1 -1
  111. package/node_modules/typebox/build/format/email.mjs +2 -2
  112. package/node_modules/typebox/build/format/hostname.mjs +2 -10
  113. package/node_modules/typebox/build/format/idn_email.d.mts +1 -1
  114. package/node_modules/typebox/build/format/idn_email.mjs +3 -3
  115. package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -0
  116. package/node_modules/typebox/build/format/idn_hostname.mjs +3 -11
  117. package/node_modules/typebox/build/format/idna/format/bidi.d.mts +3 -0
  118. package/node_modules/typebox/build/format/idna/format/bidi.mjs +98 -0
  119. package/node_modules/typebox/build/format/idna/format/puny.d.mts +3 -0
  120. package/node_modules/typebox/build/format/idna/format/puny.mjs +144 -0
  121. package/node_modules/typebox/build/format/idna/hostname.d.mts +1 -0
  122. package/node_modules/typebox/build/format/idna/hostname.mjs +16 -0
  123. package/node_modules/typebox/build/format/idna/idn-hostname.d.mts +1 -0
  124. package/node_modules/typebox/build/format/idna/idn-hostname.mjs +23 -0
  125. package/node_modules/typebox/build/format/idna/index.d.mts +2 -0
  126. package/node_modules/typebox/build/format/idna/index.mjs +2 -0
  127. package/node_modules/typebox/build/format/idna/label/ascii.d.mts +1 -0
  128. package/node_modules/typebox/build/format/idna/label/ascii.mjs +9 -0
  129. package/node_modules/typebox/build/format/idna/label/puny.d.mts +1 -0
  130. package/node_modules/typebox/build/format/idna/label/puny.mjs +28 -0
  131. package/node_modules/typebox/build/format/idna/label/unicode.d.mts +1 -0
  132. package/node_modules/typebox/build/format/idna/label/unicode.mjs +106 -0
  133. package/node_modules/typebox/build/format/idna/pattern/pattern.d.mts +30 -0
  134. package/node_modules/typebox/build/format/idna/pattern/pattern.mjs +70 -0
  135. package/node_modules/typebox/build/format/ipv4.d.mts +0 -1
  136. package/node_modules/typebox/build/format/ipv4.mjs +2 -32
  137. package/node_modules/typebox/build/format/ipv6.mjs +2 -61
  138. package/node_modules/typebox/build/format/iri.d.mts +2 -2
  139. package/node_modules/typebox/build/format/iri.mjs +26 -8
  140. package/node_modules/typebox/build/format/iri_reference.d.mts +2 -2
  141. package/node_modules/typebox/build/format/iri_reference.mjs +9 -55
  142. package/node_modules/typebox/build/format/regex.d.mts +1 -2
  143. package/node_modules/typebox/build/format/regex.mjs +2 -6
  144. package/node_modules/typebox/build/format/time.d.mts +2 -2
  145. package/node_modules/typebox/build/format/time.mjs +19 -14
  146. package/node_modules/typebox/build/format/uri.d.mts +1 -1
  147. package/node_modules/typebox/build/format/uri.mjs +3 -130
  148. package/node_modules/typebox/build/format/uri_reference.d.mts +1 -1
  149. package/node_modules/typebox/build/format/uri_reference.mjs +2 -3
  150. package/node_modules/typebox/build/format/uri_template.d.mts +2 -3
  151. package/node_modules/typebox/build/format/uri_template.mjs +4 -5
  152. package/node_modules/typebox/build/format/url.d.mts +3 -3
  153. package/node_modules/typebox/build/format/url.mjs +4 -5
  154. package/node_modules/typebox/build/guard/emit.d.mts +3 -1
  155. package/node_modules/typebox/build/guard/emit.mjs +12 -5
  156. package/node_modules/typebox/build/guard/guard.d.mts +8 -2
  157. package/node_modules/typebox/build/guard/guard.mjs +25 -4
  158. package/node_modules/typebox/build/guard/string.d.mts +2 -2
  159. package/node_modules/typebox/build/guard/string.mjs +7 -7
  160. package/node_modules/typebox/build/schema/engine/_context.mjs +3 -3
  161. package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -2
  162. package/node_modules/typebox/build/schema/engine/_regexp.d.mts +2 -0
  163. package/node_modules/typebox/build/schema/engine/_regexp.mjs +4 -0
  164. package/node_modules/typebox/build/schema/engine/_stack.mjs +12 -13
  165. package/node_modules/typebox/build/schema/engine/additionalItems.mjs +17 -7
  166. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +4 -3
  167. package/node_modules/typebox/build/schema/engine/contains.mjs +18 -6
  168. package/node_modules/typebox/build/schema/engine/enum.mjs +1 -1
  169. package/node_modules/typebox/build/schema/engine/items.mjs +26 -6
  170. package/node_modules/typebox/build/schema/engine/maxContains.mjs +3 -3
  171. package/node_modules/typebox/build/schema/engine/minContains.mjs +14 -4
  172. package/node_modules/typebox/build/schema/engine/not.mjs +4 -2
  173. package/node_modules/typebox/build/schema/engine/oneOf.mjs +7 -6
  174. package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -2
  175. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +4 -3
  176. package/node_modules/typebox/build/schema/engine/ref.mjs +1 -7
  177. package/node_modules/typebox/build/schema/engine/schema.mjs +13 -4
  178. package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
  179. package/node_modules/typebox/build/schema/resolve/resolve.d.mts +4 -1
  180. package/node_modules/typebox/build/schema/resolve/resolve.mjs +202 -1
  181. package/node_modules/typebox/build/schema/static/propertyNames.d.mts +5 -0
  182. package/node_modules/typebox/build/schema/static/propertyNames.mjs +3 -0
  183. package/node_modules/typebox/build/schema/static/schema.d.mts +3 -0
  184. package/node_modules/typebox/build/schema/types/index.d.mts +0 -2
  185. package/node_modules/typebox/build/schema/types/index.mjs +0 -2
  186. package/node_modules/typebox/build/system/memory/clone.mjs +14 -11
  187. package/node_modules/typebox/build/system/memory/discard.mjs +6 -5
  188. package/node_modules/typebox/build/system/settings/settings.d.mts +9 -0
  189. package/node_modules/typebox/build/system/settings/settings.mjs +2 -0
  190. package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +6 -1
  191. package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +16 -3
  192. package/node_modules/typebox/build/type/engine/call/instantiate.mjs +34 -4
  193. package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +5 -5
  194. package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +20 -26
  195. package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +6 -10
  196. package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +9 -13
  197. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +7 -4
  198. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +12 -19
  199. package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +4 -20
  200. package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +8 -20
  201. package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +4 -4
  202. package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +11 -8
  203. package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +1 -1
  204. package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +3 -4
  205. package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +17 -2
  206. package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +26 -6
  207. package/node_modules/typebox/build/type/engine/exclude/operation.mjs +3 -4
  208. package/node_modules/typebox/build/type/engine/extract/operation.d.mts +1 -1
  209. package/node_modules/typebox/build/type/engine/extract/operation.mjs +3 -4
  210. package/node_modules/typebox/build/type/engine/priority/priority.d.mts +2 -2
  211. package/node_modules/typebox/build/type/engine/priority/priority.mjs +3 -4
  212. package/node_modules/typebox/build/type/script/mapping.d.mts +32 -29
  213. package/node_modules/typebox/build/type/script/mapping.mjs +18 -25
  214. package/node_modules/typebox/build/type/script/parser.d.mts +19 -25
  215. package/node_modules/typebox/build/type/script/parser.mjs +27 -23
  216. package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
  217. package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
  218. package/node_modules/typebox/package.json +27 -27
  219. package/node_modules/typebox/readme.md +79 -82
  220. package/node_modules/ws/lib/permessage-deflate.js +3 -1
  221. package/node_modules/ws/package.json +1 -1
  222. package/openclaw.plugin.json +57 -7
  223. package/package.json +9 -9
  224. package/dist/account-configured-BwfXBo_F.js +0 -14
  225. package/dist/account-inspect-Drw2gAiN.js +0 -89
  226. package/dist/account-reply-mode-DrUXogvO.js +0 -14
  227. package/dist/action-runtime.runtime-D9I6uc0Q.js +0 -2
  228. package/dist/actions.runtime-DLFyUkvg.js +0 -2
  229. package/dist/block-text-YtiNkqmx.js +0 -79
  230. package/dist/runtime-api-Cj9nxBNv.js +0 -10
  231. package/node_modules/p-map/index.d.ts +0 -155
  232. package/node_modules/p-map/index.js +0 -285
  233. package/node_modules/p-map/license +0 -9
  234. package/node_modules/p-map/package.json +0 -57
  235. package/node_modules/p-map/readme.md +0 -190
  236. package/node_modules/typebox/build/format/_idna.d.mts +0 -2
  237. package/node_modules/typebox/build/format/_idna.mjs +0 -246
  238. package/node_modules/typebox/build/format/_puny.d.mts +0 -1
  239. package/node_modules/typebox/build/format/_puny.mjs +0 -77
  240. package/node_modules/typebox/build/schema/resolve/ref.d.mts +0 -3
  241. package/node_modules/typebox/build/schema/resolve/ref.mjs +0 -146
  242. package/node_modules/typebox/build/schema/types/contentEncoding.d.mts +0 -9
  243. package/node_modules/typebox/build/schema/types/contentEncoding.mjs +0 -13
  244. package/node_modules/typebox/build/schema/types/contentMediaType.d.mts +0 -9
  245. package/node_modules/typebox/build/schema/types/contentMediaType.mjs +0 -13
  246. package/dist/{security-audit-DR097212.js → security-audit-B_yKr7MW.js} +1 -1
@@ -1,135 +1,8 @@
1
- function IsAlpha(ch) {
2
- return (ch >= 97 && ch <= 122) || (ch >= 65 && ch <= 90); // a-z, A-Z
3
- }
4
- function IsAlphaNumeric(ch) {
5
- return IsAlpha(ch) || (ch >= 48 && ch <= 57); // a-z, A-Z, 0-9
6
- }
7
- function IsHex(ch) {
8
- return (ch >= 48 && ch <= 57) || // 0-9
9
- (ch >= 65 && ch <= 70) || // A-F
10
- (ch >= 97 && ch <= 102); // a-f
11
- }
12
- function IsSchemeChar(ch) {
13
- return IsAlphaNumeric(ch) ||
14
- ch === 43 || ch === 45 || ch === 46; // '+', '-', '.'
15
- }
16
- function IsUnreserved(ch) {
17
- return IsAlphaNumeric(ch) ||
18
- ch === 45 || ch === 46 || // '-', '.'
19
- ch === 95 || ch === 126; // '_', '~'
20
- }
21
- function IsSubDelim(ch) {
22
- return ch === 33 || ch === 36 || ch === 38 || ch === 39 ||
23
- ch === 40 || ch === 41 || ch === 42 || ch === 43 ||
24
- ch === 44 || ch === 59 || ch === 61; // ! $ & ' ( ) * + , ; =
25
- }
26
- function IsPchar(ch) {
27
- return IsUnreserved(ch) || IsSubDelim(ch) || ch === 58 || ch === 64; // ':', '@'
28
- }
1
+ const Uri = /^[a-z][a-z0-9+\-.]*:(?:\/\/(?:(?:[-a-z0-9._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:[\da-f]{1,4}:){6}(?:[\da-f]{1,4}:[\da-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))|::(?:[\da-f]{1,4}:){5}(?:[\da-f]{1,4}:[\da-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))|(?:[\da-f]{1,4})?::(?:[\da-f]{1,4}:){4}(?:[\da-f]{1,4}:[\da-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|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$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[-a-z0-9._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[-a-z0-9._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
29
2
  /**
30
- * Returns true if the value matches RFC 3986 URI syntax.
3
+ * Returns true if the value is a valid Uniform Resource Identifier.
31
4
  * @specification https://tools.ietf.org/html/rfc3986
32
5
  */
33
6
  export function IsUri(value) {
34
- const length = value.length;
35
- if (length === 0)
36
- return false;
37
- // Scheme: must start with a letter
38
- if (!IsAlpha(value.charCodeAt(0)))
39
- return false;
40
- // Scheme: continues until ':'
41
- let i = 1;
42
- while (i < length) {
43
- const ch = value.charCodeAt(i);
44
- if (ch === 58)
45
- break; // ':'
46
- if (!IsSchemeChar(ch))
47
- return false;
48
- i++;
49
- }
50
- // Ensure scheme is terminated by ':'
51
- if (value.charCodeAt(i) !== 58)
52
- return false;
53
- i++;
54
- // Authority: optional '//'
55
- if (value.charCodeAt(i) === 47 && value.charCodeAt(i + 1) === 47) {
56
- i += 2;
57
- // Userinfo: check for '@' before path/query/fragment delimiters
58
- const authorityStart = i;
59
- let atPos = -1;
60
- for (let j = i; j < length; j++) {
61
- const ch = value.charCodeAt(j);
62
- if (ch === 64) {
63
- atPos = j;
64
- break;
65
- } // '@'
66
- if (ch === 47 || ch === 63 || ch === 35)
67
- break; // '/', '?', '#'
68
- }
69
- if (atPos !== -1) {
70
- // Userinfo: validate allowed chars and percent-encoding
71
- for (let j = authorityStart; j < atPos; j++) {
72
- const ch = value.charCodeAt(j);
73
- if (ch === 91 || ch === 93)
74
- return false; // No '[' or ']' in userinfo
75
- if (ch === 37) { // '%' percent-encoding
76
- if (j + 2 >= atPos || !IsHex(value.charCodeAt(j + 1)) || !IsHex(value.charCodeAt(j + 2)))
77
- return false;
78
- j += 2;
79
- }
80
- else if (!IsUnreserved(ch) && !IsSubDelim(ch) && ch !== 58)
81
- return false;
82
- }
83
- i = atPos + 1;
84
- }
85
- // Host: IP-literal [addr] or reg-name
86
- if (value.charCodeAt(i) === 91) { // '['
87
- i++;
88
- while (i < length && value.charCodeAt(i) !== 93)
89
- i++;
90
- if (value.charCodeAt(i) !== 93)
91
- return false; // ']'
92
- i++;
93
- }
94
- else {
95
- // Host: validate ASCII; skip validation for non-ASCII (Unicode hosts)
96
- while (i < length) {
97
- const ch = value.charCodeAt(i);
98
- if (ch === 47 || ch === 63 || ch === 35 || ch === 58)
99
- break;
100
- if (ch < 128 && !IsUnreserved(ch) && !IsSubDelim(ch))
101
- return false;
102
- i++;
103
- }
104
- }
105
- // Port: optional digits after ':'
106
- if (value.charCodeAt(i) === 58) { // ':'
107
- i++;
108
- while (i < length) {
109
- const ch = value.charCodeAt(i);
110
- if (ch === 47 || ch === 63 || ch === 35)
111
- break;
112
- if (ch < 48 || ch > 57)
113
- return false; // 0-9
114
- i++;
115
- }
116
- }
117
- }
118
- // Path, Query, and Fragment
119
- while (i < length) {
120
- const ch = value.charCodeAt(i);
121
- if (ch === 37) { // '%' percent-encoding
122
- if (i + 2 >= length || !IsHex(value.charCodeAt(i + 1)) || !IsHex(value.charCodeAt(i + 2)))
123
- return false;
124
- i += 2;
125
- }
126
- else if (ch > 127) {
127
- return false; // URI is ASCII-only
128
- }
129
- else if (!(IsPchar(ch) || ch === 47 || ch === 63 || ch === 35)) {
130
- return false; // '/', '?', '#'
131
- }
132
- i++;
133
- }
134
- return true;
7
+ return Uri.test(value);
135
8
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Returns true if the value is a valid URI Reference.
2
+ * Returns true if the value is a valid Uri Reference.
3
3
  * @specification https://tools.ietf.org/html/rfc3986
4
4
  */
5
5
  export declare function IsUriReference(value: string): boolean;
@@ -1,7 +1,6 @@
1
- // deno-lint-ignore-file no-control-regex
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*|\/(?:(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[-a-z0-9._~!$&'()*+,;=@]|%[0-9a-f]{2})+(?:\/(?:[-a-z0-9._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?)(?:\?(?:[-a-z0-9._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[-a-z0-9._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
3
2
  /**
4
- * Returns true if the value is a valid URI Reference.
3
+ * Returns true if the value is a valid Uri Reference.
5
4
  * @specification https://tools.ietf.org/html/rfc3986
6
5
  */
7
6
  export function IsUriReference(value) {
@@ -1,6 +1,5 @@
1
1
  /**
2
- * Returns true if the value is a uri template
3
- * @specification
4
- * @source ajv-formats
2
+ * Returns true if the value is a valid Uri Template
3
+ * @specification https://datatracker.ietf.org/doc/html/rfc6570
5
4
  */
6
5
  export declare function IsUriTemplate(value: string): boolean;
@@ -1,9 +1,8 @@
1
- // deno-lint-ignore-file
2
- const UriTemplate = /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i;
1
+ // deno-lint-ignore-file no-control-regex
2
+ const UriTemplate = /^(?:(?:[^\x00-\x20"<>%\\^`{|}\x7f]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?:\.(?:[a-z0-9_]|%[0-9a-f]{2})+)*(?::[1-9]\d{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?:\.(?:[a-z0-9_]|%[0-9a-f]{2})+)*(?::[1-9]\d{0,3}|\*)?)*\})*$/i;
3
3
  /**
4
- * Returns true if the value is a uri template
5
- * @specification
6
- * @source ajv-formats
4
+ * Returns true if the value is a valid Uri Template
5
+ * @specification https://datatracker.ietf.org/doc/html/rfc6570
7
6
  */
8
7
  export function IsUriTemplate(value) {
9
8
  return UriTemplate.test(value);
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Returns true if the value is a Url
3
- * @specification
4
- * @source ajv-formats
2
+ * Returns true if the value is a valid Uniform Resource Locator
3
+ * @specification https://datatracker.ietf.org/doc/html/rfc3986
4
+ * @specification https://datatracker.ietf.org/doc/html/rfc3987
5
5
  */
6
6
  export declare function IsUrl(value: string): boolean;
@@ -1,9 +1,8 @@
1
- const Url = /^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu;
2
1
  /**
3
- * Returns true if the value is a Url
4
- * @specification
5
- * @source ajv-formats
2
+ * Returns true if the value is a valid Uniform Resource Locator
3
+ * @specification https://datatracker.ietf.org/doc/html/rfc3986
4
+ * @specification https://datatracker.ietf.org/doc/html/rfc3987
6
5
  */
7
6
  export function IsUrl(value) {
8
- return Url.test(value);
7
+ return URL.canParse(value);
9
8
  }
@@ -33,6 +33,9 @@ export declare function IsGreaterEqualThan(left: string, right: string): string;
33
33
  export declare function IsMinLength(value: string, length: string): string;
34
34
  export declare function IsMaxLength(value: string, length: string): string;
35
35
  export declare function Every(value: string, offset: string, params: [value: string, index: string], expression: string): string;
36
+ export declare function Some(value: string, params: [value: string, index: string], expression: string): string;
37
+ export declare function SomeAll(value: string, params: [value: string, index: string], expression: string): string;
38
+ export declare function Counted(value: string, params: [value: string, index: string], expression: string): string;
36
39
  export declare function Entries(value: string): string;
37
40
  export declare function Keys(value: string): string;
38
41
  export declare function HasPropertyKey(value: string, key: string): string;
@@ -50,5 +53,4 @@ export declare function If(condition: string, then: string): string;
50
53
  export declare function Return(expression: string): string;
51
54
  export declare function ReduceAnd(operands: string[]): string;
52
55
  export declare function ReduceOr(operands: string[]): string;
53
- export declare function PrefixIncrement(expression: string): string;
54
56
  export declare function MultipleOf(dividend: string, divisor: string): string;
@@ -110,6 +110,15 @@ export function Every(value, offset, params, expression) {
110
110
  ? `${value}.every((${params[0]}, ${params[1]}) => ${expression})`
111
111
  : `((value, callback) => { for(let index = ${offset}; index < value.length; index++) if (!callback(value[index], index)) return false; return true })(${value}, (${params[0]}, ${params[1]}) => ${expression})`;
112
112
  }
113
+ export function Some(value, params, expression) {
114
+ return `${value}.some((${params[0]}, ${params[1]}) => ${expression})`;
115
+ }
116
+ export function SomeAll(value, params, expression) {
117
+ return `((value, callback) => { let result = false; for(let index = 0; index < value.length; index++) if (callback(value[index], index)) result = true; return result })(${value}, (${params[0]}, ${params[1]}) => ${expression})`;
118
+ }
119
+ export function Counted(value, params, expression) {
120
+ return `${value}.reduce((result, ${params[0]}, ${params[1]}) => (${expression}) ? ++result : result, 0)`;
121
+ }
113
122
  // --------------------------------------------------------------------------
114
123
  // Objects
115
124
  // --------------------------------------------------------------------------
@@ -145,6 +154,8 @@ export function Member(left, right) {
145
154
  return `${left}${IsIdentifier(right) ? `.${right}` : `[${Constant(right)}]`}`;
146
155
  }
147
156
  export function Constant(value) {
157
+ if (!G.IsValueLike(value))
158
+ throw Error('Unsupported Constant');
148
159
  return G.IsString(value) ? JSON.stringify(value) : `${value}`;
149
160
  }
150
161
  export function Ternary(condition, true_, false_) {
@@ -172,15 +183,11 @@ export function ReduceAnd(operands) {
172
183
  return G.IsEqual(operands.length, 0) ? 'true' : operands.reduce((left, right) => And(left, right));
173
184
  }
174
185
  export function ReduceOr(operands) {
175
- // deno-coverage-ignore - we never observe 0 operands
176
186
  return G.IsEqual(operands.length, 0) ? 'false' : operands.reduce((left, right) => Or(left, right));
177
187
  }
178
188
  // --------------------------------------------------------------------------
179
- // Arithmetic
189
+ // MultipleOf
180
190
  // --------------------------------------------------------------------------
181
- export function PrefixIncrement(expression) {
182
- return `++${expression}`;
183
- }
184
191
  export function MultipleOf(dividend, divisor) {
185
192
  return `Guard.IsMultipleOf(${dividend}, ${divisor})`;
186
193
  }
@@ -39,10 +39,16 @@ export declare function GraphemeCount(value: string): number;
39
39
  export declare function IsMaxLength(value: string, length: number): boolean;
40
40
  /** Returns true if the string has at least the given number of graphemes */
41
41
  export declare function IsMinLength(value: string, length: number): boolean;
42
- /** Returns true if all elements from offset satisfy the callback, short-circuiting on the first failure */
42
+ /** Returns true if every element from offset satisfies the callback, short-circuiting on the first failure */
43
43
  export declare function Every<T>(value: T[], offset: number, callback: (value: T, index: number) => boolean): boolean;
44
- /** Returns true if all elements from offset satisfy the callback, visiting every element regardless of failure */
44
+ /** Returns true if every element from offset satisfies the callback, using exhaustive enumeration */
45
45
  export declare function EveryAll<T>(value: T[], offset: number, callback: (value: T, index: number) => boolean): boolean;
46
+ /** Returns true if some element satisfies the callback, short-circuiting on the first success */
47
+ export declare function Some<T>(value: T[], callback: (value: T, index: number) => boolean): boolean;
48
+ /** Returns true if some element satisfies the callback, using exhaustive enumeration */
49
+ export declare function SomeAll<T>(value: T[], callback: (value: T, index: number) => boolean): boolean;
50
+ /** Returns the count of elements that satisfy the callback */
51
+ export declare function Counted(value: unknown[], callback: (value: unknown, index: number) => boolean): number;
46
52
  /** Shifts the left-most element from an array and dispatches to the true arm, or the false arm if empty */
47
53
  export declare function ShiftLeft<T, True extends (left: T, right: T[]) => unknown, False extends () => unknown>(array: T[], true_: True, false_: False): ReturnType<True> | ReturnType<False>;
48
54
  /** Returns true if the PropertyKey is Unsafe (ref: prototype-pollution). */
@@ -129,16 +129,16 @@ export function GraphemeCount(value) {
129
129
  }
130
130
  /** Returns true if the string has at most the given number of graphemes */
131
131
  export function IsMaxLength(value, length) {
132
- return String.IsMaxLengthFast(value, length);
132
+ return String.IsMaxLength(value, length);
133
133
  }
134
134
  /** Returns true if the string has at least the given number of graphemes */
135
135
  export function IsMinLength(value, length) {
136
- return String.IsMinLengthFast(value, length);
136
+ return String.IsMinLength(value, length);
137
137
  }
138
138
  // --------------------------------------------------------------------------
139
139
  // Array
140
140
  // --------------------------------------------------------------------------
141
- /** Returns true if all elements from offset satisfy the callback, short-circuiting on the first failure */
141
+ /** Returns true if every element from offset satisfies the callback, short-circuiting on the first failure */
142
142
  export function Every(value, offset, callback) {
143
143
  for (let index = offset; index < value.length; index++) {
144
144
  if (!callback(value[index], index))
@@ -146,7 +146,7 @@ export function Every(value, offset, callback) {
146
146
  }
147
147
  return true;
148
148
  }
149
- /** Returns true if all elements from offset satisfy the callback, visiting every element regardless of failure */
149
+ /** Returns true if every element from offset satisfies the callback, using exhaustive enumeration */
150
150
  export function EveryAll(value, offset, callback) {
151
151
  let result = true;
152
152
  for (let index = offset; index < value.length; index++) {
@@ -155,6 +155,27 @@ export function EveryAll(value, offset, callback) {
155
155
  }
156
156
  return result;
157
157
  }
158
+ /** Returns true if some element satisfies the callback, short-circuiting on the first success */
159
+ export function Some(value, callback) {
160
+ for (let index = 0; index < value.length; index++) {
161
+ if (callback(value[index], index))
162
+ return true;
163
+ }
164
+ return false;
165
+ }
166
+ /** Returns true if some element satisfies the callback, using exhaustive enumeration */
167
+ export function SomeAll(value, callback) {
168
+ let result = false;
169
+ for (let index = 0; index < value.length; index++) {
170
+ if (callback(value[index], index))
171
+ result = true;
172
+ }
173
+ return result;
174
+ }
175
+ /** Returns the count of elements that satisfy the callback */
176
+ export function Counted(value, callback) {
177
+ return value.reduce((result, value, index) => callback(value, index) ? ++result : result, 0);
178
+ }
158
179
  /** Shifts the left-most element from an array and dispatches to the true arm, or the false arm if empty */
159
180
  export function ShiftLeft(array, true_, false_) {
160
181
  return (IsEqual(array.length, 0) ? false_() : true_(array[0], array.slice(1)));
@@ -1,6 +1,6 @@
1
1
  /** Returns the number of grapheme clusters in a string */
2
2
  export declare function GraphemeCount(value: string): number;
3
3
  /** Fast check for minimum grapheme length, falls back to full check if needed */
4
- export declare function IsMinLengthFast(value: string, minLength: number): boolean;
4
+ export declare function IsMinLength(value: string, minLength: number): boolean;
5
5
  /** Fast check for maximum grapheme length, falls back to full check if needed */
6
- export declare function IsMaxLengthFast(value: string, maxLength: number): boolean;
6
+ export declare function IsMaxLength(value: string, maxLength: number): boolean;
@@ -67,7 +67,7 @@ function NextGraphemeClusterIndex(value, clusterStart) {
67
67
  // Consume combining marks & variation selectors
68
68
  clusterEnd = ConsumeModifiers(value, clusterEnd);
69
69
  // Handle multi-ZWJ sequences
70
- while (clusterEnd < value.length - 1 && value[clusterEnd] === '\u200D') {
70
+ while (clusterEnd < value.length - 1 && IsZeroWidthJoiner(value.codePointAt(clusterEnd))) {
71
71
  const nextCP = value.codePointAt(clusterEnd + 1);
72
72
  clusterEnd += 1 + CodePointLength(nextCP);
73
73
  clusterEnd = ConsumeModifiers(value, clusterEnd);
@@ -106,7 +106,7 @@ export function GraphemeCount(value) {
106
106
  // IsMinLength
107
107
  // --------------------------------------------------------------------------
108
108
  /** Checks if a string has at least a minimum number of grapheme clusters */
109
- function IsMinLength(value, minLength) {
109
+ function IsMinLengthSegmented(value, minLength) {
110
110
  // ----------------------------------------------------------------
111
111
  // Inaccessible via public interface (review)
112
112
  //
@@ -129,7 +129,7 @@ function IsMinLength(value, minLength) {
129
129
  // IsMaxLength
130
130
  // --------------------------------------------------------------------------
131
131
  /** Checks if a string has at most a maximum number of grapheme clusters */
132
- function IsMaxLength(value, maxLength) {
132
+ function IsMaxLengthSegmented(value, maxLength) {
133
133
  let count = 0;
134
134
  let index = 0;
135
135
  while (index < value.length) {
@@ -144,13 +144,13 @@ function IsMaxLength(value, maxLength) {
144
144
  // IsMinLengthFast
145
145
  // --------------------------------------------------------------------------
146
146
  /** Fast check for minimum grapheme length, falls back to full check if needed */
147
- export function IsMinLengthFast(value, minLength) {
147
+ export function IsMinLength(value, minLength) {
148
148
  if (minLength === 0)
149
149
  return true; // 0-length
150
150
  let index = 0;
151
151
  while (index < value.length) {
152
152
  if (IsGraphemeCodePoint(value.charCodeAt(index))) {
153
- return IsMinLength(value, minLength);
153
+ return IsMinLengthSegmented(value, minLength);
154
154
  }
155
155
  index++;
156
156
  if (index >= minLength)
@@ -162,11 +162,11 @@ export function IsMinLengthFast(value, minLength) {
162
162
  // IsMaxLengthFast
163
163
  // --------------------------------------------------------------------------
164
164
  /** Fast check for maximum grapheme length, falls back to full check if needed */
165
- export function IsMaxLengthFast(value, maxLength) {
165
+ export function IsMaxLength(value, maxLength) {
166
166
  let index = 0;
167
167
  while (index < value.length) {
168
168
  if (IsGraphemeCodePoint(value.charCodeAt(index))) {
169
- return IsMaxLength(value, maxLength);
169
+ return IsMaxLengthSegmented(value, maxLength);
170
170
  }
171
171
  index++;
172
172
  if (index > maxLength)
@@ -7,10 +7,10 @@ import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
7
7
  function HasUnevaluatedFromObject(value) {
8
8
  return (Schema.IsUnevaluatedItems(value)
9
9
  || Schema.IsUnevaluatedProperties(value)
10
- || G.Keys(value).some(key => HasUnevaluatedFromUnknown(value[key])));
10
+ || G.Some(G.Keys(value), key => HasUnevaluatedFromUnknown(value[key])));
11
11
  }
12
12
  function HasUnevaluatedFromArray(value) {
13
- return value.some(value => HasUnevaluatedFromUnknown(value));
13
+ return G.Some(value, value => HasUnevaluatedFromUnknown(value));
14
14
  }
15
15
  function HasUnevaluatedFromUnknown(value) {
16
16
  return (G.IsArray(value) ? HasUnevaluatedFromArray(value) :
@@ -18,7 +18,7 @@ function HasUnevaluatedFromUnknown(value) {
18
18
  false);
19
19
  }
20
20
  export function HasUnevaluated(context, schema) {
21
- return HasUnevaluatedFromUnknown(schema) || G.Keys(context).some(key => HasUnevaluatedFromUnknown(context[key]));
21
+ return HasUnevaluatedFromUnknown(schema) || G.Some(G.Keys(context), key => HasUnevaluatedFromUnknown(context[key]));
22
22
  }
23
23
  // ------------------------------------------------------------------
24
24
  // BuildContext
@@ -1,5 +1,4 @@
1
1
  // deno-fmt-ignore-file
2
- import { Hashing } from '../../system/hashing/index.mjs';
3
2
  import { EmitGuard as E } from '../../guard/index.mjs';
4
3
  import { BuildSchema } from './schema.mjs';
5
4
  const index = [0];
@@ -9,7 +8,7 @@ const funcs = new Map();
9
8
  // CreateName
10
9
  // ------------------------------------------------------------------
11
10
  function NextName() {
12
- return Hashing.Hash(index[0]++);
11
+ return `${index[0]++}`;
13
12
  }
14
13
  function CreateName(schema, href) {
15
14
  if (!names.has(schema))
@@ -0,0 +1,2 @@
1
+ /** Standard RegExp with Unicode */
2
+ export declare function UnicodeRegExp(pattern: string): RegExp;
@@ -0,0 +1,4 @@
1
+ /** Standard RegExp with Unicode */
2
+ export function UnicodeRegExp(pattern) {
3
+ return new RegExp(pattern, 'u');
4
+ }
@@ -4,7 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
4
4
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
5
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
6
  };
7
- var _Stack_instances, _Stack_PushResourceAnchors, _Stack_PopResourceAnchors, _Stack_FromContext, _Stack_FromRef;
7
+ var _Stack_instances, _Stack_PushResourceAnchors, _Stack_PopResourceAnchors;
8
8
  import * as Schema from '../types/index.mjs';
9
9
  import { Guard as G } from '../../guard/index.mjs';
10
10
  import { Resolve } from '../resolve/index.mjs';
@@ -22,7 +22,7 @@ export class Stack {
22
22
  // Base
23
23
  // ----------------------------------------------------------------
24
24
  BaseURL() {
25
- return this.ids.reduce((result, schema) => new URL(schema.$id, result), new URL('http://unknown'));
25
+ return this.ids.reduce((result, schema) => new URL(schema.$id, result), Resolve.DefaultBase);
26
26
  }
27
27
  Base() {
28
28
  return this.ids[this.ids.length - 1] ?? this.schema;
@@ -58,23 +58,29 @@ export class Stack {
58
58
  if (Schema.IsDynamicAnchor(schema))
59
59
  this.dynamicAnchors.pop();
60
60
  }
61
+ // ----------------------------------------------------------------
62
+ // Ref
63
+ // ----------------------------------------------------------------
61
64
  Ref(ref) {
62
- return __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_FromContext).call(this, ref) ?? __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_FromRef).call(this, ref);
65
+ const root = this.schema;
66
+ return !ref.$ref.startsWith('#')
67
+ ? Resolve.Ref(this.context, root, ref.$ref)
68
+ : Resolve.Ref(this.context, this.Base(), ref.$ref);
63
69
  }
64
70
  // ----------------------------------------------------------------
65
71
  // RecursiveRef
66
72
  // ----------------------------------------------------------------
67
73
  RecursiveRef(recursiveRef) {
68
74
  return Schema.IsRecursiveAnchorTrue(this.Base())
69
- ? Resolve.Ref(this.recursiveAnchors[0], recursiveRef.$recursiveRef)
70
- : Resolve.Ref(this.Base(), recursiveRef.$recursiveRef);
75
+ ? Resolve.Ref(this.context, this.recursiveAnchors[0], recursiveRef.$recursiveRef)
76
+ : Resolve.Ref(this.context, this.Base(), recursiveRef.$recursiveRef);
71
77
  }
72
78
  // ----------------------------------------------------------------
73
79
  // DynamicRef
74
80
  // ----------------------------------------------------------------
75
81
  DynamicRef(dynamicRef) {
76
82
  const root = this.schema;
77
- return Resolve.DynamicRef(root, this.Base(), dynamicRef, this.dynamicAnchors);
83
+ return Resolve.DynamicRef(this.context, root, this.Base(), dynamicRef, this.dynamicAnchors);
78
84
  }
79
85
  }
80
86
  _Stack_instances = new WeakSet(), _Stack_PushResourceAnchors = function _Stack_PushResourceAnchors(schema, isRoot = true) {
@@ -97,11 +103,4 @@ _Stack_instances = new WeakSet(), _Stack_PushResourceAnchors = function _Stack_P
97
103
  this.dynamicAnchors.pop();
98
104
  for (const key of G.Keys(current))
99
105
  __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_PopResourceAnchors).call(this, current[key], false);
100
- }, _Stack_FromContext = function _Stack_FromContext(ref) {
101
- return G.HasPropertyKey(this.context, ref.$ref) ? this.context[ref.$ref] : undefined;
102
- }, _Stack_FromRef = function _Stack_FromRef(ref) {
103
- const root = this.schema;
104
- return !ref.$ref.startsWith('#')
105
- ? Resolve.Ref(root, ref.$ref)
106
- : Resolve.Ref(this.Base(), ref.$ref);
107
106
  };
@@ -12,15 +12,25 @@ function IsValid(schema) {
12
12
  // ------------------------------------------------------------------
13
13
  // Build
14
14
  // ------------------------------------------------------------------
15
- export function BuildAdditionalItems(stack, context, schema, value) {
16
- if (!IsValid(schema))
17
- return E.Constant(true);
15
+ function BuildAdditionalItemsStandard(stack, context, schema, value) {
18
16
  const [item, index] = [Unique(), Unique()];
19
17
  const isSchema = BuildSchemaPushStack(stack, context, schema.additionalItems, item);
20
18
  const isLength = E.IsLessThan(index, E.Constant(schema.items.length));
21
19
  const addIndex = context.AddIndex(index);
22
- const guarded = context.UseUnevaluated() ? E.Or(isLength, E.And(isSchema, addIndex)) : E.Or(isLength, isSchema);
23
- return E.Call(E.Member(value, 'every'), [E.ArrowFunction([item, index], guarded)]);
20
+ return E.Every(value, E.Constant(0), [item, index], E.Or(isLength, E.And(isSchema, addIndex)));
21
+ }
22
+ function BuildAdditionalItemsFast(stack, context, schema, value) {
23
+ const [item, index] = [Unique(), Unique()];
24
+ const isSchema = BuildSchemaPushStack(stack, context, schema.additionalItems, item);
25
+ const isLength = E.IsLessThan(index, E.Constant(schema.items.length));
26
+ return E.Every(value, E.Constant(0), [item, index], E.Or(isLength, isSchema));
27
+ }
28
+ export function BuildAdditionalItems(stack, context, schema, value) {
29
+ if (!IsValid(schema))
30
+ return E.Constant(true);
31
+ return context.UseUnevaluated()
32
+ ? BuildAdditionalItemsStandard(stack, context, schema, value)
33
+ : BuildAdditionalItemsFast(stack, context, schema, value);
24
34
  }
25
35
  // ------------------------------------------------------------------
26
36
  // Check
@@ -28,7 +38,7 @@ export function BuildAdditionalItems(stack, context, schema, value) {
28
38
  export function CheckAdditionalItems(stack, context, schema, value) {
29
39
  if (!IsValid(schema))
30
40
  return true;
31
- const isAdditionalItems = value.every((item, index) => {
41
+ const isAdditionalItems = G.Every(value, 0, (item, index) => {
32
42
  return G.IsLessThan(index, schema.items.length)
33
43
  || (CheckSchemaPushStack(stack, context, schema.additionalItems, item) && context.AddIndex(index));
34
44
  });
@@ -40,7 +50,7 @@ export function CheckAdditionalItems(stack, context, schema, value) {
40
50
  export function ErrorAdditionalItems(stack, context, schemaPath, instancePath, schema, value) {
41
51
  if (!IsValid(schema))
42
52
  return true;
43
- const isAdditionalItems = value.every((item, index) => {
53
+ const isAdditionalItems = G.Every(value, 0, (item, index) => {
44
54
  const nextSchemaPath = `${schemaPath}/additionalItems`;
45
55
  const nextInstancePath = `${instancePath}/${index}`;
46
56
  return G.IsLessThan(index, schema.items.length) ||
@@ -3,6 +3,7 @@ import * as S from '../types/index.mjs';
3
3
  import * as V from './_externals.mjs';
4
4
  import { Unique } from './_unique.mjs';
5
5
  import { AccumulatedErrorContext } from './_context.mjs';
6
+ import { UnicodeRegExp } from './_regexp.mjs';
6
7
  import { EmitGuard as E, Guard as G } from '../../guard/index.mjs';
7
8
  import { BuildSchemaPushStack, CheckSchemaPushStack, ErrorSchemaPushStack } from './schema.mjs';
8
9
  // ------------------------------------------------------------------
@@ -58,7 +59,7 @@ export function BuildAdditionalPropertiesFast(_context, schema, value) {
58
59
  // ------------------------------------------------------------------
59
60
  export function BuildAdditionalPropertiesStandard(stack, context, schema, value) {
60
61
  const [key, _index] = [Unique(), Unique()];
61
- const regexp = V.CreateVariable(new RegExp(GetPropertiesPattern(schema)));
62
+ const regexp = V.CreateVariable(UnicodeRegExp(GetPropertiesPattern(schema)));
62
63
  const isSchema = BuildSchemaPushStack(stack, context, schema.additionalProperties, `${value}[${key}]`);
63
64
  const isKey = E.Call(E.Member(regexp, 'test'), [key]);
64
65
  const addKey = context.AddKey(key);
@@ -78,7 +79,7 @@ export function BuildAdditionalProperties(stack, context, schema, value) {
78
79
  // Check
79
80
  // ------------------------------------------------------------------
80
81
  export function CheckAdditionalProperties(stack, context, schema, value) {
81
- const regexp = new RegExp(GetPropertiesPattern(schema));
82
+ const regexp = UnicodeRegExp(GetPropertiesPattern(schema));
82
83
  const isAdditionalProperties = G.Every(G.Keys(value), 0, (key, _index) => {
83
84
  return regexp.test(key) ||
84
85
  (CheckSchemaPushStack(stack, context, schema.additionalProperties, value[key]) && context.AddKey(key));
@@ -89,7 +90,7 @@ export function CheckAdditionalProperties(stack, context, schema, value) {
89
90
  // Error
90
91
  // ------------------------------------------------------------------
91
92
  export function ErrorAdditionalProperties(stack, context, schemaPath, instancePath, schema, value) {
92
- const regexp = new RegExp(GetPropertiesPattern(schema));
93
+ const regexp = UnicodeRegExp(GetPropertiesPattern(schema));
93
94
  const additionalProperties = [];
94
95
  const isAdditionalProperties = G.EveryAll(G.Keys(value), 0, (key, _index) => {
95
96
  const nextSchemaPath = `${schemaPath}/additionalProperties`;