@openclaw/whatsapp 2026.8.1-beta.3 → 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 (239) hide show
  1. package/dist/{accounts-BX2fZUyR.js → accounts-CeKQbu_s.js} +9 -26
  2. package/dist/{action-runtime-pM-ExU0l.js → action-runtime-YA_Yvunu.js} +2 -2
  3. package/dist/action-runtime-api.js +1 -1
  4. package/dist/action-runtime.runtime.js +1 -1
  5. package/dist/{call-tool-api.js → agent-tools-api.js} +11 -4
  6. package/dist/{agent-tools-login-BjRpD-JQ.js → agent-tools-login-B-2qZPzc.js} +12 -3
  7. package/dist/api.js +6 -6
  8. package/dist/{approval-handler.runtime-CkMMvUjk.js → approval-handler.runtime-C7jZ8rsD.js} +3 -3
  9. package/dist/{approval-reactions-Jyr1JaAK.js → approval-reactions-rpaNVHzZ.js} +2 -2
  10. package/dist/{channel-DRMYRfZ8.js → channel-Dx09AAmX.js} +10 -12
  11. package/dist/channel-plugin-api.js +1 -1
  12. package/dist/{channel-react-action-CstrR0CT.js → channel-react-action-n9a8Hk5i.js} +3 -3
  13. package/dist/{channel.runtime-X3JC2gaq.js → channel.runtime-D_PjmeMT.js} +3 -3
  14. package/dist/{channel.setup-DhBBhbQv.js → channel.setup-CRJQiWbh.js} +1 -1
  15. package/dist/{directory-config-P7_3U73Z.js → directory-config-Ci8Jjsw4.js} +1 -1
  16. package/dist/directory-contract-api.js +1 -1
  17. package/dist/{group-session-key-DmFc_Cqi.js → group-session-key-CH9jJIVQ.js} +1 -1
  18. package/dist/index.js +4 -4
  19. package/dist/light-runtime-api.js +1 -1
  20. package/dist/{login-BkpKpndm.js → login-1u5WcfTn.js} +1 -1
  21. package/dist/{login-qr-1dpv6jjT.js → login-qr-B_1sr0hk.js} +35 -14
  22. package/dist/login-qr-runtime.js +1 -1
  23. package/dist/{monitor-IzwQKizW.js → monitor-CySzv38g.js} +115 -108
  24. package/dist/{question-reactions-D3eAeB0i.js → question-reactions-B9D6MHXZ.js} +1 -1
  25. package/dist/runtime-api.js +6 -6
  26. package/dist/{send-CwvTU4RI.js → send-C3S-NqyO.js} +2 -2
  27. package/dist/{send-api-obOSm2cC.js → send-api-C-FFC1p_.js} +3 -3
  28. package/dist/{setup-finalize-n4K2I2gJ.js → setup-finalize-CRzMpx84.js} +4 -4
  29. package/dist/setup-plugin-api.js +1 -1
  30. package/dist/{setup-surface-Cwn3zyxK.js → setup-surface-ym4doiv3.js} +2 -2
  31. package/dist/{shared-wg42NKFB.js → shared-D3B14d45.js} +3 -3
  32. package/node_modules/baileys/lib/Defaults/index.js +1 -1
  33. package/node_modules/baileys/lib/Socket/business.d.ts.map +1 -1
  34. package/node_modules/baileys/lib/Socket/chats.d.ts +1 -0
  35. package/node_modules/baileys/lib/Socket/chats.d.ts.map +1 -1
  36. package/node_modules/baileys/lib/Socket/chats.js +10 -5
  37. package/node_modules/baileys/lib/Socket/chats.js.map +1 -1
  38. package/node_modules/baileys/lib/Socket/communities.d.ts.map +1 -1
  39. package/node_modules/baileys/lib/Socket/groups.d.ts.map +1 -1
  40. package/node_modules/baileys/lib/Socket/index.d.ts.map +1 -1
  41. package/node_modules/baileys/lib/Socket/messages-recv.d.ts.map +1 -1
  42. package/node_modules/baileys/lib/Socket/messages-send.d.ts.map +1 -1
  43. package/node_modules/baileys/lib/Socket/newsletter.d.ts.map +1 -1
  44. package/node_modules/baileys/lib/Socket/socket.d.ts.map +1 -1
  45. package/node_modules/baileys/lib/Socket/socket.js +3 -0
  46. package/node_modules/baileys/lib/Socket/socket.js.map +1 -1
  47. package/node_modules/baileys/lib/Types/index.d.ts +1 -0
  48. package/node_modules/baileys/lib/Types/index.d.ts.map +1 -1
  49. package/node_modules/baileys/lib/Types/index.js.map +1 -1
  50. package/node_modules/baileys/lib/Utils/browser-utils.d.ts.map +1 -1
  51. package/node_modules/baileys/lib/Utils/browser-utils.js +1 -0
  52. package/node_modules/baileys/lib/Utils/browser-utils.js.map +1 -1
  53. package/node_modules/baileys/lib/Utils/generics.d.ts +1 -0
  54. package/node_modules/baileys/lib/Utils/generics.d.ts.map +1 -1
  55. package/node_modules/baileys/lib/Utils/generics.js +1 -1
  56. package/node_modules/baileys/lib/Utils/generics.js.map +1 -1
  57. package/node_modules/baileys/lib/Utils/tc-token-utils.d.ts.map +1 -1
  58. package/node_modules/baileys/lib/Utils/tc-token-utils.js +3 -2
  59. package/node_modules/baileys/lib/Utils/tc-token-utils.js.map +1 -1
  60. package/node_modules/baileys/lib/Utils/validate-connection.d.ts.map +1 -1
  61. package/node_modules/baileys/lib/Utils/validate-connection.js +9 -2
  62. package/node_modules/baileys/lib/Utils/validate-connection.js.map +1 -1
  63. package/node_modules/baileys/node_modules/content-type/README.md +2 -0
  64. package/node_modules/baileys/node_modules/content-type/dist/index.d.ts +20 -0
  65. package/node_modules/baileys/node_modules/content-type/dist/index.js +20 -14
  66. package/node_modules/baileys/node_modules/content-type/dist/index.js.map +1 -1
  67. package/node_modules/baileys/node_modules/content-type/package.json +1 -1
  68. package/node_modules/baileys/node_modules/file-type/package.json +1 -1
  69. package/node_modules/baileys/node_modules/file-type/readme.md +3 -0
  70. package/node_modules/baileys/node_modules/file-type/source/detectors/zip.js +6 -1
  71. package/node_modules/baileys/node_modules/file-type/source/index.d.ts +3 -0
  72. package/node_modules/baileys/node_modules/file-type/source/index.js +25 -13
  73. package/node_modules/baileys/node_modules/music-metadata/LICENSE.txt +9 -9
  74. package/node_modules/baileys/node_modules/music-metadata/README.md +878 -878
  75. package/node_modules/baileys/node_modules/music-metadata/lib/ParseError.d.ts +1 -1
  76. package/node_modules/baileys/node_modules/music-metadata/lib/ParseError.js +1 -1
  77. package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfObject.d.ts +1 -4
  78. package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfObject.js +66 -30
  79. package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfParser.d.ts +5 -1
  80. package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfParser.js +94 -25
  81. package/node_modules/baileys/node_modules/music-metadata/lib/dsf/DsfChunk.js +2 -2
  82. package/node_modules/baileys/node_modules/music-metadata/lib/dsf/DsfParser.js +38 -13
  83. package/node_modules/baileys/node_modules/music-metadata/lib/mp4/AtomToken.js +2 -1
  84. package/node_modules/baileys/node_modules/music-metadata/lib/mp4/MP4Parser.js +34 -7
  85. package/node_modules/baileys/node_modules/music-metadata/lib/ogg/speex/SpeexStream.d.ts +7 -0
  86. package/node_modules/baileys/node_modules/music-metadata/lib/ogg/speex/SpeexStream.js +13 -0
  87. package/node_modules/baileys/node_modules/music-metadata/lib/riff/RiffChunk.js +1 -1
  88. package/node_modules/baileys/node_modules/music-metadata/package.json +156 -156
  89. package/node_modules/baileys/node_modules/protobufjs/README.md +61 -84
  90. package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.js +66 -45
  91. package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
  92. package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
  93. package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
  94. package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.js +47 -40
  95. package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.js.map +1 -1
  96. package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.min.js +3 -3
  97. package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.min.js.map +1 -1
  98. package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.js +92 -68
  99. package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.js.map +1 -1
  100. package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.min.js +3 -3
  101. package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
  102. package/node_modules/baileys/node_modules/protobufjs/ext/descriptor.js +26 -10
  103. package/node_modules/baileys/node_modules/protobufjs/index.d.ts +3 -0
  104. package/node_modules/baileys/node_modules/protobufjs/package.json +1 -1
  105. package/node_modules/baileys/node_modules/protobufjs/src/converter.js +5 -1
  106. package/node_modules/baileys/node_modules/protobufjs/src/enum.js +5 -2
  107. package/node_modules/baileys/node_modules/protobufjs/src/field.js +6 -1
  108. package/node_modules/baileys/node_modules/protobufjs/src/parse.js +26 -23
  109. package/node_modules/baileys/node_modules/protobufjs/src/reader.js +36 -9
  110. package/node_modules/baileys/node_modules/protobufjs/src/util/codegen.js +3 -1
  111. package/node_modules/baileys/node_modules/protobufjs/src/util/utf8.js +2 -28
  112. package/node_modules/baileys/node_modules/protobufjs/src/writer.js +7 -1
  113. package/node_modules/baileys/package.json +1 -1
  114. package/node_modules/typebox/build/format/date.d.mts +1 -1
  115. package/node_modules/typebox/build/format/date.mjs +1 -1
  116. package/node_modules/typebox/build/format/date_time.d.mts +2 -2
  117. package/node_modules/typebox/build/format/date_time.mjs +3 -3
  118. package/node_modules/typebox/build/format/email.d.mts +1 -1
  119. package/node_modules/typebox/build/format/email.mjs +2 -2
  120. package/node_modules/typebox/build/format/hostname.mjs +2 -10
  121. package/node_modules/typebox/build/format/idn_email.d.mts +1 -1
  122. package/node_modules/typebox/build/format/idn_email.mjs +3 -3
  123. package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -0
  124. package/node_modules/typebox/build/format/idn_hostname.mjs +3 -11
  125. package/node_modules/typebox/build/format/idna/format/bidi.d.mts +3 -0
  126. package/node_modules/typebox/build/format/idna/format/bidi.mjs +98 -0
  127. package/node_modules/typebox/build/format/idna/format/puny.d.mts +3 -0
  128. package/node_modules/typebox/build/format/idna/format/puny.mjs +144 -0
  129. package/node_modules/typebox/build/format/idna/hostname.d.mts +1 -0
  130. package/node_modules/typebox/build/format/idna/hostname.mjs +16 -0
  131. package/node_modules/typebox/build/format/idna/idn-hostname.d.mts +1 -0
  132. package/node_modules/typebox/build/format/idna/idn-hostname.mjs +23 -0
  133. package/node_modules/typebox/build/format/idna/index.d.mts +2 -0
  134. package/node_modules/typebox/build/format/idna/index.mjs +2 -0
  135. package/node_modules/typebox/build/format/idna/label/ascii.d.mts +1 -0
  136. package/node_modules/typebox/build/format/idna/label/ascii.mjs +9 -0
  137. package/node_modules/typebox/build/format/idna/label/puny.d.mts +1 -0
  138. package/node_modules/typebox/build/format/idna/label/puny.mjs +28 -0
  139. package/node_modules/typebox/build/format/idna/label/unicode.d.mts +1 -0
  140. package/node_modules/typebox/build/format/idna/label/unicode.mjs +106 -0
  141. package/node_modules/typebox/build/format/idna/pattern/pattern.d.mts +30 -0
  142. package/node_modules/typebox/build/format/idna/pattern/pattern.mjs +70 -0
  143. package/node_modules/typebox/build/format/ipv4.d.mts +0 -1
  144. package/node_modules/typebox/build/format/ipv4.mjs +2 -32
  145. package/node_modules/typebox/build/format/ipv6.mjs +2 -61
  146. package/node_modules/typebox/build/format/iri.d.mts +2 -2
  147. package/node_modules/typebox/build/format/iri.mjs +26 -8
  148. package/node_modules/typebox/build/format/iri_reference.d.mts +2 -2
  149. package/node_modules/typebox/build/format/iri_reference.mjs +9 -55
  150. package/node_modules/typebox/build/format/regex.d.mts +1 -2
  151. package/node_modules/typebox/build/format/regex.mjs +2 -6
  152. package/node_modules/typebox/build/format/time.d.mts +2 -2
  153. package/node_modules/typebox/build/format/time.mjs +19 -14
  154. package/node_modules/typebox/build/format/uri.d.mts +1 -1
  155. package/node_modules/typebox/build/format/uri.mjs +3 -130
  156. package/node_modules/typebox/build/format/uri_reference.d.mts +1 -1
  157. package/node_modules/typebox/build/format/uri_reference.mjs +2 -3
  158. package/node_modules/typebox/build/format/uri_template.d.mts +2 -3
  159. package/node_modules/typebox/build/format/uri_template.mjs +4 -5
  160. package/node_modules/typebox/build/format/url.d.mts +3 -3
  161. package/node_modules/typebox/build/format/url.mjs +4 -5
  162. package/node_modules/typebox/build/guard/emit.d.mts +3 -1
  163. package/node_modules/typebox/build/guard/emit.mjs +12 -5
  164. package/node_modules/typebox/build/guard/guard.d.mts +8 -2
  165. package/node_modules/typebox/build/guard/guard.mjs +25 -4
  166. package/node_modules/typebox/build/guard/string.d.mts +2 -2
  167. package/node_modules/typebox/build/guard/string.mjs +7 -7
  168. package/node_modules/typebox/build/schema/engine/_context.mjs +3 -3
  169. package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -2
  170. package/node_modules/typebox/build/schema/engine/_regexp.d.mts +2 -0
  171. package/node_modules/typebox/build/schema/engine/_regexp.mjs +4 -0
  172. package/node_modules/typebox/build/schema/engine/_stack.mjs +12 -13
  173. package/node_modules/typebox/build/schema/engine/additionalItems.mjs +17 -7
  174. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +4 -3
  175. package/node_modules/typebox/build/schema/engine/contains.mjs +18 -6
  176. package/node_modules/typebox/build/schema/engine/enum.mjs +1 -1
  177. package/node_modules/typebox/build/schema/engine/items.mjs +26 -6
  178. package/node_modules/typebox/build/schema/engine/maxContains.mjs +3 -3
  179. package/node_modules/typebox/build/schema/engine/minContains.mjs +14 -4
  180. package/node_modules/typebox/build/schema/engine/not.mjs +4 -2
  181. package/node_modules/typebox/build/schema/engine/oneOf.mjs +7 -6
  182. package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -2
  183. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +4 -3
  184. package/node_modules/typebox/build/schema/engine/ref.mjs +1 -7
  185. package/node_modules/typebox/build/schema/engine/schema.mjs +13 -4
  186. package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
  187. package/node_modules/typebox/build/schema/resolve/resolve.d.mts +4 -1
  188. package/node_modules/typebox/build/schema/resolve/resolve.mjs +202 -1
  189. package/node_modules/typebox/build/schema/static/propertyNames.d.mts +5 -0
  190. package/node_modules/typebox/build/schema/static/propertyNames.mjs +3 -0
  191. package/node_modules/typebox/build/schema/static/schema.d.mts +3 -0
  192. package/node_modules/typebox/build/schema/types/index.d.mts +0 -2
  193. package/node_modules/typebox/build/schema/types/index.mjs +0 -2
  194. package/node_modules/typebox/build/system/memory/clone.mjs +14 -11
  195. package/node_modules/typebox/build/system/memory/discard.mjs +6 -5
  196. package/node_modules/typebox/build/system/settings/settings.d.mts +9 -0
  197. package/node_modules/typebox/build/system/settings/settings.mjs +2 -0
  198. package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +6 -1
  199. package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +16 -3
  200. package/node_modules/typebox/build/type/engine/call/instantiate.mjs +34 -4
  201. package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +5 -5
  202. package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +20 -26
  203. package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +6 -10
  204. package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +9 -13
  205. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +7 -4
  206. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +12 -19
  207. package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +4 -20
  208. package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +8 -20
  209. package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +4 -4
  210. package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +11 -8
  211. package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +1 -1
  212. package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +3 -4
  213. package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +17 -2
  214. package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +26 -6
  215. package/node_modules/typebox/build/type/engine/exclude/operation.mjs +3 -4
  216. package/node_modules/typebox/build/type/engine/extract/operation.d.mts +1 -1
  217. package/node_modules/typebox/build/type/engine/extract/operation.mjs +3 -4
  218. package/node_modules/typebox/build/type/engine/priority/priority.d.mts +2 -2
  219. package/node_modules/typebox/build/type/engine/priority/priority.mjs +3 -4
  220. package/node_modules/typebox/build/type/script/mapping.d.mts +32 -29
  221. package/node_modules/typebox/build/type/script/mapping.mjs +18 -25
  222. package/node_modules/typebox/build/type/script/parser.d.mts +19 -25
  223. package/node_modules/typebox/build/type/script/parser.mjs +27 -23
  224. package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
  225. package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
  226. package/node_modules/typebox/package.json +27 -27
  227. package/node_modules/typebox/readme.md +79 -82
  228. package/openclaw.plugin.json +2 -1
  229. package/package.json +6 -6
  230. package/node_modules/typebox/build/format/_idna.d.mts +0 -2
  231. package/node_modules/typebox/build/format/_idna.mjs +0 -246
  232. package/node_modules/typebox/build/format/_puny.d.mts +0 -1
  233. package/node_modules/typebox/build/format/_puny.mjs +0 -77
  234. package/node_modules/typebox/build/schema/resolve/ref.d.mts +0 -3
  235. package/node_modules/typebox/build/schema/resolve/ref.mjs +0 -146
  236. package/node_modules/typebox/build/schema/types/contentEncoding.d.mts +0 -9
  237. package/node_modules/typebox/build/schema/types/contentEncoding.mjs +0 -13
  238. package/node_modules/typebox/build/schema/types/contentMediaType.d.mts +0 -9
  239. package/node_modules/typebox/build/schema/types/contentMediaType.mjs +0 -13
@@ -1,146 +0,0 @@
1
- // deno-fmt-ignore-file
2
- import { Guard } from '../../guard/index.mjs';
3
- import { Pointer } from '../pointer/index.mjs';
4
- import * as Schema from '../types/index.mjs';
5
- // ------------------------------------------------------------------
6
- // Match: Id
7
- // ------------------------------------------------------------------
8
- function MatchId(schema, base, ref) {
9
- if (schema.$id === ref.hash)
10
- return schema;
11
- const absoluteId = new URL(schema.$id, base.href);
12
- const absoluteRef = new URL(ref.href, base.href);
13
- if (Guard.IsEqual(absoluteId.pathname, absoluteRef.pathname)) {
14
- return ref.hash.startsWith('#') ? MatchHash(schema, base, ref) : schema;
15
- }
16
- return undefined;
17
- }
18
- // ------------------------------------------------------------------
19
- // Match: Anchor
20
- // ------------------------------------------------------------------
21
- function MatchAnchor(schema, base, ref) {
22
- const absoluteAnchor = new URL(`#${schema.$anchor}`, base.href);
23
- const absoluteRef = new URL(ref.href, base.href);
24
- return Guard.IsEqual(absoluteAnchor.href, absoluteRef.href) ? schema : undefined;
25
- }
26
- // ------------------------------------------------------------------
27
- // Match: DynamicAnchor
28
- // ------------------------------------------------------------------
29
- function MatchDynamicAnchor(schema, base, ref) {
30
- const absoluteAnchor = new URL(`#${schema.$dynamicAnchor}`, base.href);
31
- const absoluteRef = new URL(ref.href, base.href);
32
- return Guard.IsEqual(absoluteAnchor.href, absoluteRef.href) ? schema : undefined;
33
- }
34
- // ------------------------------------------------------------------
35
- // Match: Hash
36
- //
37
- // Resolves JSON Pointer fragments only. Plain anchor-style fragments
38
- // (no leading '/') are handled exclusively by MatchAnchor and
39
- // MatchDynamicAnchor to prevent accidentally resolving an anchor name
40
- // as a pointer into the schema tree.
41
- //
42
- // ------------------------------------------------------------------
43
- function MatchHash(schema, _base, ref) {
44
- if (ref.href.endsWith('#'))
45
- return schema;
46
- if (!ref.hash.startsWith('#'))
47
- return undefined;
48
- const fragment = decodeURIComponent(ref.hash.slice(1));
49
- if (!fragment.startsWith('/'))
50
- return undefined;
51
- return Pointer.Get(schema, fragment);
52
- }
53
- // ------------------------------------------------------------------
54
- // Match
55
- // ------------------------------------------------------------------
56
- function Match(schema, base, ref) {
57
- if (Schema.IsId(schema)) {
58
- const result = MatchId(schema, base, ref);
59
- if (!Guard.IsUndefined(result))
60
- return result;
61
- }
62
- if (Schema.IsAnchor(schema)) {
63
- const result = MatchAnchor(schema, base, ref);
64
- if (!Guard.IsUndefined(result))
65
- return result;
66
- }
67
- if (Schema.IsDynamicAnchor(schema)) {
68
- const result = MatchDynamicAnchor(schema, base, ref);
69
- if (!Guard.IsUndefined(result))
70
- return result;
71
- }
72
- return MatchHash(schema, base, ref);
73
- }
74
- // ------------------------------------------------------------------
75
- // FromArray
76
- // ------------------------------------------------------------------
77
- function FromArray(schema, base, ref) {
78
- return schema.reduce((result, item) => {
79
- const match = FromValue(item, base, ref);
80
- return !Guard.IsUndefined(match) ? match : result;
81
- }, undefined);
82
- }
83
- // ------------------------------------------------------------------
84
- // FromObject
85
- // ------------------------------------------------------------------
86
- function FromObject(schema, base, ref) {
87
- return Guard.Keys(schema).reduce((result, key) => {
88
- const match = FromValue(schema[key], base, ref);
89
- return !Guard.IsUndefined(match) ? match : result;
90
- }, undefined);
91
- }
92
- // ------------------------------------------------------------------
93
- // FromValue
94
- // ------------------------------------------------------------------
95
- function FromValue(schema, base, ref) {
96
- const nextBase = Schema.IsSchemaObject(schema) && Schema.IsId(schema)
97
- ? new URL(schema.$id, base.href)
98
- : base;
99
- if (Schema.IsSchemaObject(schema)) {
100
- const result = Match(schema, nextBase, ref);
101
- if (!Guard.IsUndefined(result))
102
- return result;
103
- }
104
- if (Guard.IsArray(schema))
105
- return FromArray(schema, nextBase, ref);
106
- if (Guard.IsObject(schema))
107
- return FromObject(schema, nextBase, ref);
108
- return undefined;
109
- }
110
- // ------------------------------------------------------------------
111
- // Ref
112
- // ------------------------------------------------------------------
113
- export function Ref(schema, ref) {
114
- const defaultBase = new URL('http://unknown/');
115
- const initialBase = Schema.IsId(schema) ? new URL(schema.$id, defaultBase.href) : defaultBase;
116
- const initialRef = new URL(ref, initialBase.href);
117
- return FromValue(schema, initialBase, initialRef);
118
- }
119
- // ------------------------------------------------------------------
120
- // DynamicRef
121
- // ------------------------------------------------------------------
122
- export function DynamicRef(root, base, dynamicRef, dynamicAnchors) {
123
- // Resolve the static target using either the local base (for fragment‑only references)
124
- // or the document root (for absolute URI references).
125
- const fragmentTarget = dynamicRef.$dynamicRef.startsWith('#')
126
- ? Ref(base, dynamicRef.$dynamicRef)
127
- : Ref(root, dynamicRef.$dynamicRef);
128
- if (Guard.IsUndefined(fragmentTarget))
129
- return undefined;
130
- // Dynamic override only applies if the resolved target itself declares a $dynamicAnchor.
131
- // If it does not, return the static target unchanged.
132
- if (!Schema.IsSchemaObject(fragmentTarget) || !Schema.IsDynamicAnchor(fragmentTarget))
133
- return fragmentTarget;
134
- // Extract the fragment portion of the reference. According to the test suite,
135
- // only plain fragment names (e.g., "#foo") trigger the dynamic scope; JSON
136
- // Pointer fragments (e.g., "#/definitions/foo") bypass dynamic resolution.
137
- const fragment = new URL(dynamicRef.$dynamicRef, 'http://unknown/').hash;
138
- if (fragment.startsWith('#/'))
139
- return fragmentTarget;
140
- // Search the live dynamic anchor stack for a schema whose $dynamicAnchor matches the
141
- // target's $dynamicAnchor. The stack reflects the current evaluation path, and
142
- // find() returns the outermost (first encountered) match, which is the correct
143
- // lexical scope per the specification.
144
- const anchorTarget = dynamicAnchors.find(anchor => anchor.$dynamicAnchor === fragmentTarget.$dynamicAnchor);
145
- return anchorTarget ?? fragmentTarget;
146
- }
@@ -1,9 +0,0 @@
1
- import { type XSchemaObject } from './schema.mjs';
2
- export interface XContentEncoding<ContentEncoding extends string = string> {
3
- contentEncoding: ContentEncoding;
4
- }
5
- /**
6
- * Returns true if the schema contains a valid contentEncoding property
7
- * @specification Json Schema 7
8
- */
9
- export declare function IsContentEncoding(schema: XSchemaObject): schema is XContentEncoding;
@@ -1,13 +0,0 @@
1
- // deno-fmt-ignore-file
2
- import { Guard } from '../../guard/index.mjs';
3
- // ------------------------------------------------------------------
4
- // Guard
5
- // ------------------------------------------------------------------
6
- /**
7
- * Returns true if the schema contains a valid contentEncoding property
8
- * @specification Json Schema 7
9
- */
10
- export function IsContentEncoding(schema) {
11
- return Guard.HasPropertyKey(schema, 'contentEncoding')
12
- && Guard.IsString(schema.contentEncoding);
13
- }
@@ -1,9 +0,0 @@
1
- import { type XSchemaObject } from './schema.mjs';
2
- export interface XContentMediaType<ContentMediaType extends string = string> {
3
- contentMediaType: ContentMediaType;
4
- }
5
- /**
6
- * Returns true if the schema contains a valid contentMediaType property
7
- * @specification Json Schema 7
8
- */
9
- export declare function IsContentMediaType(schema: XSchemaObject): schema is XContentMediaType;
@@ -1,13 +0,0 @@
1
- // deno-fmt-ignore-file
2
- import { Guard } from '../../guard/index.mjs';
3
- // ------------------------------------------------------------------
4
- // Guard
5
- // ------------------------------------------------------------------
6
- /**
7
- * Returns true if the schema contains a valid contentMediaType property
8
- * @specification Json Schema 7
9
- */
10
- export function IsContentMediaType(schema) {
11
- return Guard.HasPropertyKey(schema, 'contentMediaType')
12
- && Guard.IsString(schema.contentMediaType);
13
- }