@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-umd.js
CHANGED
|
@@ -47,7 +47,11 @@
|
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
var
|
|
50
|
+
var pubsubExports = {};
|
|
51
|
+
var pubsub = {
|
|
52
|
+
get exports(){ return pubsubExports; },
|
|
53
|
+
set exports(v){ pubsubExports = v; },
|
|
54
|
+
};
|
|
51
55
|
|
|
52
56
|
/**
|
|
53
57
|
* Copyright (c) 2010,2011,2012,2013,2014 Morgan Roderick http://roderick.dk
|
|
@@ -401,9 +405,13 @@
|
|
|
401
405
|
return result;
|
|
402
406
|
};
|
|
403
407
|
}));
|
|
404
|
-
} (pubsub,
|
|
408
|
+
} (pubsub, pubsubExports));
|
|
405
409
|
|
|
406
|
-
var
|
|
410
|
+
var uri_allExports = {};
|
|
411
|
+
var uri_all = {
|
|
412
|
+
get exports(){ return uri_allExports; },
|
|
413
|
+
set exports(v){ uri_allExports = v; },
|
|
414
|
+
};
|
|
407
415
|
|
|
408
416
|
/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
|
|
409
417
|
|
|
@@ -1809,9 +1817,9 @@
|
|
|
1809
1817
|
|
|
1810
1818
|
})));
|
|
1811
1819
|
|
|
1812
|
-
} (uri_all,
|
|
1820
|
+
} (uri_all, uri_allExports));
|
|
1813
1821
|
|
|
1814
|
-
const URI =
|
|
1822
|
+
const URI = uri_allExports;
|
|
1815
1823
|
|
|
1816
1824
|
|
|
1817
1825
|
const isObject$1 = (value) => typeof value === "object" && !Array.isArray(value) && value !== null;
|
|
@@ -1907,116 +1915,138 @@
|
|
|
1907
1915
|
|
|
1908
1916
|
const nil$2 = "";
|
|
1909
1917
|
|
|
1910
|
-
const
|
|
1918
|
+
const EXISTS = Symbol("EXISTS");
|
|
1919
|
+
|
|
1920
|
+
const segmentGenerator = (pointer) => {
|
|
1911
1921
|
if (pointer.length > 0 && pointer[0] !== "/") {
|
|
1912
1922
|
throw Error("Invalid JSON Pointer");
|
|
1913
1923
|
}
|
|
1914
1924
|
|
|
1915
|
-
|
|
1916
|
-
|
|
1925
|
+
let segmentStart = 1;
|
|
1926
|
+
let segmentEnd = 0;
|
|
1917
1927
|
|
|
1918
|
-
|
|
1919
|
-
|
|
1928
|
+
return (mode) => {
|
|
1929
|
+
if (mode === EXISTS) {
|
|
1930
|
+
return segmentEnd < pointer.length;
|
|
1931
|
+
}
|
|
1932
|
+
|
|
1933
|
+
if (segmentEnd >= pointer.length) {
|
|
1934
|
+
return;
|
|
1935
|
+
}
|
|
1920
1936
|
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1937
|
+
const position = pointer.indexOf("/", segmentStart);
|
|
1938
|
+
segmentEnd = position === -1 ? pointer.length : position;
|
|
1939
|
+
const segment = unescape(pointer.slice(segmentStart, segmentEnd));
|
|
1940
|
+
segmentStart = segmentEnd + 1;
|
|
1941
|
+
|
|
1942
|
+
return segment;
|
|
1943
|
+
};
|
|
1944
|
+
};
|
|
1945
|
+
|
|
1946
|
+
const get$2 = (pointer, subject = undefined) => {
|
|
1947
|
+
const nextSegment = segmentGenerator(pointer);
|
|
1948
|
+
const fn = (subject) => _get(nextSegment, subject, nil$2);
|
|
1949
|
+
return subject === undefined ? fn : fn(subject);
|
|
1950
|
+
};
|
|
1924
1951
|
|
|
1925
|
-
|
|
1952
|
+
const _get = (nextSegment, subject, cursor) => {
|
|
1953
|
+
if (!nextSegment(EXISTS)) {
|
|
1954
|
+
return subject;
|
|
1955
|
+
} else {
|
|
1956
|
+
const segment = nextSegment();
|
|
1957
|
+
return _get(nextSegment, applySegment(subject, segment, cursor), append(segment, cursor));
|
|
1958
|
+
}
|
|
1926
1959
|
};
|
|
1927
1960
|
|
|
1928
1961
|
const set = (pointer, subject = undefined, value = undefined) => {
|
|
1929
|
-
const
|
|
1930
|
-
const fn = curry$a((subject, value) => _set(
|
|
1962
|
+
const nextSegment = segmentGenerator(pointer);
|
|
1963
|
+
const fn = curry$a((subject, value) => _set(nextSegment, subject, value, nil$2));
|
|
1931
1964
|
return subject === undefined ? fn : fn(subject, value);
|
|
1932
1965
|
};
|
|
1933
1966
|
|
|
1934
|
-
const _set = (
|
|
1935
|
-
|
|
1967
|
+
const _set = (nextSegment, subject, value, cursor) => {
|
|
1968
|
+
const segment = nextSegment();
|
|
1969
|
+
if (segment === undefined) {
|
|
1936
1970
|
return value;
|
|
1937
|
-
} else if (
|
|
1971
|
+
} else if (nextSegment(EXISTS)) {
|
|
1938
1972
|
if (Array.isArray(subject)) {
|
|
1939
|
-
const index = pointer.shift();
|
|
1940
1973
|
const clonedSubject = [...subject];
|
|
1941
|
-
clonedSubject[
|
|
1974
|
+
clonedSubject[segment] = _set(nextSegment, applySegment(subject, segment, cursor), value, append(segment, cursor));
|
|
1942
1975
|
return clonedSubject;
|
|
1943
1976
|
} else {
|
|
1944
|
-
|
|
1945
|
-
return { ...subject, [segment]: _set(pointer, applySegment(subject, segment, cursor), value, append(segment, cursor)) };
|
|
1977
|
+
return { ...subject, [segment]: _set(nextSegment, applySegment(subject, segment, cursor), value, append(segment, cursor)) };
|
|
1946
1978
|
}
|
|
1947
1979
|
} else if (Array.isArray(subject)) {
|
|
1948
1980
|
const clonedSubject = [...subject];
|
|
1949
|
-
|
|
1950
|
-
clonedSubject[segment] = value;
|
|
1981
|
+
clonedSubject[computeSegment(subject, segment)] = value;
|
|
1951
1982
|
return clonedSubject;
|
|
1952
1983
|
} else if (typeof subject === "object" && subject !== null) {
|
|
1953
|
-
return { ...subject, [
|
|
1984
|
+
return { ...subject, [segment]: value };
|
|
1954
1985
|
} else {
|
|
1955
|
-
return applySegment(subject,
|
|
1986
|
+
return applySegment(subject, segment, cursor);
|
|
1956
1987
|
}
|
|
1957
1988
|
};
|
|
1958
1989
|
|
|
1959
1990
|
const assign = (pointer, subject = undefined, value = undefined) => {
|
|
1960
|
-
const
|
|
1961
|
-
const fn = curry$a((subject, value) => _assign(
|
|
1991
|
+
const nextSegment = segmentGenerator(pointer);
|
|
1992
|
+
const fn = curry$a((subject, value) => _assign(nextSegment, subject, value, nil$2));
|
|
1962
1993
|
return subject === undefined ? fn : fn(subject, value);
|
|
1963
1994
|
};
|
|
1964
1995
|
|
|
1965
|
-
const _assign = (
|
|
1966
|
-
|
|
1996
|
+
const _assign = (nextSegment, subject, value, cursor) => {
|
|
1997
|
+
const segment = nextSegment();
|
|
1998
|
+
if (segment === undefined) {
|
|
1967
1999
|
return;
|
|
1968
|
-
} else if (
|
|
1969
|
-
|
|
1970
|
-
subject[segment] = value;
|
|
2000
|
+
} else if (!nextSegment(EXISTS) && !isScalar(subject)) {
|
|
2001
|
+
subject[computeSegment(subject, segment)] = value;
|
|
1971
2002
|
} else {
|
|
1972
|
-
|
|
1973
|
-
_assign(pointer, applySegment(subject, segment, cursor), value, append(segment, cursor));
|
|
2003
|
+
_assign(nextSegment, applySegment(subject, segment, cursor), value, append(segment, cursor));
|
|
1974
2004
|
}
|
|
1975
2005
|
};
|
|
1976
2006
|
|
|
1977
2007
|
const unset = (pointer, subject = undefined) => {
|
|
1978
|
-
const
|
|
1979
|
-
const fn = (subject) => _unset(
|
|
2008
|
+
const nextSegment = segmentGenerator(pointer);
|
|
2009
|
+
const fn = (subject) => _unset(nextSegment, subject, nil$2);
|
|
1980
2010
|
return subject === undefined ? fn : fn(subject);
|
|
1981
2011
|
};
|
|
1982
2012
|
|
|
1983
|
-
const _unset = (
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
2013
|
+
const _unset = (nextSegment, subject, cursor) => {
|
|
2014
|
+
const segment = nextSegment();
|
|
2015
|
+
if (segment === undefined) {
|
|
2016
|
+
return;
|
|
2017
|
+
} else if (nextSegment(EXISTS)) {
|
|
1988
2018
|
const value = applySegment(subject, segment, cursor);
|
|
1989
|
-
return { ...subject, [segment]: _unset(
|
|
2019
|
+
return { ...subject, [segment]: _unset(nextSegment, value, append(segment, cursor)) };
|
|
1990
2020
|
} else if (Array.isArray(subject)) {
|
|
1991
|
-
|
|
2021
|
+
const clonedSubject = [...subject];
|
|
2022
|
+
delete clonedSubject[computeSegment(subject, segment)];
|
|
2023
|
+
return clonedSubject;
|
|
1992
2024
|
} else if (typeof subject === "object" && subject !== null) {
|
|
1993
2025
|
// eslint-disable-next-line no-unused-vars
|
|
1994
|
-
const { [
|
|
2026
|
+
const { [segment]: _, ...result } = subject;
|
|
1995
2027
|
return result;
|
|
1996
2028
|
} else {
|
|
1997
|
-
return applySegment(subject,
|
|
2029
|
+
return applySegment(subject, segment, cursor);
|
|
1998
2030
|
}
|
|
1999
2031
|
};
|
|
2000
2032
|
|
|
2001
2033
|
const remove = (pointer, subject = undefined) => {
|
|
2002
|
-
const
|
|
2003
|
-
const fn = (subject) => _remove(
|
|
2034
|
+
const nextSegment = segmentGenerator(pointer);
|
|
2035
|
+
const fn = (subject) => _remove(nextSegment, subject, nil$2);
|
|
2004
2036
|
return subject === undefined ? fn : fn(subject);
|
|
2005
2037
|
};
|
|
2006
2038
|
|
|
2007
|
-
const _remove = (
|
|
2008
|
-
|
|
2039
|
+
const _remove = (nextSegment, subject, cursor) => {
|
|
2040
|
+
const segment = nextSegment();
|
|
2041
|
+
if (segment === undefined) {
|
|
2009
2042
|
return;
|
|
2010
|
-
} else if (
|
|
2011
|
-
const segment = pointer.shift();
|
|
2043
|
+
} else if (nextSegment(EXISTS)) {
|
|
2012
2044
|
const value = applySegment(subject, segment, cursor);
|
|
2013
|
-
_remove(
|
|
2014
|
-
} else if (
|
|
2015
|
-
subject
|
|
2016
|
-
} else if (typeof subject === "object" && subject !== null) {
|
|
2017
|
-
delete subject[pointer[0]];
|
|
2045
|
+
_remove(nextSegment, value, append(segment, cursor));
|
|
2046
|
+
} else if (!isScalar(subject)) {
|
|
2047
|
+
delete subject[segment];
|
|
2018
2048
|
} else {
|
|
2019
|
-
applySegment(subject,
|
|
2049
|
+
applySegment(subject, segment, cursor);
|
|
2020
2050
|
}
|
|
2021
2051
|
};
|
|
2022
2052
|
|
|
@@ -2237,7 +2267,11 @@
|
|
|
2237
2267
|
allValues: allValues
|
|
2238
2268
|
};
|
|
2239
2269
|
|
|
2240
|
-
var
|
|
2270
|
+
var mooExports = {};
|
|
2271
|
+
var moo$1 = {
|
|
2272
|
+
get exports(){ return mooExports; },
|
|
2273
|
+
set exports(v){ mooExports = v; },
|
|
2274
|
+
};
|
|
2241
2275
|
|
|
2242
2276
|
(function (module) {
|
|
2243
2277
|
(function(root, factory) {
|
|
@@ -2292,6 +2326,38 @@
|
|
|
2292
2326
|
}
|
|
2293
2327
|
}
|
|
2294
2328
|
|
|
2329
|
+
function pad(s, length) {
|
|
2330
|
+
if (s.length > length) {
|
|
2331
|
+
return s
|
|
2332
|
+
}
|
|
2333
|
+
return Array(length - s.length + 1).join(" ") + s
|
|
2334
|
+
}
|
|
2335
|
+
|
|
2336
|
+
function lastNLines(string, numLines) {
|
|
2337
|
+
var position = string.length;
|
|
2338
|
+
var lineBreaks = 0;
|
|
2339
|
+
while (true) {
|
|
2340
|
+
var idx = string.lastIndexOf("\n", position - 1);
|
|
2341
|
+
if (idx === -1) {
|
|
2342
|
+
break;
|
|
2343
|
+
} else {
|
|
2344
|
+
lineBreaks++;
|
|
2345
|
+
}
|
|
2346
|
+
position = idx;
|
|
2347
|
+
if (lineBreaks === numLines) {
|
|
2348
|
+
break;
|
|
2349
|
+
}
|
|
2350
|
+
if (position === 0) {
|
|
2351
|
+
break;
|
|
2352
|
+
}
|
|
2353
|
+
}
|
|
2354
|
+
var startPosition =
|
|
2355
|
+
lineBreaks < numLines ?
|
|
2356
|
+
0 :
|
|
2357
|
+
position + 1;
|
|
2358
|
+
return string.substring(startPosition).split("\n")
|
|
2359
|
+
}
|
|
2360
|
+
|
|
2295
2361
|
function objectToRules(object) {
|
|
2296
2362
|
var keys = Object.getOwnPropertyNames(object);
|
|
2297
2363
|
var result = [];
|
|
@@ -2574,39 +2640,31 @@
|
|
|
2574
2640
|
}
|
|
2575
2641
|
|
|
2576
2642
|
function keywordTransform(map) {
|
|
2577
|
-
|
|
2578
|
-
|
|
2643
|
+
|
|
2644
|
+
// Use a JavaScript Map to map keywords to their corresponding token type
|
|
2645
|
+
// unless Map is unsupported, then fall back to using an Object:
|
|
2646
|
+
var isMap = typeof Map !== 'undefined';
|
|
2647
|
+
var reverseMap = isMap ? new Map : Object.create(null);
|
|
2648
|
+
|
|
2579
2649
|
var types = Object.getOwnPropertyNames(map);
|
|
2580
2650
|
for (var i = 0; i < types.length; i++) {
|
|
2581
2651
|
var tokenType = types[i];
|
|
2582
2652
|
var item = map[tokenType];
|
|
2583
2653
|
var keywordList = Array.isArray(item) ? item : [item];
|
|
2584
2654
|
keywordList.forEach(function(keyword) {
|
|
2585
|
-
(byLength[keyword.length] = byLength[keyword.length] || []).push(keyword);
|
|
2586
2655
|
if (typeof keyword !== 'string') {
|
|
2587
2656
|
throw new Error("keyword must be string (in keyword '" + tokenType + "')")
|
|
2588
2657
|
}
|
|
2589
|
-
|
|
2658
|
+
if (isMap) {
|
|
2659
|
+
reverseMap.set(keyword, tokenType);
|
|
2660
|
+
} else {
|
|
2661
|
+
reverseMap[keyword] = tokenType;
|
|
2662
|
+
}
|
|
2590
2663
|
});
|
|
2591
2664
|
}
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
// https://jsperf.com/string-lookups
|
|
2595
|
-
function str(x) { return JSON.stringify(x) }
|
|
2596
|
-
var source = '';
|
|
2597
|
-
source += 'switch (value.length) {\n';
|
|
2598
|
-
for (var length in byLength) {
|
|
2599
|
-
var keywords = byLength[length];
|
|
2600
|
-
source += 'case ' + length + ':\n';
|
|
2601
|
-
source += 'switch (value) {\n';
|
|
2602
|
-
keywords.forEach(function(keyword) {
|
|
2603
|
-
var tokenType = reverseMap[keyword];
|
|
2604
|
-
source += 'case ' + str(keyword) + ': return ' + str(tokenType) + '\n';
|
|
2605
|
-
});
|
|
2606
|
-
source += '}\n';
|
|
2665
|
+
return function(k) {
|
|
2666
|
+
return isMap ? reverseMap.get(k) : reverseMap[k]
|
|
2607
2667
|
}
|
|
2608
|
-
source += '}\n';
|
|
2609
|
-
return Function('value', source) // type
|
|
2610
2668
|
}
|
|
2611
2669
|
|
|
2612
2670
|
/***************************************************************************/
|
|
@@ -2625,6 +2683,7 @@
|
|
|
2625
2683
|
this.line = info ? info.line : 1;
|
|
2626
2684
|
this.col = info ? info.col : 1;
|
|
2627
2685
|
this.queuedToken = info ? info.queuedToken : null;
|
|
2686
|
+
this.queuedText = info ? info.queuedText: "";
|
|
2628
2687
|
this.queuedThrow = info ? info.queuedThrow : null;
|
|
2629
2688
|
this.setState(info ? info.state : this.startState);
|
|
2630
2689
|
this.stack = info && info.stack ? info.stack.slice() : [];
|
|
@@ -2638,6 +2697,7 @@
|
|
|
2638
2697
|
state: this.state,
|
|
2639
2698
|
stack: this.stack.slice(),
|
|
2640
2699
|
queuedToken: this.queuedToken,
|
|
2700
|
+
queuedText: this.queuedText,
|
|
2641
2701
|
queuedThrow: this.queuedThrow,
|
|
2642
2702
|
}
|
|
2643
2703
|
};
|
|
@@ -2769,7 +2829,8 @@
|
|
|
2769
2829
|
|
|
2770
2830
|
// throw, if no rule with {error: true}
|
|
2771
2831
|
if (group.shouldThrow) {
|
|
2772
|
-
|
|
2832
|
+
var err = new Error(this.formatError(token, "invalid syntax"));
|
|
2833
|
+
throw err;
|
|
2773
2834
|
}
|
|
2774
2835
|
|
|
2775
2836
|
if (group.pop) this.popState();
|
|
@@ -2810,13 +2871,28 @@
|
|
|
2810
2871
|
col: this.col,
|
|
2811
2872
|
};
|
|
2812
2873
|
}
|
|
2813
|
-
|
|
2814
|
-
var
|
|
2815
|
-
var
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2874
|
+
|
|
2875
|
+
var numLinesAround = 2;
|
|
2876
|
+
var firstDisplayedLine = Math.max(token.line - numLinesAround, 1);
|
|
2877
|
+
var lastDisplayedLine = token.line + numLinesAround;
|
|
2878
|
+
var lastLineDigits = String(lastDisplayedLine).length;
|
|
2879
|
+
var displayedLines = lastNLines(
|
|
2880
|
+
this.buffer,
|
|
2881
|
+
(this.line - token.line) + numLinesAround + 1
|
|
2882
|
+
)
|
|
2883
|
+
.slice(0, 5);
|
|
2884
|
+
var errorLines = [];
|
|
2885
|
+
errorLines.push(message + " at line " + token.line + " col " + token.col + ":");
|
|
2886
|
+
errorLines.push("");
|
|
2887
|
+
for (var i = 0; i < displayedLines.length; i++) {
|
|
2888
|
+
var line = displayedLines[i];
|
|
2889
|
+
var lineNo = firstDisplayedLine + i;
|
|
2890
|
+
errorLines.push(pad(String(lineNo), lastLineDigits) + " " + line);
|
|
2891
|
+
if (lineNo === token.line) {
|
|
2892
|
+
errorLines.push(pad("", lastLineDigits + token.col + 1) + "^");
|
|
2893
|
+
}
|
|
2894
|
+
}
|
|
2895
|
+
return errorLines.join("\n")
|
|
2820
2896
|
};
|
|
2821
2897
|
|
|
2822
2898
|
Lexer.prototype.clone = function() {
|
|
@@ -2839,7 +2915,7 @@
|
|
|
2839
2915
|
}));
|
|
2840
2916
|
} (moo$1));
|
|
2841
2917
|
|
|
2842
|
-
const moo =
|
|
2918
|
+
const moo = mooExports;
|
|
2843
2919
|
|
|
2844
2920
|
|
|
2845
2921
|
const digit = `[0-9]`;
|
|
@@ -3102,8 +3178,8 @@
|
|
|
3102
3178
|
* obs-text = %x80-FF
|
|
3103
3179
|
* quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
|
|
3104
3180
|
*/
|
|
3105
|
-
var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g;
|
|
3106
|
-
var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/;
|
|
3181
|
+
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
|
|
3182
|
+
var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/; // eslint-disable-line no-control-regex
|
|
3107
3183
|
var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
3108
3184
|
|
|
3109
3185
|
/**
|
|
@@ -3112,7 +3188,7 @@
|
|
|
3112
3188
|
* quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
|
|
3113
3189
|
* obs-text = %x80-FF
|
|
3114
3190
|
*/
|
|
3115
|
-
var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g;
|
|
3191
|
+
var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g; // eslint-disable-line no-control-regex
|
|
3116
3192
|
|
|
3117
3193
|
/**
|
|
3118
3194
|
* RegExp to match chars that must be quoted-pair in RFC 7230 sec 3.2.6
|
|
@@ -3201,7 +3277,7 @@
|
|
|
3201
3277
|
|
|
3202
3278
|
var index = header.indexOf(';');
|
|
3203
3279
|
var type = index !== -1
|
|
3204
|
-
? header.
|
|
3280
|
+
? header.slice(0, index).trim()
|
|
3205
3281
|
: header.trim();
|
|
3206
3282
|
|
|
3207
3283
|
if (!TYPE_REGEXP.test(type)) {
|
|
@@ -3227,11 +3303,14 @@
|
|
|
3227
3303
|
key = match[1].toLowerCase();
|
|
3228
3304
|
value = match[2];
|
|
3229
3305
|
|
|
3230
|
-
if (value
|
|
3231
|
-
// remove quotes
|
|
3232
|
-
value = value
|
|
3233
|
-
|
|
3234
|
-
|
|
3306
|
+
if (value.charCodeAt(0) === 0x22 /* " */) {
|
|
3307
|
+
// remove quotes
|
|
3308
|
+
value = value.slice(1, -1);
|
|
3309
|
+
|
|
3310
|
+
// remove escapes
|
|
3311
|
+
if (value.indexOf('\\') !== -1) {
|
|
3312
|
+
value = value.replace(QESC_REGEXP, '$1');
|
|
3313
|
+
}
|
|
3235
3314
|
}
|
|
3236
3315
|
|
|
3237
3316
|
obj.parameters[key] = value;
|
|
@@ -3680,13 +3759,13 @@
|
|
|
3680
3759
|
toSchema
|
|
3681
3760
|
};
|
|
3682
3761
|
|
|
3683
|
-
|
|
3762
|
+
let InvalidSchemaError$3 = class InvalidSchemaError extends Error {
|
|
3684
3763
|
constructor(output) {
|
|
3685
3764
|
super("Invalid Schema");
|
|
3686
3765
|
this.name = this.constructor.name;
|
|
3687
3766
|
this.output = output;
|
|
3688
3767
|
}
|
|
3689
|
-
}
|
|
3768
|
+
};
|
|
3690
3769
|
|
|
3691
3770
|
var invalidSchemaError = InvalidSchemaError$3;
|
|
3692
3771
|
|
|
@@ -3699,7 +3778,7 @@
|
|
|
3699
3778
|
var metaData$4 = { compile: compile$M, interpret: interpret$M };
|
|
3700
3779
|
|
|
3701
3780
|
const curry = justCurryIt$1;
|
|
3702
|
-
const PubSub$1 =
|
|
3781
|
+
const PubSub$1 = pubsubExports;
|
|
3703
3782
|
const { resolveUrl } = common$1;
|
|
3704
3783
|
const Instance$C = instance;
|
|
3705
3784
|
const Schema$O = schema$5;
|
|
@@ -3788,7 +3867,13 @@
|
|
|
3788
3867
|
};
|
|
3789
3868
|
|
|
3790
3869
|
const _keywords = {};
|
|
3791
|
-
const getKeyword = (id) =>
|
|
3870
|
+
const getKeyword = (id) => {
|
|
3871
|
+
if (!_keywords[id]) {
|
|
3872
|
+
addKeyword(id, metaData$3);
|
|
3873
|
+
}
|
|
3874
|
+
|
|
3875
|
+
return _keywords[id];
|
|
3876
|
+
};
|
|
3792
3877
|
const hasKeyword = (id) => id in _keywords;
|
|
3793
3878
|
const addKeyword = (id, keywordHandler) => {
|
|
3794
3879
|
_keywords[id] = {
|
|
@@ -3905,7 +3990,7 @@
|
|
|
3905
3990
|
};
|
|
3906
3991
|
|
|
3907
3992
|
const Pact$9 = lib$3;
|
|
3908
|
-
const PubSub =
|
|
3993
|
+
const PubSub = pubsubExports;
|
|
3909
3994
|
const Core$x = core$2;
|
|
3910
3995
|
const Instance$B = instance;
|
|
3911
3996
|
const Schema$N = schema$5;
|
|
@@ -4066,7 +4151,16 @@
|
|
|
4066
4151
|
};
|
|
4067
4152
|
|
|
4068
4153
|
const collectEvaluatedItems$d = (keywordValue, instance, ast, dynamicAnchors) => {
|
|
4069
|
-
|
|
4154
|
+
if (!interpret$I(keywordValue, instance, ast, dynamicAnchors)) {
|
|
4155
|
+
return false;
|
|
4156
|
+
}
|
|
4157
|
+
|
|
4158
|
+
const evaluatedIndexes = new Set();
|
|
4159
|
+
for (let ndx = keywordValue[0]; ndx < Instance$y.length(instance); ndx++) {
|
|
4160
|
+
evaluatedIndexes.add(ndx);
|
|
4161
|
+
}
|
|
4162
|
+
|
|
4163
|
+
return evaluatedIndexes;
|
|
4070
4164
|
};
|
|
4071
4165
|
|
|
4072
4166
|
var additionalItems6 = { compile: compile$I, interpret: interpret$I, collectEvaluatedItems: collectEvaluatedItems$d };
|
|
@@ -4865,15 +4959,14 @@
|
|
|
4865
4959
|
const [, fragment] = splitUrl(Schema$d.value(dynamicRef));
|
|
4866
4960
|
const referencedSchema = await Schema$d.get(Schema$d.value(dynamicRef), dynamicRef);
|
|
4867
4961
|
await Core$a.compileSchema(referencedSchema, ast);
|
|
4868
|
-
return [referencedSchema.id, fragment];
|
|
4962
|
+
return [referencedSchema.id, fragment, Schema$d.uri(referencedSchema)];
|
|
4869
4963
|
};
|
|
4870
4964
|
|
|
4871
|
-
const interpret$7 = ([id, fragment], instance, ast, dynamicAnchors) => {
|
|
4965
|
+
const interpret$7 = ([id, fragment, ref], instance, ast, dynamicAnchors) => {
|
|
4872
4966
|
if (fragment in ast.metaData[id].dynamicAnchors) {
|
|
4873
4967
|
return Core$a.interpretSchema(dynamicAnchors[fragment], instance, ast, dynamicAnchors);
|
|
4874
4968
|
} else {
|
|
4875
|
-
|
|
4876
|
-
return Core$a.interpretSchema(`${id}#${encodeURI(pointer)}`, instance, ast, dynamicAnchors);
|
|
4969
|
+
return Core$a.interpretSchema(ref, instance, ast, dynamicAnchors);
|
|
4877
4970
|
}
|
|
4878
4971
|
};
|
|
4879
4972
|
|
|
@@ -6598,7 +6691,7 @@
|
|
|
6598
6691
|
InvalidSchemaError: InvalidSchemaError
|
|
6599
6692
|
};
|
|
6600
6693
|
|
|
6601
|
-
exports
|
|
6694
|
+
exports.default = lib;
|
|
6602
6695
|
|
|
6603
6696
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
6604
6697
|
|