@hyperjump/json-schema 0.23.4 → 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 +132 -81
- package/dist/json-schema-amd.js.map +1 -1
- package/dist/json-schema-amd.min.js +3 -2
- package/dist/json-schema-cjs.js +132 -81
- package/dist/json-schema-cjs.js.map +1 -1
- package/dist/json-schema-cjs.min.js +1 -2
- package/dist/json-schema-esm.js +131 -80
- package/dist/json-schema-esm.js.map +1 -1
- package/dist/json-schema-esm.min.js +1 -2
- package/dist/json-schema-iife.js +132 -81
- package/dist/json-schema-iife.js.map +1 -1
- package/dist/json-schema-iife.min.js +3 -2
- package/dist/json-schema-system.js +131 -80
- package/dist/json-schema-system.js.map +1 -1
- package/dist/json-schema-system.min.js +3 -2
- package/dist/json-schema-umd.js +132 -81
- package/dist/json-schema-umd.js.map +1 -1
- package/dist/json-schema-umd.min.js +3 -2
- package/lib/keywords/additionalItems6.js +10 -1
- package/lib/keywords/dynamicRef.js +3 -4
- package/package.json +3 -2
- 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-esm.js
CHANGED
|
@@ -41,7 +41,11 @@ function curry$b(fn, arity) {
|
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
var
|
|
44
|
+
var pubsubExports = {};
|
|
45
|
+
var pubsub = {
|
|
46
|
+
get exports(){ return pubsubExports; },
|
|
47
|
+
set exports(v){ pubsubExports = v; },
|
|
48
|
+
};
|
|
45
49
|
|
|
46
50
|
/**
|
|
47
51
|
* Copyright (c) 2010,2011,2012,2013,2014 Morgan Roderick http://roderick.dk
|
|
@@ -395,9 +399,13 @@ var pubsub = {exports: {}};
|
|
|
395
399
|
return result;
|
|
396
400
|
};
|
|
397
401
|
}));
|
|
398
|
-
} (pubsub,
|
|
402
|
+
} (pubsub, pubsubExports));
|
|
399
403
|
|
|
400
|
-
var
|
|
404
|
+
var uri_allExports = {};
|
|
405
|
+
var uri_all = {
|
|
406
|
+
get exports(){ return uri_allExports; },
|
|
407
|
+
set exports(v){ uri_allExports = v; },
|
|
408
|
+
};
|
|
401
409
|
|
|
402
410
|
/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
|
|
403
411
|
|
|
@@ -1803,9 +1811,9 @@ var uri_all = {exports: {}};
|
|
|
1803
1811
|
|
|
1804
1812
|
})));
|
|
1805
1813
|
|
|
1806
|
-
} (uri_all,
|
|
1814
|
+
} (uri_all, uri_allExports));
|
|
1807
1815
|
|
|
1808
|
-
const URI =
|
|
1816
|
+
const URI = uri_allExports;
|
|
1809
1817
|
|
|
1810
1818
|
|
|
1811
1819
|
const isObject$1 = (value) => typeof value === "object" && !Array.isArray(value) && value !== null;
|
|
@@ -1901,116 +1909,138 @@ const curry$a = justCurryIt$1;
|
|
|
1901
1909
|
|
|
1902
1910
|
const nil$2 = "";
|
|
1903
1911
|
|
|
1904
|
-
const
|
|
1912
|
+
const EXISTS = Symbol("EXISTS");
|
|
1913
|
+
|
|
1914
|
+
const segmentGenerator = (pointer) => {
|
|
1905
1915
|
if (pointer.length > 0 && pointer[0] !== "/") {
|
|
1906
1916
|
throw Error("Invalid JSON Pointer");
|
|
1907
1917
|
}
|
|
1908
1918
|
|
|
1909
|
-
|
|
1910
|
-
|
|
1919
|
+
let segmentStart = 1;
|
|
1920
|
+
let segmentEnd = 0;
|
|
1911
1921
|
|
|
1912
|
-
|
|
1913
|
-
|
|
1922
|
+
return (mode) => {
|
|
1923
|
+
if (mode === EXISTS) {
|
|
1924
|
+
return segmentEnd < pointer.length;
|
|
1925
|
+
}
|
|
1914
1926
|
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1927
|
+
if (segmentEnd >= pointer.length) {
|
|
1928
|
+
return;
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
const position = pointer.indexOf("/", segmentStart);
|
|
1932
|
+
segmentEnd = position === -1 ? pointer.length : position;
|
|
1933
|
+
const segment = unescape(pointer.slice(segmentStart, segmentEnd));
|
|
1934
|
+
segmentStart = segmentEnd + 1;
|
|
1918
1935
|
|
|
1919
|
-
|
|
1936
|
+
return segment;
|
|
1937
|
+
};
|
|
1938
|
+
};
|
|
1939
|
+
|
|
1940
|
+
const get$2 = (pointer, subject = undefined) => {
|
|
1941
|
+
const nextSegment = segmentGenerator(pointer);
|
|
1942
|
+
const fn = (subject) => _get(nextSegment, subject, nil$2);
|
|
1943
|
+
return subject === undefined ? fn : fn(subject);
|
|
1944
|
+
};
|
|
1945
|
+
|
|
1946
|
+
const _get = (nextSegment, subject, cursor) => {
|
|
1947
|
+
if (!nextSegment(EXISTS)) {
|
|
1948
|
+
return subject;
|
|
1949
|
+
} else {
|
|
1950
|
+
const segment = nextSegment();
|
|
1951
|
+
return _get(nextSegment, applySegment(subject, segment, cursor), append(segment, cursor));
|
|
1952
|
+
}
|
|
1920
1953
|
};
|
|
1921
1954
|
|
|
1922
1955
|
const set = (pointer, subject = undefined, value = undefined) => {
|
|
1923
|
-
const
|
|
1924
|
-
const fn = curry$a((subject, value) => _set(
|
|
1956
|
+
const nextSegment = segmentGenerator(pointer);
|
|
1957
|
+
const fn = curry$a((subject, value) => _set(nextSegment, subject, value, nil$2));
|
|
1925
1958
|
return subject === undefined ? fn : fn(subject, value);
|
|
1926
1959
|
};
|
|
1927
1960
|
|
|
1928
|
-
const _set = (
|
|
1929
|
-
|
|
1961
|
+
const _set = (nextSegment, subject, value, cursor) => {
|
|
1962
|
+
const segment = nextSegment();
|
|
1963
|
+
if (segment === undefined) {
|
|
1930
1964
|
return value;
|
|
1931
|
-
} else if (
|
|
1965
|
+
} else if (nextSegment(EXISTS)) {
|
|
1932
1966
|
if (Array.isArray(subject)) {
|
|
1933
|
-
const index = pointer.shift();
|
|
1934
1967
|
const clonedSubject = [...subject];
|
|
1935
|
-
clonedSubject[
|
|
1968
|
+
clonedSubject[segment] = _set(nextSegment, applySegment(subject, segment, cursor), value, append(segment, cursor));
|
|
1936
1969
|
return clonedSubject;
|
|
1937
1970
|
} else {
|
|
1938
|
-
|
|
1939
|
-
return { ...subject, [segment]: _set(pointer, applySegment(subject, segment, cursor), value, append(segment, cursor)) };
|
|
1971
|
+
return { ...subject, [segment]: _set(nextSegment, applySegment(subject, segment, cursor), value, append(segment, cursor)) };
|
|
1940
1972
|
}
|
|
1941
1973
|
} else if (Array.isArray(subject)) {
|
|
1942
1974
|
const clonedSubject = [...subject];
|
|
1943
|
-
|
|
1944
|
-
clonedSubject[segment] = value;
|
|
1975
|
+
clonedSubject[computeSegment(subject, segment)] = value;
|
|
1945
1976
|
return clonedSubject;
|
|
1946
1977
|
} else if (typeof subject === "object" && subject !== null) {
|
|
1947
|
-
return { ...subject, [
|
|
1978
|
+
return { ...subject, [segment]: value };
|
|
1948
1979
|
} else {
|
|
1949
|
-
return applySegment(subject,
|
|
1980
|
+
return applySegment(subject, segment, cursor);
|
|
1950
1981
|
}
|
|
1951
1982
|
};
|
|
1952
1983
|
|
|
1953
1984
|
const assign = (pointer, subject = undefined, value = undefined) => {
|
|
1954
|
-
const
|
|
1955
|
-
const fn = curry$a((subject, value) => _assign(
|
|
1985
|
+
const nextSegment = segmentGenerator(pointer);
|
|
1986
|
+
const fn = curry$a((subject, value) => _assign(nextSegment, subject, value, nil$2));
|
|
1956
1987
|
return subject === undefined ? fn : fn(subject, value);
|
|
1957
1988
|
};
|
|
1958
1989
|
|
|
1959
|
-
const _assign = (
|
|
1960
|
-
|
|
1990
|
+
const _assign = (nextSegment, subject, value, cursor) => {
|
|
1991
|
+
const segment = nextSegment();
|
|
1992
|
+
if (segment === undefined) {
|
|
1961
1993
|
return;
|
|
1962
|
-
} else if (
|
|
1963
|
-
|
|
1964
|
-
subject[segment] = value;
|
|
1994
|
+
} else if (!nextSegment(EXISTS) && !isScalar(subject)) {
|
|
1995
|
+
subject[computeSegment(subject, segment)] = value;
|
|
1965
1996
|
} else {
|
|
1966
|
-
|
|
1967
|
-
_assign(pointer, applySegment(subject, segment, cursor), value, append(segment, cursor));
|
|
1997
|
+
_assign(nextSegment, applySegment(subject, segment, cursor), value, append(segment, cursor));
|
|
1968
1998
|
}
|
|
1969
1999
|
};
|
|
1970
2000
|
|
|
1971
2001
|
const unset = (pointer, subject = undefined) => {
|
|
1972
|
-
const
|
|
1973
|
-
const fn = (subject) => _unset(
|
|
2002
|
+
const nextSegment = segmentGenerator(pointer);
|
|
2003
|
+
const fn = (subject) => _unset(nextSegment, subject, nil$2);
|
|
1974
2004
|
return subject === undefined ? fn : fn(subject);
|
|
1975
2005
|
};
|
|
1976
2006
|
|
|
1977
|
-
const _unset = (
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
2007
|
+
const _unset = (nextSegment, subject, cursor) => {
|
|
2008
|
+
const segment = nextSegment();
|
|
2009
|
+
if (segment === undefined) {
|
|
2010
|
+
return;
|
|
2011
|
+
} else if (nextSegment(EXISTS)) {
|
|
1982
2012
|
const value = applySegment(subject, segment, cursor);
|
|
1983
|
-
return { ...subject, [segment]: _unset(
|
|
2013
|
+
return { ...subject, [segment]: _unset(nextSegment, value, append(segment, cursor)) };
|
|
1984
2014
|
} else if (Array.isArray(subject)) {
|
|
1985
|
-
|
|
2015
|
+
const clonedSubject = [...subject];
|
|
2016
|
+
delete clonedSubject[computeSegment(subject, segment)];
|
|
2017
|
+
return clonedSubject;
|
|
1986
2018
|
} else if (typeof subject === "object" && subject !== null) {
|
|
1987
2019
|
// eslint-disable-next-line no-unused-vars
|
|
1988
|
-
const { [
|
|
2020
|
+
const { [segment]: _, ...result } = subject;
|
|
1989
2021
|
return result;
|
|
1990
2022
|
} else {
|
|
1991
|
-
return applySegment(subject,
|
|
2023
|
+
return applySegment(subject, segment, cursor);
|
|
1992
2024
|
}
|
|
1993
2025
|
};
|
|
1994
2026
|
|
|
1995
2027
|
const remove = (pointer, subject = undefined) => {
|
|
1996
|
-
const
|
|
1997
|
-
const fn = (subject) => _remove(
|
|
2028
|
+
const nextSegment = segmentGenerator(pointer);
|
|
2029
|
+
const fn = (subject) => _remove(nextSegment, subject, nil$2);
|
|
1998
2030
|
return subject === undefined ? fn : fn(subject);
|
|
1999
2031
|
};
|
|
2000
2032
|
|
|
2001
|
-
const _remove = (
|
|
2002
|
-
|
|
2033
|
+
const _remove = (nextSegment, subject, cursor) => {
|
|
2034
|
+
const segment = nextSegment();
|
|
2035
|
+
if (segment === undefined) {
|
|
2003
2036
|
return;
|
|
2004
|
-
} else if (
|
|
2005
|
-
const segment = pointer.shift();
|
|
2037
|
+
} else if (nextSegment(EXISTS)) {
|
|
2006
2038
|
const value = applySegment(subject, segment, cursor);
|
|
2007
|
-
_remove(
|
|
2008
|
-
} else if (
|
|
2009
|
-
subject
|
|
2010
|
-
} else if (typeof subject === "object" && subject !== null) {
|
|
2011
|
-
delete subject[pointer[0]];
|
|
2039
|
+
_remove(nextSegment, value, append(segment, cursor));
|
|
2040
|
+
} else if (!isScalar(subject)) {
|
|
2041
|
+
delete subject[segment];
|
|
2012
2042
|
} else {
|
|
2013
|
-
applySegment(subject,
|
|
2043
|
+
applySegment(subject, segment, cursor);
|
|
2014
2044
|
}
|
|
2015
2045
|
};
|
|
2016
2046
|
|
|
@@ -2231,7 +2261,11 @@ var lib$3 = {
|
|
|
2231
2261
|
allValues: allValues
|
|
2232
2262
|
};
|
|
2233
2263
|
|
|
2234
|
-
var
|
|
2264
|
+
var mooExports = {};
|
|
2265
|
+
var moo$1 = {
|
|
2266
|
+
get exports(){ return mooExports; },
|
|
2267
|
+
set exports(v){ mooExports = v; },
|
|
2268
|
+
};
|
|
2235
2269
|
|
|
2236
2270
|
(function (module) {
|
|
2237
2271
|
(function(root, factory) {
|
|
@@ -2875,7 +2909,7 @@ var moo$1 = {exports: {}};
|
|
|
2875
2909
|
}));
|
|
2876
2910
|
} (moo$1));
|
|
2877
2911
|
|
|
2878
|
-
const moo =
|
|
2912
|
+
const moo = mooExports;
|
|
2879
2913
|
|
|
2880
2914
|
|
|
2881
2915
|
const digit = `[0-9]`;
|
|
@@ -3138,8 +3172,8 @@ var contentType = {};
|
|
|
3138
3172
|
* obs-text = %x80-FF
|
|
3139
3173
|
* quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
|
|
3140
3174
|
*/
|
|
3141
|
-
var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g;
|
|
3142
|
-
var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/;
|
|
3175
|
+
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
|
|
3176
|
+
var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/; // eslint-disable-line no-control-regex
|
|
3143
3177
|
var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
3144
3178
|
|
|
3145
3179
|
/**
|
|
@@ -3148,7 +3182,7 @@ var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
|
3148
3182
|
* quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
|
|
3149
3183
|
* obs-text = %x80-FF
|
|
3150
3184
|
*/
|
|
3151
|
-
var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g;
|
|
3185
|
+
var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g; // eslint-disable-line no-control-regex
|
|
3152
3186
|
|
|
3153
3187
|
/**
|
|
3154
3188
|
* RegExp to match chars that must be quoted-pair in RFC 7230 sec 3.2.6
|
|
@@ -3237,7 +3271,7 @@ function parse$1 (string) {
|
|
|
3237
3271
|
|
|
3238
3272
|
var index = header.indexOf(';');
|
|
3239
3273
|
var type = index !== -1
|
|
3240
|
-
? header.
|
|
3274
|
+
? header.slice(0, index).trim()
|
|
3241
3275
|
: header.trim();
|
|
3242
3276
|
|
|
3243
3277
|
if (!TYPE_REGEXP.test(type)) {
|
|
@@ -3263,11 +3297,14 @@ function parse$1 (string) {
|
|
|
3263
3297
|
key = match[1].toLowerCase();
|
|
3264
3298
|
value = match[2];
|
|
3265
3299
|
|
|
3266
|
-
if (value
|
|
3267
|
-
// remove quotes
|
|
3268
|
-
value = value
|
|
3269
|
-
|
|
3270
|
-
|
|
3300
|
+
if (value.charCodeAt(0) === 0x22 /* " */) {
|
|
3301
|
+
// remove quotes
|
|
3302
|
+
value = value.slice(1, -1);
|
|
3303
|
+
|
|
3304
|
+
// remove escapes
|
|
3305
|
+
if (value.indexOf('\\') !== -1) {
|
|
3306
|
+
value = value.replace(QESC_REGEXP, '$1');
|
|
3307
|
+
}
|
|
3271
3308
|
}
|
|
3272
3309
|
|
|
3273
3310
|
obj.parameters[key] = value;
|
|
@@ -3716,13 +3753,13 @@ var schema$5 = {
|
|
|
3716
3753
|
toSchema
|
|
3717
3754
|
};
|
|
3718
3755
|
|
|
3719
|
-
|
|
3756
|
+
let InvalidSchemaError$3 = class InvalidSchemaError extends Error {
|
|
3720
3757
|
constructor(output) {
|
|
3721
3758
|
super("Invalid Schema");
|
|
3722
3759
|
this.name = this.constructor.name;
|
|
3723
3760
|
this.output = output;
|
|
3724
3761
|
}
|
|
3725
|
-
}
|
|
3762
|
+
};
|
|
3726
3763
|
|
|
3727
3764
|
var invalidSchemaError = InvalidSchemaError$3;
|
|
3728
3765
|
|
|
@@ -3735,7 +3772,7 @@ const interpret$M = () => true;
|
|
|
3735
3772
|
var metaData$4 = { compile: compile$M, interpret: interpret$M };
|
|
3736
3773
|
|
|
3737
3774
|
const curry = justCurryIt$1;
|
|
3738
|
-
const PubSub$1 =
|
|
3775
|
+
const PubSub$1 = pubsubExports;
|
|
3739
3776
|
const { resolveUrl } = common$1;
|
|
3740
3777
|
const Instance$C = instance;
|
|
3741
3778
|
const Schema$O = schema$5;
|
|
@@ -3824,7 +3861,13 @@ const setShouldMetaValidate = (isEnabled) => {
|
|
|
3824
3861
|
};
|
|
3825
3862
|
|
|
3826
3863
|
const _keywords = {};
|
|
3827
|
-
const getKeyword = (id) =>
|
|
3864
|
+
const getKeyword = (id) => {
|
|
3865
|
+
if (!_keywords[id]) {
|
|
3866
|
+
addKeyword(id, metaData$3);
|
|
3867
|
+
}
|
|
3868
|
+
|
|
3869
|
+
return _keywords[id];
|
|
3870
|
+
};
|
|
3828
3871
|
const hasKeyword = (id) => id in _keywords;
|
|
3829
3872
|
const addKeyword = (id, keywordHandler) => {
|
|
3830
3873
|
_keywords[id] = {
|
|
@@ -3941,7 +3984,7 @@ var core$2 = {
|
|
|
3941
3984
|
};
|
|
3942
3985
|
|
|
3943
3986
|
const Pact$9 = lib$3;
|
|
3944
|
-
const PubSub =
|
|
3987
|
+
const PubSub = pubsubExports;
|
|
3945
3988
|
const Core$x = core$2;
|
|
3946
3989
|
const Instance$B = instance;
|
|
3947
3990
|
const Schema$N = schema$5;
|
|
@@ -4102,7 +4145,16 @@ const interpret$I = ([numberOfItems, additionalItems], instance, ast, dynamicAnc
|
|
|
4102
4145
|
};
|
|
4103
4146
|
|
|
4104
4147
|
const collectEvaluatedItems$d = (keywordValue, instance, ast, dynamicAnchors) => {
|
|
4105
|
-
|
|
4148
|
+
if (!interpret$I(keywordValue, instance, ast, dynamicAnchors)) {
|
|
4149
|
+
return false;
|
|
4150
|
+
}
|
|
4151
|
+
|
|
4152
|
+
const evaluatedIndexes = new Set();
|
|
4153
|
+
for (let ndx = keywordValue[0]; ndx < Instance$y.length(instance); ndx++) {
|
|
4154
|
+
evaluatedIndexes.add(ndx);
|
|
4155
|
+
}
|
|
4156
|
+
|
|
4157
|
+
return evaluatedIndexes;
|
|
4106
4158
|
};
|
|
4107
4159
|
|
|
4108
4160
|
var additionalItems6 = { compile: compile$I, interpret: interpret$I, collectEvaluatedItems: collectEvaluatedItems$d };
|
|
@@ -4901,15 +4953,14 @@ const compile$7 = async (dynamicRef, ast) => {
|
|
|
4901
4953
|
const [, fragment] = splitUrl(Schema$d.value(dynamicRef));
|
|
4902
4954
|
const referencedSchema = await Schema$d.get(Schema$d.value(dynamicRef), dynamicRef);
|
|
4903
4955
|
await Core$a.compileSchema(referencedSchema, ast);
|
|
4904
|
-
return [referencedSchema.id, fragment];
|
|
4956
|
+
return [referencedSchema.id, fragment, Schema$d.uri(referencedSchema)];
|
|
4905
4957
|
};
|
|
4906
4958
|
|
|
4907
|
-
const interpret$7 = ([id, fragment], instance, ast, dynamicAnchors) => {
|
|
4959
|
+
const interpret$7 = ([id, fragment, ref], instance, ast, dynamicAnchors) => {
|
|
4908
4960
|
if (fragment in ast.metaData[id].dynamicAnchors) {
|
|
4909
4961
|
return Core$a.interpretSchema(dynamicAnchors[fragment], instance, ast, dynamicAnchors);
|
|
4910
4962
|
} else {
|
|
4911
|
-
|
|
4912
|
-
return Core$a.interpretSchema(`${id}#${encodeURI(pointer)}`, instance, ast, dynamicAnchors);
|
|
4963
|
+
return Core$a.interpretSchema(ref, instance, ast, dynamicAnchors);
|
|
4913
4964
|
}
|
|
4914
4965
|
};
|
|
4915
4966
|
|