@openclaw/whatsapp 2026.9.4 → 2026.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/activity.svg +40 -0
- package/assets/icon.png +0 -0
- package/dist/{accounts-CiKHiuEe.js → .setup/accounts-D_NGDjCx.mjs} +2 -2
- package/dist/{action-runtime-CRZLhN3f.js → .setup/action-runtime-DZZFamfl.mjs} +3 -3
- package/dist/{active-listener-BEjWsCNM.js → .setup/active-listener-CDjoX9QR.mjs} +2 -2
- package/dist/{agent-tools-login-B-2qZPzc.js → .setup/agent-tools-login-B6MAs75N.mjs} +2 -2
- package/dist/{approval-handler.runtime-DGJEaoqh.js → .setup/approval-handler.runtime-C0hzmMSj.mjs} +12 -12
- package/dist/{approval-reactions-DSFH6Mtx.js → .setup/approval-reactions-BnXw-UZI.mjs} +13 -13
- package/dist/{auth-store-ZWaclAbd.js → .setup/auth-store-Dh8a3cba.mjs} +5 -5
- package/dist/{channel-CzEIEZqG.js → .setup/channel-CSclZYjU.mjs} +20 -29
- package/dist/{channel-react-action-CHeJSG9F.js → .setup/channel-react-action-1iBiEnq7.mjs} +5 -5
- package/dist/.setup/channel.runtime-ddGY37w8.mjs +16 -0
- package/dist/.setup/channel.setup-CqUl8COe.mjs +5 -0
- package/dist/{connection-controller-DNp6U1NN.js → .setup/connection-controller-C60mU7j7.mjs} +5 -5
- package/dist/{connection-controller-runtime-context-DG0tuYuw.js → .setup/connection-controller-runtime-context-hgLJoRc8.mjs} +1 -1
- package/dist/{directory-config-CoWFw1zn.js → .setup/directory-config-BHPoBklt.mjs} +8 -8
- package/dist/{group-session-key-BmVDSPr1.js → .setup/group-session-key-D22hYMdE.mjs} +5 -5
- package/dist/.setup/legacy-session-surface-api-B2szjq4r.mjs +2 -0
- package/dist/{login-6j2iP9nR.js → .setup/login-2dmd1TfE.mjs} +5 -5
- package/dist/{login-qr-DRFgI6k1.js → .setup/login-qr-CgKtO_ef.mjs} +6 -6
- package/dist/{monitor-DaIAK4fT.js → .setup/monitor-BblvzLpX.mjs} +68 -65
- package/dist/.setup/normalize-DdsROMMa.mjs +2 -0
- package/dist/{normalize-target-CugRyONv.js → .setup/normalize-target-BGra1ZnM.mjs} +8 -30
- package/dist/{question-reactions-bbe0Qnjn.js → .setup/question-reactions-D3Zq9Gbn.mjs} +2 -2
- package/dist/{resolve-outbound-target-1GqbT1uX.js → .setup/resolve-outbound-target-C2eUvsTc.mjs} +1 -1
- package/dist/{send-BDDGPxav.js → .setup/send-C6jDmcL9.mjs} +7 -7
- package/dist/{send-api-C_Zn4Ij-.js → .setup/send-api-B4DOt2RJ.mjs} +7 -7
- package/dist/{session.runtime-Nsqaehbd.js → .setup/session.runtime-DcJuO42v.mjs} +1 -1
- package/dist/{setup-finalize-CZ6fHFFU.js → .setup/setup-finalize-BYEgU0hb.mjs} +6 -6
- package/dist/.setup/setup-plugin-api-CXfU-7vN.mjs +3 -0
- package/dist/{setup-surface-CnK_PPiA.js → .setup/setup-surface-Cd3wN5HD.mjs} +4 -4
- package/dist/{shared-CLKLJLgY.js → .setup/shared-C9OEtKgc.mjs} +47 -50
- package/dist/{socket-close-B3X9uerq.js → .setup/socket-close-CCVSFufF.mjs} +4 -4
- package/dist/{text-runtime-DyfmcATV.js → .setup/text-runtime-CHl0iPYe.mjs} +1 -1
- package/dist/action-runtime-api.js +1 -1
- package/dist/action-runtime.runtime.js +1 -1
- package/dist/agent-tools-api.js +4 -4
- package/dist/api.js +15 -15
- package/dist/auth-presence.js +1 -1
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/contract-api.js +5 -5
- package/dist/directory-contract-api.js +1 -1
- package/dist/doctor-contract-api.js +2 -2
- package/dist/legacy-session-surface-api.js +1 -1
- package/dist/light-runtime-api.js +4 -4
- package/dist/login-qr-runtime.js +1 -1
- package/dist/runtime-api.js +13 -13
- package/dist/runtime-setter-api.js +1 -1
- package/dist/security-contract-api.js +1 -1
- package/dist/setup-entry.js +3 -2
- package/dist/setup-plugin-api.js +1 -1
- package/node_modules/audio-decode/node_modules/@thi.ng/bitstream/README.md +1 -1
- package/node_modules/audio-decode/node_modules/@thi.ng/bitstream/package.json +5 -5
- package/node_modules/audio-decode/node_modules/@thi.ng/errors/README.md +1 -1
- package/node_modules/audio-decode/node_modules/@thi.ng/errors/package.json +5 -5
- package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/flac/dist/flac-decoder.min.js +1 -1
- package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/flac/dist/flac-decoder.min.js.map +1 -1
- package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/flac/package.json +1 -1
- package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/flac/src/FLACDecoder.js +6 -6
- package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/flac/src/FLACDecoderWebWorker.js +2 -2
- package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/dist/opus-ml-decoder.min.js +11603 -11540
- package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/dist/opus-ml-decoder.min.js.map +1 -1
- package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/package.json +1 -1
- package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/src/EmscriptenWasm.js +0 -0
- package/node_modules/audio-decode/node_modules/@wasm-audio-decoders/opus-ml/types.d.ts +1 -5
- package/node_modules/audio-decode/node_modules/audio-type/audio-type.js +156 -2
- package/node_modules/audio-decode/node_modules/audio-type/package.json +23 -2
- package/node_modules/audio-decode/node_modules/audio-type/readme.md +40 -2
- package/node_modules/audio-decode/node_modules/ogg-opus-decoder/README.md +1 -1
- package/node_modules/audio-decode/node_modules/ogg-opus-decoder/dist/ogg-opus-decoder.min.js +3 -3
- package/node_modules/audio-decode/node_modules/ogg-opus-decoder/dist/ogg-opus-decoder.min.js.map +1 -1
- package/node_modules/audio-decode/node_modules/ogg-opus-decoder/dist/ogg-opus-decoder.opus-ml.min.js +0 -0
- package/node_modules/audio-decode/node_modules/ogg-opus-decoder/dist/ogg-opus-decoder.opus-ml.min.js.map +1 -1
- package/node_modules/audio-decode/node_modules/ogg-opus-decoder/package.json +8 -8
- package/node_modules/audio-decode/node_modules/ogg-opus-decoder/src/OggOpusDecoder.js +1 -1
- package/node_modules/audio-decode/node_modules/opus-decoder/README.md +1 -1
- package/node_modules/audio-decode/node_modules/opus-decoder/dist/opus-decoder.min.js +3 -3
- package/node_modules/audio-decode/node_modules/opus-decoder/dist/opus-decoder.min.js.map +1 -1
- package/node_modules/audio-decode/node_modules/opus-decoder/package.json +1 -1
- package/node_modules/audio-decode/node_modules/opus-decoder/types.d.ts +1 -5
- package/node_modules/baileys/node_modules/protobufjs/README.md +24 -17
- package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.js +124 -14
- package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
- package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
- package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
- package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.js +63 -9
- package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.js.map +1 -1
- package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.min.js +3 -3
- package/node_modules/baileys/node_modules/protobufjs/dist/minimal/protobuf.min.js.map +1 -1
- package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.js +133 -18
- package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.js.map +1 -1
- package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.min.js +3 -3
- package/node_modules/baileys/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
- package/node_modules/baileys/node_modules/protobufjs/ext/descriptor.generated.d.ts +7 -0
- package/node_modules/baileys/node_modules/protobufjs/ext/descriptor.js +24 -0
- package/node_modules/baileys/node_modules/protobufjs/ext/protojson.js +14 -4
- package/node_modules/baileys/node_modules/protobufjs/ext/textformat.js +8 -4
- package/node_modules/baileys/node_modules/protobufjs/google/protobuf/descriptor.json +20 -1
- package/node_modules/baileys/node_modules/protobufjs/google/protobuf/descriptor.proto +14 -1
- package/node_modules/baileys/node_modules/protobufjs/index.d.ts +12 -0
- package/node_modules/baileys/node_modules/protobufjs/package.json +1 -1
- package/node_modules/baileys/node_modules/protobufjs/src/decoder.js +31 -2
- package/node_modules/baileys/node_modules/protobufjs/src/enum.js +10 -0
- package/node_modules/baileys/node_modules/protobufjs/src/object.js +5 -2
- package/node_modules/baileys/node_modules/protobufjs/src/parse.js +9 -4
- package/node_modules/baileys/node_modules/protobufjs/src/reader.js +61 -7
- package/node_modules/baileys/node_modules/protobufjs/src/type.js +10 -0
- package/node_modules/baileys/node_modules/protobufjs/src/wrappers.js +5 -1
- package/node_modules/typebox/build/compile/validator.d.mts +1 -1
- package/node_modules/typebox/build/compile/validator.mjs +1 -1
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +7 -5
- package/node_modules/typebox/build/format/iri.mjs +5 -1
- package/node_modules/typebox/build/guard/emit.mjs +2 -4
- package/node_modules/typebox/build/guard/guard.mjs +6 -18
- package/node_modules/typebox/build/guard/string.mjs +16 -24
- package/node_modules/typebox/build/schema/build.mjs +2 -2
- package/node_modules/typebox/build/schema/check.mjs +1 -1
- package/node_modules/typebox/build/schema/compile.d.mts +3 -2
- package/node_modules/typebox/build/schema/compile.mjs +8 -8
- package/node_modules/typebox/build/schema/engine/_context.d.mts +6 -7
- package/node_modules/typebox/build/schema/engine/_context.mjs +23 -15
- package/node_modules/typebox/build/schema/engine/_functions.d.mts +2 -2
- package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/_reducer.d.mts +3 -3
- package/node_modules/typebox/build/schema/engine/_refine.d.mts +5 -5
- package/node_modules/typebox/build/schema/engine/_refine.mjs +4 -7
- package/node_modules/typebox/build/schema/engine/_stack.d.mts +34 -16
- package/node_modules/typebox/build/schema/engine/_stack.mjs +148 -104
- package/node_modules/typebox/build/schema/engine/additionalItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +8 -8
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +26 -18
- package/node_modules/typebox/build/schema/engine/allOf.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/allOf.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/anyOf.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/anyOf.mjs +5 -10
- package/node_modules/typebox/build/schema/engine/boolean.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/boolean.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/const.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/const.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/contains.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/contains.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/dependencies.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/dependencies.mjs +3 -6
- package/node_modules/typebox/build/schema/engine/dependentRequired.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/dependentRequired.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/dependentSchemas.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/dynamicRef.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/dynamicRef.mjs +11 -7
- package/node_modules/typebox/build/schema/engine/enum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/enum.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/exclusiveMaximum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/exclusiveMaximum.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/exclusiveMinimum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/exclusiveMinimum.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/format.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/format.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/if.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/if.mjs +7 -15
- package/node_modules/typebox/build/schema/engine/items.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/items.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/maxContains.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/maxItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maxItems.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/maxLength.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maxLength.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/maxProperties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maxProperties.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/maximum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maximum.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/minContains.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/minContains.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/minItems.d.mts +5 -5
- package/node_modules/typebox/build/schema/engine/minItems.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/minLength.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/minLength.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/minProperties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/minProperties.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/minimum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/minimum.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/multipleOf.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/multipleOf.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/not.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/not.mjs +4 -8
- package/node_modules/typebox/build/schema/engine/oneOf.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +6 -11
- package/node_modules/typebox/build/schema/engine/pattern.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -7
- package/node_modules/typebox/build/schema/engine/patternProperties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/prefixItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/prefixItems.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/properties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/properties.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/propertyNames.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/propertyNames.mjs +4 -10
- package/node_modules/typebox/build/schema/engine/recursiveRef.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/recursiveRef.mjs +11 -7
- package/node_modules/typebox/build/schema/engine/ref.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/ref.mjs +19 -15
- package/node_modules/typebox/build/schema/engine/required.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/required.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/schema.d.mts +7 -7
- package/node_modules/typebox/build/schema/engine/schema.mjs +137 -133
- package/node_modules/typebox/build/schema/engine/type.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/type.mjs +2 -6
- package/node_modules/typebox/build/schema/engine/unevaluatedItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +5 -9
- package/node_modules/typebox/build/schema/engine/unevaluatedProperties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +5 -9
- package/node_modules/typebox/build/schema/engine/uniqueItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/uniqueItems.mjs +2 -6
- package/node_modules/typebox/build/schema/errors.d.mts +2 -2
- package/node_modules/typebox/build/schema/errors.mjs +8 -14
- package/node_modules/typebox/build/schema/intern/index.d.mts +1 -0
- package/node_modules/typebox/build/schema/intern/index.mjs +1 -0
- package/node_modules/typebox/build/schema/intern/intern.d.mts +11 -0
- package/node_modules/typebox/build/schema/intern/intern.mjs +293 -0
- package/node_modules/typebox/build/schema/meta/draft_2019_09.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_2019_09.mjs +288 -0
- package/node_modules/typebox/build/schema/meta/draft_2020_12.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_2020_12.mjs +300 -0
- package/node_modules/typebox/build/schema/meta/draft_3.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_3.mjs +143 -0
- package/node_modules/typebox/build/schema/meta/draft_4.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_4.mjs +149 -0
- package/node_modules/typebox/build/schema/meta/draft_6.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_6.mjs +155 -0
- package/node_modules/typebox/build/schema/meta/draft_7.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/draft_7.mjs +172 -0
- package/node_modules/typebox/build/schema/meta/index.d.mts +2 -0
- package/node_modules/typebox/build/schema/meta/index.mjs +2 -0
- package/node_modules/typebox/build/schema/meta/meta.d.mts +9 -0
- package/node_modules/typebox/build/schema/meta/meta.mjs +15 -0
- package/node_modules/typebox/build/schema/meta/schema.d.mts +6 -0
- package/node_modules/typebox/build/schema/meta/schema.mjs +1 -0
- package/node_modules/typebox/build/schema/parse.d.mts +1 -0
- package/node_modules/typebox/build/schema/parse.mjs +10 -5
- package/node_modules/typebox/build/schema/resolve/resolve.d.mts +8 -3
- package/node_modules/typebox/build/schema/resolve/resolve.mjs +268 -139
- package/node_modules/typebox/build/schema/schema.d.mts +2 -0
- package/node_modules/typebox/build/schema/schema.mjs +2 -0
- package/node_modules/typebox/build/value/errors/errors.d.mts +2 -12
- package/node_modules/typebox/build/value/errors/errors.mjs +2 -7
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +59 -89
- package/openclaw.plugin.json +11 -2
- package/package.json +7 -5
- package/dist/channel.runtime-BFiZ9WhU.js +0 -55
- package/dist/channel.setup-gIWoRLzt.js +0 -14
- package/dist/normalize-C7Hkc_vE.js +0 -2
- /package/dist/{account-ids-CB5SOWjc.js → .setup/account-ids-CB5SOWjc.mjs} +0 -0
- /package/dist/{audio-preflight.runtime-C_glQhZY.js → .setup/audio-preflight.runtime-C_glQhZY.mjs} +0 -0
- /package/dist/{command-policy-BIOSHySD.js → .setup/command-policy-BIOSHySD.mjs} +0 -0
- /package/dist/{config-schema-BYA6e_Ii.js → .setup/config-schema-BYA6e_Ii.mjs} +0 -0
- /package/dist/{constants-C7m81BNe.js → .setup/constants-C7m81BNe.mjs} +0 -0
- /package/dist/{creds-files-Drg3usj1.js → .setup/creds-files-Drg3usj1.mjs} +0 -0
- /package/dist/{doctor-BPb-SjdE.js → .setup/doctor-BPb-SjdE.mjs} +0 -0
- /package/dist/{group-config-path-BGyzT9Lg.js → .setup/group-config-path-BGyzT9Lg.mjs} +0 -0
- /package/dist/{group-session-contract-DDnZSsJ1.js → .setup/group-session-contract-DDnZSsJ1.mjs} +0 -0
- /package/dist/{reply-resolver.runtime-Ded8D58Y.js → .setup/reply-resolver.runtime-Ded8D58Y.mjs} +0 -0
- /package/dist/{rolldown-runtime-D7D4PA-g.js → .setup/rolldown-runtime-D7D4PA-g.mjs} +0 -0
- /package/dist/{runtime-BLlToOi6.js → .setup/runtime-BLlToOi6.mjs} +0 -0
- /package/dist/{runtime-group-policy-DeSRFXEV.js → .setup/runtime-group-policy-DeSRFXEV.mjs} +0 -0
- /package/dist/{security-contract-nAzD945y.js → .setup/security-contract-nAzD945y.mjs} +0 -0
- /package/dist/{session-contract-DMTm6Q_L.js → .setup/session-contract-DMTm6Q_L.mjs} +0 -0
- /package/dist/{session-errors-JuazczrA.js → .setup/session-errors-JuazczrA.mjs} +0 -0
- /package/dist/{targets-runtime-RBjx3pg_.js → .setup/targets-runtime-RBjx3pg_.mjs} +0 -0
|
@@ -1,50 +1,84 @@
|
|
|
1
|
-
// deno-fmt-ignore-file
|
|
2
1
|
import { Guard } from '../../guard/index.mjs';
|
|
3
2
|
import { Pointer } from '../pointer/index.mjs';
|
|
4
3
|
import * as Schema from '../types/index.mjs';
|
|
4
|
+
import * as Stack from '../engine/_stack.mjs';
|
|
5
5
|
// ------------------------------------------------------------------
|
|
6
|
-
//
|
|
6
|
+
// Helpers
|
|
7
|
+
//
|
|
8
|
+
// Utilities to compute schema base URIs, normalize absolute URLs,
|
|
9
|
+
// strip URL fragments for canonical hrefs, find target base URIs,
|
|
10
|
+
// resolve $ref root schemas, and identify JSON pointers vs anchors.
|
|
7
11
|
// ------------------------------------------------------------------
|
|
8
|
-
|
|
12
|
+
function RelativeBase(schema, base) {
|
|
13
|
+
return Schema.IsSchemaObject(schema) && Schema.IsId(schema) ? Stack.NextUri(schema.$id, base.href) : base;
|
|
14
|
+
}
|
|
15
|
+
function AbsoluteBase(base) {
|
|
16
|
+
return Stack.NextUri(base, Stack.DefaultUri);
|
|
17
|
+
}
|
|
18
|
+
function CanonicalHref(url) {
|
|
19
|
+
return url.href.split('#')[0];
|
|
20
|
+
}
|
|
21
|
+
function Base(schema, base, target) {
|
|
22
|
+
return SearchBase(schema, AbsoluteBase(base), target);
|
|
23
|
+
}
|
|
24
|
+
function RefRoot(stack, ref) {
|
|
25
|
+
return (ref.$ref.startsWith('#') || stack.enteredResource) ? stack.lexicalSchema : stack.schema;
|
|
26
|
+
}
|
|
27
|
+
function IsPointerFragment(fragment) {
|
|
28
|
+
return fragment.startsWith('#/');
|
|
29
|
+
}
|
|
9
30
|
// ------------------------------------------------------------------
|
|
10
|
-
//
|
|
31
|
+
// Search
|
|
32
|
+
//
|
|
33
|
+
// Recursive tree walks that locate things by identity, not URL.
|
|
34
|
+
// SearchDynamicAnchor finds a node with a matching $dynamicAnchor.
|
|
35
|
+
// SearchBase finds a specific target schema (by reference) and
|
|
36
|
+
// returns its base URI, tracking $id rebasing as it descends.
|
|
11
37
|
// ------------------------------------------------------------------
|
|
12
|
-
function
|
|
13
|
-
if (schema
|
|
38
|
+
function SearchDynamicAnchor(schema, name) {
|
|
39
|
+
if (Guard.IsObject(schema) && Schema.IsDynamicAnchor(schema) && Guard.IsEqual(schema.$dynamicAnchor, name)) {
|
|
14
40
|
return schema;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
41
|
+
}
|
|
42
|
+
if (Guard.IsObject(schema)) {
|
|
43
|
+
for (const key of Guard.Keys(schema)) {
|
|
44
|
+
const result = SearchDynamicAnchor(schema[key], name);
|
|
45
|
+
if (result)
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
19
48
|
}
|
|
20
49
|
return undefined;
|
|
21
50
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
51
|
+
function SearchBase(schema, base, target) {
|
|
52
|
+
if (Guard.IsEqual(schema, target))
|
|
53
|
+
return base.href;
|
|
54
|
+
const nextBase = RelativeBase(schema, base);
|
|
55
|
+
if (Guard.IsArray(schema)) {
|
|
56
|
+
for (const item of schema) {
|
|
57
|
+
const result = SearchBase(item, nextBase, target);
|
|
58
|
+
if (!Guard.IsUndefined(result))
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else if (Guard.IsObject(schema)) {
|
|
63
|
+
for (const key of Guard.Keys(schema)) {
|
|
64
|
+
const result = SearchBase(schema[key], nextBase, target);
|
|
65
|
+
if (!Guard.IsUndefined(result))
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return undefined;
|
|
37
70
|
}
|
|
38
71
|
// ------------------------------------------------------------------
|
|
39
|
-
// Match
|
|
40
|
-
//
|
|
41
|
-
// Resolves JSON Pointer fragments only. Plain anchor-style fragments
|
|
42
|
-
// (no leading '/') are handled exclusively by MatchAnchor and
|
|
43
|
-
// MatchDynamicAnchor to prevent accidentally resolving an anchor name
|
|
44
|
-
// as a pointer into the schema tree.
|
|
72
|
+
// Match
|
|
45
73
|
//
|
|
74
|
+
// Tests whether a schema node is what a reference URL points to.
|
|
75
|
+
// MatchSchemaObject checks a single node in order: $id, $anchor,
|
|
76
|
+
// $dynamicAnchor, then JSON pointer/hash. MatchFromArray,
|
|
77
|
+
// MatchFromObject, and Match recurse through the tree to try every
|
|
78
|
+
// node, skipping const and enum since their values are user data,
|
|
79
|
+
// not schema.
|
|
46
80
|
// ------------------------------------------------------------------
|
|
47
|
-
function
|
|
81
|
+
function MatchWithHash(schema, ref) {
|
|
48
82
|
if (ref.href.endsWith('#'))
|
|
49
83
|
return schema;
|
|
50
84
|
if (!ref.hash.startsWith('#'))
|
|
@@ -54,149 +88,244 @@ function MatchHash(schema, _base, ref) {
|
|
|
54
88
|
return undefined;
|
|
55
89
|
return Pointer.Get(schema, fragment);
|
|
56
90
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if (Schema.IsAnchor(schema)) {
|
|
67
|
-
const result = MatchAnchor(schema, base, ref);
|
|
68
|
-
if (!Guard.IsUndefined(result))
|
|
69
|
-
return result;
|
|
70
|
-
}
|
|
71
|
-
if (Schema.IsDynamicAnchor(schema)) {
|
|
72
|
-
const result = MatchDynamicAnchor(schema, base, ref);
|
|
73
|
-
if (!Guard.IsUndefined(result))
|
|
74
|
-
return result;
|
|
75
|
-
}
|
|
76
|
-
return MatchHash(schema, base, ref);
|
|
91
|
+
function MatchWithId(schema, base, ref) {
|
|
92
|
+
if (!Schema.IsId(schema))
|
|
93
|
+
return undefined;
|
|
94
|
+
if (Guard.IsEqual(schema.$id, ref.hash))
|
|
95
|
+
return schema;
|
|
96
|
+
const absoluteRef = new URL(ref.href, base.href);
|
|
97
|
+
if (Guard.IsEqual(base.pathname, absoluteRef.pathname))
|
|
98
|
+
return ref.hash.startsWith('#') ? MatchWithHash(schema, ref) : schema;
|
|
99
|
+
return undefined;
|
|
77
100
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
101
|
+
function MatchWithAnchor(schema, base, ref) {
|
|
102
|
+
if (!Schema.IsAnchor(schema))
|
|
103
|
+
return undefined;
|
|
104
|
+
const absoluteAnchor = new URL(`#${schema.$anchor}`, base.href);
|
|
105
|
+
const absoluteRef = new URL(ref.href, base.href);
|
|
106
|
+
return Guard.IsEqual(absoluteAnchor.href, absoluteRef.href) ? schema : undefined;
|
|
107
|
+
}
|
|
108
|
+
function MatchWithDynamicAnchor(schema, base, ref) {
|
|
109
|
+
if (!Schema.IsDynamicAnchor(schema))
|
|
110
|
+
return undefined;
|
|
111
|
+
const absoluteAnchor = new URL(`#${schema.$dynamicAnchor}`, base.href);
|
|
112
|
+
const absoluteRef = new URL(ref.href, base.href);
|
|
113
|
+
const isMatch = Guard.IsEqual(absoluteAnchor.href, absoluteRef.href);
|
|
114
|
+
return isMatch ? schema : undefined;
|
|
115
|
+
}
|
|
116
|
+
function MatchSchemaObject(schema, base, ref) {
|
|
117
|
+
if (!Schema.IsSchemaObject(schema))
|
|
118
|
+
return undefined;
|
|
119
|
+
return MatchWithId(schema, base, ref) ??
|
|
120
|
+
MatchWithAnchor(schema, base, ref) ??
|
|
121
|
+
MatchWithDynamicAnchor(schema, base, ref) ??
|
|
122
|
+
MatchWithHash(schema, ref);
|
|
123
|
+
}
|
|
124
|
+
function MatchFromArray(schema, base, ref) {
|
|
125
|
+
if (!Guard.IsArray(schema))
|
|
126
|
+
return undefined;
|
|
82
127
|
return schema.reduce((result, item) => {
|
|
83
|
-
const match =
|
|
128
|
+
const match = Match(item, base, ref);
|
|
84
129
|
return !Guard.IsUndefined(match) ? match : result;
|
|
85
130
|
}, undefined);
|
|
86
131
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
function SkipProperty(key) {
|
|
91
|
-
// these are explicit data encoded in a schema, they should not
|
|
92
|
-
// be considered valid targets used for de-referencing.
|
|
93
|
-
return Guard.IsEqual(key, 'const') || Guard.IsEqual(key, 'enum');
|
|
94
|
-
}
|
|
95
|
-
function FromObject(schema, base, ref) {
|
|
132
|
+
function MatchFromObject(schema, base, ref) {
|
|
133
|
+
if (!Guard.IsObject(schema))
|
|
134
|
+
return undefined;
|
|
96
135
|
return Guard.Keys(schema).reduce((result, key) => {
|
|
97
|
-
if (
|
|
136
|
+
if (Guard.IsEqual(key, 'const') || Guard.IsEqual(key, 'enum'))
|
|
98
137
|
return result;
|
|
99
|
-
const match =
|
|
138
|
+
const match = Match(schema[key], base, ref);
|
|
100
139
|
return !Guard.IsUndefined(match) ? match : result;
|
|
101
140
|
}, undefined);
|
|
102
141
|
}
|
|
142
|
+
function Match(schema, base, ref) {
|
|
143
|
+
const relativeBase = RelativeBase(schema, base);
|
|
144
|
+
return MatchSchemaObject(schema, relativeBase, ref) ??
|
|
145
|
+
MatchFromArray(schema, relativeBase, ref) ??
|
|
146
|
+
MatchFromObject(schema, relativeBase, ref);
|
|
147
|
+
}
|
|
103
148
|
// ------------------------------------------------------------------
|
|
104
|
-
//
|
|
149
|
+
// Resource
|
|
150
|
+
//
|
|
151
|
+
// Wraps RefInternal to check whether the resolved schema is itself
|
|
152
|
+
// a resource root (carries its own $id). Used by FindResolvedResource
|
|
153
|
+
// to tell a boundary hit from a landing inside a resource.
|
|
105
154
|
// ------------------------------------------------------------------
|
|
106
|
-
function
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
: base;
|
|
110
|
-
if (Schema.IsSchemaObject(schema)) {
|
|
111
|
-
const result = Match(schema, nextBase, ref);
|
|
112
|
-
if (!Guard.IsUndefined(result))
|
|
113
|
-
return result;
|
|
114
|
-
}
|
|
115
|
-
if (Guard.IsArray(schema))
|
|
116
|
-
return FromArray(schema, nextBase, ref);
|
|
117
|
-
if (Guard.IsObject(schema))
|
|
118
|
-
return FromObject(schema, nextBase, ref);
|
|
119
|
-
return undefined;
|
|
155
|
+
function Resource(context, schema, base, ref) {
|
|
156
|
+
const result = RefInternal(context, schema, base, ref);
|
|
157
|
+
return Schema.IsSchemaObject(result) && Schema.IsId(result) ? result : undefined;
|
|
120
158
|
}
|
|
121
159
|
// ------------------------------------------------------------------
|
|
122
|
-
//
|
|
160
|
+
// FindDeferredResource
|
|
123
161
|
//
|
|
124
|
-
//
|
|
125
|
-
//
|
|
126
|
-
//
|
|
162
|
+
// Legacy Draft-4 schemas (no $schema keyword) treat a nested $id as
|
|
163
|
+
// an in-place base change, not a new resource. A local ('#...') ref
|
|
164
|
+
// landing at a different base than the current one needs a stack
|
|
165
|
+
// entry so later lookups use the right base.
|
|
127
166
|
// ------------------------------------------------------------------
|
|
128
|
-
function
|
|
129
|
-
|
|
167
|
+
function FindDeferredResourceLegacy(stack, ref, schema) {
|
|
168
|
+
if (!ref.$ref.startsWith('#'))
|
|
169
|
+
return undefined;
|
|
170
|
+
if (!Schema.IsSchemaObject(stack.schema) || Guard.HasPropertyKey(stack.schema, '$schema'))
|
|
171
|
+
return undefined;
|
|
172
|
+
const targetBase = Base(stack.lexicalSchema, stack.referenceBase, schema);
|
|
173
|
+
if (Guard.IsUndefined(targetBase) || Guard.IsEqual(targetBase, stack.referenceBase))
|
|
174
|
+
return undefined;
|
|
175
|
+
return { target: schema, base: targetBase, root: /* safe-object-root */ stack.lexicalSchema };
|
|
176
|
+
}
|
|
177
|
+
function FindDeferredResourceModern(stack, canonical, schema) {
|
|
178
|
+
const remoteRoot = stack.context[canonical];
|
|
179
|
+
if (!Schema.IsSchemaObject(remoteRoot))
|
|
180
|
+
return undefined;
|
|
181
|
+
return { target: schema, base: canonical, root: remoteRoot };
|
|
182
|
+
}
|
|
183
|
+
function FindDeferredResource(stack, ref, schema, canonical, isRemote) {
|
|
184
|
+
const remote = isRemote ? FindDeferredResourceModern(stack, canonical, schema) : undefined;
|
|
185
|
+
return Guard.IsUndefined(remote) ? FindDeferredResourceLegacy(stack, ref, schema) : remote;
|
|
130
186
|
}
|
|
131
187
|
// ------------------------------------------------------------------
|
|
132
|
-
//
|
|
188
|
+
// FindResolvedResource
|
|
133
189
|
//
|
|
134
|
-
//
|
|
135
|
-
//
|
|
190
|
+
// Handles a ref that crossed into a different resource but landed
|
|
191
|
+
// on a schema without that resource's $id (e.g. a pointer into the
|
|
192
|
+
// middle of a remote document). Enters the enclosing resource so
|
|
193
|
+
// lexical/base lookups behave as if traversal walked in from its top.
|
|
136
194
|
// ------------------------------------------------------------------
|
|
137
|
-
function
|
|
195
|
+
function FindResolvedResource(stack, canonical, schema) {
|
|
196
|
+
if (Schema.IsId(schema))
|
|
197
|
+
return undefined;
|
|
198
|
+
const resource = Resource(stack.context, /* safe-object-root */ stack.schema, stack.referenceBase, canonical);
|
|
199
|
+
if (!resource || stack.ids.includes(resource))
|
|
200
|
+
return undefined;
|
|
201
|
+
return { resource };
|
|
202
|
+
}
|
|
203
|
+
// ------------------------------------------------------------------
|
|
204
|
+
// RefInternal
|
|
205
|
+
//
|
|
206
|
+
// Shared lookup used by Ref, RecursiveRef, and DynamicRef. Tries,
|
|
207
|
+
// in order: exact match in the pre-registered context, then a local
|
|
208
|
+
// search within the given schema, then a search in a remote
|
|
209
|
+
// document. Returns just the schema; caller-specific bookkeeping
|
|
210
|
+
// (deferred/resolved resources) happens one level up.
|
|
211
|
+
// ------------------------------------------------------------------
|
|
212
|
+
function RefInternalWithContext(context, ref) {
|
|
138
213
|
return Guard.HasPropertyKey(context, ref) ? context[ref] : undefined;
|
|
139
214
|
}
|
|
215
|
+
function RefInternalWithLocal(schema, base, ref) {
|
|
216
|
+
return Match(schema, base, ref);
|
|
217
|
+
}
|
|
218
|
+
function RefInternalWithRemote(context, base, ref) {
|
|
219
|
+
const canonicalHref = CanonicalHref(ref);
|
|
220
|
+
if (!Guard.HasPropertyKey(context, canonicalHref) || Guard.IsEqual(canonicalHref, CanonicalHref(base)))
|
|
221
|
+
return undefined;
|
|
222
|
+
const remoteSchema = context[canonicalHref];
|
|
223
|
+
const remoteBase = RelativeBase(remoteSchema, new URL(canonicalHref));
|
|
224
|
+
return Guard.IsEqual(ref.hash, '') ? remoteSchema : Match(remoteSchema, remoteBase, ref);
|
|
225
|
+
}
|
|
226
|
+
function RefInternal(context, schema, base, ref) {
|
|
227
|
+
const absoluteBase = AbsoluteBase(base);
|
|
228
|
+
const target = Stack.NextUri(ref, absoluteBase.href);
|
|
229
|
+
return RefInternalWithContext(context, ref) ??
|
|
230
|
+
RefInternalWithLocal(schema, absoluteBase, target) ??
|
|
231
|
+
RefInternalWithRemote(context, absoluteBase, target);
|
|
232
|
+
}
|
|
140
233
|
// ------------------------------------------------------------------
|
|
141
|
-
//
|
|
234
|
+
// RefNextStack
|
|
142
235
|
//
|
|
143
|
-
//
|
|
144
|
-
//
|
|
145
|
-
//
|
|
236
|
+
// Computes the next stack state from any deferred or resolved
|
|
237
|
+
// resource found while following a $ref, carrying existing stack
|
|
238
|
+
// state forward rather than rebuilding it.
|
|
146
239
|
// ------------------------------------------------------------------
|
|
147
|
-
function
|
|
148
|
-
|
|
240
|
+
function RefNextStackDeferred(stack, deferredResource) {
|
|
241
|
+
if (!deferredResource)
|
|
242
|
+
return stack;
|
|
243
|
+
const resourceEntries = new Map(stack.resourceEntries);
|
|
244
|
+
resourceEntries.set(deferredResource.target, { base: deferredResource.base, root: deferredResource.root });
|
|
245
|
+
return { ...stack, resourceEntries };
|
|
246
|
+
}
|
|
247
|
+
function RefNextStackResolved(stack, resolvedResource) {
|
|
248
|
+
return resolvedResource ? Stack.NextStack(stack, resolvedResource.resource) : stack;
|
|
249
|
+
}
|
|
250
|
+
function RefNextStack(stack, pendingResource, deferredResource, resolvedResource) {
|
|
251
|
+
const withDeferred = RefNextStackDeferred({ ...stack, pendingResource }, deferredResource);
|
|
252
|
+
const withResolved = RefNextStackResolved(withDeferred, resolvedResource);
|
|
253
|
+
return withResolved;
|
|
149
254
|
}
|
|
150
255
|
// ------------------------------------------------------------------
|
|
151
|
-
//
|
|
256
|
+
// RefResult
|
|
152
257
|
//
|
|
153
|
-
//
|
|
154
|
-
//
|
|
155
|
-
//
|
|
258
|
+
// Builds the final XRefResult. RefResultFound gets the canonical
|
|
259
|
+
// URL, checks if it's remote from the current resource, and looks
|
|
260
|
+
// for a deferred or resolved resource crossing accordingly.
|
|
261
|
+
// RefResultNotFound just advances pendingResource if a schema was
|
|
262
|
+
// found without crossing into a resource.
|
|
156
263
|
// ------------------------------------------------------------------
|
|
157
|
-
function
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
return
|
|
264
|
+
function RefResultFound(stack, ref, schema) {
|
|
265
|
+
const canonical = CanonicalHref(Stack.NextUri(ref.$ref, stack.referenceBase));
|
|
266
|
+
const isRemote = !Guard.IsEqual(canonical, stack.resourceBase);
|
|
267
|
+
const deferredResource = FindDeferredResource(stack, ref, schema, canonical, isRemote);
|
|
268
|
+
const resolvedResource = isRemote ? FindResolvedResource(stack, canonical, schema) : undefined;
|
|
269
|
+
return { schema, stack: RefNextStack(stack, true, deferredResource, resolvedResource) };
|
|
270
|
+
}
|
|
271
|
+
function RefResultNotFound(stack, schema) {
|
|
272
|
+
return { schema, stack: RefNextStack(stack, !Guard.IsUndefined(schema)) };
|
|
166
273
|
}
|
|
167
274
|
// ------------------------------------------------------------------
|
|
168
275
|
// Ref
|
|
276
|
+
//
|
|
277
|
+
// Picks the root to resolve against, and returns a XRefResult
|
|
278
|
+
// containing the resolved schema and the next stack state for
|
|
279
|
+
// subsequent evaluation.
|
|
169
280
|
// ------------------------------------------------------------------
|
|
170
|
-
export function Ref(
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
return RefContext(context, ref) ?? RefLocal(schema, initialBase, initialRef) ?? RefRemote(context, initialBase, initialRef);
|
|
281
|
+
export function Ref(stack, ref) {
|
|
282
|
+
const schema = RefInternal(stack.context, RefRoot(stack, ref), stack.referenceBase, ref.$ref);
|
|
283
|
+
return Schema.IsSchemaObject(schema) ? RefResultFound(stack, ref, schema) : RefResultNotFound(stack, schema);
|
|
174
284
|
}
|
|
175
285
|
// ------------------------------------------------------------------
|
|
176
|
-
//
|
|
286
|
+
// RecursiveRef: Draft 2019-09
|
|
287
|
+
//
|
|
288
|
+
// If a $recursiveAnchor is active in scope, it's used as the root
|
|
289
|
+
// instead of the lexical schema, letting the ref bind to the
|
|
290
|
+
// outermost applicable schema rather than the innermost.
|
|
177
291
|
// ------------------------------------------------------------------
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
292
|
+
function IsRecursiveAnchorInScope(stack) {
|
|
293
|
+
return Schema.IsSchemaObject(stack.lexicalSchema) && Schema.IsRecursiveAnchorTrue(stack.lexicalSchema);
|
|
294
|
+
}
|
|
295
|
+
export function RecursiveRef(stack, recursiveRef) {
|
|
296
|
+
const schema = IsRecursiveAnchorInScope(stack) ? stack.recursiveAnchor : stack.lexicalSchema;
|
|
297
|
+
return RefInternal(stack.context, schema, stack.lexicalBase, recursiveRef.$recursiveRef);
|
|
298
|
+
}
|
|
299
|
+
// ------------------------------------------------------------------
|
|
300
|
+
// DynamicRef: Draft 2020-12
|
|
301
|
+
//
|
|
302
|
+
// FindScopedDynamicAnchor checks anchors tracked on the stack first,
|
|
303
|
+
// then falls back to a full tree search. If RefInternal finds a target
|
|
304
|
+
// directly, DynamicRefWhenFound only continues the scoped search when
|
|
305
|
+
// that target itself has a $dynamicAnchor. If RefInternal finds nothing,
|
|
306
|
+
// DynamicRefWhenNotFound goes straight to a scoped anchor search
|
|
307
|
+
// by name.
|
|
308
|
+
// ------------------------------------------------------------------
|
|
309
|
+
function DynamicRefFragment(stack, dynamicRef) {
|
|
310
|
+
return Stack.NextUri(dynamicRef.$dynamicRef, AbsoluteBase(stack.lexicalBase).href).hash;
|
|
311
|
+
}
|
|
312
|
+
function FindScopedDynamicAnchor(stack, name) {
|
|
313
|
+
return stack.dynamicAnchors.find((anchor) => Guard.IsEqual(anchor.$dynamicAnchor, name)) ?? SearchDynamicAnchor(stack.schema, name);
|
|
314
|
+
}
|
|
315
|
+
function DynamicRefWhenFound(stack, dynamicRef, fragmentTarget) {
|
|
188
316
|
if (!Schema.IsSchemaObject(fragmentTarget) || !Schema.IsDynamicAnchor(fragmentTarget))
|
|
189
317
|
return fragmentTarget;
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
//
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
const
|
|
201
|
-
|
|
318
|
+
const fragment = DynamicRefFragment(stack, dynamicRef);
|
|
319
|
+
return IsPointerFragment(fragment) ? fragmentTarget : FindScopedDynamicAnchor(stack, fragmentTarget.$dynamicAnchor);
|
|
320
|
+
}
|
|
321
|
+
function DynamicRefWhenNotFound(stack, dynamicRef) {
|
|
322
|
+
const fragment = DynamicRefFragment(stack, dynamicRef);
|
|
323
|
+
// (review): We never observe this condition, but should be able to reach here in coverage.
|
|
324
|
+
// if (IsPointerFragment(fragment) || !fragment.startsWith('#')) return undefined
|
|
325
|
+
return FindScopedDynamicAnchor(stack, decodeURIComponent(fragment.slice(1)));
|
|
326
|
+
}
|
|
327
|
+
export function DynamicRef(stack, dynamicRef) {
|
|
328
|
+
const fragmentRoot = dynamicRef.$dynamicRef.startsWith('#') ? stack.lexicalSchema : stack.schema;
|
|
329
|
+
const fragmentTarget = RefInternal(stack.context, fragmentRoot, stack.lexicalBase, dynamicRef.$dynamicRef);
|
|
330
|
+
return Guard.IsUndefined(fragmentTarget) ? DynamicRefWhenNotFound(stack, dynamicRef) : DynamicRefWhenFound(stack, dynamicRef, fragmentTarget);
|
|
202
331
|
}
|
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
import type { TProperties, TSchema } from '../../type/index.mjs';
|
|
2
2
|
import type { TLocalizedValidationError } from '../../error/index.mjs';
|
|
3
|
-
/**
|
|
4
|
-
* Performs an exhaustive Check on the specified value and reports any errors found.
|
|
5
|
-
* If no errors are found, an empty array is returned. Unlike Check, this function
|
|
6
|
-
* does not terminate at the first occurrence of an error. For best performance, call
|
|
7
|
-
* Check first and call Errors only if Check returns false.
|
|
8
|
-
*/
|
|
3
|
+
/** Returns an array of validation errors for the given value. */
|
|
9
4
|
export declare function Errors<Type extends TSchema>(type: Type, value: unknown): TLocalizedValidationError[];
|
|
10
|
-
/**
|
|
11
|
-
* Performs an exhaustive Check on the specified value and reports any errors found.
|
|
12
|
-
* If no errors are found, an empty array is returned. Unlike Check, this function
|
|
13
|
-
* does not terminate at the first occurrence of an error. For best performance, call
|
|
14
|
-
* Check first and call Errors only if Check returns false.
|
|
15
|
-
*/
|
|
5
|
+
/** Returns an array of validation errors for the given value. */
|
|
16
6
|
export declare function Errors<Context extends TProperties, Type extends TSchema>(context: Context, type: Type, value: unknown): TLocalizedValidationError[];
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
2
|
import { Arguments } from '../../system/arguments/index.mjs';
|
|
3
|
-
import { Errors as SchemaErrors
|
|
4
|
-
/**
|
|
5
|
-
* Performs an exhaustive Check on the specified value and reports any errors found.
|
|
6
|
-
* If no errors are found, an empty array is returned. Unlike Check, this function
|
|
7
|
-
* does not terminate at the first occurrence of an error. For best performance, call
|
|
8
|
-
* Check first and call Errors only if Check returns false.
|
|
9
|
-
*/
|
|
3
|
+
import { Errors as SchemaErrors } from '../../schema/index.mjs';
|
|
4
|
+
/** Returns an array of validation errors for the given value. */
|
|
10
5
|
export function Errors(...args) {
|
|
11
6
|
const [context, type, value] = Arguments.Match(args, {
|
|
12
7
|
3: (context, type, value) => [context, type, value],
|