@hyperjump/json-schema 0.23.0 → 0.23.1
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 +1555 -406
- 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 +1555 -406
- 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 +1555 -406
- 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 +1555 -406
- 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 +1555 -406
- 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 +1555 -406
- 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/package.json +2 -2
package/dist/json-schema-esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
2
2
|
|
|
3
|
-
var justCurryIt = curry$
|
|
3
|
+
var justCurryIt$2 = curry$j;
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
6
|
function add(a, b, c) {
|
|
@@ -25,7 +25,7 @@ var justCurryIt = curry$a;
|
|
|
25
25
|
milesToKm(10); // 16.2
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
|
-
function curry$
|
|
28
|
+
function curry$j(fn, arity) {
|
|
29
29
|
return function curried() {
|
|
30
30
|
if (arity == null) {
|
|
31
31
|
arity = fn.length;
|
|
@@ -1896,84 +1896,84 @@ const pathRelative$1 = (from, to) => {
|
|
|
1896
1896
|
|
|
1897
1897
|
var common$1 = { jsonTypeOf: jsonTypeOf$2, resolveUrl: resolveUrl$3, urlFragment: urlFragment$1, pathRelative: pathRelative$1 };
|
|
1898
1898
|
|
|
1899
|
-
const curry$
|
|
1899
|
+
const curry$i = justCurryIt$2;
|
|
1900
1900
|
|
|
1901
1901
|
|
|
1902
|
-
const nil$
|
|
1902
|
+
const nil$3 = "";
|
|
1903
1903
|
|
|
1904
|
-
const compile$
|
|
1904
|
+
const compile$Q = (pointer) => {
|
|
1905
1905
|
if (pointer.length > 0 && pointer[0] !== "/") {
|
|
1906
1906
|
throw Error("Invalid JSON Pointer");
|
|
1907
1907
|
}
|
|
1908
1908
|
|
|
1909
|
-
return pointer.split("/").slice(1).map(unescape);
|
|
1909
|
+
return pointer.split("/").slice(1).map(unescape$1);
|
|
1910
1910
|
};
|
|
1911
1911
|
|
|
1912
|
-
const get$
|
|
1913
|
-
const ptr = compile$
|
|
1912
|
+
const get$3 = (pointer, value = undefined) => {
|
|
1913
|
+
const ptr = compile$Q(pointer);
|
|
1914
1914
|
|
|
1915
1915
|
const fn = (value) => ptr.reduce(([value, pointer], segment) => {
|
|
1916
|
-
return [applySegment(value, segment, pointer), append(segment, pointer)];
|
|
1916
|
+
return [applySegment$1(value, segment, pointer), append$1(segment, pointer)];
|
|
1917
1917
|
}, [value, ""])[0];
|
|
1918
1918
|
|
|
1919
1919
|
return value === undefined ? fn : fn(value);
|
|
1920
1920
|
};
|
|
1921
1921
|
|
|
1922
|
-
const set = (pointer, subject = undefined, value = undefined) => {
|
|
1923
|
-
const ptr = compile$
|
|
1924
|
-
const fn = curry$
|
|
1922
|
+
const set$1 = (pointer, subject = undefined, value = undefined) => {
|
|
1923
|
+
const ptr = compile$Q(pointer);
|
|
1924
|
+
const fn = curry$i((subject, value) => _set$1(ptr, subject, value, nil$3));
|
|
1925
1925
|
return subject === undefined ? fn : fn(subject, value);
|
|
1926
1926
|
};
|
|
1927
1927
|
|
|
1928
|
-
const _set = (pointer, subject, value, cursor) => {
|
|
1928
|
+
const _set$1 = (pointer, subject, value, cursor) => {
|
|
1929
1929
|
if (pointer.length === 0) {
|
|
1930
1930
|
return value;
|
|
1931
1931
|
} else if (pointer.length > 1) {
|
|
1932
1932
|
const segment = pointer.shift();
|
|
1933
|
-
return { ...subject, [segment]: _set(pointer, applySegment(subject, segment, cursor), value, append(segment, cursor)) };
|
|
1933
|
+
return { ...subject, [segment]: _set$1(pointer, applySegment$1(subject, segment, cursor), value, append$1(segment, cursor)) };
|
|
1934
1934
|
} else if (Array.isArray(subject)) {
|
|
1935
1935
|
const clonedSubject = [...subject];
|
|
1936
|
-
const segment = computeSegment(subject, pointer[0]);
|
|
1936
|
+
const segment = computeSegment$1(subject, pointer[0]);
|
|
1937
1937
|
clonedSubject[segment] = value;
|
|
1938
1938
|
return clonedSubject;
|
|
1939
1939
|
} else if (typeof subject === "object" && subject !== null) {
|
|
1940
1940
|
return { ...subject, [pointer[0]]: value };
|
|
1941
1941
|
} else {
|
|
1942
|
-
return applySegment(subject, pointer[0], cursor);
|
|
1942
|
+
return applySegment$1(subject, pointer[0], cursor);
|
|
1943
1943
|
}
|
|
1944
1944
|
};
|
|
1945
1945
|
|
|
1946
|
-
const assign = (pointer, subject = undefined, value = undefined) => {
|
|
1947
|
-
const ptr = compile$
|
|
1948
|
-
const fn = curry$
|
|
1946
|
+
const assign$1 = (pointer, subject = undefined, value = undefined) => {
|
|
1947
|
+
const ptr = compile$Q(pointer);
|
|
1948
|
+
const fn = curry$i((subject, value) => _assign$1(ptr, subject, value, nil$3));
|
|
1949
1949
|
return subject === undefined ? fn : fn(subject, value);
|
|
1950
1950
|
};
|
|
1951
1951
|
|
|
1952
|
-
const _assign = (pointer, subject, value, cursor) => {
|
|
1952
|
+
const _assign$1 = (pointer, subject, value, cursor) => {
|
|
1953
1953
|
if (pointer.length === 0) {
|
|
1954
1954
|
return;
|
|
1955
|
-
} else if (pointer.length === 1 && !isScalar(subject)) {
|
|
1956
|
-
const segment = computeSegment(subject, pointer[0]);
|
|
1955
|
+
} else if (pointer.length === 1 && !isScalar$1(subject)) {
|
|
1956
|
+
const segment = computeSegment$1(subject, pointer[0]);
|
|
1957
1957
|
subject[segment] = value;
|
|
1958
1958
|
} else {
|
|
1959
1959
|
const segment = pointer.shift();
|
|
1960
|
-
_assign(pointer, applySegment(subject, segment, cursor), value, append(segment, cursor));
|
|
1960
|
+
_assign$1(pointer, applySegment$1(subject, segment, cursor), value, append$1(segment, cursor));
|
|
1961
1961
|
}
|
|
1962
1962
|
};
|
|
1963
1963
|
|
|
1964
|
-
const unset = (pointer, subject = undefined) => {
|
|
1965
|
-
const ptr = compile$
|
|
1966
|
-
const fn = (subject) => _unset(ptr, subject, nil$
|
|
1964
|
+
const unset$1 = (pointer, subject = undefined) => {
|
|
1965
|
+
const ptr = compile$Q(pointer);
|
|
1966
|
+
const fn = (subject) => _unset$1(ptr, subject, nil$3);
|
|
1967
1967
|
return subject === undefined ? fn : fn(subject);
|
|
1968
1968
|
};
|
|
1969
1969
|
|
|
1970
|
-
const _unset = (pointer, subject, cursor) => {
|
|
1970
|
+
const _unset$1 = (pointer, subject, cursor) => {
|
|
1971
1971
|
if (pointer.length == 0) {
|
|
1972
1972
|
return undefined;
|
|
1973
1973
|
} else if (pointer.length > 1) {
|
|
1974
1974
|
const segment = pointer.shift();
|
|
1975
|
-
const value = applySegment(subject, segment, cursor);
|
|
1976
|
-
return { ...subject, [segment]: _unset(pointer, value, append(segment, cursor)) };
|
|
1975
|
+
const value = applySegment$1(subject, segment, cursor);
|
|
1976
|
+
return { ...subject, [segment]: _unset$1(pointer, value, append$1(segment, cursor)) };
|
|
1977
1977
|
} else if (Array.isArray(subject)) {
|
|
1978
1978
|
return subject.filter((_, ndx) => ndx != pointer[0]);
|
|
1979
1979
|
} else if (typeof subject === "object" && subject !== null) {
|
|
@@ -1981,54 +1981,54 @@ const _unset = (pointer, subject, cursor) => {
|
|
|
1981
1981
|
const { [pointer[0]]: _, ...result } = subject;
|
|
1982
1982
|
return result;
|
|
1983
1983
|
} else {
|
|
1984
|
-
return applySegment(subject, pointer[0], cursor);
|
|
1984
|
+
return applySegment$1(subject, pointer[0], cursor);
|
|
1985
1985
|
}
|
|
1986
1986
|
};
|
|
1987
1987
|
|
|
1988
|
-
const remove = (pointer, subject = undefined) => {
|
|
1989
|
-
const ptr = compile$
|
|
1990
|
-
const fn = (subject) => _remove(ptr, subject, nil$
|
|
1988
|
+
const remove$1 = (pointer, subject = undefined) => {
|
|
1989
|
+
const ptr = compile$Q(pointer);
|
|
1990
|
+
const fn = (subject) => _remove$1(ptr, subject, nil$3);
|
|
1991
1991
|
return subject === undefined ? fn : fn(subject);
|
|
1992
1992
|
};
|
|
1993
1993
|
|
|
1994
|
-
const _remove = (pointer, subject, cursor) => {
|
|
1994
|
+
const _remove$1 = (pointer, subject, cursor) => {
|
|
1995
1995
|
if (pointer.length === 0) {
|
|
1996
1996
|
return;
|
|
1997
1997
|
} else if (pointer.length > 1) {
|
|
1998
1998
|
const segment = pointer.shift();
|
|
1999
|
-
const value = applySegment(subject, segment, cursor);
|
|
2000
|
-
_remove(pointer, value, append(segment, cursor));
|
|
1999
|
+
const value = applySegment$1(subject, segment, cursor);
|
|
2000
|
+
_remove$1(pointer, value, append$1(segment, cursor));
|
|
2001
2001
|
} else if (Array.isArray(subject)) {
|
|
2002
2002
|
subject.splice(pointer[0], 1);
|
|
2003
2003
|
} else if (typeof subject === "object" && subject !== null) {
|
|
2004
2004
|
delete subject[pointer[0]];
|
|
2005
2005
|
} else {
|
|
2006
|
-
applySegment(subject, pointer[0], cursor);
|
|
2006
|
+
applySegment$1(subject, pointer[0], cursor);
|
|
2007
2007
|
}
|
|
2008
2008
|
};
|
|
2009
2009
|
|
|
2010
|
-
const append = curry$
|
|
2010
|
+
const append$1 = curry$i((segment, pointer) => pointer + "/" + escape$2(segment));
|
|
2011
2011
|
|
|
2012
|
-
const escape = (segment) => segment.toString().replace(/~/g, "~0").replace(/\//g, "~1");
|
|
2013
|
-
const unescape = (segment) => segment.toString().replace(/~1/g, "/").replace(/~0/g, "~");
|
|
2014
|
-
const computeSegment = (value, segment) => Array.isArray(value) && segment === "-" ? value.length : segment;
|
|
2012
|
+
const escape$2 = (segment) => segment.toString().replace(/~/g, "~0").replace(/\//g, "~1");
|
|
2013
|
+
const unescape$1 = (segment) => segment.toString().replace(/~1/g, "/").replace(/~0/g, "~");
|
|
2014
|
+
const computeSegment$1 = (value, segment) => Array.isArray(value) && segment === "-" ? value.length : segment;
|
|
2015
2015
|
|
|
2016
|
-
const applySegment = (value, segment, cursor = "") => {
|
|
2016
|
+
const applySegment$1 = (value, segment, cursor = "") => {
|
|
2017
2017
|
if (value === undefined) {
|
|
2018
2018
|
throw TypeError(`Value at '${cursor}' is undefined and does not have property '${segment}'`);
|
|
2019
2019
|
} else if (value === null) {
|
|
2020
2020
|
throw TypeError(`Value at '${cursor}' is null and does not have property '${segment}'`);
|
|
2021
|
-
} else if (isScalar(value)) {
|
|
2021
|
+
} else if (isScalar$1(value)) {
|
|
2022
2022
|
throw TypeError(`Value at '${cursor}' is a ${typeof value} and does not have property '${segment}'`);
|
|
2023
2023
|
} else {
|
|
2024
|
-
const computedSegment = computeSegment(value, segment);
|
|
2024
|
+
const computedSegment = computeSegment$1(value, segment);
|
|
2025
2025
|
return value[computedSegment];
|
|
2026
2026
|
}
|
|
2027
2027
|
};
|
|
2028
2028
|
|
|
2029
|
-
const isScalar = (value) => value === null || typeof value !== "object";
|
|
2029
|
+
const isScalar$1 = (value) => value === null || typeof value !== "object";
|
|
2030
2030
|
|
|
2031
|
-
var lib$
|
|
2031
|
+
var lib$6 = { nil: nil$3, append: append$1, get: get$3, set: set$1, assign: assign$1, unset: unset$1, remove: remove$1 };
|
|
2032
2032
|
|
|
2033
2033
|
const $__value = Symbol("$__value");
|
|
2034
2034
|
const $__href = Symbol("$__href");
|
|
@@ -2044,16 +2044,16 @@ const value$2 = (ref) => ref[$__value];
|
|
|
2044
2044
|
|
|
2045
2045
|
var reference = { cons: cons$1, isReference, href, value: value$2 };
|
|
2046
2046
|
|
|
2047
|
-
const JsonPointer$
|
|
2048
|
-
const curry$
|
|
2047
|
+
const JsonPointer$3 = lib$6;
|
|
2048
|
+
const curry$h = justCurryIt$2;
|
|
2049
2049
|
const { resolveUrl: resolveUrl$2, jsonTypeOf: jsonTypeOf$1 } = common$1;
|
|
2050
2050
|
const Reference$2 = reference;
|
|
2051
2051
|
|
|
2052
2052
|
|
|
2053
|
-
const nil$
|
|
2054
|
-
const cons = (instance, id = "") => Object.freeze({ ...nil$
|
|
2053
|
+
const nil$2 = Object.freeze({ id: "", pointer: "", instance: undefined, value: undefined });
|
|
2054
|
+
const cons = (instance, id = "") => Object.freeze({ ...nil$2, id: resolveUrl$2(id, ""), instance, value: instance });
|
|
2055
2055
|
|
|
2056
|
-
const get$
|
|
2056
|
+
const get$2 = (url, instance = nil$2) => {
|
|
2057
2057
|
if (!url.startsWith("#")) {
|
|
2058
2058
|
throw Error(`No JSON document found at '${url.split("#")[0]}'`);
|
|
2059
2059
|
}
|
|
@@ -2064,252 +2064,1275 @@ const get$1 = (url, instance = nil$1) => {
|
|
|
2064
2064
|
const uri$1 = (doc) => `${doc.id}#${encodeURI(doc.pointer)}`;
|
|
2065
2065
|
const value$1 = (doc) => Reference$2.isReference(doc.value) ? Reference$2.value(doc.value) : doc.value;
|
|
2066
2066
|
const has$1 = (key, doc) => key in value$1(doc);
|
|
2067
|
-
const typeOf$1 = curry$
|
|
2067
|
+
const typeOf$1 = curry$h((doc, type) => jsonTypeOf$1(value$1(doc), type));
|
|
2068
2068
|
|
|
2069
2069
|
const step$1 = (key, doc) => Object.freeze({
|
|
2070
2070
|
...doc,
|
|
2071
|
-
pointer: JsonPointer$
|
|
2071
|
+
pointer: JsonPointer$3.append(key, doc.pointer),
|
|
2072
2072
|
value: value$1(doc)[key]
|
|
2073
2073
|
});
|
|
2074
2074
|
|
|
2075
|
-
const entries$
|
|
2075
|
+
const entries$5 = (doc) => Object.keys(value$1(doc))
|
|
2076
2076
|
.map((key) => [key, step$1(key, doc)]);
|
|
2077
2077
|
|
|
2078
2078
|
const keys$1 = (doc) => Object.keys(value$1(doc));
|
|
2079
2079
|
|
|
2080
|
-
const map$
|
|
2080
|
+
const map$7 = curry$h((fn, doc) => value$1(doc)
|
|
2081
2081
|
.map((item, ndx, array, thisArg) => fn(step$1(ndx, doc), ndx, array, thisArg)));
|
|
2082
2082
|
|
|
2083
|
-
const forEach = curry$
|
|
2083
|
+
const forEach = curry$h((fn, doc) => value$1(doc)
|
|
2084
2084
|
.forEach((item, ndx, array, thisArg) => fn(step$1(ndx, doc), ndx, array, thisArg)));
|
|
2085
2085
|
|
|
2086
|
-
const filter$
|
|
2086
|
+
const filter$2 = curry$h((fn, doc) => value$1(doc)
|
|
2087
2087
|
.map((item, ndx, array, thisArg) => step$1(ndx, doc))
|
|
2088
2088
|
.filter((item, ndx, array, thisArg) => fn(item, ndx, array, thisArg)));
|
|
2089
2089
|
|
|
2090
|
-
const reduce$
|
|
2090
|
+
const reduce$6 = curry$h((fn, acc, doc) => value$1(doc)
|
|
2091
2091
|
.reduce((acc, item, ndx) => fn(acc, step$1(ndx, doc), ndx), acc));
|
|
2092
2092
|
|
|
2093
|
-
const every$
|
|
2093
|
+
const every$2 = curry$h((fn, doc) => value$1(doc)
|
|
2094
2094
|
.every((item, ndx, array, thisArg) => fn(step$1(ndx, doc), ndx, array, thisArg)));
|
|
2095
2095
|
|
|
2096
|
-
const some$
|
|
2096
|
+
const some$2 = curry$h((fn, doc) => value$1(doc)
|
|
2097
2097
|
.some((item, ndx, array, thisArg) => fn(step$1(ndx, doc), ndx, array, thisArg)));
|
|
2098
2098
|
|
|
2099
2099
|
const length$1 = (doc) => value$1(doc).length;
|
|
2100
2100
|
|
|
2101
2101
|
var instance = {
|
|
2102
|
-
nil: nil$
|
|
2103
|
-
step: step$1, entries: entries$
|
|
2102
|
+
nil: nil$2, cons, get: get$2, uri: uri$1, value: value$1, has: has$1, typeOf: typeOf$1, length: length$1,
|
|
2103
|
+
step: step$1, entries: entries$5, keys: keys$1, map: map$7, forEach, filter: filter$2, reduce: reduce$6, every: every$2, some: some$2
|
|
2104
2104
|
};
|
|
2105
2105
|
|
|
2106
|
-
var entries$
|
|
2106
|
+
var entries$4 = async (doc) => Object.entries(await doc);
|
|
2107
2107
|
|
|
2108
|
-
const curry$
|
|
2108
|
+
const curry$g = justCurryIt$2;
|
|
2109
2109
|
|
|
2110
2110
|
|
|
2111
|
-
var map$
|
|
2111
|
+
var map$6 = curry$g(async (fn, doc) => (await doc).map(fn));
|
|
2112
2112
|
|
|
2113
|
-
const curry$
|
|
2113
|
+
const curry$f = justCurryIt$2;
|
|
2114
2114
|
|
|
2115
2115
|
|
|
2116
|
-
var reduce$
|
|
2116
|
+
var reduce$5 = curry$f(async (fn, acc, doc) => {
|
|
2117
2117
|
return (await doc).reduce(async (acc, item) => fn(await acc, item), acc);
|
|
2118
2118
|
});
|
|
2119
2119
|
|
|
2120
|
-
const curry$
|
|
2121
|
-
const reduce$
|
|
2120
|
+
const curry$e = justCurryIt$2;
|
|
2121
|
+
const reduce$4 = reduce$5;
|
|
2122
2122
|
|
|
2123
2123
|
|
|
2124
|
-
var filter = curry$
|
|
2125
|
-
return reduce$
|
|
2124
|
+
var filter$1 = curry$e(async (fn, doc, options = {}) => {
|
|
2125
|
+
return reduce$4(async (acc, item) => {
|
|
2126
2126
|
return (await fn(item)) ? acc.concat([item]) : acc;
|
|
2127
2127
|
}, [], doc, options);
|
|
2128
2128
|
});
|
|
2129
2129
|
|
|
2130
|
-
const curry$
|
|
2131
|
-
const map$
|
|
2130
|
+
const curry$d = justCurryIt$2;
|
|
2131
|
+
const map$5 = map$6;
|
|
2132
2132
|
|
|
2133
2133
|
|
|
2134
|
-
var some = curry$
|
|
2135
|
-
const results = await map$
|
|
2134
|
+
var some$1 = curry$d(async (fn, doc) => {
|
|
2135
|
+
const results = await map$5(fn, doc);
|
|
2136
2136
|
return (await Promise.all(results))
|
|
2137
2137
|
.some((a) => a);
|
|
2138
2138
|
});
|
|
2139
2139
|
|
|
2140
|
-
const curry$
|
|
2141
|
-
const map$
|
|
2140
|
+
const curry$c = justCurryIt$2;
|
|
2141
|
+
const map$4 = map$6;
|
|
2142
2142
|
|
|
2143
2143
|
|
|
2144
|
-
var every = curry$
|
|
2145
|
-
const results = await map$
|
|
2144
|
+
var every$1 = curry$c(async (fn, doc) => {
|
|
2145
|
+
const results = await map$4(fn, doc);
|
|
2146
2146
|
return (await Promise.all(results))
|
|
2147
2147
|
.every((a) => a);
|
|
2148
2148
|
});
|
|
2149
2149
|
|
|
2150
|
-
const curry$
|
|
2150
|
+
const curry$b = justCurryIt$2;
|
|
2151
2151
|
|
|
2152
2152
|
|
|
2153
|
-
var pipeline$
|
|
2153
|
+
var pipeline$3 = curry$b((fns, doc) => {
|
|
2154
2154
|
return fns.reduce(async (acc, fn) => fn(await acc), doc);
|
|
2155
2155
|
});
|
|
2156
2156
|
|
|
2157
|
-
var all = (doc) => Promise.all(doc);
|
|
2157
|
+
var all$1 = (doc) => Promise.all(doc);
|
|
2158
2158
|
|
|
2159
|
-
const pipeline = pipeline$
|
|
2160
|
-
const entries$
|
|
2161
|
-
const reduce = reduce$
|
|
2159
|
+
const pipeline$2 = pipeline$3;
|
|
2160
|
+
const entries$3 = entries$4;
|
|
2161
|
+
const reduce$3 = reduce$5;
|
|
2162
2162
|
|
|
2163
2163
|
|
|
2164
|
-
var allValues = (doc) => {
|
|
2165
|
-
return pipeline([
|
|
2166
|
-
entries$
|
|
2167
|
-
reduce(async (acc, [propertyName, propertyValue]) => {
|
|
2164
|
+
var allValues$1 = (doc) => {
|
|
2165
|
+
return pipeline$2([
|
|
2166
|
+
entries$3,
|
|
2167
|
+
reduce$3(async (acc, [propertyName, propertyValue]) => {
|
|
2168
2168
|
acc[propertyName] = await propertyValue;
|
|
2169
2169
|
return acc;
|
|
2170
2170
|
}, {})
|
|
2171
2171
|
], doc);
|
|
2172
2172
|
};
|
|
2173
2173
|
|
|
2174
|
-
var lib$
|
|
2175
|
-
entries: entries$
|
|
2176
|
-
map: map$
|
|
2177
|
-
filter: filter,
|
|
2178
|
-
reduce: reduce$
|
|
2179
|
-
some: some,
|
|
2180
|
-
every: every,
|
|
2181
|
-
pipeline: pipeline$
|
|
2182
|
-
all: all,
|
|
2183
|
-
allValues: allValues
|
|
2174
|
+
var lib$5 = {
|
|
2175
|
+
entries: entries$4,
|
|
2176
|
+
map: map$6,
|
|
2177
|
+
filter: filter$1,
|
|
2178
|
+
reduce: reduce$5,
|
|
2179
|
+
some: some$1,
|
|
2180
|
+
every: every$1,
|
|
2181
|
+
pipeline: pipeline$3,
|
|
2182
|
+
all: all$1,
|
|
2183
|
+
allValues: allValues$1
|
|
2184
2184
|
};
|
|
2185
2185
|
|
|
2186
|
-
var
|
|
2187
|
-
|
|
2188
|
-
var contentType = {};
|
|
2189
|
-
|
|
2190
|
-
/*!
|
|
2191
|
-
* content-type
|
|
2192
|
-
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
2193
|
-
* MIT Licensed
|
|
2194
|
-
*/
|
|
2186
|
+
var justCurryIt$1 = curry$a;
|
|
2195
2187
|
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
* / DIGIT / ALPHA
|
|
2204
|
-
* ; any VCHAR, except delimiters
|
|
2205
|
-
* quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE
|
|
2206
|
-
* qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text
|
|
2207
|
-
* obs-text = %x80-FF
|
|
2208
|
-
* quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
|
|
2209
|
-
*/
|
|
2210
|
-
var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g;
|
|
2211
|
-
var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/;
|
|
2212
|
-
var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
2188
|
+
/*
|
|
2189
|
+
function add(a, b, c) {
|
|
2190
|
+
return a + b + c;
|
|
2191
|
+
}
|
|
2192
|
+
curry(add)(1)(2)(3); // 6
|
|
2193
|
+
curry(add)(1)(2)(2); // 5
|
|
2194
|
+
curry(add)(2)(4, 3); // 9
|
|
2213
2195
|
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
*/
|
|
2220
|
-
var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g;
|
|
2196
|
+
function add(...args) {
|
|
2197
|
+
return args.reduce((sum, n) => sum + n, 0)
|
|
2198
|
+
}
|
|
2199
|
+
var curryAdd4 = curry(add, 4)
|
|
2200
|
+
curryAdd4(1)(2, 3)(4); // 10
|
|
2221
2201
|
|
|
2222
|
-
|
|
2223
|
-
*
|
|
2224
|
-
|
|
2225
|
-
|
|
2202
|
+
function converter(ratio, input) {
|
|
2203
|
+
return (input*ratio).toFixed(1);
|
|
2204
|
+
}
|
|
2205
|
+
const curriedConverter = curry(converter)
|
|
2206
|
+
const milesToKm = curriedConverter(1.62);
|
|
2207
|
+
milesToKm(35); // 56.7
|
|
2208
|
+
milesToKm(10); // 16.2
|
|
2209
|
+
*/
|
|
2226
2210
|
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2211
|
+
function curry$a(fn, arity) {
|
|
2212
|
+
return function curried() {
|
|
2213
|
+
if (arity == null) {
|
|
2214
|
+
arity = fn.length;
|
|
2215
|
+
}
|
|
2216
|
+
var args = [].slice.call(arguments);
|
|
2217
|
+
if (args.length >= arity) {
|
|
2218
|
+
return fn.apply(this, args);
|
|
2219
|
+
} else {
|
|
2220
|
+
return function() {
|
|
2221
|
+
return curried.apply(this, args.concat([].slice.call(arguments)));
|
|
2222
|
+
};
|
|
2223
|
+
}
|
|
2224
|
+
};
|
|
2225
|
+
}
|
|
2235
2226
|
|
|
2236
|
-
|
|
2237
|
-
* Module exports.
|
|
2238
|
-
* @public
|
|
2239
|
-
*/
|
|
2227
|
+
const curry$9 = justCurryIt$1;
|
|
2240
2228
|
|
|
2241
|
-
contentType.format = format$1;
|
|
2242
|
-
contentType.parse = parse$1;
|
|
2243
2229
|
|
|
2244
|
-
|
|
2245
|
-
* Format object to media type.
|
|
2246
|
-
*
|
|
2247
|
-
* @param {object} obj
|
|
2248
|
-
* @return {string}
|
|
2249
|
-
* @public
|
|
2250
|
-
*/
|
|
2230
|
+
const nil$1 = "";
|
|
2251
2231
|
|
|
2252
|
-
|
|
2253
|
-
if (
|
|
2254
|
-
throw
|
|
2232
|
+
const compile$P = (pointer) => {
|
|
2233
|
+
if (pointer.length > 0 && pointer[0] !== "/") {
|
|
2234
|
+
throw Error("Invalid JSON Pointer");
|
|
2255
2235
|
}
|
|
2256
2236
|
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
if (!type || !TYPE_REGEXP.test(type)) {
|
|
2261
|
-
throw new TypeError('invalid type')
|
|
2262
|
-
}
|
|
2237
|
+
return pointer.split("/").slice(1).map(unescape);
|
|
2238
|
+
};
|
|
2263
2239
|
|
|
2264
|
-
|
|
2240
|
+
const get$1 = (pointer, value = undefined) => {
|
|
2241
|
+
const ptr = compile$P(pointer);
|
|
2265
2242
|
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
var params = Object.keys(parameters).sort();
|
|
2243
|
+
const fn = (value) => ptr.reduce(([value, pointer], segment) => {
|
|
2244
|
+
return [applySegment(value, segment, pointer), append(segment, pointer)];
|
|
2245
|
+
}, [value, ""])[0];
|
|
2270
2246
|
|
|
2271
|
-
|
|
2272
|
-
|
|
2247
|
+
return value === undefined ? fn : fn(value);
|
|
2248
|
+
};
|
|
2273
2249
|
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2250
|
+
const set = (pointer, subject = undefined, value = undefined) => {
|
|
2251
|
+
const ptr = compile$P(pointer);
|
|
2252
|
+
const fn = curry$9((subject, value) => _set(ptr, subject, value, nil$1));
|
|
2253
|
+
return subject === undefined ? fn : fn(subject, value);
|
|
2254
|
+
};
|
|
2277
2255
|
|
|
2278
|
-
|
|
2256
|
+
const _set = (pointer, subject, value, cursor) => {
|
|
2257
|
+
if (pointer.length === 0) {
|
|
2258
|
+
return value;
|
|
2259
|
+
} else if (pointer.length > 1) {
|
|
2260
|
+
if (Array.isArray(subject)) {
|
|
2261
|
+
const index = pointer.shift();
|
|
2262
|
+
const clonedSubject = [...subject];
|
|
2263
|
+
clonedSubject[index] = _set(pointer, applySegment(subject, index, cursor), value, append(index, cursor));
|
|
2264
|
+
return clonedSubject;
|
|
2265
|
+
} else {
|
|
2266
|
+
const segment = pointer.shift();
|
|
2267
|
+
return { ...subject, [segment]: _set(pointer, applySegment(subject, segment, cursor), value, append(segment, cursor)) };
|
|
2279
2268
|
}
|
|
2269
|
+
} else if (Array.isArray(subject)) {
|
|
2270
|
+
const clonedSubject = [...subject];
|
|
2271
|
+
const segment = computeSegment(subject, pointer[0]);
|
|
2272
|
+
clonedSubject[segment] = value;
|
|
2273
|
+
return clonedSubject;
|
|
2274
|
+
} else if (typeof subject === "object" && subject !== null) {
|
|
2275
|
+
return { ...subject, [pointer[0]]: value };
|
|
2276
|
+
} else {
|
|
2277
|
+
return applySegment(subject, pointer[0], cursor);
|
|
2280
2278
|
}
|
|
2279
|
+
};
|
|
2281
2280
|
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
*
|
|
2288
|
-
* @param {string|object} string
|
|
2289
|
-
* @return {Object}
|
|
2290
|
-
* @public
|
|
2291
|
-
*/
|
|
2281
|
+
const assign = (pointer, subject = undefined, value = undefined) => {
|
|
2282
|
+
const ptr = compile$P(pointer);
|
|
2283
|
+
const fn = curry$9((subject, value) => _assign(ptr, subject, value, nil$1));
|
|
2284
|
+
return subject === undefined ? fn : fn(subject, value);
|
|
2285
|
+
};
|
|
2292
2286
|
|
|
2293
|
-
|
|
2294
|
-
if (
|
|
2295
|
-
|
|
2287
|
+
const _assign = (pointer, subject, value, cursor) => {
|
|
2288
|
+
if (pointer.length === 0) {
|
|
2289
|
+
return;
|
|
2290
|
+
} else if (pointer.length === 1 && !isScalar(subject)) {
|
|
2291
|
+
const segment = computeSegment(subject, pointer[0]);
|
|
2292
|
+
subject[segment] = value;
|
|
2293
|
+
} else {
|
|
2294
|
+
const segment = pointer.shift();
|
|
2295
|
+
_assign(pointer, applySegment(subject, segment, cursor), value, append(segment, cursor));
|
|
2296
2296
|
}
|
|
2297
|
+
};
|
|
2297
2298
|
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2299
|
+
const unset = (pointer, subject = undefined) => {
|
|
2300
|
+
const ptr = compile$P(pointer);
|
|
2301
|
+
const fn = (subject) => _unset(ptr, subject, nil$1);
|
|
2302
|
+
return subject === undefined ? fn : fn(subject);
|
|
2303
|
+
};
|
|
2302
2304
|
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
+
const _unset = (pointer, subject, cursor) => {
|
|
2306
|
+
if (pointer.length == 0) {
|
|
2307
|
+
return undefined;
|
|
2308
|
+
} else if (pointer.length > 1) {
|
|
2309
|
+
const segment = pointer.shift();
|
|
2310
|
+
const value = applySegment(subject, segment, cursor);
|
|
2311
|
+
return { ...subject, [segment]: _unset(pointer, value, append(segment, cursor)) };
|
|
2312
|
+
} else if (Array.isArray(subject)) {
|
|
2313
|
+
return subject.filter((_, ndx) => ndx != pointer[0]);
|
|
2314
|
+
} else if (typeof subject === "object" && subject !== null) {
|
|
2315
|
+
// eslint-disable-next-line no-unused-vars
|
|
2316
|
+
const { [pointer[0]]: _, ...result } = subject;
|
|
2317
|
+
return result;
|
|
2318
|
+
} else {
|
|
2319
|
+
return applySegment(subject, pointer[0], cursor);
|
|
2305
2320
|
}
|
|
2321
|
+
};
|
|
2306
2322
|
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2323
|
+
const remove = (pointer, subject = undefined) => {
|
|
2324
|
+
const ptr = compile$P(pointer);
|
|
2325
|
+
const fn = (subject) => _remove(ptr, subject, nil$1);
|
|
2326
|
+
return subject === undefined ? fn : fn(subject);
|
|
2327
|
+
};
|
|
2328
|
+
|
|
2329
|
+
const _remove = (pointer, subject, cursor) => {
|
|
2330
|
+
if (pointer.length === 0) {
|
|
2331
|
+
return;
|
|
2332
|
+
} else if (pointer.length > 1) {
|
|
2333
|
+
const segment = pointer.shift();
|
|
2334
|
+
const value = applySegment(subject, segment, cursor);
|
|
2335
|
+
_remove(pointer, value, append(segment, cursor));
|
|
2336
|
+
} else if (Array.isArray(subject)) {
|
|
2337
|
+
subject.splice(pointer[0], 1);
|
|
2338
|
+
} else if (typeof subject === "object" && subject !== null) {
|
|
2339
|
+
delete subject[pointer[0]];
|
|
2340
|
+
} else {
|
|
2341
|
+
applySegment(subject, pointer[0], cursor);
|
|
2342
|
+
}
|
|
2343
|
+
};
|
|
2344
|
+
|
|
2345
|
+
const append = curry$9((segment, pointer) => pointer + "/" + escape$1(segment));
|
|
2346
|
+
|
|
2347
|
+
const escape$1 = (segment) => segment.toString().replace(/~/g, "~0").replace(/\//g, "~1");
|
|
2348
|
+
const unescape = (segment) => segment.toString().replace(/~1/g, "/").replace(/~0/g, "~");
|
|
2349
|
+
const computeSegment = (value, segment) => Array.isArray(value) && segment === "-" ? value.length : segment;
|
|
2350
|
+
|
|
2351
|
+
const applySegment = (value, segment, cursor = "") => {
|
|
2352
|
+
if (value === undefined) {
|
|
2353
|
+
throw TypeError(`Value at '${cursor}' is undefined and does not have property '${segment}'`);
|
|
2354
|
+
} else if (value === null) {
|
|
2355
|
+
throw TypeError(`Value at '${cursor}' is null and does not have property '${segment}'`);
|
|
2356
|
+
} else if (isScalar(value)) {
|
|
2357
|
+
throw TypeError(`Value at '${cursor}' is a ${typeof value} and does not have property '${segment}'`);
|
|
2358
|
+
} else {
|
|
2359
|
+
const computedSegment = computeSegment(value, segment);
|
|
2360
|
+
return value[computedSegment];
|
|
2361
|
+
}
|
|
2362
|
+
};
|
|
2363
|
+
|
|
2364
|
+
const isScalar = (value) => value === null || typeof value !== "object";
|
|
2365
|
+
|
|
2366
|
+
var lib$4 = { nil: nil$1, append, get: get$1, set, assign, unset, remove };
|
|
2367
|
+
|
|
2368
|
+
var moo$1 = {exports: {}};
|
|
2369
|
+
|
|
2370
|
+
(function (module) {
|
|
2371
|
+
(function(root, factory) {
|
|
2372
|
+
if (module.exports) {
|
|
2373
|
+
module.exports = factory();
|
|
2374
|
+
} else {
|
|
2375
|
+
root.moo = factory();
|
|
2376
|
+
}
|
|
2377
|
+
}(commonjsGlobal, function() {
|
|
2378
|
+
|
|
2379
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
2380
|
+
var toString = Object.prototype.toString;
|
|
2381
|
+
var hasSticky = typeof new RegExp().sticky === 'boolean';
|
|
2382
|
+
|
|
2383
|
+
/***************************************************************************/
|
|
2384
|
+
|
|
2385
|
+
function isRegExp(o) { return o && toString.call(o) === '[object RegExp]' }
|
|
2386
|
+
function isObject(o) { return o && typeof o === 'object' && !isRegExp(o) && !Array.isArray(o) }
|
|
2387
|
+
|
|
2388
|
+
function reEscape(s) {
|
|
2389
|
+
return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')
|
|
2390
|
+
}
|
|
2391
|
+
function reGroups(s) {
|
|
2392
|
+
var re = new RegExp('|' + s);
|
|
2393
|
+
return re.exec('').length - 1
|
|
2394
|
+
}
|
|
2395
|
+
function reCapture(s) {
|
|
2396
|
+
return '(' + s + ')'
|
|
2397
|
+
}
|
|
2398
|
+
function reUnion(regexps) {
|
|
2399
|
+
if (!regexps.length) return '(?!)'
|
|
2400
|
+
var source = regexps.map(function(s) {
|
|
2401
|
+
return "(?:" + s + ")"
|
|
2402
|
+
}).join('|');
|
|
2403
|
+
return "(?:" + source + ")"
|
|
2404
|
+
}
|
|
2405
|
+
|
|
2406
|
+
function regexpOrLiteral(obj) {
|
|
2407
|
+
if (typeof obj === 'string') {
|
|
2408
|
+
return '(?:' + reEscape(obj) + ')'
|
|
2409
|
+
|
|
2410
|
+
} else if (isRegExp(obj)) {
|
|
2411
|
+
// TODO: consider /u support
|
|
2412
|
+
if (obj.ignoreCase) throw new Error('RegExp /i flag not allowed')
|
|
2413
|
+
if (obj.global) throw new Error('RegExp /g flag is implied')
|
|
2414
|
+
if (obj.sticky) throw new Error('RegExp /y flag is implied')
|
|
2415
|
+
if (obj.multiline) throw new Error('RegExp /m flag is implied')
|
|
2416
|
+
return obj.source
|
|
2417
|
+
|
|
2418
|
+
} else {
|
|
2419
|
+
throw new Error('Not a pattern: ' + obj)
|
|
2420
|
+
}
|
|
2421
|
+
}
|
|
2422
|
+
|
|
2423
|
+
function objectToRules(object) {
|
|
2424
|
+
var keys = Object.getOwnPropertyNames(object);
|
|
2425
|
+
var result = [];
|
|
2426
|
+
for (var i = 0; i < keys.length; i++) {
|
|
2427
|
+
var key = keys[i];
|
|
2428
|
+
var thing = object[key];
|
|
2429
|
+
var rules = [].concat(thing);
|
|
2430
|
+
if (key === 'include') {
|
|
2431
|
+
for (var j = 0; j < rules.length; j++) {
|
|
2432
|
+
result.push({include: rules[j]});
|
|
2433
|
+
}
|
|
2434
|
+
continue
|
|
2435
|
+
}
|
|
2436
|
+
var match = [];
|
|
2437
|
+
rules.forEach(function(rule) {
|
|
2438
|
+
if (isObject(rule)) {
|
|
2439
|
+
if (match.length) result.push(ruleOptions(key, match));
|
|
2440
|
+
result.push(ruleOptions(key, rule));
|
|
2441
|
+
match = [];
|
|
2442
|
+
} else {
|
|
2443
|
+
match.push(rule);
|
|
2444
|
+
}
|
|
2445
|
+
});
|
|
2446
|
+
if (match.length) result.push(ruleOptions(key, match));
|
|
2447
|
+
}
|
|
2448
|
+
return result
|
|
2449
|
+
}
|
|
2450
|
+
|
|
2451
|
+
function arrayToRules(array) {
|
|
2452
|
+
var result = [];
|
|
2453
|
+
for (var i = 0; i < array.length; i++) {
|
|
2454
|
+
var obj = array[i];
|
|
2455
|
+
if (obj.include) {
|
|
2456
|
+
var include = [].concat(obj.include);
|
|
2457
|
+
for (var j = 0; j < include.length; j++) {
|
|
2458
|
+
result.push({include: include[j]});
|
|
2459
|
+
}
|
|
2460
|
+
continue
|
|
2461
|
+
}
|
|
2462
|
+
if (!obj.type) {
|
|
2463
|
+
throw new Error('Rule has no type: ' + JSON.stringify(obj))
|
|
2464
|
+
}
|
|
2465
|
+
result.push(ruleOptions(obj.type, obj));
|
|
2466
|
+
}
|
|
2467
|
+
return result
|
|
2468
|
+
}
|
|
2469
|
+
|
|
2470
|
+
function ruleOptions(type, obj) {
|
|
2471
|
+
if (!isObject(obj)) {
|
|
2472
|
+
obj = { match: obj };
|
|
2473
|
+
}
|
|
2474
|
+
if (obj.include) {
|
|
2475
|
+
throw new Error('Matching rules cannot also include states')
|
|
2476
|
+
}
|
|
2477
|
+
|
|
2478
|
+
// nb. error and fallback imply lineBreaks
|
|
2479
|
+
var options = {
|
|
2480
|
+
defaultType: type,
|
|
2481
|
+
lineBreaks: !!obj.error || !!obj.fallback,
|
|
2482
|
+
pop: false,
|
|
2483
|
+
next: null,
|
|
2484
|
+
push: null,
|
|
2485
|
+
error: false,
|
|
2486
|
+
fallback: false,
|
|
2487
|
+
value: null,
|
|
2488
|
+
type: null,
|
|
2489
|
+
shouldThrow: false,
|
|
2490
|
+
};
|
|
2491
|
+
|
|
2492
|
+
// Avoid Object.assign(), so we support IE9+
|
|
2493
|
+
for (var key in obj) {
|
|
2494
|
+
if (hasOwnProperty.call(obj, key)) {
|
|
2495
|
+
options[key] = obj[key];
|
|
2496
|
+
}
|
|
2497
|
+
}
|
|
2498
|
+
|
|
2499
|
+
// type transform cannot be a string
|
|
2500
|
+
if (typeof options.type === 'string' && type !== options.type) {
|
|
2501
|
+
throw new Error("Type transform cannot be a string (type '" + options.type + "' for token '" + type + "')")
|
|
2502
|
+
}
|
|
2503
|
+
|
|
2504
|
+
// convert to array
|
|
2505
|
+
var match = options.match;
|
|
2506
|
+
options.match = Array.isArray(match) ? match : match ? [match] : [];
|
|
2507
|
+
options.match.sort(function(a, b) {
|
|
2508
|
+
return isRegExp(a) && isRegExp(b) ? 0
|
|
2509
|
+
: isRegExp(b) ? -1 : isRegExp(a) ? +1 : b.length - a.length
|
|
2510
|
+
});
|
|
2511
|
+
return options
|
|
2512
|
+
}
|
|
2513
|
+
|
|
2514
|
+
function toRules(spec) {
|
|
2515
|
+
return Array.isArray(spec) ? arrayToRules(spec) : objectToRules(spec)
|
|
2516
|
+
}
|
|
2517
|
+
|
|
2518
|
+
var defaultErrorRule = ruleOptions('error', {lineBreaks: true, shouldThrow: true});
|
|
2519
|
+
function compileRules(rules, hasStates) {
|
|
2520
|
+
var errorRule = null;
|
|
2521
|
+
var fast = Object.create(null);
|
|
2522
|
+
var fastAllowed = true;
|
|
2523
|
+
var unicodeFlag = null;
|
|
2524
|
+
var groups = [];
|
|
2525
|
+
var parts = [];
|
|
2526
|
+
|
|
2527
|
+
// If there is a fallback rule, then disable fast matching
|
|
2528
|
+
for (var i = 0; i < rules.length; i++) {
|
|
2529
|
+
if (rules[i].fallback) {
|
|
2530
|
+
fastAllowed = false;
|
|
2531
|
+
}
|
|
2532
|
+
}
|
|
2533
|
+
|
|
2534
|
+
for (var i = 0; i < rules.length; i++) {
|
|
2535
|
+
var options = rules[i];
|
|
2536
|
+
|
|
2537
|
+
if (options.include) {
|
|
2538
|
+
// all valid inclusions are removed by states() preprocessor
|
|
2539
|
+
throw new Error('Inheritance is not allowed in stateless lexers')
|
|
2540
|
+
}
|
|
2541
|
+
|
|
2542
|
+
if (options.error || options.fallback) {
|
|
2543
|
+
// errorRule can only be set once
|
|
2544
|
+
if (errorRule) {
|
|
2545
|
+
if (!options.fallback === !errorRule.fallback) {
|
|
2546
|
+
throw new Error("Multiple " + (options.fallback ? "fallback" : "error") + " rules not allowed (for token '" + options.defaultType + "')")
|
|
2547
|
+
} else {
|
|
2548
|
+
throw new Error("fallback and error are mutually exclusive (for token '" + options.defaultType + "')")
|
|
2549
|
+
}
|
|
2550
|
+
}
|
|
2551
|
+
errorRule = options;
|
|
2552
|
+
}
|
|
2553
|
+
|
|
2554
|
+
var match = options.match.slice();
|
|
2555
|
+
if (fastAllowed) {
|
|
2556
|
+
while (match.length && typeof match[0] === 'string' && match[0].length === 1) {
|
|
2557
|
+
var word = match.shift();
|
|
2558
|
+
fast[word.charCodeAt(0)] = options;
|
|
2559
|
+
}
|
|
2560
|
+
}
|
|
2561
|
+
|
|
2562
|
+
// Warn about inappropriate state-switching options
|
|
2563
|
+
if (options.pop || options.push || options.next) {
|
|
2564
|
+
if (!hasStates) {
|
|
2565
|
+
throw new Error("State-switching options are not allowed in stateless lexers (for token '" + options.defaultType + "')")
|
|
2566
|
+
}
|
|
2567
|
+
if (options.fallback) {
|
|
2568
|
+
throw new Error("State-switching options are not allowed on fallback tokens (for token '" + options.defaultType + "')")
|
|
2569
|
+
}
|
|
2570
|
+
}
|
|
2571
|
+
|
|
2572
|
+
// Only rules with a .match are included in the RegExp
|
|
2573
|
+
if (match.length === 0) {
|
|
2574
|
+
continue
|
|
2575
|
+
}
|
|
2576
|
+
fastAllowed = false;
|
|
2577
|
+
|
|
2578
|
+
groups.push(options);
|
|
2579
|
+
|
|
2580
|
+
// Check unicode flag is used everywhere or nowhere
|
|
2581
|
+
for (var j = 0; j < match.length; j++) {
|
|
2582
|
+
var obj = match[j];
|
|
2583
|
+
if (!isRegExp(obj)) {
|
|
2584
|
+
continue
|
|
2585
|
+
}
|
|
2586
|
+
|
|
2587
|
+
if (unicodeFlag === null) {
|
|
2588
|
+
unicodeFlag = obj.unicode;
|
|
2589
|
+
} else if (unicodeFlag !== obj.unicode && options.fallback === false) {
|
|
2590
|
+
throw new Error('If one rule is /u then all must be')
|
|
2591
|
+
}
|
|
2592
|
+
}
|
|
2593
|
+
|
|
2594
|
+
// convert to RegExp
|
|
2595
|
+
var pat = reUnion(match.map(regexpOrLiteral));
|
|
2596
|
+
|
|
2597
|
+
// validate
|
|
2598
|
+
var regexp = new RegExp(pat);
|
|
2599
|
+
if (regexp.test("")) {
|
|
2600
|
+
throw new Error("RegExp matches empty string: " + regexp)
|
|
2601
|
+
}
|
|
2602
|
+
var groupCount = reGroups(pat);
|
|
2603
|
+
if (groupCount > 0) {
|
|
2604
|
+
throw new Error("RegExp has capture groups: " + regexp + "\nUse (?: … ) instead")
|
|
2605
|
+
}
|
|
2606
|
+
|
|
2607
|
+
// try and detect rules matching newlines
|
|
2608
|
+
if (!options.lineBreaks && regexp.test('\n')) {
|
|
2609
|
+
throw new Error('Rule should declare lineBreaks: ' + regexp)
|
|
2610
|
+
}
|
|
2611
|
+
|
|
2612
|
+
// store regex
|
|
2613
|
+
parts.push(reCapture(pat));
|
|
2614
|
+
}
|
|
2615
|
+
|
|
2616
|
+
|
|
2617
|
+
// If there's no fallback rule, use the sticky flag so we only look for
|
|
2618
|
+
// matches at the current index.
|
|
2619
|
+
//
|
|
2620
|
+
// If we don't support the sticky flag, then fake it using an irrefutable
|
|
2621
|
+
// match (i.e. an empty pattern).
|
|
2622
|
+
var fallbackRule = errorRule && errorRule.fallback;
|
|
2623
|
+
var flags = hasSticky && !fallbackRule ? 'ym' : 'gm';
|
|
2624
|
+
var suffix = hasSticky || fallbackRule ? '' : '|';
|
|
2625
|
+
|
|
2626
|
+
if (unicodeFlag === true) flags += "u";
|
|
2627
|
+
var combined = new RegExp(reUnion(parts) + suffix, flags);
|
|
2628
|
+
return {regexp: combined, groups: groups, fast: fast, error: errorRule || defaultErrorRule}
|
|
2629
|
+
}
|
|
2630
|
+
|
|
2631
|
+
function compile(rules) {
|
|
2632
|
+
var result = compileRules(toRules(rules));
|
|
2633
|
+
return new Lexer({start: result}, 'start')
|
|
2634
|
+
}
|
|
2635
|
+
|
|
2636
|
+
function checkStateGroup(g, name, map) {
|
|
2637
|
+
var state = g && (g.push || g.next);
|
|
2638
|
+
if (state && !map[state]) {
|
|
2639
|
+
throw new Error("Missing state '" + state + "' (in token '" + g.defaultType + "' of state '" + name + "')")
|
|
2640
|
+
}
|
|
2641
|
+
if (g && g.pop && +g.pop !== 1) {
|
|
2642
|
+
throw new Error("pop must be 1 (in token '" + g.defaultType + "' of state '" + name + "')")
|
|
2643
|
+
}
|
|
2644
|
+
}
|
|
2645
|
+
function compileStates(states, start) {
|
|
2646
|
+
var all = states.$all ? toRules(states.$all) : [];
|
|
2647
|
+
delete states.$all;
|
|
2648
|
+
|
|
2649
|
+
var keys = Object.getOwnPropertyNames(states);
|
|
2650
|
+
if (!start) start = keys[0];
|
|
2651
|
+
|
|
2652
|
+
var ruleMap = Object.create(null);
|
|
2653
|
+
for (var i = 0; i < keys.length; i++) {
|
|
2654
|
+
var key = keys[i];
|
|
2655
|
+
ruleMap[key] = toRules(states[key]).concat(all);
|
|
2656
|
+
}
|
|
2657
|
+
for (var i = 0; i < keys.length; i++) {
|
|
2658
|
+
var key = keys[i];
|
|
2659
|
+
var rules = ruleMap[key];
|
|
2660
|
+
var included = Object.create(null);
|
|
2661
|
+
for (var j = 0; j < rules.length; j++) {
|
|
2662
|
+
var rule = rules[j];
|
|
2663
|
+
if (!rule.include) continue
|
|
2664
|
+
var splice = [j, 1];
|
|
2665
|
+
if (rule.include !== key && !included[rule.include]) {
|
|
2666
|
+
included[rule.include] = true;
|
|
2667
|
+
var newRules = ruleMap[rule.include];
|
|
2668
|
+
if (!newRules) {
|
|
2669
|
+
throw new Error("Cannot include nonexistent state '" + rule.include + "' (in state '" + key + "')")
|
|
2670
|
+
}
|
|
2671
|
+
for (var k = 0; k < newRules.length; k++) {
|
|
2672
|
+
var newRule = newRules[k];
|
|
2673
|
+
if (rules.indexOf(newRule) !== -1) continue
|
|
2674
|
+
splice.push(newRule);
|
|
2675
|
+
}
|
|
2676
|
+
}
|
|
2677
|
+
rules.splice.apply(rules, splice);
|
|
2678
|
+
j--;
|
|
2679
|
+
}
|
|
2680
|
+
}
|
|
2681
|
+
|
|
2682
|
+
var map = Object.create(null);
|
|
2683
|
+
for (var i = 0; i < keys.length; i++) {
|
|
2684
|
+
var key = keys[i];
|
|
2685
|
+
map[key] = compileRules(ruleMap[key], true);
|
|
2686
|
+
}
|
|
2687
|
+
|
|
2688
|
+
for (var i = 0; i < keys.length; i++) {
|
|
2689
|
+
var name = keys[i];
|
|
2690
|
+
var state = map[name];
|
|
2691
|
+
var groups = state.groups;
|
|
2692
|
+
for (var j = 0; j < groups.length; j++) {
|
|
2693
|
+
checkStateGroup(groups[j], name, map);
|
|
2694
|
+
}
|
|
2695
|
+
var fastKeys = Object.getOwnPropertyNames(state.fast);
|
|
2696
|
+
for (var j = 0; j < fastKeys.length; j++) {
|
|
2697
|
+
checkStateGroup(state.fast[fastKeys[j]], name, map);
|
|
2698
|
+
}
|
|
2699
|
+
}
|
|
2700
|
+
|
|
2701
|
+
return new Lexer(map, start)
|
|
2702
|
+
}
|
|
2703
|
+
|
|
2704
|
+
function keywordTransform(map) {
|
|
2705
|
+
var reverseMap = Object.create(null);
|
|
2706
|
+
var byLength = Object.create(null);
|
|
2707
|
+
var types = Object.getOwnPropertyNames(map);
|
|
2708
|
+
for (var i = 0; i < types.length; i++) {
|
|
2709
|
+
var tokenType = types[i];
|
|
2710
|
+
var item = map[tokenType];
|
|
2711
|
+
var keywordList = Array.isArray(item) ? item : [item];
|
|
2712
|
+
keywordList.forEach(function(keyword) {
|
|
2713
|
+
(byLength[keyword.length] = byLength[keyword.length] || []).push(keyword);
|
|
2714
|
+
if (typeof keyword !== 'string') {
|
|
2715
|
+
throw new Error("keyword must be string (in keyword '" + tokenType + "')")
|
|
2716
|
+
}
|
|
2717
|
+
reverseMap[keyword] = tokenType;
|
|
2718
|
+
});
|
|
2719
|
+
}
|
|
2720
|
+
|
|
2721
|
+
// fast string lookup
|
|
2722
|
+
// https://jsperf.com/string-lookups
|
|
2723
|
+
function str(x) { return JSON.stringify(x) }
|
|
2724
|
+
var source = '';
|
|
2725
|
+
source += 'switch (value.length) {\n';
|
|
2726
|
+
for (var length in byLength) {
|
|
2727
|
+
var keywords = byLength[length];
|
|
2728
|
+
source += 'case ' + length + ':\n';
|
|
2729
|
+
source += 'switch (value) {\n';
|
|
2730
|
+
keywords.forEach(function(keyword) {
|
|
2731
|
+
var tokenType = reverseMap[keyword];
|
|
2732
|
+
source += 'case ' + str(keyword) + ': return ' + str(tokenType) + '\n';
|
|
2733
|
+
});
|
|
2734
|
+
source += '}\n';
|
|
2735
|
+
}
|
|
2736
|
+
source += '}\n';
|
|
2737
|
+
return Function('value', source) // type
|
|
2738
|
+
}
|
|
2739
|
+
|
|
2740
|
+
/***************************************************************************/
|
|
2741
|
+
|
|
2742
|
+
var Lexer = function(states, state) {
|
|
2743
|
+
this.startState = state;
|
|
2744
|
+
this.states = states;
|
|
2745
|
+
this.buffer = '';
|
|
2746
|
+
this.stack = [];
|
|
2747
|
+
this.reset();
|
|
2748
|
+
};
|
|
2749
|
+
|
|
2750
|
+
Lexer.prototype.reset = function(data, info) {
|
|
2751
|
+
this.buffer = data || '';
|
|
2752
|
+
this.index = 0;
|
|
2753
|
+
this.line = info ? info.line : 1;
|
|
2754
|
+
this.col = info ? info.col : 1;
|
|
2755
|
+
this.queuedToken = info ? info.queuedToken : null;
|
|
2756
|
+
this.queuedThrow = info ? info.queuedThrow : null;
|
|
2757
|
+
this.setState(info ? info.state : this.startState);
|
|
2758
|
+
this.stack = info && info.stack ? info.stack.slice() : [];
|
|
2759
|
+
return this
|
|
2760
|
+
};
|
|
2761
|
+
|
|
2762
|
+
Lexer.prototype.save = function() {
|
|
2763
|
+
return {
|
|
2764
|
+
line: this.line,
|
|
2765
|
+
col: this.col,
|
|
2766
|
+
state: this.state,
|
|
2767
|
+
stack: this.stack.slice(),
|
|
2768
|
+
queuedToken: this.queuedToken,
|
|
2769
|
+
queuedThrow: this.queuedThrow,
|
|
2770
|
+
}
|
|
2771
|
+
};
|
|
2772
|
+
|
|
2773
|
+
Lexer.prototype.setState = function(state) {
|
|
2774
|
+
if (!state || this.state === state) return
|
|
2775
|
+
this.state = state;
|
|
2776
|
+
var info = this.states[state];
|
|
2777
|
+
this.groups = info.groups;
|
|
2778
|
+
this.error = info.error;
|
|
2779
|
+
this.re = info.regexp;
|
|
2780
|
+
this.fast = info.fast;
|
|
2781
|
+
};
|
|
2782
|
+
|
|
2783
|
+
Lexer.prototype.popState = function() {
|
|
2784
|
+
this.setState(this.stack.pop());
|
|
2785
|
+
};
|
|
2786
|
+
|
|
2787
|
+
Lexer.prototype.pushState = function(state) {
|
|
2788
|
+
this.stack.push(this.state);
|
|
2789
|
+
this.setState(state);
|
|
2790
|
+
};
|
|
2791
|
+
|
|
2792
|
+
var eat = hasSticky ? function(re, buffer) { // assume re is /y
|
|
2793
|
+
return re.exec(buffer)
|
|
2794
|
+
} : function(re, buffer) { // assume re is /g
|
|
2795
|
+
var match = re.exec(buffer);
|
|
2796
|
+
// will always match, since we used the |(?:) trick
|
|
2797
|
+
if (match[0].length === 0) {
|
|
2798
|
+
return null
|
|
2799
|
+
}
|
|
2800
|
+
return match
|
|
2801
|
+
};
|
|
2802
|
+
|
|
2803
|
+
Lexer.prototype._getGroup = function(match) {
|
|
2804
|
+
var groupCount = this.groups.length;
|
|
2805
|
+
for (var i = 0; i < groupCount; i++) {
|
|
2806
|
+
if (match[i + 1] !== undefined) {
|
|
2807
|
+
return this.groups[i]
|
|
2808
|
+
}
|
|
2809
|
+
}
|
|
2810
|
+
throw new Error('Cannot find token type for matched text')
|
|
2811
|
+
};
|
|
2812
|
+
|
|
2813
|
+
function tokenToString() {
|
|
2814
|
+
return this.value
|
|
2815
|
+
}
|
|
2816
|
+
|
|
2817
|
+
Lexer.prototype.next = function() {
|
|
2818
|
+
var index = this.index;
|
|
2819
|
+
|
|
2820
|
+
// If a fallback token matched, we don't need to re-run the RegExp
|
|
2821
|
+
if (this.queuedGroup) {
|
|
2822
|
+
var token = this._token(this.queuedGroup, this.queuedText, index);
|
|
2823
|
+
this.queuedGroup = null;
|
|
2824
|
+
this.queuedText = "";
|
|
2825
|
+
return token
|
|
2826
|
+
}
|
|
2827
|
+
|
|
2828
|
+
var buffer = this.buffer;
|
|
2829
|
+
if (index === buffer.length) {
|
|
2830
|
+
return // EOF
|
|
2831
|
+
}
|
|
2832
|
+
|
|
2833
|
+
// Fast matching for single characters
|
|
2834
|
+
var group = this.fast[buffer.charCodeAt(index)];
|
|
2835
|
+
if (group) {
|
|
2836
|
+
return this._token(group, buffer.charAt(index), index)
|
|
2837
|
+
}
|
|
2838
|
+
|
|
2839
|
+
// Execute RegExp
|
|
2840
|
+
var re = this.re;
|
|
2841
|
+
re.lastIndex = index;
|
|
2842
|
+
var match = eat(re, buffer);
|
|
2843
|
+
|
|
2844
|
+
// Error tokens match the remaining buffer
|
|
2845
|
+
var error = this.error;
|
|
2846
|
+
if (match == null) {
|
|
2847
|
+
return this._token(error, buffer.slice(index, buffer.length), index)
|
|
2848
|
+
}
|
|
2849
|
+
|
|
2850
|
+
var group = this._getGroup(match);
|
|
2851
|
+
var text = match[0];
|
|
2852
|
+
|
|
2853
|
+
if (error.fallback && match.index !== index) {
|
|
2854
|
+
this.queuedGroup = group;
|
|
2855
|
+
this.queuedText = text;
|
|
2856
|
+
|
|
2857
|
+
// Fallback tokens contain the unmatched portion of the buffer
|
|
2858
|
+
return this._token(error, buffer.slice(index, match.index), index)
|
|
2859
|
+
}
|
|
2860
|
+
|
|
2861
|
+
return this._token(group, text, index)
|
|
2862
|
+
};
|
|
2863
|
+
|
|
2864
|
+
Lexer.prototype._token = function(group, text, offset) {
|
|
2865
|
+
// count line breaks
|
|
2866
|
+
var lineBreaks = 0;
|
|
2867
|
+
if (group.lineBreaks) {
|
|
2868
|
+
var matchNL = /\n/g;
|
|
2869
|
+
var nl = 1;
|
|
2870
|
+
if (text === '\n') {
|
|
2871
|
+
lineBreaks = 1;
|
|
2872
|
+
} else {
|
|
2873
|
+
while (matchNL.exec(text)) { lineBreaks++; nl = matchNL.lastIndex; }
|
|
2874
|
+
}
|
|
2875
|
+
}
|
|
2876
|
+
|
|
2877
|
+
var token = {
|
|
2878
|
+
type: (typeof group.type === 'function' && group.type(text)) || group.defaultType,
|
|
2879
|
+
value: typeof group.value === 'function' ? group.value(text) : text,
|
|
2880
|
+
text: text,
|
|
2881
|
+
toString: tokenToString,
|
|
2882
|
+
offset: offset,
|
|
2883
|
+
lineBreaks: lineBreaks,
|
|
2884
|
+
line: this.line,
|
|
2885
|
+
col: this.col,
|
|
2886
|
+
};
|
|
2887
|
+
// nb. adding more props to token object will make V8 sad!
|
|
2888
|
+
|
|
2889
|
+
var size = text.length;
|
|
2890
|
+
this.index += size;
|
|
2891
|
+
this.line += lineBreaks;
|
|
2892
|
+
if (lineBreaks !== 0) {
|
|
2893
|
+
this.col = size - nl + 1;
|
|
2894
|
+
} else {
|
|
2895
|
+
this.col += size;
|
|
2896
|
+
}
|
|
2897
|
+
|
|
2898
|
+
// throw, if no rule with {error: true}
|
|
2899
|
+
if (group.shouldThrow) {
|
|
2900
|
+
throw new Error(this.formatError(token, "invalid syntax"))
|
|
2901
|
+
}
|
|
2902
|
+
|
|
2903
|
+
if (group.pop) this.popState();
|
|
2904
|
+
else if (group.push) this.pushState(group.push);
|
|
2905
|
+
else if (group.next) this.setState(group.next);
|
|
2906
|
+
|
|
2907
|
+
return token
|
|
2908
|
+
};
|
|
2909
|
+
|
|
2910
|
+
if (typeof Symbol !== 'undefined' && Symbol.iterator) {
|
|
2911
|
+
var LexerIterator = function(lexer) {
|
|
2912
|
+
this.lexer = lexer;
|
|
2913
|
+
};
|
|
2914
|
+
|
|
2915
|
+
LexerIterator.prototype.next = function() {
|
|
2916
|
+
var token = this.lexer.next();
|
|
2917
|
+
return {value: token, done: !token}
|
|
2918
|
+
};
|
|
2919
|
+
|
|
2920
|
+
LexerIterator.prototype[Symbol.iterator] = function() {
|
|
2921
|
+
return this
|
|
2922
|
+
};
|
|
2923
|
+
|
|
2924
|
+
Lexer.prototype[Symbol.iterator] = function() {
|
|
2925
|
+
return new LexerIterator(this)
|
|
2926
|
+
};
|
|
2927
|
+
}
|
|
2928
|
+
|
|
2929
|
+
Lexer.prototype.formatError = function(token, message) {
|
|
2930
|
+
if (token == null) {
|
|
2931
|
+
// An undefined token indicates EOF
|
|
2932
|
+
var text = this.buffer.slice(this.index);
|
|
2933
|
+
var token = {
|
|
2934
|
+
text: text,
|
|
2935
|
+
offset: this.index,
|
|
2936
|
+
lineBreaks: text.indexOf('\n') === -1 ? 0 : 1,
|
|
2937
|
+
line: this.line,
|
|
2938
|
+
col: this.col,
|
|
2939
|
+
};
|
|
2940
|
+
}
|
|
2941
|
+
var start = Math.max(0, token.offset - token.col + 1);
|
|
2942
|
+
var eol = token.lineBreaks ? token.text.indexOf('\n') : token.text.length;
|
|
2943
|
+
var firstLine = this.buffer.substring(start, token.offset + eol);
|
|
2944
|
+
message += " at line " + token.line + " col " + token.col + ":\n\n";
|
|
2945
|
+
message += " " + firstLine + "\n";
|
|
2946
|
+
message += " " + Array(token.col).join(" ") + "^";
|
|
2947
|
+
return message
|
|
2948
|
+
};
|
|
2949
|
+
|
|
2950
|
+
Lexer.prototype.clone = function() {
|
|
2951
|
+
return new Lexer(this.states, this.state)
|
|
2952
|
+
};
|
|
2953
|
+
|
|
2954
|
+
Lexer.prototype.has = function(tokenType) {
|
|
2955
|
+
return true
|
|
2956
|
+
};
|
|
2957
|
+
|
|
2958
|
+
|
|
2959
|
+
return {
|
|
2960
|
+
compile: compile,
|
|
2961
|
+
states: compileStates,
|
|
2962
|
+
error: Object.freeze({error: true}),
|
|
2963
|
+
fallback: Object.freeze({fallback: true}),
|
|
2964
|
+
keywords: keywordTransform,
|
|
2965
|
+
}
|
|
2966
|
+
|
|
2967
|
+
}));
|
|
2968
|
+
} (moo$1));
|
|
2969
|
+
|
|
2970
|
+
const moo = moo$1.exports;
|
|
2971
|
+
|
|
2972
|
+
|
|
2973
|
+
const digit = `[0-9]`;
|
|
2974
|
+
const digit19 = `[1-9]`;
|
|
2975
|
+
const hexdig = `[0-9a-fA-F]`;
|
|
2976
|
+
|
|
2977
|
+
// String
|
|
2978
|
+
const unescaped = `[\\x20-\\x21\\x23-\\x5b\\x5d-\\u{10ffff}]`;
|
|
2979
|
+
const escape = `\\\\`;
|
|
2980
|
+
const escaped = `${escape}(?:["\\/\\\\brfnt]|u${hexdig}{4})`;
|
|
2981
|
+
const char = `(?:${unescaped}|${escaped})`;
|
|
2982
|
+
const string = `"${char}*"`;
|
|
2983
|
+
|
|
2984
|
+
// Number
|
|
2985
|
+
const int = `(?:0|${digit19}${digit}*)`;
|
|
2986
|
+
const frac = `\\.${digit}+`;
|
|
2987
|
+
const e = `[eE]`;
|
|
2988
|
+
const exp = `${e}[-+]?${digit}+`;
|
|
2989
|
+
const number = `-?${int}(?:${frac})?(?:${exp})?`;
|
|
2990
|
+
|
|
2991
|
+
// Whitespace
|
|
2992
|
+
const whitespace = `(?:(?:\\r?\\n)|[ \\t])+`;
|
|
2993
|
+
|
|
2994
|
+
var lexer = (json) => {
|
|
2995
|
+
const lexer = moo.states({
|
|
2996
|
+
main: {
|
|
2997
|
+
WS: { match: new RegExp(whitespace, "u"), lineBreaks: true },
|
|
2998
|
+
true: { match: "true", value: () => true },
|
|
2999
|
+
false: { match: "false", value: () => false },
|
|
3000
|
+
null: { match: "null", value: () => null },
|
|
3001
|
+
number: { match: new RegExp(number, "u"), value: parseFloat },
|
|
3002
|
+
string: { match: new RegExp(string, "u"), value: JSON.parse },
|
|
3003
|
+
"{": "{",
|
|
3004
|
+
"}": "}",
|
|
3005
|
+
"[": "[",
|
|
3006
|
+
"]": "]",
|
|
3007
|
+
":": ":",
|
|
3008
|
+
",": ",",
|
|
3009
|
+
error: moo.error
|
|
3010
|
+
}
|
|
3011
|
+
});
|
|
3012
|
+
lexer.reset(json);
|
|
3013
|
+
|
|
3014
|
+
const _next = () => {
|
|
3015
|
+
let token;
|
|
3016
|
+
do {
|
|
3017
|
+
token = lexer.next();
|
|
3018
|
+
if (token?.type === "error") {
|
|
3019
|
+
throw SyntaxError(lexer.formatError(token, "Unrecognized token"));
|
|
3020
|
+
}
|
|
3021
|
+
} while (token?.type === "WS");
|
|
3022
|
+
|
|
3023
|
+
return token;
|
|
3024
|
+
};
|
|
3025
|
+
|
|
3026
|
+
let previous;
|
|
3027
|
+
let nextToken = _next();
|
|
3028
|
+
|
|
3029
|
+
const next = (expectedType = undefined) => {
|
|
3030
|
+
previous = nextToken;
|
|
3031
|
+
nextToken = _next();
|
|
3032
|
+
if (expectedType && previous?.type !== expectedType) {
|
|
3033
|
+
throw SyntaxError(lexer.formatError(previous, `Expected a '${expectedType}'`));
|
|
3034
|
+
}
|
|
3035
|
+
return previous;
|
|
3036
|
+
};
|
|
3037
|
+
|
|
3038
|
+
const peek = () => nextToken;
|
|
3039
|
+
|
|
3040
|
+
const defaultErrorToken = { offset: 0, line: 1, col: 0, text: "" };
|
|
3041
|
+
const syntaxError = (message) => {
|
|
3042
|
+
const referenceToken = previous || defaultErrorToken;
|
|
3043
|
+
const errorToken = {
|
|
3044
|
+
...referenceToken,
|
|
3045
|
+
offset: referenceToken.offset + referenceToken.text.length,
|
|
3046
|
+
col: referenceToken.col + referenceToken.text.length
|
|
3047
|
+
};
|
|
3048
|
+
throw new SyntaxError(lexer.formatError(errorToken, message));
|
|
3049
|
+
};
|
|
3050
|
+
|
|
3051
|
+
return { next, peek, syntaxError };
|
|
3052
|
+
};
|
|
3053
|
+
|
|
3054
|
+
const JsonPointer$2 = lib$4;
|
|
3055
|
+
const jsonLexer = lexer;
|
|
3056
|
+
|
|
3057
|
+
|
|
3058
|
+
const defaultReviver = (key, value) => value;
|
|
3059
|
+
const parse$3 = (json, reviver = defaultReviver) => {
|
|
3060
|
+
const lexer = jsonLexer(json);
|
|
3061
|
+
const value = parseValue(lexer, "", JsonPointer$2.nil, reviver);
|
|
3062
|
+
|
|
3063
|
+
const token = lexer.peek();
|
|
3064
|
+
if (token) {
|
|
3065
|
+
lexer.syntaxError("A value has been parsed, but more tokens were found");
|
|
3066
|
+
}
|
|
3067
|
+
return value;
|
|
3068
|
+
};
|
|
3069
|
+
|
|
3070
|
+
const parseValue = (lexer, key, pointer, reviver) => {
|
|
3071
|
+
let value;
|
|
3072
|
+
const token = lexer.next();
|
|
3073
|
+
switch (token?.type) {
|
|
3074
|
+
case "true":
|
|
3075
|
+
case "false":
|
|
3076
|
+
case "null":
|
|
3077
|
+
case "number":
|
|
3078
|
+
case "string":
|
|
3079
|
+
value = token.value;
|
|
3080
|
+
break;
|
|
3081
|
+
case "{":
|
|
3082
|
+
value = parseObject(lexer, key, pointer, reviver);
|
|
3083
|
+
break;
|
|
3084
|
+
case "[":
|
|
3085
|
+
value = parseArray(lexer, key, pointer, reviver);
|
|
3086
|
+
break;
|
|
3087
|
+
default:
|
|
3088
|
+
lexer.syntaxError("Expected a JSON value");
|
|
3089
|
+
}
|
|
3090
|
+
|
|
3091
|
+
return reviver(key, value, pointer);
|
|
3092
|
+
};
|
|
3093
|
+
|
|
3094
|
+
const parseObject = (lexer, key, pointer, reviver) => {
|
|
3095
|
+
const value = {};
|
|
3096
|
+
|
|
3097
|
+
if (lexer.peek()?.type !== "}") {
|
|
3098
|
+
parseProperties(lexer, key, pointer, reviver, value);
|
|
3099
|
+
}
|
|
3100
|
+
|
|
3101
|
+
lexer.next("}");
|
|
3102
|
+
|
|
3103
|
+
return value;
|
|
3104
|
+
};
|
|
3105
|
+
|
|
3106
|
+
const parseProperties = (lexer, key, pointer, reviver, value) => {
|
|
3107
|
+
const propertyName = lexer.next("string").value;
|
|
3108
|
+
lexer.next(":");
|
|
3109
|
+
if (!isValueToken(lexer.peek())) {
|
|
3110
|
+
lexer.syntaxError("Expected a JSON value");
|
|
3111
|
+
}
|
|
3112
|
+
value[propertyName] = parseValue(lexer, propertyName, JsonPointer$2.append(propertyName, pointer), reviver);
|
|
3113
|
+
|
|
3114
|
+
if (lexer.peek()?.type === ",") {
|
|
3115
|
+
lexer.next(); // burn comma
|
|
3116
|
+
parseProperties(lexer, propertyName, pointer, reviver, value);
|
|
3117
|
+
} else if (isValueToken(lexer.peek())) {
|
|
3118
|
+
lexer.next(",");
|
|
3119
|
+
}
|
|
3120
|
+
};
|
|
3121
|
+
|
|
3122
|
+
const parseArray = (lexer, key, pointer, reviver) => {
|
|
3123
|
+
const value = [];
|
|
3124
|
+
|
|
3125
|
+
if (lexer.peek()?.type !== "]") {
|
|
3126
|
+
parseItems(lexer, 0, pointer, reviver, value);
|
|
3127
|
+
}
|
|
3128
|
+
|
|
3129
|
+
lexer.next("]");
|
|
3130
|
+
|
|
3131
|
+
return value;
|
|
3132
|
+
};
|
|
3133
|
+
|
|
3134
|
+
const parseItems = (lexer, key, pointer, reviver, value) => {
|
|
3135
|
+
if (!isValueToken(lexer.peek())) {
|
|
3136
|
+
lexer.syntaxError("Expected a JSON value");
|
|
3137
|
+
}
|
|
3138
|
+
value[key] = parseValue(lexer, key, JsonPointer$2.append(key, pointer), reviver);
|
|
3139
|
+
if (lexer.peek()?.type === ",") {
|
|
3140
|
+
lexer.next(); // burn comma
|
|
3141
|
+
parseItems(lexer, key + 1, pointer, reviver, value);
|
|
3142
|
+
} else if (isValueToken(lexer.peek())) {
|
|
3143
|
+
lexer.next(",");
|
|
3144
|
+
}
|
|
3145
|
+
};
|
|
3146
|
+
|
|
3147
|
+
const valueType = new Set(["string", "number", "true", "false", "null", "[", "{"]);
|
|
3148
|
+
const isValueToken = (token) => valueType.has(token?.type);
|
|
3149
|
+
|
|
3150
|
+
var parse_1 = parse$3;
|
|
3151
|
+
|
|
3152
|
+
const JsonPointer$1 = lib$4;
|
|
3153
|
+
|
|
3154
|
+
|
|
3155
|
+
const defaultReplacer = (key, value) => value;
|
|
3156
|
+
const stringify$2 = (value, replacer = defaultReplacer, space = "") => {
|
|
3157
|
+
return stringifyValue(value, replacer, space, "", JsonPointer$1.nil, 1);
|
|
3158
|
+
};
|
|
3159
|
+
|
|
3160
|
+
const stringifyValue = (value, replacer, space, key, pointer, depth) => {
|
|
3161
|
+
value = replacer(key, value, pointer);
|
|
3162
|
+
let result;
|
|
3163
|
+
if (Array.isArray(value)) {
|
|
3164
|
+
result = stringifyArray(value, replacer, space, pointer, depth);
|
|
3165
|
+
} else if (typeof value === "object" && value !== null) {
|
|
3166
|
+
result = stringifyObject(value, replacer, space, pointer, depth);
|
|
3167
|
+
} else {
|
|
3168
|
+
result = JSON.stringify(value);
|
|
3169
|
+
}
|
|
3170
|
+
|
|
3171
|
+
return result;
|
|
3172
|
+
};
|
|
3173
|
+
|
|
3174
|
+
const stringifyArray = (value, replacer, space, pointer, depth) => {
|
|
3175
|
+
if (value.length === 0) {
|
|
3176
|
+
space = "";
|
|
3177
|
+
}
|
|
3178
|
+
const padding = space ? `\n${space.repeat(depth - 1)}` : "";
|
|
3179
|
+
return "[" + padding + space + value
|
|
3180
|
+
.map((item, index) => {
|
|
3181
|
+
const indexPointer = JsonPointer$1.append(index, pointer);
|
|
3182
|
+
return stringifyValue(item, replacer, space, index, indexPointer, depth + 1);
|
|
3183
|
+
})
|
|
3184
|
+
.join(`,${padding}${space}`) + padding + "]";
|
|
3185
|
+
};
|
|
3186
|
+
|
|
3187
|
+
const stringifyObject = (value, replacer, space, pointer, depth) => {
|
|
3188
|
+
if (Object.keys(value).length === 0) {
|
|
3189
|
+
space = "";
|
|
3190
|
+
}
|
|
3191
|
+
const padding = space ? `\n${space.repeat(depth - 1)}` : "";
|
|
3192
|
+
const spacing = space ? " " : "";
|
|
3193
|
+
return "{" + padding + space + Object.entries(value)
|
|
3194
|
+
.map(([key, value]) => {
|
|
3195
|
+
const keyPointer = JsonPointer$1.append(key, pointer);
|
|
3196
|
+
return JSON.stringify(key) + ":" + spacing + stringifyValue(value, replacer, space, key, keyPointer, depth + 1);
|
|
3197
|
+
})
|
|
3198
|
+
.join(`,${padding}${space}`) + padding + "}";
|
|
3199
|
+
};
|
|
3200
|
+
|
|
3201
|
+
var stringify_1 = stringify$2;
|
|
3202
|
+
|
|
3203
|
+
const parse$2 = parse_1;
|
|
3204
|
+
const stringify$1 = stringify_1;
|
|
3205
|
+
|
|
3206
|
+
|
|
3207
|
+
var lib$3 = { parse: parse$2, stringify: stringify$1 };
|
|
3208
|
+
|
|
3209
|
+
var fetch_browser = fetch;
|
|
3210
|
+
|
|
3211
|
+
var contentType = {};
|
|
3212
|
+
|
|
3213
|
+
/*!
|
|
3214
|
+
* content-type
|
|
3215
|
+
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
3216
|
+
* MIT Licensed
|
|
3217
|
+
*/
|
|
3218
|
+
|
|
3219
|
+
/**
|
|
3220
|
+
* RegExp to match *( ";" parameter ) in RFC 7231 sec 3.1.1.1
|
|
3221
|
+
*
|
|
3222
|
+
* parameter = token "=" ( token / quoted-string )
|
|
3223
|
+
* token = 1*tchar
|
|
3224
|
+
* tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*"
|
|
3225
|
+
* / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
|
|
3226
|
+
* / DIGIT / ALPHA
|
|
3227
|
+
* ; any VCHAR, except delimiters
|
|
3228
|
+
* quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE
|
|
3229
|
+
* qdtext = HTAB / SP / %x21 / %x23-5B / %x5D-7E / obs-text
|
|
3230
|
+
* obs-text = %x80-FF
|
|
3231
|
+
* quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
|
|
3232
|
+
*/
|
|
3233
|
+
var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g;
|
|
3234
|
+
var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/;
|
|
3235
|
+
var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
3236
|
+
|
|
3237
|
+
/**
|
|
3238
|
+
* RegExp to match quoted-pair in RFC 7230 sec 3.2.6
|
|
3239
|
+
*
|
|
3240
|
+
* quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
|
|
3241
|
+
* obs-text = %x80-FF
|
|
3242
|
+
*/
|
|
3243
|
+
var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g;
|
|
3244
|
+
|
|
3245
|
+
/**
|
|
3246
|
+
* RegExp to match chars that must be quoted-pair in RFC 7230 sec 3.2.6
|
|
3247
|
+
*/
|
|
3248
|
+
var QUOTE_REGEXP = /([\\"])/g;
|
|
3249
|
+
|
|
3250
|
+
/**
|
|
3251
|
+
* RegExp to match type in RFC 7231 sec 3.1.1.1
|
|
3252
|
+
*
|
|
3253
|
+
* media-type = type "/" subtype
|
|
3254
|
+
* type = token
|
|
3255
|
+
* subtype = token
|
|
3256
|
+
*/
|
|
3257
|
+
var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
3258
|
+
|
|
3259
|
+
/**
|
|
3260
|
+
* Module exports.
|
|
3261
|
+
* @public
|
|
3262
|
+
*/
|
|
3263
|
+
|
|
3264
|
+
contentType.format = format$1;
|
|
3265
|
+
contentType.parse = parse$1;
|
|
3266
|
+
|
|
3267
|
+
/**
|
|
3268
|
+
* Format object to media type.
|
|
3269
|
+
*
|
|
3270
|
+
* @param {object} obj
|
|
3271
|
+
* @return {string}
|
|
3272
|
+
* @public
|
|
3273
|
+
*/
|
|
3274
|
+
|
|
3275
|
+
function format$1 (obj) {
|
|
3276
|
+
if (!obj || typeof obj !== 'object') {
|
|
3277
|
+
throw new TypeError('argument obj is required')
|
|
3278
|
+
}
|
|
3279
|
+
|
|
3280
|
+
var parameters = obj.parameters;
|
|
3281
|
+
var type = obj.type;
|
|
3282
|
+
|
|
3283
|
+
if (!type || !TYPE_REGEXP.test(type)) {
|
|
3284
|
+
throw new TypeError('invalid type')
|
|
3285
|
+
}
|
|
3286
|
+
|
|
3287
|
+
var string = type;
|
|
3288
|
+
|
|
3289
|
+
// append parameters
|
|
3290
|
+
if (parameters && typeof parameters === 'object') {
|
|
3291
|
+
var param;
|
|
3292
|
+
var params = Object.keys(parameters).sort();
|
|
3293
|
+
|
|
3294
|
+
for (var i = 0; i < params.length; i++) {
|
|
3295
|
+
param = params[i];
|
|
3296
|
+
|
|
3297
|
+
if (!TOKEN_REGEXP.test(param)) {
|
|
3298
|
+
throw new TypeError('invalid parameter name')
|
|
3299
|
+
}
|
|
3300
|
+
|
|
3301
|
+
string += '; ' + param + '=' + qstring(parameters[param]);
|
|
3302
|
+
}
|
|
3303
|
+
}
|
|
3304
|
+
|
|
3305
|
+
return string
|
|
3306
|
+
}
|
|
3307
|
+
|
|
3308
|
+
/**
|
|
3309
|
+
* Parse media type to object.
|
|
3310
|
+
*
|
|
3311
|
+
* @param {string|object} string
|
|
3312
|
+
* @return {Object}
|
|
3313
|
+
* @public
|
|
3314
|
+
*/
|
|
3315
|
+
|
|
3316
|
+
function parse$1 (string) {
|
|
3317
|
+
if (!string) {
|
|
3318
|
+
throw new TypeError('argument string is required')
|
|
3319
|
+
}
|
|
3320
|
+
|
|
3321
|
+
// support req/res-like objects as argument
|
|
3322
|
+
var header = typeof string === 'object'
|
|
3323
|
+
? getcontenttype(string)
|
|
3324
|
+
: string;
|
|
3325
|
+
|
|
3326
|
+
if (typeof header !== 'string') {
|
|
3327
|
+
throw new TypeError('argument string is required to be a string')
|
|
3328
|
+
}
|
|
3329
|
+
|
|
3330
|
+
var index = header.indexOf(';');
|
|
3331
|
+
var type = index !== -1
|
|
3332
|
+
? header.substr(0, index).trim()
|
|
3333
|
+
: header.trim();
|
|
3334
|
+
|
|
3335
|
+
if (!TYPE_REGEXP.test(type)) {
|
|
2313
3336
|
throw new TypeError('invalid media type')
|
|
2314
3337
|
}
|
|
2315
3338
|
|
|
@@ -2437,9 +3460,10 @@ const getContentType = (path) => {
|
|
|
2437
3460
|
|
|
2438
3461
|
var mediaTypes = { addPlugin, parse, getContentType };
|
|
2439
3462
|
|
|
2440
|
-
const curry$
|
|
2441
|
-
const Pact$a = lib$
|
|
2442
|
-
const
|
|
3463
|
+
const curry$8 = justCurryIt$2;
|
|
3464
|
+
const Pact$a = lib$5;
|
|
3465
|
+
const Json = lib$3;
|
|
3466
|
+
const JsonPointer = lib$6;
|
|
2443
3467
|
const { jsonTypeOf, resolveUrl: resolveUrl$1, urlFragment, pathRelative } = common$1;
|
|
2444
3468
|
const fetch$1 = fetch_browser;
|
|
2445
3469
|
const Reference$1 = reference;
|
|
@@ -2470,64 +3494,61 @@ const getConfig = (dialectId, key) => {
|
|
|
2470
3494
|
// Schema Management
|
|
2471
3495
|
const schemaStore = {};
|
|
2472
3496
|
const schemaStoreAlias = {};
|
|
3497
|
+
const add$1 = (schema, retrievalUri = "", defaultDialectId = "") => {
|
|
3498
|
+
const dialectId = getDialectId(schema, retrievalUri, defaultDialectId);
|
|
2473
3499
|
|
|
2474
|
-
const
|
|
2475
|
-
schema = JSON.parse(JSON.stringify(schema));
|
|
2476
|
-
const externalId = resolveUrl$1(url, "");
|
|
3500
|
+
const id = getBaseUri(schema, retrievalUri, dialectJsonSchemaVersion[dialectId]);
|
|
2477
3501
|
|
|
2478
|
-
//
|
|
2479
|
-
const
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
3502
|
+
// Extract embedded schemas and collect anchors
|
|
3503
|
+
const embeddedToken = getConfig(dialectId, "embeddedToken");
|
|
3504
|
+
const baseToken = getConfig(dialectId, "baseToken");
|
|
3505
|
+
const anchorToken = getConfig(dialectId, "anchorToken");
|
|
3506
|
+
const dynamicAnchorToken = getConfig(dialectId, "dynamicAnchorToken");
|
|
3507
|
+
const jrefToken = getConfig(dialectId, "jrefToken");
|
|
2484
3508
|
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
}
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
}
|
|
2503
|
-
|
|
2504
|
-
|
|
3509
|
+
const dynamicAnchors = {};
|
|
3510
|
+
const anchors = { "": "" };
|
|
3511
|
+
|
|
3512
|
+
schema = Json.parse(JSON.stringify(schema), (key, value, pointer) => {
|
|
3513
|
+
if (jsonTypeOf(value, "object")) {
|
|
3514
|
+
// Embedded Schema
|
|
3515
|
+
const embeddedSchemaDialectId = typeof value.$schema === "string" ? resolveUrl$1(value.$schema, "") : dialectId;
|
|
3516
|
+
const embeddedEmbeddedToken = getConfig(embeddedSchemaDialectId, "embeddedToken");
|
|
3517
|
+
const embeddedAnchorToken = getConfig(embeddedSchemaDialectId, "anchorToken");
|
|
3518
|
+
if (typeof value[embeddedEmbeddedToken] === "string" && (embeddedEmbeddedToken !== embeddedAnchorToken || value[embeddedEmbeddedToken][0] !== "#") && pointer !== "") {
|
|
3519
|
+
const embeddedRetrievalUri = resolveUrl$1(id, value[embeddedEmbeddedToken]);
|
|
3520
|
+
add$1(value, embeddedRetrievalUri, dialectId);
|
|
3521
|
+
return Reference$1.cons(value[embeddedEmbeddedToken], value);
|
|
3522
|
+
}
|
|
3523
|
+
|
|
3524
|
+
if (typeof value[jrefToken] === "string") {
|
|
3525
|
+
return Reference$1.cons(value[jrefToken], value);
|
|
3526
|
+
}
|
|
3527
|
+
|
|
3528
|
+
if (typeof value[anchorToken] === "string" && pointer !== JsonPointer.nil) {
|
|
3529
|
+
const anchor = anchorToken !== embeddedToken ? value[anchorToken] : value[anchorToken].slice(1);
|
|
3530
|
+
anchors[anchor] = pointer;
|
|
3531
|
+
delete value[anchorToken];
|
|
3532
|
+
}
|
|
3533
|
+
|
|
3534
|
+
if (typeof value[dynamicAnchorToken] === "string") {
|
|
3535
|
+
dynamicAnchors[value[dynamicAnchorToken]] = `${id}#${pointer}`;
|
|
3536
|
+
anchors[value[dynamicAnchorToken]] = pointer;
|
|
3537
|
+
delete value[dynamicAnchorToken];
|
|
2505
3538
|
}
|
|
2506
3539
|
}
|
|
2507
|
-
}
|
|
2508
3540
|
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
throw Error("Couldn't determine an identifier for the schema");
|
|
2513
|
-
}
|
|
2514
|
-
const baseToken = getConfig(dialectId, "baseToken");
|
|
2515
|
-
delete schema[baseToken];
|
|
2516
|
-
if (externalId) {
|
|
2517
|
-
schemaStoreAlias[externalId] = id;
|
|
2518
|
-
}
|
|
3541
|
+
return value;
|
|
3542
|
+
});
|
|
3543
|
+
console.log(embeddedIds);
|
|
2519
3544
|
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
schema[anchorToken] = anchorToken !== baseToken ? encodeURI(fragment) : `#${encodeURI(fragment)}`;
|
|
2523
|
-
}
|
|
3545
|
+
delete schema.$schema;
|
|
3546
|
+
delete schema[baseToken];
|
|
2524
3547
|
|
|
2525
3548
|
// recursiveAnchor
|
|
2526
|
-
const dynamicAnchors = {};
|
|
2527
3549
|
const recursiveAnchorToken = getConfig(dialectId, "recursiveAnchorToken");
|
|
2528
3550
|
if (schema[recursiveAnchorToken] === true) {
|
|
2529
3551
|
dynamicAnchors[""] = `${id}#`;
|
|
2530
|
-
schema[anchorToken] = "";
|
|
2531
3552
|
delete schema[recursiveAnchorToken];
|
|
2532
3553
|
}
|
|
2533
3554
|
|
|
@@ -2542,69 +3563,66 @@ const add$1 = (schema, url = "", defaultSchemaVersion = "") => {
|
|
|
2542
3563
|
}
|
|
2543
3564
|
|
|
2544
3565
|
// Store Schema
|
|
2545
|
-
const anchors = { "": "" };
|
|
2546
3566
|
schemaStore[id] = {
|
|
2547
|
-
id
|
|
2548
|
-
dialectId
|
|
2549
|
-
schema
|
|
2550
|
-
anchors
|
|
2551
|
-
dynamicAnchors
|
|
2552
|
-
vocabulary
|
|
3567
|
+
id,
|
|
3568
|
+
dialectId,
|
|
3569
|
+
schema,
|
|
3570
|
+
anchors,
|
|
3571
|
+
dynamicAnchors,
|
|
3572
|
+
vocabulary,
|
|
2553
3573
|
validated: false
|
|
2554
3574
|
};
|
|
3575
|
+
if (id === "https://example.com/schema/root") {
|
|
3576
|
+
console.log(Object.keys(schemaStore).filter((id) => !/json-schema\.org/.test(id)));
|
|
3577
|
+
}
|
|
2555
3578
|
|
|
2556
|
-
|
|
3579
|
+
if (retrievalUri) {
|
|
3580
|
+
schemaStoreAlias[resolveUrl$1(retrievalUri, "")] = id;
|
|
3581
|
+
}
|
|
2557
3582
|
};
|
|
2558
3583
|
|
|
2559
|
-
const
|
|
2560
|
-
const
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
}
|
|
2564
|
-
|
|
2565
|
-
const processSchema = (subject, id, dialectId, pointer, anchors, dynamicAnchors) => {
|
|
2566
|
-
if (jsonTypeOf(subject, "object")) {
|
|
2567
|
-
const embeddedSchemaDialectId = typeof subject.$schema === "string" ? resolveUrl$1(subject.$schema, "") : dialectId;
|
|
2568
|
-
const embeddedEmbeddedToken = getConfig(embeddedSchemaDialectId, "embeddedToken");
|
|
2569
|
-
const embeddedAnchorToken = getConfig(embeddedSchemaDialectId, "anchorToken");
|
|
2570
|
-
if (typeof subject[embeddedEmbeddedToken] === "string" && (embeddedEmbeddedToken !== embeddedAnchorToken || subject[embeddedEmbeddedToken][0] !== "#")) {
|
|
2571
|
-
const ref = resolveUrl$1(id, subject[embeddedEmbeddedToken]);
|
|
2572
|
-
const embeddedBaseToken = getConfig(embeddedSchemaDialectId, "baseToken");
|
|
2573
|
-
subject[embeddedBaseToken] = ref;
|
|
2574
|
-
add$1(subject, ref, dialectId);
|
|
2575
|
-
return Reference$1.cons(subject[embeddedEmbeddedToken], subject);
|
|
2576
|
-
}
|
|
2577
|
-
|
|
2578
|
-
const anchorToken = getConfig(dialectId, "anchorToken");
|
|
2579
|
-
const dynamicAnchorToken = getConfig(dialectId, "dynamicAnchorToken");
|
|
2580
|
-
if (typeof subject[dynamicAnchorToken] === "string") {
|
|
2581
|
-
dynamicAnchors[subject[dynamicAnchorToken]] = `${id}#${encodeURI(pointer)}`;
|
|
2582
|
-
anchors[subject[dynamicAnchorToken]] = pointer;
|
|
2583
|
-
delete subject[dynamicAnchorToken];
|
|
2584
|
-
}
|
|
2585
|
-
|
|
2586
|
-
const embeddedToken = getConfig(dialectId, "embeddedToken");
|
|
2587
|
-
if (typeof subject[anchorToken] === "string") {
|
|
2588
|
-
const anchor = anchorToken !== embeddedToken ? subject[anchorToken] : subject[anchorToken].slice(1);
|
|
2589
|
-
anchors[anchor] = pointer;
|
|
2590
|
-
delete subject[anchorToken];
|
|
2591
|
-
}
|
|
3584
|
+
const getDialectId = (schema, retrievalUri, defaultDialectId) => {
|
|
3585
|
+
const dialectId = resolveUrl$1(schema.$schema || defaultDialectId, "");
|
|
3586
|
+
if (!dialectId) {
|
|
3587
|
+
throw Error("Couldn't determine schema dialect");
|
|
3588
|
+
}
|
|
2592
3589
|
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
3590
|
+
// Determine JSON Schema version
|
|
3591
|
+
if (!(dialectId in dialectJsonSchemaVersion)) {
|
|
3592
|
+
if (schema?.$vocabulary?.[core201909Id] === true && dialectId === getBaseUri(schema, retrievalUri, core201909Id)) {
|
|
3593
|
+
// Self describing 2019-09 meta-schema
|
|
3594
|
+
dialectJsonSchemaVersion[dialectId] = core201909Id;
|
|
3595
|
+
} else if (schema?.$vocabulary?.[core202012Id] === true && dialectId === getBaseUri(schema, retrievalUri, core202012Id)) {
|
|
3596
|
+
// Self describing 2020-12 meta-schema
|
|
3597
|
+
dialectJsonSchemaVersion[dialectId] = core202012Id;
|
|
3598
|
+
} else {
|
|
3599
|
+
// Need to look at meta-schema to determine version
|
|
3600
|
+
const metaSchema = schemaStore[dialectId];
|
|
3601
|
+
if (!metaSchema) {
|
|
3602
|
+
throw Error(`Couldn't determine JSON Schema version for dialect: '${dialectId}'`);
|
|
3603
|
+
} else if (metaSchema.vocabulary[core201909Id] === true) {
|
|
3604
|
+
dialectJsonSchemaVersion[dialectId] = core201909Id;
|
|
3605
|
+
} else if (metaSchema.vocabulary[core202012Id] === true) {
|
|
3606
|
+
dialectJsonSchemaVersion[dialectId] = core202012Id;
|
|
3607
|
+
} else {
|
|
3608
|
+
// Assume the jsonSchemaVersion is the meta-schema's dialectId (non-standard behavior)
|
|
3609
|
+
dialectJsonSchemaVersion[dialectId] = dialectJsonSchemaVersion[metaSchema.dialectId];
|
|
3610
|
+
}
|
|
2596
3611
|
}
|
|
3612
|
+
}
|
|
2597
3613
|
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
}
|
|
3614
|
+
return dialectId;
|
|
3615
|
+
};
|
|
2601
3616
|
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
3617
|
+
const getBaseUri = (schema, retrievalUri, jsonSchemaVersion) => {
|
|
3618
|
+
const baseToken = config[jsonSchemaVersion]?.["baseToken"];
|
|
3619
|
+
const relativeBaseUri = typeof schema[baseToken] === "string" ? schema[baseToken] : "";
|
|
3620
|
+
const baseUri = resolveUrl$1(resolveUrl$1(retrievalUri, relativeBaseUri), "");
|
|
3621
|
+
if (!baseUri) {
|
|
3622
|
+
throw Error("Couldn't determine an identifier for the schema");
|
|
2607
3623
|
}
|
|
3624
|
+
|
|
3625
|
+
return baseUri;
|
|
2608
3626
|
};
|
|
2609
3627
|
|
|
2610
3628
|
const hasStoredSchema = (id) => id in schemaStore || id in schemaStoreAlias;
|
|
@@ -2641,13 +3659,21 @@ const get = async (url, contextDoc = nil) => {
|
|
|
2641
3659
|
|
|
2642
3660
|
const [schema, defaultDialectId] = await MediaTypes$1.parse(response);
|
|
2643
3661
|
|
|
3662
|
+
let dialectId;
|
|
3663
|
+
if (schema.$schema) {
|
|
3664
|
+
dialectId = resolveUrl$1(schema.$schema, "");
|
|
3665
|
+
} else if (defaultDialectId) {
|
|
3666
|
+
dialectId = resolveUrl$1(id, defaultDialectId);
|
|
3667
|
+
} else {
|
|
3668
|
+
dialectId = "";
|
|
3669
|
+
}
|
|
3670
|
+
|
|
2644
3671
|
// Make sure the meta-schema is loaded if this isn't a known dialect
|
|
2645
|
-
|
|
2646
|
-
if (id !== dialectId && !(dialectId in dialectJsonSchemaVersion)) {
|
|
3672
|
+
if (dialectId && id !== dialectId && !(dialectId in dialectJsonSchemaVersion)) {
|
|
2647
3673
|
await get(dialectId);
|
|
2648
3674
|
}
|
|
2649
3675
|
|
|
2650
|
-
add$1(schema, id);
|
|
3676
|
+
add$1(schema, id, dialectId);
|
|
2651
3677
|
}
|
|
2652
3678
|
|
|
2653
3679
|
const storedSchema = getStoredSchema(id);
|
|
@@ -2690,14 +3716,14 @@ const step = (key, doc) => {
|
|
|
2690
3716
|
|
|
2691
3717
|
const keys = (doc) => Object.keys(value(doc));
|
|
2692
3718
|
|
|
2693
|
-
const entries = (doc) => Pact$a.pipeline([
|
|
3719
|
+
const entries$2 = (doc) => Pact$a.pipeline([
|
|
2694
3720
|
value,
|
|
2695
3721
|
Object.keys,
|
|
2696
3722
|
Pact$a.map(async (key) => [key, await step(key, doc)]),
|
|
2697
3723
|
Pact$a.all
|
|
2698
3724
|
], doc);
|
|
2699
3725
|
|
|
2700
|
-
const map = curry$
|
|
3726
|
+
const map$3 = curry$8((fn, doc) => Pact$a.pipeline([
|
|
2701
3727
|
value,
|
|
2702
3728
|
Pact$a.map(async (item, ndx) => fn(await step(ndx, doc), ndx)),
|
|
2703
3729
|
Pact$a.all
|
|
@@ -2713,41 +3739,43 @@ const toSchemaDefaultOptions = {
|
|
|
2713
3739
|
const toSchema = (schemaDoc, options = {}) => {
|
|
2714
3740
|
const fullOptions = { ...toSchemaDefaultOptions, ...options };
|
|
2715
3741
|
|
|
2716
|
-
const
|
|
2717
|
-
|
|
2718
|
-
|
|
3742
|
+
const anchorToken = getConfig(schemaDoc.dialectId, "anchorToken");
|
|
3743
|
+
const dynamicAnchorToken = getConfig(schemaDoc.dialectId, "dynamicAnchorToken");
|
|
3744
|
+
|
|
3745
|
+
const anchors = {};
|
|
3746
|
+
for (const anchor in schemaDoc.anchors) {
|
|
3747
|
+
if (anchor !== "" && !schemaDoc.dynamicAnchors[anchor]) {
|
|
3748
|
+
anchors[schemaDoc.anchors[anchor]] = anchor;
|
|
2719
3749
|
}
|
|
3750
|
+
}
|
|
3751
|
+
|
|
3752
|
+
const dynamicAnchors = {};
|
|
3753
|
+
for (const anchor in schemaDoc.dynamicAnchors) {
|
|
3754
|
+
const pointer = urlFragment(schemaDoc.dynamicAnchors[anchor]);
|
|
3755
|
+
dynamicAnchors[pointer] = anchor;
|
|
3756
|
+
}
|
|
2720
3757
|
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
3758
|
+
const schema = JSON.parse(Json.stringify(schemaDoc.schema, (key, value, pointer) => {
|
|
3759
|
+
if (Reference$1.isReference(value)) {
|
|
3760
|
+
const refValue = Reference$1.value(value);
|
|
3761
|
+
const embeddedDialect = typeof refValue.$schema === "string" ? resolveUrl$1(refValue.$schema, "") : schemaDoc.dialectId;
|
|
3762
|
+
const embeddedToken = getConfig(embeddedDialect, "embeddedToken");
|
|
3763
|
+
if (!fullOptions.includeEmbedded && embeddedToken in refValue) {
|
|
3764
|
+
return;
|
|
3765
|
+
} else {
|
|
3766
|
+
return Reference$1.value(value);
|
|
3767
|
+
}
|
|
2726
3768
|
} else {
|
|
2727
|
-
|
|
3769
|
+
if (pointer in anchors) {
|
|
3770
|
+
value = { [anchorToken]: anchors[pointer], ...value };
|
|
3771
|
+
}
|
|
3772
|
+
if (pointer in dynamicAnchors) {
|
|
3773
|
+
value = { [dynamicAnchorToken]: dynamicAnchors[pointer], ...value };
|
|
3774
|
+
}
|
|
3775
|
+
return value;
|
|
2728
3776
|
}
|
|
2729
3777
|
}));
|
|
2730
3778
|
|
|
2731
|
-
const dynamicAnchorToken = getConfig(schemaDoc.dialectId, "dynamicAnchorToken");
|
|
2732
|
-
Object.entries(schemaDoc.dynamicAnchors)
|
|
2733
|
-
.forEach(([anchor, uri]) => {
|
|
2734
|
-
const pointer = urlFragment(uri);
|
|
2735
|
-
JsonPointer.assign(pointer, schema, {
|
|
2736
|
-
[dynamicAnchorToken]: anchor,
|
|
2737
|
-
...JsonPointer.get(pointer, schema)
|
|
2738
|
-
});
|
|
2739
|
-
});
|
|
2740
|
-
|
|
2741
|
-
const anchorToken = getConfig(schemaDoc.dialectId, "anchorToken");
|
|
2742
|
-
Object.entries(schemaDoc.anchors)
|
|
2743
|
-
.filter(([anchor]) => anchor !== "")
|
|
2744
|
-
.forEach(([anchor, pointer]) => {
|
|
2745
|
-
JsonPointer.assign(pointer, schema, {
|
|
2746
|
-
[anchorToken]: anchor,
|
|
2747
|
-
...JsonPointer.get(pointer, schema)
|
|
2748
|
-
});
|
|
2749
|
-
});
|
|
2750
|
-
|
|
2751
3779
|
const baseToken = getConfig(schemaDoc.dialectId, "baseToken");
|
|
2752
3780
|
const id = relativeUri(fullOptions.parentId, schemaDoc.id);
|
|
2753
3781
|
const dialect = fullOptions.parentDialect === schemaDoc.dialectId ? "" : schemaDoc.dialectId;
|
|
@@ -2770,7 +3798,7 @@ const relativeUri = (from, to) => {
|
|
|
2770
3798
|
var schema$5 = {
|
|
2771
3799
|
setConfig, getConfig,
|
|
2772
3800
|
add: add$1, get, markValidated,
|
|
2773
|
-
uri, value, getAnchorPointer, typeOf, has, step, keys, entries, map, length,
|
|
3801
|
+
uri, value, getAnchorPointer, typeOf, has, step, keys, entries: entries$2, map: map$3, length,
|
|
2774
3802
|
toSchema
|
|
2775
3803
|
};
|
|
2776
3804
|
|
|
@@ -2792,7 +3820,7 @@ const interpret$O = () => true;
|
|
|
2792
3820
|
|
|
2793
3821
|
var metaData$4 = { compile: compile$O, interpret: interpret$O };
|
|
2794
3822
|
|
|
2795
|
-
const curry = justCurryIt;
|
|
3823
|
+
const curry$7 = justCurryIt$2;
|
|
2796
3824
|
const PubSub$1 = pubsub.exports;
|
|
2797
3825
|
const { resolveUrl } = common$1;
|
|
2798
3826
|
const Instance$E = instance;
|
|
@@ -2828,7 +3856,7 @@ const compile$N = async (schema) => {
|
|
|
2828
3856
|
return { ast, schemaUri };
|
|
2829
3857
|
};
|
|
2830
3858
|
|
|
2831
|
-
const interpret$N = curry(({ ast, schemaUri }, value, outputFormat = FLAG) => {
|
|
3859
|
+
const interpret$N = curry$7(({ ast, schemaUri }, value, outputFormat = FLAG) => {
|
|
2832
3860
|
if (![FLAG, BASIC, DETAILED, VERBOSE].includes(outputFormat)) {
|
|
2833
3861
|
throw Error(`The '${outputFormat}' error format is not supported`);
|
|
2834
3862
|
}
|
|
@@ -2998,7 +4026,7 @@ var core$2 = {
|
|
|
2998
4026
|
addMediaTypePlugin: MediaTypes.addPlugin
|
|
2999
4027
|
};
|
|
3000
4028
|
|
|
3001
|
-
const Pact$9 = lib$
|
|
4029
|
+
const Pact$9 = lib$5;
|
|
3002
4030
|
const PubSub = pubsub.exports;
|
|
3003
4031
|
const Core$x = core$2;
|
|
3004
4032
|
const Instance$D = instance;
|
|
@@ -3111,9 +4139,9 @@ const Keywords$2 = keywords$6;
|
|
|
3111
4139
|
const InvalidSchemaError$1 = invalidSchemaError;
|
|
3112
4140
|
|
|
3113
4141
|
|
|
3114
|
-
var lib$
|
|
4142
|
+
var lib$2 = { Core: Core$w, Schema: Schema$O, Instance: Instance$C, Reference, Keywords: Keywords$2, InvalidSchemaError: InvalidSchemaError$1 };
|
|
3115
4143
|
|
|
3116
|
-
const { Core: Core$v, Schema: Schema$N, Instance: Instance$B } = lib$
|
|
4144
|
+
const { Core: Core$v, Schema: Schema$N, Instance: Instance$B } = lib$2;
|
|
3117
4145
|
|
|
3118
4146
|
|
|
3119
4147
|
const compile$L = async (schema, ast, parentSchema) => {
|
|
@@ -3141,7 +4169,7 @@ const interpret$L = ([numberOfItems, additionalItems], instance, ast, dynamicAnc
|
|
|
3141
4169
|
|
|
3142
4170
|
var additionalItems = { compile: compile$L, interpret: interpret$L };
|
|
3143
4171
|
|
|
3144
|
-
const { Core: Core$u, Schema: Schema$M, Instance: Instance$A } = lib$
|
|
4172
|
+
const { Core: Core$u, Schema: Schema$M, Instance: Instance$A } = lib$2;
|
|
3145
4173
|
|
|
3146
4174
|
|
|
3147
4175
|
const compile$K = async (schema, ast, parentSchema) => {
|
|
@@ -3165,7 +4193,7 @@ const collectEvaluatedItems$d = (keywordValue, instance, ast, dynamicAnchors) =>
|
|
|
3165
4193
|
|
|
3166
4194
|
var additionalItems6 = { compile: compile$K, interpret: interpret$K, collectEvaluatedItems: collectEvaluatedItems$d };
|
|
3167
4195
|
|
|
3168
|
-
const { Core: Core$t, Schema: Schema$L, Instance: Instance$z } = lib$
|
|
4196
|
+
const { Core: Core$t, Schema: Schema$L, Instance: Instance$z } = lib$2;
|
|
3169
4197
|
|
|
3170
4198
|
|
|
3171
4199
|
const compile$J = async (schema, ast, parentSchema) => {
|
|
@@ -3199,7 +4227,7 @@ const interpret$J = ([propertyNames, propertyNamePatterns, additionalProperties]
|
|
|
3199
4227
|
|
|
3200
4228
|
var additionalProperties = { compile: compile$J, interpret: interpret$J };
|
|
3201
4229
|
|
|
3202
|
-
const { Core: Core$s, Schema: Schema$K, Instance: Instance$y } = lib$
|
|
4230
|
+
const { Core: Core$s, Schema: Schema$K, Instance: Instance$y } = lib$2;
|
|
3203
4231
|
|
|
3204
4232
|
|
|
3205
4233
|
const compile$I = async (schema, ast, parentSchema) => {
|
|
@@ -3228,8 +4256,129 @@ const collectEvaluatedProperties$c = (keywordValue, instance, ast, dynamicAnchor
|
|
|
3228
4256
|
|
|
3229
4257
|
var additionalProperties6 = { compile: compile$I, interpret: interpret$I, collectEvaluatedProperties: collectEvaluatedProperties$c };
|
|
3230
4258
|
|
|
3231
|
-
|
|
3232
|
-
|
|
4259
|
+
var entries$1 = async (doc) => Object.entries(await doc);
|
|
4260
|
+
|
|
4261
|
+
var justCurryIt = curry$6;
|
|
4262
|
+
|
|
4263
|
+
/*
|
|
4264
|
+
function add(a, b, c) {
|
|
4265
|
+
return a + b + c;
|
|
4266
|
+
}
|
|
4267
|
+
curry(add)(1)(2)(3); // 6
|
|
4268
|
+
curry(add)(1)(2)(2); // 5
|
|
4269
|
+
curry(add)(2)(4, 3); // 9
|
|
4270
|
+
|
|
4271
|
+
function add(...args) {
|
|
4272
|
+
return args.reduce((sum, n) => sum + n, 0)
|
|
4273
|
+
}
|
|
4274
|
+
var curryAdd4 = curry(add, 4)
|
|
4275
|
+
curryAdd4(1)(2, 3)(4); // 10
|
|
4276
|
+
|
|
4277
|
+
function converter(ratio, input) {
|
|
4278
|
+
return (input*ratio).toFixed(1);
|
|
4279
|
+
}
|
|
4280
|
+
const curriedConverter = curry(converter)
|
|
4281
|
+
const milesToKm = curriedConverter(1.62);
|
|
4282
|
+
milesToKm(35); // 56.7
|
|
4283
|
+
milesToKm(10); // 16.2
|
|
4284
|
+
*/
|
|
4285
|
+
|
|
4286
|
+
function curry$6(fn, arity) {
|
|
4287
|
+
return function curried() {
|
|
4288
|
+
if (arity == null) {
|
|
4289
|
+
arity = fn.length;
|
|
4290
|
+
}
|
|
4291
|
+
var args = [].slice.call(arguments);
|
|
4292
|
+
if (args.length >= arity) {
|
|
4293
|
+
return fn.apply(this, args);
|
|
4294
|
+
} else {
|
|
4295
|
+
return function() {
|
|
4296
|
+
return curried.apply(this, args.concat([].slice.call(arguments)));
|
|
4297
|
+
};
|
|
4298
|
+
}
|
|
4299
|
+
};
|
|
4300
|
+
}
|
|
4301
|
+
|
|
4302
|
+
const curry$5 = justCurryIt;
|
|
4303
|
+
|
|
4304
|
+
|
|
4305
|
+
var map$2 = curry$5(async (fn, doc) => (await doc).map(fn));
|
|
4306
|
+
|
|
4307
|
+
const curry$4 = justCurryIt;
|
|
4308
|
+
|
|
4309
|
+
|
|
4310
|
+
var reduce$2 = curry$4(async (fn, acc, doc) => {
|
|
4311
|
+
return (await doc).reduce(async (acc, item) => fn(await acc, item), acc);
|
|
4312
|
+
});
|
|
4313
|
+
|
|
4314
|
+
const curry$3 = justCurryIt;
|
|
4315
|
+
const reduce$1 = reduce$2;
|
|
4316
|
+
|
|
4317
|
+
|
|
4318
|
+
var filter = curry$3(async (fn, doc, options = {}) => {
|
|
4319
|
+
return reduce$1(async (acc, item) => {
|
|
4320
|
+
return (await fn(item)) ? acc.concat([item]) : acc;
|
|
4321
|
+
}, [], doc, options);
|
|
4322
|
+
});
|
|
4323
|
+
|
|
4324
|
+
const curry$2 = justCurryIt;
|
|
4325
|
+
const map$1 = map$2;
|
|
4326
|
+
|
|
4327
|
+
|
|
4328
|
+
var some = curry$2(async (fn, doc) => {
|
|
4329
|
+
const results = await map$1(fn, doc);
|
|
4330
|
+
return (await Promise.all(results))
|
|
4331
|
+
.some((a) => a);
|
|
4332
|
+
});
|
|
4333
|
+
|
|
4334
|
+
const curry$1 = justCurryIt;
|
|
4335
|
+
const map = map$2;
|
|
4336
|
+
|
|
4337
|
+
|
|
4338
|
+
var every = curry$1(async (fn, doc) => {
|
|
4339
|
+
const results = await map(fn, doc);
|
|
4340
|
+
return (await Promise.all(results))
|
|
4341
|
+
.every((a) => a);
|
|
4342
|
+
});
|
|
4343
|
+
|
|
4344
|
+
const curry = justCurryIt;
|
|
4345
|
+
|
|
4346
|
+
|
|
4347
|
+
var pipeline$1 = curry((fns, doc) => {
|
|
4348
|
+
return fns.reduce(async (acc, fn) => fn(await acc), doc);
|
|
4349
|
+
});
|
|
4350
|
+
|
|
4351
|
+
var all = (doc) => Promise.all(doc);
|
|
4352
|
+
|
|
4353
|
+
const pipeline = pipeline$1;
|
|
4354
|
+
const entries = entries$1;
|
|
4355
|
+
const reduce = reduce$2;
|
|
4356
|
+
|
|
4357
|
+
|
|
4358
|
+
var allValues = (doc) => {
|
|
4359
|
+
return pipeline([
|
|
4360
|
+
entries,
|
|
4361
|
+
reduce(async (acc, [propertyName, propertyValue]) => {
|
|
4362
|
+
acc[propertyName] = await propertyValue;
|
|
4363
|
+
return acc;
|
|
4364
|
+
}, {})
|
|
4365
|
+
], doc);
|
|
4366
|
+
};
|
|
4367
|
+
|
|
4368
|
+
var lib$1 = {
|
|
4369
|
+
entries: entries$1,
|
|
4370
|
+
map: map$2,
|
|
4371
|
+
filter: filter,
|
|
4372
|
+
reduce: reduce$2,
|
|
4373
|
+
some: some,
|
|
4374
|
+
every: every,
|
|
4375
|
+
pipeline: pipeline$1,
|
|
4376
|
+
all: all,
|
|
4377
|
+
allValues: allValues
|
|
4378
|
+
};
|
|
4379
|
+
|
|
4380
|
+
const { Core: Core$r, Schema: Schema$J } = lib$2;
|
|
4381
|
+
const Pact$8 = lib$1;
|
|
3233
4382
|
|
|
3234
4383
|
|
|
3235
4384
|
const compile$H = (schema, ast) => Pact$8.pipeline([
|
|
@@ -3257,8 +4406,8 @@ const collectEvaluatedItems$c = (allOf, instance, ast, dynamicAnchors) => {
|
|
|
3257
4406
|
|
|
3258
4407
|
var allOf = { compile: compile$H, interpret: interpret$H, collectEvaluatedProperties: collectEvaluatedProperties$b, collectEvaluatedItems: collectEvaluatedItems$c };
|
|
3259
4408
|
|
|
3260
|
-
const { Core: Core$q, Schema: Schema$I } = lib$
|
|
3261
|
-
const Pact$7 = lib$
|
|
4409
|
+
const { Core: Core$q, Schema: Schema$I } = lib$2;
|
|
4410
|
+
const Pact$7 = lib$1;
|
|
3262
4411
|
|
|
3263
4412
|
|
|
3264
4413
|
const compile$G = (schema, ast) => Pact$7.pipeline([
|
|
@@ -3346,7 +4495,7 @@ function stringify(val, allowUndefined) {
|
|
|
3346
4495
|
|
|
3347
4496
|
var fastestStableStringify = function(obj) { return '' + stringify(obj, false); };
|
|
3348
4497
|
|
|
3349
|
-
const { Schema: Schema$H, Instance: Instance$x } = lib$
|
|
4498
|
+
const { Schema: Schema$H, Instance: Instance$x } = lib$2;
|
|
3350
4499
|
const jsonStringify$2 = fastestStableStringify;
|
|
3351
4500
|
|
|
3352
4501
|
|
|
@@ -3355,7 +4504,7 @@ const interpret$F = (const_, instance) => jsonStringify$2(Instance$x.value(insta
|
|
|
3355
4504
|
|
|
3356
4505
|
var _const = { compile: compile$F, interpret: interpret$F };
|
|
3357
4506
|
|
|
3358
|
-
const { Core: Core$p, Instance: Instance$w } = lib$
|
|
4507
|
+
const { Core: Core$p, Instance: Instance$w } = lib$2;
|
|
3359
4508
|
|
|
3360
4509
|
|
|
3361
4510
|
const compile$E = (schema, ast) => Core$p.compileSchema(schema, ast);
|
|
@@ -3366,7 +4515,7 @@ const interpret$E = (contains, instance, ast, dynamicAnchors) => {
|
|
|
3366
4515
|
|
|
3367
4516
|
var contains = { compile: compile$E, interpret: interpret$E };
|
|
3368
4517
|
|
|
3369
|
-
const { Core: Core$o, Schema: Schema$G, Instance: Instance$v } = lib$
|
|
4518
|
+
const { Core: Core$o, Schema: Schema$G, Instance: Instance$v } = lib$2;
|
|
3370
4519
|
|
|
3371
4520
|
|
|
3372
4521
|
const compile$D = async (schema, ast, parentSchema) => {
|
|
@@ -3400,8 +4549,8 @@ const collectEvaluatedItems$a = (keywordValue, instance, ast, dynamicAnchors) =>
|
|
|
3400
4549
|
|
|
3401
4550
|
var containsMinContainsMaxContains = { compile: compile$D, interpret: interpret$D, collectEvaluatedItems: collectEvaluatedItems$a };
|
|
3402
4551
|
|
|
3403
|
-
const { Core: Core$n, Schema: Schema$F } = lib$
|
|
3404
|
-
const Pact$6 = lib$
|
|
4552
|
+
const { Core: Core$n, Schema: Schema$F } = lib$2;
|
|
4553
|
+
const Pact$6 = lib$1;
|
|
3405
4554
|
|
|
3406
4555
|
|
|
3407
4556
|
const compile$C = async (schema, ast) => {
|
|
@@ -3416,8 +4565,8 @@ const interpret$C = () => true;
|
|
|
3416
4565
|
|
|
3417
4566
|
var definitions = { compile: compile$C, interpret: interpret$C };
|
|
3418
4567
|
|
|
3419
|
-
const { Core: Core$m, Schema: Schema$E, Instance: Instance$u } = lib$
|
|
3420
|
-
const Pact$5 = lib$
|
|
4568
|
+
const { Core: Core$m, Schema: Schema$E, Instance: Instance$u } = lib$2;
|
|
4569
|
+
const Pact$5 = lib$1;
|
|
3421
4570
|
|
|
3422
4571
|
|
|
3423
4572
|
const compile$B = (schema, ast) => Pact$5.pipeline([
|
|
@@ -3446,8 +4595,8 @@ const interpret$B = (dependencies, instance, ast, dynamicAnchors) => {
|
|
|
3446
4595
|
|
|
3447
4596
|
var dependencies = { compile: compile$B, interpret: interpret$B };
|
|
3448
4597
|
|
|
3449
|
-
const { Schema: Schema$D, Instance: Instance$t } = lib$
|
|
3450
|
-
const Pact$4 = lib$
|
|
4598
|
+
const { Schema: Schema$D, Instance: Instance$t } = lib$2;
|
|
4599
|
+
const Pact$4 = lib$1;
|
|
3451
4600
|
|
|
3452
4601
|
|
|
3453
4602
|
const compile$A = (schema) => Pact$4.pipeline([
|
|
@@ -3466,8 +4615,8 @@ const interpret$A = (dependentRequired, instance) => {
|
|
|
3466
4615
|
|
|
3467
4616
|
var dependentRequired = { compile: compile$A, interpret: interpret$A };
|
|
3468
4617
|
|
|
3469
|
-
const { Core: Core$l, Schema: Schema$C, Instance: Instance$s } = lib$
|
|
3470
|
-
const Pact$3 = lib$
|
|
4618
|
+
const { Core: Core$l, Schema: Schema$C, Instance: Instance$s } = lib$2;
|
|
4619
|
+
const Pact$3 = lib$1;
|
|
3471
4620
|
|
|
3472
4621
|
|
|
3473
4622
|
const compile$z = (schema, ast) => Pact$3.pipeline([
|
|
@@ -3497,7 +4646,7 @@ const collectEvaluatedProperties$9 = (dependentSchemas, instance, ast, dynamicAn
|
|
|
3497
4646
|
|
|
3498
4647
|
var dependentSchemas = { compile: compile$z, interpret: interpret$z, collectEvaluatedProperties: collectEvaluatedProperties$9 };
|
|
3499
4648
|
|
|
3500
|
-
const { Schema: Schema$B, Instance: Instance$r } = lib$
|
|
4649
|
+
const { Schema: Schema$B, Instance: Instance$r } = lib$2;
|
|
3501
4650
|
const jsonStringify$1 = fastestStableStringify;
|
|
3502
4651
|
|
|
3503
4652
|
|
|
@@ -3506,7 +4655,7 @@ const interpret$y = (enum_, instance) => enum_.some((enumValue) => jsonStringify
|
|
|
3506
4655
|
|
|
3507
4656
|
var _enum = { compile: compile$y, interpret: interpret$y };
|
|
3508
4657
|
|
|
3509
|
-
const { Schema: Schema$A, Instance: Instance$q } = lib$
|
|
4658
|
+
const { Schema: Schema$A, Instance: Instance$q } = lib$2;
|
|
3510
4659
|
|
|
3511
4660
|
|
|
3512
4661
|
const compile$x = async (schema) => Schema$A.value(schema);
|
|
@@ -3514,7 +4663,7 @@ const interpret$x = (exclusiveMaximum, instance) => !Instance$q.typeOf(instance,
|
|
|
3514
4663
|
|
|
3515
4664
|
var exclusiveMaximum = { compile: compile$x, interpret: interpret$x };
|
|
3516
4665
|
|
|
3517
|
-
const { Schema: Schema$z, Instance: Instance$p } = lib$
|
|
4666
|
+
const { Schema: Schema$z, Instance: Instance$p } = lib$2;
|
|
3518
4667
|
|
|
3519
4668
|
|
|
3520
4669
|
const compile$w = async (schema) => Schema$z.value(schema);
|
|
@@ -3522,7 +4671,7 @@ const interpret$w = (exclusiveMinimum, instance) => !Instance$p.typeOf(instance,
|
|
|
3522
4671
|
|
|
3523
4672
|
var exclusiveMinimum = { compile: compile$w, interpret: interpret$w };
|
|
3524
4673
|
|
|
3525
|
-
const { Core: Core$k } = lib$
|
|
4674
|
+
const { Core: Core$k } = lib$2;
|
|
3526
4675
|
|
|
3527
4676
|
|
|
3528
4677
|
const compile$v = (schema, ast) => Core$k.compileSchema(schema, ast);
|
|
@@ -3542,7 +4691,7 @@ const collectEvaluatedItems$9 = (ifSchema, instance, ast, dynamicAnchors) => {
|
|
|
3542
4691
|
|
|
3543
4692
|
var _if = { compile: compile$v, interpret: interpret$v, collectEvaluatedProperties: collectEvaluatedProperties$8, collectEvaluatedItems: collectEvaluatedItems$9 };
|
|
3544
4693
|
|
|
3545
|
-
const { Core: Core$j, Schema: Schema$y } = lib$
|
|
4694
|
+
const { Core: Core$j, Schema: Schema$y } = lib$2;
|
|
3546
4695
|
|
|
3547
4696
|
|
|
3548
4697
|
const compile$u = async (schema, ast, parentSchema) => {
|
|
@@ -3586,7 +4735,7 @@ const collectEvaluatedItems$8 = ([guard, block], instance, ast, dynamicAnchors)
|
|
|
3586
4735
|
|
|
3587
4736
|
var then = { compile: compile$u, interpret: interpret$u, collectEvaluatedProperties: collectEvaluatedProperties$7, collectEvaluatedItems: collectEvaluatedItems$8 };
|
|
3588
4737
|
|
|
3589
|
-
const { Core: Core$i, Schema: Schema$x } = lib$
|
|
4738
|
+
const { Core: Core$i, Schema: Schema$x } = lib$2;
|
|
3590
4739
|
|
|
3591
4740
|
|
|
3592
4741
|
const compile$t = async (schema, ast, parentSchema) => {
|
|
@@ -3630,7 +4779,7 @@ const collectEvaluatedItems$7 = ([guard, block], instance, ast, dynamicAnchors)
|
|
|
3630
4779
|
|
|
3631
4780
|
var _else = { compile: compile$t, interpret: interpret$t, collectEvaluatedProperties: collectEvaluatedProperties$6, collectEvaluatedItems: collectEvaluatedItems$7 };
|
|
3632
4781
|
|
|
3633
|
-
const { Core: Core$h, Schema: Schema$w, Instance: Instance$o } = lib$
|
|
4782
|
+
const { Core: Core$h, Schema: Schema$w, Instance: Instance$o } = lib$2;
|
|
3634
4783
|
|
|
3635
4784
|
|
|
3636
4785
|
const compile$s = async (schema, ast) => {
|
|
@@ -3662,7 +4811,7 @@ const collectEvaluatedItems$6 = (items, instance, ast, dynamicAnchors) => {
|
|
|
3662
4811
|
|
|
3663
4812
|
var items = { compile: compile$s, interpret: interpret$s, collectEvaluatedItems: collectEvaluatedItems$6 };
|
|
3664
4813
|
|
|
3665
|
-
const { Core: Core$g, Schema: Schema$v, Instance: Instance$n } = lib$
|
|
4814
|
+
const { Core: Core$g, Schema: Schema$v, Instance: Instance$n } = lib$2;
|
|
3666
4815
|
|
|
3667
4816
|
|
|
3668
4817
|
const compile$r = async (schema, ast, parentSchema) => {
|
|
@@ -3686,7 +4835,7 @@ const collectEvaluatedItems$5 = (keywordValue, instance, ast, dynamicAnchors) =>
|
|
|
3686
4835
|
|
|
3687
4836
|
var items202012 = { compile: compile$r, interpret: interpret$r, collectEvaluatedItems: collectEvaluatedItems$5 };
|
|
3688
4837
|
|
|
3689
|
-
const { Schema: Schema$u, Instance: Instance$m } = lib$
|
|
4838
|
+
const { Schema: Schema$u, Instance: Instance$m } = lib$2;
|
|
3690
4839
|
|
|
3691
4840
|
|
|
3692
4841
|
const compile$q = (schema) => Schema$u.value(schema);
|
|
@@ -3694,7 +4843,7 @@ const interpret$q = (maxItems, instance) => !Instance$m.typeOf(instance, "array"
|
|
|
3694
4843
|
|
|
3695
4844
|
var maxItems = { compile: compile$q, interpret: interpret$q };
|
|
3696
4845
|
|
|
3697
|
-
const { Schema: Schema$t, Instance: Instance$l } = lib$
|
|
4846
|
+
const { Schema: Schema$t, Instance: Instance$l } = lib$2;
|
|
3698
4847
|
|
|
3699
4848
|
|
|
3700
4849
|
const compile$p = (schema) => Schema$t.value(schema);
|
|
@@ -3702,7 +4851,7 @@ const interpret$p = (maxLength, instance) => !Instance$l.typeOf(instance, "strin
|
|
|
3702
4851
|
|
|
3703
4852
|
var maxLength = { compile: compile$p, interpret: interpret$p };
|
|
3704
4853
|
|
|
3705
|
-
const { Schema: Schema$s, Instance: Instance$k } = lib$
|
|
4854
|
+
const { Schema: Schema$s, Instance: Instance$k } = lib$2;
|
|
3706
4855
|
|
|
3707
4856
|
|
|
3708
4857
|
const compile$o = (schema) => Schema$s.value(schema);
|
|
@@ -3710,7 +4859,7 @@ const interpret$o = (maxLength, instance) => !Instance$k.typeOf(instance, "strin
|
|
|
3710
4859
|
|
|
3711
4860
|
var maxLength6 = { compile: compile$o, interpret: interpret$o };
|
|
3712
4861
|
|
|
3713
|
-
const { Schema: Schema$r, Instance: Instance$j } = lib$
|
|
4862
|
+
const { Schema: Schema$r, Instance: Instance$j } = lib$2;
|
|
3714
4863
|
|
|
3715
4864
|
|
|
3716
4865
|
const compile$n = (schema) => Schema$r.value(schema);
|
|
@@ -3718,7 +4867,7 @@ const interpret$n = (maxProperties, instance) => !Instance$j.typeOf(instance, "o
|
|
|
3718
4867
|
|
|
3719
4868
|
var maxProperties = { compile: compile$n, interpret: interpret$n };
|
|
3720
4869
|
|
|
3721
|
-
const { Schema: Schema$q, Instance: Instance$i } = lib$
|
|
4870
|
+
const { Schema: Schema$q, Instance: Instance$i } = lib$2;
|
|
3722
4871
|
|
|
3723
4872
|
|
|
3724
4873
|
const compile$m = async (schema, ast, parentSchema) => {
|
|
@@ -3739,7 +4888,7 @@ const interpret$m = ([maximum, isExclusive], instance) => {
|
|
|
3739
4888
|
|
|
3740
4889
|
var maximumExclusiveMaximum = { compile: compile$m, interpret: interpret$m };
|
|
3741
4890
|
|
|
3742
|
-
const { Schema: Schema$p, Instance: Instance$h } = lib$
|
|
4891
|
+
const { Schema: Schema$p, Instance: Instance$h } = lib$2;
|
|
3743
4892
|
|
|
3744
4893
|
|
|
3745
4894
|
const compile$l = async (schema) => Schema$p.value(schema);
|
|
@@ -3747,7 +4896,7 @@ const interpret$l = (maximum, instance) => !Instance$h.typeOf(instance, "number"
|
|
|
3747
4896
|
|
|
3748
4897
|
var maximum = { compile: compile$l, interpret: interpret$l };
|
|
3749
4898
|
|
|
3750
|
-
const { Schema: Schema$o, Instance: Instance$g } = lib$
|
|
4899
|
+
const { Schema: Schema$o, Instance: Instance$g } = lib$2;
|
|
3751
4900
|
|
|
3752
4901
|
|
|
3753
4902
|
const compile$k = (schema) => Schema$o.value(schema);
|
|
@@ -3755,7 +4904,7 @@ const interpret$k = (minItems, instance) => !Instance$g.typeOf(instance, "array"
|
|
|
3755
4904
|
|
|
3756
4905
|
var minItems = { compile: compile$k, interpret: interpret$k };
|
|
3757
4906
|
|
|
3758
|
-
const { Schema: Schema$n, Instance: Instance$f } = lib$
|
|
4907
|
+
const { Schema: Schema$n, Instance: Instance$f } = lib$2;
|
|
3759
4908
|
|
|
3760
4909
|
|
|
3761
4910
|
const compile$j = (schema) => Schema$n.value(schema);
|
|
@@ -3763,7 +4912,7 @@ const interpret$j = (minLength, instance) => !Instance$f.typeOf(instance, "strin
|
|
|
3763
4912
|
|
|
3764
4913
|
var minLength = { compile: compile$j, interpret: interpret$j };
|
|
3765
4914
|
|
|
3766
|
-
const { Schema: Schema$m, Instance: Instance$e } = lib$
|
|
4915
|
+
const { Schema: Schema$m, Instance: Instance$e } = lib$2;
|
|
3767
4916
|
|
|
3768
4917
|
|
|
3769
4918
|
const compile$i = (schema) => Schema$m.value(schema);
|
|
@@ -3771,7 +4920,7 @@ const interpret$i = (minLength, instance) => !Instance$e.typeOf(instance, "strin
|
|
|
3771
4920
|
|
|
3772
4921
|
var minLength6 = { compile: compile$i, interpret: interpret$i };
|
|
3773
4922
|
|
|
3774
|
-
const { Schema: Schema$l, Instance: Instance$d } = lib$
|
|
4923
|
+
const { Schema: Schema$l, Instance: Instance$d } = lib$2;
|
|
3775
4924
|
|
|
3776
4925
|
|
|
3777
4926
|
const compile$h = (schema) => Schema$l.value(schema);
|
|
@@ -3779,7 +4928,7 @@ const interpret$h = (minProperties, instance) => !Instance$d.typeOf(instance, "o
|
|
|
3779
4928
|
|
|
3780
4929
|
var minProperties = { compile: compile$h, interpret: interpret$h };
|
|
3781
4930
|
|
|
3782
|
-
const { Schema: Schema$k, Instance: Instance$c } = lib$
|
|
4931
|
+
const { Schema: Schema$k, Instance: Instance$c } = lib$2;
|
|
3783
4932
|
|
|
3784
4933
|
|
|
3785
4934
|
const compile$g = async (schema, ast, parentSchema) => {
|
|
@@ -3800,7 +4949,7 @@ const interpret$g = ([minimum, isExclusive], instance) => {
|
|
|
3800
4949
|
|
|
3801
4950
|
var minimumExclusiveMinimum = { compile: compile$g, interpret: interpret$g };
|
|
3802
4951
|
|
|
3803
|
-
const { Schema: Schema$j, Instance: Instance$b } = lib$
|
|
4952
|
+
const { Schema: Schema$j, Instance: Instance$b } = lib$2;
|
|
3804
4953
|
|
|
3805
4954
|
|
|
3806
4955
|
const compile$f = async (schema) => Schema$j.value(schema);
|
|
@@ -3808,7 +4957,7 @@ const interpret$f = (minimum, instance) => !Instance$b.typeOf(instance, "number"
|
|
|
3808
4957
|
|
|
3809
4958
|
var minimum = { compile: compile$f, interpret: interpret$f };
|
|
3810
4959
|
|
|
3811
|
-
const { Schema: Schema$i, Instance: Instance$a } = lib$
|
|
4960
|
+
const { Schema: Schema$i, Instance: Instance$a } = lib$2;
|
|
3812
4961
|
|
|
3813
4962
|
|
|
3814
4963
|
const compile$e = (schema) => Schema$i.value(schema);
|
|
@@ -3826,7 +4975,7 @@ const numberEqual = (a, b) => Math.abs(a - b) < 1.19209290e-7;
|
|
|
3826
4975
|
|
|
3827
4976
|
var multipleOf = { compile: compile$e, interpret: interpret$e };
|
|
3828
4977
|
|
|
3829
|
-
const { Core: Core$f } = lib$
|
|
4978
|
+
const { Core: Core$f } = lib$2;
|
|
3830
4979
|
|
|
3831
4980
|
|
|
3832
4981
|
const compile$d = Core$f.compileSchema;
|
|
@@ -3834,7 +4983,7 @@ const interpret$d = (not, instance, ast, dynamicAnchors) => !Core$f.interpretSch
|
|
|
3834
4983
|
|
|
3835
4984
|
var not = { compile: compile$d, interpret: interpret$d };
|
|
3836
4985
|
|
|
3837
|
-
const { Core: Core$e, Schema: Schema$h } = lib$
|
|
4986
|
+
const { Core: Core$e, Schema: Schema$h } = lib$2;
|
|
3838
4987
|
|
|
3839
4988
|
|
|
3840
4989
|
const compile$c = async (schema, ast) => {
|
|
@@ -3883,7 +5032,7 @@ const collectEvaluatedItems$4 = (oneOf, instance, ast, dynamicAnchors) => {
|
|
|
3883
5032
|
|
|
3884
5033
|
var oneOf = { compile: compile$c, interpret: interpret$c, collectEvaluatedProperties: collectEvaluatedProperties$5, collectEvaluatedItems: collectEvaluatedItems$4 };
|
|
3885
5034
|
|
|
3886
|
-
const { Schema: Schema$g, Instance: Instance$9 } = lib$
|
|
5035
|
+
const { Schema: Schema$g, Instance: Instance$9 } = lib$2;
|
|
3887
5036
|
|
|
3888
5037
|
|
|
3889
5038
|
const compile$b = (schema) => new RegExp(Schema$g.value(schema), "u");
|
|
@@ -3891,8 +5040,8 @@ const interpret$b = (pattern, instance) => !Instance$9.typeOf(instance, "string"
|
|
|
3891
5040
|
|
|
3892
5041
|
var pattern = { compile: compile$b, interpret: interpret$b };
|
|
3893
5042
|
|
|
3894
|
-
const { Core: Core$d, Schema: Schema$f, Instance: Instance$8 } = lib$
|
|
3895
|
-
const Pact$2 = lib$
|
|
5043
|
+
const { Core: Core$d, Schema: Schema$f, Instance: Instance$8 } = lib$2;
|
|
5044
|
+
const Pact$2 = lib$1;
|
|
3896
5045
|
|
|
3897
5046
|
|
|
3898
5047
|
const compile$a = (schema, ast) => Pact$2.pipeline([
|
|
@@ -3929,8 +5078,8 @@ const splitUrl$1 = (url) => {
|
|
|
3929
5078
|
|
|
3930
5079
|
var common = { isObject, escapeRegExp: escapeRegExp$1, splitUrl: splitUrl$1 };
|
|
3931
5080
|
|
|
3932
|
-
const { Core: Core$c, Schema: Schema$e, Instance: Instance$7 } = lib$
|
|
3933
|
-
const Pact$1 = lib$
|
|
5081
|
+
const { Core: Core$c, Schema: Schema$e, Instance: Instance$7 } = lib$2;
|
|
5082
|
+
const Pact$1 = lib$1;
|
|
3934
5083
|
const { escapeRegExp } = common;
|
|
3935
5084
|
|
|
3936
5085
|
|
|
@@ -3955,7 +5104,7 @@ const collectEvaluatedProperties$3 = (properties, instance, ast, dynamicAnchors)
|
|
|
3955
5104
|
|
|
3956
5105
|
var properties = { compile: compile$9, interpret: interpret$9, collectEvaluatedProperties: collectEvaluatedProperties$3 };
|
|
3957
5106
|
|
|
3958
|
-
const { Core: Core$b, Instance: Instance$6 } = lib$
|
|
5107
|
+
const { Core: Core$b, Instance: Instance$6 } = lib$2;
|
|
3959
5108
|
|
|
3960
5109
|
|
|
3961
5110
|
const compile$8 = (schema, ast) => Core$b.compileSchema(schema, ast);
|
|
@@ -3967,7 +5116,7 @@ const interpret$8 = (propertyNames, instance, ast, dynamicAnchors) => {
|
|
|
3967
5116
|
|
|
3968
5117
|
var propertyNames = { compile: compile$8, interpret: interpret$8 };
|
|
3969
5118
|
|
|
3970
|
-
const { Core: Core$a, Schema: Schema$d } = lib$
|
|
5119
|
+
const { Core: Core$a, Schema: Schema$d } = lib$2;
|
|
3971
5120
|
const { splitUrl } = common;
|
|
3972
5121
|
|
|
3973
5122
|
|
|
@@ -3992,7 +5141,7 @@ const collectEvaluatedItems$3 = Core$a.collectEvaluatedItems;
|
|
|
3992
5141
|
|
|
3993
5142
|
var dynamicRef = { compile: compile$7, interpret: interpret$7, collectEvaluatedProperties: collectEvaluatedProperties$2, collectEvaluatedItems: collectEvaluatedItems$3 };
|
|
3994
5143
|
|
|
3995
|
-
const { Core: Core$9, Schema: Schema$c } = lib$
|
|
5144
|
+
const { Core: Core$9, Schema: Schema$c } = lib$2;
|
|
3996
5145
|
|
|
3997
5146
|
|
|
3998
5147
|
const compile$6 = async (ref, ast) => {
|
|
@@ -4006,7 +5155,7 @@ const collectEvaluatedItems$2 = Core$9.collectEvaluatedItems;
|
|
|
4006
5155
|
|
|
4007
5156
|
var ref = { compile: compile$6, interpret: interpret$6, collectEvaluatedProperties: collectEvaluatedProperties$1, collectEvaluatedItems: collectEvaluatedItems$2 };
|
|
4008
5157
|
|
|
4009
|
-
const { Schema: Schema$b, Instance: Instance$5 } = lib$
|
|
5158
|
+
const { Schema: Schema$b, Instance: Instance$5 } = lib$2;
|
|
4010
5159
|
|
|
4011
5160
|
|
|
4012
5161
|
const compile$5 = (schema) => Schema$b.value(schema);
|
|
@@ -4017,8 +5166,8 @@ const interpret$5 = (required, instance) => {
|
|
|
4017
5166
|
|
|
4018
5167
|
var required = { compile: compile$5, interpret: interpret$5 };
|
|
4019
5168
|
|
|
4020
|
-
const { Core: Core$8, Schema: Schema$a, Instance: Instance$4 } = lib$
|
|
4021
|
-
const Pact = lib$
|
|
5169
|
+
const { Core: Core$8, Schema: Schema$a, Instance: Instance$4 } = lib$2;
|
|
5170
|
+
const Pact = lib$1;
|
|
4022
5171
|
|
|
4023
5172
|
|
|
4024
5173
|
const compile$4 = (schema, ast) => {
|
|
@@ -4042,7 +5191,7 @@ const collectEvaluatedItems$1 = (items, instance, ast, dynamicAnchors) => {
|
|
|
4042
5191
|
|
|
4043
5192
|
var tupleItems = { compile: compile$4, interpret: interpret$4, collectEvaluatedItems: collectEvaluatedItems$1 };
|
|
4044
5193
|
|
|
4045
|
-
const { Schema: Schema$9, Instance: Instance$3 } = lib$
|
|
5194
|
+
const { Schema: Schema$9, Instance: Instance$3 } = lib$2;
|
|
4046
5195
|
|
|
4047
5196
|
|
|
4048
5197
|
const compile$3 = (schema) => Schema$9.value(schema);
|
|
@@ -4050,7 +5199,7 @@ const interpret$3 = (type, instance) => typeof type === "string" ? Instance$3.ty
|
|
|
4050
5199
|
|
|
4051
5200
|
var type = { compile: compile$3, interpret: interpret$3 };
|
|
4052
5201
|
|
|
4053
|
-
const { Core: Core$7, Schema: Schema$8, Instance: Instance$2 } = lib$
|
|
5202
|
+
const { Core: Core$7, Schema: Schema$8, Instance: Instance$2 } = lib$2;
|
|
4054
5203
|
|
|
4055
5204
|
|
|
4056
5205
|
const compile$2 = async (schema, ast, parentSchema) => {
|
|
@@ -4074,7 +5223,7 @@ const collectEvaluatedItems = (keywordValue, instance, ast, dynamicAnchors) => {
|
|
|
4074
5223
|
|
|
4075
5224
|
var unevaluatedItems = { compile: compile$2, interpret: interpret$2, collectEvaluatedItems };
|
|
4076
5225
|
|
|
4077
|
-
const { Core: Core$6, Schema: Schema$7, Instance: Instance$1 } = lib$
|
|
5226
|
+
const { Core: Core$6, Schema: Schema$7, Instance: Instance$1 } = lib$2;
|
|
4078
5227
|
|
|
4079
5228
|
|
|
4080
5229
|
const compile$1 = async (schema, ast, parentSchema) => {
|
|
@@ -4099,7 +5248,7 @@ const collectEvaluatedProperties = (keywordValue, instance, ast, dynamicAnchors)
|
|
|
4099
5248
|
|
|
4100
5249
|
var unevaluatedProperties = { compile: compile$1, interpret: interpret$1, collectEvaluatedProperties };
|
|
4101
5250
|
|
|
4102
|
-
const { Schema: Schema$6, Instance } = lib$
|
|
5251
|
+
const { Schema: Schema$6, Instance } = lib$2;
|
|
4103
5252
|
const jsonStringify = fastestStableStringify;
|
|
4104
5253
|
|
|
4105
5254
|
|
|
@@ -4116,7 +5265,7 @@ const interpret = (uniqueItems, instance) => {
|
|
|
4116
5265
|
|
|
4117
5266
|
var uniqueItems = { compile, interpret };
|
|
4118
5267
|
|
|
4119
|
-
const { Keywords: Keywords$1 } = lib$
|
|
5268
|
+
const { Keywords: Keywords$1 } = lib$2;
|
|
4120
5269
|
|
|
4121
5270
|
|
|
4122
5271
|
var keywords$5 = {
|
|
@@ -4322,7 +5471,7 @@ var schema$4 = `{
|
|
|
4322
5471
|
"default": {}
|
|
4323
5472
|
}`;
|
|
4324
5473
|
|
|
4325
|
-
const { Core: Core$5, Schema: Schema$5 } = lib$
|
|
5474
|
+
const { Core: Core$5, Schema: Schema$5 } = lib$2;
|
|
4326
5475
|
const keywords$4 = keywords$5;
|
|
4327
5476
|
const metaSchema$4 = schema$4;
|
|
4328
5477
|
|
|
@@ -4524,7 +5673,7 @@ var schema$3 = `{
|
|
|
4524
5673
|
"default": {}
|
|
4525
5674
|
}`;
|
|
4526
5675
|
|
|
4527
|
-
const { Core: Core$4, Schema: Schema$4 } = lib$
|
|
5676
|
+
const { Core: Core$4, Schema: Schema$4 } = lib$2;
|
|
4528
5677
|
const keywords$3 = keywords$5;
|
|
4529
5678
|
const metaSchema$3 = schema$3;
|
|
4530
5679
|
|
|
@@ -4749,7 +5898,7 @@ var schema$2 = `{
|
|
|
4749
5898
|
"default": true
|
|
4750
5899
|
}`;
|
|
4751
5900
|
|
|
4752
|
-
const { Core: Core$3, Schema: Schema$3 } = lib$
|
|
5901
|
+
const { Core: Core$3, Schema: Schema$3 } = lib$2;
|
|
4753
5902
|
const keywords$2 = keywords$5;
|
|
4754
5903
|
const metaSchema$2 = schema$2;
|
|
4755
5904
|
|
|
@@ -5132,7 +6281,7 @@ var content$1 = `{
|
|
|
5132
6281
|
}
|
|
5133
6282
|
}`;
|
|
5134
6283
|
|
|
5135
|
-
const { Core: Core$2, Schema: Schema$2 } = lib$
|
|
6284
|
+
const { Core: Core$2, Schema: Schema$2 } = lib$2;
|
|
5136
6285
|
const keywords$1 = keywords$5;
|
|
5137
6286
|
const metaSchema$1 = schema$1;
|
|
5138
6287
|
const coreMetaSchema$1 = core$1;
|
|
@@ -5579,7 +6728,7 @@ var unevaluated = `{
|
|
|
5579
6728
|
}
|
|
5580
6729
|
}`;
|
|
5581
6730
|
|
|
5582
|
-
const { Core: Core$1, Schema: Schema$1 } = lib$
|
|
6731
|
+
const { Core: Core$1, Schema: Schema$1 } = lib$2;
|
|
5583
6732
|
const keywords = keywords$5;
|
|
5584
6733
|
const metaSchema = schema;
|
|
5585
6734
|
const coreMetaSchema = core;
|
|
@@ -5683,7 +6832,7 @@ Core$1.defineVocabulary("https://json-schema.org/draft/2020-12/vocab/unevaluated
|
|
|
5683
6832
|
"unevaluatedProperties": keywords.unevaluatedProperties
|
|
5684
6833
|
});
|
|
5685
6834
|
|
|
5686
|
-
const { Core, Schema, InvalidSchemaError } = lib$
|
|
6835
|
+
const { Core, Schema, InvalidSchemaError } = lib$2;
|
|
5687
6836
|
const Keywords = keywords$5;
|
|
5688
6837
|
|
|
5689
6838
|
|