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