@openclaw/whatsapp 2026.8.1-beta.3 → 2026.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{accounts-BX2fZUyR.js → accounts-CeKQbu_s.js} +9 -26
- package/dist/{action-runtime-pM-ExU0l.js → action-runtime-Bw0loEdy.js} +2 -2
- package/dist/action-runtime-api.js +1 -1
- package/dist/action-runtime.runtime.js +1 -1
- package/dist/{call-tool-api.js → agent-tools-api.js} +13 -6
- package/dist/{agent-tools-login-BjRpD-JQ.js → agent-tools-login-B-2qZPzc.js} +12 -3
- package/dist/api.js +10 -10
- package/dist/{approval-handler.runtime-CkMMvUjk.js → approval-handler.runtime-DeyPb57-.js} +3 -3
- package/dist/{approval-reactions-Jyr1JaAK.js → approval-reactions-DGDA6hQ7.js} +7 -5
- package/dist/{auth-store-CtpBqH5S.js → auth-store-DTj1H9pv.js} +5 -3
- package/dist/{channel-DRMYRfZ8.js → channel-DxMmDjqK.js} +26 -24
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-react-action-CstrR0CT.js → channel-react-action-BUp7Wbfr.js} +3 -3
- package/dist/{channel.runtime-X3JC2gaq.js → channel.runtime-BwSnyXRX.js} +4 -4
- package/dist/{channel.setup-DhBBhbQv.js → channel.setup-aOFLSQyw.js} +1 -1
- package/dist/{config-schema-BQP5YCeK.js → config-schema-BYA6e_Ii.js} +6 -4
- package/dist/{connection-controller-CIYuBJrs.js → connection-controller-BvkxsbWi.js} +2 -2
- package/dist/{constants-HU41RHGI.js → constants-C7m81BNe.js} +1 -1
- package/dist/{directory-config-P7_3U73Z.js → directory-config-LgxYJLWY.js} +3 -3
- package/dist/directory-contract-api.js +1 -1
- package/dist/{group-session-key-DmFc_Cqi.js → group-session-key-KUguLmSZ.js} +4 -4
- package/dist/index.js +4 -4
- package/dist/light-runtime-api.js +2 -2
- package/dist/{login-BkpKpndm.js → login-Bk_jiXKD.js} +6 -5
- package/dist/{login-qr-1dpv6jjT.js → login-qr-B3m61NqA.js} +43 -20
- package/dist/login-qr-runtime.js +1 -1
- package/dist/{monitor-IzwQKizW.js → monitor-CTsyo-HE.js} +185 -162
- package/dist/{question-reactions-D3eAeB0i.js → question-reactions-B9D6MHXZ.js} +1 -1
- package/dist/runtime-api.js +9 -9
- package/dist/{send-CwvTU4RI.js → send-DiPjiygK.js} +54 -29
- package/dist/{send-api-obOSm2cC.js → send-api-kFcuhSiY.js} +43 -41
- package/dist/{setup-finalize-n4K2I2gJ.js → setup-finalize-CqH5wTK5.js} +7 -6
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-Cwn3zyxK.js → setup-surface-Dm3T6S8t.js} +3 -3
- package/dist/{shared-wg42NKFB.js → shared-DDjonGys.js} +7 -6
- package/dist/{socket-close-2T0_jZTN.js → socket-close-CpkkJZCU.js} +9 -6
- package/dist/{targets-runtime-TMk0lGuy.js → targets-runtime-RBjx3pg_.js} +1 -2
- package/dist/{text-runtime-CaKLhowd.js → text-runtime-DyfmcATV.js} +1 -1
- package/node_modules/baileys/lib/Defaults/index.js +1 -1
- package/node_modules/baileys/lib/Socket/business.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/chats.d.ts +1 -0
- package/node_modules/baileys/lib/Socket/chats.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/chats.js +10 -5
- package/node_modules/baileys/lib/Socket/chats.js.map +1 -1
- package/node_modules/baileys/lib/Socket/communities.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/groups.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/index.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/messages-recv.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/messages-send.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/newsletter.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/socket.d.ts.map +1 -1
- package/node_modules/baileys/lib/Socket/socket.js +3 -0
- package/node_modules/baileys/lib/Socket/socket.js.map +1 -1
- package/node_modules/baileys/lib/Types/index.d.ts +1 -0
- package/node_modules/baileys/lib/Types/index.d.ts.map +1 -1
- package/node_modules/baileys/lib/Types/index.js.map +1 -1
- package/node_modules/baileys/lib/Utils/browser-utils.d.ts.map +1 -1
- package/node_modules/baileys/lib/Utils/browser-utils.js +1 -0
- package/node_modules/baileys/lib/Utils/browser-utils.js.map +1 -1
- package/node_modules/baileys/lib/Utils/generics.d.ts +1 -0
- package/node_modules/baileys/lib/Utils/generics.d.ts.map +1 -1
- package/node_modules/baileys/lib/Utils/generics.js +1 -1
- package/node_modules/baileys/lib/Utils/generics.js.map +1 -1
- package/node_modules/baileys/lib/Utils/tc-token-utils.d.ts.map +1 -1
- package/node_modules/baileys/lib/Utils/tc-token-utils.js +3 -2
- package/node_modules/baileys/lib/Utils/tc-token-utils.js.map +1 -1
- package/node_modules/baileys/lib/Utils/validate-connection.d.ts.map +1 -1
- package/node_modules/baileys/lib/Utils/validate-connection.js +9 -2
- package/node_modules/baileys/lib/Utils/validate-connection.js.map +1 -1
- package/node_modules/baileys/node_modules/content-type/README.md +2 -0
- package/node_modules/baileys/node_modules/content-type/dist/index.d.ts +20 -0
- package/node_modules/baileys/node_modules/content-type/dist/index.js +20 -14
- package/node_modules/baileys/node_modules/content-type/dist/index.js.map +1 -1
- package/node_modules/baileys/node_modules/content-type/package.json +1 -1
- package/node_modules/baileys/node_modules/file-type/package.json +1 -1
- package/node_modules/baileys/node_modules/file-type/readme.md +3 -0
- package/node_modules/baileys/node_modules/file-type/source/detectors/zip.js +6 -1
- package/node_modules/baileys/node_modules/file-type/source/index.d.ts +3 -0
- package/node_modules/baileys/node_modules/file-type/source/index.js +25 -13
- package/node_modules/baileys/node_modules/music-metadata/LICENSE.txt +9 -9
- package/node_modules/baileys/node_modules/music-metadata/README.md +878 -878
- package/node_modules/baileys/node_modules/music-metadata/lib/ParseError.d.ts +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/ParseError.js +1 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfObject.d.ts +1 -4
- package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfObject.js +66 -30
- package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfParser.d.ts +5 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/asf/AsfParser.js +94 -25
- package/node_modules/baileys/node_modules/music-metadata/lib/dsf/DsfChunk.js +2 -2
- package/node_modules/baileys/node_modules/music-metadata/lib/dsf/DsfParser.js +38 -13
- package/node_modules/baileys/node_modules/music-metadata/lib/mp4/AtomToken.js +2 -1
- package/node_modules/baileys/node_modules/music-metadata/lib/mp4/MP4Parser.js +34 -7
- package/node_modules/baileys/node_modules/music-metadata/lib/ogg/speex/SpeexStream.d.ts +7 -0
- package/node_modules/baileys/node_modules/music-metadata/lib/ogg/speex/SpeexStream.js +13 -0
- package/node_modules/baileys/node_modules/music-metadata/lib/riff/RiffChunk.js +1 -1
- package/node_modules/baileys/node_modules/music-metadata/package.json +156 -156
- package/node_modules/baileys/node_modules/process-warning/.github/dependabot.yml +42 -2
- package/node_modules/baileys/node_modules/process-warning/.github/workflows/ci.yml +12 -1
- package/node_modules/baileys/node_modules/process-warning/.github/workflows/lock-threads.yml +19 -0
- package/node_modules/baileys/node_modules/process-warning/LICENSE +1 -1
- package/node_modules/baileys/node_modules/process-warning/README.md +41 -2
- package/node_modules/baileys/node_modules/process-warning/index.js +85 -17
- package/node_modules/baileys/node_modules/process-warning/package.json +6 -7
- package/node_modules/baileys/node_modules/process-warning/test/emit-once-only.test.js +3 -3
- package/node_modules/baileys/node_modules/process-warning/test/emit-reset.test.js +4 -4
- package/node_modules/baileys/node_modules/process-warning/test/emit-unlimited.test.js +2 -2
- package/node_modules/baileys/node_modules/process-warning/test/spy-warning.test.js +143 -0
- package/node_modules/baileys/node_modules/process-warning/types/index.d.ts +15 -1
- package/node_modules/baileys/node_modules/process-warning/types/index.tst.ts +48 -0
- package/node_modules/baileys/node_modules/protobufjs/README.md +61 -84
- package/node_modules/baileys/node_modules/protobufjs/dist/light/protobuf.js +66 -45
- 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 +47 -40
- 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 +92 -68
- 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.js +26 -10
- package/node_modules/baileys/node_modules/protobufjs/index.d.ts +3 -0
- package/node_modules/baileys/node_modules/protobufjs/package.json +1 -1
- package/node_modules/baileys/node_modules/protobufjs/src/converter.js +5 -1
- package/node_modules/baileys/node_modules/protobufjs/src/enum.js +5 -2
- package/node_modules/baileys/node_modules/protobufjs/src/field.js +6 -1
- package/node_modules/baileys/node_modules/protobufjs/src/parse.js +26 -23
- package/node_modules/baileys/node_modules/protobufjs/src/reader.js +36 -9
- package/node_modules/baileys/node_modules/protobufjs/src/util/codegen.js +3 -1
- package/node_modules/baileys/node_modules/protobufjs/src/util/utf8.js +2 -28
- package/node_modules/baileys/node_modules/protobufjs/src/writer.js +7 -1
- package/node_modules/baileys/node_modules/ws/lib/permessage-deflate.js +3 -1
- package/node_modules/baileys/node_modules/ws/package.json +1 -1
- package/node_modules/baileys/package.json +1 -1
- package/node_modules/typebox/build/format/date.d.mts +1 -1
- package/node_modules/typebox/build/format/date.mjs +1 -1
- package/node_modules/typebox/build/format/date_time.d.mts +2 -2
- package/node_modules/typebox/build/format/date_time.mjs +3 -3
- package/node_modules/typebox/build/format/email.d.mts +1 -1
- package/node_modules/typebox/build/format/email.mjs +2 -2
- package/node_modules/typebox/build/format/hostname.mjs +2 -10
- package/node_modules/typebox/build/format/idn_email.d.mts +1 -1
- package/node_modules/typebox/build/format/idn_email.mjs +3 -3
- package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idn_hostname.mjs +3 -11
- package/node_modules/typebox/build/format/idna/format/bidi.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/bidi.mjs +98 -0
- package/node_modules/typebox/build/format/idna/format/puny.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/puny.mjs +144 -0
- package/node_modules/typebox/build/format/idna/hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/hostname.mjs +16 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +41 -0
- package/node_modules/typebox/build/format/idna/index.d.mts +2 -0
- package/node_modules/typebox/build/format/idna/index.mjs +2 -0
- package/node_modules/typebox/build/format/idna/label/ascii.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/ascii.mjs +9 -0
- package/node_modules/typebox/build/format/idna/label/puny.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/puny.mjs +28 -0
- package/node_modules/typebox/build/format/idna/label/unicode.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/unicode.mjs +106 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.d.mts +30 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.mjs +70 -0
- package/node_modules/typebox/build/format/ipv4.d.mts +0 -1
- package/node_modules/typebox/build/format/ipv4.mjs +2 -32
- package/node_modules/typebox/build/format/ipv6.mjs +2 -61
- package/node_modules/typebox/build/format/iri.d.mts +2 -2
- package/node_modules/typebox/build/format/iri.mjs +26 -8
- package/node_modules/typebox/build/format/iri_reference.d.mts +2 -2
- package/node_modules/typebox/build/format/iri_reference.mjs +9 -55
- package/node_modules/typebox/build/format/regex.d.mts +1 -2
- package/node_modules/typebox/build/format/regex.mjs +2 -6
- package/node_modules/typebox/build/format/time.d.mts +2 -2
- package/node_modules/typebox/build/format/time.mjs +19 -14
- package/node_modules/typebox/build/format/uri.d.mts +1 -1
- package/node_modules/typebox/build/format/uri.mjs +3 -130
- package/node_modules/typebox/build/format/uri_reference.d.mts +1 -1
- package/node_modules/typebox/build/format/uri_reference.mjs +2 -3
- package/node_modules/typebox/build/format/uri_template.d.mts +2 -3
- package/node_modules/typebox/build/format/uri_template.mjs +4 -5
- package/node_modules/typebox/build/format/url.d.mts +3 -3
- package/node_modules/typebox/build/format/url.mjs +4 -5
- package/node_modules/typebox/build/guard/emit.d.mts +3 -1
- package/node_modules/typebox/build/guard/emit.mjs +12 -5
- package/node_modules/typebox/build/guard/guard.d.mts +8 -2
- package/node_modules/typebox/build/guard/guard.mjs +25 -4
- package/node_modules/typebox/build/guard/string.d.mts +2 -2
- package/node_modules/typebox/build/guard/string.mjs +7 -7
- package/node_modules/typebox/build/schema/engine/_context.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -2
- package/node_modules/typebox/build/schema/engine/_regexp.d.mts +2 -0
- package/node_modules/typebox/build/schema/engine/_regexp.mjs +4 -0
- package/node_modules/typebox/build/schema/engine/_stack.mjs +12 -13
- package/node_modules/typebox/build/schema/engine/additionalItems.mjs +17 -7
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/contains.mjs +18 -6
- package/node_modules/typebox/build/schema/engine/enum.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/items.mjs +26 -6
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/minContains.mjs +14 -4
- package/node_modules/typebox/build/schema/engine/not.mjs +4 -2
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +7 -6
- package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/ref.mjs +1 -7
- package/node_modules/typebox/build/schema/engine/schema.mjs +13 -4
- package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
- package/node_modules/typebox/build/schema/resolve/resolve.d.mts +4 -1
- package/node_modules/typebox/build/schema/resolve/resolve.mjs +202 -1
- package/node_modules/typebox/build/schema/static/propertyNames.d.mts +5 -0
- package/node_modules/typebox/build/schema/static/propertyNames.mjs +3 -0
- package/node_modules/typebox/build/schema/static/schema.d.mts +3 -0
- package/node_modules/typebox/build/schema/types/index.d.mts +0 -2
- package/node_modules/typebox/build/schema/types/index.mjs +0 -2
- package/node_modules/typebox/build/system/memory/clone.mjs +14 -11
- package/node_modules/typebox/build/system/memory/discard.mjs +6 -5
- package/node_modules/typebox/build/system/settings/settings.d.mts +9 -0
- package/node_modules/typebox/build/system/settings/settings.mjs +2 -0
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +6 -1
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +16 -3
- package/node_modules/typebox/build/type/engine/call/instantiate.mjs +34 -4
- package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +5 -5
- package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +20 -26
- package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +6 -10
- package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +9 -13
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +7 -4
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +12 -19
- package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +4 -20
- package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +8 -20
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +4 -4
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +11 -8
- package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +3 -4
- package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +17 -2
- package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +26 -6
- package/node_modules/typebox/build/type/engine/exclude/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/extract/operation.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/extract/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/priority/priority.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/priority/priority.mjs +3 -4
- package/node_modules/typebox/build/type/script/mapping.d.mts +32 -29
- package/node_modules/typebox/build/type/script/mapping.mjs +18 -25
- package/node_modules/typebox/build/type/script/parser.d.mts +19 -25
- package/node_modules/typebox/build/type/script/parser.mjs +27 -23
- package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
- package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
- package/node_modules/typebox/package.json +27 -27
- package/node_modules/typebox/readme.md +79 -82
- package/openclaw.plugin.json +2 -1
- package/package.json +6 -6
- package/node_modules/baileys/node_modules/process-warning/types/index.test-d.ts +0 -36
- package/node_modules/typebox/build/format/_idna.d.mts +0 -2
- package/node_modules/typebox/build/format/_idna.mjs +0 -246
- package/node_modules/typebox/build/format/_puny.d.mts +0 -1
- package/node_modules/typebox/build/format/_puny.mjs +0 -77
- package/node_modules/typebox/build/schema/resolve/ref.d.mts +0 -3
- package/node_modules/typebox/build/schema/resolve/ref.mjs +0 -146
- package/node_modules/typebox/build/schema/types/contentEncoding.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentEncoding.mjs +0 -13
- package/node_modules/typebox/build/schema/types/contentMediaType.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentMediaType.mjs +0 -13
|
@@ -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
|
|
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),
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
23
|
-
|
|
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 =
|
|
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 =
|
|
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(
|
|
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 =
|
|
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 =
|
|
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`;
|
|
@@ -12,13 +12,24 @@ function IsValid(schema) {
|
|
|
12
12
|
// ------------------------------------------------------------------
|
|
13
13
|
// Build
|
|
14
14
|
// ------------------------------------------------------------------
|
|
15
|
+
function BuildContainsStandard(stack, context, schema, value) {
|
|
16
|
+
const [item, index] = [Unique(), Unique()];
|
|
17
|
+
const isLength = E.Not(E.IsEqual(E.Member(value, 'length'), E.Constant(0)));
|
|
18
|
+
const isSome = E.SomeAll(value, [item, index], E.And(BuildSchema(stack, context, schema.contains, item), context.AddIndex(index)));
|
|
19
|
+
return E.And(isLength, isSome);
|
|
20
|
+
}
|
|
21
|
+
function BuildContainsFast(stack, context, schema, value) {
|
|
22
|
+
const [item] = [Unique()];
|
|
23
|
+
const isLength = E.Not(E.IsEqual(E.Member(value, 'length'), E.Constant(0)));
|
|
24
|
+
const isSome = E.Some(value, [item, '_'], BuildSchema(stack, context, schema.contains, item));
|
|
25
|
+
return E.And(isLength, isSome);
|
|
26
|
+
}
|
|
15
27
|
export function BuildContains(stack, context, schema, value) {
|
|
16
28
|
if (!IsValid(schema))
|
|
17
29
|
return E.Constant(true);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return E.And(isLength, isSome);
|
|
30
|
+
return context.UseUnevaluated()
|
|
31
|
+
? BuildContainsStandard(stack, context, schema, value)
|
|
32
|
+
: BuildContainsFast(stack, context, schema, value);
|
|
22
33
|
}
|
|
23
34
|
// ------------------------------------------------------------------
|
|
24
35
|
// Check
|
|
@@ -26,8 +37,9 @@ export function BuildContains(stack, context, schema, value) {
|
|
|
26
37
|
export function CheckContains(stack, context, schema, value) {
|
|
27
38
|
if (!IsValid(schema))
|
|
28
39
|
return true;
|
|
29
|
-
return !G.IsEqual(value.length, 0) &&
|
|
30
|
-
|
|
40
|
+
return !G.IsEqual(value.length, 0) && G.SomeAll(value, (item, index) => {
|
|
41
|
+
return CheckSchema(stack, context, schema.contains, item) && context.AddIndex(index);
|
|
42
|
+
});
|
|
31
43
|
}
|
|
32
44
|
// ------------------------------------------------------------------
|
|
33
45
|
// Error
|
|
@@ -16,7 +16,7 @@ export function BuildEnum(_stack, _context, schema, value) {
|
|
|
16
16
|
// Check
|
|
17
17
|
// ------------------------------------------------------------------
|
|
18
18
|
export function CheckEnum(_stack, _context, schema, value) {
|
|
19
|
-
return schema.enum
|
|
19
|
+
return G.Some(schema.enum, option => G.IsValueLike(option)
|
|
20
20
|
? G.IsEqual(value, option)
|
|
21
21
|
: G.IsDeepEqual(value, option));
|
|
22
22
|
}
|
|
@@ -5,15 +5,26 @@ import { BuildSchemaPushStack, CheckSchemaPushStack, ErrorSchemaPushStack } from
|
|
|
5
5
|
// ------------------------------------------------------------------
|
|
6
6
|
// ItemsSized
|
|
7
7
|
// ------------------------------------------------------------------
|
|
8
|
-
function
|
|
8
|
+
function BuildItemsSizedStandard(stack, context, schema, value) {
|
|
9
9
|
return E.ReduceAnd(schema.items.map((schema, index) => {
|
|
10
10
|
const isLength = E.IsLessEqualThan(E.Member(value, 'length'), E.Constant(index));
|
|
11
11
|
const isSchema = BuildSchemaPushStack(stack, context, schema, `${value}[${index}]`);
|
|
12
12
|
const addIndex = context.AddIndex(E.Constant(index));
|
|
13
|
-
|
|
14
|
-
return E.Or(isLength, guarded);
|
|
13
|
+
return E.Or(isLength, E.And(isSchema, addIndex));
|
|
15
14
|
}));
|
|
16
15
|
}
|
|
16
|
+
function BuildItemsSizedFast(stack, context, schema, value) {
|
|
17
|
+
return E.ReduceAnd(schema.items.map((schema, index) => {
|
|
18
|
+
const isLength = E.IsLessEqualThan(E.Member(value, 'length'), E.Constant(index));
|
|
19
|
+
const isSchema = BuildSchemaPushStack(stack, context, schema, `${value}[${index}]`);
|
|
20
|
+
return E.Or(isLength, isSchema);
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
function BuildItemsSized(stack, context, schema, value) {
|
|
24
|
+
return context.UseUnevaluated()
|
|
25
|
+
? BuildItemsSizedStandard(stack, context, schema, value)
|
|
26
|
+
: BuildItemsSizedFast(stack, context, schema, value);
|
|
27
|
+
}
|
|
17
28
|
function CheckItemsSized(stack, context, schema, value) {
|
|
18
29
|
return G.Every(schema.items, 0, (schema, index) => {
|
|
19
30
|
return G.IsLessEqualThan(value.length, index)
|
|
@@ -31,12 +42,21 @@ function ErrorItemsSized(stack, context, schemaPath, instancePath, schema, value
|
|
|
31
42
|
// ------------------------------------------------------------------
|
|
32
43
|
// ItemsUnsized
|
|
33
44
|
// ------------------------------------------------------------------
|
|
34
|
-
function
|
|
45
|
+
function BuildItemsUnsizedStandard(stack, context, schema, value) {
|
|
35
46
|
const offset = Schema.IsPrefixItems(schema) ? schema.prefixItems.length : 0;
|
|
36
47
|
const isSchema = BuildSchemaPushStack(stack, context, schema.items, 'element');
|
|
37
48
|
const addIndex = context.AddIndex('index');
|
|
38
|
-
|
|
39
|
-
|
|
49
|
+
return E.Every(value, E.Constant(offset), ['element', 'index'], E.And(isSchema, addIndex));
|
|
50
|
+
}
|
|
51
|
+
function BuildItemsUnsizedFast(stack, context, schema, value) {
|
|
52
|
+
const offset = Schema.IsPrefixItems(schema) ? schema.prefixItems.length : 0;
|
|
53
|
+
const isSchema = BuildSchemaPushStack(stack, context, schema.items, 'element');
|
|
54
|
+
return E.Every(value, E.Constant(offset), ['element', 'index'], isSchema);
|
|
55
|
+
}
|
|
56
|
+
function BuildItemsUnsized(stack, context, schema, value) {
|
|
57
|
+
return context.UseUnevaluated()
|
|
58
|
+
? BuildItemsUnsizedStandard(stack, context, schema, value)
|
|
59
|
+
: BuildItemsUnsizedFast(stack, context, schema, value);
|
|
40
60
|
}
|
|
41
61
|
function CheckItemsUnsized(stack, context, schema, value) {
|
|
42
62
|
const offset = Schema.IsPrefixItems(schema) ? schema.prefixItems.length : 0;
|
|
@@ -15,8 +15,8 @@ function IsValid(schema) {
|
|
|
15
15
|
export function BuildMaxContains(stack, context, schema, value) {
|
|
16
16
|
if (!IsValid(schema))
|
|
17
17
|
return E.Constant(true);
|
|
18
|
-
const [
|
|
19
|
-
const count = E.
|
|
18
|
+
const [item] = [Unique()];
|
|
19
|
+
const count = E.Counted(value, [item, '_'], BuildSchema(stack, context, schema.contains, item));
|
|
20
20
|
return E.IsLessEqualThan(count, E.Constant(schema.maxContains));
|
|
21
21
|
}
|
|
22
22
|
// ------------------------------------------------------------------
|
|
@@ -25,7 +25,7 @@ export function BuildMaxContains(stack, context, schema, value) {
|
|
|
25
25
|
export function CheckMaxContains(stack, context, schema, value) {
|
|
26
26
|
if (!IsValid(schema))
|
|
27
27
|
return true;
|
|
28
|
-
const count =
|
|
28
|
+
const count = G.Counted(value, (item) => CheckSchema(stack, context, schema.contains, item));
|
|
29
29
|
return G.IsLessEqualThan(count, schema.maxContains);
|
|
30
30
|
}
|
|
31
31
|
// ------------------------------------------------------------------
|
|
@@ -12,12 +12,22 @@ function IsValid(schema) {
|
|
|
12
12
|
// ------------------------------------------------------------------
|
|
13
13
|
// Build
|
|
14
14
|
// ------------------------------------------------------------------
|
|
15
|
+
function BuildMinContainsStandard(stack, context, schema, value) {
|
|
16
|
+
const [item, index] = [Unique(), Unique()];
|
|
17
|
+
const count = E.Counted(value, [item, index], E.And(BuildSchema(stack, context, schema.contains, item), context.AddIndex(index)));
|
|
18
|
+
return E.IsGreaterEqualThan(count, E.Constant(schema.minContains));
|
|
19
|
+
}
|
|
20
|
+
function BuildMinContainsFast(stack, context, schema, value) {
|
|
21
|
+
const [item] = [Unique()];
|
|
22
|
+
const count = E.Counted(value, [item, '_'], BuildSchema(stack, context, schema.contains, item));
|
|
23
|
+
return E.IsGreaterEqualThan(count, E.Constant(schema.minContains));
|
|
24
|
+
}
|
|
15
25
|
export function BuildMinContains(stack, context, schema, value) {
|
|
16
26
|
if (!IsValid(schema))
|
|
17
27
|
return E.Constant(true);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
28
|
+
return context.UseUnevaluated()
|
|
29
|
+
? BuildMinContainsStandard(stack, context, schema, value)
|
|
30
|
+
: BuildMinContainsFast(stack, context, schema, value);
|
|
21
31
|
}
|
|
22
32
|
// ------------------------------------------------------------------
|
|
23
33
|
// Check
|
|
@@ -25,7 +35,7 @@ export function BuildMinContains(stack, context, schema, value) {
|
|
|
25
35
|
export function CheckMinContains(stack, context, schema, value) {
|
|
26
36
|
if (!IsValid(schema))
|
|
27
37
|
return true;
|
|
28
|
-
const count =
|
|
38
|
+
const count = G.Counted(value, (item, index) => CheckSchema(stack, context, schema.contains, item) && context.AddIndex(index));
|
|
29
39
|
return G.IsGreaterEqualThan(count, schema.minContains);
|
|
30
40
|
}
|
|
31
41
|
// ------------------------------------------------------------------
|
|
@@ -6,14 +6,16 @@ import { BuildSchema, CheckSchema } from './schema.mjs';
|
|
|
6
6
|
// ------------------------------------------------------------------
|
|
7
7
|
// Build
|
|
8
8
|
// ------------------------------------------------------------------
|
|
9
|
-
function
|
|
9
|
+
function BuildNotStandard(stack, context, schema, value) {
|
|
10
10
|
return Reducer(stack, context, [schema.not], value, E.Not(E.IsEqual(E.Member('results', 'length'), E.Constant(1))));
|
|
11
11
|
}
|
|
12
12
|
function BuildNotFast(stack, context, schema, value) {
|
|
13
13
|
return E.Not(BuildSchema(stack, context, schema.not, value));
|
|
14
14
|
}
|
|
15
15
|
export function BuildNot(stack, context, schema, value) {
|
|
16
|
-
return context.UseUnevaluated()
|
|
16
|
+
return context.UseUnevaluated()
|
|
17
|
+
? BuildNotStandard(stack, context, schema, value)
|
|
18
|
+
: BuildNotFast(stack, context, schema, value);
|
|
17
19
|
}
|
|
18
20
|
// ------------------------------------------------------------------
|
|
19
21
|
// Check
|
|
@@ -3,22 +3,23 @@ import { CheckContext, AccumulatedErrorContext } from './_context.mjs';
|
|
|
3
3
|
import { Reducer } from './_reducer.mjs';
|
|
4
4
|
import { EmitGuard as E, Guard as G } from '../../guard/index.mjs';
|
|
5
5
|
import { BuildSchema, CheckSchema, ErrorSchema } from './schema.mjs';
|
|
6
|
+
import { Unique } from './_unique.mjs';
|
|
6
7
|
// ------------------------------------------------------------------
|
|
7
8
|
// Build
|
|
8
9
|
// ------------------------------------------------------------------
|
|
9
|
-
function
|
|
10
|
+
function BuildOneOfStandard(stack, context, schema, value) {
|
|
10
11
|
return Reducer(stack, context, schema.oneOf, value, E.IsEqual(E.Member('results', 'length'), E.Constant(1)));
|
|
11
12
|
}
|
|
12
13
|
function BuildOneOfFast(stack, context, schema, value) {
|
|
14
|
+
const [result] = [Unique()];
|
|
13
15
|
const results = E.ArrayLiteral(schema.oneOf.map((schema) => BuildSchema(stack, context, schema, value)));
|
|
14
|
-
const count = E.
|
|
15
|
-
E.ArrowFunction(['count', 'result'], E.Ternary(E.IsEqual('result', E.Constant(true)), E.PrefixIncrement('count'), 'count')),
|
|
16
|
-
E.Constant(0),
|
|
17
|
-
]);
|
|
16
|
+
const count = E.Counted(results, [result, '_'], E.IsEqual(result, E.Constant(true)));
|
|
18
17
|
return E.IsEqual(count, E.Constant(1));
|
|
19
18
|
}
|
|
20
19
|
export function BuildOneOf(stack, context, schema, value) {
|
|
21
|
-
return context.UseUnevaluated()
|
|
20
|
+
return context.UseUnevaluated()
|
|
21
|
+
? BuildOneOfStandard(stack, context, schema, value)
|
|
22
|
+
: BuildOneOfFast(stack, context, schema, value);
|
|
22
23
|
}
|
|
23
24
|
// ------------------------------------------------------------------
|
|
24
25
|
// Check
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
2
|
import * as Externals from './_externals.mjs';
|
|
3
3
|
import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
|
|
4
|
+
import { UnicodeRegExp } from './_regexp.mjs';
|
|
4
5
|
// ------------------------------------------------------------------
|
|
5
6
|
// Build
|
|
6
7
|
// ------------------------------------------------------------------
|
|
7
8
|
export function BuildPattern(_stack, _context, schema, value) {
|
|
8
|
-
const regexp = Externals.CreateVariable(G.IsString(schema.pattern) ?
|
|
9
|
+
const regexp = Externals.CreateVariable(G.IsString(schema.pattern) ? UnicodeRegExp(schema.pattern) : schema.pattern);
|
|
9
10
|
return E.Call(E.Member(regexp, 'test'), [value]);
|
|
10
11
|
}
|
|
11
12
|
// ------------------------------------------------------------------
|
|
12
13
|
// Check
|
|
13
14
|
// ------------------------------------------------------------------
|
|
14
15
|
export function CheckPattern(_stack, _context, schema, value) {
|
|
15
|
-
const regexp = G.IsString(schema.pattern) ?
|
|
16
|
+
const regexp = G.IsString(schema.pattern) ? UnicodeRegExp(schema.pattern) : schema.pattern;
|
|
16
17
|
return regexp.test(value);
|
|
17
18
|
}
|
|
18
19
|
// ------------------------------------------------------------------
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
2
|
import * as Externals from './_externals.mjs';
|
|
3
3
|
import { Unique } from './_unique.mjs';
|
|
4
|
+
import { UnicodeRegExp } from './_regexp.mjs';
|
|
4
5
|
import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
|
|
5
6
|
import { BuildSchemaPushStack, CheckSchemaPushStack, ErrorSchemaPushStack } from './schema.mjs';
|
|
6
7
|
// ------------------------------------------------------------------
|
|
@@ -9,7 +10,7 @@ import { BuildSchemaPushStack, CheckSchemaPushStack, ErrorSchemaPushStack } from
|
|
|
9
10
|
export function BuildPatternProperties(stack, context, schema, value) {
|
|
10
11
|
return E.ReduceAnd(G.Entries(schema.patternProperties).map(([pattern, schema]) => {
|
|
11
12
|
const [key, prop] = [Unique(), Unique()];
|
|
12
|
-
const regexp = Externals.CreateVariable(
|
|
13
|
+
const regexp = Externals.CreateVariable(UnicodeRegExp(pattern));
|
|
13
14
|
const notKey = E.Not(E.Call(E.Member(regexp, 'test'), [key]));
|
|
14
15
|
const isSchema = BuildSchemaPushStack(stack, context, schema, prop);
|
|
15
16
|
const addKey = context.AddKey(key);
|
|
@@ -22,7 +23,7 @@ export function BuildPatternProperties(stack, context, schema, value) {
|
|
|
22
23
|
// ------------------------------------------------------------------
|
|
23
24
|
export function CheckPatternProperties(stack, context, schema, value) {
|
|
24
25
|
return G.Every(G.Entries(schema.patternProperties), 0, ([pattern, schema]) => {
|
|
25
|
-
const regexp =
|
|
26
|
+
const regexp = UnicodeRegExp(pattern);
|
|
26
27
|
return G.Every(G.Entries(value), 0, ([key, prop]) => {
|
|
27
28
|
return !regexp.test(key) || CheckSchemaPushStack(stack, context, schema, prop) && context.AddKey(key);
|
|
28
29
|
});
|
|
@@ -34,7 +35,7 @@ export function CheckPatternProperties(stack, context, schema, value) {
|
|
|
34
35
|
export function ErrorPatternProperties(stack, context, schemaPath, instancePath, schema, value) {
|
|
35
36
|
return G.EveryAll(G.Entries(schema.patternProperties), 0, ([pattern, schema]) => {
|
|
36
37
|
const nextSchemaPath = `${schemaPath}/patternProperties/${pattern}`;
|
|
37
|
-
const regexp =
|
|
38
|
+
const regexp = UnicodeRegExp(pattern);
|
|
38
39
|
return G.EveryAll(G.Entries(value), 0, ([key, value]) => {
|
|
39
40
|
const nextInstancePath = `${instancePath}/${key}`;
|
|
40
41
|
const notKey = !regexp.test(key);
|
|
@@ -5,7 +5,7 @@ import { CheckContext, AccumulatedErrorContext } from './_context.mjs';
|
|
|
5
5
|
import { EmitGuard as E } from '../../guard/index.mjs';
|
|
6
6
|
import { CheckSchema, ErrorSchema } from './schema.mjs';
|
|
7
7
|
// ------------------------------------------------------------------
|
|
8
|
-
//
|
|
8
|
+
// BuildRef
|
|
9
9
|
// ------------------------------------------------------------------
|
|
10
10
|
function BuildRefStandard(stack, context, target, value) {
|
|
11
11
|
const interior = E.ArrowFunction(['context', 'value'], Functions.CreateFunction(stack, context, target, 'value'));
|
|
@@ -17,15 +17,9 @@ function BuildRefStandard(stack, context, target, value) {
|
|
|
17
17
|
]));
|
|
18
18
|
return E.Call(exterior, ['context', value]);
|
|
19
19
|
}
|
|
20
|
-
// ------------------------------------------------------------------
|
|
21
|
-
// BuildRefStandard
|
|
22
|
-
// ------------------------------------------------------------------
|
|
23
20
|
function BuildRefFast(stack, context, target, value) {
|
|
24
21
|
return Functions.CreateFunction(stack, context, target, value);
|
|
25
22
|
}
|
|
26
|
-
// ------------------------------------------------------------------
|
|
27
|
-
// BuildRef
|
|
28
|
-
// ------------------------------------------------------------------
|
|
29
23
|
export function BuildRef(stack, context, schema, value) {
|
|
30
24
|
const target = stack.Ref(schema) ?? false;
|
|
31
25
|
return context.UseUnevaluated()
|
|
@@ -45,12 +45,21 @@ import { BuildUnevaluatedItems, CheckUnevaluatedItems, ErrorUnevaluatedItems } f
|
|
|
45
45
|
import { BuildUnevaluatedProperties, CheckUnevaluatedProperties, ErrorUnevaluatedProperties } from './unevaluatedProperties.mjs';
|
|
46
46
|
import { BuildUniqueItems, CheckUniqueItems, ErrorUniqueItems } from './uniqueItems.mjs';
|
|
47
47
|
// ----------------------------------------------------------------
|
|
48
|
-
// HasTypeName
|
|
48
|
+
// HasTypeName (Optimization)
|
|
49
|
+
//
|
|
50
|
+
// We only consider a schema as having a type name when the schema
|
|
51
|
+
// has a single type string, or when every element in the type
|
|
52
|
+
// array is the same. For a type array, we must treat multi-variant
|
|
53
|
+
// types as unions and therefore can NOT use an optimized forward
|
|
54
|
+
// type check.
|
|
55
|
+
//
|
|
49
56
|
// ----------------------------------------------------------------
|
|
50
57
|
function HasTypeName(schema, typename) {
|
|
51
|
-
return Schema.IsType(schema) &&
|
|
52
|
-
(G.IsArray(schema.type) &&
|
|
53
|
-
G.
|
|
58
|
+
return (Schema.IsType(schema) &&
|
|
59
|
+
((G.IsArray(schema.type) &&
|
|
60
|
+
G.IsGreaterThan(schema.type.length, 0) &&
|
|
61
|
+
G.Every(schema.type, 0, type => G.IsEqual(type, typename))) ||
|
|
62
|
+
G.IsEqual(schema.type, typename)));
|
|
54
63
|
}
|
|
55
64
|
// ----------------------------------------------------------------
|
|
56
65
|
// HasObject
|
|
@@ -48,7 +48,7 @@ function BuildTypeNames(stack, context, typenames, value) {
|
|
|
48
48
|
return E.ReduceOr(typenames.map(type => BuildTypeName(stack, context, type, value)));
|
|
49
49
|
}
|
|
50
50
|
function CheckTypeNames(stack, context, types, schema, value) {
|
|
51
|
-
return
|
|
51
|
+
return G.Some(types, type => CheckTypeName(stack, context, type, schema, value));
|
|
52
52
|
}
|
|
53
53
|
// ------------------------------------------------------------------
|
|
54
54
|
// Type
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import * as Schema from '../types/index.mjs';
|
|
2
|
+
export declare const DefaultBase: URL;
|
|
3
|
+
export declare function Ref(context: Record<string, Schema.XSchema>, schema: Schema.XSchemaObject, ref: string): Schema.XSchema | undefined;
|
|
4
|
+
export declare function DynamicRef(context: Record<string, Schema.XSchema>, root: Schema.XSchemaObject, base: Schema.XSchemaObject, dynamicRef: Schema.XDynamicRef, dynamicAnchors: Schema.XDynamicAnchor[]): Schema.XSchema | undefined;
|