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