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