@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-cjs.js
CHANGED
|
@@ -45,7 +45,11 @@ function curry$b(fn, arity) {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
var
|
|
48
|
+
var pubsubExports = {};
|
|
49
|
+
var pubsub = {
|
|
50
|
+
get exports(){ return pubsubExports; },
|
|
51
|
+
set exports(v){ pubsubExports = v; },
|
|
52
|
+
};
|
|
49
53
|
|
|
50
54
|
/**
|
|
51
55
|
* Copyright (c) 2010,2011,2012,2013,2014 Morgan Roderick http://roderick.dk
|
|
@@ -399,9 +403,13 @@ var pubsub = {exports: {}};
|
|
|
399
403
|
return result;
|
|
400
404
|
};
|
|
401
405
|
}));
|
|
402
|
-
} (pubsub,
|
|
406
|
+
} (pubsub, pubsubExports));
|
|
403
407
|
|
|
404
|
-
var
|
|
408
|
+
var uri_allExports = {};
|
|
409
|
+
var uri_all = {
|
|
410
|
+
get exports(){ return uri_allExports; },
|
|
411
|
+
set exports(v){ uri_allExports = v; },
|
|
412
|
+
};
|
|
405
413
|
|
|
406
414
|
/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
|
|
407
415
|
|
|
@@ -1807,9 +1815,9 @@ var uri_all = {exports: {}};
|
|
|
1807
1815
|
|
|
1808
1816
|
})));
|
|
1809
1817
|
|
|
1810
|
-
} (uri_all,
|
|
1818
|
+
} (uri_all, uri_allExports));
|
|
1811
1819
|
|
|
1812
|
-
const URI =
|
|
1820
|
+
const URI = uri_allExports;
|
|
1813
1821
|
|
|
1814
1822
|
|
|
1815
1823
|
const isObject$1 = (value) => typeof value === "object" && !Array.isArray(value) && value !== null;
|
|
@@ -1905,116 +1913,138 @@ const curry$a = justCurryIt$1;
|
|
|
1905
1913
|
|
|
1906
1914
|
const nil$2 = "";
|
|
1907
1915
|
|
|
1908
|
-
const
|
|
1916
|
+
const EXISTS = Symbol("EXISTS");
|
|
1917
|
+
|
|
1918
|
+
const segmentGenerator = (pointer) => {
|
|
1909
1919
|
if (pointer.length > 0 && pointer[0] !== "/") {
|
|
1910
1920
|
throw Error("Invalid JSON Pointer");
|
|
1911
1921
|
}
|
|
1912
1922
|
|
|
1913
|
-
|
|
1914
|
-
|
|
1923
|
+
let segmentStart = 1;
|
|
1924
|
+
let segmentEnd = 0;
|
|
1915
1925
|
|
|
1916
|
-
|
|
1917
|
-
|
|
1926
|
+
return (mode) => {
|
|
1927
|
+
if (mode === EXISTS) {
|
|
1928
|
+
return segmentEnd < pointer.length;
|
|
1929
|
+
}
|
|
1918
1930
|
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1931
|
+
if (segmentEnd >= pointer.length) {
|
|
1932
|
+
return;
|
|
1933
|
+
}
|
|
1934
|
+
|
|
1935
|
+
const position = pointer.indexOf("/", segmentStart);
|
|
1936
|
+
segmentEnd = position === -1 ? pointer.length : position;
|
|
1937
|
+
const segment = unescape(pointer.slice(segmentStart, segmentEnd));
|
|
1938
|
+
segmentStart = segmentEnd + 1;
|
|
1922
1939
|
|
|
1923
|
-
|
|
1940
|
+
return segment;
|
|
1941
|
+
};
|
|
1942
|
+
};
|
|
1943
|
+
|
|
1944
|
+
const get$2 = (pointer, subject = undefined) => {
|
|
1945
|
+
const nextSegment = segmentGenerator(pointer);
|
|
1946
|
+
const fn = (subject) => _get(nextSegment, subject, nil$2);
|
|
1947
|
+
return subject === undefined ? fn : fn(subject);
|
|
1948
|
+
};
|
|
1949
|
+
|
|
1950
|
+
const _get = (nextSegment, subject, cursor) => {
|
|
1951
|
+
if (!nextSegment(EXISTS)) {
|
|
1952
|
+
return subject;
|
|
1953
|
+
} else {
|
|
1954
|
+
const segment = nextSegment();
|
|
1955
|
+
return _get(nextSegment, applySegment(subject, segment, cursor), append(segment, cursor));
|
|
1956
|
+
}
|
|
1924
1957
|
};
|
|
1925
1958
|
|
|
1926
1959
|
const set = (pointer, subject = undefined, value = undefined) => {
|
|
1927
|
-
const
|
|
1928
|
-
const fn = curry$a((subject, value) => _set(
|
|
1960
|
+
const nextSegment = segmentGenerator(pointer);
|
|
1961
|
+
const fn = curry$a((subject, value) => _set(nextSegment, subject, value, nil$2));
|
|
1929
1962
|
return subject === undefined ? fn : fn(subject, value);
|
|
1930
1963
|
};
|
|
1931
1964
|
|
|
1932
|
-
const _set = (
|
|
1933
|
-
|
|
1965
|
+
const _set = (nextSegment, subject, value, cursor) => {
|
|
1966
|
+
const segment = nextSegment();
|
|
1967
|
+
if (segment === undefined) {
|
|
1934
1968
|
return value;
|
|
1935
|
-
} else if (
|
|
1969
|
+
} else if (nextSegment(EXISTS)) {
|
|
1936
1970
|
if (Array.isArray(subject)) {
|
|
1937
|
-
const index = pointer.shift();
|
|
1938
1971
|
const clonedSubject = [...subject];
|
|
1939
|
-
clonedSubject[
|
|
1972
|
+
clonedSubject[segment] = _set(nextSegment, applySegment(subject, segment, cursor), value, append(segment, cursor));
|
|
1940
1973
|
return clonedSubject;
|
|
1941
1974
|
} else {
|
|
1942
|
-
|
|
1943
|
-
return { ...subject, [segment]: _set(pointer, applySegment(subject, segment, cursor), value, append(segment, cursor)) };
|
|
1975
|
+
return { ...subject, [segment]: _set(nextSegment, applySegment(subject, segment, cursor), value, append(segment, cursor)) };
|
|
1944
1976
|
}
|
|
1945
1977
|
} else if (Array.isArray(subject)) {
|
|
1946
1978
|
const clonedSubject = [...subject];
|
|
1947
|
-
|
|
1948
|
-
clonedSubject[segment] = value;
|
|
1979
|
+
clonedSubject[computeSegment(subject, segment)] = value;
|
|
1949
1980
|
return clonedSubject;
|
|
1950
1981
|
} else if (typeof subject === "object" && subject !== null) {
|
|
1951
|
-
return { ...subject, [
|
|
1982
|
+
return { ...subject, [segment]: value };
|
|
1952
1983
|
} else {
|
|
1953
|
-
return applySegment(subject,
|
|
1984
|
+
return applySegment(subject, segment, cursor);
|
|
1954
1985
|
}
|
|
1955
1986
|
};
|
|
1956
1987
|
|
|
1957
1988
|
const assign = (pointer, subject = undefined, value = undefined) => {
|
|
1958
|
-
const
|
|
1959
|
-
const fn = curry$a((subject, value) => _assign(
|
|
1989
|
+
const nextSegment = segmentGenerator(pointer);
|
|
1990
|
+
const fn = curry$a((subject, value) => _assign(nextSegment, subject, value, nil$2));
|
|
1960
1991
|
return subject === undefined ? fn : fn(subject, value);
|
|
1961
1992
|
};
|
|
1962
1993
|
|
|
1963
|
-
const _assign = (
|
|
1964
|
-
|
|
1994
|
+
const _assign = (nextSegment, subject, value, cursor) => {
|
|
1995
|
+
const segment = nextSegment();
|
|
1996
|
+
if (segment === undefined) {
|
|
1965
1997
|
return;
|
|
1966
|
-
} else if (
|
|
1967
|
-
|
|
1968
|
-
subject[segment] = value;
|
|
1998
|
+
} else if (!nextSegment(EXISTS) && !isScalar(subject)) {
|
|
1999
|
+
subject[computeSegment(subject, segment)] = value;
|
|
1969
2000
|
} else {
|
|
1970
|
-
|
|
1971
|
-
_assign(pointer, applySegment(subject, segment, cursor), value, append(segment, cursor));
|
|
2001
|
+
_assign(nextSegment, applySegment(subject, segment, cursor), value, append(segment, cursor));
|
|
1972
2002
|
}
|
|
1973
2003
|
};
|
|
1974
2004
|
|
|
1975
2005
|
const unset = (pointer, subject = undefined) => {
|
|
1976
|
-
const
|
|
1977
|
-
const fn = (subject) => _unset(
|
|
2006
|
+
const nextSegment = segmentGenerator(pointer);
|
|
2007
|
+
const fn = (subject) => _unset(nextSegment, subject, nil$2);
|
|
1978
2008
|
return subject === undefined ? fn : fn(subject);
|
|
1979
2009
|
};
|
|
1980
2010
|
|
|
1981
|
-
const _unset = (
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
2011
|
+
const _unset = (nextSegment, subject, cursor) => {
|
|
2012
|
+
const segment = nextSegment();
|
|
2013
|
+
if (segment === undefined) {
|
|
2014
|
+
return;
|
|
2015
|
+
} else if (nextSegment(EXISTS)) {
|
|
1986
2016
|
const value = applySegment(subject, segment, cursor);
|
|
1987
|
-
return { ...subject, [segment]: _unset(
|
|
2017
|
+
return { ...subject, [segment]: _unset(nextSegment, value, append(segment, cursor)) };
|
|
1988
2018
|
} else if (Array.isArray(subject)) {
|
|
1989
|
-
|
|
2019
|
+
const clonedSubject = [...subject];
|
|
2020
|
+
delete clonedSubject[computeSegment(subject, segment)];
|
|
2021
|
+
return clonedSubject;
|
|
1990
2022
|
} else if (typeof subject === "object" && subject !== null) {
|
|
1991
2023
|
// eslint-disable-next-line no-unused-vars
|
|
1992
|
-
const { [
|
|
2024
|
+
const { [segment]: _, ...result } = subject;
|
|
1993
2025
|
return result;
|
|
1994
2026
|
} else {
|
|
1995
|
-
return applySegment(subject,
|
|
2027
|
+
return applySegment(subject, segment, cursor);
|
|
1996
2028
|
}
|
|
1997
2029
|
};
|
|
1998
2030
|
|
|
1999
2031
|
const remove = (pointer, subject = undefined) => {
|
|
2000
|
-
const
|
|
2001
|
-
const fn = (subject) => _remove(
|
|
2032
|
+
const nextSegment = segmentGenerator(pointer);
|
|
2033
|
+
const fn = (subject) => _remove(nextSegment, subject, nil$2);
|
|
2002
2034
|
return subject === undefined ? fn : fn(subject);
|
|
2003
2035
|
};
|
|
2004
2036
|
|
|
2005
|
-
const _remove = (
|
|
2006
|
-
|
|
2037
|
+
const _remove = (nextSegment, subject, cursor) => {
|
|
2038
|
+
const segment = nextSegment();
|
|
2039
|
+
if (segment === undefined) {
|
|
2007
2040
|
return;
|
|
2008
|
-
} else if (
|
|
2009
|
-
const segment = pointer.shift();
|
|
2041
|
+
} else if (nextSegment(EXISTS)) {
|
|
2010
2042
|
const value = applySegment(subject, segment, cursor);
|
|
2011
|
-
_remove(
|
|
2012
|
-
} else if (
|
|
2013
|
-
subject
|
|
2014
|
-
} else if (typeof subject === "object" && subject !== null) {
|
|
2015
|
-
delete subject[pointer[0]];
|
|
2043
|
+
_remove(nextSegment, value, append(segment, cursor));
|
|
2044
|
+
} else if (!isScalar(subject)) {
|
|
2045
|
+
delete subject[segment];
|
|
2016
2046
|
} else {
|
|
2017
|
-
applySegment(subject,
|
|
2047
|
+
applySegment(subject, segment, cursor);
|
|
2018
2048
|
}
|
|
2019
2049
|
};
|
|
2020
2050
|
|
|
@@ -2235,7 +2265,11 @@ var lib$3 = {
|
|
|
2235
2265
|
allValues: allValues
|
|
2236
2266
|
};
|
|
2237
2267
|
|
|
2238
|
-
var
|
|
2268
|
+
var mooExports = {};
|
|
2269
|
+
var moo$1 = {
|
|
2270
|
+
get exports(){ return mooExports; },
|
|
2271
|
+
set exports(v){ mooExports = v; },
|
|
2272
|
+
};
|
|
2239
2273
|
|
|
2240
2274
|
(function (module) {
|
|
2241
2275
|
(function(root, factory) {
|
|
@@ -2879,7 +2913,7 @@ var moo$1 = {exports: {}};
|
|
|
2879
2913
|
}));
|
|
2880
2914
|
} (moo$1));
|
|
2881
2915
|
|
|
2882
|
-
const moo =
|
|
2916
|
+
const moo = mooExports;
|
|
2883
2917
|
|
|
2884
2918
|
|
|
2885
2919
|
const digit = `[0-9]`;
|
|
@@ -3142,8 +3176,8 @@ var contentType = {};
|
|
|
3142
3176
|
* obs-text = %x80-FF
|
|
3143
3177
|
* quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
|
|
3144
3178
|
*/
|
|
3145
|
-
var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g;
|
|
3146
|
-
var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/;
|
|
3179
|
+
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
|
|
3180
|
+
var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/; // eslint-disable-line no-control-regex
|
|
3147
3181
|
var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
3148
3182
|
|
|
3149
3183
|
/**
|
|
@@ -3152,7 +3186,7 @@ var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
|
3152
3186
|
* quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text )
|
|
3153
3187
|
* obs-text = %x80-FF
|
|
3154
3188
|
*/
|
|
3155
|
-
var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g;
|
|
3189
|
+
var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g; // eslint-disable-line no-control-regex
|
|
3156
3190
|
|
|
3157
3191
|
/**
|
|
3158
3192
|
* RegExp to match chars that must be quoted-pair in RFC 7230 sec 3.2.6
|
|
@@ -3241,7 +3275,7 @@ function parse$1 (string) {
|
|
|
3241
3275
|
|
|
3242
3276
|
var index = header.indexOf(';');
|
|
3243
3277
|
var type = index !== -1
|
|
3244
|
-
? header.
|
|
3278
|
+
? header.slice(0, index).trim()
|
|
3245
3279
|
: header.trim();
|
|
3246
3280
|
|
|
3247
3281
|
if (!TYPE_REGEXP.test(type)) {
|
|
@@ -3267,11 +3301,14 @@ function parse$1 (string) {
|
|
|
3267
3301
|
key = match[1].toLowerCase();
|
|
3268
3302
|
value = match[2];
|
|
3269
3303
|
|
|
3270
|
-
if (value
|
|
3271
|
-
// remove quotes
|
|
3272
|
-
value = value
|
|
3273
|
-
|
|
3274
|
-
|
|
3304
|
+
if (value.charCodeAt(0) === 0x22 /* " */) {
|
|
3305
|
+
// remove quotes
|
|
3306
|
+
value = value.slice(1, -1);
|
|
3307
|
+
|
|
3308
|
+
// remove escapes
|
|
3309
|
+
if (value.indexOf('\\') !== -1) {
|
|
3310
|
+
value = value.replace(QESC_REGEXP, '$1');
|
|
3311
|
+
}
|
|
3275
3312
|
}
|
|
3276
3313
|
|
|
3277
3314
|
obj.parameters[key] = value;
|
|
@@ -3720,13 +3757,13 @@ var schema$5 = {
|
|
|
3720
3757
|
toSchema
|
|
3721
3758
|
};
|
|
3722
3759
|
|
|
3723
|
-
|
|
3760
|
+
let InvalidSchemaError$3 = class InvalidSchemaError extends Error {
|
|
3724
3761
|
constructor(output) {
|
|
3725
3762
|
super("Invalid Schema");
|
|
3726
3763
|
this.name = this.constructor.name;
|
|
3727
3764
|
this.output = output;
|
|
3728
3765
|
}
|
|
3729
|
-
}
|
|
3766
|
+
};
|
|
3730
3767
|
|
|
3731
3768
|
var invalidSchemaError = InvalidSchemaError$3;
|
|
3732
3769
|
|
|
@@ -3739,7 +3776,7 @@ const interpret$M = () => true;
|
|
|
3739
3776
|
var metaData$4 = { compile: compile$M, interpret: interpret$M };
|
|
3740
3777
|
|
|
3741
3778
|
const curry = justCurryIt$1;
|
|
3742
|
-
const PubSub$1 =
|
|
3779
|
+
const PubSub$1 = pubsubExports;
|
|
3743
3780
|
const { resolveUrl } = common$1;
|
|
3744
3781
|
const Instance$C = instance;
|
|
3745
3782
|
const Schema$O = schema$5;
|
|
@@ -3828,7 +3865,13 @@ const setShouldMetaValidate = (isEnabled) => {
|
|
|
3828
3865
|
};
|
|
3829
3866
|
|
|
3830
3867
|
const _keywords = {};
|
|
3831
|
-
const getKeyword = (id) =>
|
|
3868
|
+
const getKeyword = (id) => {
|
|
3869
|
+
if (!_keywords[id]) {
|
|
3870
|
+
addKeyword(id, metaData$3);
|
|
3871
|
+
}
|
|
3872
|
+
|
|
3873
|
+
return _keywords[id];
|
|
3874
|
+
};
|
|
3832
3875
|
const hasKeyword = (id) => id in _keywords;
|
|
3833
3876
|
const addKeyword = (id, keywordHandler) => {
|
|
3834
3877
|
_keywords[id] = {
|
|
@@ -3945,7 +3988,7 @@ var core$2 = {
|
|
|
3945
3988
|
};
|
|
3946
3989
|
|
|
3947
3990
|
const Pact$9 = lib$3;
|
|
3948
|
-
const PubSub =
|
|
3991
|
+
const PubSub = pubsubExports;
|
|
3949
3992
|
const Core$x = core$2;
|
|
3950
3993
|
const Instance$B = instance;
|
|
3951
3994
|
const Schema$N = schema$5;
|
|
@@ -4106,7 +4149,16 @@ const interpret$I = ([numberOfItems, additionalItems], instance, ast, dynamicAnc
|
|
|
4106
4149
|
};
|
|
4107
4150
|
|
|
4108
4151
|
const collectEvaluatedItems$d = (keywordValue, instance, ast, dynamicAnchors) => {
|
|
4109
|
-
|
|
4152
|
+
if (!interpret$I(keywordValue, instance, ast, dynamicAnchors)) {
|
|
4153
|
+
return false;
|
|
4154
|
+
}
|
|
4155
|
+
|
|
4156
|
+
const evaluatedIndexes = new Set();
|
|
4157
|
+
for (let ndx = keywordValue[0]; ndx < Instance$y.length(instance); ndx++) {
|
|
4158
|
+
evaluatedIndexes.add(ndx);
|
|
4159
|
+
}
|
|
4160
|
+
|
|
4161
|
+
return evaluatedIndexes;
|
|
4110
4162
|
};
|
|
4111
4163
|
|
|
4112
4164
|
var additionalItems6 = { compile: compile$I, interpret: interpret$I, collectEvaluatedItems: collectEvaluatedItems$d };
|
|
@@ -4905,15 +4957,14 @@ const compile$7 = async (dynamicRef, ast) => {
|
|
|
4905
4957
|
const [, fragment] = splitUrl(Schema$d.value(dynamicRef));
|
|
4906
4958
|
const referencedSchema = await Schema$d.get(Schema$d.value(dynamicRef), dynamicRef);
|
|
4907
4959
|
await Core$a.compileSchema(referencedSchema, ast);
|
|
4908
|
-
return [referencedSchema.id, fragment];
|
|
4960
|
+
return [referencedSchema.id, fragment, Schema$d.uri(referencedSchema)];
|
|
4909
4961
|
};
|
|
4910
4962
|
|
|
4911
|
-
const interpret$7 = ([id, fragment], instance, ast, dynamicAnchors) => {
|
|
4963
|
+
const interpret$7 = ([id, fragment, ref], instance, ast, dynamicAnchors) => {
|
|
4912
4964
|
if (fragment in ast.metaData[id].dynamicAnchors) {
|
|
4913
4965
|
return Core$a.interpretSchema(dynamicAnchors[fragment], instance, ast, dynamicAnchors);
|
|
4914
4966
|
} else {
|
|
4915
|
-
|
|
4916
|
-
return Core$a.interpretSchema(`${id}#${encodeURI(pointer)}`, instance, ast, dynamicAnchors);
|
|
4967
|
+
return Core$a.interpretSchema(ref, instance, ast, dynamicAnchors);
|
|
4917
4968
|
}
|
|
4918
4969
|
};
|
|
4919
4970
|
|
|
@@ -6638,5 +6689,5 @@ var lib = {
|
|
|
6638
6689
|
InvalidSchemaError: InvalidSchemaError
|
|
6639
6690
|
};
|
|
6640
6691
|
|
|
6641
|
-
exports
|
|
6692
|
+
exports.default = lib;
|
|
6642
6693
|
//# sourceMappingURL=json-schema-cjs.js.map
|