@openclaw/firecrawl-plugin 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/api.js +12 -11
- package/dist/{firecrawl-client-mz7GIgb4.js → firecrawl-client-BPFpIblh.js} +15 -22
- package/dist/{firecrawl-fetch-provider-shared-DlD5WG_i.js → firecrawl-fetch-provider-CIpxLKLq.js} +36 -1
- package/dist/{firecrawl-free-search-provider-BnGTMs5x.js → firecrawl-free-search-provider-BEyEhOfR.js} +3 -7
- package/dist/index.js +3 -3
- package/dist/web-fetch-contract-api.js +2 -11
- package/dist/web-fetch-provider.js +1 -1
- package/dist/web-search-contract-api.js +2 -15
- package/dist/web-search-provider.js +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/package.json +5 -5
- package/dist/firecrawl-fetch-provider-kMXMNJJw.js +0 -38
- 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;
|