@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-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
|
+
}
|
|
1920
1932
|
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1933
|
+
if (segmentEnd >= pointer.length) {
|
|
1934
|
+
return;
|
|
1935
|
+
}
|
|
1936
|
+
|
|
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;
|
|
1924
1941
|
|
|
1925
|
-
|
|
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
|
+
};
|
|
1951
|
+
|
|
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) {
|
|
@@ -2881,7 +2915,7 @@
|
|
|
2881
2915
|
}));
|
|
2882
2916
|
} (moo$1));
|
|
2883
2917
|
|
|
2884
|
-
const moo =
|
|
2918
|
+
const moo = mooExports;
|
|
2885
2919
|
|
|
2886
2920
|
|
|
2887
2921
|
const digit = `[0-9]`;
|
|
@@ -3144,8 +3178,8 @@
|
|
|
3144
3178
|
* obs-text = %x80-FF
|
|
3145
3179
|
* quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
|
|
3146
3180
|
*/
|
|
3147
|
-
var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g;
|
|
3148
|
-
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
|
|
3149
3183
|
var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
3150
3184
|
|
|
3151
3185
|
/**
|
|
@@ -3154,7 +3188,7 @@
|
|
|
3154
3188
|
* quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
|
|
3155
3189
|
* obs-text = %x80-FF
|
|
3156
3190
|
*/
|
|
3157
|
-
var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g;
|
|
3191
|
+
var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g; // eslint-disable-line no-control-regex
|
|
3158
3192
|
|
|
3159
3193
|
/**
|
|
3160
3194
|
* RegExp to match chars that must be quoted-pair in RFC 7230 sec 3.2.6
|
|
@@ -3243,7 +3277,7 @@
|
|
|
3243
3277
|
|
|
3244
3278
|
var index = header.indexOf(';');
|
|
3245
3279
|
var type = index !== -1
|
|
3246
|
-
? header.
|
|
3280
|
+
? header.slice(0, index).trim()
|
|
3247
3281
|
: header.trim();
|
|
3248
3282
|
|
|
3249
3283
|
if (!TYPE_REGEXP.test(type)) {
|
|
@@ -3269,11 +3303,14 @@
|
|
|
3269
3303
|
key = match[1].toLowerCase();
|
|
3270
3304
|
value = match[2];
|
|
3271
3305
|
|
|
3272
|
-
if (value
|
|
3273
|
-
// remove quotes
|
|
3274
|
-
value = value
|
|
3275
|
-
|
|
3276
|
-
|
|
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
|
+
}
|
|
3277
3314
|
}
|
|
3278
3315
|
|
|
3279
3316
|
obj.parameters[key] = value;
|
|
@@ -3722,13 +3759,13 @@
|
|
|
3722
3759
|
toSchema
|
|
3723
3760
|
};
|
|
3724
3761
|
|
|
3725
|
-
|
|
3762
|
+
let InvalidSchemaError$3 = class InvalidSchemaError extends Error {
|
|
3726
3763
|
constructor(output) {
|
|
3727
3764
|
super("Invalid Schema");
|
|
3728
3765
|
this.name = this.constructor.name;
|
|
3729
3766
|
this.output = output;
|
|
3730
3767
|
}
|
|
3731
|
-
}
|
|
3768
|
+
};
|
|
3732
3769
|
|
|
3733
3770
|
var invalidSchemaError = InvalidSchemaError$3;
|
|
3734
3771
|
|
|
@@ -3741,7 +3778,7 @@
|
|
|
3741
3778
|
var metaData$4 = { compile: compile$M, interpret: interpret$M };
|
|
3742
3779
|
|
|
3743
3780
|
const curry = justCurryIt$1;
|
|
3744
|
-
const PubSub$1 =
|
|
3781
|
+
const PubSub$1 = pubsubExports;
|
|
3745
3782
|
const { resolveUrl } = common$1;
|
|
3746
3783
|
const Instance$C = instance;
|
|
3747
3784
|
const Schema$O = schema$5;
|
|
@@ -3830,7 +3867,13 @@
|
|
|
3830
3867
|
};
|
|
3831
3868
|
|
|
3832
3869
|
const _keywords = {};
|
|
3833
|
-
const getKeyword = (id) =>
|
|
3870
|
+
const getKeyword = (id) => {
|
|
3871
|
+
if (!_keywords[id]) {
|
|
3872
|
+
addKeyword(id, metaData$3);
|
|
3873
|
+
}
|
|
3874
|
+
|
|
3875
|
+
return _keywords[id];
|
|
3876
|
+
};
|
|
3834
3877
|
const hasKeyword = (id) => id in _keywords;
|
|
3835
3878
|
const addKeyword = (id, keywordHandler) => {
|
|
3836
3879
|
_keywords[id] = {
|
|
@@ -3947,7 +3990,7 @@
|
|
|
3947
3990
|
};
|
|
3948
3991
|
|
|
3949
3992
|
const Pact$9 = lib$3;
|
|
3950
|
-
const PubSub =
|
|
3993
|
+
const PubSub = pubsubExports;
|
|
3951
3994
|
const Core$x = core$2;
|
|
3952
3995
|
const Instance$B = instance;
|
|
3953
3996
|
const Schema$N = schema$5;
|
|
@@ -4108,7 +4151,16 @@
|
|
|
4108
4151
|
};
|
|
4109
4152
|
|
|
4110
4153
|
const collectEvaluatedItems$d = (keywordValue, instance, ast, dynamicAnchors) => {
|
|
4111
|
-
|
|
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;
|
|
4112
4164
|
};
|
|
4113
4165
|
|
|
4114
4166
|
var additionalItems6 = { compile: compile$I, interpret: interpret$I, collectEvaluatedItems: collectEvaluatedItems$d };
|
|
@@ -4907,15 +4959,14 @@
|
|
|
4907
4959
|
const [, fragment] = splitUrl(Schema$d.value(dynamicRef));
|
|
4908
4960
|
const referencedSchema = await Schema$d.get(Schema$d.value(dynamicRef), dynamicRef);
|
|
4909
4961
|
await Core$a.compileSchema(referencedSchema, ast);
|
|
4910
|
-
return [referencedSchema.id, fragment];
|
|
4962
|
+
return [referencedSchema.id, fragment, Schema$d.uri(referencedSchema)];
|
|
4911
4963
|
};
|
|
4912
4964
|
|
|
4913
|
-
const interpret$7 = ([id, fragment], instance, ast, dynamicAnchors) => {
|
|
4965
|
+
const interpret$7 = ([id, fragment, ref], instance, ast, dynamicAnchors) => {
|
|
4914
4966
|
if (fragment in ast.metaData[id].dynamicAnchors) {
|
|
4915
4967
|
return Core$a.interpretSchema(dynamicAnchors[fragment], instance, ast, dynamicAnchors);
|
|
4916
4968
|
} else {
|
|
4917
|
-
|
|
4918
|
-
return Core$a.interpretSchema(`${id}#${encodeURI(pointer)}`, instance, ast, dynamicAnchors);
|
|
4969
|
+
return Core$a.interpretSchema(ref, instance, ast, dynamicAnchors);
|
|
4919
4970
|
}
|
|
4920
4971
|
};
|
|
4921
4972
|
|
|
@@ -6640,7 +6691,7 @@
|
|
|
6640
6691
|
InvalidSchemaError: InvalidSchemaError
|
|
6641
6692
|
};
|
|
6642
6693
|
|
|
6643
|
-
exports
|
|
6694
|
+
exports.default = lib;
|
|
6644
6695
|
|
|
6645
6696
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
6646
6697
|
|