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