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