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