@hyperjump/json-schema 0.23.3 → 0.23.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/json-schema-amd.js +203 -110
- package/dist/json-schema-amd.js.map +1 -1
- package/dist/json-schema-amd.min.js +3 -3
- package/dist/json-schema-cjs.js +203 -110
- package/dist/json-schema-cjs.js.map +1 -1
- package/dist/json-schema-cjs.min.js +1 -3
- package/dist/json-schema-esm.js +202 -109
- package/dist/json-schema-esm.js.map +1 -1
- package/dist/json-schema-esm.min.js +1 -3
- package/dist/json-schema-iife.js +203 -110
- package/dist/json-schema-iife.js.map +1 -1
- package/dist/json-schema-iife.min.js +3 -3
- package/dist/json-schema-system.js +202 -109
- package/dist/json-schema-system.js.map +1 -1
- package/dist/json-schema-system.min.js +3 -3
- package/dist/json-schema-umd.js +203 -110
- package/dist/json-schema-umd.js.map +1 -1
- package/dist/json-schema-umd.min.js +3 -3
- package/lib/keywords/additionalItems6.js +10 -1
- package/lib/keywords/dynamicRef.js +3 -4
- package/package.json +5 -4
- package/dist/json-schema-amd.min.js.map +0 -1
- package/dist/json-schema-cjs.min.js.map +0 -1
- package/dist/json-schema-esm.min.js.map +0 -1
- package/dist/json-schema-iife.min.js.map +0 -1
- package/dist/json-schema-system.min.js.map +0 -1
- package/dist/json-schema-umd.min.js.map +0 -1
package/dist/json-schema-iife.js
CHANGED
|
@@ -44,7 +44,11 @@ var JsonSchema = (function (exports) {
|
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
var
|
|
47
|
+
var pubsubExports = {};
|
|
48
|
+
var pubsub = {
|
|
49
|
+
get exports(){ return pubsubExports; },
|
|
50
|
+
set exports(v){ pubsubExports = v; },
|
|
51
|
+
};
|
|
48
52
|
|
|
49
53
|
/**
|
|
50
54
|
* Copyright (c) 2010,2011,2012,2013,2014 Morgan Roderick http://roderick.dk
|
|
@@ -398,9 +402,13 @@ var JsonSchema = (function (exports) {
|
|
|
398
402
|
return result;
|
|
399
403
|
};
|
|
400
404
|
}));
|
|
401
|
-
} (pubsub,
|
|
405
|
+
} (pubsub, pubsubExports));
|
|
402
406
|
|
|
403
|
-
var
|
|
407
|
+
var uri_allExports = {};
|
|
408
|
+
var uri_all = {
|
|
409
|
+
get exports(){ return uri_allExports; },
|
|
410
|
+
set exports(v){ uri_allExports = v; },
|
|
411
|
+
};
|
|
404
412
|
|
|
405
413
|
/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
|
|
406
414
|
|
|
@@ -1806,9 +1814,9 @@ var JsonSchema = (function (exports) {
|
|
|
1806
1814
|
|
|
1807
1815
|
})));
|
|
1808
1816
|
|
|
1809
|
-
} (uri_all,
|
|
1817
|
+
} (uri_all, uri_allExports));
|
|
1810
1818
|
|
|
1811
|
-
const URI =
|
|
1819
|
+
const URI = uri_allExports;
|
|
1812
1820
|
|
|
1813
1821
|
|
|
1814
1822
|
const isObject$1 = (value) => typeof value === "object" && !Array.isArray(value) && value !== null;
|
|
@@ -1904,116 +1912,138 @@ var JsonSchema = (function (exports) {
|
|
|
1904
1912
|
|
|
1905
1913
|
const nil$2 = "";
|
|
1906
1914
|
|
|
1907
|
-
const
|
|
1915
|
+
const EXISTS = Symbol("EXISTS");
|
|
1916
|
+
|
|
1917
|
+
const segmentGenerator = (pointer) => {
|
|
1908
1918
|
if (pointer.length > 0 && pointer[0] !== "/") {
|
|
1909
1919
|
throw Error("Invalid JSON Pointer");
|
|
1910
1920
|
}
|
|
1911
1921
|
|
|
1912
|
-
|
|
1913
|
-
|
|
1922
|
+
let segmentStart = 1;
|
|
1923
|
+
let segmentEnd = 0;
|
|
1914
1924
|
|
|
1915
|
-
|
|
1916
|
-
|
|
1925
|
+
return (mode) => {
|
|
1926
|
+
if (mode === EXISTS) {
|
|
1927
|
+
return segmentEnd < pointer.length;
|
|
1928
|
+
}
|
|
1929
|
+
|
|
1930
|
+
if (segmentEnd >= pointer.length) {
|
|
1931
|
+
return;
|
|
1932
|
+
}
|
|
1917
1933
|
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1934
|
+
const position = pointer.indexOf("/", segmentStart);
|
|
1935
|
+
segmentEnd = position === -1 ? pointer.length : position;
|
|
1936
|
+
const segment = unescape(pointer.slice(segmentStart, segmentEnd));
|
|
1937
|
+
segmentStart = segmentEnd + 1;
|
|
1938
|
+
|
|
1939
|
+
return segment;
|
|
1940
|
+
};
|
|
1941
|
+
};
|
|
1942
|
+
|
|
1943
|
+
const get$2 = (pointer, subject = undefined) => {
|
|
1944
|
+
const nextSegment = segmentGenerator(pointer);
|
|
1945
|
+
const fn = (subject) => _get(nextSegment, subject, nil$2);
|
|
1946
|
+
return subject === undefined ? fn : fn(subject);
|
|
1947
|
+
};
|
|
1921
1948
|
|
|
1922
|
-
|
|
1949
|
+
const _get = (nextSegment, subject, cursor) => {
|
|
1950
|
+
if (!nextSegment(EXISTS)) {
|
|
1951
|
+
return subject;
|
|
1952
|
+
} else {
|
|
1953
|
+
const segment = nextSegment();
|
|
1954
|
+
return _get(nextSegment, applySegment(subject, segment, cursor), append(segment, cursor));
|
|
1955
|
+
}
|
|
1923
1956
|
};
|
|
1924
1957
|
|
|
1925
1958
|
const set = (pointer, subject = undefined, value = undefined) => {
|
|
1926
|
-
const
|
|
1927
|
-
const fn = curry$a((subject, value) => _set(
|
|
1959
|
+
const nextSegment = segmentGenerator(pointer);
|
|
1960
|
+
const fn = curry$a((subject, value) => _set(nextSegment, subject, value, nil$2));
|
|
1928
1961
|
return subject === undefined ? fn : fn(subject, value);
|
|
1929
1962
|
};
|
|
1930
1963
|
|
|
1931
|
-
const _set = (
|
|
1932
|
-
|
|
1964
|
+
const _set = (nextSegment, subject, value, cursor) => {
|
|
1965
|
+
const segment = nextSegment();
|
|
1966
|
+
if (segment === undefined) {
|
|
1933
1967
|
return value;
|
|
1934
|
-
} else if (
|
|
1968
|
+
} else if (nextSegment(EXISTS)) {
|
|
1935
1969
|
if (Array.isArray(subject)) {
|
|
1936
|
-
const index = pointer.shift();
|
|
1937
1970
|
const clonedSubject = [...subject];
|
|
1938
|
-
clonedSubject[
|
|
1971
|
+
clonedSubject[segment] = _set(nextSegment, applySegment(subject, segment, cursor), value, append(segment, cursor));
|
|
1939
1972
|
return clonedSubject;
|
|
1940
1973
|
} else {
|
|
1941
|
-
|
|
1942
|
-
return { ...subject, [segment]: _set(pointer, applySegment(subject, segment, cursor), value, append(segment, cursor)) };
|
|
1974
|
+
return { ...subject, [segment]: _set(nextSegment, applySegment(subject, segment, cursor), value, append(segment, cursor)) };
|
|
1943
1975
|
}
|
|
1944
1976
|
} else if (Array.isArray(subject)) {
|
|
1945
1977
|
const clonedSubject = [...subject];
|
|
1946
|
-
|
|
1947
|
-
clonedSubject[segment] = value;
|
|
1978
|
+
clonedSubject[computeSegment(subject, segment)] = value;
|
|
1948
1979
|
return clonedSubject;
|
|
1949
1980
|
} else if (typeof subject === "object" && subject !== null) {
|
|
1950
|
-
return { ...subject, [
|
|
1981
|
+
return { ...subject, [segment]: value };
|
|
1951
1982
|
} else {
|
|
1952
|
-
return applySegment(subject,
|
|
1983
|
+
return applySegment(subject, segment, cursor);
|
|
1953
1984
|
}
|
|
1954
1985
|
};
|
|
1955
1986
|
|
|
1956
1987
|
const assign = (pointer, subject = undefined, value = undefined) => {
|
|
1957
|
-
const
|
|
1958
|
-
const fn = curry$a((subject, value) => _assign(
|
|
1988
|
+
const nextSegment = segmentGenerator(pointer);
|
|
1989
|
+
const fn = curry$a((subject, value) => _assign(nextSegment, subject, value, nil$2));
|
|
1959
1990
|
return subject === undefined ? fn : fn(subject, value);
|
|
1960
1991
|
};
|
|
1961
1992
|
|
|
1962
|
-
const _assign = (
|
|
1963
|
-
|
|
1993
|
+
const _assign = (nextSegment, subject, value, cursor) => {
|
|
1994
|
+
const segment = nextSegment();
|
|
1995
|
+
if (segment === undefined) {
|
|
1964
1996
|
return;
|
|
1965
|
-
} else if (
|
|
1966
|
-
|
|
1967
|
-
subject[segment] = value;
|
|
1997
|
+
} else if (!nextSegment(EXISTS) && !isScalar(subject)) {
|
|
1998
|
+
subject[computeSegment(subject, segment)] = value;
|
|
1968
1999
|
} else {
|
|
1969
|
-
|
|
1970
|
-
_assign(pointer, applySegment(subject, segment, cursor), value, append(segment, cursor));
|
|
2000
|
+
_assign(nextSegment, applySegment(subject, segment, cursor), value, append(segment, cursor));
|
|
1971
2001
|
}
|
|
1972
2002
|
};
|
|
1973
2003
|
|
|
1974
2004
|
const unset = (pointer, subject = undefined) => {
|
|
1975
|
-
const
|
|
1976
|
-
const fn = (subject) => _unset(
|
|
2005
|
+
const nextSegment = segmentGenerator(pointer);
|
|
2006
|
+
const fn = (subject) => _unset(nextSegment, subject, nil$2);
|
|
1977
2007
|
return subject === undefined ? fn : fn(subject);
|
|
1978
2008
|
};
|
|
1979
2009
|
|
|
1980
|
-
const _unset = (
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
2010
|
+
const _unset = (nextSegment, subject, cursor) => {
|
|
2011
|
+
const segment = nextSegment();
|
|
2012
|
+
if (segment === undefined) {
|
|
2013
|
+
return;
|
|
2014
|
+
} else if (nextSegment(EXISTS)) {
|
|
1985
2015
|
const value = applySegment(subject, segment, cursor);
|
|
1986
|
-
return { ...subject, [segment]: _unset(
|
|
2016
|
+
return { ...subject, [segment]: _unset(nextSegment, value, append(segment, cursor)) };
|
|
1987
2017
|
} else if (Array.isArray(subject)) {
|
|
1988
|
-
|
|
2018
|
+
const clonedSubject = [...subject];
|
|
2019
|
+
delete clonedSubject[computeSegment(subject, segment)];
|
|
2020
|
+
return clonedSubject;
|
|
1989
2021
|
} else if (typeof subject === "object" && subject !== null) {
|
|
1990
2022
|
// eslint-disable-next-line no-unused-vars
|
|
1991
|
-
const { [
|
|
2023
|
+
const { [segment]: _, ...result } = subject;
|
|
1992
2024
|
return result;
|
|
1993
2025
|
} else {
|
|
1994
|
-
return applySegment(subject,
|
|
2026
|
+
return applySegment(subject, segment, cursor);
|
|
1995
2027
|
}
|
|
1996
2028
|
};
|
|
1997
2029
|
|
|
1998
2030
|
const remove = (pointer, subject = undefined) => {
|
|
1999
|
-
const
|
|
2000
|
-
const fn = (subject) => _remove(
|
|
2031
|
+
const nextSegment = segmentGenerator(pointer);
|
|
2032
|
+
const fn = (subject) => _remove(nextSegment, subject, nil$2);
|
|
2001
2033
|
return subject === undefined ? fn : fn(subject);
|
|
2002
2034
|
};
|
|
2003
2035
|
|
|
2004
|
-
const _remove = (
|
|
2005
|
-
|
|
2036
|
+
const _remove = (nextSegment, subject, cursor) => {
|
|
2037
|
+
const segment = nextSegment();
|
|
2038
|
+
if (segment === undefined) {
|
|
2006
2039
|
return;
|
|
2007
|
-
} else if (
|
|
2008
|
-
const segment = pointer.shift();
|
|
2040
|
+
} else if (nextSegment(EXISTS)) {
|
|
2009
2041
|
const value = applySegment(subject, segment, cursor);
|
|
2010
|
-
_remove(
|
|
2011
|
-
} else if (
|
|
2012
|
-
subject
|
|
2013
|
-
} else if (typeof subject === "object" && subject !== null) {
|
|
2014
|
-
delete subject[pointer[0]];
|
|
2042
|
+
_remove(nextSegment, value, append(segment, cursor));
|
|
2043
|
+
} else if (!isScalar(subject)) {
|
|
2044
|
+
delete subject[segment];
|
|
2015
2045
|
} else {
|
|
2016
|
-
applySegment(subject,
|
|
2046
|
+
applySegment(subject, segment, cursor);
|
|
2017
2047
|
}
|
|
2018
2048
|
};
|
|
2019
2049
|
|
|
@@ -2234,7 +2264,11 @@ var JsonSchema = (function (exports) {
|
|
|
2234
2264
|
allValues: allValues
|
|
2235
2265
|
};
|
|
2236
2266
|
|
|
2237
|
-
var
|
|
2267
|
+
var mooExports = {};
|
|
2268
|
+
var moo$1 = {
|
|
2269
|
+
get exports(){ return mooExports; },
|
|
2270
|
+
set exports(v){ mooExports = v; },
|
|
2271
|
+
};
|
|
2238
2272
|
|
|
2239
2273
|
(function (module) {
|
|
2240
2274
|
(function(root, factory) {
|
|
@@ -2289,6 +2323,38 @@ var JsonSchema = (function (exports) {
|
|
|
2289
2323
|
}
|
|
2290
2324
|
}
|
|
2291
2325
|
|
|
2326
|
+
function pad(s, length) {
|
|
2327
|
+
if (s.length > length) {
|
|
2328
|
+
return s
|
|
2329
|
+
}
|
|
2330
|
+
return Array(length - s.length + 1).join(" ") + s
|
|
2331
|
+
}
|
|
2332
|
+
|
|
2333
|
+
function lastNLines(string, numLines) {
|
|
2334
|
+
var position = string.length;
|
|
2335
|
+
var lineBreaks = 0;
|
|
2336
|
+
while (true) {
|
|
2337
|
+
var idx = string.lastIndexOf("\n", position - 1);
|
|
2338
|
+
if (idx === -1) {
|
|
2339
|
+
break;
|
|
2340
|
+
} else {
|
|
2341
|
+
lineBreaks++;
|
|
2342
|
+
}
|
|
2343
|
+
position = idx;
|
|
2344
|
+
if (lineBreaks === numLines) {
|
|
2345
|
+
break;
|
|
2346
|
+
}
|
|
2347
|
+
if (position === 0) {
|
|
2348
|
+
break;
|
|
2349
|
+
}
|
|
2350
|
+
}
|
|
2351
|
+
var startPosition =
|
|
2352
|
+
lineBreaks < numLines ?
|
|
2353
|
+
0 :
|
|
2354
|
+
position + 1;
|
|
2355
|
+
return string.substring(startPosition).split("\n")
|
|
2356
|
+
}
|
|
2357
|
+
|
|
2292
2358
|
function objectToRules(object) {
|
|
2293
2359
|
var keys = Object.getOwnPropertyNames(object);
|
|
2294
2360
|
var result = [];
|
|
@@ -2571,39 +2637,31 @@ var JsonSchema = (function (exports) {
|
|
|
2571
2637
|
}
|
|
2572
2638
|
|
|
2573
2639
|
function keywordTransform(map) {
|
|
2574
|
-
|
|
2575
|
-
|
|
2640
|
+
|
|
2641
|
+
// Use a JavaScript Map to map keywords to their corresponding token type
|
|
2642
|
+
// unless Map is unsupported, then fall back to using an Object:
|
|
2643
|
+
var isMap = typeof Map !== 'undefined';
|
|
2644
|
+
var reverseMap = isMap ? new Map : Object.create(null);
|
|
2645
|
+
|
|
2576
2646
|
var types = Object.getOwnPropertyNames(map);
|
|
2577
2647
|
for (var i = 0; i < types.length; i++) {
|
|
2578
2648
|
var tokenType = types[i];
|
|
2579
2649
|
var item = map[tokenType];
|
|
2580
2650
|
var keywordList = Array.isArray(item) ? item : [item];
|
|
2581
2651
|
keywordList.forEach(function(keyword) {
|
|
2582
|
-
(byLength[keyword.length] = byLength[keyword.length] || []).push(keyword);
|
|
2583
2652
|
if (typeof keyword !== 'string') {
|
|
2584
2653
|
throw new Error("keyword must be string (in keyword '" + tokenType + "')")
|
|
2585
2654
|
}
|
|
2586
|
-
|
|
2655
|
+
if (isMap) {
|
|
2656
|
+
reverseMap.set(keyword, tokenType);
|
|
2657
|
+
} else {
|
|
2658
|
+
reverseMap[keyword] = tokenType;
|
|
2659
|
+
}
|
|
2587
2660
|
});
|
|
2588
2661
|
}
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
// https://jsperf.com/string-lookups
|
|
2592
|
-
function str(x) { return JSON.stringify(x) }
|
|
2593
|
-
var source = '';
|
|
2594
|
-
source += 'switch (value.length) {\n';
|
|
2595
|
-
for (var length in byLength) {
|
|
2596
|
-
var keywords = byLength[length];
|
|
2597
|
-
source += 'case ' + length + ':\n';
|
|
2598
|
-
source += 'switch (value) {\n';
|
|
2599
|
-
keywords.forEach(function(keyword) {
|
|
2600
|
-
var tokenType = reverseMap[keyword];
|
|
2601
|
-
source += 'case ' + str(keyword) + ': return ' + str(tokenType) + '\n';
|
|
2602
|
-
});
|
|
2603
|
-
source += '}\n';
|
|
2662
|
+
return function(k) {
|
|
2663
|
+
return isMap ? reverseMap.get(k) : reverseMap[k]
|
|
2604
2664
|
}
|
|
2605
|
-
source += '}\n';
|
|
2606
|
-
return Function('value', source) // type
|
|
2607
2665
|
}
|
|
2608
2666
|
|
|
2609
2667
|
/***************************************************************************/
|
|
@@ -2622,6 +2680,7 @@ var JsonSchema = (function (exports) {
|
|
|
2622
2680
|
this.line = info ? info.line : 1;
|
|
2623
2681
|
this.col = info ? info.col : 1;
|
|
2624
2682
|
this.queuedToken = info ? info.queuedToken : null;
|
|
2683
|
+
this.queuedText = info ? info.queuedText: "";
|
|
2625
2684
|
this.queuedThrow = info ? info.queuedThrow : null;
|
|
2626
2685
|
this.setState(info ? info.state : this.startState);
|
|
2627
2686
|
this.stack = info && info.stack ? info.stack.slice() : [];
|
|
@@ -2635,6 +2694,7 @@ var JsonSchema = (function (exports) {
|
|
|
2635
2694
|
state: this.state,
|
|
2636
2695
|
stack: this.stack.slice(),
|
|
2637
2696
|
queuedToken: this.queuedToken,
|
|
2697
|
+
queuedText: this.queuedText,
|
|
2638
2698
|
queuedThrow: this.queuedThrow,
|
|
2639
2699
|
}
|
|
2640
2700
|
};
|
|
@@ -2766,7 +2826,8 @@ var JsonSchema = (function (exports) {
|
|
|
2766
2826
|
|
|
2767
2827
|
// throw, if no rule with {error: true}
|
|
2768
2828
|
if (group.shouldThrow) {
|
|
2769
|
-
|
|
2829
|
+
var err = new Error(this.formatError(token, "invalid syntax"));
|
|
2830
|
+
throw err;
|
|
2770
2831
|
}
|
|
2771
2832
|
|
|
2772
2833
|
if (group.pop) this.popState();
|
|
@@ -2807,13 +2868,28 @@ var JsonSchema = (function (exports) {
|
|
|
2807
2868
|
col: this.col,
|
|
2808
2869
|
};
|
|
2809
2870
|
}
|
|
2810
|
-
|
|
2811
|
-
var
|
|
2812
|
-
var
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2871
|
+
|
|
2872
|
+
var numLinesAround = 2;
|
|
2873
|
+
var firstDisplayedLine = Math.max(token.line - numLinesAround, 1);
|
|
2874
|
+
var lastDisplayedLine = token.line + numLinesAround;
|
|
2875
|
+
var lastLineDigits = String(lastDisplayedLine).length;
|
|
2876
|
+
var displayedLines = lastNLines(
|
|
2877
|
+
this.buffer,
|
|
2878
|
+
(this.line - token.line) + numLinesAround + 1
|
|
2879
|
+
)
|
|
2880
|
+
.slice(0, 5);
|
|
2881
|
+
var errorLines = [];
|
|
2882
|
+
errorLines.push(message + " at line " + token.line + " col " + token.col + ":");
|
|
2883
|
+
errorLines.push("");
|
|
2884
|
+
for (var i = 0; i < displayedLines.length; i++) {
|
|
2885
|
+
var line = displayedLines[i];
|
|
2886
|
+
var lineNo = firstDisplayedLine + i;
|
|
2887
|
+
errorLines.push(pad(String(lineNo), lastLineDigits) + " " + line);
|
|
2888
|
+
if (lineNo === token.line) {
|
|
2889
|
+
errorLines.push(pad("", lastLineDigits + token.col + 1) + "^");
|
|
2890
|
+
}
|
|
2891
|
+
}
|
|
2892
|
+
return errorLines.join("\n")
|
|
2817
2893
|
};
|
|
2818
2894
|
|
|
2819
2895
|
Lexer.prototype.clone = function() {
|
|
@@ -2836,7 +2912,7 @@ var JsonSchema = (function (exports) {
|
|
|
2836
2912
|
}));
|
|
2837
2913
|
} (moo$1));
|
|
2838
2914
|
|
|
2839
|
-
const moo =
|
|
2915
|
+
const moo = mooExports;
|
|
2840
2916
|
|
|
2841
2917
|
|
|
2842
2918
|
const digit = `[0-9]`;
|
|
@@ -3099,8 +3175,8 @@ var JsonSchema = (function (exports) {
|
|
|
3099
3175
|
* obs-text = %x80-FF
|
|
3100
3176
|
* quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
|
|
3101
3177
|
*/
|
|
3102
|
-
var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g;
|
|
3103
|
-
var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/;
|
|
3178
|
+
var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g; // eslint-disable-line no-control-regex
|
|
3179
|
+
var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/; // eslint-disable-line no-control-regex
|
|
3104
3180
|
var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
3105
3181
|
|
|
3106
3182
|
/**
|
|
@@ -3109,7 +3185,7 @@ var JsonSchema = (function (exports) {
|
|
|
3109
3185
|
* quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
|
|
3110
3186
|
* obs-text = %x80-FF
|
|
3111
3187
|
*/
|
|
3112
|
-
var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g;
|
|
3188
|
+
var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g; // eslint-disable-line no-control-regex
|
|
3113
3189
|
|
|
3114
3190
|
/**
|
|
3115
3191
|
* RegExp to match chars that must be quoted-pair in RFC 7230 sec 3.2.6
|
|
@@ -3198,7 +3274,7 @@ var JsonSchema = (function (exports) {
|
|
|
3198
3274
|
|
|
3199
3275
|
var index = header.indexOf(';');
|
|
3200
3276
|
var type = index !== -1
|
|
3201
|
-
? header.
|
|
3277
|
+
? header.slice(0, index).trim()
|
|
3202
3278
|
: header.trim();
|
|
3203
3279
|
|
|
3204
3280
|
if (!TYPE_REGEXP.test(type)) {
|
|
@@ -3224,11 +3300,14 @@ var JsonSchema = (function (exports) {
|
|
|
3224
3300
|
key = match[1].toLowerCase();
|
|
3225
3301
|
value = match[2];
|
|
3226
3302
|
|
|
3227
|
-
if (value
|
|
3228
|
-
// remove quotes
|
|
3229
|
-
value = value
|
|
3230
|
-
|
|
3231
|
-
|
|
3303
|
+
if (value.charCodeAt(0) === 0x22 /* " */) {
|
|
3304
|
+
// remove quotes
|
|
3305
|
+
value = value.slice(1, -1);
|
|
3306
|
+
|
|
3307
|
+
// remove escapes
|
|
3308
|
+
if (value.indexOf('\\') !== -1) {
|
|
3309
|
+
value = value.replace(QESC_REGEXP, '$1');
|
|
3310
|
+
}
|
|
3232
3311
|
}
|
|
3233
3312
|
|
|
3234
3313
|
obj.parameters[key] = value;
|
|
@@ -3677,13 +3756,13 @@ var JsonSchema = (function (exports) {
|
|
|
3677
3756
|
toSchema
|
|
3678
3757
|
};
|
|
3679
3758
|
|
|
3680
|
-
|
|
3759
|
+
let InvalidSchemaError$3 = class InvalidSchemaError extends Error {
|
|
3681
3760
|
constructor(output) {
|
|
3682
3761
|
super("Invalid Schema");
|
|
3683
3762
|
this.name = this.constructor.name;
|
|
3684
3763
|
this.output = output;
|
|
3685
3764
|
}
|
|
3686
|
-
}
|
|
3765
|
+
};
|
|
3687
3766
|
|
|
3688
3767
|
var invalidSchemaError = InvalidSchemaError$3;
|
|
3689
3768
|
|
|
@@ -3696,7 +3775,7 @@ var JsonSchema = (function (exports) {
|
|
|
3696
3775
|
var metaData$4 = { compile: compile$M, interpret: interpret$M };
|
|
3697
3776
|
|
|
3698
3777
|
const curry = justCurryIt$1;
|
|
3699
|
-
const PubSub$1 =
|
|
3778
|
+
const PubSub$1 = pubsubExports;
|
|
3700
3779
|
const { resolveUrl } = common$1;
|
|
3701
3780
|
const Instance$C = instance;
|
|
3702
3781
|
const Schema$O = schema$5;
|
|
@@ -3785,7 +3864,13 @@ var JsonSchema = (function (exports) {
|
|
|
3785
3864
|
};
|
|
3786
3865
|
|
|
3787
3866
|
const _keywords = {};
|
|
3788
|
-
const getKeyword = (id) =>
|
|
3867
|
+
const getKeyword = (id) => {
|
|
3868
|
+
if (!_keywords[id]) {
|
|
3869
|
+
addKeyword(id, metaData$3);
|
|
3870
|
+
}
|
|
3871
|
+
|
|
3872
|
+
return _keywords[id];
|
|
3873
|
+
};
|
|
3789
3874
|
const hasKeyword = (id) => id in _keywords;
|
|
3790
3875
|
const addKeyword = (id, keywordHandler) => {
|
|
3791
3876
|
_keywords[id] = {
|
|
@@ -3902,7 +3987,7 @@ var JsonSchema = (function (exports) {
|
|
|
3902
3987
|
};
|
|
3903
3988
|
|
|
3904
3989
|
const Pact$9 = lib$3;
|
|
3905
|
-
const PubSub =
|
|
3990
|
+
const PubSub = pubsubExports;
|
|
3906
3991
|
const Core$x = core$2;
|
|
3907
3992
|
const Instance$B = instance;
|
|
3908
3993
|
const Schema$N = schema$5;
|
|
@@ -4063,7 +4148,16 @@ var JsonSchema = (function (exports) {
|
|
|
4063
4148
|
};
|
|
4064
4149
|
|
|
4065
4150
|
const collectEvaluatedItems$d = (keywordValue, instance, ast, dynamicAnchors) => {
|
|
4066
|
-
|
|
4151
|
+
if (!interpret$I(keywordValue, instance, ast, dynamicAnchors)) {
|
|
4152
|
+
return false;
|
|
4153
|
+
}
|
|
4154
|
+
|
|
4155
|
+
const evaluatedIndexes = new Set();
|
|
4156
|
+
for (let ndx = keywordValue[0]; ndx < Instance$y.length(instance); ndx++) {
|
|
4157
|
+
evaluatedIndexes.add(ndx);
|
|
4158
|
+
}
|
|
4159
|
+
|
|
4160
|
+
return evaluatedIndexes;
|
|
4067
4161
|
};
|
|
4068
4162
|
|
|
4069
4163
|
var additionalItems6 = { compile: compile$I, interpret: interpret$I, collectEvaluatedItems: collectEvaluatedItems$d };
|
|
@@ -4862,15 +4956,14 @@ var JsonSchema = (function (exports) {
|
|
|
4862
4956
|
const [, fragment] = splitUrl(Schema$d.value(dynamicRef));
|
|
4863
4957
|
const referencedSchema = await Schema$d.get(Schema$d.value(dynamicRef), dynamicRef);
|
|
4864
4958
|
await Core$a.compileSchema(referencedSchema, ast);
|
|
4865
|
-
return [referencedSchema.id, fragment];
|
|
4959
|
+
return [referencedSchema.id, fragment, Schema$d.uri(referencedSchema)];
|
|
4866
4960
|
};
|
|
4867
4961
|
|
|
4868
|
-
const interpret$7 = ([id, fragment], instance, ast, dynamicAnchors) => {
|
|
4962
|
+
const interpret$7 = ([id, fragment, ref], instance, ast, dynamicAnchors) => {
|
|
4869
4963
|
if (fragment in ast.metaData[id].dynamicAnchors) {
|
|
4870
4964
|
return Core$a.interpretSchema(dynamicAnchors[fragment], instance, ast, dynamicAnchors);
|
|
4871
4965
|
} else {
|
|
4872
|
-
|
|
4873
|
-
return Core$a.interpretSchema(`${id}#${encodeURI(pointer)}`, instance, ast, dynamicAnchors);
|
|
4966
|
+
return Core$a.interpretSchema(ref, instance, ast, dynamicAnchors);
|
|
4874
4967
|
}
|
|
4875
4968
|
};
|
|
4876
4969
|
|
|
@@ -6595,7 +6688,7 @@ var JsonSchema = (function (exports) {
|
|
|
6595
6688
|
InvalidSchemaError: InvalidSchemaError
|
|
6596
6689
|
};
|
|
6597
6690
|
|
|
6598
|
-
exports
|
|
6691
|
+
exports.default = lib;
|
|
6599
6692
|
|
|
6600
6693
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
6601
6694
|
|