@hyperjump/json-schema 0.23.1 → 0.23.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/json-schema-amd.js +516 -1632
- package/dist/json-schema-amd.js.map +1 -1
- package/dist/json-schema-amd.min.js +2 -2
- package/dist/json-schema-amd.min.js.map +1 -1
- package/dist/json-schema-cjs.js +516 -1632
- package/dist/json-schema-cjs.js.map +1 -1
- package/dist/json-schema-cjs.min.js +2 -2
- package/dist/json-schema-cjs.min.js.map +1 -1
- package/dist/json-schema-esm.js +516 -1632
- package/dist/json-schema-esm.js.map +1 -1
- package/dist/json-schema-esm.min.js +2 -2
- package/dist/json-schema-esm.min.js.map +1 -1
- package/dist/json-schema-iife.js +516 -1632
- package/dist/json-schema-iife.js.map +1 -1
- package/dist/json-schema-iife.min.js +2 -2
- package/dist/json-schema-iife.min.js.map +1 -1
- package/dist/json-schema-system.js +516 -1632
- package/dist/json-schema-system.js.map +1 -1
- package/dist/json-schema-system.min.js +2 -2
- package/dist/json-schema-system.min.js.map +1 -1
- package/dist/json-schema-umd.js +516 -1632
- package/dist/json-schema-umd.js.map +1 -1
- package/dist/json-schema-umd.min.js +2 -2
- package/dist/json-schema-umd.min.js.map +1 -1
- package/lib/draft-06.js +2 -2
- package/lib/draft-07.js +2 -2
- package/lib/draft-2019-09.js +2 -2
- package/lib/draft-2020-12.js +2 -2
- package/lib/keywords/index.js +0 -2
- package/lib/keywords/maxLength.js +1 -1
- package/lib/keywords/minLength.js +1 -1
- package/package.json +1 -1
- package/lib/keywords/maxLength6.js +0 -7
- package/lib/keywords/minLength6.js +0 -7
package/dist/json-schema-esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
2
2
|
|
|
3
|
-
var justCurryIt$
|
|
3
|
+
var justCurryIt$1 = curry$b;
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
6
|
function add(a, b, c) {
|
|
@@ -25,7 +25,7 @@ var justCurryIt$2 = curry$j;
|
|
|
25
25
|
milesToKm(10); // 16.2
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
|
-
function curry$
|
|
28
|
+
function curry$b(fn, arity) {
|
|
29
29
|
return function curried() {
|
|
30
30
|
if (arity == null) {
|
|
31
31
|
arity = fn.length;
|
|
@@ -1896,84 +1896,91 @@ const pathRelative$1 = (from, to) => {
|
|
|
1896
1896
|
|
|
1897
1897
|
var common$1 = { jsonTypeOf: jsonTypeOf$2, resolveUrl: resolveUrl$3, urlFragment: urlFragment$1, pathRelative: pathRelative$1 };
|
|
1898
1898
|
|
|
1899
|
-
const curry$
|
|
1899
|
+
const curry$a = justCurryIt$1;
|
|
1900
1900
|
|
|
1901
1901
|
|
|
1902
|
-
const nil$
|
|
1902
|
+
const nil$2 = "";
|
|
1903
1903
|
|
|
1904
|
-
const compile$
|
|
1904
|
+
const compile$N = (pointer) => {
|
|
1905
1905
|
if (pointer.length > 0 && pointer[0] !== "/") {
|
|
1906
1906
|
throw Error("Invalid JSON Pointer");
|
|
1907
1907
|
}
|
|
1908
1908
|
|
|
1909
|
-
return pointer.split("/").slice(1).map(unescape
|
|
1909
|
+
return pointer.split("/").slice(1).map(unescape);
|
|
1910
1910
|
};
|
|
1911
1911
|
|
|
1912
|
-
const get$
|
|
1913
|
-
const ptr = compile$
|
|
1912
|
+
const get$2 = (pointer, value = undefined) => {
|
|
1913
|
+
const ptr = compile$N(pointer);
|
|
1914
1914
|
|
|
1915
1915
|
const fn = (value) => ptr.reduce(([value, pointer], segment) => {
|
|
1916
|
-
return [applySegment
|
|
1916
|
+
return [applySegment(value, segment, pointer), append(segment, pointer)];
|
|
1917
1917
|
}, [value, ""])[0];
|
|
1918
1918
|
|
|
1919
1919
|
return value === undefined ? fn : fn(value);
|
|
1920
1920
|
};
|
|
1921
1921
|
|
|
1922
|
-
const set
|
|
1923
|
-
const ptr = compile$
|
|
1924
|
-
const fn = curry$
|
|
1922
|
+
const set = (pointer, subject = undefined, value = undefined) => {
|
|
1923
|
+
const ptr = compile$N(pointer);
|
|
1924
|
+
const fn = curry$a((subject, value) => _set(ptr, subject, value, nil$2));
|
|
1925
1925
|
return subject === undefined ? fn : fn(subject, value);
|
|
1926
1926
|
};
|
|
1927
1927
|
|
|
1928
|
-
const _set
|
|
1928
|
+
const _set = (pointer, subject, value, cursor) => {
|
|
1929
1929
|
if (pointer.length === 0) {
|
|
1930
1930
|
return value;
|
|
1931
1931
|
} else if (pointer.length > 1) {
|
|
1932
|
-
|
|
1933
|
-
|
|
1932
|
+
if (Array.isArray(subject)) {
|
|
1933
|
+
const index = pointer.shift();
|
|
1934
|
+
const clonedSubject = [...subject];
|
|
1935
|
+
clonedSubject[index] = _set(pointer, applySegment(subject, index, cursor), value, append(index, cursor));
|
|
1936
|
+
return clonedSubject;
|
|
1937
|
+
} else {
|
|
1938
|
+
const segment = pointer.shift();
|
|
1939
|
+
return { ...subject, [segment]: _set(pointer, applySegment(subject, segment, cursor), value, append(segment, cursor)) };
|
|
1940
|
+
}
|
|
1934
1941
|
} else if (Array.isArray(subject)) {
|
|
1935
1942
|
const clonedSubject = [...subject];
|
|
1936
|
-
const segment = computeSegment
|
|
1943
|
+
const segment = computeSegment(subject, pointer[0]);
|
|
1937
1944
|
clonedSubject[segment] = value;
|
|
1938
1945
|
return clonedSubject;
|
|
1939
1946
|
} else if (typeof subject === "object" && subject !== null) {
|
|
1940
1947
|
return { ...subject, [pointer[0]]: value };
|
|
1941
1948
|
} else {
|
|
1942
|
-
return applySegment
|
|
1949
|
+
return applySegment(subject, pointer[0], cursor);
|
|
1943
1950
|
}
|
|
1944
1951
|
};
|
|
1945
1952
|
|
|
1946
|
-
const assign
|
|
1947
|
-
const ptr = compile$
|
|
1948
|
-
const fn = curry$
|
|
1953
|
+
const assign = (pointer, subject = undefined, value = undefined) => {
|
|
1954
|
+
const ptr = compile$N(pointer);
|
|
1955
|
+
const fn = curry$a((subject, value) => _assign(ptr, subject, value, nil$2));
|
|
1949
1956
|
return subject === undefined ? fn : fn(subject, value);
|
|
1950
1957
|
};
|
|
1951
1958
|
|
|
1952
|
-
const _assign
|
|
1959
|
+
const _assign = (pointer, subject, value, cursor) => {
|
|
1953
1960
|
if (pointer.length === 0) {
|
|
1954
1961
|
return;
|
|
1955
|
-
} else if (pointer.length === 1 && !isScalar
|
|
1956
|
-
const segment = computeSegment
|
|
1962
|
+
} else if (pointer.length === 1 && !isScalar(subject)) {
|
|
1963
|
+
const segment = computeSegment(subject, pointer[0]);
|
|
1957
1964
|
subject[segment] = value;
|
|
1958
1965
|
} else {
|
|
1959
1966
|
const segment = pointer.shift();
|
|
1960
|
-
_assign
|
|
1967
|
+
_assign(pointer, applySegment(subject, segment, cursor), value, append(segment, cursor));
|
|
1961
1968
|
}
|
|
1962
1969
|
};
|
|
1963
1970
|
|
|
1964
|
-
const unset
|
|
1965
|
-
const ptr = compile$
|
|
1966
|
-
const fn = (subject) => _unset
|
|
1971
|
+
const unset = (pointer, subject = undefined) => {
|
|
1972
|
+
const ptr = compile$N(pointer);
|
|
1973
|
+
const fn = (subject) => _unset(ptr, subject, nil$2);
|
|
1967
1974
|
return subject === undefined ? fn : fn(subject);
|
|
1968
1975
|
};
|
|
1969
1976
|
|
|
1970
|
-
const _unset
|
|
1977
|
+
const _unset = (pointer, subject, cursor) => {
|
|
1971
1978
|
if (pointer.length == 0) {
|
|
1972
1979
|
return undefined;
|
|
1973
1980
|
} else if (pointer.length > 1) {
|
|
1974
1981
|
const segment = pointer.shift();
|
|
1975
|
-
const value = applySegment
|
|
1976
|
-
return { ...subject, [segment]: _unset
|
|
1982
|
+
const value = applySegment(subject, segment, cursor);
|
|
1983
|
+
return { ...subject, [segment]: _unset(pointer, value, append(segment, cursor)) };
|
|
1977
1984
|
} else if (Array.isArray(subject)) {
|
|
1978
1985
|
return subject.filter((_, ndx) => ndx != pointer[0]);
|
|
1979
1986
|
} else if (typeof subject === "object" && subject !== null) {
|
|
@@ -1981,54 +1988,54 @@ const _unset$1 = (pointer, subject, cursor) => {
|
|
|
1981
1988
|
const { [pointer[0]]: _, ...result } = subject;
|
|
1982
1989
|
return result;
|
|
1983
1990
|
} else {
|
|
1984
|
-
return applySegment
|
|
1991
|
+
return applySegment(subject, pointer[0], cursor);
|
|
1985
1992
|
}
|
|
1986
1993
|
};
|
|
1987
1994
|
|
|
1988
|
-
const remove
|
|
1989
|
-
const ptr = compile$
|
|
1990
|
-
const fn = (subject) => _remove
|
|
1995
|
+
const remove = (pointer, subject = undefined) => {
|
|
1996
|
+
const ptr = compile$N(pointer);
|
|
1997
|
+
const fn = (subject) => _remove(ptr, subject, nil$2);
|
|
1991
1998
|
return subject === undefined ? fn : fn(subject);
|
|
1992
1999
|
};
|
|
1993
2000
|
|
|
1994
|
-
const _remove
|
|
2001
|
+
const _remove = (pointer, subject, cursor) => {
|
|
1995
2002
|
if (pointer.length === 0) {
|
|
1996
2003
|
return;
|
|
1997
2004
|
} else if (pointer.length > 1) {
|
|
1998
2005
|
const segment = pointer.shift();
|
|
1999
|
-
const value = applySegment
|
|
2000
|
-
_remove
|
|
2006
|
+
const value = applySegment(subject, segment, cursor);
|
|
2007
|
+
_remove(pointer, value, append(segment, cursor));
|
|
2001
2008
|
} else if (Array.isArray(subject)) {
|
|
2002
2009
|
subject.splice(pointer[0], 1);
|
|
2003
2010
|
} else if (typeof subject === "object" && subject !== null) {
|
|
2004
2011
|
delete subject[pointer[0]];
|
|
2005
2012
|
} else {
|
|
2006
|
-
applySegment
|
|
2013
|
+
applySegment(subject, pointer[0], cursor);
|
|
2007
2014
|
}
|
|
2008
2015
|
};
|
|
2009
2016
|
|
|
2010
|
-
const append
|
|
2017
|
+
const append = curry$a((segment, pointer) => pointer + "/" + escape(segment));
|
|
2011
2018
|
|
|
2012
|
-
const escape
|
|
2013
|
-
const unescape
|
|
2014
|
-
const computeSegment
|
|
2019
|
+
const escape = (segment) => segment.toString().replace(/~/g, "~0").replace(/\//g, "~1");
|
|
2020
|
+
const unescape = (segment) => segment.toString().replace(/~1/g, "/").replace(/~0/g, "~");
|
|
2021
|
+
const computeSegment = (value, segment) => Array.isArray(value) && segment === "-" ? value.length : segment;
|
|
2015
2022
|
|
|
2016
|
-
const applySegment
|
|
2023
|
+
const applySegment = (value, segment, cursor = "") => {
|
|
2017
2024
|
if (value === undefined) {
|
|
2018
2025
|
throw TypeError(`Value at '${cursor}' is undefined and does not have property '${segment}'`);
|
|
2019
2026
|
} else if (value === null) {
|
|
2020
2027
|
throw TypeError(`Value at '${cursor}' is null and does not have property '${segment}'`);
|
|
2021
|
-
} else if (isScalar
|
|
2028
|
+
} else if (isScalar(value)) {
|
|
2022
2029
|
throw TypeError(`Value at '${cursor}' is a ${typeof value} and does not have property '${segment}'`);
|
|
2023
2030
|
} else {
|
|
2024
|
-
const computedSegment = computeSegment
|
|
2031
|
+
const computedSegment = computeSegment(value, segment);
|
|
2025
2032
|
return value[computedSegment];
|
|
2026
2033
|
}
|
|
2027
2034
|
};
|
|
2028
2035
|
|
|
2029
|
-
const isScalar
|
|
2036
|
+
const isScalar = (value) => value === null || typeof value !== "object";
|
|
2030
2037
|
|
|
2031
|
-
var lib$
|
|
2038
|
+
var lib$3 = { nil: nil$2, append, get: get$2, set, assign, unset, remove };
|
|
2032
2039
|
|
|
2033
2040
|
const $__value = Symbol("$__value");
|
|
2034
2041
|
const $__href = Symbol("$__href");
|
|
@@ -2044,16 +2051,16 @@ const value$2 = (ref) => ref[$__value];
|
|
|
2044
2051
|
|
|
2045
2052
|
var reference = { cons: cons$1, isReference, href, value: value$2 };
|
|
2046
2053
|
|
|
2047
|
-
const JsonPointer$
|
|
2048
|
-
const curry$
|
|
2054
|
+
const JsonPointer$1 = lib$3;
|
|
2055
|
+
const curry$9 = justCurryIt$1;
|
|
2049
2056
|
const { resolveUrl: resolveUrl$2, jsonTypeOf: jsonTypeOf$1 } = common$1;
|
|
2050
2057
|
const Reference$2 = reference;
|
|
2051
2058
|
|
|
2052
2059
|
|
|
2053
|
-
const nil$
|
|
2054
|
-
const cons = (instance, id = "") => Object.freeze({ ...nil$
|
|
2060
|
+
const nil$1 = Object.freeze({ id: "", pointer: "", instance: undefined, value: undefined });
|
|
2061
|
+
const cons = (instance, id = "") => Object.freeze({ ...nil$1, id: resolveUrl$2(id, ""), instance, value: instance });
|
|
2055
2062
|
|
|
2056
|
-
const get$
|
|
2063
|
+
const get$1 = (url, instance = nil$1) => {
|
|
2057
2064
|
if (!url.startsWith("#")) {
|
|
2058
2065
|
throw Error(`No JSON document found at '${url.split("#")[0]}'`);
|
|
2059
2066
|
}
|
|
@@ -2064,126 +2071,48 @@ const get$2 = (url, instance = nil$2) => {
|
|
|
2064
2071
|
const uri$1 = (doc) => `${doc.id}#${encodeURI(doc.pointer)}`;
|
|
2065
2072
|
const value$1 = (doc) => Reference$2.isReference(doc.value) ? Reference$2.value(doc.value) : doc.value;
|
|
2066
2073
|
const has$1 = (key, doc) => key in value$1(doc);
|
|
2067
|
-
const typeOf$1 = curry$
|
|
2074
|
+
const typeOf$1 = curry$9((doc, type) => jsonTypeOf$1(value$1(doc), type));
|
|
2068
2075
|
|
|
2069
2076
|
const step$1 = (key, doc) => Object.freeze({
|
|
2070
2077
|
...doc,
|
|
2071
|
-
pointer: JsonPointer$
|
|
2078
|
+
pointer: JsonPointer$1.append(key, doc.pointer),
|
|
2072
2079
|
value: value$1(doc)[key]
|
|
2073
2080
|
});
|
|
2074
2081
|
|
|
2075
|
-
const entries$
|
|
2082
|
+
const entries$3 = (doc) => Object.keys(value$1(doc))
|
|
2076
2083
|
.map((key) => [key, step$1(key, doc)]);
|
|
2077
2084
|
|
|
2078
2085
|
const keys$1 = (doc) => Object.keys(value$1(doc));
|
|
2079
2086
|
|
|
2080
|
-
const map$
|
|
2087
|
+
const map$4 = curry$9((fn, doc) => value$1(doc)
|
|
2081
2088
|
.map((item, ndx, array, thisArg) => fn(step$1(ndx, doc), ndx, array, thisArg)));
|
|
2082
2089
|
|
|
2083
|
-
const forEach = curry$
|
|
2090
|
+
const forEach = curry$9((fn, doc) => value$1(doc)
|
|
2084
2091
|
.forEach((item, ndx, array, thisArg) => fn(step$1(ndx, doc), ndx, array, thisArg)));
|
|
2085
2092
|
|
|
2086
|
-
const filter$
|
|
2093
|
+
const filter$1 = curry$9((fn, doc) => value$1(doc)
|
|
2087
2094
|
.map((item, ndx, array, thisArg) => step$1(ndx, doc))
|
|
2088
2095
|
.filter((item, ndx, array, thisArg) => fn(item, ndx, array, thisArg)));
|
|
2089
2096
|
|
|
2090
|
-
const reduce$
|
|
2097
|
+
const reduce$3 = curry$9((fn, acc, doc) => value$1(doc)
|
|
2091
2098
|
.reduce((acc, item, ndx) => fn(acc, step$1(ndx, doc), ndx), acc));
|
|
2092
2099
|
|
|
2093
|
-
const every$
|
|
2100
|
+
const every$1 = curry$9((fn, doc) => value$1(doc)
|
|
2094
2101
|
.every((item, ndx, array, thisArg) => fn(step$1(ndx, doc), ndx, array, thisArg)));
|
|
2095
2102
|
|
|
2096
|
-
const some$
|
|
2103
|
+
const some$1 = curry$9((fn, doc) => value$1(doc)
|
|
2097
2104
|
.some((item, ndx, array, thisArg) => fn(step$1(ndx, doc), ndx, array, thisArg)));
|
|
2098
2105
|
|
|
2099
2106
|
const length$1 = (doc) => value$1(doc).length;
|
|
2100
2107
|
|
|
2101
2108
|
var instance = {
|
|
2102
|
-
nil: nil$
|
|
2103
|
-
step: step$1, entries: entries$
|
|
2104
|
-
};
|
|
2105
|
-
|
|
2106
|
-
var entries$4 = async (doc) => Object.entries(await doc);
|
|
2107
|
-
|
|
2108
|
-
const curry$g = justCurryIt$2;
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
var map$6 = curry$g(async (fn, doc) => (await doc).map(fn));
|
|
2112
|
-
|
|
2113
|
-
const curry$f = justCurryIt$2;
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
var reduce$5 = curry$f(async (fn, acc, doc) => {
|
|
2117
|
-
return (await doc).reduce(async (acc, item) => fn(await acc, item), acc);
|
|
2118
|
-
});
|
|
2119
|
-
|
|
2120
|
-
const curry$e = justCurryIt$2;
|
|
2121
|
-
const reduce$4 = reduce$5;
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
var filter$1 = curry$e(async (fn, doc, options = {}) => {
|
|
2125
|
-
return reduce$4(async (acc, item) => {
|
|
2126
|
-
return (await fn(item)) ? acc.concat([item]) : acc;
|
|
2127
|
-
}, [], doc, options);
|
|
2128
|
-
});
|
|
2129
|
-
|
|
2130
|
-
const curry$d = justCurryIt$2;
|
|
2131
|
-
const map$5 = map$6;
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
var some$1 = curry$d(async (fn, doc) => {
|
|
2135
|
-
const results = await map$5(fn, doc);
|
|
2136
|
-
return (await Promise.all(results))
|
|
2137
|
-
.some((a) => a);
|
|
2138
|
-
});
|
|
2139
|
-
|
|
2140
|
-
const curry$c = justCurryIt$2;
|
|
2141
|
-
const map$4 = map$6;
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
var every$1 = curry$c(async (fn, doc) => {
|
|
2145
|
-
const results = await map$4(fn, doc);
|
|
2146
|
-
return (await Promise.all(results))
|
|
2147
|
-
.every((a) => a);
|
|
2148
|
-
});
|
|
2149
|
-
|
|
2150
|
-
const curry$b = justCurryIt$2;
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
var pipeline$3 = curry$b((fns, doc) => {
|
|
2154
|
-
return fns.reduce(async (acc, fn) => fn(await acc), doc);
|
|
2155
|
-
});
|
|
2156
|
-
|
|
2157
|
-
var all$1 = (doc) => Promise.all(doc);
|
|
2158
|
-
|
|
2159
|
-
const pipeline$2 = pipeline$3;
|
|
2160
|
-
const entries$3 = entries$4;
|
|
2161
|
-
const reduce$3 = reduce$5;
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
var allValues$1 = (doc) => {
|
|
2165
|
-
return pipeline$2([
|
|
2166
|
-
entries$3,
|
|
2167
|
-
reduce$3(async (acc, [propertyName, propertyValue]) => {
|
|
2168
|
-
acc[propertyName] = await propertyValue;
|
|
2169
|
-
return acc;
|
|
2170
|
-
}, {})
|
|
2171
|
-
], doc);
|
|
2109
|
+
nil: nil$1, cons, get: get$1, uri: uri$1, value: value$1, has: has$1, typeOf: typeOf$1, length: length$1,
|
|
2110
|
+
step: step$1, entries: entries$3, keys: keys$1, map: map$4, forEach, filter: filter$1, reduce: reduce$3, every: every$1, some: some$1
|
|
2172
2111
|
};
|
|
2173
2112
|
|
|
2174
|
-
var
|
|
2175
|
-
entries: entries$4,
|
|
2176
|
-
map: map$6,
|
|
2177
|
-
filter: filter$1,
|
|
2178
|
-
reduce: reduce$5,
|
|
2179
|
-
some: some$1,
|
|
2180
|
-
every: every$1,
|
|
2181
|
-
pipeline: pipeline$3,
|
|
2182
|
-
all: all$1,
|
|
2183
|
-
allValues: allValues$1
|
|
2184
|
-
};
|
|
2113
|
+
var entries$2 = async (doc) => Object.entries(await doc);
|
|
2185
2114
|
|
|
2186
|
-
var justCurryIt
|
|
2115
|
+
var justCurryIt = curry$8;
|
|
2187
2116
|
|
|
2188
2117
|
/*
|
|
2189
2118
|
function add(a, b, c) {
|
|
@@ -2208,7 +2137,7 @@ var justCurryIt$1 = curry$a;
|
|
|
2208
2137
|
milesToKm(10); // 16.2
|
|
2209
2138
|
*/
|
|
2210
2139
|
|
|
2211
|
-
function curry$
|
|
2140
|
+
function curry$8(fn, arity) {
|
|
2212
2141
|
return function curried() {
|
|
2213
2142
|
if (arity == null) {
|
|
2214
2143
|
arity = fn.length;
|
|
@@ -2224,987 +2153,83 @@ function curry$a(fn, arity) {
|
|
|
2224
2153
|
};
|
|
2225
2154
|
}
|
|
2226
2155
|
|
|
2227
|
-
const curry$
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
const nil$1 = "";
|
|
2231
|
-
|
|
2232
|
-
const compile$P = (pointer) => {
|
|
2233
|
-
if (pointer.length > 0 && pointer[0] !== "/") {
|
|
2234
|
-
throw Error("Invalid JSON Pointer");
|
|
2235
|
-
}
|
|
2236
|
-
|
|
2237
|
-
return pointer.split("/").slice(1).map(unescape);
|
|
2238
|
-
};
|
|
2239
|
-
|
|
2240
|
-
const get$1 = (pointer, value = undefined) => {
|
|
2241
|
-
const ptr = compile$P(pointer);
|
|
2242
|
-
|
|
2243
|
-
const fn = (value) => ptr.reduce(([value, pointer], segment) => {
|
|
2244
|
-
return [applySegment(value, segment, pointer), append(segment, pointer)];
|
|
2245
|
-
}, [value, ""])[0];
|
|
2246
|
-
|
|
2247
|
-
return value === undefined ? fn : fn(value);
|
|
2248
|
-
};
|
|
2249
|
-
|
|
2250
|
-
const set = (pointer, subject = undefined, value = undefined) => {
|
|
2251
|
-
const ptr = compile$P(pointer);
|
|
2252
|
-
const fn = curry$9((subject, value) => _set(ptr, subject, value, nil$1));
|
|
2253
|
-
return subject === undefined ? fn : fn(subject, value);
|
|
2254
|
-
};
|
|
2255
|
-
|
|
2256
|
-
const _set = (pointer, subject, value, cursor) => {
|
|
2257
|
-
if (pointer.length === 0) {
|
|
2258
|
-
return value;
|
|
2259
|
-
} else if (pointer.length > 1) {
|
|
2260
|
-
if (Array.isArray(subject)) {
|
|
2261
|
-
const index = pointer.shift();
|
|
2262
|
-
const clonedSubject = [...subject];
|
|
2263
|
-
clonedSubject[index] = _set(pointer, applySegment(subject, index, cursor), value, append(index, cursor));
|
|
2264
|
-
return clonedSubject;
|
|
2265
|
-
} else {
|
|
2266
|
-
const segment = pointer.shift();
|
|
2267
|
-
return { ...subject, [segment]: _set(pointer, applySegment(subject, segment, cursor), value, append(segment, cursor)) };
|
|
2268
|
-
}
|
|
2269
|
-
} else if (Array.isArray(subject)) {
|
|
2270
|
-
const clonedSubject = [...subject];
|
|
2271
|
-
const segment = computeSegment(subject, pointer[0]);
|
|
2272
|
-
clonedSubject[segment] = value;
|
|
2273
|
-
return clonedSubject;
|
|
2274
|
-
} else if (typeof subject === "object" && subject !== null) {
|
|
2275
|
-
return { ...subject, [pointer[0]]: value };
|
|
2276
|
-
} else {
|
|
2277
|
-
return applySegment(subject, pointer[0], cursor);
|
|
2278
|
-
}
|
|
2279
|
-
};
|
|
2280
|
-
|
|
2281
|
-
const assign = (pointer, subject = undefined, value = undefined) => {
|
|
2282
|
-
const ptr = compile$P(pointer);
|
|
2283
|
-
const fn = curry$9((subject, value) => _assign(ptr, subject, value, nil$1));
|
|
2284
|
-
return subject === undefined ? fn : fn(subject, value);
|
|
2285
|
-
};
|
|
2286
|
-
|
|
2287
|
-
const _assign = (pointer, subject, value, cursor) => {
|
|
2288
|
-
if (pointer.length === 0) {
|
|
2289
|
-
return;
|
|
2290
|
-
} else if (pointer.length === 1 && !isScalar(subject)) {
|
|
2291
|
-
const segment = computeSegment(subject, pointer[0]);
|
|
2292
|
-
subject[segment] = value;
|
|
2293
|
-
} else {
|
|
2294
|
-
const segment = pointer.shift();
|
|
2295
|
-
_assign(pointer, applySegment(subject, segment, cursor), value, append(segment, cursor));
|
|
2296
|
-
}
|
|
2297
|
-
};
|
|
2298
|
-
|
|
2299
|
-
const unset = (pointer, subject = undefined) => {
|
|
2300
|
-
const ptr = compile$P(pointer);
|
|
2301
|
-
const fn = (subject) => _unset(ptr, subject, nil$1);
|
|
2302
|
-
return subject === undefined ? fn : fn(subject);
|
|
2303
|
-
};
|
|
2304
|
-
|
|
2305
|
-
const _unset = (pointer, subject, cursor) => {
|
|
2306
|
-
if (pointer.length == 0) {
|
|
2307
|
-
return undefined;
|
|
2308
|
-
} else if (pointer.length > 1) {
|
|
2309
|
-
const segment = pointer.shift();
|
|
2310
|
-
const value = applySegment(subject, segment, cursor);
|
|
2311
|
-
return { ...subject, [segment]: _unset(pointer, value, append(segment, cursor)) };
|
|
2312
|
-
} else if (Array.isArray(subject)) {
|
|
2313
|
-
return subject.filter((_, ndx) => ndx != pointer[0]);
|
|
2314
|
-
} else if (typeof subject === "object" && subject !== null) {
|
|
2315
|
-
// eslint-disable-next-line no-unused-vars
|
|
2316
|
-
const { [pointer[0]]: _, ...result } = subject;
|
|
2317
|
-
return result;
|
|
2318
|
-
} else {
|
|
2319
|
-
return applySegment(subject, pointer[0], cursor);
|
|
2320
|
-
}
|
|
2321
|
-
};
|
|
2322
|
-
|
|
2323
|
-
const remove = (pointer, subject = undefined) => {
|
|
2324
|
-
const ptr = compile$P(pointer);
|
|
2325
|
-
const fn = (subject) => _remove(ptr, subject, nil$1);
|
|
2326
|
-
return subject === undefined ? fn : fn(subject);
|
|
2327
|
-
};
|
|
2328
|
-
|
|
2329
|
-
const _remove = (pointer, subject, cursor) => {
|
|
2330
|
-
if (pointer.length === 0) {
|
|
2331
|
-
return;
|
|
2332
|
-
} else if (pointer.length > 1) {
|
|
2333
|
-
const segment = pointer.shift();
|
|
2334
|
-
const value = applySegment(subject, segment, cursor);
|
|
2335
|
-
_remove(pointer, value, append(segment, cursor));
|
|
2336
|
-
} else if (Array.isArray(subject)) {
|
|
2337
|
-
subject.splice(pointer[0], 1);
|
|
2338
|
-
} else if (typeof subject === "object" && subject !== null) {
|
|
2339
|
-
delete subject[pointer[0]];
|
|
2340
|
-
} else {
|
|
2341
|
-
applySegment(subject, pointer[0], cursor);
|
|
2342
|
-
}
|
|
2343
|
-
};
|
|
2344
|
-
|
|
2345
|
-
const append = curry$9((segment, pointer) => pointer + "/" + escape$1(segment));
|
|
2346
|
-
|
|
2347
|
-
const escape$1 = (segment) => segment.toString().replace(/~/g, "~0").replace(/\//g, "~1");
|
|
2348
|
-
const unescape = (segment) => segment.toString().replace(/~1/g, "/").replace(/~0/g, "~");
|
|
2349
|
-
const computeSegment = (value, segment) => Array.isArray(value) && segment === "-" ? value.length : segment;
|
|
2350
|
-
|
|
2351
|
-
const applySegment = (value, segment, cursor = "") => {
|
|
2352
|
-
if (value === undefined) {
|
|
2353
|
-
throw TypeError(`Value at '${cursor}' is undefined and does not have property '${segment}'`);
|
|
2354
|
-
} else if (value === null) {
|
|
2355
|
-
throw TypeError(`Value at '${cursor}' is null and does not have property '${segment}'`);
|
|
2356
|
-
} else if (isScalar(value)) {
|
|
2357
|
-
throw TypeError(`Value at '${cursor}' is a ${typeof value} and does not have property '${segment}'`);
|
|
2358
|
-
} else {
|
|
2359
|
-
const computedSegment = computeSegment(value, segment);
|
|
2360
|
-
return value[computedSegment];
|
|
2361
|
-
}
|
|
2362
|
-
};
|
|
2363
|
-
|
|
2364
|
-
const isScalar = (value) => value === null || typeof value !== "object";
|
|
2365
|
-
|
|
2366
|
-
var lib$4 = { nil: nil$1, append, get: get$1, set, assign, unset, remove };
|
|
2367
|
-
|
|
2368
|
-
var moo$1 = {exports: {}};
|
|
2369
|
-
|
|
2370
|
-
(function (module) {
|
|
2371
|
-
(function(root, factory) {
|
|
2372
|
-
if (module.exports) {
|
|
2373
|
-
module.exports = factory();
|
|
2374
|
-
} else {
|
|
2375
|
-
root.moo = factory();
|
|
2376
|
-
}
|
|
2377
|
-
}(commonjsGlobal, function() {
|
|
2378
|
-
|
|
2379
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
2380
|
-
var toString = Object.prototype.toString;
|
|
2381
|
-
var hasSticky = typeof new RegExp().sticky === 'boolean';
|
|
2382
|
-
|
|
2383
|
-
/***************************************************************************/
|
|
2384
|
-
|
|
2385
|
-
function isRegExp(o) { return o && toString.call(o) === '[object RegExp]' }
|
|
2386
|
-
function isObject(o) { return o && typeof o === 'object' && !isRegExp(o) && !Array.isArray(o) }
|
|
2387
|
-
|
|
2388
|
-
function reEscape(s) {
|
|
2389
|
-
return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')
|
|
2390
|
-
}
|
|
2391
|
-
function reGroups(s) {
|
|
2392
|
-
var re = new RegExp('|' + s);
|
|
2393
|
-
return re.exec('').length - 1
|
|
2394
|
-
}
|
|
2395
|
-
function reCapture(s) {
|
|
2396
|
-
return '(' + s + ')'
|
|
2397
|
-
}
|
|
2398
|
-
function reUnion(regexps) {
|
|
2399
|
-
if (!regexps.length) return '(?!)'
|
|
2400
|
-
var source = regexps.map(function(s) {
|
|
2401
|
-
return "(?:" + s + ")"
|
|
2402
|
-
}).join('|');
|
|
2403
|
-
return "(?:" + source + ")"
|
|
2404
|
-
}
|
|
2405
|
-
|
|
2406
|
-
function regexpOrLiteral(obj) {
|
|
2407
|
-
if (typeof obj === 'string') {
|
|
2408
|
-
return '(?:' + reEscape(obj) + ')'
|
|
2409
|
-
|
|
2410
|
-
} else if (isRegExp(obj)) {
|
|
2411
|
-
// TODO: consider /u support
|
|
2412
|
-
if (obj.ignoreCase) throw new Error('RegExp /i flag not allowed')
|
|
2413
|
-
if (obj.global) throw new Error('RegExp /g flag is implied')
|
|
2414
|
-
if (obj.sticky) throw new Error('RegExp /y flag is implied')
|
|
2415
|
-
if (obj.multiline) throw new Error('RegExp /m flag is implied')
|
|
2416
|
-
return obj.source
|
|
2417
|
-
|
|
2418
|
-
} else {
|
|
2419
|
-
throw new Error('Not a pattern: ' + obj)
|
|
2420
|
-
}
|
|
2421
|
-
}
|
|
2422
|
-
|
|
2423
|
-
function objectToRules(object) {
|
|
2424
|
-
var keys = Object.getOwnPropertyNames(object);
|
|
2425
|
-
var result = [];
|
|
2426
|
-
for (var i = 0; i < keys.length; i++) {
|
|
2427
|
-
var key = keys[i];
|
|
2428
|
-
var thing = object[key];
|
|
2429
|
-
var rules = [].concat(thing);
|
|
2430
|
-
if (key === 'include') {
|
|
2431
|
-
for (var j = 0; j < rules.length; j++) {
|
|
2432
|
-
result.push({include: rules[j]});
|
|
2433
|
-
}
|
|
2434
|
-
continue
|
|
2435
|
-
}
|
|
2436
|
-
var match = [];
|
|
2437
|
-
rules.forEach(function(rule) {
|
|
2438
|
-
if (isObject(rule)) {
|
|
2439
|
-
if (match.length) result.push(ruleOptions(key, match));
|
|
2440
|
-
result.push(ruleOptions(key, rule));
|
|
2441
|
-
match = [];
|
|
2442
|
-
} else {
|
|
2443
|
-
match.push(rule);
|
|
2444
|
-
}
|
|
2445
|
-
});
|
|
2446
|
-
if (match.length) result.push(ruleOptions(key, match));
|
|
2447
|
-
}
|
|
2448
|
-
return result
|
|
2449
|
-
}
|
|
2450
|
-
|
|
2451
|
-
function arrayToRules(array) {
|
|
2452
|
-
var result = [];
|
|
2453
|
-
for (var i = 0; i < array.length; i++) {
|
|
2454
|
-
var obj = array[i];
|
|
2455
|
-
if (obj.include) {
|
|
2456
|
-
var include = [].concat(obj.include);
|
|
2457
|
-
for (var j = 0; j < include.length; j++) {
|
|
2458
|
-
result.push({include: include[j]});
|
|
2459
|
-
}
|
|
2460
|
-
continue
|
|
2461
|
-
}
|
|
2462
|
-
if (!obj.type) {
|
|
2463
|
-
throw new Error('Rule has no type: ' + JSON.stringify(obj))
|
|
2464
|
-
}
|
|
2465
|
-
result.push(ruleOptions(obj.type, obj));
|
|
2466
|
-
}
|
|
2467
|
-
return result
|
|
2468
|
-
}
|
|
2469
|
-
|
|
2470
|
-
function ruleOptions(type, obj) {
|
|
2471
|
-
if (!isObject(obj)) {
|
|
2472
|
-
obj = { match: obj };
|
|
2473
|
-
}
|
|
2474
|
-
if (obj.include) {
|
|
2475
|
-
throw new Error('Matching rules cannot also include states')
|
|
2476
|
-
}
|
|
2477
|
-
|
|
2478
|
-
// nb. error and fallback imply lineBreaks
|
|
2479
|
-
var options = {
|
|
2480
|
-
defaultType: type,
|
|
2481
|
-
lineBreaks: !!obj.error || !!obj.fallback,
|
|
2482
|
-
pop: false,
|
|
2483
|
-
next: null,
|
|
2484
|
-
push: null,
|
|
2485
|
-
error: false,
|
|
2486
|
-
fallback: false,
|
|
2487
|
-
value: null,
|
|
2488
|
-
type: null,
|
|
2489
|
-
shouldThrow: false,
|
|
2490
|
-
};
|
|
2491
|
-
|
|
2492
|
-
// Avoid Object.assign(), so we support IE9+
|
|
2493
|
-
for (var key in obj) {
|
|
2494
|
-
if (hasOwnProperty.call(obj, key)) {
|
|
2495
|
-
options[key] = obj[key];
|
|
2496
|
-
}
|
|
2497
|
-
}
|
|
2498
|
-
|
|
2499
|
-
// type transform cannot be a string
|
|
2500
|
-
if (typeof options.type === 'string' && type !== options.type) {
|
|
2501
|
-
throw new Error("Type transform cannot be a string (type '" + options.type + "' for token '" + type + "')")
|
|
2502
|
-
}
|
|
2503
|
-
|
|
2504
|
-
// convert to array
|
|
2505
|
-
var match = options.match;
|
|
2506
|
-
options.match = Array.isArray(match) ? match : match ? [match] : [];
|
|
2507
|
-
options.match.sort(function(a, b) {
|
|
2508
|
-
return isRegExp(a) && isRegExp(b) ? 0
|
|
2509
|
-
: isRegExp(b) ? -1 : isRegExp(a) ? +1 : b.length - a.length
|
|
2510
|
-
});
|
|
2511
|
-
return options
|
|
2512
|
-
}
|
|
2513
|
-
|
|
2514
|
-
function toRules(spec) {
|
|
2515
|
-
return Array.isArray(spec) ? arrayToRules(spec) : objectToRules(spec)
|
|
2516
|
-
}
|
|
2517
|
-
|
|
2518
|
-
var defaultErrorRule = ruleOptions('error', {lineBreaks: true, shouldThrow: true});
|
|
2519
|
-
function compileRules(rules, hasStates) {
|
|
2520
|
-
var errorRule = null;
|
|
2521
|
-
var fast = Object.create(null);
|
|
2522
|
-
var fastAllowed = true;
|
|
2523
|
-
var unicodeFlag = null;
|
|
2524
|
-
var groups = [];
|
|
2525
|
-
var parts = [];
|
|
2526
|
-
|
|
2527
|
-
// If there is a fallback rule, then disable fast matching
|
|
2528
|
-
for (var i = 0; i < rules.length; i++) {
|
|
2529
|
-
if (rules[i].fallback) {
|
|
2530
|
-
fastAllowed = false;
|
|
2531
|
-
}
|
|
2532
|
-
}
|
|
2533
|
-
|
|
2534
|
-
for (var i = 0; i < rules.length; i++) {
|
|
2535
|
-
var options = rules[i];
|
|
2536
|
-
|
|
2537
|
-
if (options.include) {
|
|
2538
|
-
// all valid inclusions are removed by states() preprocessor
|
|
2539
|
-
throw new Error('Inheritance is not allowed in stateless lexers')
|
|
2540
|
-
}
|
|
2541
|
-
|
|
2542
|
-
if (options.error || options.fallback) {
|
|
2543
|
-
// errorRule can only be set once
|
|
2544
|
-
if (errorRule) {
|
|
2545
|
-
if (!options.fallback === !errorRule.fallback) {
|
|
2546
|
-
throw new Error("Multiple " + (options.fallback ? "fallback" : "error") + " rules not allowed (for token '" + options.defaultType + "')")
|
|
2547
|
-
} else {
|
|
2548
|
-
throw new Error("fallback and error are mutually exclusive (for token '" + options.defaultType + "')")
|
|
2549
|
-
}
|
|
2550
|
-
}
|
|
2551
|
-
errorRule = options;
|
|
2552
|
-
}
|
|
2553
|
-
|
|
2554
|
-
var match = options.match.slice();
|
|
2555
|
-
if (fastAllowed) {
|
|
2556
|
-
while (match.length && typeof match[0] === 'string' && match[0].length === 1) {
|
|
2557
|
-
var word = match.shift();
|
|
2558
|
-
fast[word.charCodeAt(0)] = options;
|
|
2559
|
-
}
|
|
2560
|
-
}
|
|
2561
|
-
|
|
2562
|
-
// Warn about inappropriate state-switching options
|
|
2563
|
-
if (options.pop || options.push || options.next) {
|
|
2564
|
-
if (!hasStates) {
|
|
2565
|
-
throw new Error("State-switching options are not allowed in stateless lexers (for token '" + options.defaultType + "')")
|
|
2566
|
-
}
|
|
2567
|
-
if (options.fallback) {
|
|
2568
|
-
throw new Error("State-switching options are not allowed on fallback tokens (for token '" + options.defaultType + "')")
|
|
2569
|
-
}
|
|
2570
|
-
}
|
|
2571
|
-
|
|
2572
|
-
// Only rules with a .match are included in the RegExp
|
|
2573
|
-
if (match.length === 0) {
|
|
2574
|
-
continue
|
|
2575
|
-
}
|
|
2576
|
-
fastAllowed = false;
|
|
2577
|
-
|
|
2578
|
-
groups.push(options);
|
|
2579
|
-
|
|
2580
|
-
// Check unicode flag is used everywhere or nowhere
|
|
2581
|
-
for (var j = 0; j < match.length; j++) {
|
|
2582
|
-
var obj = match[j];
|
|
2583
|
-
if (!isRegExp(obj)) {
|
|
2584
|
-
continue
|
|
2585
|
-
}
|
|
2586
|
-
|
|
2587
|
-
if (unicodeFlag === null) {
|
|
2588
|
-
unicodeFlag = obj.unicode;
|
|
2589
|
-
} else if (unicodeFlag !== obj.unicode && options.fallback === false) {
|
|
2590
|
-
throw new Error('If one rule is /u then all must be')
|
|
2591
|
-
}
|
|
2592
|
-
}
|
|
2593
|
-
|
|
2594
|
-
// convert to RegExp
|
|
2595
|
-
var pat = reUnion(match.map(regexpOrLiteral));
|
|
2596
|
-
|
|
2597
|
-
// validate
|
|
2598
|
-
var regexp = new RegExp(pat);
|
|
2599
|
-
if (regexp.test("")) {
|
|
2600
|
-
throw new Error("RegExp matches empty string: " + regexp)
|
|
2601
|
-
}
|
|
2602
|
-
var groupCount = reGroups(pat);
|
|
2603
|
-
if (groupCount > 0) {
|
|
2604
|
-
throw new Error("RegExp has capture groups: " + regexp + "\nUse (?: … ) instead")
|
|
2605
|
-
}
|
|
2606
|
-
|
|
2607
|
-
// try and detect rules matching newlines
|
|
2608
|
-
if (!options.lineBreaks && regexp.test('\n')) {
|
|
2609
|
-
throw new Error('Rule should declare lineBreaks: ' + regexp)
|
|
2610
|
-
}
|
|
2611
|
-
|
|
2612
|
-
// store regex
|
|
2613
|
-
parts.push(reCapture(pat));
|
|
2614
|
-
}
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
// If there's no fallback rule, use the sticky flag so we only look for
|
|
2618
|
-
// matches at the current index.
|
|
2619
|
-
//
|
|
2620
|
-
// If we don't support the sticky flag, then fake it using an irrefutable
|
|
2621
|
-
// match (i.e. an empty pattern).
|
|
2622
|
-
var fallbackRule = errorRule && errorRule.fallback;
|
|
2623
|
-
var flags = hasSticky && !fallbackRule ? 'ym' : 'gm';
|
|
2624
|
-
var suffix = hasSticky || fallbackRule ? '' : '|';
|
|
2625
|
-
|
|
2626
|
-
if (unicodeFlag === true) flags += "u";
|
|
2627
|
-
var combined = new RegExp(reUnion(parts) + suffix, flags);
|
|
2628
|
-
return {regexp: combined, groups: groups, fast: fast, error: errorRule || defaultErrorRule}
|
|
2629
|
-
}
|
|
2630
|
-
|
|
2631
|
-
function compile(rules) {
|
|
2632
|
-
var result = compileRules(toRules(rules));
|
|
2633
|
-
return new Lexer({start: result}, 'start')
|
|
2634
|
-
}
|
|
2635
|
-
|
|
2636
|
-
function checkStateGroup(g, name, map) {
|
|
2637
|
-
var state = g && (g.push || g.next);
|
|
2638
|
-
if (state && !map[state]) {
|
|
2639
|
-
throw new Error("Missing state '" + state + "' (in token '" + g.defaultType + "' of state '" + name + "')")
|
|
2640
|
-
}
|
|
2641
|
-
if (g && g.pop && +g.pop !== 1) {
|
|
2642
|
-
throw new Error("pop must be 1 (in token '" + g.defaultType + "' of state '" + name + "')")
|
|
2643
|
-
}
|
|
2644
|
-
}
|
|
2645
|
-
function compileStates(states, start) {
|
|
2646
|
-
var all = states.$all ? toRules(states.$all) : [];
|
|
2647
|
-
delete states.$all;
|
|
2648
|
-
|
|
2649
|
-
var keys = Object.getOwnPropertyNames(states);
|
|
2650
|
-
if (!start) start = keys[0];
|
|
2651
|
-
|
|
2652
|
-
var ruleMap = Object.create(null);
|
|
2653
|
-
for (var i = 0; i < keys.length; i++) {
|
|
2654
|
-
var key = keys[i];
|
|
2655
|
-
ruleMap[key] = toRules(states[key]).concat(all);
|
|
2656
|
-
}
|
|
2657
|
-
for (var i = 0; i < keys.length; i++) {
|
|
2658
|
-
var key = keys[i];
|
|
2659
|
-
var rules = ruleMap[key];
|
|
2660
|
-
var included = Object.create(null);
|
|
2661
|
-
for (var j = 0; j < rules.length; j++) {
|
|
2662
|
-
var rule = rules[j];
|
|
2663
|
-
if (!rule.include) continue
|
|
2664
|
-
var splice = [j, 1];
|
|
2665
|
-
if (rule.include !== key && !included[rule.include]) {
|
|
2666
|
-
included[rule.include] = true;
|
|
2667
|
-
var newRules = ruleMap[rule.include];
|
|
2668
|
-
if (!newRules) {
|
|
2669
|
-
throw new Error("Cannot include nonexistent state '" + rule.include + "' (in state '" + key + "')")
|
|
2670
|
-
}
|
|
2671
|
-
for (var k = 0; k < newRules.length; k++) {
|
|
2672
|
-
var newRule = newRules[k];
|
|
2673
|
-
if (rules.indexOf(newRule) !== -1) continue
|
|
2674
|
-
splice.push(newRule);
|
|
2675
|
-
}
|
|
2676
|
-
}
|
|
2677
|
-
rules.splice.apply(rules, splice);
|
|
2678
|
-
j--;
|
|
2679
|
-
}
|
|
2680
|
-
}
|
|
2681
|
-
|
|
2682
|
-
var map = Object.create(null);
|
|
2683
|
-
for (var i = 0; i < keys.length; i++) {
|
|
2684
|
-
var key = keys[i];
|
|
2685
|
-
map[key] = compileRules(ruleMap[key], true);
|
|
2686
|
-
}
|
|
2687
|
-
|
|
2688
|
-
for (var i = 0; i < keys.length; i++) {
|
|
2689
|
-
var name = keys[i];
|
|
2690
|
-
var state = map[name];
|
|
2691
|
-
var groups = state.groups;
|
|
2692
|
-
for (var j = 0; j < groups.length; j++) {
|
|
2693
|
-
checkStateGroup(groups[j], name, map);
|
|
2694
|
-
}
|
|
2695
|
-
var fastKeys = Object.getOwnPropertyNames(state.fast);
|
|
2696
|
-
for (var j = 0; j < fastKeys.length; j++) {
|
|
2697
|
-
checkStateGroup(state.fast[fastKeys[j]], name, map);
|
|
2698
|
-
}
|
|
2699
|
-
}
|
|
2700
|
-
|
|
2701
|
-
return new Lexer(map, start)
|
|
2702
|
-
}
|
|
2703
|
-
|
|
2704
|
-
function keywordTransform(map) {
|
|
2705
|
-
var reverseMap = Object.create(null);
|
|
2706
|
-
var byLength = Object.create(null);
|
|
2707
|
-
var types = Object.getOwnPropertyNames(map);
|
|
2708
|
-
for (var i = 0; i < types.length; i++) {
|
|
2709
|
-
var tokenType = types[i];
|
|
2710
|
-
var item = map[tokenType];
|
|
2711
|
-
var keywordList = Array.isArray(item) ? item : [item];
|
|
2712
|
-
keywordList.forEach(function(keyword) {
|
|
2713
|
-
(byLength[keyword.length] = byLength[keyword.length] || []).push(keyword);
|
|
2714
|
-
if (typeof keyword !== 'string') {
|
|
2715
|
-
throw new Error("keyword must be string (in keyword '" + tokenType + "')")
|
|
2716
|
-
}
|
|
2717
|
-
reverseMap[keyword] = tokenType;
|
|
2718
|
-
});
|
|
2719
|
-
}
|
|
2720
|
-
|
|
2721
|
-
// fast string lookup
|
|
2722
|
-
// https://jsperf.com/string-lookups
|
|
2723
|
-
function str(x) { return JSON.stringify(x) }
|
|
2724
|
-
var source = '';
|
|
2725
|
-
source += 'switch (value.length) {\n';
|
|
2726
|
-
for (var length in byLength) {
|
|
2727
|
-
var keywords = byLength[length];
|
|
2728
|
-
source += 'case ' + length + ':\n';
|
|
2729
|
-
source += 'switch (value) {\n';
|
|
2730
|
-
keywords.forEach(function(keyword) {
|
|
2731
|
-
var tokenType = reverseMap[keyword];
|
|
2732
|
-
source += 'case ' + str(keyword) + ': return ' + str(tokenType) + '\n';
|
|
2733
|
-
});
|
|
2734
|
-
source += '}\n';
|
|
2735
|
-
}
|
|
2736
|
-
source += '}\n';
|
|
2737
|
-
return Function('value', source) // type
|
|
2738
|
-
}
|
|
2739
|
-
|
|
2740
|
-
/***************************************************************************/
|
|
2741
|
-
|
|
2742
|
-
var Lexer = function(states, state) {
|
|
2743
|
-
this.startState = state;
|
|
2744
|
-
this.states = states;
|
|
2745
|
-
this.buffer = '';
|
|
2746
|
-
this.stack = [];
|
|
2747
|
-
this.reset();
|
|
2748
|
-
};
|
|
2749
|
-
|
|
2750
|
-
Lexer.prototype.reset = function(data, info) {
|
|
2751
|
-
this.buffer = data || '';
|
|
2752
|
-
this.index = 0;
|
|
2753
|
-
this.line = info ? info.line : 1;
|
|
2754
|
-
this.col = info ? info.col : 1;
|
|
2755
|
-
this.queuedToken = info ? info.queuedToken : null;
|
|
2756
|
-
this.queuedThrow = info ? info.queuedThrow : null;
|
|
2757
|
-
this.setState(info ? info.state : this.startState);
|
|
2758
|
-
this.stack = info && info.stack ? info.stack.slice() : [];
|
|
2759
|
-
return this
|
|
2760
|
-
};
|
|
2761
|
-
|
|
2762
|
-
Lexer.prototype.save = function() {
|
|
2763
|
-
return {
|
|
2764
|
-
line: this.line,
|
|
2765
|
-
col: this.col,
|
|
2766
|
-
state: this.state,
|
|
2767
|
-
stack: this.stack.slice(),
|
|
2768
|
-
queuedToken: this.queuedToken,
|
|
2769
|
-
queuedThrow: this.queuedThrow,
|
|
2770
|
-
}
|
|
2771
|
-
};
|
|
2772
|
-
|
|
2773
|
-
Lexer.prototype.setState = function(state) {
|
|
2774
|
-
if (!state || this.state === state) return
|
|
2775
|
-
this.state = state;
|
|
2776
|
-
var info = this.states[state];
|
|
2777
|
-
this.groups = info.groups;
|
|
2778
|
-
this.error = info.error;
|
|
2779
|
-
this.re = info.regexp;
|
|
2780
|
-
this.fast = info.fast;
|
|
2781
|
-
};
|
|
2782
|
-
|
|
2783
|
-
Lexer.prototype.popState = function() {
|
|
2784
|
-
this.setState(this.stack.pop());
|
|
2785
|
-
};
|
|
2786
|
-
|
|
2787
|
-
Lexer.prototype.pushState = function(state) {
|
|
2788
|
-
this.stack.push(this.state);
|
|
2789
|
-
this.setState(state);
|
|
2790
|
-
};
|
|
2791
|
-
|
|
2792
|
-
var eat = hasSticky ? function(re, buffer) { // assume re is /y
|
|
2793
|
-
return re.exec(buffer)
|
|
2794
|
-
} : function(re, buffer) { // assume re is /g
|
|
2795
|
-
var match = re.exec(buffer);
|
|
2796
|
-
// will always match, since we used the |(?:) trick
|
|
2797
|
-
if (match[0].length === 0) {
|
|
2798
|
-
return null
|
|
2799
|
-
}
|
|
2800
|
-
return match
|
|
2801
|
-
};
|
|
2802
|
-
|
|
2803
|
-
Lexer.prototype._getGroup = function(match) {
|
|
2804
|
-
var groupCount = this.groups.length;
|
|
2805
|
-
for (var i = 0; i < groupCount; i++) {
|
|
2806
|
-
if (match[i + 1] !== undefined) {
|
|
2807
|
-
return this.groups[i]
|
|
2808
|
-
}
|
|
2809
|
-
}
|
|
2810
|
-
throw new Error('Cannot find token type for matched text')
|
|
2811
|
-
};
|
|
2812
|
-
|
|
2813
|
-
function tokenToString() {
|
|
2814
|
-
return this.value
|
|
2815
|
-
}
|
|
2156
|
+
const curry$7 = justCurryIt;
|
|
2816
2157
|
|
|
2817
|
-
Lexer.prototype.next = function() {
|
|
2818
|
-
var index = this.index;
|
|
2819
2158
|
|
|
2820
|
-
|
|
2821
|
-
if (this.queuedGroup) {
|
|
2822
|
-
var token = this._token(this.queuedGroup, this.queuedText, index);
|
|
2823
|
-
this.queuedGroup = null;
|
|
2824
|
-
this.queuedText = "";
|
|
2825
|
-
return token
|
|
2826
|
-
}
|
|
2827
|
-
|
|
2828
|
-
var buffer = this.buffer;
|
|
2829
|
-
if (index === buffer.length) {
|
|
2830
|
-
return // EOF
|
|
2831
|
-
}
|
|
2832
|
-
|
|
2833
|
-
// Fast matching for single characters
|
|
2834
|
-
var group = this.fast[buffer.charCodeAt(index)];
|
|
2835
|
-
if (group) {
|
|
2836
|
-
return this._token(group, buffer.charAt(index), index)
|
|
2837
|
-
}
|
|
2838
|
-
|
|
2839
|
-
// Execute RegExp
|
|
2840
|
-
var re = this.re;
|
|
2841
|
-
re.lastIndex = index;
|
|
2842
|
-
var match = eat(re, buffer);
|
|
2843
|
-
|
|
2844
|
-
// Error tokens match the remaining buffer
|
|
2845
|
-
var error = this.error;
|
|
2846
|
-
if (match == null) {
|
|
2847
|
-
return this._token(error, buffer.slice(index, buffer.length), index)
|
|
2848
|
-
}
|
|
2849
|
-
|
|
2850
|
-
var group = this._getGroup(match);
|
|
2851
|
-
var text = match[0];
|
|
2852
|
-
|
|
2853
|
-
if (error.fallback && match.index !== index) {
|
|
2854
|
-
this.queuedGroup = group;
|
|
2855
|
-
this.queuedText = text;
|
|
2856
|
-
|
|
2857
|
-
// Fallback tokens contain the unmatched portion of the buffer
|
|
2858
|
-
return this._token(error, buffer.slice(index, match.index), index)
|
|
2859
|
-
}
|
|
2860
|
-
|
|
2861
|
-
return this._token(group, text, index)
|
|
2862
|
-
};
|
|
2863
|
-
|
|
2864
|
-
Lexer.prototype._token = function(group, text, offset) {
|
|
2865
|
-
// count line breaks
|
|
2866
|
-
var lineBreaks = 0;
|
|
2867
|
-
if (group.lineBreaks) {
|
|
2868
|
-
var matchNL = /\n/g;
|
|
2869
|
-
var nl = 1;
|
|
2870
|
-
if (text === '\n') {
|
|
2871
|
-
lineBreaks = 1;
|
|
2872
|
-
} else {
|
|
2873
|
-
while (matchNL.exec(text)) { lineBreaks++; nl = matchNL.lastIndex; }
|
|
2874
|
-
}
|
|
2875
|
-
}
|
|
2876
|
-
|
|
2877
|
-
var token = {
|
|
2878
|
-
type: (typeof group.type === 'function' && group.type(text)) || group.defaultType,
|
|
2879
|
-
value: typeof group.value === 'function' ? group.value(text) : text,
|
|
2880
|
-
text: text,
|
|
2881
|
-
toString: tokenToString,
|
|
2882
|
-
offset: offset,
|
|
2883
|
-
lineBreaks: lineBreaks,
|
|
2884
|
-
line: this.line,
|
|
2885
|
-
col: this.col,
|
|
2886
|
-
};
|
|
2887
|
-
// nb. adding more props to token object will make V8 sad!
|
|
2888
|
-
|
|
2889
|
-
var size = text.length;
|
|
2890
|
-
this.index += size;
|
|
2891
|
-
this.line += lineBreaks;
|
|
2892
|
-
if (lineBreaks !== 0) {
|
|
2893
|
-
this.col = size - nl + 1;
|
|
2894
|
-
} else {
|
|
2895
|
-
this.col += size;
|
|
2896
|
-
}
|
|
2897
|
-
|
|
2898
|
-
// throw, if no rule with {error: true}
|
|
2899
|
-
if (group.shouldThrow) {
|
|
2900
|
-
throw new Error(this.formatError(token, "invalid syntax"))
|
|
2901
|
-
}
|
|
2902
|
-
|
|
2903
|
-
if (group.pop) this.popState();
|
|
2904
|
-
else if (group.push) this.pushState(group.push);
|
|
2905
|
-
else if (group.next) this.setState(group.next);
|
|
2906
|
-
|
|
2907
|
-
return token
|
|
2908
|
-
};
|
|
2909
|
-
|
|
2910
|
-
if (typeof Symbol !== 'undefined' && Symbol.iterator) {
|
|
2911
|
-
var LexerIterator = function(lexer) {
|
|
2912
|
-
this.lexer = lexer;
|
|
2913
|
-
};
|
|
2914
|
-
|
|
2915
|
-
LexerIterator.prototype.next = function() {
|
|
2916
|
-
var token = this.lexer.next();
|
|
2917
|
-
return {value: token, done: !token}
|
|
2918
|
-
};
|
|
2919
|
-
|
|
2920
|
-
LexerIterator.prototype[Symbol.iterator] = function() {
|
|
2921
|
-
return this
|
|
2922
|
-
};
|
|
2923
|
-
|
|
2924
|
-
Lexer.prototype[Symbol.iterator] = function() {
|
|
2925
|
-
return new LexerIterator(this)
|
|
2926
|
-
};
|
|
2927
|
-
}
|
|
2928
|
-
|
|
2929
|
-
Lexer.prototype.formatError = function(token, message) {
|
|
2930
|
-
if (token == null) {
|
|
2931
|
-
// An undefined token indicates EOF
|
|
2932
|
-
var text = this.buffer.slice(this.index);
|
|
2933
|
-
var token = {
|
|
2934
|
-
text: text,
|
|
2935
|
-
offset: this.index,
|
|
2936
|
-
lineBreaks: text.indexOf('\n') === -1 ? 0 : 1,
|
|
2937
|
-
line: this.line,
|
|
2938
|
-
col: this.col,
|
|
2939
|
-
};
|
|
2940
|
-
}
|
|
2941
|
-
var start = Math.max(0, token.offset - token.col + 1);
|
|
2942
|
-
var eol = token.lineBreaks ? token.text.indexOf('\n') : token.text.length;
|
|
2943
|
-
var firstLine = this.buffer.substring(start, token.offset + eol);
|
|
2944
|
-
message += " at line " + token.line + " col " + token.col + ":\n\n";
|
|
2945
|
-
message += " " + firstLine + "\n";
|
|
2946
|
-
message += " " + Array(token.col).join(" ") + "^";
|
|
2947
|
-
return message
|
|
2948
|
-
};
|
|
2949
|
-
|
|
2950
|
-
Lexer.prototype.clone = function() {
|
|
2951
|
-
return new Lexer(this.states, this.state)
|
|
2952
|
-
};
|
|
2953
|
-
|
|
2954
|
-
Lexer.prototype.has = function(tokenType) {
|
|
2955
|
-
return true
|
|
2956
|
-
};
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
return {
|
|
2960
|
-
compile: compile,
|
|
2961
|
-
states: compileStates,
|
|
2962
|
-
error: Object.freeze({error: true}),
|
|
2963
|
-
fallback: Object.freeze({fallback: true}),
|
|
2964
|
-
keywords: keywordTransform,
|
|
2965
|
-
}
|
|
2966
|
-
|
|
2967
|
-
}));
|
|
2968
|
-
} (moo$1));
|
|
2969
|
-
|
|
2970
|
-
const moo = moo$1.exports;
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
const digit = `[0-9]`;
|
|
2974
|
-
const digit19 = `[1-9]`;
|
|
2975
|
-
const hexdig = `[0-9a-fA-F]`;
|
|
2976
|
-
|
|
2977
|
-
// String
|
|
2978
|
-
const unescaped = `[\\x20-\\x21\\x23-\\x5b\\x5d-\\u{10ffff}]`;
|
|
2979
|
-
const escape = `\\\\`;
|
|
2980
|
-
const escaped = `${escape}(?:["\\/\\\\brfnt]|u${hexdig}{4})`;
|
|
2981
|
-
const char = `(?:${unescaped}|${escaped})`;
|
|
2982
|
-
const string = `"${char}*"`;
|
|
2983
|
-
|
|
2984
|
-
// Number
|
|
2985
|
-
const int = `(?:0|${digit19}${digit}*)`;
|
|
2986
|
-
const frac = `\\.${digit}+`;
|
|
2987
|
-
const e = `[eE]`;
|
|
2988
|
-
const exp = `${e}[-+]?${digit}+`;
|
|
2989
|
-
const number = `-?${int}(?:${frac})?(?:${exp})?`;
|
|
2990
|
-
|
|
2991
|
-
// Whitespace
|
|
2992
|
-
const whitespace = `(?:(?:\\r?\\n)|[ \\t])+`;
|
|
2993
|
-
|
|
2994
|
-
var lexer = (json) => {
|
|
2995
|
-
const lexer = moo.states({
|
|
2996
|
-
main: {
|
|
2997
|
-
WS: { match: new RegExp(whitespace, "u"), lineBreaks: true },
|
|
2998
|
-
true: { match: "true", value: () => true },
|
|
2999
|
-
false: { match: "false", value: () => false },
|
|
3000
|
-
null: { match: "null", value: () => null },
|
|
3001
|
-
number: { match: new RegExp(number, "u"), value: parseFloat },
|
|
3002
|
-
string: { match: new RegExp(string, "u"), value: JSON.parse },
|
|
3003
|
-
"{": "{",
|
|
3004
|
-
"}": "}",
|
|
3005
|
-
"[": "[",
|
|
3006
|
-
"]": "]",
|
|
3007
|
-
":": ":",
|
|
3008
|
-
",": ",",
|
|
3009
|
-
error: moo.error
|
|
3010
|
-
}
|
|
3011
|
-
});
|
|
3012
|
-
lexer.reset(json);
|
|
3013
|
-
|
|
3014
|
-
const _next = () => {
|
|
3015
|
-
let token;
|
|
3016
|
-
do {
|
|
3017
|
-
token = lexer.next();
|
|
3018
|
-
if (token?.type === "error") {
|
|
3019
|
-
throw SyntaxError(lexer.formatError(token, "Unrecognized token"));
|
|
3020
|
-
}
|
|
3021
|
-
} while (token?.type === "WS");
|
|
3022
|
-
|
|
3023
|
-
return token;
|
|
3024
|
-
};
|
|
3025
|
-
|
|
3026
|
-
let previous;
|
|
3027
|
-
let nextToken = _next();
|
|
3028
|
-
|
|
3029
|
-
const next = (expectedType = undefined) => {
|
|
3030
|
-
previous = nextToken;
|
|
3031
|
-
nextToken = _next();
|
|
3032
|
-
if (expectedType && previous?.type !== expectedType) {
|
|
3033
|
-
throw SyntaxError(lexer.formatError(previous, `Expected a '${expectedType}'`));
|
|
3034
|
-
}
|
|
3035
|
-
return previous;
|
|
3036
|
-
};
|
|
3037
|
-
|
|
3038
|
-
const peek = () => nextToken;
|
|
3039
|
-
|
|
3040
|
-
const defaultErrorToken = { offset: 0, line: 1, col: 0, text: "" };
|
|
3041
|
-
const syntaxError = (message) => {
|
|
3042
|
-
const referenceToken = previous || defaultErrorToken;
|
|
3043
|
-
const errorToken = {
|
|
3044
|
-
...referenceToken,
|
|
3045
|
-
offset: referenceToken.offset + referenceToken.text.length,
|
|
3046
|
-
col: referenceToken.col + referenceToken.text.length
|
|
3047
|
-
};
|
|
3048
|
-
throw new SyntaxError(lexer.formatError(errorToken, message));
|
|
3049
|
-
};
|
|
3050
|
-
|
|
3051
|
-
return { next, peek, syntaxError };
|
|
3052
|
-
};
|
|
3053
|
-
|
|
3054
|
-
const JsonPointer$2 = lib$4;
|
|
3055
|
-
const jsonLexer = lexer;
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
const defaultReviver = (key, value) => value;
|
|
3059
|
-
const parse$3 = (json, reviver = defaultReviver) => {
|
|
3060
|
-
const lexer = jsonLexer(json);
|
|
3061
|
-
const value = parseValue(lexer, "", JsonPointer$2.nil, reviver);
|
|
3062
|
-
|
|
3063
|
-
const token = lexer.peek();
|
|
3064
|
-
if (token) {
|
|
3065
|
-
lexer.syntaxError("A value has been parsed, but more tokens were found");
|
|
3066
|
-
}
|
|
3067
|
-
return value;
|
|
3068
|
-
};
|
|
3069
|
-
|
|
3070
|
-
const parseValue = (lexer, key, pointer, reviver) => {
|
|
3071
|
-
let value;
|
|
3072
|
-
const token = lexer.next();
|
|
3073
|
-
switch (token?.type) {
|
|
3074
|
-
case "true":
|
|
3075
|
-
case "false":
|
|
3076
|
-
case "null":
|
|
3077
|
-
case "number":
|
|
3078
|
-
case "string":
|
|
3079
|
-
value = token.value;
|
|
3080
|
-
break;
|
|
3081
|
-
case "{":
|
|
3082
|
-
value = parseObject(lexer, key, pointer, reviver);
|
|
3083
|
-
break;
|
|
3084
|
-
case "[":
|
|
3085
|
-
value = parseArray(lexer, key, pointer, reviver);
|
|
3086
|
-
break;
|
|
3087
|
-
default:
|
|
3088
|
-
lexer.syntaxError("Expected a JSON value");
|
|
3089
|
-
}
|
|
3090
|
-
|
|
3091
|
-
return reviver(key, value, pointer);
|
|
3092
|
-
};
|
|
3093
|
-
|
|
3094
|
-
const parseObject = (lexer, key, pointer, reviver) => {
|
|
3095
|
-
const value = {};
|
|
3096
|
-
|
|
3097
|
-
if (lexer.peek()?.type !== "}") {
|
|
3098
|
-
parseProperties(lexer, key, pointer, reviver, value);
|
|
3099
|
-
}
|
|
3100
|
-
|
|
3101
|
-
lexer.next("}");
|
|
2159
|
+
var map$3 = curry$7(async (fn, doc) => (await doc).map(fn));
|
|
3102
2160
|
|
|
3103
|
-
|
|
3104
|
-
};
|
|
2161
|
+
const curry$6 = justCurryIt;
|
|
3105
2162
|
|
|
3106
|
-
const parseProperties = (lexer, key, pointer, reviver, value) => {
|
|
3107
|
-
const propertyName = lexer.next("string").value;
|
|
3108
|
-
lexer.next(":");
|
|
3109
|
-
if (!isValueToken(lexer.peek())) {
|
|
3110
|
-
lexer.syntaxError("Expected a JSON value");
|
|
3111
|
-
}
|
|
3112
|
-
value[propertyName] = parseValue(lexer, propertyName, JsonPointer$2.append(propertyName, pointer), reviver);
|
|
3113
2163
|
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
} else if (isValueToken(lexer.peek())) {
|
|
3118
|
-
lexer.next(",");
|
|
3119
|
-
}
|
|
3120
|
-
};
|
|
2164
|
+
var reduce$2 = curry$6(async (fn, acc, doc) => {
|
|
2165
|
+
return (await doc).reduce(async (acc, item) => fn(await acc, item), acc);
|
|
2166
|
+
});
|
|
3121
2167
|
|
|
3122
|
-
const
|
|
3123
|
-
|
|
2168
|
+
const curry$5 = justCurryIt;
|
|
2169
|
+
const reduce$1 = reduce$2;
|
|
3124
2170
|
|
|
3125
|
-
if (lexer.peek()?.type !== "]") {
|
|
3126
|
-
parseItems(lexer, 0, pointer, reviver, value);
|
|
3127
|
-
}
|
|
3128
2171
|
|
|
3129
|
-
|
|
2172
|
+
var filter = curry$5(async (fn, doc, options = {}) => {
|
|
2173
|
+
return reduce$1(async (acc, item) => {
|
|
2174
|
+
return (await fn(item)) ? acc.concat([item]) : acc;
|
|
2175
|
+
}, [], doc, options);
|
|
2176
|
+
});
|
|
3130
2177
|
|
|
3131
|
-
|
|
3132
|
-
|
|
2178
|
+
const curry$4 = justCurryIt;
|
|
2179
|
+
const map$2 = map$3;
|
|
3133
2180
|
|
|
3134
|
-
const parseItems = (lexer, key, pointer, reviver, value) => {
|
|
3135
|
-
if (!isValueToken(lexer.peek())) {
|
|
3136
|
-
lexer.syntaxError("Expected a JSON value");
|
|
3137
|
-
}
|
|
3138
|
-
value[key] = parseValue(lexer, key, JsonPointer$2.append(key, pointer), reviver);
|
|
3139
|
-
if (lexer.peek()?.type === ",") {
|
|
3140
|
-
lexer.next(); // burn comma
|
|
3141
|
-
parseItems(lexer, key + 1, pointer, reviver, value);
|
|
3142
|
-
} else if (isValueToken(lexer.peek())) {
|
|
3143
|
-
lexer.next(",");
|
|
3144
|
-
}
|
|
3145
|
-
};
|
|
3146
2181
|
|
|
3147
|
-
|
|
3148
|
-
const
|
|
2182
|
+
var some = curry$4(async (fn, doc) => {
|
|
2183
|
+
const results = await map$2(fn, doc);
|
|
2184
|
+
return (await Promise.all(results))
|
|
2185
|
+
.some((a) => a);
|
|
2186
|
+
});
|
|
3149
2187
|
|
|
3150
|
-
|
|
2188
|
+
const curry$3 = justCurryIt;
|
|
2189
|
+
const map$1 = map$3;
|
|
3151
2190
|
|
|
3152
|
-
const JsonPointer$1 = lib$4;
|
|
3153
2191
|
|
|
2192
|
+
var every = curry$3(async (fn, doc) => {
|
|
2193
|
+
const results = await map$1(fn, doc);
|
|
2194
|
+
return (await Promise.all(results))
|
|
2195
|
+
.every((a) => a);
|
|
2196
|
+
});
|
|
3154
2197
|
|
|
3155
|
-
const
|
|
3156
|
-
const stringify$2 = (value, replacer = defaultReplacer, space = "") => {
|
|
3157
|
-
return stringifyValue(value, replacer, space, "", JsonPointer$1.nil, 1);
|
|
3158
|
-
};
|
|
2198
|
+
const curry$2 = justCurryIt;
|
|
3159
2199
|
|
|
3160
|
-
const stringifyValue = (value, replacer, space, key, pointer, depth) => {
|
|
3161
|
-
value = replacer(key, value, pointer);
|
|
3162
|
-
let result;
|
|
3163
|
-
if (Array.isArray(value)) {
|
|
3164
|
-
result = stringifyArray(value, replacer, space, pointer, depth);
|
|
3165
|
-
} else if (typeof value === "object" && value !== null) {
|
|
3166
|
-
result = stringifyObject(value, replacer, space, pointer, depth);
|
|
3167
|
-
} else {
|
|
3168
|
-
result = JSON.stringify(value);
|
|
3169
|
-
}
|
|
3170
2200
|
|
|
3171
|
-
|
|
3172
|
-
|
|
2201
|
+
var pipeline$1 = curry$2((fns, doc) => {
|
|
2202
|
+
return fns.reduce(async (acc, fn) => fn(await acc), doc);
|
|
2203
|
+
});
|
|
3173
2204
|
|
|
3174
|
-
|
|
3175
|
-
if (value.length === 0) {
|
|
3176
|
-
space = "";
|
|
3177
|
-
}
|
|
3178
|
-
const padding = space ? `\n${space.repeat(depth - 1)}` : "";
|
|
3179
|
-
return "[" + padding + space + value
|
|
3180
|
-
.map((item, index) => {
|
|
3181
|
-
const indexPointer = JsonPointer$1.append(index, pointer);
|
|
3182
|
-
return stringifyValue(item, replacer, space, index, indexPointer, depth + 1);
|
|
3183
|
-
})
|
|
3184
|
-
.join(`,${padding}${space}`) + padding + "]";
|
|
3185
|
-
};
|
|
3186
|
-
|
|
3187
|
-
const stringifyObject = (value, replacer, space, pointer, depth) => {
|
|
3188
|
-
if (Object.keys(value).length === 0) {
|
|
3189
|
-
space = "";
|
|
3190
|
-
}
|
|
3191
|
-
const padding = space ? `\n${space.repeat(depth - 1)}` : "";
|
|
3192
|
-
const spacing = space ? " " : "";
|
|
3193
|
-
return "{" + padding + space + Object.entries(value)
|
|
3194
|
-
.map(([key, value]) => {
|
|
3195
|
-
const keyPointer = JsonPointer$1.append(key, pointer);
|
|
3196
|
-
return JSON.stringify(key) + ":" + spacing + stringifyValue(value, replacer, space, key, keyPointer, depth + 1);
|
|
3197
|
-
})
|
|
3198
|
-
.join(`,${padding}${space}`) + padding + "}";
|
|
3199
|
-
};
|
|
2205
|
+
var all = (doc) => Promise.all(doc);
|
|
3200
2206
|
|
|
3201
|
-
|
|
2207
|
+
const pipeline = pipeline$1;
|
|
2208
|
+
const entries$1 = entries$2;
|
|
2209
|
+
const reduce = reduce$2;
|
|
3202
2210
|
|
|
3203
|
-
const parse$2 = parse_1;
|
|
3204
|
-
const stringify$1 = stringify_1;
|
|
3205
2211
|
|
|
2212
|
+
var allValues = (doc) => {
|
|
2213
|
+
return pipeline([
|
|
2214
|
+
entries$1,
|
|
2215
|
+
reduce(async (acc, [propertyName, propertyValue]) => {
|
|
2216
|
+
acc[propertyName] = await propertyValue;
|
|
2217
|
+
return acc;
|
|
2218
|
+
}, {})
|
|
2219
|
+
], doc);
|
|
2220
|
+
};
|
|
3206
2221
|
|
|
3207
|
-
var lib$
|
|
2222
|
+
var lib$2 = {
|
|
2223
|
+
entries: entries$2,
|
|
2224
|
+
map: map$3,
|
|
2225
|
+
filter: filter,
|
|
2226
|
+
reduce: reduce$2,
|
|
2227
|
+
some: some,
|
|
2228
|
+
every: every,
|
|
2229
|
+
pipeline: pipeline$1,
|
|
2230
|
+
all: all,
|
|
2231
|
+
allValues: allValues
|
|
2232
|
+
};
|
|
3208
2233
|
|
|
3209
2234
|
var fetch_browser = fetch;
|
|
3210
2235
|
|
|
@@ -3460,10 +2485,9 @@ const getContentType = (path) => {
|
|
|
3460
2485
|
|
|
3461
2486
|
var mediaTypes = { addPlugin, parse, getContentType };
|
|
3462
2487
|
|
|
3463
|
-
const curry$
|
|
3464
|
-
const Pact$a = lib$
|
|
3465
|
-
const
|
|
3466
|
-
const JsonPointer = lib$6;
|
|
2488
|
+
const curry$1 = justCurryIt$1;
|
|
2489
|
+
const Pact$a = lib$2;
|
|
2490
|
+
const JsonPointer = lib$3;
|
|
3467
2491
|
const { jsonTypeOf, resolveUrl: resolveUrl$1, urlFragment, pathRelative } = common$1;
|
|
3468
2492
|
const fetch$1 = fetch_browser;
|
|
3469
2493
|
const Reference$1 = reference;
|
|
@@ -3494,61 +2518,64 @@ const getConfig = (dialectId, key) => {
|
|
|
3494
2518
|
// Schema Management
|
|
3495
2519
|
const schemaStore = {};
|
|
3496
2520
|
const schemaStoreAlias = {};
|
|
3497
|
-
const add$1 = (schema, retrievalUri = "", defaultDialectId = "") => {
|
|
3498
|
-
const dialectId = getDialectId(schema, retrievalUri, defaultDialectId);
|
|
3499
|
-
|
|
3500
|
-
const id = getBaseUri(schema, retrievalUri, dialectJsonSchemaVersion[dialectId]);
|
|
3501
|
-
|
|
3502
|
-
// Extract embedded schemas and collect anchors
|
|
3503
|
-
const embeddedToken = getConfig(dialectId, "embeddedToken");
|
|
3504
|
-
const baseToken = getConfig(dialectId, "baseToken");
|
|
3505
|
-
const anchorToken = getConfig(dialectId, "anchorToken");
|
|
3506
|
-
const dynamicAnchorToken = getConfig(dialectId, "dynamicAnchorToken");
|
|
3507
|
-
const jrefToken = getConfig(dialectId, "jrefToken");
|
|
3508
|
-
|
|
3509
|
-
const dynamicAnchors = {};
|
|
3510
|
-
const anchors = { "": "" };
|
|
3511
|
-
|
|
3512
|
-
schema = Json.parse(JSON.stringify(schema), (key, value, pointer) => {
|
|
3513
|
-
if (jsonTypeOf(value, "object")) {
|
|
3514
|
-
// Embedded Schema
|
|
3515
|
-
const embeddedSchemaDialectId = typeof value.$schema === "string" ? resolveUrl$1(value.$schema, "") : dialectId;
|
|
3516
|
-
const embeddedEmbeddedToken = getConfig(embeddedSchemaDialectId, "embeddedToken");
|
|
3517
|
-
const embeddedAnchorToken = getConfig(embeddedSchemaDialectId, "anchorToken");
|
|
3518
|
-
if (typeof value[embeddedEmbeddedToken] === "string" && (embeddedEmbeddedToken !== embeddedAnchorToken || value[embeddedEmbeddedToken][0] !== "#") && pointer !== "") {
|
|
3519
|
-
const embeddedRetrievalUri = resolveUrl$1(id, value[embeddedEmbeddedToken]);
|
|
3520
|
-
add$1(value, embeddedRetrievalUri, dialectId);
|
|
3521
|
-
return Reference$1.cons(value[embeddedEmbeddedToken], value);
|
|
3522
|
-
}
|
|
3523
2521
|
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
2522
|
+
const add$1 = (schema, url = "", defaultSchemaVersion = "") => {
|
|
2523
|
+
schema = JSON.parse(JSON.stringify(schema));
|
|
2524
|
+
const externalId = resolveUrl$1(url, "");
|
|
3527
2525
|
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
2526
|
+
// Dialect / JSON Schema Version
|
|
2527
|
+
const dialectId = resolveUrl$1(schema["$schema"] || defaultSchemaVersion, "");
|
|
2528
|
+
if (!dialectId) {
|
|
2529
|
+
throw Error("Couldn't determine schema dialect");
|
|
2530
|
+
}
|
|
2531
|
+
delete schema["$schema"];
|
|
3533
2532
|
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
2533
|
+
// Determine JSON Schema version
|
|
2534
|
+
if (!(dialectId in dialectJsonSchemaVersion)) {
|
|
2535
|
+
if (schema?.$vocabulary?.[core201909Id] === true && dialectId === getSchemaIdentifier(schema, externalId, core201909Id)[0]) {
|
|
2536
|
+
// Self describing 2019-09 meta-schema
|
|
2537
|
+
dialectJsonSchemaVersion[dialectId] = core201909Id;
|
|
2538
|
+
} else if (schema?.$vocabulary?.[core202012Id] === true && dialectId === getSchemaIdentifier(schema, externalId, core202012Id)[0]) {
|
|
2539
|
+
// Self describing 2020-12 meta-schema
|
|
2540
|
+
dialectJsonSchemaVersion[dialectId] = core202012Id;
|
|
2541
|
+
} else {
|
|
2542
|
+
// Need to look at meta-schema to determine version
|
|
2543
|
+
const metaSchema = schemaStore[dialectId];
|
|
2544
|
+
if (!metaSchema) {
|
|
2545
|
+
throw Error(`Couldn't determine JSON Schema version for dialect: '${dialectId}'`);
|
|
2546
|
+
} else if (metaSchema.vocabulary[core201909Id] === true) {
|
|
2547
|
+
dialectJsonSchemaVersion[dialectId] = core201909Id;
|
|
2548
|
+
} else if (metaSchema.vocabulary[core202012Id] === true) {
|
|
2549
|
+
dialectJsonSchemaVersion[dialectId] = core202012Id;
|
|
2550
|
+
} else {
|
|
2551
|
+
// Assume the jsonSchemaVersion is the meta-schema's dialectId (non-standard behavior)
|
|
2552
|
+
dialectJsonSchemaVersion[dialectId] = dialectJsonSchemaVersion[metaSchema.dialectId];
|
|
3538
2553
|
}
|
|
3539
2554
|
}
|
|
2555
|
+
}
|
|
3540
2556
|
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
2557
|
+
// Internal Identifier
|
|
2558
|
+
const [id, fragment] = getSchemaIdentifier(schema, externalId, dialectJsonSchemaVersion[dialectId]);
|
|
2559
|
+
if (!id) {
|
|
2560
|
+
throw Error("Couldn't determine an identifier for the schema");
|
|
2561
|
+
}
|
|
2562
|
+
const baseToken = getConfig(dialectId, "baseToken");
|
|
3546
2563
|
delete schema[baseToken];
|
|
2564
|
+
if (externalId) {
|
|
2565
|
+
schemaStoreAlias[externalId] = id;
|
|
2566
|
+
}
|
|
2567
|
+
|
|
2568
|
+
const anchorToken = getConfig(dialectId, "anchorToken");
|
|
2569
|
+
if (fragment && baseToken === anchorToken) {
|
|
2570
|
+
schema[anchorToken] = anchorToken !== baseToken ? encodeURI(fragment) : `#${encodeURI(fragment)}`;
|
|
2571
|
+
}
|
|
3547
2572
|
|
|
3548
2573
|
// recursiveAnchor
|
|
2574
|
+
const dynamicAnchors = {};
|
|
3549
2575
|
const recursiveAnchorToken = getConfig(dialectId, "recursiveAnchorToken");
|
|
3550
2576
|
if (schema[recursiveAnchorToken] === true) {
|
|
3551
2577
|
dynamicAnchors[""] = `${id}#`;
|
|
2578
|
+
schema[anchorToken] = "";
|
|
3552
2579
|
delete schema[recursiveAnchorToken];
|
|
3553
2580
|
}
|
|
3554
2581
|
|
|
@@ -3563,66 +2590,69 @@ const add$1 = (schema, retrievalUri = "", defaultDialectId = "") => {
|
|
|
3563
2590
|
}
|
|
3564
2591
|
|
|
3565
2592
|
// Store Schema
|
|
2593
|
+
const anchors = { "": "" };
|
|
3566
2594
|
schemaStore[id] = {
|
|
3567
|
-
id,
|
|
3568
|
-
dialectId,
|
|
3569
|
-
schema,
|
|
3570
|
-
anchors,
|
|
3571
|
-
dynamicAnchors,
|
|
3572
|
-
vocabulary,
|
|
2595
|
+
id: id,
|
|
2596
|
+
dialectId: dialectId,
|
|
2597
|
+
schema: processSchema(schema, id, dialectId, JsonPointer.nil, anchors, dynamicAnchors),
|
|
2598
|
+
anchors: anchors,
|
|
2599
|
+
dynamicAnchors: dynamicAnchors,
|
|
2600
|
+
vocabulary: vocabulary,
|
|
3573
2601
|
validated: false
|
|
3574
2602
|
};
|
|
3575
|
-
if (id === "https://example.com/schema/root") {
|
|
3576
|
-
console.log(Object.keys(schemaStore).filter((id) => !/json-schema\.org/.test(id)));
|
|
3577
|
-
}
|
|
3578
2603
|
|
|
3579
|
-
|
|
3580
|
-
schemaStoreAlias[resolveUrl$1(retrievalUri, "")] = id;
|
|
3581
|
-
}
|
|
2604
|
+
return id;
|
|
3582
2605
|
};
|
|
3583
2606
|
|
|
3584
|
-
const
|
|
3585
|
-
const
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
2607
|
+
const getSchemaIdentifier = (schema, externalId, jsonSchemaVersion) => {
|
|
2608
|
+
const baseToken = config[jsonSchemaVersion]?.["baseToken"];
|
|
2609
|
+
const internalUrl = resolveUrl$1(externalId, schema[baseToken] || "");
|
|
2610
|
+
return [resolveUrl$1(internalUrl, ""), urlFragment(internalUrl)];
|
|
2611
|
+
};
|
|
2612
|
+
|
|
2613
|
+
const processSchema = (subject, id, dialectId, pointer, anchors, dynamicAnchors) => {
|
|
2614
|
+
if (jsonTypeOf(subject, "object")) {
|
|
2615
|
+
const embeddedSchemaDialectId = typeof subject.$schema === "string" ? resolveUrl$1(subject.$schema, "") : dialectId;
|
|
2616
|
+
const embeddedEmbeddedToken = getConfig(embeddedSchemaDialectId, "embeddedToken");
|
|
2617
|
+
const embeddedAnchorToken = getConfig(embeddedSchemaDialectId, "anchorToken");
|
|
2618
|
+
if (typeof subject[embeddedEmbeddedToken] === "string" && (embeddedEmbeddedToken !== embeddedAnchorToken || subject[embeddedEmbeddedToken][0] !== "#")) {
|
|
2619
|
+
const ref = resolveUrl$1(id, subject[embeddedEmbeddedToken]);
|
|
2620
|
+
const embeddedBaseToken = getConfig(embeddedSchemaDialectId, "baseToken");
|
|
2621
|
+
subject[embeddedBaseToken] = ref;
|
|
2622
|
+
add$1(subject, ref, dialectId);
|
|
2623
|
+
return Reference$1.cons(subject[embeddedEmbeddedToken], subject);
|
|
2624
|
+
}
|
|
3589
2625
|
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
if (
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
// Self describing 2020-12 meta-schema
|
|
3597
|
-
dialectJsonSchemaVersion[dialectId] = core202012Id;
|
|
3598
|
-
} else {
|
|
3599
|
-
// Need to look at meta-schema to determine version
|
|
3600
|
-
const metaSchema = schemaStore[dialectId];
|
|
3601
|
-
if (!metaSchema) {
|
|
3602
|
-
throw Error(`Couldn't determine JSON Schema version for dialect: '${dialectId}'`);
|
|
3603
|
-
} else if (metaSchema.vocabulary[core201909Id] === true) {
|
|
3604
|
-
dialectJsonSchemaVersion[dialectId] = core201909Id;
|
|
3605
|
-
} else if (metaSchema.vocabulary[core202012Id] === true) {
|
|
3606
|
-
dialectJsonSchemaVersion[dialectId] = core202012Id;
|
|
3607
|
-
} else {
|
|
3608
|
-
// Assume the jsonSchemaVersion is the meta-schema's dialectId (non-standard behavior)
|
|
3609
|
-
dialectJsonSchemaVersion[dialectId] = dialectJsonSchemaVersion[metaSchema.dialectId];
|
|
3610
|
-
}
|
|
2626
|
+
const anchorToken = getConfig(dialectId, "anchorToken");
|
|
2627
|
+
const dynamicAnchorToken = getConfig(dialectId, "dynamicAnchorToken");
|
|
2628
|
+
if (typeof subject[dynamicAnchorToken] === "string") {
|
|
2629
|
+
dynamicAnchors[subject[dynamicAnchorToken]] = `${id}#${encodeURI(pointer)}`;
|
|
2630
|
+
anchors[subject[dynamicAnchorToken]] = pointer;
|
|
2631
|
+
delete subject[dynamicAnchorToken];
|
|
3611
2632
|
}
|
|
3612
|
-
}
|
|
3613
2633
|
|
|
3614
|
-
|
|
3615
|
-
|
|
2634
|
+
const embeddedToken = getConfig(dialectId, "embeddedToken");
|
|
2635
|
+
if (typeof subject[anchorToken] === "string") {
|
|
2636
|
+
const anchor = anchorToken !== embeddedToken ? subject[anchorToken] : subject[anchorToken].slice(1);
|
|
2637
|
+
anchors[anchor] = pointer;
|
|
2638
|
+
delete subject[anchorToken];
|
|
2639
|
+
}
|
|
3616
2640
|
|
|
3617
|
-
const
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
if (!baseUri) {
|
|
3622
|
-
throw Error("Couldn't determine an identifier for the schema");
|
|
3623
|
-
}
|
|
2641
|
+
const jrefToken = getConfig(dialectId, "jrefToken");
|
|
2642
|
+
if (typeof subject[jrefToken] === "string") {
|
|
2643
|
+
return Reference$1.cons(subject[jrefToken], subject);
|
|
2644
|
+
}
|
|
3624
2645
|
|
|
3625
|
-
|
|
2646
|
+
for (const key in subject) {
|
|
2647
|
+
subject[key] = processSchema(subject[key], id, dialectId, JsonPointer.append(key, pointer), anchors, dynamicAnchors);
|
|
2648
|
+
}
|
|
2649
|
+
|
|
2650
|
+
return subject;
|
|
2651
|
+
} else if (Array.isArray(subject)) {
|
|
2652
|
+
return subject.map((item, ndx) => processSchema(item, id, dialectId, JsonPointer.append(ndx, pointer), anchors, dynamicAnchors));
|
|
2653
|
+
} else {
|
|
2654
|
+
return subject;
|
|
2655
|
+
}
|
|
3626
2656
|
};
|
|
3627
2657
|
|
|
3628
2658
|
const hasStoredSchema = (id) => id in schemaStore || id in schemaStoreAlias;
|
|
@@ -3716,14 +2746,14 @@ const step = (key, doc) => {
|
|
|
3716
2746
|
|
|
3717
2747
|
const keys = (doc) => Object.keys(value(doc));
|
|
3718
2748
|
|
|
3719
|
-
const entries
|
|
2749
|
+
const entries = (doc) => Pact$a.pipeline([
|
|
3720
2750
|
value,
|
|
3721
2751
|
Object.keys,
|
|
3722
2752
|
Pact$a.map(async (key) => [key, await step(key, doc)]),
|
|
3723
2753
|
Pact$a.all
|
|
3724
2754
|
], doc);
|
|
3725
2755
|
|
|
3726
|
-
const map
|
|
2756
|
+
const map = curry$1((fn, doc) => Pact$a.pipeline([
|
|
3727
2757
|
value,
|
|
3728
2758
|
Pact$a.map(async (item, ndx) => fn(await step(ndx, doc), ndx)),
|
|
3729
2759
|
Pact$a.all
|
|
@@ -3739,43 +2769,36 @@ const toSchemaDefaultOptions = {
|
|
|
3739
2769
|
const toSchema = (schemaDoc, options = {}) => {
|
|
3740
2770
|
const fullOptions = { ...toSchemaDefaultOptions, ...options };
|
|
3741
2771
|
|
|
3742
|
-
const
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
const anchors = {};
|
|
3746
|
-
for (const anchor in schemaDoc.anchors) {
|
|
3747
|
-
if (anchor !== "" && !schemaDoc.dynamicAnchors[anchor]) {
|
|
3748
|
-
anchors[schemaDoc.anchors[anchor]] = anchor;
|
|
2772
|
+
const schema = JSON.parse(JSON.stringify(schemaDoc.schema, (key, value) => {
|
|
2773
|
+
if (!Reference$1.isReference(value)) {
|
|
2774
|
+
return value;
|
|
3749
2775
|
}
|
|
3750
|
-
}
|
|
3751
|
-
|
|
3752
|
-
const dynamicAnchors = {};
|
|
3753
|
-
for (const anchor in schemaDoc.dynamicAnchors) {
|
|
3754
|
-
const pointer = urlFragment(schemaDoc.dynamicAnchors[anchor]);
|
|
3755
|
-
dynamicAnchors[pointer] = anchor;
|
|
3756
|
-
}
|
|
3757
2776
|
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
if (!fullOptions.includeEmbedded && embeddedToken in refValue) {
|
|
3764
|
-
return;
|
|
3765
|
-
} else {
|
|
3766
|
-
return Reference$1.value(value);
|
|
3767
|
-
}
|
|
2777
|
+
const refValue = Reference$1.value(value);
|
|
2778
|
+
const embeddedDialect = typeof refValue.$schema === "string" ? resolveUrl$1(refValue.$schema, "") : schemaDoc.dialectId;
|
|
2779
|
+
const embeddedToken = getConfig(embeddedDialect, "embeddedToken");
|
|
2780
|
+
if (!fullOptions.includeEmbedded && embeddedToken in refValue) {
|
|
2781
|
+
return;
|
|
3768
2782
|
} else {
|
|
3769
|
-
|
|
3770
|
-
value = { [anchorToken]: anchors[pointer], ...value };
|
|
3771
|
-
}
|
|
3772
|
-
if (pointer in dynamicAnchors) {
|
|
3773
|
-
value = { [dynamicAnchorToken]: dynamicAnchors[pointer], ...value };
|
|
3774
|
-
}
|
|
3775
|
-
return value;
|
|
2783
|
+
return Reference$1.value(value);
|
|
3776
2784
|
}
|
|
3777
2785
|
}));
|
|
3778
2786
|
|
|
2787
|
+
const dynamicAnchorToken = getConfig(schemaDoc.dialectId, "dynamicAnchorToken");
|
|
2788
|
+
Object.entries(schemaDoc.dynamicAnchors)
|
|
2789
|
+
.forEach(([anchor, uri]) => {
|
|
2790
|
+
const pointer = JsonPointer.append(dynamicAnchorToken, urlFragment(uri));
|
|
2791
|
+
JsonPointer.assign(pointer, schema, anchor);
|
|
2792
|
+
});
|
|
2793
|
+
|
|
2794
|
+
const anchorToken = getConfig(schemaDoc.dialectId, "anchorToken");
|
|
2795
|
+
Object.entries(schemaDoc.anchors)
|
|
2796
|
+
.filter(([anchor]) => anchor !== "" && !(anchor in schemaDoc.dynamicAnchors))
|
|
2797
|
+
.forEach(([anchor, pointer]) => {
|
|
2798
|
+
const anchorPointer = JsonPointer.append(anchorToken, pointer);
|
|
2799
|
+
JsonPointer.assign(anchorPointer, schema, anchor);
|
|
2800
|
+
});
|
|
2801
|
+
|
|
3779
2802
|
const baseToken = getConfig(schemaDoc.dialectId, "baseToken");
|
|
3780
2803
|
const id = relativeUri(fullOptions.parentId, schemaDoc.id);
|
|
3781
2804
|
const dialect = fullOptions.parentDialect === schemaDoc.dialectId ? "" : schemaDoc.dialectId;
|
|
@@ -3798,7 +2821,7 @@ const relativeUri = (from, to) => {
|
|
|
3798
2821
|
var schema$5 = {
|
|
3799
2822
|
setConfig, getConfig,
|
|
3800
2823
|
add: add$1, get, markValidated,
|
|
3801
|
-
uri, value, getAnchorPointer, typeOf, has, step, keys, entries
|
|
2824
|
+
uri, value, getAnchorPointer, typeOf, has, step, keys, entries, map, length,
|
|
3802
2825
|
toSchema
|
|
3803
2826
|
};
|
|
3804
2827
|
|
|
@@ -3812,19 +2835,19 @@ class InvalidSchemaError$3 extends Error {
|
|
|
3812
2835
|
|
|
3813
2836
|
var invalidSchemaError = InvalidSchemaError$3;
|
|
3814
2837
|
|
|
3815
|
-
const Schema$
|
|
2838
|
+
const Schema$P = schema$5;
|
|
3816
2839
|
|
|
3817
2840
|
|
|
3818
|
-
const compile$
|
|
3819
|
-
const interpret$
|
|
2841
|
+
const compile$M = (schema) => Schema$P.value(schema);
|
|
2842
|
+
const interpret$M = () => true;
|
|
3820
2843
|
|
|
3821
|
-
var metaData$4 = { compile: compile$
|
|
2844
|
+
var metaData$4 = { compile: compile$M, interpret: interpret$M };
|
|
3822
2845
|
|
|
3823
|
-
const curry
|
|
2846
|
+
const curry = justCurryIt$1;
|
|
3824
2847
|
const PubSub$1 = pubsub.exports;
|
|
3825
2848
|
const { resolveUrl } = common$1;
|
|
3826
|
-
const Instance$
|
|
3827
|
-
const Schema$
|
|
2849
|
+
const Instance$C = instance;
|
|
2850
|
+
const Schema$O = schema$5;
|
|
3828
2851
|
const InvalidSchemaError$2 = invalidSchemaError;
|
|
3829
2852
|
const MediaTypes = mediaTypes;
|
|
3830
2853
|
const metaData$3 = metaData$4;
|
|
@@ -3844,19 +2867,19 @@ MediaTypes.addPlugin("application/schema+json", {
|
|
|
3844
2867
|
});
|
|
3845
2868
|
|
|
3846
2869
|
const validate$2 = async (schema, value = undefined, outputFormat = undefined) => {
|
|
3847
|
-
const compiled = await compile$
|
|
3848
|
-
const interpretAst = (value, outputFormat) => interpret$
|
|
2870
|
+
const compiled = await compile$L(schema);
|
|
2871
|
+
const interpretAst = (value, outputFormat) => interpret$L(compiled, Instance$C.cons(value), outputFormat);
|
|
3849
2872
|
|
|
3850
2873
|
return value === undefined ? interpretAst : interpretAst(value, outputFormat);
|
|
3851
2874
|
};
|
|
3852
2875
|
|
|
3853
|
-
const compile$
|
|
2876
|
+
const compile$L = async (schema) => {
|
|
3854
2877
|
const ast = { metaData: {} };
|
|
3855
2878
|
const schemaUri = await compileSchema(schema, ast);
|
|
3856
2879
|
return { ast, schemaUri };
|
|
3857
2880
|
};
|
|
3858
2881
|
|
|
3859
|
-
const interpret$
|
|
2882
|
+
const interpret$L = curry(({ ast, schemaUri }, value, outputFormat = FLAG) => {
|
|
3860
2883
|
if (![FLAG, BASIC, DETAILED, VERBOSE].includes(outputFormat)) {
|
|
3861
2884
|
throw Error(`The '${outputFormat}' error format is not supported`);
|
|
3862
2885
|
}
|
|
@@ -3931,10 +2954,10 @@ const compileSchema = async (schema, ast) => {
|
|
|
3931
2954
|
|
|
3932
2955
|
// Vocabularies
|
|
3933
2956
|
if (!hasKeyword(`${schema.dialectId}#validate`)) {
|
|
3934
|
-
const metaSchema = await Schema$
|
|
2957
|
+
const metaSchema = await Schema$O.get(schema.dialectId);
|
|
3935
2958
|
|
|
3936
2959
|
// Check for mandatory vocabularies
|
|
3937
|
-
const mandatoryVocabularies = Schema$
|
|
2960
|
+
const mandatoryVocabularies = Schema$O.getConfig(metaSchema.id, "mandatoryVocabularies") || [];
|
|
3938
2961
|
mandatoryVocabularies.forEach((vocabularyId) => {
|
|
3939
2962
|
if (!metaSchema.vocabulary[vocabularyId]) {
|
|
3940
2963
|
throw Error(`Vocabulary '${vocabularyId}' must be explicitly declared and required`);
|
|
@@ -3957,17 +2980,17 @@ const compileSchema = async (schema, ast) => {
|
|
|
3957
2980
|
|
|
3958
2981
|
// Meta validation
|
|
3959
2982
|
if (shouldMetaValidate && !schema.validated) {
|
|
3960
|
-
Schema$
|
|
2983
|
+
Schema$O.markValidated(schema.id);
|
|
3961
2984
|
|
|
3962
2985
|
// Compile
|
|
3963
2986
|
if (!(schema.dialectId in metaValidators)) {
|
|
3964
|
-
const metaSchema = await Schema$
|
|
3965
|
-
const compiledSchema = await compile$
|
|
3966
|
-
metaValidators[metaSchema.id] = interpret$
|
|
2987
|
+
const metaSchema = await Schema$O.get(schema.dialectId);
|
|
2988
|
+
const compiledSchema = await compile$L(metaSchema);
|
|
2989
|
+
metaValidators[metaSchema.id] = interpret$L(compiledSchema);
|
|
3967
2990
|
}
|
|
3968
2991
|
|
|
3969
2992
|
// Interpret
|
|
3970
|
-
const schemaInstance = Instance$
|
|
2993
|
+
const schemaInstance = Instance$C.cons(schema.schema, schema.id);
|
|
3971
2994
|
const metaResults = metaValidators[schema.dialectId](schemaInstance, metaOutputFormat);
|
|
3972
2995
|
if (!metaResults.valid) {
|
|
3973
2996
|
throw new InvalidSchemaError$2(metaResults);
|
|
@@ -3986,7 +3009,7 @@ const compileSchema = async (schema, ast) => {
|
|
|
3986
3009
|
};
|
|
3987
3010
|
|
|
3988
3011
|
const followReferences = async (doc) => {
|
|
3989
|
-
return Schema$
|
|
3012
|
+
return Schema$O.typeOf(doc, "string") ? followReferences(await Schema$O.get(Schema$O.value(doc), doc)) : doc;
|
|
3990
3013
|
};
|
|
3991
3014
|
|
|
3992
3015
|
const interpretSchema = (schemaUri, instance, ast, dynamicAnchors) => {
|
|
@@ -4014,45 +3037,45 @@ const getKeywordId = (schemaUri, ast) => {
|
|
|
4014
3037
|
};
|
|
4015
3038
|
|
|
4016
3039
|
const add = (schema, url = "", defaultSchemaVersion = "") => {
|
|
4017
|
-
const id = Schema$
|
|
3040
|
+
const id = Schema$O.add(schema, url, defaultSchemaVersion);
|
|
4018
3041
|
delete metaValidators[id];
|
|
4019
3042
|
};
|
|
4020
3043
|
|
|
4021
3044
|
var core$2 = {
|
|
4022
|
-
validate: validate$2, compile: compile$
|
|
3045
|
+
validate: validate$2, compile: compile$L, interpret: interpret$L,
|
|
4023
3046
|
setMetaOutputFormat, setShouldMetaValidate, FLAG, BASIC, DETAILED, VERBOSE,
|
|
4024
3047
|
add, getKeyword, hasKeyword, defineVocabulary,
|
|
4025
3048
|
compileSchema, interpretSchema, collectEvaluatedProperties: collectEvaluatedProperties$e, collectEvaluatedItems: collectEvaluatedItems$f,
|
|
4026
3049
|
addMediaTypePlugin: MediaTypes.addPlugin
|
|
4027
3050
|
};
|
|
4028
3051
|
|
|
4029
|
-
const Pact$9 = lib$
|
|
3052
|
+
const Pact$9 = lib$2;
|
|
4030
3053
|
const PubSub = pubsub.exports;
|
|
4031
3054
|
const Core$x = core$2;
|
|
4032
|
-
const Instance$
|
|
4033
|
-
const Schema$
|
|
3055
|
+
const Instance$B = instance;
|
|
3056
|
+
const Schema$N = schema$5;
|
|
4034
3057
|
|
|
4035
3058
|
|
|
4036
|
-
const compile$
|
|
4037
|
-
const url = Schema$
|
|
3059
|
+
const compile$K = async (schema, ast) => {
|
|
3060
|
+
const url = Schema$N.uri(schema);
|
|
4038
3061
|
if (!(url in ast)) {
|
|
4039
3062
|
ast[url] = false; // Place dummy entry in ast to avoid recursive loops
|
|
4040
3063
|
|
|
4041
|
-
const schemaValue = Schema$
|
|
3064
|
+
const schemaValue = Schema$N.value(schema);
|
|
4042
3065
|
if (!["object", "boolean"].includes(typeof schemaValue)) {
|
|
4043
|
-
throw Error(`No schema found at '${Schema$
|
|
3066
|
+
throw Error(`No schema found at '${Schema$N.uri(schema)}'`);
|
|
4044
3067
|
}
|
|
4045
3068
|
|
|
4046
3069
|
ast[url] = [
|
|
4047
3070
|
`${schema.dialectId}#validate`,
|
|
4048
|
-
Schema$
|
|
3071
|
+
Schema$N.uri(schema),
|
|
4049
3072
|
typeof schemaValue === "boolean" ? schemaValue : await Pact$9.pipeline([
|
|
4050
|
-
Schema$
|
|
3073
|
+
Schema$N.entries,
|
|
4051
3074
|
Pact$9.map(([keyword, keywordSchema]) => [`${schema.dialectId}#${keyword}`, keywordSchema]),
|
|
4052
3075
|
Pact$9.filter(([keywordId]) => keywordId !== `${schema.dialectId}#validate`),
|
|
4053
3076
|
Pact$9.map(async ([keywordId, keywordSchema]) => {
|
|
4054
3077
|
const keywordAst = await Core$x.getKeyword(keywordId).compile(keywordSchema, ast, schema);
|
|
4055
|
-
return [keywordId, Schema$
|
|
3078
|
+
return [keywordId, Schema$N.uri(keywordSchema), keywordAst];
|
|
4056
3079
|
}),
|
|
4057
3080
|
Pact$9.all
|
|
4058
3081
|
], schema)
|
|
@@ -4062,7 +3085,7 @@ const compile$M = async (schema, ast) => {
|
|
|
4062
3085
|
return url;
|
|
4063
3086
|
};
|
|
4064
3087
|
|
|
4065
|
-
const interpret$
|
|
3088
|
+
const interpret$K = (uri, instance, ast, dynamicAnchors) => {
|
|
4066
3089
|
const [keywordId, schemaUrl, nodes] = ast[uri];
|
|
4067
3090
|
|
|
4068
3091
|
PubSub.publishSync("result.start");
|
|
@@ -4074,7 +3097,7 @@ const interpret$M = (uri, instance, ast, dynamicAnchors) => {
|
|
|
4074
3097
|
PubSub.publishSync("result", {
|
|
4075
3098
|
keyword: keywordId,
|
|
4076
3099
|
absoluteKeywordLocation: schemaUrl,
|
|
4077
|
-
instanceLocation: Instance$
|
|
3100
|
+
instanceLocation: Instance$B.uri(instance),
|
|
4078
3101
|
valid: isValid,
|
|
4079
3102
|
ast: keywordValue
|
|
4080
3103
|
});
|
|
@@ -4085,7 +3108,7 @@ const interpret$M = (uri, instance, ast, dynamicAnchors) => {
|
|
|
4085
3108
|
PubSub.publishSync("result", {
|
|
4086
3109
|
keyword: keywordId,
|
|
4087
3110
|
absoluteKeywordLocation: schemaUrl,
|
|
4088
|
-
instanceLocation: Instance$
|
|
3111
|
+
instanceLocation: Instance$B.uri(instance),
|
|
4089
3112
|
valid: isValid,
|
|
4090
3113
|
ast: uri
|
|
4091
3114
|
});
|
|
@@ -4123,7 +3146,7 @@ const collectEvaluatedItems$e = (uri, instance, ast, dynamicAnchors, isTop = fal
|
|
|
4123
3146
|
}, new Set());
|
|
4124
3147
|
};
|
|
4125
3148
|
|
|
4126
|
-
var validate$1 = { compile: compile$
|
|
3149
|
+
var validate$1 = { compile: compile$K, interpret: interpret$K, collectEvaluatedProperties: collectEvaluatedProperties$d, collectEvaluatedItems: collectEvaluatedItems$e };
|
|
4127
3150
|
|
|
4128
3151
|
const metaData$2 = metaData$4;
|
|
4129
3152
|
const validate = validate$1;
|
|
@@ -4132,90 +3155,90 @@ const validate = validate$1;
|
|
|
4132
3155
|
var keywords$6 = { metaData: metaData$2, validate };
|
|
4133
3156
|
|
|
4134
3157
|
const Core$w = core$2;
|
|
4135
|
-
const Schema$
|
|
4136
|
-
const Instance$
|
|
3158
|
+
const Schema$M = schema$5;
|
|
3159
|
+
const Instance$A = instance;
|
|
4137
3160
|
const Reference = reference;
|
|
4138
3161
|
const Keywords$2 = keywords$6;
|
|
4139
3162
|
const InvalidSchemaError$1 = invalidSchemaError;
|
|
4140
3163
|
|
|
4141
3164
|
|
|
4142
|
-
var lib$
|
|
3165
|
+
var lib$1 = { Core: Core$w, Schema: Schema$M, Instance: Instance$A, Reference, Keywords: Keywords$2, InvalidSchemaError: InvalidSchemaError$1 };
|
|
4143
3166
|
|
|
4144
|
-
const { Core: Core$v, Schema: Schema$
|
|
3167
|
+
const { Core: Core$v, Schema: Schema$L, Instance: Instance$z } = lib$1;
|
|
4145
3168
|
|
|
4146
3169
|
|
|
4147
|
-
const compile$
|
|
4148
|
-
const items = await Schema$
|
|
4149
|
-
const numberOfItems = Schema$
|
|
3170
|
+
const compile$J = async (schema, ast, parentSchema) => {
|
|
3171
|
+
const items = await Schema$L.step("items", parentSchema);
|
|
3172
|
+
const numberOfItems = Schema$L.typeOf(items, "array") ? Schema$L.length(items) : Number.MAX_SAFE_INTEGER;
|
|
4150
3173
|
|
|
4151
|
-
if (Schema$
|
|
4152
|
-
return [numberOfItems, Schema$
|
|
3174
|
+
if (Schema$L.typeOf(schema, "boolean")) {
|
|
3175
|
+
return [numberOfItems, Schema$L.value(schema)];
|
|
4153
3176
|
} else {
|
|
4154
3177
|
return [numberOfItems, await Core$v.compileSchema(schema, ast)];
|
|
4155
3178
|
}
|
|
4156
3179
|
};
|
|
4157
3180
|
|
|
4158
|
-
const interpret$
|
|
4159
|
-
if (!Instance$
|
|
3181
|
+
const interpret$J = ([numberOfItems, additionalItems], instance, ast, dynamicAnchors) => {
|
|
3182
|
+
if (!Instance$z.typeOf(instance, "array")) {
|
|
4160
3183
|
return true;
|
|
4161
3184
|
}
|
|
4162
3185
|
|
|
4163
3186
|
if (typeof additionalItems === "string") {
|
|
4164
|
-
return Instance$
|
|
3187
|
+
return Instance$z.every((item, ndx) => ndx < numberOfItems || Core$v.interpretSchema(additionalItems, item, ast, dynamicAnchors), instance);
|
|
4165
3188
|
} else {
|
|
4166
|
-
return Instance$
|
|
3189
|
+
return Instance$z.every((item, ndx) => ndx < numberOfItems ? true : additionalItems, instance);
|
|
4167
3190
|
}
|
|
4168
3191
|
};
|
|
4169
3192
|
|
|
4170
|
-
var additionalItems = { compile: compile$
|
|
3193
|
+
var additionalItems = { compile: compile$J, interpret: interpret$J };
|
|
4171
3194
|
|
|
4172
|
-
const { Core: Core$u, Schema: Schema$
|
|
3195
|
+
const { Core: Core$u, Schema: Schema$K, Instance: Instance$y } = lib$1;
|
|
4173
3196
|
|
|
4174
3197
|
|
|
4175
|
-
const compile$
|
|
4176
|
-
const items = await Schema$
|
|
4177
|
-
const numberOfItems = Schema$
|
|
3198
|
+
const compile$I = async (schema, ast, parentSchema) => {
|
|
3199
|
+
const items = await Schema$K.step("items", parentSchema);
|
|
3200
|
+
const numberOfItems = Schema$K.typeOf(items, "array") ? Schema$K.length(items) : Number.MAX_SAFE_INTEGER;
|
|
4178
3201
|
|
|
4179
3202
|
return [numberOfItems, await Core$u.compileSchema(schema, ast)];
|
|
4180
3203
|
};
|
|
4181
3204
|
|
|
4182
|
-
const interpret$
|
|
4183
|
-
if (!Instance$
|
|
3205
|
+
const interpret$I = ([numberOfItems, additionalItems], instance, ast, dynamicAnchors) => {
|
|
3206
|
+
if (!Instance$y.typeOf(instance, "array")) {
|
|
4184
3207
|
return true;
|
|
4185
3208
|
}
|
|
4186
3209
|
|
|
4187
|
-
return Instance$
|
|
3210
|
+
return Instance$y.every((item, ndx) => ndx < numberOfItems || Core$u.interpretSchema(additionalItems, item, ast, dynamicAnchors), instance);
|
|
4188
3211
|
};
|
|
4189
3212
|
|
|
4190
3213
|
const collectEvaluatedItems$d = (keywordValue, instance, ast, dynamicAnchors) => {
|
|
4191
|
-
return interpret$
|
|
3214
|
+
return interpret$I(keywordValue, instance, ast, dynamicAnchors) && new Set(Instance$y.map((item, ndx) => ndx, instance));
|
|
4192
3215
|
};
|
|
4193
3216
|
|
|
4194
|
-
var additionalItems6 = { compile: compile$
|
|
3217
|
+
var additionalItems6 = { compile: compile$I, interpret: interpret$I, collectEvaluatedItems: collectEvaluatedItems$d };
|
|
4195
3218
|
|
|
4196
|
-
const { Core: Core$t, Schema: Schema$
|
|
3219
|
+
const { Core: Core$t, Schema: Schema$J, Instance: Instance$x } = lib$1;
|
|
4197
3220
|
|
|
4198
3221
|
|
|
4199
|
-
const compile$
|
|
4200
|
-
const properties = await Schema$
|
|
4201
|
-
const propertyNames = Schema$
|
|
3222
|
+
const compile$H = async (schema, ast, parentSchema) => {
|
|
3223
|
+
const properties = await Schema$J.step("properties", parentSchema);
|
|
3224
|
+
const propertyNames = Schema$J.typeOf(properties, "object") ? Schema$J.keys(properties) : [];
|
|
4202
3225
|
|
|
4203
|
-
const patternProperties = await Schema$
|
|
4204
|
-
const propertyNamePatterns = Schema$
|
|
3226
|
+
const patternProperties = await Schema$J.step("patternProperties", parentSchema);
|
|
3227
|
+
const propertyNamePatterns = Schema$J.typeOf(patternProperties, "object") ? Schema$J.keys(patternProperties).map((pattern) => new RegExp(pattern)) : [];
|
|
4205
3228
|
|
|
4206
|
-
if (Schema$
|
|
4207
|
-
return [propertyNames, propertyNamePatterns, Schema$
|
|
3229
|
+
if (Schema$J.typeOf(schema, "boolean")) {
|
|
3230
|
+
return [propertyNames, propertyNamePatterns, Schema$J.value(schema)];
|
|
4208
3231
|
} else {
|
|
4209
3232
|
return [propertyNames, propertyNamePatterns, await Core$t.compileSchema(schema, ast)];
|
|
4210
3233
|
}
|
|
4211
3234
|
};
|
|
4212
3235
|
|
|
4213
|
-
const interpret$
|
|
4214
|
-
if (!Instance$
|
|
3236
|
+
const interpret$H = ([propertyNames, propertyNamePatterns, additionalProperties], instance, ast, dynamicAnchors) => {
|
|
3237
|
+
if (!Instance$x.typeOf(instance, "object")) {
|
|
4215
3238
|
return true;
|
|
4216
3239
|
}
|
|
4217
3240
|
|
|
4218
|
-
const properties = Instance$
|
|
3241
|
+
const properties = Instance$x.entries(instance)
|
|
4219
3242
|
.filter(([propertyName]) => !propertyNames.includes(propertyName) && !propertyNamePatterns.some((pattern) => pattern.test(propertyName)));
|
|
4220
3243
|
|
|
4221
3244
|
if (typeof additionalProperties === "string") {
|
|
@@ -4225,168 +3248,47 @@ const interpret$J = ([propertyNames, propertyNamePatterns, additionalProperties]
|
|
|
4225
3248
|
}
|
|
4226
3249
|
};
|
|
4227
3250
|
|
|
4228
|
-
var additionalProperties = { compile: compile$
|
|
3251
|
+
var additionalProperties = { compile: compile$H, interpret: interpret$H };
|
|
4229
3252
|
|
|
4230
|
-
const { Core: Core$s, Schema: Schema$
|
|
3253
|
+
const { Core: Core$s, Schema: Schema$I, Instance: Instance$w } = lib$1;
|
|
4231
3254
|
|
|
4232
3255
|
|
|
4233
|
-
const compile$
|
|
4234
|
-
const propertiesSchema = await Schema$
|
|
4235
|
-
const propertyNames = Schema$
|
|
3256
|
+
const compile$G = async (schema, ast, parentSchema) => {
|
|
3257
|
+
const propertiesSchema = await Schema$I.step("properties", parentSchema);
|
|
3258
|
+
const propertyNames = Schema$I.typeOf(propertiesSchema, "object") ? Schema$I.keys(propertiesSchema) : [];
|
|
4236
3259
|
|
|
4237
|
-
const patternProperties = await Schema$
|
|
4238
|
-
const propertyNamePatterns = Schema$
|
|
3260
|
+
const patternProperties = await Schema$I.step("patternProperties", parentSchema);
|
|
3261
|
+
const propertyNamePatterns = Schema$I.typeOf(patternProperties, "object") ? Schema$I.keys(patternProperties).map((pattern) => new RegExp(pattern)) : [];
|
|
4239
3262
|
|
|
4240
3263
|
return [propertyNames, propertyNamePatterns, await Core$s.compileSchema(schema, ast)];
|
|
4241
3264
|
};
|
|
4242
3265
|
|
|
4243
|
-
const interpret$
|
|
4244
|
-
if (!Instance$
|
|
3266
|
+
const interpret$G = ([propertyNames, propertyNamePatterns, additionalProperties], instance, ast, dynamicAnchors) => {
|
|
3267
|
+
if (!Instance$w.typeOf(instance, "object")) {
|
|
4245
3268
|
return true;
|
|
4246
3269
|
}
|
|
4247
3270
|
|
|
4248
|
-
return Instance$
|
|
3271
|
+
return Instance$w.entries(instance)
|
|
4249
3272
|
.filter(([propertyName]) => !propertyNames.includes(propertyName) && !propertyNamePatterns.some((pattern) => pattern.test(propertyName)))
|
|
4250
3273
|
.every(([, property]) => Core$s.interpretSchema(additionalProperties, property, ast, dynamicAnchors));
|
|
4251
3274
|
};
|
|
4252
3275
|
|
|
4253
3276
|
const collectEvaluatedProperties$c = (keywordValue, instance, ast, dynamicAnchors) => {
|
|
4254
|
-
return interpret$
|
|
4255
|
-
};
|
|
4256
|
-
|
|
4257
|
-
var additionalProperties6 = { compile: compile$I, interpret: interpret$I, collectEvaluatedProperties: collectEvaluatedProperties$c };
|
|
4258
|
-
|
|
4259
|
-
var entries$1 = async (doc) => Object.entries(await doc);
|
|
4260
|
-
|
|
4261
|
-
var justCurryIt = curry$6;
|
|
4262
|
-
|
|
4263
|
-
/*
|
|
4264
|
-
function add(a, b, c) {
|
|
4265
|
-
return a + b + c;
|
|
4266
|
-
}
|
|
4267
|
-
curry(add)(1)(2)(3); // 6
|
|
4268
|
-
curry(add)(1)(2)(2); // 5
|
|
4269
|
-
curry(add)(2)(4, 3); // 9
|
|
4270
|
-
|
|
4271
|
-
function add(...args) {
|
|
4272
|
-
return args.reduce((sum, n) => sum + n, 0)
|
|
4273
|
-
}
|
|
4274
|
-
var curryAdd4 = curry(add, 4)
|
|
4275
|
-
curryAdd4(1)(2, 3)(4); // 10
|
|
4276
|
-
|
|
4277
|
-
function converter(ratio, input) {
|
|
4278
|
-
return (input*ratio).toFixed(1);
|
|
4279
|
-
}
|
|
4280
|
-
const curriedConverter = curry(converter)
|
|
4281
|
-
const milesToKm = curriedConverter(1.62);
|
|
4282
|
-
milesToKm(35); // 56.7
|
|
4283
|
-
milesToKm(10); // 16.2
|
|
4284
|
-
*/
|
|
4285
|
-
|
|
4286
|
-
function curry$6(fn, arity) {
|
|
4287
|
-
return function curried() {
|
|
4288
|
-
if (arity == null) {
|
|
4289
|
-
arity = fn.length;
|
|
4290
|
-
}
|
|
4291
|
-
var args = [].slice.call(arguments);
|
|
4292
|
-
if (args.length >= arity) {
|
|
4293
|
-
return fn.apply(this, args);
|
|
4294
|
-
} else {
|
|
4295
|
-
return function() {
|
|
4296
|
-
return curried.apply(this, args.concat([].slice.call(arguments)));
|
|
4297
|
-
};
|
|
4298
|
-
}
|
|
4299
|
-
};
|
|
4300
|
-
}
|
|
4301
|
-
|
|
4302
|
-
const curry$5 = justCurryIt;
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
var map$2 = curry$5(async (fn, doc) => (await doc).map(fn));
|
|
4306
|
-
|
|
4307
|
-
const curry$4 = justCurryIt;
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
var reduce$2 = curry$4(async (fn, acc, doc) => {
|
|
4311
|
-
return (await doc).reduce(async (acc, item) => fn(await acc, item), acc);
|
|
4312
|
-
});
|
|
4313
|
-
|
|
4314
|
-
const curry$3 = justCurryIt;
|
|
4315
|
-
const reduce$1 = reduce$2;
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
var filter = curry$3(async (fn, doc, options = {}) => {
|
|
4319
|
-
return reduce$1(async (acc, item) => {
|
|
4320
|
-
return (await fn(item)) ? acc.concat([item]) : acc;
|
|
4321
|
-
}, [], doc, options);
|
|
4322
|
-
});
|
|
4323
|
-
|
|
4324
|
-
const curry$2 = justCurryIt;
|
|
4325
|
-
const map$1 = map$2;
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
var some = curry$2(async (fn, doc) => {
|
|
4329
|
-
const results = await map$1(fn, doc);
|
|
4330
|
-
return (await Promise.all(results))
|
|
4331
|
-
.some((a) => a);
|
|
4332
|
-
});
|
|
4333
|
-
|
|
4334
|
-
const curry$1 = justCurryIt;
|
|
4335
|
-
const map = map$2;
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
var every = curry$1(async (fn, doc) => {
|
|
4339
|
-
const results = await map(fn, doc);
|
|
4340
|
-
return (await Promise.all(results))
|
|
4341
|
-
.every((a) => a);
|
|
4342
|
-
});
|
|
4343
|
-
|
|
4344
|
-
const curry = justCurryIt;
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
var pipeline$1 = curry((fns, doc) => {
|
|
4348
|
-
return fns.reduce(async (acc, fn) => fn(await acc), doc);
|
|
4349
|
-
});
|
|
4350
|
-
|
|
4351
|
-
var all = (doc) => Promise.all(doc);
|
|
4352
|
-
|
|
4353
|
-
const pipeline = pipeline$1;
|
|
4354
|
-
const entries = entries$1;
|
|
4355
|
-
const reduce = reduce$2;
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
var allValues = (doc) => {
|
|
4359
|
-
return pipeline([
|
|
4360
|
-
entries,
|
|
4361
|
-
reduce(async (acc, [propertyName, propertyValue]) => {
|
|
4362
|
-
acc[propertyName] = await propertyValue;
|
|
4363
|
-
return acc;
|
|
4364
|
-
}, {})
|
|
4365
|
-
], doc);
|
|
3277
|
+
return interpret$G(keywordValue, instance, ast, dynamicAnchors) && [new RegExp("")];
|
|
4366
3278
|
};
|
|
4367
3279
|
|
|
4368
|
-
var
|
|
4369
|
-
entries: entries$1,
|
|
4370
|
-
map: map$2,
|
|
4371
|
-
filter: filter,
|
|
4372
|
-
reduce: reduce$2,
|
|
4373
|
-
some: some,
|
|
4374
|
-
every: every,
|
|
4375
|
-
pipeline: pipeline$1,
|
|
4376
|
-
all: all,
|
|
4377
|
-
allValues: allValues
|
|
4378
|
-
};
|
|
3280
|
+
var additionalProperties6 = { compile: compile$G, interpret: interpret$G, collectEvaluatedProperties: collectEvaluatedProperties$c };
|
|
4379
3281
|
|
|
4380
|
-
const { Core: Core$r, Schema: Schema$
|
|
4381
|
-
const Pact$8 = lib$
|
|
3282
|
+
const { Core: Core$r, Schema: Schema$H } = lib$1;
|
|
3283
|
+
const Pact$8 = lib$2;
|
|
4382
3284
|
|
|
4383
3285
|
|
|
4384
|
-
const compile$
|
|
4385
|
-
Schema$
|
|
3286
|
+
const compile$F = (schema, ast) => Pact$8.pipeline([
|
|
3287
|
+
Schema$H.map(async (itemSchema) => Core$r.compileSchema(await itemSchema, ast)),
|
|
4386
3288
|
Pact$8.all
|
|
4387
3289
|
], schema);
|
|
4388
3290
|
|
|
4389
|
-
const interpret$
|
|
3291
|
+
const interpret$F = (allOf, instance, ast, dynamicAnchors) => {
|
|
4390
3292
|
return allOf.every((schemaUrl) => Core$r.interpretSchema(schemaUrl, instance, ast, dynamicAnchors));
|
|
4391
3293
|
};
|
|
4392
3294
|
|
|
@@ -4404,18 +3306,18 @@ const collectEvaluatedItems$c = (allOf, instance, ast, dynamicAnchors) => {
|
|
|
4404
3306
|
}, new Set());
|
|
4405
3307
|
};
|
|
4406
3308
|
|
|
4407
|
-
var allOf = { compile: compile$
|
|
3309
|
+
var allOf = { compile: compile$F, interpret: interpret$F, collectEvaluatedProperties: collectEvaluatedProperties$b, collectEvaluatedItems: collectEvaluatedItems$c };
|
|
4408
3310
|
|
|
4409
|
-
const { Core: Core$q, Schema: Schema$
|
|
4410
|
-
const Pact$7 = lib$
|
|
3311
|
+
const { Core: Core$q, Schema: Schema$G } = lib$1;
|
|
3312
|
+
const Pact$7 = lib$2;
|
|
4411
3313
|
|
|
4412
3314
|
|
|
4413
|
-
const compile$
|
|
4414
|
-
Schema$
|
|
3315
|
+
const compile$E = (schema, ast) => Pact$7.pipeline([
|
|
3316
|
+
Schema$G.map(async (itemSchema) => Core$q.compileSchema(await itemSchema, ast)),
|
|
4415
3317
|
Pact$7.all
|
|
4416
3318
|
], schema);
|
|
4417
3319
|
|
|
4418
|
-
const interpret$
|
|
3320
|
+
const interpret$E = (anyOf, instance, ast, dynamicAnchors) => {
|
|
4419
3321
|
const matches = anyOf.filter((schemaUrl) => Core$q.interpretSchema(schemaUrl, instance, ast, dynamicAnchors));
|
|
4420
3322
|
return matches.length > 0;
|
|
4421
3323
|
};
|
|
@@ -4434,7 +3336,7 @@ const collectEvaluatedItems$b = (anyOf, instance, ast, dynamicAnchors) => {
|
|
|
4434
3336
|
}, false);
|
|
4435
3337
|
};
|
|
4436
3338
|
|
|
4437
|
-
var anyOf = { compile: compile$
|
|
3339
|
+
var anyOf = { compile: compile$E, interpret: interpret$E, collectEvaluatedProperties: collectEvaluatedProperties$a, collectEvaluatedItems: collectEvaluatedItems$b };
|
|
4438
3340
|
|
|
4439
3341
|
var keyList = Object.keys;
|
|
4440
3342
|
var native_stringify = JSON.stringify;
|
|
@@ -4495,92 +3397,92 @@ function stringify(val, allowUndefined) {
|
|
|
4495
3397
|
|
|
4496
3398
|
var fastestStableStringify = function(obj) { return '' + stringify(obj, false); };
|
|
4497
3399
|
|
|
4498
|
-
const { Schema: Schema$
|
|
3400
|
+
const { Schema: Schema$F, Instance: Instance$v } = lib$1;
|
|
4499
3401
|
const jsonStringify$2 = fastestStableStringify;
|
|
4500
3402
|
|
|
4501
3403
|
|
|
4502
|
-
const compile$
|
|
4503
|
-
const interpret$
|
|
3404
|
+
const compile$D = (schema) => jsonStringify$2(Schema$F.value(schema));
|
|
3405
|
+
const interpret$D = (const_, instance) => jsonStringify$2(Instance$v.value(instance)) === const_;
|
|
4504
3406
|
|
|
4505
|
-
var _const = { compile: compile$
|
|
3407
|
+
var _const = { compile: compile$D, interpret: interpret$D };
|
|
4506
3408
|
|
|
4507
|
-
const { Core: Core$p, Instance: Instance$
|
|
3409
|
+
const { Core: Core$p, Instance: Instance$u } = lib$1;
|
|
4508
3410
|
|
|
4509
3411
|
|
|
4510
|
-
const compile$
|
|
3412
|
+
const compile$C = (schema, ast) => Core$p.compileSchema(schema, ast);
|
|
4511
3413
|
|
|
4512
|
-
const interpret$
|
|
4513
|
-
return !Instance$
|
|
3414
|
+
const interpret$C = (contains, instance, ast, dynamicAnchors) => {
|
|
3415
|
+
return !Instance$u.typeOf(instance, "array") || Instance$u.some((item) => Core$p.interpretSchema(contains, item, ast, dynamicAnchors), instance);
|
|
4514
3416
|
};
|
|
4515
3417
|
|
|
4516
|
-
var contains = { compile: compile$
|
|
3418
|
+
var contains = { compile: compile$C, interpret: interpret$C };
|
|
4517
3419
|
|
|
4518
|
-
const { Core: Core$o, Schema: Schema$
|
|
3420
|
+
const { Core: Core$o, Schema: Schema$E, Instance: Instance$t } = lib$1;
|
|
4519
3421
|
|
|
4520
3422
|
|
|
4521
|
-
const compile$
|
|
3423
|
+
const compile$B = async (schema, ast, parentSchema) => {
|
|
4522
3424
|
const contains = await Core$o.compileSchema(schema, ast);
|
|
4523
3425
|
|
|
4524
|
-
const minContainsSchema = await Schema$
|
|
4525
|
-
const minContains = Schema$
|
|
3426
|
+
const minContainsSchema = await Schema$E.step("minContains", parentSchema);
|
|
3427
|
+
const minContains = Schema$E.typeOf(minContainsSchema, "number") ? Schema$E.value(minContainsSchema) : 1;
|
|
4526
3428
|
|
|
4527
|
-
const maxContainsSchema = await Schema$
|
|
4528
|
-
const maxContains = Schema$
|
|
3429
|
+
const maxContainsSchema = await Schema$E.step("maxContains", parentSchema);
|
|
3430
|
+
const maxContains = Schema$E.typeOf(maxContainsSchema, "number") ? Schema$E.value(maxContainsSchema) : Number.MAX_SAFE_INTEGER;
|
|
4529
3431
|
|
|
4530
3432
|
return { contains, minContains, maxContains };
|
|
4531
3433
|
};
|
|
4532
3434
|
|
|
4533
|
-
const interpret$
|
|
4534
|
-
if (!Instance$
|
|
3435
|
+
const interpret$B = ({ contains, minContains, maxContains }, instance, ast, dynamicAnchors) => {
|
|
3436
|
+
if (!Instance$t.typeOf(instance, "array")) {
|
|
4535
3437
|
return true;
|
|
4536
3438
|
}
|
|
4537
3439
|
|
|
4538
|
-
const matches = Instance$
|
|
3440
|
+
const matches = Instance$t.reduce((matches, item) => {
|
|
4539
3441
|
return Core$o.interpretSchema(contains, item, ast, dynamicAnchors) ? matches + 1 : matches;
|
|
4540
3442
|
}, 0, instance);
|
|
4541
3443
|
return matches >= minContains && matches <= maxContains;
|
|
4542
3444
|
};
|
|
4543
3445
|
|
|
4544
3446
|
const collectEvaluatedItems$a = (keywordValue, instance, ast, dynamicAnchors) => {
|
|
4545
|
-
return interpret$
|
|
3447
|
+
return interpret$B(keywordValue, instance, ast, dynamicAnchors) && Instance$t.reduce((matchedIndexes, item, itemIndex) => {
|
|
4546
3448
|
return Core$o.interpretSchema(keywordValue.contains, item, ast, dynamicAnchors) ? matchedIndexes.add(itemIndex) : matchedIndexes;
|
|
4547
3449
|
}, new Set(), instance);
|
|
4548
3450
|
};
|
|
4549
3451
|
|
|
4550
|
-
var containsMinContainsMaxContains = { compile: compile$
|
|
3452
|
+
var containsMinContainsMaxContains = { compile: compile$B, interpret: interpret$B, collectEvaluatedItems: collectEvaluatedItems$a };
|
|
4551
3453
|
|
|
4552
|
-
const { Core: Core$n, Schema: Schema$
|
|
4553
|
-
const Pact$6 = lib$
|
|
3454
|
+
const { Core: Core$n, Schema: Schema$D } = lib$1;
|
|
3455
|
+
const Pact$6 = lib$2;
|
|
4554
3456
|
|
|
4555
3457
|
|
|
4556
|
-
const compile$
|
|
3458
|
+
const compile$A = async (schema, ast) => {
|
|
4557
3459
|
await Pact$6.pipeline([
|
|
4558
|
-
Schema$
|
|
3460
|
+
Schema$D.entries,
|
|
4559
3461
|
Pact$6.map(([, definitionSchema]) => Core$n.compileSchema(definitionSchema, ast)),
|
|
4560
3462
|
Pact$6.all
|
|
4561
3463
|
], schema);
|
|
4562
3464
|
};
|
|
4563
3465
|
|
|
4564
|
-
const interpret$
|
|
3466
|
+
const interpret$A = () => true;
|
|
4565
3467
|
|
|
4566
|
-
var definitions = { compile: compile$
|
|
3468
|
+
var definitions = { compile: compile$A, interpret: interpret$A };
|
|
4567
3469
|
|
|
4568
|
-
const { Core: Core$m, Schema: Schema$
|
|
4569
|
-
const Pact$5 = lib$
|
|
3470
|
+
const { Core: Core$m, Schema: Schema$C, Instance: Instance$s } = lib$1;
|
|
3471
|
+
const Pact$5 = lib$2;
|
|
4570
3472
|
|
|
4571
3473
|
|
|
4572
|
-
const compile$
|
|
4573
|
-
Schema$
|
|
3474
|
+
const compile$z = (schema, ast) => Pact$5.pipeline([
|
|
3475
|
+
Schema$C.entries,
|
|
4574
3476
|
Pact$5.map(async ([key, dependency]) => {
|
|
4575
|
-
return [key, Schema$
|
|
3477
|
+
return [key, Schema$C.typeOf(dependency, "array") ? Schema$C.value(dependency) : await Core$m.compileSchema(dependency, ast)];
|
|
4576
3478
|
}),
|
|
4577
3479
|
Pact$5.all
|
|
4578
3480
|
], schema);
|
|
4579
3481
|
|
|
4580
|
-
const interpret$
|
|
4581
|
-
const value = Instance$
|
|
3482
|
+
const interpret$z = (dependencies, instance, ast, dynamicAnchors) => {
|
|
3483
|
+
const value = Instance$s.value(instance);
|
|
4582
3484
|
|
|
4583
|
-
return !Instance$
|
|
3485
|
+
return !Instance$s.typeOf(instance, "object") || dependencies.every(([propertyName, dependency]) => {
|
|
4584
3486
|
if (!(propertyName in value)) {
|
|
4585
3487
|
return true;
|
|
4586
3488
|
}
|
|
@@ -4593,49 +3495,49 @@ const interpret$B = (dependencies, instance, ast, dynamicAnchors) => {
|
|
|
4593
3495
|
});
|
|
4594
3496
|
};
|
|
4595
3497
|
|
|
4596
|
-
var dependencies = { compile: compile$
|
|
3498
|
+
var dependencies = { compile: compile$z, interpret: interpret$z };
|
|
4597
3499
|
|
|
4598
|
-
const { Schema: Schema$
|
|
4599
|
-
const Pact$4 = lib$
|
|
3500
|
+
const { Schema: Schema$B, Instance: Instance$r } = lib$1;
|
|
3501
|
+
const Pact$4 = lib$2;
|
|
4600
3502
|
|
|
4601
3503
|
|
|
4602
|
-
const compile$
|
|
4603
|
-
Schema$
|
|
4604
|
-
Pact$4.map(([key, dependentRequired]) => [key, Schema$
|
|
3504
|
+
const compile$y = (schema) => Pact$4.pipeline([
|
|
3505
|
+
Schema$B.entries,
|
|
3506
|
+
Pact$4.map(([key, dependentRequired]) => [key, Schema$B.value(dependentRequired)]),
|
|
4605
3507
|
Pact$4.all
|
|
4606
3508
|
], schema);
|
|
4607
3509
|
|
|
4608
|
-
const interpret$
|
|
4609
|
-
const value = Instance$
|
|
3510
|
+
const interpret$y = (dependentRequired, instance) => {
|
|
3511
|
+
const value = Instance$r.value(instance);
|
|
4610
3512
|
|
|
4611
|
-
return !Instance$
|
|
3513
|
+
return !Instance$r.typeOf(instance, "object") || dependentRequired.every(([propertyName, required]) => {
|
|
4612
3514
|
return !(propertyName in value) || required.every((key) => key in value);
|
|
4613
3515
|
});
|
|
4614
3516
|
};
|
|
4615
3517
|
|
|
4616
|
-
var dependentRequired = { compile: compile$
|
|
3518
|
+
var dependentRequired = { compile: compile$y, interpret: interpret$y };
|
|
4617
3519
|
|
|
4618
|
-
const { Core: Core$l, Schema: Schema$
|
|
4619
|
-
const Pact$3 = lib$
|
|
3520
|
+
const { Core: Core$l, Schema: Schema$A, Instance: Instance$q } = lib$1;
|
|
3521
|
+
const Pact$3 = lib$2;
|
|
4620
3522
|
|
|
4621
3523
|
|
|
4622
|
-
const compile$
|
|
4623
|
-
Schema$
|
|
3524
|
+
const compile$x = (schema, ast) => Pact$3.pipeline([
|
|
3525
|
+
Schema$A.entries,
|
|
4624
3526
|
Pact$3.map(async ([key, dependentSchema]) => [key, await Core$l.compileSchema(dependentSchema, ast)]),
|
|
4625
3527
|
Pact$3.all
|
|
4626
3528
|
], schema);
|
|
4627
3529
|
|
|
4628
|
-
const interpret$
|
|
4629
|
-
const value = Instance$
|
|
3530
|
+
const interpret$x = (dependentSchemas, instance, ast, dynamicAnchors) => {
|
|
3531
|
+
const value = Instance$q.value(instance);
|
|
4630
3532
|
|
|
4631
|
-
return !Instance$
|
|
3533
|
+
return !Instance$q.typeOf(instance, "object") || dependentSchemas.every(([propertyName, dependentSchema]) => {
|
|
4632
3534
|
return !(propertyName in value) || Core$l.interpretSchema(dependentSchema, instance, ast, dynamicAnchors);
|
|
4633
3535
|
});
|
|
4634
3536
|
};
|
|
4635
3537
|
|
|
4636
3538
|
const collectEvaluatedProperties$9 = (dependentSchemas, instance, ast, dynamicAnchors) => {
|
|
4637
3539
|
return dependentSchemas.reduce((acc, [propertyName, dependentSchema]) => {
|
|
4638
|
-
if (!acc || !Instance$
|
|
3540
|
+
if (!acc || !Instance$q.has(propertyName, instance)) {
|
|
4639
3541
|
return acc;
|
|
4640
3542
|
}
|
|
4641
3543
|
|
|
@@ -4644,39 +3546,39 @@ const collectEvaluatedProperties$9 = (dependentSchemas, instance, ast, dynamicAn
|
|
|
4644
3546
|
}, []);
|
|
4645
3547
|
};
|
|
4646
3548
|
|
|
4647
|
-
var dependentSchemas = { compile: compile$
|
|
3549
|
+
var dependentSchemas = { compile: compile$x, interpret: interpret$x, collectEvaluatedProperties: collectEvaluatedProperties$9 };
|
|
4648
3550
|
|
|
4649
|
-
const { Schema: Schema$
|
|
3551
|
+
const { Schema: Schema$z, Instance: Instance$p } = lib$1;
|
|
4650
3552
|
const jsonStringify$1 = fastestStableStringify;
|
|
4651
3553
|
|
|
4652
3554
|
|
|
4653
|
-
const compile$
|
|
4654
|
-
const interpret$
|
|
3555
|
+
const compile$w = (schema) => Schema$z.value(schema).map(jsonStringify$1);
|
|
3556
|
+
const interpret$w = (enum_, instance) => enum_.some((enumValue) => jsonStringify$1(Instance$p.value(instance)) === enumValue);
|
|
4655
3557
|
|
|
4656
|
-
var _enum = { compile: compile$
|
|
3558
|
+
var _enum = { compile: compile$w, interpret: interpret$w };
|
|
4657
3559
|
|
|
4658
|
-
const { Schema: Schema$
|
|
3560
|
+
const { Schema: Schema$y, Instance: Instance$o } = lib$1;
|
|
4659
3561
|
|
|
4660
3562
|
|
|
4661
|
-
const compile$
|
|
4662
|
-
const interpret$
|
|
3563
|
+
const compile$v = async (schema) => Schema$y.value(schema);
|
|
3564
|
+
const interpret$v = (exclusiveMaximum, instance) => !Instance$o.typeOf(instance, "number") || Instance$o.value(instance) < exclusiveMaximum;
|
|
4663
3565
|
|
|
4664
|
-
var exclusiveMaximum = { compile: compile$
|
|
3566
|
+
var exclusiveMaximum = { compile: compile$v, interpret: interpret$v };
|
|
4665
3567
|
|
|
4666
|
-
const { Schema: Schema$
|
|
3568
|
+
const { Schema: Schema$x, Instance: Instance$n } = lib$1;
|
|
4667
3569
|
|
|
4668
3570
|
|
|
4669
|
-
const compile$
|
|
4670
|
-
const interpret$
|
|
3571
|
+
const compile$u = async (schema) => Schema$x.value(schema);
|
|
3572
|
+
const interpret$u = (exclusiveMinimum, instance) => !Instance$n.typeOf(instance, "number") || Instance$n.value(instance) > exclusiveMinimum;
|
|
4671
3573
|
|
|
4672
|
-
var exclusiveMinimum = { compile: compile$
|
|
3574
|
+
var exclusiveMinimum = { compile: compile$u, interpret: interpret$u };
|
|
4673
3575
|
|
|
4674
|
-
const { Core: Core$k } = lib$
|
|
3576
|
+
const { Core: Core$k } = lib$1;
|
|
4675
3577
|
|
|
4676
3578
|
|
|
4677
|
-
const compile$
|
|
3579
|
+
const compile$t = (schema, ast) => Core$k.compileSchema(schema, ast);
|
|
4678
3580
|
|
|
4679
|
-
const interpret$
|
|
3581
|
+
const interpret$t = (ifSchema, instance, ast, dynamicAnchors) => {
|
|
4680
3582
|
Core$k.interpretSchema(ifSchema, instance, ast, dynamicAnchors);
|
|
4681
3583
|
return true;
|
|
4682
3584
|
};
|
|
@@ -4689,21 +3591,21 @@ const collectEvaluatedItems$9 = (ifSchema, instance, ast, dynamicAnchors) => {
|
|
|
4689
3591
|
return Core$k.collectEvaluatedItems(ifSchema, instance, ast, dynamicAnchors) || new Set();
|
|
4690
3592
|
};
|
|
4691
3593
|
|
|
4692
|
-
var _if = { compile: compile$
|
|
3594
|
+
var _if = { compile: compile$t, interpret: interpret$t, collectEvaluatedProperties: collectEvaluatedProperties$8, collectEvaluatedItems: collectEvaluatedItems$9 };
|
|
4693
3595
|
|
|
4694
|
-
const { Core: Core$j, Schema: Schema$
|
|
3596
|
+
const { Core: Core$j, Schema: Schema$w } = lib$1;
|
|
4695
3597
|
|
|
4696
3598
|
|
|
4697
|
-
const compile$
|
|
4698
|
-
if (Schema$
|
|
4699
|
-
const ifSchema = await Schema$
|
|
3599
|
+
const compile$s = async (schema, ast, parentSchema) => {
|
|
3600
|
+
if (Schema$w.has("if", parentSchema)) {
|
|
3601
|
+
const ifSchema = await Schema$w.step("if", parentSchema);
|
|
4700
3602
|
return [await Core$j.compileSchema(ifSchema, ast), await Core$j.compileSchema(schema, ast)];
|
|
4701
3603
|
} else {
|
|
4702
3604
|
return [];
|
|
4703
3605
|
}
|
|
4704
3606
|
};
|
|
4705
3607
|
|
|
4706
|
-
const interpret$
|
|
3608
|
+
const interpret$s = ([guard, block], instance, ast, dynamicAnchors) => {
|
|
4707
3609
|
return guard === undefined || !quietInterpretSchema$1(guard, instance, ast, dynamicAnchors) || Core$j.interpretSchema(block, instance, ast, dynamicAnchors);
|
|
4708
3610
|
};
|
|
4709
3611
|
|
|
@@ -4733,21 +3635,21 @@ const collectEvaluatedItems$8 = ([guard, block], instance, ast, dynamicAnchors)
|
|
|
4733
3635
|
return Core$j.collectEvaluatedItems(block, instance, ast, dynamicAnchors);
|
|
4734
3636
|
};
|
|
4735
3637
|
|
|
4736
|
-
var then = { compile: compile$
|
|
3638
|
+
var then = { compile: compile$s, interpret: interpret$s, collectEvaluatedProperties: collectEvaluatedProperties$7, collectEvaluatedItems: collectEvaluatedItems$8 };
|
|
4737
3639
|
|
|
4738
|
-
const { Core: Core$i, Schema: Schema$
|
|
3640
|
+
const { Core: Core$i, Schema: Schema$v } = lib$1;
|
|
4739
3641
|
|
|
4740
3642
|
|
|
4741
|
-
const compile$
|
|
4742
|
-
if (Schema$
|
|
4743
|
-
const ifSchema = await Schema$
|
|
3643
|
+
const compile$r = async (schema, ast, parentSchema) => {
|
|
3644
|
+
if (Schema$v.has("if", parentSchema)) {
|
|
3645
|
+
const ifSchema = await Schema$v.step("if", parentSchema);
|
|
4744
3646
|
return [await Core$i.compileSchema(ifSchema, ast), await Core$i.compileSchema(schema, ast)];
|
|
4745
3647
|
} else {
|
|
4746
3648
|
return [];
|
|
4747
3649
|
}
|
|
4748
3650
|
};
|
|
4749
3651
|
|
|
4750
|
-
const interpret$
|
|
3652
|
+
const interpret$r = ([guard, block], instance, ast, dynamicAnchors) => {
|
|
4751
3653
|
return guard === undefined || quietInterpretSchema(guard, instance, ast, dynamicAnchors) || Core$i.interpretSchema(block, instance, ast, dynamicAnchors);
|
|
4752
3654
|
};
|
|
4753
3655
|
|
|
@@ -4777,150 +3679,134 @@ const collectEvaluatedItems$7 = ([guard, block], instance, ast, dynamicAnchors)
|
|
|
4777
3679
|
return Core$i.collectEvaluatedItems(block, instance, ast, dynamicAnchors);
|
|
4778
3680
|
};
|
|
4779
3681
|
|
|
4780
|
-
var _else = { compile: compile$
|
|
3682
|
+
var _else = { compile: compile$r, interpret: interpret$r, collectEvaluatedProperties: collectEvaluatedProperties$6, collectEvaluatedItems: collectEvaluatedItems$7 };
|
|
4781
3683
|
|
|
4782
|
-
const { Core: Core$h, Schema: Schema$
|
|
3684
|
+
const { Core: Core$h, Schema: Schema$u, Instance: Instance$m } = lib$1;
|
|
4783
3685
|
|
|
4784
3686
|
|
|
4785
|
-
const compile$
|
|
4786
|
-
if (Schema$
|
|
4787
|
-
const tupleItems = await Schema$
|
|
3687
|
+
const compile$q = async (schema, ast) => {
|
|
3688
|
+
if (Schema$u.typeOf(schema, "array")) {
|
|
3689
|
+
const tupleItems = await Schema$u.map((itemSchema) => Core$h.compileSchema(itemSchema, ast), schema);
|
|
4788
3690
|
return Promise.all(tupleItems);
|
|
4789
3691
|
} else {
|
|
4790
3692
|
return Core$h.compileSchema(schema, ast);
|
|
4791
3693
|
}
|
|
4792
3694
|
};
|
|
4793
3695
|
|
|
4794
|
-
const interpret$
|
|
4795
|
-
if (!Instance$
|
|
3696
|
+
const interpret$q = (items, instance, ast, dynamicAnchors) => {
|
|
3697
|
+
if (!Instance$m.typeOf(instance, "array")) {
|
|
4796
3698
|
return true;
|
|
4797
3699
|
}
|
|
4798
3700
|
|
|
4799
3701
|
if (typeof items === "string") {
|
|
4800
|
-
return Instance$
|
|
3702
|
+
return Instance$m.every((itemValue) => Core$h.interpretSchema(items, itemValue, ast, dynamicAnchors), instance);
|
|
4801
3703
|
} else {
|
|
4802
|
-
return Instance$
|
|
3704
|
+
return Instance$m.every((item, ndx) => !(ndx in items) || Core$h.interpretSchema(items[ndx], item, ast, dynamicAnchors), instance);
|
|
4803
3705
|
}
|
|
4804
3706
|
};
|
|
4805
3707
|
|
|
4806
3708
|
const collectEvaluatedItems$6 = (items, instance, ast, dynamicAnchors) => {
|
|
4807
|
-
return interpret$
|
|
4808
|
-
? new Set(Instance$
|
|
3709
|
+
return interpret$q(items, instance, ast, dynamicAnchors) && (typeof items === "string"
|
|
3710
|
+
? new Set(Instance$m.map((item, itemIndex) => itemIndex, instance))
|
|
4809
3711
|
: new Set(items.map((item, itemIndex) => itemIndex)));
|
|
4810
3712
|
};
|
|
4811
3713
|
|
|
4812
|
-
var items = { compile: compile$
|
|
3714
|
+
var items = { compile: compile$q, interpret: interpret$q, collectEvaluatedItems: collectEvaluatedItems$6 };
|
|
4813
3715
|
|
|
4814
|
-
const { Core: Core$g, Schema: Schema$
|
|
3716
|
+
const { Core: Core$g, Schema: Schema$t, Instance: Instance$l } = lib$1;
|
|
4815
3717
|
|
|
4816
3718
|
|
|
4817
|
-
const compile$
|
|
4818
|
-
const items = await Schema$
|
|
4819
|
-
const numberOfPrefixItems = Schema$
|
|
3719
|
+
const compile$p = async (schema, ast, parentSchema) => {
|
|
3720
|
+
const items = await Schema$t.step("prefixItems", parentSchema);
|
|
3721
|
+
const numberOfPrefixItems = Schema$t.typeOf(items, "array") ? Schema$t.length(items) : 0;
|
|
4820
3722
|
|
|
4821
3723
|
return [numberOfPrefixItems, await Core$g.compileSchema(schema, ast)];
|
|
4822
3724
|
};
|
|
4823
3725
|
|
|
4824
|
-
const interpret$
|
|
4825
|
-
if (!Instance$
|
|
3726
|
+
const interpret$p = ([numberOfPrefixItems, items], instance, ast, dynamicAnchors) => {
|
|
3727
|
+
if (!Instance$l.typeOf(instance, "array")) {
|
|
4826
3728
|
return true;
|
|
4827
3729
|
}
|
|
4828
3730
|
|
|
4829
|
-
return Instance$
|
|
3731
|
+
return Instance$l.every((item, ndx) => ndx < numberOfPrefixItems || Core$g.interpretSchema(items, item, ast, dynamicAnchors), instance);
|
|
4830
3732
|
};
|
|
4831
3733
|
|
|
4832
3734
|
const collectEvaluatedItems$5 = (keywordValue, instance, ast, dynamicAnchors) => {
|
|
4833
|
-
return interpret$
|
|
3735
|
+
return interpret$p(keywordValue, instance, ast, dynamicAnchors) && new Set(Instance$l.map((item, ndx) => ndx, instance));
|
|
4834
3736
|
};
|
|
4835
3737
|
|
|
4836
|
-
var items202012 = { compile: compile$
|
|
4837
|
-
|
|
4838
|
-
const { Schema: Schema$u, Instance: Instance$m } = lib$2;
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
const compile$q = (schema) => Schema$u.value(schema);
|
|
4842
|
-
const interpret$q = (maxItems, instance) => !Instance$m.typeOf(instance, "array") || Instance$m.length(instance) <= maxItems;
|
|
4843
|
-
|
|
4844
|
-
var maxItems = { compile: compile$q, interpret: interpret$q };
|
|
3738
|
+
var items202012 = { compile: compile$p, interpret: interpret$p, collectEvaluatedItems: collectEvaluatedItems$5 };
|
|
4845
3739
|
|
|
4846
|
-
const { Schema: Schema$
|
|
3740
|
+
const { Schema: Schema$s, Instance: Instance$k } = lib$1;
|
|
4847
3741
|
|
|
4848
3742
|
|
|
4849
|
-
const compile$
|
|
4850
|
-
const interpret$
|
|
3743
|
+
const compile$o = (schema) => Schema$s.value(schema);
|
|
3744
|
+
const interpret$o = (maxItems, instance) => !Instance$k.typeOf(instance, "array") || Instance$k.length(instance) <= maxItems;
|
|
4851
3745
|
|
|
4852
|
-
var
|
|
3746
|
+
var maxItems = { compile: compile$o, interpret: interpret$o };
|
|
4853
3747
|
|
|
4854
|
-
const { Schema: Schema$
|
|
3748
|
+
const { Schema: Schema$r, Instance: Instance$j } = lib$1;
|
|
4855
3749
|
|
|
4856
3750
|
|
|
4857
|
-
const compile$
|
|
4858
|
-
const interpret$
|
|
3751
|
+
const compile$n = (schema) => Schema$r.value(schema);
|
|
3752
|
+
const interpret$n = (maxLength, instance) => !Instance$j.typeOf(instance, "string") || [...Instance$j.value(instance)].length <= maxLength;
|
|
4859
3753
|
|
|
4860
|
-
var
|
|
3754
|
+
var maxLength = { compile: compile$n, interpret: interpret$n };
|
|
4861
3755
|
|
|
4862
|
-
const { Schema: Schema$
|
|
3756
|
+
const { Schema: Schema$q, Instance: Instance$i } = lib$1;
|
|
4863
3757
|
|
|
4864
3758
|
|
|
4865
|
-
const compile$
|
|
4866
|
-
const interpret$
|
|
3759
|
+
const compile$m = (schema) => Schema$q.value(schema);
|
|
3760
|
+
const interpret$m = (maxProperties, instance) => !Instance$i.typeOf(instance, "object") || Instance$i.keys(instance).length <= maxProperties;
|
|
4867
3761
|
|
|
4868
|
-
var maxProperties = { compile: compile$
|
|
3762
|
+
var maxProperties = { compile: compile$m, interpret: interpret$m };
|
|
4869
3763
|
|
|
4870
|
-
const { Schema: Schema$
|
|
3764
|
+
const { Schema: Schema$p, Instance: Instance$h } = lib$1;
|
|
4871
3765
|
|
|
4872
3766
|
|
|
4873
|
-
const compile$
|
|
4874
|
-
const exclusiveMaximum = await Schema$
|
|
4875
|
-
const isExclusive = Schema$
|
|
3767
|
+
const compile$l = async (schema, ast, parentSchema) => {
|
|
3768
|
+
const exclusiveMaximum = await Schema$p.step("exclusiveMaximum", parentSchema);
|
|
3769
|
+
const isExclusive = Schema$p.value(exclusiveMaximum);
|
|
4876
3770
|
|
|
4877
|
-
return [Schema$
|
|
3771
|
+
return [Schema$p.value(schema), isExclusive];
|
|
4878
3772
|
};
|
|
4879
3773
|
|
|
4880
|
-
const interpret$
|
|
4881
|
-
if (!Instance$
|
|
3774
|
+
const interpret$l = ([maximum, isExclusive], instance) => {
|
|
3775
|
+
if (!Instance$h.typeOf(instance, "number")) {
|
|
4882
3776
|
return true;
|
|
4883
3777
|
}
|
|
4884
3778
|
|
|
4885
|
-
const value = Instance$
|
|
3779
|
+
const value = Instance$h.value(instance);
|
|
4886
3780
|
return isExclusive ? value < maximum : value <= maximum;
|
|
4887
3781
|
};
|
|
4888
3782
|
|
|
4889
|
-
var maximumExclusiveMaximum = { compile: compile$
|
|
4890
|
-
|
|
4891
|
-
const { Schema: Schema$p, Instance: Instance$h } = lib$2;
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
const compile$l = async (schema) => Schema$p.value(schema);
|
|
4895
|
-
const interpret$l = (maximum, instance) => !Instance$h.typeOf(instance, "number") || Instance$h.value(instance) <= maximum;
|
|
4896
|
-
|
|
4897
|
-
var maximum = { compile: compile$l, interpret: interpret$l };
|
|
3783
|
+
var maximumExclusiveMaximum = { compile: compile$l, interpret: interpret$l };
|
|
4898
3784
|
|
|
4899
|
-
const { Schema: Schema$o, Instance: Instance$g } = lib$
|
|
3785
|
+
const { Schema: Schema$o, Instance: Instance$g } = lib$1;
|
|
4900
3786
|
|
|
4901
3787
|
|
|
4902
|
-
const compile$k = (schema) => Schema$o.value(schema);
|
|
4903
|
-
const interpret$k = (
|
|
3788
|
+
const compile$k = async (schema) => Schema$o.value(schema);
|
|
3789
|
+
const interpret$k = (maximum, instance) => !Instance$g.typeOf(instance, "number") || Instance$g.value(instance) <= maximum;
|
|
4904
3790
|
|
|
4905
|
-
var
|
|
3791
|
+
var maximum = { compile: compile$k, interpret: interpret$k };
|
|
4906
3792
|
|
|
4907
|
-
const { Schema: Schema$n, Instance: Instance$f } = lib$
|
|
3793
|
+
const { Schema: Schema$n, Instance: Instance$f } = lib$1;
|
|
4908
3794
|
|
|
4909
3795
|
|
|
4910
3796
|
const compile$j = (schema) => Schema$n.value(schema);
|
|
4911
|
-
const interpret$j = (
|
|
3797
|
+
const interpret$j = (minItems, instance) => !Instance$f.typeOf(instance, "array") || Instance$f.length(instance) >= minItems;
|
|
4912
3798
|
|
|
4913
|
-
var
|
|
3799
|
+
var minItems = { compile: compile$j, interpret: interpret$j };
|
|
4914
3800
|
|
|
4915
|
-
const { Schema: Schema$m, Instance: Instance$e } = lib$
|
|
3801
|
+
const { Schema: Schema$m, Instance: Instance$e } = lib$1;
|
|
4916
3802
|
|
|
4917
3803
|
|
|
4918
3804
|
const compile$i = (schema) => Schema$m.value(schema);
|
|
4919
3805
|
const interpret$i = (minLength, instance) => !Instance$e.typeOf(instance, "string") || [...Instance$e.value(instance)].length >= minLength;
|
|
4920
3806
|
|
|
4921
|
-
var
|
|
3807
|
+
var minLength = { compile: compile$i, interpret: interpret$i };
|
|
4922
3808
|
|
|
4923
|
-
const { Schema: Schema$l, Instance: Instance$d } = lib$
|
|
3809
|
+
const { Schema: Schema$l, Instance: Instance$d } = lib$1;
|
|
4924
3810
|
|
|
4925
3811
|
|
|
4926
3812
|
const compile$h = (schema) => Schema$l.value(schema);
|
|
@@ -4928,7 +3814,7 @@ const interpret$h = (minProperties, instance) => !Instance$d.typeOf(instance, "o
|
|
|
4928
3814
|
|
|
4929
3815
|
var minProperties = { compile: compile$h, interpret: interpret$h };
|
|
4930
3816
|
|
|
4931
|
-
const { Schema: Schema$k, Instance: Instance$c } = lib$
|
|
3817
|
+
const { Schema: Schema$k, Instance: Instance$c } = lib$1;
|
|
4932
3818
|
|
|
4933
3819
|
|
|
4934
3820
|
const compile$g = async (schema, ast, parentSchema) => {
|
|
@@ -4949,7 +3835,7 @@ const interpret$g = ([minimum, isExclusive], instance) => {
|
|
|
4949
3835
|
|
|
4950
3836
|
var minimumExclusiveMinimum = { compile: compile$g, interpret: interpret$g };
|
|
4951
3837
|
|
|
4952
|
-
const { Schema: Schema$j, Instance: Instance$b } = lib$
|
|
3838
|
+
const { Schema: Schema$j, Instance: Instance$b } = lib$1;
|
|
4953
3839
|
|
|
4954
3840
|
|
|
4955
3841
|
const compile$f = async (schema) => Schema$j.value(schema);
|
|
@@ -4957,7 +3843,7 @@ const interpret$f = (minimum, instance) => !Instance$b.typeOf(instance, "number"
|
|
|
4957
3843
|
|
|
4958
3844
|
var minimum = { compile: compile$f, interpret: interpret$f };
|
|
4959
3845
|
|
|
4960
|
-
const { Schema: Schema$i, Instance: Instance$a } = lib$
|
|
3846
|
+
const { Schema: Schema$i, Instance: Instance$a } = lib$1;
|
|
4961
3847
|
|
|
4962
3848
|
|
|
4963
3849
|
const compile$e = (schema) => Schema$i.value(schema);
|
|
@@ -4975,7 +3861,7 @@ const numberEqual = (a, b) => Math.abs(a - b) < 1.19209290e-7;
|
|
|
4975
3861
|
|
|
4976
3862
|
var multipleOf = { compile: compile$e, interpret: interpret$e };
|
|
4977
3863
|
|
|
4978
|
-
const { Core: Core$f } = lib$
|
|
3864
|
+
const { Core: Core$f } = lib$1;
|
|
4979
3865
|
|
|
4980
3866
|
|
|
4981
3867
|
const compile$d = Core$f.compileSchema;
|
|
@@ -4983,7 +3869,7 @@ const interpret$d = (not, instance, ast, dynamicAnchors) => !Core$f.interpretSch
|
|
|
4983
3869
|
|
|
4984
3870
|
var not = { compile: compile$d, interpret: interpret$d };
|
|
4985
3871
|
|
|
4986
|
-
const { Core: Core$e, Schema: Schema$h } = lib$
|
|
3872
|
+
const { Core: Core$e, Schema: Schema$h } = lib$1;
|
|
4987
3873
|
|
|
4988
3874
|
|
|
4989
3875
|
const compile$c = async (schema, ast) => {
|
|
@@ -5032,7 +3918,7 @@ const collectEvaluatedItems$4 = (oneOf, instance, ast, dynamicAnchors) => {
|
|
|
5032
3918
|
|
|
5033
3919
|
var oneOf = { compile: compile$c, interpret: interpret$c, collectEvaluatedProperties: collectEvaluatedProperties$5, collectEvaluatedItems: collectEvaluatedItems$4 };
|
|
5034
3920
|
|
|
5035
|
-
const { Schema: Schema$g, Instance: Instance$9 } = lib$
|
|
3921
|
+
const { Schema: Schema$g, Instance: Instance$9 } = lib$1;
|
|
5036
3922
|
|
|
5037
3923
|
|
|
5038
3924
|
const compile$b = (schema) => new RegExp(Schema$g.value(schema), "u");
|
|
@@ -5040,8 +3926,8 @@ const interpret$b = (pattern, instance) => !Instance$9.typeOf(instance, "string"
|
|
|
5040
3926
|
|
|
5041
3927
|
var pattern = { compile: compile$b, interpret: interpret$b };
|
|
5042
3928
|
|
|
5043
|
-
const { Core: Core$d, Schema: Schema$f, Instance: Instance$8 } = lib$
|
|
5044
|
-
const Pact$2 = lib$
|
|
3929
|
+
const { Core: Core$d, Schema: Schema$f, Instance: Instance$8 } = lib$1;
|
|
3930
|
+
const Pact$2 = lib$2;
|
|
5045
3931
|
|
|
5046
3932
|
|
|
5047
3933
|
const compile$a = (schema, ast) => Pact$2.pipeline([
|
|
@@ -5078,8 +3964,8 @@ const splitUrl$1 = (url) => {
|
|
|
5078
3964
|
|
|
5079
3965
|
var common = { isObject, escapeRegExp: escapeRegExp$1, splitUrl: splitUrl$1 };
|
|
5080
3966
|
|
|
5081
|
-
const { Core: Core$c, Schema: Schema$e, Instance: Instance$7 } = lib$
|
|
5082
|
-
const Pact$1 = lib$
|
|
3967
|
+
const { Core: Core$c, Schema: Schema$e, Instance: Instance$7 } = lib$1;
|
|
3968
|
+
const Pact$1 = lib$2;
|
|
5083
3969
|
const { escapeRegExp } = common;
|
|
5084
3970
|
|
|
5085
3971
|
|
|
@@ -5104,7 +3990,7 @@ const collectEvaluatedProperties$3 = (properties, instance, ast, dynamicAnchors)
|
|
|
5104
3990
|
|
|
5105
3991
|
var properties = { compile: compile$9, interpret: interpret$9, collectEvaluatedProperties: collectEvaluatedProperties$3 };
|
|
5106
3992
|
|
|
5107
|
-
const { Core: Core$b, Instance: Instance$6 } = lib$
|
|
3993
|
+
const { Core: Core$b, Instance: Instance$6 } = lib$1;
|
|
5108
3994
|
|
|
5109
3995
|
|
|
5110
3996
|
const compile$8 = (schema, ast) => Core$b.compileSchema(schema, ast);
|
|
@@ -5116,7 +4002,7 @@ const interpret$8 = (propertyNames, instance, ast, dynamicAnchors) => {
|
|
|
5116
4002
|
|
|
5117
4003
|
var propertyNames = { compile: compile$8, interpret: interpret$8 };
|
|
5118
4004
|
|
|
5119
|
-
const { Core: Core$a, Schema: Schema$d } = lib$
|
|
4005
|
+
const { Core: Core$a, Schema: Schema$d } = lib$1;
|
|
5120
4006
|
const { splitUrl } = common;
|
|
5121
4007
|
|
|
5122
4008
|
|
|
@@ -5141,7 +4027,7 @@ const collectEvaluatedItems$3 = Core$a.collectEvaluatedItems;
|
|
|
5141
4027
|
|
|
5142
4028
|
var dynamicRef = { compile: compile$7, interpret: interpret$7, collectEvaluatedProperties: collectEvaluatedProperties$2, collectEvaluatedItems: collectEvaluatedItems$3 };
|
|
5143
4029
|
|
|
5144
|
-
const { Core: Core$9, Schema: Schema$c } = lib$
|
|
4030
|
+
const { Core: Core$9, Schema: Schema$c } = lib$1;
|
|
5145
4031
|
|
|
5146
4032
|
|
|
5147
4033
|
const compile$6 = async (ref, ast) => {
|
|
@@ -5155,7 +4041,7 @@ const collectEvaluatedItems$2 = Core$9.collectEvaluatedItems;
|
|
|
5155
4041
|
|
|
5156
4042
|
var ref = { compile: compile$6, interpret: interpret$6, collectEvaluatedProperties: collectEvaluatedProperties$1, collectEvaluatedItems: collectEvaluatedItems$2 };
|
|
5157
4043
|
|
|
5158
|
-
const { Schema: Schema$b, Instance: Instance$5 } = lib$
|
|
4044
|
+
const { Schema: Schema$b, Instance: Instance$5 } = lib$1;
|
|
5159
4045
|
|
|
5160
4046
|
|
|
5161
4047
|
const compile$5 = (schema) => Schema$b.value(schema);
|
|
@@ -5166,8 +4052,8 @@ const interpret$5 = (required, instance) => {
|
|
|
5166
4052
|
|
|
5167
4053
|
var required = { compile: compile$5, interpret: interpret$5 };
|
|
5168
4054
|
|
|
5169
|
-
const { Core: Core$8, Schema: Schema$a, Instance: Instance$4 } = lib$
|
|
5170
|
-
const Pact = lib$
|
|
4055
|
+
const { Core: Core$8, Schema: Schema$a, Instance: Instance$4 } = lib$1;
|
|
4056
|
+
const Pact = lib$2;
|
|
5171
4057
|
|
|
5172
4058
|
|
|
5173
4059
|
const compile$4 = (schema, ast) => {
|
|
@@ -5191,7 +4077,7 @@ const collectEvaluatedItems$1 = (items, instance, ast, dynamicAnchors) => {
|
|
|
5191
4077
|
|
|
5192
4078
|
var tupleItems = { compile: compile$4, interpret: interpret$4, collectEvaluatedItems: collectEvaluatedItems$1 };
|
|
5193
4079
|
|
|
5194
|
-
const { Schema: Schema$9, Instance: Instance$3 } = lib$
|
|
4080
|
+
const { Schema: Schema$9, Instance: Instance$3 } = lib$1;
|
|
5195
4081
|
|
|
5196
4082
|
|
|
5197
4083
|
const compile$3 = (schema) => Schema$9.value(schema);
|
|
@@ -5199,7 +4085,7 @@ const interpret$3 = (type, instance) => typeof type === "string" ? Instance$3.ty
|
|
|
5199
4085
|
|
|
5200
4086
|
var type = { compile: compile$3, interpret: interpret$3 };
|
|
5201
4087
|
|
|
5202
|
-
const { Core: Core$7, Schema: Schema$8, Instance: Instance$2 } = lib$
|
|
4088
|
+
const { Core: Core$7, Schema: Schema$8, Instance: Instance$2 } = lib$1;
|
|
5203
4089
|
|
|
5204
4090
|
|
|
5205
4091
|
const compile$2 = async (schema, ast, parentSchema) => {
|
|
@@ -5223,7 +4109,7 @@ const collectEvaluatedItems = (keywordValue, instance, ast, dynamicAnchors) => {
|
|
|
5223
4109
|
|
|
5224
4110
|
var unevaluatedItems = { compile: compile$2, interpret: interpret$2, collectEvaluatedItems };
|
|
5225
4111
|
|
|
5226
|
-
const { Core: Core$6, Schema: Schema$7, Instance: Instance$1 } = lib$
|
|
4112
|
+
const { Core: Core$6, Schema: Schema$7, Instance: Instance$1 } = lib$1;
|
|
5227
4113
|
|
|
5228
4114
|
|
|
5229
4115
|
const compile$1 = async (schema, ast, parentSchema) => {
|
|
@@ -5248,7 +4134,7 @@ const collectEvaluatedProperties = (keywordValue, instance, ast, dynamicAnchors)
|
|
|
5248
4134
|
|
|
5249
4135
|
var unevaluatedProperties = { compile: compile$1, interpret: interpret$1, collectEvaluatedProperties };
|
|
5250
4136
|
|
|
5251
|
-
const { Schema: Schema$6, Instance } = lib$
|
|
4137
|
+
const { Schema: Schema$6, Instance } = lib$1;
|
|
5252
4138
|
const jsonStringify = fastestStableStringify;
|
|
5253
4139
|
|
|
5254
4140
|
|
|
@@ -5265,7 +4151,7 @@ const interpret = (uniqueItems, instance) => {
|
|
|
5265
4151
|
|
|
5266
4152
|
var uniqueItems = { compile, interpret };
|
|
5267
4153
|
|
|
5268
|
-
const { Keywords: Keywords$1 } = lib$
|
|
4154
|
+
const { Keywords: Keywords$1 } = lib$1;
|
|
5269
4155
|
|
|
5270
4156
|
|
|
5271
4157
|
var keywords$5 = {
|
|
@@ -5292,14 +4178,12 @@ var keywords$5 = {
|
|
|
5292
4178
|
items202012: items202012,
|
|
5293
4179
|
maxItems: maxItems,
|
|
5294
4180
|
maxLength: maxLength,
|
|
5295
|
-
maxLength6: maxLength6,
|
|
5296
4181
|
maxProperties: maxProperties,
|
|
5297
4182
|
maximumExclusiveMaximum: maximumExclusiveMaximum,
|
|
5298
4183
|
maximum: maximum,
|
|
5299
4184
|
metaData: Keywords$1.metaData,
|
|
5300
4185
|
minItems: minItems,
|
|
5301
4186
|
minLength: minLength,
|
|
5302
|
-
minLength6: minLength6,
|
|
5303
4187
|
minProperties: minProperties,
|
|
5304
4188
|
minimumExclusiveMinimum: minimumExclusiveMinimum,
|
|
5305
4189
|
minimum: minimum,
|
|
@@ -5471,7 +4355,7 @@ var schema$4 = `{
|
|
|
5471
4355
|
"default": {}
|
|
5472
4356
|
}`;
|
|
5473
4357
|
|
|
5474
|
-
const { Core: Core$5, Schema: Schema$5 } = lib$
|
|
4358
|
+
const { Core: Core$5, Schema: Schema$5 } = lib$1;
|
|
5475
4359
|
const keywords$4 = keywords$5;
|
|
5476
4360
|
const metaSchema$4 = schema$4;
|
|
5477
4361
|
|
|
@@ -5673,7 +4557,7 @@ var schema$3 = `{
|
|
|
5673
4557
|
"default": {}
|
|
5674
4558
|
}`;
|
|
5675
4559
|
|
|
5676
|
-
const { Core: Core$4, Schema: Schema$4 } = lib$
|
|
4560
|
+
const { Core: Core$4, Schema: Schema$4 } = lib$1;
|
|
5677
4561
|
const keywords$3 = keywords$5;
|
|
5678
4562
|
const metaSchema$3 = schema$3;
|
|
5679
4563
|
|
|
@@ -5705,11 +4589,11 @@ Core$4.defineVocabulary(jsonSchemaVersion$3, {
|
|
|
5705
4589
|
"format": keywords$3.metaData,
|
|
5706
4590
|
"items": keywords$3.items,
|
|
5707
4591
|
"maxItems": keywords$3.maxItems,
|
|
5708
|
-
"maxLength": keywords$3.
|
|
4592
|
+
"maxLength": keywords$3.maxLength,
|
|
5709
4593
|
"maxProperties": keywords$3.maxProperties,
|
|
5710
4594
|
"maximum": keywords$3.maximum,
|
|
5711
4595
|
"minItems": keywords$3.minItems,
|
|
5712
|
-
"minLength": keywords$3.
|
|
4596
|
+
"minLength": keywords$3.minLength,
|
|
5713
4597
|
"minProperties": keywords$3.minProperties,
|
|
5714
4598
|
"minimum": keywords$3.minimum,
|
|
5715
4599
|
"multipleOf": keywords$3.multipleOf,
|
|
@@ -5898,7 +4782,7 @@ var schema$2 = `{
|
|
|
5898
4782
|
"default": true
|
|
5899
4783
|
}`;
|
|
5900
4784
|
|
|
5901
|
-
const { Core: Core$3, Schema: Schema$3 } = lib$
|
|
4785
|
+
const { Core: Core$3, Schema: Schema$3 } = lib$1;
|
|
5902
4786
|
const keywords$2 = keywords$5;
|
|
5903
4787
|
const metaSchema$2 = schema$2;
|
|
5904
4788
|
|
|
@@ -5932,11 +4816,11 @@ Core$3.defineVocabulary(jsonSchemaVersion$2, {
|
|
|
5932
4816
|
"else": keywords$2.else,
|
|
5933
4817
|
"items": keywords$2.items,
|
|
5934
4818
|
"maxItems": keywords$2.maxItems,
|
|
5935
|
-
"maxLength": keywords$2.
|
|
4819
|
+
"maxLength": keywords$2.maxLength,
|
|
5936
4820
|
"maxProperties": keywords$2.maxProperties,
|
|
5937
4821
|
"maximum": keywords$2.maximum,
|
|
5938
4822
|
"minItems": keywords$2.minItems,
|
|
5939
|
-
"minLength": keywords$2.
|
|
4823
|
+
"minLength": keywords$2.minLength,
|
|
5940
4824
|
"minProperties": keywords$2.minProperties,
|
|
5941
4825
|
"minimum": keywords$2.minimum,
|
|
5942
4826
|
"multipleOf": keywords$2.multipleOf,
|
|
@@ -6281,7 +5165,7 @@ var content$1 = `{
|
|
|
6281
5165
|
}
|
|
6282
5166
|
}`;
|
|
6283
5167
|
|
|
6284
|
-
const { Core: Core$2, Schema: Schema$2 } = lib$
|
|
5168
|
+
const { Core: Core$2, Schema: Schema$2 } = lib$1;
|
|
6285
5169
|
const keywords$1 = keywords$5;
|
|
6286
5170
|
const metaSchema$1 = schema$1;
|
|
6287
5171
|
const coreMetaSchema$1 = core$1;
|
|
@@ -6340,11 +5224,11 @@ Core$2.defineVocabulary("https://json-schema.org/draft/2019-09/vocab/validation"
|
|
|
6340
5224
|
"exclusiveMaximum": keywords$1.exclusiveMaximum,
|
|
6341
5225
|
"exclusiveMinimum": keywords$1.exclusiveMinimum,
|
|
6342
5226
|
"maxItems": keywords$1.maxItems,
|
|
6343
|
-
"maxLength": keywords$1.
|
|
5227
|
+
"maxLength": keywords$1.maxLength,
|
|
6344
5228
|
"maxProperties": keywords$1.maxProperties,
|
|
6345
5229
|
"maximum": keywords$1.maximum,
|
|
6346
5230
|
"minItems": keywords$1.minItems,
|
|
6347
|
-
"minLength": keywords$1.
|
|
5231
|
+
"minLength": keywords$1.minLength,
|
|
6348
5232
|
"minProperties": keywords$1.minProperties,
|
|
6349
5233
|
"minimum": keywords$1.minimum,
|
|
6350
5234
|
"multipleOf": keywords$1.multipleOf,
|
|
@@ -6728,7 +5612,7 @@ var unevaluated = `{
|
|
|
6728
5612
|
}
|
|
6729
5613
|
}`;
|
|
6730
5614
|
|
|
6731
|
-
const { Core: Core$1, Schema: Schema$1 } = lib$
|
|
5615
|
+
const { Core: Core$1, Schema: Schema$1 } = lib$1;
|
|
6732
5616
|
const keywords = keywords$5;
|
|
6733
5617
|
const metaSchema = schema;
|
|
6734
5618
|
const coreMetaSchema = core;
|
|
@@ -6787,11 +5671,11 @@ Core$1.defineVocabulary("https://json-schema.org/draft/2020-12/vocab/validation"
|
|
|
6787
5671
|
"exclusiveMaximum": keywords.exclusiveMaximum,
|
|
6788
5672
|
"exclusiveMinimum": keywords.exclusiveMinimum,
|
|
6789
5673
|
"maxItems": keywords.maxItems,
|
|
6790
|
-
"maxLength": keywords.
|
|
5674
|
+
"maxLength": keywords.maxLength,
|
|
6791
5675
|
"maxProperties": keywords.maxProperties,
|
|
6792
5676
|
"maximum": keywords.maximum,
|
|
6793
5677
|
"minItems": keywords.minItems,
|
|
6794
|
-
"minLength": keywords.
|
|
5678
|
+
"minLength": keywords.minLength,
|
|
6795
5679
|
"minProperties": keywords.minProperties,
|
|
6796
5680
|
"minimum": keywords.minimum,
|
|
6797
5681
|
"multipleOf": keywords.multipleOf,
|
|
@@ -6832,7 +5716,7 @@ Core$1.defineVocabulary("https://json-schema.org/draft/2020-12/vocab/unevaluated
|
|
|
6832
5716
|
"unevaluatedProperties": keywords.unevaluatedProperties
|
|
6833
5717
|
});
|
|
6834
5718
|
|
|
6835
|
-
const { Core, Schema, InvalidSchemaError } = lib$
|
|
5719
|
+
const { Core, Schema, InvalidSchemaError } = lib$1;
|
|
6836
5720
|
const Keywords = keywords$5;
|
|
6837
5721
|
|
|
6838
5722
|
|